mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
thermal: stm32: Rework sensor mode management
Be sure get_temp returns an error while disabling or enabling the device. Set THERMAL_DEVICE_ENABLED state at the end of power on function. Set THERMAL_DEVICE_DISABLED state at the beginning of power off function. Signed-off-by: Pascal Paillet <p.paillet@st.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20200110101605.24984-3-p.paillet@st.com
This commit is contained in:
parent
d401652c1c
commit
d4a7e0538f
1 changed files with 4 additions and 6 deletions
|
@ -160,6 +160,8 @@ static int stm_sensor_power_on(struct stm_thermal_sensor *sensor)
|
||||||
writel_relaxed(value, sensor->base +
|
writel_relaxed(value, sensor->base +
|
||||||
DTS_CFGR1_OFFSET);
|
DTS_CFGR1_OFFSET);
|
||||||
|
|
||||||
|
sensor->mode = THERMAL_DEVICE_ENABLED;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,6 +169,8 @@ static int stm_sensor_power_off(struct stm_thermal_sensor *sensor)
|
||||||
{
|
{
|
||||||
u32 value;
|
u32 value;
|
||||||
|
|
||||||
|
sensor->mode = THERMAL_DEVICE_DISABLED;
|
||||||
|
|
||||||
/* Stop measuring */
|
/* Stop measuring */
|
||||||
value = readl_relaxed(sensor->base + DTS_CFGR1_OFFSET);
|
value = readl_relaxed(sensor->base + DTS_CFGR1_OFFSET);
|
||||||
value &= ~TS1_START;
|
value &= ~TS1_START;
|
||||||
|
@ -374,7 +378,6 @@ static int stm_thermal_update_threshold(struct stm_thermal_sensor *sensor)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
sensor->mode = THERMAL_DEVICE_DISABLED;
|
|
||||||
|
|
||||||
ret = stm_sensor_power_off(sensor);
|
ret = stm_sensor_power_off(sensor);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -576,8 +579,6 @@ static int stm_thermal_suspend(struct device *dev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
sensor->mode = THERMAL_DEVICE_DISABLED;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,7 +591,6 @@ static int stm_thermal_resume(struct device *dev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
sensor->mode = THERMAL_DEVICE_ENABLED;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -718,8 +718,6 @@ static int stm_thermal_probe(struct platform_device *pdev)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_tz;
|
goto err_tz;
|
||||||
|
|
||||||
sensor->mode = THERMAL_DEVICE_ENABLED;
|
|
||||||
|
|
||||||
dev_info(&pdev->dev, "%s: Driver initialized successfully\n",
|
dev_info(&pdev->dev, "%s: Driver initialized successfully\n",
|
||||||
__func__);
|
__func__);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue