diff options
author | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-11-04 14:35:58 +0100 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 10:59:16 +0200 |
commit | 5091a52f398d14bbae8cbc544ac8369d1496deab (patch) | |
tree | 665262d773bc7381067089269e03fe7d3cc6086f | |
parent | 2d88dbcfaee3d65c2ea9ac795553375d9866b7ee (diff) |
ARM: ux500: runtime: Prevent undefined state of pins for amba
Pins must never be left in undefined state, which may happen if
device driver's runtime suspend callback runs before the pins
are disabled. The opposite goes for runtime resume.
This change will also mean that device drivers can not use their
pins in the runtime suspend|resume callbacks.
Change-Id: Id08b9ffb07451b3e96c6ec671dd73c03d16bbe1a
Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/36496
Reviewed-by: Per FORLIN <per.forlin@stericsson.com>
-rw-r--r-- | arch/arm/mach-ux500/pm/runtime.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/arch/arm/mach-ux500/pm/runtime.c b/arch/arm/mach-ux500/pm/runtime.c index 784bbd0c9ba..5772abc45e2 100644 --- a/arch/arm/mach-ux500/pm/runtime.c +++ b/arch/arm/mach-ux500/pm/runtime.c @@ -267,6 +267,13 @@ static int ux500_pd_amba_runtime_suspend(struct device *dev) dev_vdbg(dev, "%s()\n", __func__); /* + * Do this first, to make sure pins is not in undefined state after + * drivers has run their runtime suspend. This also means that drivers + * are not able to use their pins/regulators during runtime suspend. + */ + ux500_pd_disable(prd); + + /* * Do not bypass AMBA bus pm functions by calling generic * pm directly. A future fix could be to implement a * "pm_bus_generic_*" API which we can use instead. @@ -279,8 +286,8 @@ static int ux500_pd_amba_runtime_suspend(struct device *dev) else ret = pm_generic_runtime_suspend(dev); - if (!ret) - ux500_pd_disable(prd); + if (ret) + ux500_pd_enable(prd); return ret; } @@ -293,8 +300,6 @@ static int ux500_pd_amba_runtime_resume(struct device *dev) dev_vdbg(dev, "%s()\n", __func__); - ux500_pd_enable(prd); - /* * Do not bypass AMBA bus pm functions by calling generic * pm directly. A future fix could be to implement a @@ -308,6 +313,15 @@ static int ux500_pd_amba_runtime_resume(struct device *dev) else ret = pm_generic_runtime_resume(dev); + /* + * Restore pins/regulator after drivers has runtime resumed, due + * to that we must not have pins in undefined state. This also means + * that drivers are not able to use their pins/regulators during + * runtime resume. + */ + if (!ret) + ux500_pd_enable(prd); + return ret; } |