From 1ab7d94be8bbf723084c07971f0e21f752b925f7 Mon Sep 17 00:00:00 2001 From: Matt Wagantall Date: Fri, 2 Dec 2011 17:59:57 -0800 Subject: [PATCH] msm: footswitch-8x60: Update collapse steps for memory retention robustness Disabling clocks before collapsing power to the core is recommended since halting clock results in memory periphery power collapse. If that happens right after collapsing the core's power, there is a theoretical possibility that an unwanted state may be latched into memory. Since memory retention is not assumed across a collapse, this should not be a problem anyway. Still, change this now so it doesn't get forgotten and cause problems in the future should memory retention be used. Change-Id: Ie9c7bb0b8096e0e23fb8d0312982e5ea5eccacc6 Signed-off-by: Matt Wagantall --- arch/arm/mach-msm/footswitch-8x60.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-msm/footswitch-8x60.c b/arch/arm/mach-msm/footswitch-8x60.c index 98447fac0cd..a8e2449a097 100644 --- a/arch/arm/mach-msm/footswitch-8x60.c +++ b/arch/arm/mach-msm/footswitch-8x60.c @@ -255,6 +255,14 @@ static int footswitch_disable(struct regulator_dev *rdev) /* Wait for synchronous resets to propagate. */ udelay(RESET_DELAY_US); + /* + * Return clocks to their state before this function. For robustness + * if memory-retention across collapses is required, clocks should + * be disabled before asserting the clamps. Assuming clocks were off + * before entering footswitch_disable(), this will be true. + */ + restore_clocks(fs); + /* * Clamp the I/O ports of the core to ensure the values * remain fixed while the core is collapsed. @@ -266,9 +274,6 @@ static int footswitch_disable(struct regulator_dev *rdev) regval &= ~ENABLE_BIT; writel_relaxed(regval, fs->gfs_ctl_reg); - /* Return clocks to their state before this function. */ - restore_clocks(fs); - fs->is_enabled = false; return rc;