diff mbox

[3/3] ARM: tegra: paz00: enable wifi led

Message ID 1310725464-2524-4-git-send-email-marvin24@gmx.de (mailing list archive)
State New, archived
Headers show

Commit Message

Marc Dietrich July 15, 2011, 10:24 a.m. UTC
This adds support for the wifi led. It is automaticly triggered by
the rfkill0 event.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
---
 arch/arm/mach-tegra/board-paz00-pinmux.c |    1 +
 arch/arm/mach-tegra/board-paz00.c        |   23 +++++++++++++++++++++++
 arch/arm/mach-tegra/board-paz00.h        |    1 +
 3 files changed, 25 insertions(+), 0 deletions(-)

Comments

Stephen Warren July 15, 2011, 5:10 p.m. UTC | #1
Marc Dietrich wrote at Friday, July 15, 2011 4:24 AM:
> This adds support for the wifi led. It is automaticly triggered by
> the rfkill0 event.
...
> +static struct gpio_led gpio_leds[] = {
> +	{
> +		.name                   = "wifi-led",
> +		.default_trigger        = "rfkill0",
> +		.gpio                   = TEGRA_WIFI_LED,
> +	},
> +};

How does this work given that the previous patch simply exports the actual
GPIO to user-space, rather than registering it through an rfkill driver;
Does the WiFi driver itself register directly with the rfkill system? 

(what model of device is the AC100's WiFi? I assume it's on USB.)
Marc Dietrich July 16, 2011, 4:19 p.m. UTC | #2
Am Fri, 15 Jul 2011 10:10:28 -0700
schrieb Stephen Warren <swarren@nvidia.com>:

> Marc Dietrich wrote at Friday, July 15, 2011 4:24 AM:
> > This adds support for the wifi led. It is automaticly triggered by
> > the rfkill0 event.
> ...
> > +static struct gpio_led gpio_leds[] = {
> > +	{
> > +		.name                   = "wifi-led",
> > +		.default_trigger        = "rfkill0",
> > +		.gpio                   = TEGRA_WIFI_LED,
> > +	},
> > +};
> 
> How does this work given that the previous patch simply exports the
> actual GPIO to user-space, rather than registering it through an
> rfkill driver; Does the WiFi driver itself register directly with the
> rfkill system? 

I don't know the details but the driver seems to register some rfkill
poll routine which reports the hw status back to the mac layer. I guess
from there the rfkill events are distributed. At least the led works
fine here (and acts upon rfkill block). Problem is that the even binds
to the first device registered to if you plug in some other network
device which is registered first, then the led will act upon this one.
Don't know how to bind it to a specific device.

> (what model of device is the AC100's WiFi? I assume it's on USB.)

yes, it's a rt3070 (check the rt2x00 driver).

Marc
diff mbox

Patch

diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c b/arch/arm/mach-tegra/board-paz00-pinmux.c
index c02a48f..41a6304 100644
--- a/arch/arm/mach-tegra/board-paz00-pinmux.c
+++ b/arch/arm/mach-tegra/board-paz00-pinmux.c
@@ -146,6 +146,7 @@  static struct tegra_gpio_table gpio_table[] = {
 	{ .gpio = TEGRA_GPIO_SD1_POWER,	.enable = true },
 	{ .gpio = TEGRA_ULPI_RST,	.enable = true },
 	{ .gpio = TEGRA_WIFI_PWRN,	.enable = true },
+	{ .gpio = TEGRA_WIFI_LED,	.enable = true },
 };
 
 void paz00_pinmux_init(void)
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 0bc652b..9c7531a 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -26,6 +26,7 @@ 
 #include <linux/pda_power.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/leds.h>
 #include <linux/i2c.h>
 #include <linux/i2c-tegra.h>
 #include <linux/platform_data/tegra_usb.h>
@@ -79,8 +80,30 @@  static struct platform_device debug_uart = {
 	},
 };
 
+static struct gpio_led gpio_leds[] = {
+	{
+		.name                   = "wifi-led",
+		.default_trigger        = "rfkill0",
+		.gpio                   = TEGRA_WIFI_LED,
+	},
+};
+
+static struct gpio_led_platform_data gpio_led_info = {
+	.leds           = gpio_leds,
+	.num_leds       = ARRAY_SIZE(gpio_leds),
+};
+
+static struct platform_device leds_gpio = {
+	.name   = "leds-gpio",
+	.id     = -1,
+	.dev    = {
+		.platform_data  = &gpio_led_info,
+	},
+};
+
 static struct platform_device *paz00_devices[] __initdata = {
 	&debug_uart,
+	&leds_gpio,
 	&tegra_sdhci_device1,
 	&tegra_sdhci_device4,
 };
diff --git a/arch/arm/mach-tegra/board-paz00.h b/arch/arm/mach-tegra/board-paz00.h
index 5d2849e..5d06053 100644
--- a/arch/arm/mach-tegra/board-paz00.h
+++ b/arch/arm/mach-tegra/board-paz00.h
@@ -27,6 +27,7 @@ 
 
 /* WIFI */
 #define TEGRA_WIFI_PWRN			TEGRA_GPIO_PK5
+#define TEGRA_WIFI_LED			TEGRA_GPIO_PD0
 
 void paz00_pinmux_init(void);