1
0
Fork 0
alistair23-linux/drivers/iio
Fabrice Gasnier 7c48d6e80e iio: adc: stm32-adc: fix runtime autosuspend delay when slow polling
[ Upstream commit c537d34575 ]

When the ADC is runtime suspended and starting a conversion, the stm32-adc
driver calls pm_runtime_get_sync() that gets cascaded to the parent
(e.g. runtime resume of stm32-adc-core driver). This also kicks the
autosuspend delay (e.g. 2s) of the parent.
Once the ADC is active, calling pm_runtime_get_sync() again (upon a new
capture) won't kick the autosuspend delay for the parent (stm32-adc-core
driver) as already active.

Currently, this makes the stm32-adc-core driver go in suspend state
every 2s when doing slow polling. As an example, doing a capture, e.g.
cat in_voltageY_raw at a 0.2s rate, the auto suspend delay for the parent
isn't refreshed. Once it expires, the parent immediately falls into
runtime suspended state, in between two captures, as soon as the child
driver falls into runtime suspend state:
- e.g. after 2s, + child calls pm_runtime_put_autosuspend() + 100ms
  autosuspend delay of the child.
- stm32-adc-core switches off regulators, clocks and so on.
- They get switched on back again 100ms later in this example (at 2.2s).

So, use runtime_idle() callback in stm32-adc-core driver to call
pm_runtime_mark_last_busy() for the parent driver (stm32-adc-core),
to avoid this.

Fixes: 9bdbb1139c ("iio: adc: stm32-adc: add power management support")
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/1593615328-5180-1-git-send-email-fabrice.gasnier@st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-29 09:57:43 +01:00
..
accel iio:accel:mma8452: Fix timestamp alignment and prevent data leak. 2020-09-17 13:47:51 +02:00
adc iio: adc: stm32-adc: fix runtime autosuspend delay when slow polling 2020-10-29 09:57:43 +01:00
afe treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
amplifiers Second set of IIO device support, features, cleanups and minor fixes for 5.3. 2019-07-01 10:58:13 +02:00
buffer treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
chemical iio:chemical:ccs811: Fix timestamp alignment and prevent data leak. 2020-09-17 13:47:51 +02:00
common iio: cros_ec: Set Gyroscope default frequency to 25Hz 2020-09-17 13:47:49 +02:00
dac iio: dac: ad5592r: fix unbalanced mutex unlocks in ad5592r_read_raw() 2020-08-21 13:05:24 +02:00
dummy spi: docs: convert to ReST and add it to the kABI bookset 2019-07-31 14:13:13 -06:00
frequency iio: frequency: adf4371: Fix output frequency setting 2019-08-05 17:38:33 +01:00
gyro iio: st_gyro: Correct data for LSM9DS0 gyro 2020-02-01 09:34:36 +00:00
health iio:health:afe4404 Fix timestamp alignment and prevent data leak. 2020-07-22 09:33:00 +02:00
humidity iio:humidity:hts221 Fix alignment and data leak issues 2020-07-22 09:32:54 +02:00
imu iio: imu: st_lsm6dsx: Fix selection of ST_LSM6DS3_ID 2020-01-23 08:22:33 +01:00
light iio:light:max44000 Fix timestamp alignment and prevent data leak. 2020-09-17 13:47:51 +02:00
magnetometer iio:magnetometer:ak8975 Fix alignment and data leak issues. 2020-09-17 13:47:50 +02:00
multiplexer treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
orientation treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 309 2019-06-05 17:37:04 +02:00
potentiometer iio: potentiometer: add a driver for Maxim 5432-5435 2019-08-05 14:25:08 +01:00
potentiostat treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
pressure iio:pressure:ms5611 Fix buffer element alignment 2020-07-22 09:32:54 +02:00
proximity iio:proximity:mb1232: Fix timestamp alignment and prevent data leak. 2020-09-17 13:47:50 +02:00
resolver treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
temperature iio: max31856: add missing of_node and parent references to iio_dev 2019-12-31 16:42:46 +01:00
trigger iio: trigger: stm32-timer: disable master mode when stopping 2020-03-25 08:25:53 +01:00
Kconfig Second set of IIO device support, features, cleanups and minor fixes for 5.3. 2019-07-01 10:58:13 +02:00
Makefile counter: stm32-lptimer: add counter device 2019-04-25 21:33:41 +02:00
iio_core.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
iio_core_trigger.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-buffer.c iio: buffer: align the size of scan bytes to size of the largest element 2020-01-23 08:22:33 +01:00
industrialio-configfs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-core.c iio: core: add missing IIO_MOD_H2/ETHANOL string identifiers 2020-07-22 09:32:54 +02:00
industrialio-event.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-sw-device.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-sw-trigger.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-trigger.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-triggered-event.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
inkern.c Driver Core and debugfs changes for 5.3-rc1 2019-07-12 12:24:03 -07:00