From patchwork Sun Oct 27 16:14:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 3099541 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D9520BF924 for ; Sun, 27 Oct 2013 16:15:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01660202CF for ; Sun, 27 Oct 2013 16:15:32 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D97C5202C3 for ; Sun, 27 Oct 2013 16:15:30 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VaSzr-00009x-LD; Sun, 27 Oct 2013 16:15:23 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VaSzp-0001VH-1R; Sun, 27 Oct 2013 16:15:21 +0000 Received: from [2a02:180:1:1::551f:bb62] (helo=smtp.ring0.de) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VaSzl-0001So-AQ for linux-arm-kernel@lists.infradead.org; Sun, 27 Oct 2013 16:15:19 +0000 Received: from comu.ring0.de (unknown [127.0.0.1]) by smtp.ring0.de (Postfix) with ESMTP id 9A07C2C58EE5; Sun, 27 Oct 2013 17:14:51 +0100 (CET) Received: (from spamd@localhost) by comu.ring0.de (8.13.8/8.13.8/Submit) id r9RGEkOD014353; Sun, 27 Oct 2013 17:14:46 +0100 X-Authentication-Warning: comu.ring0.de: spamd set sender to sre@ring0.de using -f X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 From: Sebastian Reichel To: Sebastian Reichel , Luciano Coelho Subject: [PATCH 3/4] wl1251: spi: add vio regulator support Date: Sun, 27 Oct 2013 17:14:28 +0100 Message-Id: <1382890469-25286-4-git-send-email-sre@debian.org> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1382890469-25286-1-git-send-email-sre@debian.org> References: <1382890469-25286-1-git-send-email-sre@debian.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131027_121517_686255_09DEF0B1 X-CRM114-Status: GOOD ( 15.89 ) X-Spam-Score: -1.1 (-) Cc: Mark Rutland , devicetree@vger.kernel.org, Russell King , Pawel Moll , Ian Campbell , Tony Lindgren , Greg Kroah-Hartman , Stephen Warren , linux-doc@vger.kernel.org, "John W. Linville" , Rob Herring , linux-kernel@vger.kernel.org, Sachin Kamat , Bill Pemberton , Sebastian Reichel , Felipe Balbi , Rob Landley , netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for requesting the regulator powering the vio pin. The patch also adds the regulator for the all boards using the wl1251 in spi mode (only the Nokia N900). Signed-off-by: Sebastian Reichel Reviewed-by: Pavel Machek --- arch/arm/mach-omap2/board-rx51-peripherals.c | 2 ++ drivers/net/wireless/ti/wl1251/spi.c | 19 +++++++++++++++++-- drivers/net/wireless/ti/wl1251/wl1251.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index b9d95dd..a791fef 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c @@ -552,6 +552,8 @@ static struct regulator_consumer_supply rx51_vio_supplies[] = { REGULATOR_SUPPLY("vio", "2-0063"), /* lis3lv02d */ REGULATOR_SUPPLY("Vdd_IO", "3-001d"), + /* wl1251 */ + REGULATOR_SUPPLY("vio", "spi4.0"), }; static struct regulator_consumer_supply rx51_vaux1_consumers[] = { diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c index 9a2df9d..efea57a 100644 --- a/drivers/net/wireless/ti/wl1251/spi.c +++ b/drivers/net/wireless/ti/wl1251/spi.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "wl1251.h" #include "reg.h" @@ -306,13 +307,26 @@ static int wl1251_spi_probe(struct spi_device *spi) irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING); - ret = wl1251_init_ieee80211(wl); + wl->vio = devm_regulator_get(&spi->dev, "vio"); + if (IS_ERR(wl->vio)) { + ret = PTR_ERR(wl->vio); + wl1251_error("vio regulator missing: %d", ret); + goto out_free; + } + + ret = regulator_enable(wl->vio); if (ret) goto out_free; + ret = wl1251_init_ieee80211(wl); + if (ret) + goto disable_regulator; + return 0; - out_free: +disable_regulator: + regulator_disable(wl->vio); +out_free: ieee80211_free_hw(hw); return ret; @@ -324,6 +338,7 @@ static int wl1251_spi_remove(struct spi_device *spi) free_irq(wl->irq, wl); wl1251_free_hw(wl); + regulator_disable(wl->vio); return 0; } diff --git a/drivers/net/wireless/ti/wl1251/wl1251.h b/drivers/net/wireless/ti/wl1251/wl1251.h index 5e9808c..010718b 100644 --- a/drivers/net/wireless/ti/wl1251/wl1251.h +++ b/drivers/net/wireless/ti/wl1251/wl1251.h @@ -279,6 +279,8 @@ struct wl1251 { int irq; bool use_eeprom; + struct regulator *vio; + spinlock_t wl_lock; enum wl1251_state state;