public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
@ 2024-06-27  4:46 Dmitry Torokhov
  2024-06-28 15:35 ` Thierry Reding
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2024-06-27  4:46 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Russell King, Jonathan Hunter, linux-arm-kernel, linux-tegra,
	linux-kernel

Complete conversion of the WiFi rfkill device to use device
properties/software nodes by utilizing PROPERTY_ENTRY_GPIO() instead of
a lookup table.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

Compiled only, no real hardware to test.

 arch/arm/mach-tegra/board-paz00.c | 50 ++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 18d37f90cdfe..3ec810b6f1a7 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -8,35 +8,49 @@
  * Copyright (C) 2010 Google, Inc.
  */
 
-#include <linux/property.h>
+#include <linux/err.h>
 #include <linux/gpio/machine.h>
+#include <linux/gpio/property.h>
 #include <linux/platform_device.h>
+#include <linux/printk.h>
+#include <linux/property.h>
 
 #include "board.h"
 
-static struct property_entry wifi_rfkill_prop[] __initdata = {
-	PROPERTY_ENTRY_STRING("name", "wifi_rfkill"),
-	PROPERTY_ENTRY_STRING("type", "wlan"),
-	{ },
+static const struct software_node tegra_gpiochip_node = {
+	.name	= "tegra-gpio",
 };
 
-static struct platform_device wifi_rfkill_device = {
-	.name	= "rfkill_gpio",
-	.id	= -1,
+static const struct property_entry wifi_rfkill_prop[] __initconst = {
+	PROPERTY_ENTRY_STRING("name", "wifi_rfkill"),
+	PROPERTY_ENTRY_STRING("type", "wlan"),
+	PROPERTY_ENTRY_GPIO("reset-gpios",
+			    &tegra_gpiochip_node, 25, GPIO_ACTIVE_HIGH),
+	PROPERTY_ENTRY_GPIO("shutdown-gpios",
+			    &tegra_gpiochip_node, 85, GPIO_ACTIVE_HIGH),
+	{ }
 };
 
-static struct gpiod_lookup_table wifi_gpio_lookup = {
-	.dev_id = "rfkill_gpio",
-	.table = {
-		GPIO_LOOKUP("tegra-gpio", 25, "reset", 0),
-		GPIO_LOOKUP("tegra-gpio", 85, "shutdown", 0),
-		{ },
-	},
+static const struct platform_device_info wifi_rfkill_info __initconst = {
+	.name		= "rfkill_gpio",
+	.id		= PLATFORM_DEVID_NONE,
+	.properties	= wifi_rfkill_prop,
 };
 
 void __init tegra_paz00_wifikill_init(void)
 {
-	device_create_managed_software_node(&wifi_rfkill_device.dev, wifi_rfkill_prop, NULL);
-	gpiod_add_lookup_table(&wifi_gpio_lookup);
-	platform_device_register(&wifi_rfkill_device);
+	struct platform_device *pd;
+	int err;
+
+	err = software_node_register(&tegra_gpiochip_node);
+	if (err) {
+		pr_err("failed to register %s node: %d\n",
+		       tegra_gpiochip_node.name, err);
+		return;
+	}
+
+	pd = platform_device_register_full(&wifi_rfkill_info);
+	err = PTR_ERR_OR_ZERO(pd);
+	if (err)
+		pr_err("failed to register WiFi rfkill device: %d\n", err);
 }
-- 
2.45.2.741.gdbec12cfda-goog


-- 
Dmitry

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
  2024-06-27  4:46 [PATCH] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill Dmitry Torokhov
@ 2024-06-28 15:35 ` Thierry Reding
  2026-02-12  3:22   ` Dmitry Torokhov
  0 siblings, 1 reply; 7+ messages in thread
From: Thierry Reding @ 2024-06-28 15:35 UTC (permalink / raw)
  To: Thierry Reding, Dmitry Torokhov
  Cc: Russell King, Jonathan Hunter, linux-arm-kernel, linux-tegra,
	linux-kernel

From: Thierry Reding <treding@nvidia.com>


On Wed, 26 Jun 2024 21:46:13 -0700, Dmitry Torokhov wrote:
> Complete conversion of the WiFi rfkill device to use device
> properties/software nodes by utilizing PROPERTY_ENTRY_GPIO() instead of
> a lookup table.
> 
> 

Applied, thanks!

[1/1] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
      commit: 47ac458bb229f8c4864081d173adbcfc55c34880

Best regards,
-- 
Thierry Reding <treding@nvidia.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
  2024-06-28 15:35 ` Thierry Reding
@ 2026-02-12  3:22   ` Dmitry Torokhov
  2026-02-14 14:26     ` Marc Dietrich
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2026-02-12  3:22 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Russell King, Jonathan Hunter, linux-arm-kernel, linux-tegra,
	linux-kernel

Hi Thierry,

On Fri, Jun 28, 2024 at 05:35:08PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> 
> On Wed, 26 Jun 2024 21:46:13 -0700, Dmitry Torokhov wrote:
> > Complete conversion of the WiFi rfkill device to use device
> > properties/software nodes by utilizing PROPERTY_ENTRY_GPIO() instead of
> > a lookup table.
> > 
> > 
> 
> Applied, thanks!
> 
> [1/1] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
>       commit: 47ac458bb229f8c4864081d173adbcfc55c34880

Do you know by any chance why paz00 does not simply configure rfkill
switch via device tree? The driver (rfkill-gpio) seem to support device
tree...

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
  2026-02-12  3:22   ` Dmitry Torokhov
@ 2026-02-14 14:26     ` Marc Dietrich
  2026-02-14 14:49       ` Chen-Yu Tsai
  0 siblings, 1 reply; 7+ messages in thread
From: Marc Dietrich @ 2026-02-14 14:26 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Thierry Reding, Russell King, Jonathan Hunter, linux-arm-kernel,
	linux-tegra, linux-kernel

Hi Dimitry,

On Wed, 11 Feb 2026, Dmitry Torokhov wrote:

> Hi Thierry,
>
> On Fri, Jun 28, 2024 at 05:35:08PM +0200, Thierry Reding wrote:
>> From: Thierry Reding <treding@nvidia.com>
>>
>>
>> On Wed, 26 Jun 2024 21:46:13 -0700, Dmitry Torokhov wrote:
>>> Complete conversion of the WiFi rfkill device to use device
>>> properties/software nodes by utilizing PROPERTY_ENTRY_GPIO() instead of
>>> a lookup table.
>>>
>>>
>>
>> Applied, thanks!
>>
>> [1/1] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
>>       commit: 47ac458bb229f8c4864081d173adbcfc55c34880
>
> Do you know by any chance why paz00 does not simply configure rfkill
> switch via device tree? The driver (rfkill-gpio) seem to support device
> tree...

last time I tried this was rejected because the wifi chip is on the usb 
bus and "rfkill" should be a sub-function of this chip [1], but that was 
some time ago...

Looking hard the schematics, the wifi chip does not have a gpio input as 
first thought. Rather it seems that the first gpio toggles a regulator 
which supplies the wifi module (m2 card) with power and the second gpio is 
just connected to the wifi LED.

Not sure how to transfer this into dt, but I guess this would be the 
better solution.

Marc

  [1] 
https://linux-tegra.vger.kernel.narkive.com/hRFke8jh/patch-1-3-net-rfkill-gpio-add-device-tree-support

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
  2026-02-14 14:26     ` Marc Dietrich
@ 2026-02-14 14:49       ` Chen-Yu Tsai
  2026-02-14 20:40         ` Marc Dietrich
  0 siblings, 1 reply; 7+ messages in thread
From: Chen-Yu Tsai @ 2026-02-14 14:49 UTC (permalink / raw)
  To: Marc Dietrich
  Cc: Dmitry Torokhov, Thierry Reding, Russell King, Jonathan Hunter,
	linux-arm-kernel, linux-tegra, linux-kernel

On Sat, Feb 14, 2026 at 10:27 PM Marc Dietrich <marvin24@gmx.de> wrote:
>
> Hi Dimitry,
>
> On Wed, 11 Feb 2026, Dmitry Torokhov wrote:
>
> > Hi Thierry,
> >
> > On Fri, Jun 28, 2024 at 05:35:08PM +0200, Thierry Reding wrote:
> >> From: Thierry Reding <treding@nvidia.com>
> >>
> >>
> >> On Wed, 26 Jun 2024 21:46:13 -0700, Dmitry Torokhov wrote:
> >>> Complete conversion of the WiFi rfkill device to use device
> >>> properties/software nodes by utilizing PROPERTY_ENTRY_GPIO() instead of
> >>> a lookup table.
> >>>
> >>>
> >>
> >> Applied, thanks!
> >>
> >> [1/1] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
> >>       commit: 47ac458bb229f8c4864081d173adbcfc55c34880
> >
> > Do you know by any chance why paz00 does not simply configure rfkill
> > switch via device tree? The driver (rfkill-gpio) seem to support device
> > tree...
>
> last time I tried this was rejected because the wifi chip is on the usb
> bus and "rfkill" should be a sub-function of this chip [1], but that was
> some time ago...
>
> Looking hard the schematics, the wifi chip does not have a gpio input as
> first thought. Rather it seems that the first gpio toggles a regulator
> which supplies the wifi module (m2 card) with power and the second gpio is
> just connected to the wifi LED.
>
> Not sure how to transfer this into dt, but I guess this would be the
> better solution.

Then the first GPIO should probably just be described as a fixed regulator
feeding the USB controller that the M.2 module is connected to.

There's also a WIP M.2 E-key binding and driver, but AFAIK that doesn't
actually implement USB support.

The second one could be just a GPIO-driver LED with a netdev trigger?


ChenYu

> Marc
>
>   [1]
> https://linux-tegra.vger.kernel.narkive.com/hRFke8jh/patch-1-3-net-rfkill-gpio-add-device-tree-support
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
  2026-02-14 14:49       ` Chen-Yu Tsai
@ 2026-02-14 20:40         ` Marc Dietrich
  2026-02-23  9:27           ` Chen-Yu Tsai
  0 siblings, 1 reply; 7+ messages in thread
From: Marc Dietrich @ 2026-02-14 20:40 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Dmitry Torokhov, Thierry Reding, Russell King, Jonathan Hunter,
	linux-arm-kernel, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1920 bytes --]

Hallo Chen-Yu,

On Sat, 14 Feb 2026, Chen-Yu Tsai wrote:

> On Sat, Feb 14, 2026 at 10:27 PM Marc Dietrich <marvin24@gmx.de> wrote:
>>
>> Hi Dimitry,
>>
>> On Wed, 11 Feb 2026, Dmitry Torokhov wrote:
>>
>>> Hi Thierry,
>>>
>>> On Fri, Jun 28, 2024 at 05:35:08PM +0200, Thierry Reding wrote:
>>>> From: Thierry Reding <treding@nvidia.com>
>>>>
>>>>
>>>> On Wed, 26 Jun 2024 21:46:13 -0700, Dmitry Torokhov wrote:
>>>>> Complete conversion of the WiFi rfkill device to use device
>>>>> properties/software nodes by utilizing PROPERTY_ENTRY_GPIO() instead of
>>>>> a lookup table.
>>>>>
>>>>>
>>>>
>>>> Applied, thanks!
>>>>
>>>> [1/1] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
>>>>       commit: 47ac458bb229f8c4864081d173adbcfc55c34880
>>>
>>> Do you know by any chance why paz00 does not simply configure rfkill
>>> switch via device tree? The driver (rfkill-gpio) seem to support device
>>> tree...
>>
>> last time I tried this was rejected because the wifi chip is on the usb
>> bus and "rfkill" should be a sub-function of this chip [1], but that was
>> some time ago...
>>
>> Looking hard the schematics, the wifi chip does not have a gpio input as
>> first thought. Rather it seems that the first gpio toggles a regulator
>> which supplies the wifi module (m2 card) with power and the second gpio is
>> just connected to the wifi LED.
>>
>> Not sure how to transfer this into dt, but I guess this would be the
>> better solution.
>
> Then the first GPIO should probably just be described as a fixed regulator
> feeding the USB controller that the M.2 module is connected to.

I think that is what rfkill-gpio is for, so the proposal of 
Dimitry looks fine, execpt for the reset-gpio, aka LED which is 
already included in the dt (but maybe with the wrong gpio).

I will give it a try on real HW and report back.

Thanks!

Marc

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
  2026-02-14 20:40         ` Marc Dietrich
@ 2026-02-23  9:27           ` Chen-Yu Tsai
  0 siblings, 0 replies; 7+ messages in thread
From: Chen-Yu Tsai @ 2026-02-23  9:27 UTC (permalink / raw)
  To: Marc Dietrich
  Cc: Dmitry Torokhov, Thierry Reding, Russell King, Jonathan Hunter,
	linux-arm-kernel, linux-tegra, linux-kernel

On Sun, Feb 15, 2026 at 4:40 AM Marc Dietrich <marvin24@gmx.de> wrote:
>
> Hallo Chen-Yu,
>
> On Sat, 14 Feb 2026, Chen-Yu Tsai wrote:
>
> > On Sat, Feb 14, 2026 at 10:27 PM Marc Dietrich <marvin24@gmx.de> wrote:
> >>
> >> Hi Dimitry,
> >>
> >> On Wed, 11 Feb 2026, Dmitry Torokhov wrote:
> >>
> >>> Hi Thierry,
> >>>
> >>> On Fri, Jun 28, 2024 at 05:35:08PM +0200, Thierry Reding wrote:
> >>>> From: Thierry Reding <treding@nvidia.com>
> >>>>
> >>>>
> >>>> On Wed, 26 Jun 2024 21:46:13 -0700, Dmitry Torokhov wrote:
> >>>>> Complete conversion of the WiFi rfkill device to use device
> >>>>> properties/software nodes by utilizing PROPERTY_ENTRY_GPIO() instead of
> >>>>> a lookup table.
> >>>>>
> >>>>>
> >>>>
> >>>> Applied, thanks!
> >>>>
> >>>> [1/1] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill
> >>>>       commit: 47ac458bb229f8c4864081d173adbcfc55c34880
> >>>
> >>> Do you know by any chance why paz00 does not simply configure rfkill
> >>> switch via device tree? The driver (rfkill-gpio) seem to support device
> >>> tree...
> >>
> >> last time I tried this was rejected because the wifi chip is on the usb
> >> bus and "rfkill" should be a sub-function of this chip [1], but that was
> >> some time ago...
> >>
> >> Looking hard the schematics, the wifi chip does not have a gpio input as
> >> first thought. Rather it seems that the first gpio toggles a regulator
> >> which supplies the wifi module (m2 card) with power and the second gpio is
> >> just connected to the wifi LED.
> >>
> >> Not sure how to transfer this into dt, but I guess this would be the
> >> better solution.
> >
> > Then the first GPIO should probably just be described as a fixed regulator
> > feeding the USB controller that the M.2 module is connected to.
>
> I think that is what rfkill-gpio is for, so the proposal of
> Dimitry looks fine, execpt for the reset-gpio, aka LED which is
> already included in the dt (but maybe with the wrong gpio).

I did that some years ago and was rejected. It was for SDIO, not USB
though.

Note that if the wireless driver also registers an rfkill device, you
would end up with two rfkill devices in the system, and with slightly
different behavior.

One would just disable the radio portion of the WiFi device, while the
other would cause the WiFi device to disappear.


ChenYu

> I will give it a try on real HW and report back.
>
> Thanks!
>
> Marc

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-02-23  9:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27  4:46 [PATCH] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill Dmitry Torokhov
2024-06-28 15:35 ` Thierry Reding
2026-02-12  3:22   ` Dmitry Torokhov
2026-02-14 14:26     ` Marc Dietrich
2026-02-14 14:49       ` Chen-Yu Tsai
2026-02-14 20:40         ` Marc Dietrich
2026-02-23  9:27           ` Chen-Yu Tsai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox