|
@@ -15,6 +15,7 @@
|
|
|
#include <linux/clkdev.h>
|
|
|
#include <linux/slab.h>
|
|
|
#include <linux/err.h>
|
|
|
+#include <linux/pm_runtime.h>
|
|
|
|
|
|
#ifdef CONFIG_PM
|
|
|
|
|
@@ -367,6 +368,43 @@ static int pm_clk_notify(struct notifier_block *nb,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int pm_clk_runtime_suspend(struct device *dev)
|
|
|
+{
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ dev_dbg(dev, "%s\n", __func__);
|
|
|
+
|
|
|
+ ret = pm_generic_runtime_suspend(dev);
|
|
|
+ if (ret) {
|
|
|
+ dev_err(dev, "failed to suspend device\n");
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ ret = pm_clk_suspend(dev);
|
|
|
+ if (ret) {
|
|
|
+ dev_err(dev, "failed to suspend clock\n");
|
|
|
+ pm_generic_runtime_resume(dev);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int pm_clk_runtime_resume(struct device *dev)
|
|
|
+{
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ dev_dbg(dev, "%s\n", __func__);
|
|
|
+
|
|
|
+ ret = pm_clk_resume(dev);
|
|
|
+ if (ret) {
|
|
|
+ dev_err(dev, "failed to resume clock\n");
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ return pm_generic_runtime_resume(dev);
|
|
|
+}
|
|
|
+
|
|
|
#else /* !CONFIG_PM */
|
|
|
|
|
|
/**
|