]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
arm: tegra: thermal: use correct zone pointer
authorDiwakar Tundlam <dtundlam@nvidia.com>
Thu, 27 Mar 2014 23:15:26 +0000 (16:15 -0700)
committerDiwakar Tundlam <dtundlam@nvidia.com>
Fri, 28 Mar 2014 20:02:45 +0000 (13:02 -0700)
The global index of thermal zones from thermal framework will be
different from the 0-based soctherm driver's own index. Use the global
index to notify framework, not the local index. Local index is used to
program the HW, and is derived from the stored devdata.

This fixes hw programming of thresholds in the wrong zone when written
from the trip_point_x_temp sysfs node.

This doesn't directly affect the bug mentioned below, but fixes a
problem that occurs when trying to repro it.

Bug 1482109

Change-Id: Ib03b719a51d296d3b77e99c53bcb68742576e3bb
Signed-off-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-on: http://git-master/r/387984
Reviewed-by: Automatic_Commit_Validation_User
arch/arm/mach-tegra/tegra11_soctherm.c

index 393a0ecf8c93b03a6ad7c28cbe2149c370722342..58b26eee6f4642a1931f34efea6717af0acfba0e 100644 (file)
@@ -1397,6 +1397,7 @@ static int soctherm_set_trip_temp(struct thermal_zone_device *thz,
 {
        struct soctherm_therm *therm = thz->devdata;
        struct thermal_trip_info *trip_state;
+       ptrdiff_t index = therm - plat_data.therm;
        long rem;
 
        trip_state = &therm->trips[trip];
@@ -1412,18 +1413,18 @@ static int soctherm_set_trip_temp(struct thermal_zone_device *thz,
        if (trip_state->trip_type == THERMAL_TRIP_HOT) {
                if (strnstr(trip_state->cdev_type,
                            "heavy", THERMAL_NAME_LENGTH))
-                       prog_hw_threshold(trip_state, thz->id, THROTTLE_HEAVY);
+                       prog_hw_threshold(trip_state, index, THROTTLE_HEAVY);
                else if (strnstr(trip_state->cdev_type,
                                 "light", THERMAL_NAME_LENGTH))
-                       prog_hw_threshold(trip_state, thz->id, THROTTLE_LIGHT);
+                       prog_hw_threshold(trip_state, index, THROTTLE_LIGHT);
        }
 
        /* Allow SW to shutdown at 'Critical temperature reached' */
-       thermal_notify_framework(soctherm_th_zones[thz->id], trip);
+       thermal_notify_framework(thz, trip);
 
        /* Reprogram HW thermtrip */
        if (trip_state->trip_type == THERMAL_TRIP_CRITICAL)
-               prog_hw_shutdown(trip_state, thz->id);
+               prog_hw_shutdown(trip_state, index);
 
        return 0;
 }