linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, jic23@cam.ac.uk
Cc: arnd@arndb.de, linus.walleij@linaro.org, denis.ciocca@st.com,
	linux-iio@vger.kernel.org, Lee Jones <lee.jones@linaro.org>
Subject: [PATCH 17/20] iio: pressure-core: st: Provide support for the Vdd_IO power supply
Date: Mon, 16 Sep 2013 17:02:23 +0100	[thread overview]
Message-ID: <1379347346-823-18-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1379347346-823-1-git-send-email-lee.jones@linaro.org>

The power to some of the sensors are controlled by regulators. In most
cases these are 'always on', but if not they will fail to work until
the regulator is enabled using the relevant APIs. This patch allows for
the Vdd_IO power supply to be specified by either platform data or
Device Tree.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 13 ++++++++++++-
 include/linux/iio/common/st_sensors.h   |  2 ++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index c801c80..e3f3888 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -319,7 +319,7 @@ void st_press_power_enable(struct iio_dev *indio_dev)
 	struct st_sensor_data *pdata = iio_priv(indio_dev);
 	int err;
 
-	/* Regulators not mandatory, but if requested we should enable it. */
+	/* Regulators not mandatory, but if requested we should enable them. */
 	pdata->vdd = devm_regulator_get_optional(&indio_dev->dev, "vdd");
 	if (!IS_ERR(pdata->vdd)) {
 		err = regulator_enable(pdata->vdd);
@@ -327,6 +327,14 @@ void st_press_power_enable(struct iio_dev *indio_dev)
 			dev_warn(&indio_dev->dev,
 				 "Failed to enable specified Vdd supply\n");
 	}
+
+	pdata->vdd_io = devm_regulator_get_optional(&indio_dev->dev, "vddio");
+	if (!IS_ERR(pdata->vdd_io)) {
+		err = regulator_enable(pdata->vdd_io);
+		if (err != 0)
+			dev_warn(&indio_dev->dev,
+				 "Failed to enable specified Vdd_IO supply\n");
+	}
 }
 
 void st_press_power_disable(struct iio_dev *indio_dev)
@@ -335,6 +343,9 @@ void st_press_power_disable(struct iio_dev *indio_dev)
 
 	if (!IS_ERR(pdata->vdd))
 		regulator_disable(pdata->vdd);
+
+	if (!IS_ERR(pdata->vdd_io))
+		regulator_disable(pdata->vdd_io);
 }
 
 int st_press_common_probe(struct iio_dev *indio_dev,
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 968b84e..3c005eb 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -203,6 +203,7 @@ struct st_sensors {
  * @sensor: Pointer to the current sensor struct in use.
  * @current_fullscale: Maximum range of measure by the sensor.
  * @vdd: Pointer to sensor's Vdd power supply
+ * @vdd_io: Pointer to sensor's Vdd-IO power supply
  * @enabled: Status of the sensor (false->off, true->on).
  * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
  * @buffer_data: Data used by buffer part.
@@ -219,6 +220,7 @@ struct st_sensor_data {
 	struct st_sensors *sensor;
 	struct st_sensor_fullscale_avl *current_fullscale;
 	struct regulator *vdd;
+	struct regulator *vdd_io;
 
 	bool enabled;
 	bool multiread_bit;
-- 
1.8.1.2


  parent reply	other threads:[~2013-09-16 16:02 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-16 16:02 [PATCH v4 00/20] iio: ST clean-ups and new sensor support Lee Jones
2013-09-16 16:02 ` [PATCH 01/20] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes Lee Jones
2013-09-16 16:02 ` [PATCH 02/20] ARM: ux500: Enable the LPS001WP Pressure & Temperature sensor from DT Lee Jones
2013-09-16 16:02 ` [PATCH 03/20] ARM: ux500: Enable the LSM303DLH Accelerator " Lee Jones
2013-09-16 16:02 ` [PATCH 04/20] ARM: ux500: Enable the LSM303DLH Magnetometer " Lee Jones
2013-09-16 16:02 ` [PATCH 05/20] ARM: ux500: Enable the L3G4200D Gyroscope " Lee Jones
2013-09-16 16:02 ` [PATCH 06/20] ARM: ux500: CONFIG: Enable ST's IIO Sensors by default Lee Jones
2013-09-16 16:02 ` [PATCH 08/20] Documentation: dt: iio: Add binding for LSM303DLH - Accel Lee Jones
2013-09-16 16:02 ` [PATCH 09/20] Documentation: dt: iio: Add binding for L3G4200D Lee Jones
2013-09-16 16:02 ` [PATCH 10/20] Documentation: dt: iio: Add binding for LSM303DLH - Magn Lee Jones
2013-09-16 16:02 ` [PATCH 11/20] iio: sensors-core: st: Support sensors which don't have a Data Ready pin Lee Jones
2013-09-21 12:51   ` Jonathan Cameron
2013-09-21 13:07     ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 12/20] iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor() Lee Jones
2013-09-21 12:51   ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 13/20] iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data() Lee Jones
2013-09-21 12:52   ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 14/20] iio: pressure-core: st: Clean-up probe() function Lee Jones
2013-09-21 12:52   ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 15/20] iio: pressure: st: Add support for new LPS001WP pressure sensor Lee Jones
2013-09-21 12:53   ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 16/20] iio: pressure-core: st: Provide support for the Vdd power supply Lee Jones
2013-09-21 13:03   ` Jonathan Cameron
2013-09-23 19:18   ` Jonathan Cameron
2013-09-16 16:02 ` Lee Jones [this message]
2013-09-23 19:19   ` [PATCH 17/20] iio: pressure-core: st: Provide support for the Vdd_IO " Jonathan Cameron
2013-09-16 16:02 ` [PATCH 18/20] iio: accel-core: st: Clean up error handling in probe() Lee Jones
2013-09-21 12:56   ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 19/20] iio: gyro-core: " Lee Jones
2013-09-21 12:57   ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 20/20] iio: magn-core: " Lee Jones
2013-09-21 12:57   ` Jonathan Cameron
     [not found] ` <1379347346-823-8-git-send-email-lee.jones@linaro.org>
2013-10-01 21:09   ` [PATCH 07/20] Documentation: dt: iio: Add binding for LPS001WP Jonathan Cameron
2013-10-01 21:13     ` Jonathan Cameron

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=1379347346-823-18-git-send-email-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=arnd@arndb.de \
    --cc=denis.ciocca@st.com \
    --cc=jic23@cam.ac.uk \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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).