misc: nct1008: use common thermal_trip_info in nct driver
Diwakar Tundlam [Fri, 11 Jan 2013 07:41:38 +0000 (23:41 -0800)]
Bug 1200075

Change-Id: I82e5a7ea8dc1e033ebf7d37ab17b39a4217b55e9
Signed-off-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-on: http://git-master/r/190574
Reviewed-by: Automatic_Commit_Validation_User

drivers/misc/nct1008.c
include/linux/nct1008.h

index fd0c997..007906d 100644 (file)
@@ -477,7 +477,7 @@ static void nct1008_update(struct nct1008_data *data)
 {
        struct thermal_zone_device *thz = data->nct_ext;
        long low_temp = 0, high_temp = NCT1008_MAX_TEMP * 1000;
-       struct nct_trip_temp *trip_state;
+       struct thermal_trip_info *trip_state;
        long temp, trip_temp, hysteresis_temp;
        int count;
        enum events type = 0;
@@ -492,7 +492,7 @@ static void nct1008_update(struct nct1008_data *data)
        for (count = 0; count < thz->trips; count++) {
                trip_state = &data->plat_data.trips[count];
                trip_temp = trip_state->trip_temp;
-               hysteresis_temp = trip_state->is_enabled ?
+               hysteresis_temp = trip_state->tripped ?
                                trip_temp - trip_state->hysteresis : trip_temp;
 
                if ((trip_temp >= temp) && (trip_temp < high_temp)) {
@@ -550,8 +550,8 @@ static int nct1008_ext_bind(struct thermal_zone_device *thz,
        for (i = 0; i < data->plat_data.num_trips; i++) {
                if (!strcmp(data->plat_data.trips[i].cdev_type, cdev->type)) {
                        thermal_zone_bind_cooling_device(thz, i, cdev,
-                                       data->plat_data.trips[i].state,
-                                       data->plat_data.trips[i].state);
+                                       data->plat_data.trips[i].upper,
+                                       data->plat_data.trips[i].lower);
                        bind = true;
                }
        }
@@ -580,16 +580,16 @@ static int nct1008_ext_get_trip_temp(struct thermal_zone_device *thz,
                                     unsigned long *temp)
 {
        struct nct1008_data *data = thz->devdata;
-       struct nct_trip_temp *trip_state = &data->plat_data.trips[trip];
+       struct thermal_trip_info *trip_state = &data->plat_data.trips[trip];
 
        *temp = trip_state->trip_temp;
 
        if (thz->temperature >= trip_state->trip_temp) {
-               trip_state->is_enabled = true;
-       } else if (trip_state->is_enabled) {
+               trip_state->tripped = true;
+       } else if (trip_state->tripped) {
                *temp -= trip_state->hysteresis;
                if (thz->temperature < *temp)
-                       trip_state->is_enabled = false;
+                       trip_state->tripped = false;
        }
 
        return 0;
@@ -621,7 +621,7 @@ static int nct1008_ext_get_trend(struct thermal_zone_device *thz,
                                 enum thermal_trend *trend)
 {
        struct nct1008_data *data = thz->devdata;
-       struct nct_trip_temp *trip_state;
+       struct thermal_trip_info *trip_state;
 
        trip_state = &data->plat_data.trips[trip];
 
index 5695ee5..e1f893a 100644 (file)
@@ -3,7 +3,7 @@
  *
  * NCT1008, temperature monitoring device from ON Semiconductors
  *
- * Copyright (c) 2010-2012, NVIDIA Corporation.
+ * Copyright (c) 2010-2013, NVIDIA Corporation.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include <linux/types.h>
 #include <linux/workqueue.h>
 #include <linux/thermal.h>
+#include <linux/platform_data/thermal_sensors.h>
 
 struct nct1008_data;
 
 enum nct1008_chip { NCT1008, NCT72 };
 
-
-struct nct_trip_temp {
-       char *cdev_type;
-       long trip_temp;
-       enum thermal_trip_type trip_type;
-       unsigned long state;
-       long hysteresis;
-       bool is_enabled;
-};
-
-#define NCT_MAX_TRIPS (32)
-
 struct nct1008_platform_data {
        bool supported_hwrev;
        bool ext_range;
@@ -50,11 +39,9 @@ struct nct1008_platform_data {
        u8 offset;
        s16 shutdown_ext_limit;
        s16 shutdown_local_limit;
-
        int passive_delay;
-
        int num_trips;
-       struct nct_trip_temp trips[NCT_MAX_TRIPS];
+       struct thermal_trip_info trips[THERMAL_MAX_TRIPS];
        const char *loc_name;
 };
 #endif /* _LINUX_NCT1008_H */