linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sre@debian.org (Sebastian Reichel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] wl1251: spi: add vio regulator support
Date: Sun, 27 Oct 2013 17:14:28 +0100	[thread overview]
Message-ID: <1382890469-25286-4-git-send-email-sre@debian.org> (raw)
In-Reply-To: <1382890469-25286-1-git-send-email-sre@debian.org>

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 <sre@debian.org>
---
 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 <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 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;
-- 
1.8.4.rc3

  parent reply	other threads:[~2013-10-27 16:14 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-27 16:14 [PATCH 0/4] wl1251 device tree support Sebastian Reichel
2013-10-27 16:14 ` [PATCH 1/4] wl1251: split wl251 platform data to a separate structure Sebastian Reichel
2013-11-05 12:13   ` Pavel Machek
2013-11-14 18:51   ` Tony Lindgren
2013-11-14 23:03     ` Sebastian Reichel
2013-11-14 23:22       ` Tony Lindgren
2013-11-15 14:32         ` John W. Linville
2013-11-15 14:55           ` Sebastian Reichel
2013-12-10  3:28           ` Tony Lindgren
2013-10-27 16:14 ` [PATCH 2/4] wl1251: move power GPIO handling into the driver Sebastian Reichel
2013-10-27 16:24   ` Alexander Shiyan
2013-10-27 20:12     ` Sebastian Reichel
2013-10-28 17:29       ` Grazvydas Ignotas
2013-10-28 19:23         ` Mark Brown
2013-10-28 23:26           ` Sebastian Reichel
2013-10-29  1:33             ` Mark Brown
2013-11-05 13:11   ` Pavel Machek
2013-10-27 16:14 ` Sebastian Reichel [this message]
2013-11-05 13:12   ` [PATCH 3/4] wl1251: spi: add vio regulator support Pavel Machek
2013-10-27 16:14 ` [PATCH 4/4] wl1251: spi: add device tree support Sebastian Reichel
2013-10-28  6:37   ` Kumar Gala
2013-10-28 17:15     ` Grazvydas Ignotas
2013-10-28 19:30       ` Kumar Gala
2013-10-28 22:38     ` Tomasz Figa
2013-10-29  8:28       ` Kumar Gala

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=1382890469-25286-4-git-send-email-sre@debian.org \
    --to=sre@debian.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).