aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/magnetometer
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2014-04-13 15:08:00 -0400
committerJonathan Cameron <jic23@kernel.org>2014-04-26 06:52:42 -0400
commitea7e586bdd331fd6fba2b6f9fd3777928c2814d8 (patch)
tree3d7caff67e139ab25a01ccfd2fa26edafb0cd261 /drivers/iio/magnetometer
parent4f544ced19b3d300ac11414b68a676a2c42f6d06 (diff)
iio: st_sensors: move regulator retrieveal to core
Currently the pressure sensor has code to retrieve and enable two regulators for Vdd and Vdd IO, but actually these voltage inputs are found on all of these ST sensors, so move the regulator handling to the core and make sure all the ST sensors call these functions on probe() and remove() to enable/disable power. Here also mover over to obtaining the regulator from the *parent* device of the IIO device, as the IIO device is created on-the-fly in this very subsystem it very unlikely evert have any regulators attached to it whatsoever. It is much more likely that the parent is a platform device, possibly instantiated from a device tree, which in turn have Vdd and Vdd IO supplied assigned to it. Cc: Lee Jones <lee.jones@linaro.org> Cc: Denis CIOCCA <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/magnetometer')
-rw-r--r--drivers/iio/magnetometer/st_magn_core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index 8e33a7682d33..240a21dd0c61 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -355,6 +355,8 @@ int st_magn_common_probe(struct iio_dev *indio_dev,
355 indio_dev->modes = INDIO_DIRECT_MODE; 355 indio_dev->modes = INDIO_DIRECT_MODE;
356 indio_dev->info = &magn_info; 356 indio_dev->info = &magn_info;
357 357
358 st_sensors_power_enable(indio_dev);
359
358 err = st_sensors_check_device_support(indio_dev, 360 err = st_sensors_check_device_support(indio_dev,
359 ARRAY_SIZE(st_magn_sensors), st_magn_sensors); 361 ARRAY_SIZE(st_magn_sensors), st_magn_sensors);
360 if (err < 0) 362 if (err < 0)
@@ -406,6 +408,8 @@ void st_magn_common_remove(struct iio_dev *indio_dev)
406{ 408{
407 struct st_sensor_data *mdata = iio_priv(indio_dev); 409 struct st_sensor_data *mdata = iio_priv(indio_dev);
408 410
411 st_sensors_power_disable(indio_dev);
412
409 iio_device_unregister(indio_dev); 413 iio_device_unregister(indio_dev);
410 if (mdata->get_irq_data_ready(indio_dev) > 0) 414 if (mdata->get_irq_data_ready(indio_dev) > 0)
411 st_sensors_deallocate_trigger(indio_dev); 415 st_sensors_deallocate_trigger(indio_dev);