* [PATCH] Thermal: imx: add clk disable/enable for suspend/resume
@ 2015-01-05 14:29 Anson Huang
[not found] ` <CADTbHxpExF7Qzz9-HCVWWbU24ymBV1wLt4ON_6avY_oLkknFaQ@mail.gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Anson Huang @ 2015-01-05 14:29 UTC (permalink / raw)
To: linux-pm, linux-kernel; +Cc: rui.zhang, edubezval
Thermal sensor's clk is from pll3_usb_otg, per hardware
design requirement, need to make sure pll3_usb_otg is disabled
before STOP mode is entered, otherwise, all PFDs under it may
enter incorrect state, this patch disables pll3_usb_otg before
suspend and enables it after resume.
Signed-off-by: Anson Huang <b20788@freescale.com>
---
drivers/thermal/imx_thermal.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index 461bf3d..03894da 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -600,6 +600,8 @@ static int imx_thermal_suspend(struct device *dev)
regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_MEASURE_TEMP);
regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN);
data->mode = THERMAL_DEVICE_DISABLED;
+ if (!IS_ERR(data->thermal_clk))
+ clk_disable_unprepare(data->thermal_clk);
return 0;
}
@@ -609,6 +611,8 @@ static int imx_thermal_resume(struct device *dev)
struct imx_thermal_data *data = dev_get_drvdata(dev);
struct regmap *map = data->tempmon;
+ if (!IS_ERR(data->thermal_clk))
+ clk_prepare_enable(data->thermal_clk);
/* Enabled thermal sensor after resume */
regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN);
regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread[parent not found: <CADTbHxpExF7Qzz9-HCVWWbU24ymBV1wLt4ON_6avY_oLkknFaQ@mail.gmail.com>]
* Re: [PATCH] Thermal: imx: add clk disable/enable for suspend/resume [not found] ` <CADTbHxpExF7Qzz9-HCVWWbU24ymBV1wLt4ON_6avY_oLkknFaQ@mail.gmail.com> @ 2015-01-04 1:00 ` Eduardo Valentin 0 siblings, 0 replies; 2+ messages in thread From: Eduardo Valentin @ 2015-01-04 1:00 UTC (permalink / raw) To: Pankaj Jangra Cc: Anson Huang, linux-pm, linux-kernel@vger.kernel.org, rui.zhang [-- Attachment #1: Type: text/plain, Size: 2137 bytes --] Hello, On Mon, Jan 05, 2015 at 10:34:11PM +0530, Pankaj Jangra wrote: > Hi Anson, > > On Mon, Jan 5, 2015 at 7:59 PM, Anson Huang <b20788@freescale.com> wrote: > > > Thermal sensor's clk is from pll3_usb_otg, per hardware > > design requirement, need to make sure pll3_usb_otg is disabled > > before STOP mode is entered, otherwise, all PFDs under it may > > enter incorrect state, this patch disables pll3_usb_otg before > > suspend and enables it after resume. > > > > Signed-off-by: Anson Huang <b20788@freescale.com> > > > > +++ b/drivers/thermal/imx_thermal.c > > @@ -600,6 +600,8 @@ static int imx_thermal_suspend(struct device *dev) > > regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_MEASURE_TEMP); > > regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN); > > data->mode = THERMAL_DEVICE_DISABLED; > > + if (!IS_ERR(data->thermal_clk)) > > > I think you do not need to check for the error condition here. Because > during the probe of driver, this condition is already checked and if the > clock get is failed, > it will fail the driver probing itself. > Agreed here, no need for this extra check. > + clk_disable_unprepare(data->thermal_clk); > > > > return 0; > > } > > @@ -609,6 +611,8 @@ static int imx_thermal_resume(struct device *dev) > > struct imx_thermal_data *data = dev_get_drvdata(dev); > > struct regmap *map = data->tempmon; > > > > + if (!IS_ERR(data->thermal_clk)) > > > Same as above. > > > + clk_prepare_enable(data->thermal_clk); > > /* Enabled thermal sensor after resume */ > > regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN); > > regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP); > > -- > > > > Else changes looks good to me. > > -- Pankaj Jangra > > > 1.9.1 > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-pm" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-05 19:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-05 14:29 [PATCH] Thermal: imx: add clk disable/enable for suspend/resume Anson Huang
[not found] ` <CADTbHxpExF7Qzz9-HCVWWbU24ymBV1wLt4ON_6avY_oLkknFaQ@mail.gmail.com>
2015-01-04 1:00 ` Eduardo Valentin
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).