From: Pascal Paillet <p.paillet@st.com> To: <rui.zhang@intel.com>, <edubezval@gmail.com>, <daniel.lezcano@linaro.org>, <amit.kucheria@verdurent.com>, <mcoquelin.stm32@gmail.com>, <alexandre.torgue@st.com>, <p.paillet@st.com>, <david.hernandezsanchez@st.com>, <horms+renesas@verge.net.au>, <wsa+renesas@sang-engineering.com>, <linux-pm@vger.kernel.org>, <linux-stm32@st-md-mailman.stormreply.com>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH_V3 2/6] thermal: stm32: rework sensor mode management Date: Fri, 10 Jan 2020 11:16:01 +0100 [thread overview] Message-ID: <20200110101605.24984-3-p.paillet@st.com> (raw) In-Reply-To: <20200110101605.24984-1-p.paillet@st.com> 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> --- 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
WARNING: multiple messages have this Message-ID (diff)
From: Pascal Paillet <p.paillet@st.com> To: <rui.zhang@intel.com>, <edubezval@gmail.com>, <daniel.lezcano@linaro.org>, <amit.kucheria@verdurent.com>, <mcoquelin.stm32@gmail.com>, <alexandre.torgue@st.com>, <p.paillet@st.com>, <david.hernandezsanchez@st.com>, <horms+renesas@verge.net.au>, <wsa+renesas@sang-engineering.com>, <linux-pm@vger.kernel.org>, <linux-stm32@st-md-mailman.stormreply.com>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH_V3 2/6] thermal: stm32: rework sensor mode management Date: Fri, 10 Jan 2020 11:16:01 +0100 [thread overview] Message-ID: <20200110101605.24984-3-p.paillet@st.com> (raw) In-Reply-To: <20200110101605.24984-1-p.paillet@st.com> 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> --- 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-01-10 10:17 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-10 10:15 [PATCH_V3 0/6] thermal: stm32: driver improvements Pascal Paillet 2020-01-10 10:15 ` Pascal Paillet 2020-01-10 10:16 ` [PATCH_V3 1/6] thermal: stm32: fix icifr register name Pascal Paillet 2020-01-10 10:16 ` Pascal Paillet 2020-01-10 10:16 ` Pascal Paillet [this message] 2020-01-10 10:16 ` [PATCH_V3 2/6] thermal: stm32: rework sensor mode management Pascal Paillet 2020-01-10 10:16 ` [PATCH_V3 3/6] thermal: stm32: disable interrupts at probe Pascal Paillet 2020-01-10 10:16 ` Pascal Paillet 2020-01-10 10:16 ` [PATCH_V3 4/6] thermal: stm32: handle multiple trip points Pascal Paillet 2020-01-10 10:16 ` Pascal Paillet 2020-01-10 10:16 ` [PATCH_V3 5/6] thermal: stm32: improve temperature computing Pascal Paillet 2020-01-10 10:16 ` Pascal Paillet 2020-01-10 10:16 ` [PATCH_V3 6/6] thermal: stm32: fix low threshold interrupt flood Pascal Paillet 2020-01-10 10:16 ` Pascal Paillet 2020-01-27 13:17 ` [PATCH_V3 0/6] thermal: stm32: driver improvements Pascal PAILLET-LME 2020-01-27 13:17 ` Pascal PAILLET-LME 2020-01-27 14:39 ` Daniel Lezcano 2020-01-27 14:39 ` Daniel Lezcano
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200110101605.24984-3-p.paillet@st.com \ --to=p.paillet@st.com \ --cc=alexandre.torgue@st.com \ --cc=amit.kucheria@verdurent.com \ --cc=daniel.lezcano@linaro.org \ --cc=david.hernandezsanchez@st.com \ --cc=edubezval@gmail.com \ --cc=horms+renesas@verge.net.au \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=linux-stm32@st-md-mailman.stormreply.com \ --cc=mcoquelin.stm32@gmail.com \ --cc=rui.zhang@intel.com \ --cc=wsa+renesas@sang-engineering.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.