ARM: tegra: thermal: removed thermal find device
Joshua Primero [Tue, 28 Aug 2012 18:32:34 +0000 (11:32 -0700)]
Removed the tegra thermal layer find device functionality
and replaced it with the Linux thermal version.

Change-Id: If0531f438af4dc66354f8d2beade49034c6fd2ff
Signed-off-by: Joshua Primero <jprimero@nvidia.com>
Reviewed-on: http://git-master/r/130284
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>

arch/arm/mach-tegra/board-cardhu-sensors.c
arch/arm/mach-tegra/include/mach/thermal.h
arch/arm/mach-tegra/tegra3_thermal.c

index adccac3..e50be58 100644 (file)
@@ -956,13 +956,18 @@ static int cardhu_nct1008_init(void)
 }
 
 #ifdef CONFIG_TEGRA_SKIN_THROTTLE
+static int tegra_skin_match(struct thermal_zone_device *thz, void *data)
+{
+       return strcmp((char *)data, thz->type) == 0;
+}
+
 static int tegra_skin_get_temp(void *data, long *temp)
 {
-       enum thermal_device_id id = (enum thermal_device_id)data;
-       struct tegra_thermal_device *device = tegra_thermal_get_device(id);
+       struct thermal_zone_device *thz;
+
+       thz = thermal_zone_device_find(data, tegra_skin_match);
 
-       /* if sensor has not loaded use 25C as default */
-       if (!device || device->get_temp(device->data, temp))
+       if (!thz || thz->ops->get_temp(thz, temp))
                *temp = 25000;
 
        return 0;
@@ -974,7 +979,7 @@ static struct therm_est_data skin_data = {
        .ndevs = 2,
        .devs = {
                        {
-                               .dev_data = (void *)THERMAL_DEVICE_ID_NCT_EXT,
+                               .dev_data = "nct_ext",
                                .get_temp = tegra_skin_get_temp,
                                .coeffs = {
                                        2, 1, 1, 1,
@@ -985,7 +990,7 @@ static struct therm_est_data skin_data = {
                                },
                        },
                        {
-                               .dev_data = (void *)THERMAL_DEVICE_ID_NCT_INT,
+                               .dev_data = "nct_int",
                                .get_temp = tegra_skin_get_temp,
                                .coeffs = {
                                        -11, -7, -5, -3,
index 43388d2..f3bbbeb 100644 (file)
@@ -98,16 +98,12 @@ static inline struct thermal_cooling_device *balanced_throttle_register(
 #ifdef CONFIG_TEGRA_THERMAL
 int tegra_thermal_init(struct tegra_thermal_bind *thermal_binds);
 int tegra_thermal_device_register(struct tegra_thermal_device *device);
-struct tegra_thermal_device *tegra_thermal_get_device(enum thermal_device_id id);
 int tegra_thermal_exit(void);
 #else
 static inline int tegra_thermal_init(struct tegra_thermal_bind *thermal_binds)
 { return 0; }
 static inline int tegra_thermal_device_register(struct tegra_thermal_device *device)
 { return 0; }
-static inline struct tegra_thermal_device *tegra_thermal_get_device(
-       enum thermal_device_id id)
-{ return NULL; }
 static inline int tegra_thermal_exit(void)
 { return 0; }
 #endif
index f76723e..87e2940 100644 (file)
@@ -193,14 +193,6 @@ static void tegra_thermal_alert(void *data)
                device->set_limits(device->data, low_temp, high_temp);
 }
 
-struct tegra_thermal_device *tegra_thermal_get_device(enum thermal_device_id id)
-{
-       if (id < 0 || id >= THERMAL_DEVICE_MAX)
-               return NULL;
-
-       return devices[id];
-}
-
 static int passive_get_trip_temp(void *data, long trip)
 {
        struct tegra_thermal_bind *bind = data;