Skip to content

Commit d92ed2c

Browse files
andrzejtpdlezcano
authored andcommitted
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 <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 7a7d66f commit d92ed2c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/thermal/imx_thermal.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,11 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
252252
const struct thermal_soc_data *soc_data = data->socdata;
253253
struct regmap *map = data->tempmon;
254254
unsigned int n_meas;
255-
bool wait;
255+
bool wait, run_measurement;
256256
u32 val;
257257

258-
if (thermal_zone_device_is_enabled(tz)) {
258+
run_measurement = !data->irq_enabled;
259+
if (!run_measurement) {
259260
/* Check if a measurement is currently in progress */
260261
regmap_read(map, soc_data->temp_data, &val);
261262
wait = !(val & soc_data->temp_valid_mask);
@@ -282,7 +283,7 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
282283

283284
regmap_read(map, soc_data->temp_data, &val);
284285

285-
if (!thermal_zone_device_is_enabled(tz)) {
286+
if (run_measurement) {
286287
regmap_write(map, soc_data->sensor_ctrl + REG_CLR,
287288
soc_data->measure_temp_mask);
288289
regmap_write(map, soc_data->sensor_ctrl + REG_SET,

0 commit comments

Comments
 (0)