* Re: [PATCH V2] thermal: imx: correct suspend/resume flow
2013-12-24 14:43 [PATCH V2] thermal: imx: correct suspend/resume flow Anson Huang
@ 2013-12-24 3:09 ` Shawn Guo
2014-01-02 2:01 ` Zhang Rui
1 sibling, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2013-12-24 3:09 UTC (permalink / raw)
To: Anson Huang; +Cc: rui.zhang, eduardo.valentin, linux-pm, linux-kernel
On Tue, Dec 24, 2013 at 09:43:24AM -0500, Anson Huang wrote:
> Fixes regression introduced by:
>
> commit 37713a1e8e4c1a1067ad4c99296f78d3c82ed9c4
> Author: Philipp Zabel <p.zabel@pengutronix.de>
> Date: Thu Aug 1 18:33:12 2013 +0200
>
> thermal: imx: implement thermal alarm interrupt handling
>
Generally, when we quote a commit in the log, it's good enough to use
the output of 'git log --oneline' with patch subject in parentheses.
37713a1 (thermal: imx: implement thermal alarm interrupt handling)
Anyway, Rui and Eduardo may be fine with what you put there, so
Acked-by: Shawn Guo <shawn.guo@linaro.org>
> The commit 37713a1e8e4 makes imx thermal sensor always powered up as alarm
> function is enabled, but the suspend callback of imx thermal returns
> success only if thermal sensor is powered down, so it will always returns
> fail hence break system's suspend, this patch disables imx thermal sensor
> before suspend and re-enable it after resume.
>
> Signed-off-by: Anson Huang <b20788@freescale.com>
> ---
> drivers/thermal/imx_thermal.c | 31 +++++++++++++++++--------------
> 1 file changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
> index cbb16f3..9a9a6c2 100644
> --- a/drivers/thermal/imx_thermal.c
> +++ b/drivers/thermal/imx_thermal.c
> @@ -510,27 +510,30 @@ static int imx_thermal_suspend(struct device *dev)
> {
> struct imx_thermal_data *data = dev_get_drvdata(dev);
> struct regmap *map = data->tempmon;
> - u32 val;
>
> - regmap_read(map, TEMPSENSE0, &val);
> - if ((val & TEMPSENSE0_POWER_DOWN) == 0) {
> - /*
> - * If a measurement is taking place, wait for a long enough
> - * time for it to finish, and then check again. If it still
> - * does not finish, something must go wrong.
> - */
> - udelay(50);
> - regmap_read(map, TEMPSENSE0, &val);
> - if ((val & TEMPSENSE0_POWER_DOWN) == 0)
> - return -ETIMEDOUT;
> - }
> + /*
> + * Need to disable thermal sensor, otherwise, when thermal core
> + * try to get temperature before thermal sensor resume, a wrong
> + * temperature will be read as the thermal sensor is powered
> + * down.
> + */
> + regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_MEASURE_TEMP);
> + regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN);
> + data->mode = THERMAL_DEVICE_DISABLED;
>
> return 0;
> }
>
> static int imx_thermal_resume(struct device *dev)
> {
> - /* Nothing to do for now */
> + struct imx_thermal_data *data = dev_get_drvdata(dev);
> + struct regmap *map = data->tempmon;
> +
> + /* Enabled thermal sensor after resume */
> + regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN);
> + regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP);
> + data->mode = THERMAL_DEVICE_ENABLED;
> +
> return 0;
> }
> #endif
> --
> 1.7.9.5
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH V2] thermal: imx: correct suspend/resume flow
@ 2013-12-24 14:43 Anson Huang
2013-12-24 3:09 ` Shawn Guo
2014-01-02 2:01 ` Zhang Rui
0 siblings, 2 replies; 4+ messages in thread
From: Anson Huang @ 2013-12-24 14:43 UTC (permalink / raw)
To: rui.zhang, shawn.guo, eduardo.valentin; +Cc: linux-pm, linux-kernel
Fixes regression introduced by:
commit 37713a1e8e4c1a1067ad4c99296f78d3c82ed9c4
Author: Philipp Zabel <p.zabel@pengutronix.de>
Date: Thu Aug 1 18:33:12 2013 +0200
thermal: imx: implement thermal alarm interrupt handling
The commit 37713a1e8e4 makes imx thermal sensor always powered up as alarm
function is enabled, but the suspend callback of imx thermal returns
success only if thermal sensor is powered down, so it will always returns
fail hence break system's suspend, this patch disables imx thermal sensor
before suspend and re-enable it after resume.
Signed-off-by: Anson Huang <b20788@freescale.com>
---
drivers/thermal/imx_thermal.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index cbb16f3..9a9a6c2 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -510,27 +510,30 @@ static int imx_thermal_suspend(struct device *dev)
{
struct imx_thermal_data *data = dev_get_drvdata(dev);
struct regmap *map = data->tempmon;
- u32 val;
- regmap_read(map, TEMPSENSE0, &val);
- if ((val & TEMPSENSE0_POWER_DOWN) == 0) {
- /*
- * If a measurement is taking place, wait for a long enough
- * time for it to finish, and then check again. If it still
- * does not finish, something must go wrong.
- */
- udelay(50);
- regmap_read(map, TEMPSENSE0, &val);
- if ((val & TEMPSENSE0_POWER_DOWN) == 0)
- return -ETIMEDOUT;
- }
+ /*
+ * Need to disable thermal sensor, otherwise, when thermal core
+ * try to get temperature before thermal sensor resume, a wrong
+ * temperature will be read as the thermal sensor is powered
+ * down.
+ */
+ regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_MEASURE_TEMP);
+ regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN);
+ data->mode = THERMAL_DEVICE_DISABLED;
return 0;
}
static int imx_thermal_resume(struct device *dev)
{
- /* Nothing to do for now */
+ struct imx_thermal_data *data = dev_get_drvdata(dev);
+ struct regmap *map = data->tempmon;
+
+ /* Enabled thermal sensor after resume */
+ regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN);
+ regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP);
+ data->mode = THERMAL_DEVICE_ENABLED;
+
return 0;
}
#endif
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V2] thermal: imx: correct suspend/resume flow
2013-12-24 14:43 [PATCH V2] thermal: imx: correct suspend/resume flow Anson Huang
2013-12-24 3:09 ` Shawn Guo
@ 2014-01-02 2:01 ` Zhang Rui
2014-01-02 2:16 ` Shawn Guo
1 sibling, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2014-01-02 2:01 UTC (permalink / raw)
To: Anson Huang; +Cc: shawn.guo, eduardo.valentin, linux-pm, linux-kernel
On Tue, 2013-12-24 at 09:43 -0500, Anson Huang wrote:
> Fixes regression introduced by:
>
> commit 37713a1e8e4c1a1067ad4c99296f78d3c82ed9c4
> Author: Philipp Zabel <p.zabel@pengutronix.de>
> Date: Thu Aug 1 18:33:12 2013 +0200
>
> thermal: imx: implement thermal alarm interrupt handling
>
> The commit 37713a1e8e4 makes imx thermal sensor always powered up as alarm
> function is enabled, but the suspend callback of imx thermal returns
> success only if thermal sensor is powered down, so it will always returns
> fail hence break system's suspend, this patch disables imx thermal sensor
> before suspend and re-enable it after resume.
>
> Signed-off-by: Anson Huang <b20788@freescale.com>
applied. BTW, this should also be a stable material for 3.12, right?
thanks,
rui
> ---
> drivers/thermal/imx_thermal.c | 31 +++++++++++++++++--------------
> 1 file changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
> index cbb16f3..9a9a6c2 100644
> --- a/drivers/thermal/imx_thermal.c
> +++ b/drivers/thermal/imx_thermal.c
> @@ -510,27 +510,30 @@ static int imx_thermal_suspend(struct device *dev)
> {
> struct imx_thermal_data *data = dev_get_drvdata(dev);
> struct regmap *map = data->tempmon;
> - u32 val;
>
> - regmap_read(map, TEMPSENSE0, &val);
> - if ((val & TEMPSENSE0_POWER_DOWN) == 0) {
> - /*
> - * If a measurement is taking place, wait for a long enough
> - * time for it to finish, and then check again. If it still
> - * does not finish, something must go wrong.
> - */
> - udelay(50);
> - regmap_read(map, TEMPSENSE0, &val);
> - if ((val & TEMPSENSE0_POWER_DOWN) == 0)
> - return -ETIMEDOUT;
> - }
> + /*
> + * Need to disable thermal sensor, otherwise, when thermal core
> + * try to get temperature before thermal sensor resume, a wrong
> + * temperature will be read as the thermal sensor is powered
> + * down.
> + */
> + regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_MEASURE_TEMP);
> + regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN);
> + data->mode = THERMAL_DEVICE_DISABLED;
>
> return 0;
> }
>
> static int imx_thermal_resume(struct device *dev)
> {
> - /* Nothing to do for now */
> + struct imx_thermal_data *data = dev_get_drvdata(dev);
> + struct regmap *map = data->tempmon;
> +
> + /* Enabled thermal sensor after resume */
> + regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN);
> + regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP);
> + data->mode = THERMAL_DEVICE_ENABLED;
> +
> return 0;
> }
> #endif
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] thermal: imx: correct suspend/resume flow
2014-01-02 2:01 ` Zhang Rui
@ 2014-01-02 2:16 ` Shawn Guo
0 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2014-01-02 2:16 UTC (permalink / raw)
To: Zhang Rui; +Cc: Anson Huang, eduardo.valentin, linux-pm, linux-kernel
On Thu, Jan 02, 2014 at 10:01:51AM +0800, Zhang Rui wrote:
> On Tue, 2013-12-24 at 09:43 -0500, Anson Huang wrote:
> > Fixes regression introduced by:
> >
> > commit 37713a1e8e4c1a1067ad4c99296f78d3c82ed9c4
> > Author: Philipp Zabel <p.zabel@pengutronix.de>
> > Date: Thu Aug 1 18:33:12 2013 +0200
> >
> > thermal: imx: implement thermal alarm interrupt handling
> >
> > The commit 37713a1e8e4 makes imx thermal sensor always powered up as alarm
> > function is enabled, but the suspend callback of imx thermal returns
> > success only if thermal sensor is powered down, so it will always returns
> > fail hence break system's suspend, this patch disables imx thermal sensor
> > before suspend and re-enable it after resume.
> >
> > Signed-off-by: Anson Huang <b20788@freescale.com>
>
> applied. BTW, this should also be a stable material for 3.12, right?
Right. That would be great. Thanks.
Shawn
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-02 2:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-24 14:43 [PATCH V2] thermal: imx: correct suspend/resume flow Anson Huang
2013-12-24 3:09 ` Shawn Guo
2014-01-02 2:01 ` Zhang Rui
2014-01-02 2:16 ` Shawn Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).