From patchwork Wed Dec 21 10:48:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 13078638 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D73DC10F1B for ; Wed, 21 Dec 2022 10:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234589AbiLUKsP (ORCPT ); Wed, 21 Dec 2022 05:48:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229612AbiLUKsK (ORCPT ); Wed, 21 Dec 2022 05:48:10 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20C876394 for ; Wed, 21 Dec 2022 02:48:10 -0800 (PST) Received: from dude05.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::54]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1p7wds-00065f-9P; Wed, 21 Dec 2022 11:48:08 +0100 From: Philipp Zabel To: Johannes Berg Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, kernel@pengutronix.de, Philipp Zabel Subject: [PATCH 1/2] dt-bindings: net: Add rfkill-gpio binding Date: Wed, 21 Dec 2022 11:48:02 +0100 Message-Id: <20221221104803.1693874-1-p.zabel@pengutronix.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::54 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: netdev@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add a device tree binding document for GPIO controlled rfkill switches. The name, type, shutdown-gpios and reset-gpios properties are the same as defined for ACPI. Signed-off-by: Philipp Zabel --- .../devicetree/bindings/net/rfkill-gpio.yaml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/rfkill-gpio.yaml diff --git a/Documentation/devicetree/bindings/net/rfkill-gpio.yaml b/Documentation/devicetree/bindings/net/rfkill-gpio.yaml new file mode 100644 index 000000000000..6e62e6c96456 --- /dev/null +++ b/Documentation/devicetree/bindings/net/rfkill-gpio.yaml @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/net/rfkill-gpio.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: GPIO controlled rfkill switch + +maintainers: + - Johannes Berg + - Philipp Zabel + +properties: + compatible: + const: rfkill-gpio + + name: + $ref: /schemas/types.yaml#/definitions/string + description: rfkill switch name, defaults to node name + + type: + description: rfkill radio type + enum: + - wlan + - bluetooth + - ultrawideband + - wimax + - wwan + - gps + - fm + - nfc + + shutdown-gpios: + maxItems: 1 + + reset-gpios: + maxItems: 1 + +required: + - compatible + - type + +oneOf: + - required: + - shutdown-gpios + - required: + - reset-gpios + +additionalProperties: false + +examples: + - | + #include + + rfkill-pcie-wlan { + compatible = "rfkill-gpio"; + name = "rfkill-pcie-wlan"; + type = "wlan"; + shutdown-gpios = <&gpio2 25 GPIO_ACTIVE_HIGH>; + }; From patchwork Wed Dec 21 10:48:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 13078639 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 460D6C4332F for ; Wed, 21 Dec 2022 10:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234603AbiLUKsR (ORCPT ); Wed, 21 Dec 2022 05:48:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234534AbiLUKsM (ORCPT ); Wed, 21 Dec 2022 05:48:12 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 459D86394 for ; Wed, 21 Dec 2022 02:48:12 -0800 (PST) Received: from dude05.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::54]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1p7wdu-00065f-I0; Wed, 21 Dec 2022 11:48:10 +0100 From: Philipp Zabel To: Johannes Berg Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, kernel@pengutronix.de, Philipp Zabel Subject: [PATCH 2/2] net: rfkill: gpio: add DT support Date: Wed, 21 Dec 2022 11:48:03 +0100 Message-Id: <20221221104803.1693874-2-p.zabel@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221221104803.1693874-1-p.zabel@pengutronix.de> References: <20221221104803.1693874-1-p.zabel@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::54 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: netdev@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Allow probing rfkill-gpio via device tree. This just hooks up the already existing support that was started in commit 262c91ee5e52 ("net: rfkill: gpio: prepare for DT and ACPI support") via the "rfkill-gpio" compatible. Signed-off-by: Philipp Zabel --- net/rfkill/rfkill-gpio.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index f5afc9bcdee6..9f763654cd27 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -157,12 +157,21 @@ static const struct acpi_device_id rfkill_acpi_match[] = { MODULE_DEVICE_TABLE(acpi, rfkill_acpi_match); #endif +#ifdef CONFIG_OF +static const struct of_device_id rfkill_of_match[] = { + { .compatible = "rfkill-gpio", }, + { }, +}; +MODULE_DEVICE_TABLE(of, rfkill_of_match); +#endif + static struct platform_driver rfkill_gpio_driver = { .probe = rfkill_gpio_probe, .remove = rfkill_gpio_remove, .driver = { .name = "rfkill_gpio", .acpi_match_table = ACPI_PTR(rfkill_acpi_match), + .of_match_table = of_match_ptr(rfkill_of_match), }, };