]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
ARM: tegra: dvfs: Don't protect dvfs data in early reasume
authorAlex Frid <afrid@nvidia.com>
Wed, 16 Jul 2014 01:28:15 +0000 (18:28 -0700)
committerMatthew Pedro <mapedro@nvidia.com>
Thu, 31 Jul 2014 17:53:53 +0000 (10:53 -0700)
Don't protect dvfs data with mutex in late suspend/early resume.
DVFS operations are suspended at that time, but during syscore resume
it may be necessary to update DVFS data to changes happened while the
system was in suspend (in praticular memory configuration was changed
by boot-rom on suspend wake).

Change-Id: I8df278dc2e58e5ea1508d187afe0b8f4d8ccbe22
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/438903
(cherry picked from commit 9008a4ad3ee979445b42bc52b8d1619da82badbb)
Reviewed-on: http://git-master/r/440505
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Tested-by: Gaurav Sarode <gsarode@nvidia.com>
arch/arm/mach-tegra/dvfs.c

index 80c5035ba42c184ee4e9a13d887c282e05920ecb..4d5bdfdf790096bf6968cd1123e7286eefd1d894 100644 (file)
@@ -884,13 +884,24 @@ const int *tegra_dvfs_get_millivolts_pll(struct dvfs *d)
 int tegra_dvfs_set_rate(struct clk *c, unsigned long rate)
 {
        int ret;
+       bool suspended;
 
        if (!c->dvfs)
                return -EINVAL;
 
-       mutex_lock(&dvfs_lock);
+       suspended = timekeeping_suspended && c->dvfs->dvfs_rail->suspended;
+       if (suspended) {
+               if (mutex_is_locked(&dvfs_lock))
+                       WARN(1, "%s: Entered suspend with DVFS mutex locked\n",
+                            __func__);
+       } else {
+               mutex_lock(&dvfs_lock);
+       }
+
        ret = __tegra_dvfs_set_rate(c->dvfs, rate);
-       mutex_unlock(&dvfs_lock);
+
+       if (!suspended)
+               mutex_unlock(&dvfs_lock);
 
        return ret;
 }