]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
arm: tegra: soctherm: cap hotspot offset on switch
authorDiwakar Tundlam <dtundlam@nvidia.com>
Fri, 9 May 2014 22:58:42 +0000 (15:58 -0700)
committerMandar Padmawar <mpadmawar@nvidia.com>
Tue, 13 May 2014 10:05:59 +0000 (03:05 -0700)
If CPU-zone temp reads a lot higher than PLL-zone in a transient
scenario, we would program a huge hotspot offset value which would
cause spuriously high temperatures when we actually switch to
PLL-TSOSC. In the issue described in the bug, this seems to cause a
spurious shutdown.

We fix this by capping the dynamic hotspot offset to the maximum
defined by specification. Also use signed vars to work with -ve temps.

Bug 1511045

Change-Id: Ia5803103e951105382c937de8c75f82e4f166b16
Signed-off-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-on: http://git-master/r/407794
Reviewed-by: Edward Riegelsberger <eriegels@nvidia.com>
arch/arm/mach-tegra/tegra11_soctherm.c

index d9a8f18ebc988dda4d7025024f63663a3f05007b..dfb1471a345011b68ba46b9022d425b873d6bce7 100644 (file)
@@ -2848,7 +2848,7 @@ static void soctherm_adjust_zone(int tz)
 {
        u32 r, s;
        int i;
-       unsigned long ztemp, pll_temp, diff;
+       long ztemp, pll_temp, diff;
        bool low_voltage;
 
        if (soctherm_suspended)
@@ -2884,6 +2884,10 @@ static void soctherm_adjust_zone(int tz)
                else
                        diff = 0;
 
+               /* cap hotspot offset to max offset from pdata */
+               if (diff > plat_data.therm[tz].hotspot_offset)
+                       diff = plat_data.therm[tz].hotspot_offset;
+
                /* Program hotspot offsets per <tz> ~ PLL diff */
                r = soctherm_readl(TS_HOTSPOT_OFF);
                if (tz == THERM_CPU)