netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@debian.org>
To: Sebastian Reichel <sre@ring0.de>, Luciano Coelho <luca@coelho.fi>,
	Tony Lindgren <tony@atomide.com>,
	"John W. Linville" <linville@tuxdriver.com>
Cc: Rob Herring <rob.herring@calxeda.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Rob Landley <rob@landley.net>, Kumar Gala <galak@codeaurora.org>,
	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 <sre@debian.org>
Subject: [PATCHv2 3/5] wl1251: spi: add vio regulator support
Date: Sat, 15 Feb 2014 00:05:54 +0100	[thread overview]
Message-ID: <1392419156-14394-4-git-send-email-sre@debian.org> (raw)
In-Reply-To: <1392419156-14394-1-git-send-email-sre@debian.org>

This patch adds support for requesting the regulator powering
the vio pin.

Signed-off-by: Sebastian Reichel <sre@debian.org>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
---
 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 <linux/spi/spi.h>
 #include <linux/wl12xx.h>
 #include <linux/gpio.h>
+#include <linux/regulator/consumer.h>
 
 #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


  parent reply	other threads:[~2014-02-14 23:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140125000929.GD25488@atomide.com>
2014-02-14 23:05 ` [RESEND] [PATCHv2 0/5] wl1251 device tree support Sebastian Reichel
2014-02-14 23:05   ` [PATCHv2 1/5] wl1251: split wl251 platform data to a separate structure Sebastian Reichel
2014-02-14 23:05   ` [PATCHv2 2/5] wl1251: move power GPIO handling into the driver Sebastian Reichel
2014-02-14 23:05   ` Sebastian Reichel [this message]
2014-02-14 23:05   ` [PATCHv2 4/5] wl1251: spi: add device tree support Sebastian Reichel
2014-02-14 23:05   ` [PATCHv2 5/5] Documentation: dt: wireless: Add wl1251 Sebastian Reichel
     [not found]   ` <20140226194436.GA20992@earth.universe>
2014-03-13 17:00     ` [RESEND] [PATCHv2 0/5] wl1251 device tree support Sebastian Reichel
     [not found]       ` <20140313170038.GA20372-SfvFxonMDyemK9LvCR3Hrw@public.gmane.org>
2014-03-13 17:27         ` John W. Linville
2014-03-13 18:01           ` Sebastian Reichel
2013-10-27 16:14 [PATCH 0/4] " Sebastian Reichel
2013-12-06  0:22 ` [PATCHv2 0/5] " Sebastian Reichel
2013-12-06  0:22   ` [PATCHv2 3/5] wl1251: spi: add vio regulator support Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392419156-14394-4-git-send-email-sre@debian.org \
    --to=sre@debian.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=luca@coelho.fi \
    --cc=mark.rutland@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pawel.moll@arm.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=sre@ring0.de \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).