summaryrefslogtreecommitdiffstats
path: root/drivers/iio/pressure
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-09-16 18:02:00 +0200
committerJonathan Cameron <jic23@kernel.org>2013-09-23 21:17:58 +0200
commit71e1980c8d465fd304d867d36f2246b72513efed (patch)
tree18fcb702bbef11b3b89cfbbc3707cee045065c44 /drivers/iio/pressure
parentiio: pressure-core: st: Provide support for the Vdd power supply (diff)
downloadlinux-71e1980c8d465fd304d867d36f2246b72513efed.tar.xz
linux-71e1980c8d465fd304d867d36f2246b72513efed.zip
iio: pressure-core: st: Provide support for the Vdd_IO power supply
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> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/pressure')
-rw-r--r--drivers/iio/pressure/st_pressure_core.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index baeab109f41d..58083f9d51c5 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -319,7 +319,7 @@ static 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 @@ static 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");
+ }
}
static void st_press_power_disable(struct iio_dev *indio_dev)
@@ -335,6 +343,9 @@ static 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,