diff options
author | Andrzej Pietrasiewicz <andrzej.p@collabora.com> | 2020-07-03 13:43:53 +0300 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2020-07-07 02:26:06 +0300 |
commit | d92ed2c9d3ff65b4d8740135a0f348cc073f013e (patch) | |
tree | 679cbb12e041ef53ec825baf3e46d21044046f84 /drivers/thermal | |
parent | 7a7d66f26b0ff47e7edbc9df884ad711ed918992 (diff) | |
download | linux-d92ed2c9d3ff65b4d8740135a0f348cc073f013e.tar.xz |
thermal: imx: Use driver's local data to decide whether to run a measurement
Use driver's local data to evaluate the need to run or not to run a
measurement.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200703104354.19657-3-andrzej.p@collabora.com
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/imx_thermal.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 9700ae39feb7..c0efa7bc48e2 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -252,10 +252,11 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp) const struct thermal_soc_data *soc_data = data->socdata; struct regmap *map = data->tempmon; unsigned int n_meas; - bool wait; + bool wait, run_measurement; u32 val; - if (thermal_zone_device_is_enabled(tz)) { + run_measurement = !data->irq_enabled; + if (!run_measurement) { /* Check if a measurement is currently in progress */ regmap_read(map, soc_data->temp_data, &val); wait = !(val & soc_data->temp_valid_mask); @@ -282,7 +283,7 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp) regmap_read(map, soc_data->temp_data, &val); - if (!thermal_zone_device_is_enabled(tz)) { + if (run_measurement) { regmap_write(map, soc_data->sensor_ctrl + REG_CLR, soc_data->measure_temp_mask); regmap_write(map, soc_data->sensor_ctrl + REG_SET, |