diff mbox series

[V3,1/3] cpufreq: dt: Allow platform specific suspend/resume callbacks

Message ID 012d28b80a343dd3cf2dc369f0f9cca2699536e2.1524561482.git.viresh.kumar@linaro.org
State Accepted
Commit 67782701157141048e065970ddb241a0461c55be
Headers show
Series cpufreq: dt: Allow platforms to provide suspend/resume hooks | expand

Commit Message

Viresh Kumar April 24, 2018, 9:39 a.m. UTC
Platforms may need to implement platform specific suspend/resume hooks.
Update cpufreq-dt driver's platform data to contain those for such
platforms.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Tested-by: Miquel Raynal <miquel.raynal@bootlin.com>

---
 drivers/cpufreq/cpufreq-dt.c | 10 ++++++++--
 drivers/cpufreq/cpufreq-dt.h |  5 +++++
 2 files changed, 13 insertions(+), 2 deletions(-)

-- 
2.15.0.194.g9af6a3dea062
diff mbox series

Patch

diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 190ea0dccb79..0a9ebf00be46 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -346,8 +346,14 @@  static int dt_cpufreq_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	if (data && data->have_governor_per_policy)
-		dt_cpufreq_driver.flags |= CPUFREQ_HAVE_GOVERNOR_PER_POLICY;
+	if (data) {
+		if (data->have_governor_per_policy)
+			dt_cpufreq_driver.flags |= CPUFREQ_HAVE_GOVERNOR_PER_POLICY;
+
+		dt_cpufreq_driver.resume = data->resume;
+		if (data->suspend)
+			dt_cpufreq_driver.suspend = data->suspend;
+	}
 
 	ret = cpufreq_register_driver(&dt_cpufreq_driver);
 	if (ret)
diff --git a/drivers/cpufreq/cpufreq-dt.h b/drivers/cpufreq/cpufreq-dt.h
index 54d774e46c43..d5aeea13433e 100644
--- a/drivers/cpufreq/cpufreq-dt.h
+++ b/drivers/cpufreq/cpufreq-dt.h
@@ -12,8 +12,13 @@ 
 
 #include <linux/types.h>
 
+struct cpufreq_policy;
+
 struct cpufreq_dt_platform_data {
 	bool have_governor_per_policy;
+
+	int (*suspend)(struct cpufreq_policy *policy);
+	int (*resume)(struct cpufreq_policy *policy);
 };
 
 #endif /* __CPUFREQ_DT_H__ */