From patchwork Fri Jul 22 20:38:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Dietrich X-Patchwork-Id: 1001032 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6MKcmwr008196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 22 Jul 2011 20:39:09 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QkMUa-0002OD-34; Fri, 22 Jul 2011 20:38:40 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QkMUZ-0001jn-Nl; Fri, 22 Jul 2011 20:38:39 +0000 Received: from mailout-de.gmx.net ([213.165.64.23]) by canuck.infradead.org with smtp (Exim 4.76 #1 (Red Hat Linux)) id 1QkMUW-0001jU-34 for linux-arm-kernel@lists.infradead.org; Fri, 22 Jul 2011 20:38:37 +0000 Received: (qmail invoked by alias); 22 Jul 2011 20:38:31 -0000 Received: from e181177102.adsl.alicedsl.de (EHLO ax2-5200p.localnet) [85.181.177.102] by mail.gmx.net (mp071) with SMTP; 22 Jul 2011 22:38:31 +0200 X-Authenticated: #9962044 X-Provags-ID: V01U2FsdGVkX18gU9ZOkoMgb+8kgF9cpS9sKiTzLKRl2psx54ZF8U 40Pls+dgMsFnhY From: Marc Dietrich To: Vasily Khoruzhick Subject: Re: [PATCH 2/3] ARM: tegra: paz00: export the WIFI rfkill gpio Date: Fri, 22 Jul 2011 22:38:27 +0200 User-Agent: KMail/1.13.6 (Linux/3.0.0-rc4+; KDE/4.6.2; x86_64; ; ) References: <1310725464-2524-1-git-send-email-marvin24@gmx.de> <1310725464-2524-3-git-send-email-marvin24@gmx.de> <201107151517.03176.anarsoul@gmail.com> In-Reply-To: <201107151517.03176.anarsoul@gmail.com> MIME-Version: 1.0 Message-Id: <201107222238.28131.marvin24@gmx.de> X-Y-GMX-Trusted: 0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110722_163836_423466_15E74249 X-CRM114-Status: GOOD ( 25.06 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (marvin24[at]gmx.de) 0.1 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (marvin24[at]gmx.de) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [213.165.64.23 listed in list.dnswl.org] Cc: Olof Johansson , linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Collin Cross X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 22 Jul 2011 20:39:09 +0000 (UTC) Hi Vasily, On Friday 15 July 2011 14:17:02 Vasily Khoruzhick wrote: > On Friday 15 July 2011 13:24:22 Marc Dietrich wrote: > > This makes the WIFI rfkill gpio available to userspace. On boot, > > WIFI will be unblocked by default. > > Take a look on rfkill-gpio driver. mmh, seems I don't understand that driver. I made a simple patch which roughly goes like this: ... +static struct rfkill_gpio_platform_data rfkill_gpio_data = { + .name = "rfkill-gpio", + .reset_gpio = TEGRA_WIFI_RST, + .shutdown_gpio = TEGRA_WIFI_PWRN, + .type = RFKILL_TYPE_WLAN, +}; + +static struct platform_device rfkill_gpio = { + .name = "rfkill_gpio", + .id = -1, + .dev = { + .platform_data = &rfkill_gpio_data, + }, +}; + @@ -327,6 +343,7 @@ static struct platform_device *paz00_devices[] __initdata = { &tegra_spi_device3, &tegra_spi_device4, &leds_gpio, + &rfkill_gpio, &tegra_gart_device, &tegra_i2s_device1, &tegra_das_device, now I get two rfkill devices: root@ac100:/sys/devices/platform/rfkill_gpio/rfkill/rfkill0# rfkill list; echo 0 > state; sleep 5; rfkill list; echo 1 > state; sleep 5; rfkill list 0: rfkill-gpio: Wireless LAN Soft blocked: no Hard blocked: no 1: phy0: Wireless LAN Soft blocked: no Hard blocked: no 0: rfkill-gpio: Wireless LAN Soft blocked: yes Hard blocked: no 1: phy0: Wireless LAN Soft blocked: no Hard blocked: yes 0: rfkill-gpio: Wireless LAN Soft blocked: no Hard blocked: no 1: phy0: Wireless LAN Soft blocked: no Hard blocked: no writing echo 1 > state is equal to rfkill block 0, while rfkill block 1 seems to be the softblock of phy0. Is it possible that the gpios (rst and pwrn) are exchanged? Why do I get two devices: rfkill-gpio from rfkill-gpio driver and phy0 from the wifi driver? I guess the latter shows the current state of the chip and the first? The state of the "switch"? Thanks Marc > Regards > Vasily > > > Signed-off-by: Marc Dietrich > > --- > > > > arch/arm/mach-tegra/board-paz00-pinmux.c | 1 + > > arch/arm/mach-tegra/board-paz00.c | 16 ++++++++++++++++ > > arch/arm/mach-tegra/board-paz00.h | 6 ++++++ > > 3 files changed, 23 insertions(+), 0 deletions(-) > > > > diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c > > b/arch/arm/mach-tegra/board-paz00-pinmux.c index bdd2627..c02a48f 100644 > > --- a/arch/arm/mach-tegra/board-paz00-pinmux.c > > +++ b/arch/arm/mach-tegra/board-paz00-pinmux.c > > @@ -145,6 +145,7 @@ static struct tegra_gpio_table gpio_table[] = { > > > > { .gpio = TEGRA_GPIO_SD1_WP, .enable = true }, > > { .gpio = TEGRA_GPIO_SD1_POWER, .enable = true }, > > { .gpio = TEGRA_ULPI_RST, .enable = true }, > > > > + { .gpio = TEGRA_WIFI_PWRN, .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 931b06e..0bc652b 100644 > > --- a/arch/arm/mach-tegra/board-paz00.c > > +++ b/arch/arm/mach-tegra/board-paz00.c > > @@ -25,6 +25,7 @@ > > > > #include > > #include > > #include > > > > +#include > > > > #include > > #include > > #include > > > > @@ -165,6 +166,20 @@ static struct tegra_sdhci_platform_data sdhci_pdata4 > > = { .is_8bit = 1, > > > > }; > > > > +static void __init paz00_wifi_init(void) > > +{ > > + int ret; > > + > > + /* unlock hw rfkill */ > > + ret = gpio_request_one(TEGRA_WIFI_PWRN, GPIOF_OUT_INIT_HIGH, > > + "wifi pwrn"); > > + if (ret) { > > + pr_warning("WIFI: could not requestrfkill gpio\n"); > > + return; > > + } > > + gpio_export(TEGRA_WIFI_PWRN, 0); > > +}; > > + > > > > static void __init tegra_paz00_init(void) > > { > > > > tegra_clk_init_from_table(paz00_clk_init_table); > > > > @@ -178,6 +193,7 @@ static void __init tegra_paz00_init(void) > > > > paz00_i2c_init(); > > paz00_usb_init(); > > > > + paz00_wifi_init(); > > > > } > > > > MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ") > > > > diff --git a/arch/arm/mach-tegra/board-paz00.h > > b/arch/arm/mach-tegra/board-paz00.h index d4ff39d..5d2849e 100644 > > --- a/arch/arm/mach-tegra/board-paz00.h > > +++ b/arch/arm/mach-tegra/board-paz00.h > > @@ -17,11 +17,17 @@ > > > > #ifndef _MACH_TEGRA_BOARD_PAZ00_H > > #define _MACH_TEGRA_BOARD_PAZ00_H > > > > +/* SDCARD */ > > > > #define TEGRA_GPIO_SD1_CD TEGRA_GPIO_PV5 > > #define TEGRA_GPIO_SD1_WP TEGRA_GPIO_PH1 > > #define TEGRA_GPIO_SD1_POWER TEGRA_GPIO_PT3 > > > > + > > +/* ULPI */ > > > > #define TEGRA_ULPI_RST TEGRA_GPIO_PV0 > > > > +/* WIFI */ > > +#define TEGRA_WIFI_PWRN TEGRA_GPIO_PK5 > > + > > > > void paz00_pinmux_init(void); > > > > #endif diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board- paz00.c index e85711f..06b3089 100644 --- a/arch/arm/mach-tegra/board-paz00.c +++ b/arch/arm/mach-tegra/board-paz00.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include