Return-path: Received: from ring0.de ([5.45.105.125]:33049 "EHLO smtp.ring0.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752421AbaBNXHB (ORCPT ); Fri, 14 Feb 2014 18:07:01 -0500 From: Sebastian Reichel To: Sebastian Reichel , Luciano Coelho , Tony Lindgren , "John W. Linville" Cc: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Rob Landley , Kumar Gala , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, linux-omap@vger.kernel.org, netdev@vger.kernel.org, Sebastian Reichel Subject: [PATCHv2 3/5] wl1251: spi: add vio regulator support Date: Sat, 15 Feb 2014 00:05:54 +0100 Message-Id: <1392419156-14394-4-git-send-email-sre@debian.org> (sfid-20140215_000833_864281_6AC71A51) In-Reply-To: <1392419156-14394-1-git-send-email-sre@debian.org> References: <20140125000929.GD25488@atomide.com> <1392419156-14394-1-git-send-email-sre@debian.org> Sender: linux-wireless-owner@vger.kernel.org List-ID: This patch adds support for requesting the regulator powering the vio pin. Signed-off-by: Sebastian Reichel Reviewed-by: Pavel Machek --- drivers/net/wireless/ti/wl1251/spi.c | 19 +++++++++++++++++-- drivers/net/wireless/ti/wl1251/wl1251.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c index 6abcbc3..0a8aacc 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 389fe25..16dae52 100644 --- a/drivers/net/wireless/ti/wl1251/wl1251.h +++ b/drivers/net/wireless/ti/wl1251/wl1251.h @@ -280,6 +280,8 @@ struct wl1251 { int irq; bool use_eeprom; + struct regulator *vio; + spinlock_t wl_lock; enum wl1251_state state; -- 1.8.5.3