[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200110101605.24984-3-p.paillet@st.com>
Date: Fri, 10 Jan 2020 11:16:01 +0100
From: Pascal Paillet <p.paillet@...com>
To: <rui.zhang@...el.com>, <edubezval@...il.com>,
<daniel.lezcano@...aro.org>, <amit.kucheria@...durent.com>,
<mcoquelin.stm32@...il.com>, <alexandre.torgue@...com>,
<p.paillet@...com>, <david.hernandezsanchez@...com>,
<horms+renesas@...ge.net.au>, <wsa+renesas@...g-engineering.com>,
<linux-pm@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH_V3 2/6] 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@...com>
---
drivers/thermal/st/stm_thermal.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c
index 7835e109692e..a21fa7e0c72b 100644
--- a/drivers/thermal/st/stm_thermal.c
+++ b/drivers/thermal/st/stm_thermal.c
@@ -160,6 +160,8 @@ static int stm_sensor_power_on(struct stm_thermal_sensor *sensor)
writel_relaxed(value, sensor->base +
DTS_CFGR1_OFFSET);
+ sensor->mode = THERMAL_DEVICE_ENABLED;
+
return 0;
}
@@ -167,6 +169,8 @@ static int stm_sensor_power_off(struct stm_thermal_sensor *sensor)
{
u32 value;
+ sensor->mode = THERMAL_DEVICE_DISABLED;
+
/* Stop measuring */
value = readl_relaxed(sensor->base + DTS_CFGR1_OFFSET);
value &= ~TS1_START;
@@ -374,7 +378,6 @@ static int stm_thermal_update_threshold(struct stm_thermal_sensor *sensor)
{
int ret;
- sensor->mode = THERMAL_DEVICE_DISABLED;
ret = stm_sensor_power_off(sensor);
if (ret)
@@ -576,8 +579,6 @@ static int stm_thermal_suspend(struct device *dev)
if (ret)
return ret;
- sensor->mode = THERMAL_DEVICE_DISABLED;
-
return 0;
}
@@ -590,7 +591,6 @@ static int stm_thermal_resume(struct device *dev)
if (ret)
return ret;
- sensor->mode = THERMAL_DEVICE_ENABLED;
return 0;
}
@@ -718,8 +718,6 @@ static int stm_thermal_probe(struct platform_device *pdev)
if (ret)
goto err_tz;
- sensor->mode = THERMAL_DEVICE_ENABLED;
-
dev_info(&pdev->dev, "%s: Driver initialized successfully\n",
__func__);
--
2.17.1
Powered by blists - more mailing lists