diff options
author | Marc Gonzalez <marc_gonzalez@sigmadesigns.com> | 2016-09-02 09:17:17 -0400 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2016-09-27 02:02:16 -0400 |
commit | 9dfe1a2f9a5a582931e9ecf3efd8dac5e1f89072 (patch) | |
tree | eba37e4472af80abb6febba030bf0e3b343aaa4d | |
parent | e3da1cbed64a19babe91775e21fcd8887039e711 (diff) |
thermal: tango: add resume support
When this platform is suspended, firmware powers the entire SoC down,
except a few hardware blocks waiting for wakeup events. There is no
context to save for this particular block.
Therefore, there is nothing useful for the driver to do on suspend;
so we define a NULL suspend hook. On resume, the driver initializes
the block exactly as is done in the probe callback.
Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
-rw-r--r-- | drivers/thermal/tango_thermal.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/thermal/tango_thermal.c b/drivers/thermal/tango_thermal.c index 70e0d9f406e9..201304aeafeb 100644 --- a/drivers/thermal/tango_thermal.c +++ b/drivers/thermal/tango_thermal.c | |||
@@ -64,6 +64,12 @@ static const struct thermal_zone_of_device_ops ops = { | |||
64 | .get_temp = tango_get_temp, | 64 | .get_temp = tango_get_temp, |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static void tango_thermal_init(struct tango_thermal_priv *priv) | ||
68 | { | ||
69 | writel(0, priv->base + TEMPSI_CFG); | ||
70 | writel(CMD_ON, priv->base + TEMPSI_CMD); | ||
71 | } | ||
72 | |||
67 | static int tango_thermal_probe(struct platform_device *pdev) | 73 | static int tango_thermal_probe(struct platform_device *pdev) |
68 | { | 74 | { |
69 | struct resource *res; | 75 | struct resource *res; |
@@ -79,14 +85,22 @@ static int tango_thermal_probe(struct platform_device *pdev) | |||
79 | if (IS_ERR(priv->base)) | 85 | if (IS_ERR(priv->base)) |
80 | return PTR_ERR(priv->base); | 86 | return PTR_ERR(priv->base); |
81 | 87 | ||
88 | platform_set_drvdata(pdev, priv); | ||
82 | priv->thresh_idx = IDX_MIN; | 89 | priv->thresh_idx = IDX_MIN; |
83 | writel(0, priv->base + TEMPSI_CFG); | 90 | tango_thermal_init(priv); |
84 | writel(CMD_ON, priv->base + TEMPSI_CMD); | ||
85 | 91 | ||
86 | tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &ops); | 92 | tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &ops); |
87 | return PTR_ERR_OR_ZERO(tzdev); | 93 | return PTR_ERR_OR_ZERO(tzdev); |
88 | } | 94 | } |
89 | 95 | ||
96 | static int __maybe_unused tango_thermal_resume(struct device *dev) | ||
97 | { | ||
98 | tango_thermal_init(dev_get_drvdata(dev)); | ||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | static SIMPLE_DEV_PM_OPS(tango_thermal_pm, NULL, tango_thermal_resume); | ||
103 | |||
90 | static const struct of_device_id tango_sensor_ids[] = { | 104 | static const struct of_device_id tango_sensor_ids[] = { |
91 | { | 105 | { |
92 | .compatible = "sigma,smp8758-thermal", | 106 | .compatible = "sigma,smp8758-thermal", |
@@ -99,6 +113,7 @@ static struct platform_driver tango_thermal_driver = { | |||
99 | .driver = { | 113 | .driver = { |
100 | .name = "tango-thermal", | 114 | .name = "tango-thermal", |
101 | .of_match_table = tango_sensor_ids, | 115 | .of_match_table = tango_sensor_ids, |
116 | .pm = &tango_thermal_pm, | ||
102 | }, | 117 | }, |
103 | }; | 118 | }; |
104 | 119 | ||