ARM: tegra: paz00: configure WiFi rfkill switch through device tree
PATCH 1/1 ARM: tegra: paz00: configure WiFi rfkill switch through device tree
As of d64c732dfc9e ("net: rfkill: gpio: add DT support") rfkill-gpio device can be instantiated via device tree.
Add the declaration there and drop board-paz00.c file and relevant Makefile fragments.
---
This is not tested on real hardware, compile tested only...
arch/arm/boot/dts/nvidia/tegra20-paz00.dts | 8 ++++ arch/arm/mach-tegra/Makefile | 2 - arch/arm/mach-tegra/board-paz00.c | 56 ---------------------- arch/arm/mach-tegra/board.h | 2 - arch/arm/mach-tegra/tegra.c | 4 -- 5 files changed, 8 insertions(+), 64 deletions(-)
arch/arm/boot/dts/nvidia/tegra20-paz00.dts +8 -0
@@ -706,6 +706,14 @@ vdd_pnl_reg: regulator-3v0 { enable-active-high; }; + rfkill { + compatible = "rfkill-gpio"; + label = "wifi_rfkill"; + radio-type = "wlan"; + reset-gpios = <&gpio TEGRA_GPIO(D, 1) GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio TEGRA_GPIO(K, 5) GPIO_ACTIVE_HIGH>; + }; + sound { compatible = "nvidia,tegra-audio-alc5632-paz00", "nvidia,tegra-audio-alc5632";
arch/arm/mach-tegra/Makefile +0 -2
@@ -15,5 +15,3 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_ARCH_TEGRA_114_SOC) += pm-tegra30.o obj-$(CONFIG_ARCH_TEGRA_124_SOC) += pm-tegra30.o - -obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-paz00.o
arch/arm/mach-tegra/board-paz00.c deleted +0 -56
56 lines not on this page · raw message
arch/arm/mach-tegra/board.h +0 -2
@@ -19,6 +19,4 @@void __init tegra_map_common_io (void );void __init tegra_init_irq (void ); -void __init tegra_paz00_wifikill_init (void ); -#endif
arch/arm/mach-tegra/tegra.c +0 -4
@@ -83,10 +83,6 @@ static void __init tegra_dt_init(void)static void __init tegra_dt_init_late (void ) { -if (IS_ENABLED (CONFIG_ARCH_TEGRA_2x_SOC) && -of_machine_is_compatible ("compal,paz00" )) -tegra_paz00_wifikill_init (); -if (IS_ENABLED (CONFIG_ARCH_TEGRA_2x_SOC) &&of_machine_is_compatible ("nvidia,tegra20" ))platform_device_register_simple ("tegra20-cpufreq" ,-1 ,NULL ,0 );
Signature · 5 lines
2.53.0.310.g728cabbaf7-goog -- Dmitry
Hi Dmitry,
Quoted 23 lines · Dmitry Torokhov
As of
d64c732dfc9e("net: rfkill: gpio: add DT support") rfkill-gpio device can be instantiated via device tree.Add the declaration there and drop
board-paz00.cfile and relevantMakefilefragments.Signed-off-by Dmitry Torokhov <[email protected]>---
This is not tested on real hardware, compile tested only...
arch/arm/boot/dts/nvidia/tegra20-paz00.dts | 8 ++++ arch/arm/mach-tegra/Makefile | 2 - arch/arm/mach-tegra/board-paz00.c | 56 ---------------------- arch/arm/mach-tegra/board.h | 2 - arch/arm/mach-tegra/tegra.c | 4 -- 5 files changed, 8 insertions(+), 64 deletions(-)arch/arm/boot/dts/nvidia/tegra20-paz00.dts +0
-0
arch/arm/boot/dts/nvidia/tegra20-paz00.dts vdd_pnl_reg: regulator-3v0 { · line 713
Quoted 8 lines
arch/arm/boot/dts/nvidia/tegra20-paz00.dts +5
-0@@ -706,6 +706,14 @@ vdd_pnl_reg: regulator-3v0 { enable-active-high; }; + rfkill { + compatible = "rfkill-gpio"; + label = "wifi_rfkill"; + radio-type = "wlan"; + reset-gpios = <&gpio TEGRA_GPIO(D, 1) GPIO_ACTIVE_HIGH>;
I guess this can be removed, as it should trigger the LED, which is already included elsewhere ....
arch/arm/boot/dts/nvidia/tegra20-paz00.dts vdd_pnl_reg: regulator-3v0 { · line 719
Quoted 6 lines
arch/arm/boot/dts/nvidia/tegra20-paz00.dts +3
-0+ shutdown-gpios = <&gpio TEGRA_GPIO(K, 5) GPIO_ACTIVE_HIGH>; + }; + sound { compatible = "nvidia,tegra-audio-alc5632-paz00", "nvidia,tegra-audio-alc5632";
I'll give it a try and report back.
Thanks for the nice cleanup!
Marc
Quoted 106 lines
arch/arm/mach-tegra/Makefile +0
-0@@ -15,5 +15,3 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.oobj-$(CONFIG_ARCH_TEGRA_114_SOC) += pm-tegra30.o
obj-$(CONFIG_ARCH_TEGRA_124_SOC) += pm-tegra30.oarch/arm/mach-tegra/Makefile +0
-2- -obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-paz00.oarch/arm/mach-tegra/board-paz00.c deleted +0
-56@@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* -* arch/arm/mach-tegra/board-paz00.c -* -* Copyright (C) 2011 Marc Dietrich <[email protected]> -* -* Based on board-harmony.c -* Copyright (C) 2010 Google, Inc. -*/ - -#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 const struct software_node tegra_gpiochip_node = { - .name ="tegra-gpio" , -}; - -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 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 ) -{ -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); -}arch/arm/mach-tegra/board.h +0
-2@@ -19,6 +19,4 @@void __init tegra_map_common_io (void );void __init tegra_init_irq (void ); -void __init tegra_paz00_wifikill_init (void ); -#endif arch/arm/mach-tegra/tegra.c +0
-4@@ -83,10 +83,6 @@ static void __init tegra_dt_init(void)static void __init tegra_dt_init_late (void ) { -if (IS_ENABLED (CONFIG_ARCH_TEGRA_2x_SOC) && -of_machine_is_compatible ("compal,paz00" )) -tegra_paz00_wifikill_init (); -if (IS_ENABLED (CONFIG_ARCH_TEGRA_2x_SOC) &&of_machine_is_compatible ("nvidia,tegra20" ))platform_device_register_simple ("tegra20-cpufreq" ,-1 ,NULL ,0 );Signature · 5 lines
2.53.0.310.g728cabbaf7-goog -- Dmitry
Hi Dmitry,
Quoted 38 lines · Marc Dietrich
Hi Dmitry,
Quoted 23 lines · Dmitry Torokhov
As of
d64c732dfc9e("net: rfkill: gpio: add DT support") rfkill-gpio device can be instantiated via device tree.Add the declaration there and drop
board-paz00.cfile and relevantMakefilefragments.Signed-off-by Dmitry Torokhov <[email protected]>---
This is not tested on real hardware, compile tested only...
arch/arm/boot/dts/nvidia/tegra20-paz00.dts | 8 ++++ arch/arm/mach-tegra/Makefile | 2 - arch/arm/mach-tegra/board-paz00.c | 56 ---------------------- arch/arm/mach-tegra/board.h | 2 - arch/arm/mach-tegra/tegra.c | 4 -- 5 files changed, 8 insertions(+), 64 deletions(-)arch/arm/boot/dts/nvidia/tegra20-paz00.dts +0
-0arch/arm/boot/dts/nvidia/tegra20-paz00.dts vdd_pnl_reg: regulator-3v0 { · line 713
Quoted 8 lines
arch/arm/boot/dts/nvidia/tegra20-paz00.dts +5
-0@@ -706,6 +706,14 @@ vdd_pnl_reg: regulator-3v0 { enable-active-high; }; + rfkill { + compatible = "rfkill-gpio"; + label = "wifi_rfkill"; + radio-type = "wlan"; + reset-gpios = <&gpio TEGRA_GPIO(D, 1) GPIO_ACTIVE_HIGH>;I guess this can be removed, as it should trigger the LED, which is already included elsewhere ....
Quoted 8 lines
arch/arm/boot/dts/nvidia/tegra20-paz00.dts vdd_pnl_reg: regulator-3v0 { · line 719
Quoted 6 lines
arch/arm/boot/dts/nvidia/tegra20-paz00.dts +3
-0+ shutdown-gpios = <&gpio TEGRA_GPIO(K, 5) GPIO_ACTIVE_HIGH>; + }; + sound { compatible = "nvidia,tegra-audio-alc5632-paz00", "nvidia,tegra-audio-alc5632";I'll give it a try and report back.
rfkill (and LED) works as expected. With the reset-gpio line mentioned above removed, you can add my Tested-By.
Thanks!
Marc
Hi Marc,
Quoted 53 lines · Marc Dietrich
Hi Dmitry,
Quoted 40 lines · Marc Dietrich
Hi Dmitry,
Quoted 24 lines · Dmitry Torokhov
As of
d64c732dfc9e("net: rfkill: gpio: add DT support") rfkill-gpio device can be instantiated via device tree.Add the declaration there and drop
board-paz00.cfile and relevantMakefilefragments.Signed-off-by Dmitry Torokhov <[email protected]>---
This is not tested on real hardware, compile tested only...
arch/arm/boot/dts/nvidia/tegra20-paz00.dts | 8 ++++ arch/arm/mach-tegra/Makefile | 2 - arch/arm/mach-tegra/board-paz00.c | 56 ---------------------- arch/arm/mach-tegra/board.h | 2 - arch/arm/mach-tegra/tegra.c | 4 -- 5 files changed, 8 insertions(+), 64 deletions(-)arch/arm/boot/dts/nvidia/tegra20-paz00.dts +0
-0arch/arm/boot/dts/nvidia/tegra20-paz00.dts vdd_pnl_reg: regulator-3v0 { · line 713
Quoted 8 lines
arch/arm/boot/dts/nvidia/tegra20-paz00.dts +5
-0@@ -706,6 +706,14 @@ vdd_pnl_reg: regulator-3v0 { enable-active-high; }; + rfkill { + compatible = "rfkill-gpio"; + label = "wifi_rfkill"; + radio-type = "wlan"; + reset-gpios = <&gpio TEGRA_GPIO(D, 1) GPIO_ACTIVE_HIGH>;I guess this can be removed, as it should trigger the LED, which is already included elsewhere ....
Quoted 8 lines
arch/arm/boot/dts/nvidia/tegra20-paz00.dts vdd_pnl_reg: regulator-3v0 { · line 719
Quoted 6 lines
arch/arm/boot/dts/nvidia/tegra20-paz00.dts +3
-0+ shutdown-gpios = <&gpio TEGRA_GPIO(K, 5) GPIO_ACTIVE_HIGH>; + }; + sound { compatible = "nvidia,tegra-audio-alc5632-paz00", "nvidia,tegra-audio-alc5632";I'll give it a try and report back.
Quoted 2 lines
rfkill (and LED) works as expected. With the reset-gpio line mentioned above removed, you can add my Tested-By.
Thank you Marc.
I am still a bit confused about the reset gpio. As far as I understand looking through old commits reset gpio (PD1) is distinct from the LED gpio (PD0) that is currently being controlled by "gpio-leds".
I guess the rfkill driver needs at least one of "reset" or "shutdown" gpios, and that is why it continues to work with only shutdown, but I am trying to understand if PD1 was never connected to the WiFi chip reset line and instead is used for something else, or if it is indeed a reset line...
Was the patch not working with reset-gpios present? I am trying to gather data to craft a proper commit message.
Thanks.
Signature · 1 line
Dmitry
Hi Dmitry,
Quoted 56 lines · Dmitry Torokhov
Hi Marc,
Quoted 53 lines · Marc Dietrich
Hi Dmitry,
Quoted 48 lines · Marc Dietrich
Hi Dmitry,
Quoted 24 lines · Dmitry Torokhov
As of
d64c732dfc9e("net: rfkill: gpio: add DT support") rfkill-gpio device can be instantiated via device tree.Add the declaration there and drop
board-paz00.cfile and relevantMakefilefragments.Signed-off-by Dmitry Torokhov <[email protected]>---
This is not tested on real hardware, compile tested only...
arch/arm/boot/dts/nvidia/tegra20-paz00.dts | 8 ++++ arch/arm/mach-tegra/Makefile | 2 - arch/arm/mach-tegra/board-paz00.c | 56 ---------------------- arch/arm/mach-tegra/board.h | 2 - arch/arm/mach-tegra/tegra.c | 4 -- 5 files changed, 8 insertions(+), 64 deletions(-)arch/arm/boot/dts/nvidia/tegra20-paz00.dts +0
-0arch/arm/boot/dts/nvidia/tegra20-paz00.dts vdd_pnl_reg: regulator-3v0 { · line 713
Quoted 8 lines
arch/arm/boot/dts/nvidia/tegra20-paz00.dts +5
-0@@ -706,6 +706,14 @@ vdd_pnl_reg: regulator-3v0 { enable-active-high; }; + rfkill { + compatible = "rfkill-gpio"; + label = "wifi_rfkill"; + radio-type = "wlan"; + reset-gpios = <&gpio TEGRA_GPIO(D, 1) GPIO_ACTIVE_HIGH>;I guess this can be removed, as it should trigger the LED, which is already included elsewhere ....
arch/arm/boot/dts/nvidia/tegra20-paz00.dts vdd_pnl_reg: regulator-3v0 { · line 719
Quoted 6 lines
arch/arm/boot/dts/nvidia/tegra20-paz00.dts +3
-0+ shutdown-gpios = <&gpio TEGRA_GPIO(K, 5) GPIO_ACTIVE_HIGH>; + }; + sound { compatible = "nvidia,tegra-audio-alc5632-paz00", "nvidia,tegra-audio-alc5632";I'll give it a try and report back.
Quoted 8 lines
Quoted 2 lines
rfkill (and LED) works as expected. With the reset-gpio line mentioned above removed, you can add my Tested-By.
Thank you Marc.
I am still a bit confused about the reset gpio. As far as I understand looking through old commits reset gpio (PD1) is distinct from the LED gpio (PD0) that is currently being controlled by "gpio-leds".
well, the situation is a bit complicated. First, D1 gpio is eletrical ORed with the Wifi LED gpio (D0), which you can confirm by checking the schematic (google is your friend).
The said schematic contains two nearly identical devices (Toshiba Netbook AC100, aka Procyon and Toshiba tablet Folio 100, aka Sirius). GPIO D1 is also used on the tablet to rfkill the wifi/bt module on an M2 card, while the Notebook has wifi on a separate usb port (JP2) (and G3 modem on an M2 card), where D1 is not connected to at all. At least that's how I understand it.
Quoted 5 lines
I guess the rfkill driver needs at least one of "reset" or "shutdown" gpios, and that is why it continues to work with only shutdown, but I am trying to understand if PD1 was never connected to the WiFi chip reset line and instead is used for something else, or if it is indeed a reset line...
see above.
Quoted 2 lines
Was the patch not working with reset-gpios present? I am trying to gather data to craft a proper commit message.
It also works with the reset-gpio, but just because it is not connected to anything beside the LED on this machine.
Maybe I should also add that there are also variants of the Netbook with integrated bluetooth (and without 3G), but I don't know where it is connected to (maybe also to the M2 socket). In order to support such machines, we could use a second rfkill device for bluetooth only I guess. The original code used a single rfkill device in order to control both gpios together for a common rfkill I guess. I just don't have such a variant, so I cannot test it.
Best wishes,
Marc
Hi Dmitry,
Quoted 68 lines · Marc Dietrich
Quoted 49 lines · Dmitry Torokhov
Quoted 48 lines · Marc Dietrich
Quoted 46 lines · Marc Dietrich
Quoted 24 lines · Dmitry Torokhov
As of
d64c732dfc9e("net: rfkill: gpio: add DT support") rfkill-gpio device can be instantiated via device tree.Add the declaration there and drop
board-paz00.cfile and relevantMakefilefragments.Signed-off-by Dmitry Torokhov <[email protected]>---
This is not tested on real hardware, compile tested only...
arch/arm/boot/dts/nvidia/tegra20-paz00.dts | 8 ++++ arch/arm/mach-tegra/Makefile | 2 - arch/arm/mach-tegra/board-paz00.c | 56 ---------------------- arch/arm/mach-tegra/board.h | 2 - arch/arm/mach-tegra/tegra.c | 4 -- 5 files changed, 8 insertions(+), 64 deletions(-)arch/arm/boot/dts/nvidia/tegra20-paz00.dts +0
-0arch/arm/boot/dts/nvidia/tegra20-paz00.dts vdd_pnl_reg: regulator-3v0 { · line 713
Quoted 8 lines
arch/arm/boot/dts/nvidia/tegra20-paz00.dts +5
-0@@ -706,6 +706,14 @@ vdd_pnl_reg: regulator-3v0 { enable-active-high; }; + rfkill { + compatible = "rfkill-gpio"; + label = "wifi_rfkill"; + radio-type = "wlan"; + reset-gpios = <&gpio TEGRA_GPIO(D, 1) GPIO_ACTIVE_HIGH>;I guess this can be removed, as it should trigger the LED, which is already included elsewhere ....
arch/arm/boot/dts/nvidia/tegra20-paz00.dts vdd_pnl_reg: regulator-3v0 { · line 719
Quoted 6 lines
arch/arm/boot/dts/nvidia/tegra20-paz00.dts +3
-0+ shutdown-gpios = <&gpio TEGRA_GPIO(K, 5) GPIO_ACTIVE_HIGH>; + }; + sound { compatible = "nvidia,tegra-audio-alc5632-paz00", "nvidia,tegra-audio-alc5632";I'll give it a try and report back.
Quoted 8 lines
Quoted 2 lines
rfkill (and LED) works as expected. With the reset-gpio line mentioned above removed, you can add my Tested-By.
Thank you Marc.
I am still a bit confused about the reset gpio. As far as I understand looking through old commits reset gpio (PD1) is distinct from the LED gpio (PD0) that is currently being controlled by "gpio-leds".
well, the situation is a bit complicated. First, D1 gpio is eletrical ORed with the Wifi LED gpio (D0), which you can confirm by checking the schematic (google is your friend).
The said schematic contains two nearly identical devices (Toshiba Netbook AC100, aka Procyon and Toshiba tablet Folio 100, aka Sirius). GPIO D1 is also used on the tablet to rfkill the wifi/bt module on an M2 card, while the Notebook has wifi on a separate usb port (JP2) (and G3 modem on an M2 card), where D1 is not connected to at all. At least that's how I understand it.Quoted 5 lines
I guess the rfkill driver needs at least one of "reset" or "shutdown" gpios, and that is why it continues to work with only shutdown, but I am trying to understand if PD1 was never connected to the WiFi chip reset line and instead is used for something else, or if it is indeed a reset line...
Quoted 8 lines
see above.
Quoted 2 lines
Was the patch not working with reset-gpios present? I am trying to gather data to craft a proper commit message.
It also works with the reset-gpio, but just because it is not connected to anything beside the LED on this machine.
Maybe I should also add that there are also variants of the Netbook with integrated bluetooth (and without 3G), but I don't know where it is connected to (maybe also to the M2 socket). In order to support such machines, we could use a second rfkill device for bluetooth only I guess. The original code used a single rfkill device in order to control both gpios together for a common rfkill I guess. I just don't have such a variant, so I cannot test it.
thinking about all this a bit more, I guess your approach to just convert the driver to device-tree and not change any functionally beside it, is the best solution for now (and good pratice in general). Maybe I can get access to a machine with bluetooth (or some other user steps up), so we can try to find a better solution, if required at all.
Thanks!
Marc
Hi Marc,
Quoted 6 lines · Marc Dietrich
thinking about all this a bit more, I guess your approach to just convert the driver to device-tree and not change any functionally beside it, is the best solution for now (and good pratice in general).
Maybe I can get access to a machine with bluetooth (or some other user steps up), so we can try to find a better solution, if required at all.
Thank you. I believe your tested-by is applicable to the current version of the patch as well, so maybe Thierry can simply pick it up.
Thanks.
Signature · 1 line
Dmitry
Quoted 4 lines · Dmitry Torokhov
Hi Marc,
Quoted 1 line · Marc Dietrich
Quoted 8 lines
Quoted 5 lines
thinking about all this a bit more, I guess your approach to just convert the driver to device-tree and not change any functionally beside it, is the best solution for now (and good pratice in general).
Maybe I can get access to a machine with bluetooth (or some other user steps up), so we can try to find a better solution, if required at all.Thank you. I believe your tested-by is applicable to the current version of the patch as well, so maybe Thierry can simply pick it up.
yes sure, thanks!
Marc