| From 20cc8319830f052a7ad06c02a10293111dd9169f Mon Sep 17 00:00:00 2001 |
| From: Ben Dooks <ben.dooks@codethink.co.uk> |
| Date: Thu, 22 May 2014 20:00:05 +0200 |
| Subject: drivers: sh: pm_runtime implementation needs to suspend and resume |
| devices |
| |
| If we override the platform bus calls for pm_runtime then we end up |
| with the calls to the devices' suspend and resume methods ignored |
| in favour of the bus ones. |
| |
| Change to calling the pm_runtime calls to suspend and resume the |
| devices specifically in the drivers/sh/pm_runtime.c implementation |
| to allow any device that may want to run power management to do so. |
| |
| Note, all the current sh driver implementations do not use their |
| own power management code so this is not a major implementation |
| issues. |
| |
| This also brings the implementation into line with the versions |
| used by the Davinci and Keystone PM domain code, so once fully |
| tested these implementations could be merged together. |
| |
| Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> |
| Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> |
| Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| (cherry picked from commit 8255fe169232364e5a01bd062e8037b8c1a9adec) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| drivers/sh/pm_runtime.c | 37 +++++++++++++++++++++++++++++++++++-- |
| 1 file changed, 35 insertions(+), 2 deletions(-) |
| |
| diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c |
| index 00b82ec94442..25eafbe4da33 100644 |
| --- a/drivers/sh/pm_runtime.c |
| +++ b/drivers/sh/pm_runtime.c |
| @@ -21,10 +21,43 @@ |
| #include <linux/slab.h> |
| |
| #ifdef CONFIG_PM_RUNTIME |
| +static int sh_pm_runtime_suspend(struct device *dev) |
| +{ |
| + int ret; |
| + |
| + 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; |
| +} |
| + |
| +static int sh_pm_runtime_resume(struct device *dev) |
| +{ |
| + int ret; |
| + |
| + ret = pm_clk_resume(dev); |
| + if (ret) { |
| + dev_err(dev, "failed to resume clock\n"); |
| + return ret; |
| + } |
| + |
| + return pm_generic_runtime_resume(dev); |
| +} |
| + |
| static struct dev_pm_domain default_pm_domain = { |
| .ops = { |
| - .runtime_suspend = pm_clk_suspend, |
| - .runtime_resume = pm_clk_resume, |
| + .runtime_suspend = sh_pm_runtime_suspend, |
| + .runtime_resume = sh_pm_runtime_resume, |
| USE_PLATFORM_PM_SLEEP_OPS |
| }, |
| }; |
| -- |
| 2.1.2 |
| |