ARM: tegra: thermal: Update due to struct_est_data modification
Jinyoung Park [Thu, 21 Mar 2013 08:48:08 +0000 (17:48 +0900)]
Updated initialization of skin_data because struct therm_est_data in
include/linux/therm_est.h is modified; adding multiple trip points,
removing get_temp callback in struct therm_est_subdevice, and changing
type of devs from flexible array to pointer.

Bug 1233363
Bug 1236444

Change-Id: Id170d06ddcffbe546b01003e49fe327f361df4b3
Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com>
Reviewed-on: http://git-master/r/211124
Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com>
Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>

arch/arm/mach-tegra/board-cardhu-sensors.c
arch/arm/mach-tegra/board-dalmore-sensors.c
arch/arm/mach-tegra/board-macallan-sensors.c
arch/arm/mach-tegra/board-pluto-sensors.c
arch/arm/mach-tegra/board-roth-sensors.c

index 2979773..72aba92 100644 (file)
@@ -800,56 +800,50 @@ 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)
-{
-       struct thermal_zone_device *thz;
-
-       thz = thermal_zone_device_find(data, tegra_skin_match);
-
-       if (!thz || thz->ops->get_temp(thz, temp))
-               *temp = 25000;
+static struct thermal_trip_info skin_trips[] = {
+       {
+               .cdev_type = "skin-balanced",
+               .trip_temp = 45000,
+               .trip_type = THERMAL_TRIP_PASSIVE,
+               .upper = THERMAL_NO_LIMIT,
+               .lower = THERMAL_NO_LIMIT,
+               .hysteresis = 0,
+       },
+};
 
-       return 0;
-}
+static struct therm_est_subdevice skin_devs[] = {
+       {
+               .dev_data = "nct_ext",
+               .coeffs = {
+                       2, 1, 1, 1,
+                       1, 1, 1, 1,
+                       1, 1, 1, 0,
+                       1, 1, 0, 0,
+                       0, 0, -1, -7
+               },
+       },
+       {
+               .dev_data = "nct_int",
+               .coeffs = {
+                       -11, -7, -5, -3,
+                       -3, -2, -1, 0,
+                       0, 0, 1, 1,
+                       1, 2, 2, 3,
+                       4, 6, 11, 18
+               },
+       },
+};
 
 static struct therm_est_data skin_data = {
-       .cdev_type = "skin-balanced",
+       .num_trips = ARRAY_SIZE(skin_trips),
+       .trips = skin_trips,
        .toffset = 9793,
        .polling_period = 1100,
-       .ndevs = 2,
+       .passive_delay = 30000,
        .tc1 = 10,
        .tc2 = 1,
-       .devs = {
-                       {
-                               .dev_data = "nct_ext",
-                               .get_temp = tegra_skin_get_temp,
-                               .coeffs = {
-                                       2, 1, 1, 1,
-                                       1, 1, 1, 1,
-                                       1, 1, 1, 0,
-                                       1, 1, 0, 0,
-                                       0, 0, -1, -7
-                               },
-                       },
-                       {
-                               .dev_data = "nct_int",
-                               .get_temp = tegra_skin_get_temp,
-                               .coeffs = {
-                                       -11, -7, -5, -3,
-                                       -3, -2, -1, 0,
-                                       0, 0, 1, 1,
-                                       1, 2, 2, 3,
-                                       4, 6, 11, 18
-                               },
-                       },
-       },
-       .trip_temp = 45000,
-       .passive_delay = 30000,
+       .ndevs = ARRAY_SIZE(skin_devs),
+       .devs = skin_devs,
 };
 
 static struct throttle_table skin_throttle_table[] = {
index c79993a..b85fa25 100644 (file)
@@ -660,56 +660,50 @@ static struct i2c_board_info __initdata bq20z45_pdata[] = {
 };
 
 #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)
-{
-       struct thermal_zone_device *thz;
-
-       thz = thermal_zone_device_find(data, tegra_skin_match);
-
-       if (!thz || thz->ops->get_temp(thz, temp))
-               *temp = 25000;
+static struct thermal_trip_info skin_trips[] = {
+       {
+               .cdev_type = "skin-balanced",
+               .trip_temp = 45000,
+               .trip_type = THERMAL_TRIP_PASSIVE,
+               .upper = THERMAL_NO_LIMIT,
+               .lower = THERMAL_NO_LIMIT,
+               .hysteresis = 0,
+       },
+};
 
-       return 0;
-}
+static struct therm_est_subdevice skin_devs[] = {
+       {
+               .dev_data = "nct_ext",
+               .coeffs = {
+                       2, 1, 1, 1,
+                       1, 1, 1, 1,
+                       1, 1, 1, 0,
+                       1, 1, 0, 0,
+                       0, 0, -1, -7
+               },
+       },
+       {
+               .dev_data = "nct_int",
+               .coeffs = {
+                       -11, -7, -5, -3,
+                       -3, -2, -1, 0,
+                       0, 0, 1, 1,
+                       1, 2, 2, 3,
+                       4, 6, 11, 18
+               },
+       },
+};
 
 static struct therm_est_data skin_data = {
-       .cdev_type = "skin-balanced",
+       .num_trips = ARRAY_SIZE(skin_trips),
+       .trips = skin_trips,
        .toffset = 9793,
        .polling_period = 1100,
-       .ndevs = 2,
+       .passive_delay = 15000,
        .tc1 = 10,
        .tc2 = 1,
-       .devs = {
-                       {
-                               .dev_data = "nct_ext",
-                               .get_temp = tegra_skin_get_temp,
-                               .coeffs = {
-                                       2, 1, 1, 1,
-                                       1, 1, 1, 1,
-                                       1, 1, 1, 0,
-                                       1, 1, 0, 0,
-                                       0, 0, -1, -7
-                               },
-                       },
-                       {
-                               .dev_data = "nct_int",
-                               .get_temp = tegra_skin_get_temp,
-                               .coeffs = {
-                                       -11, -7, -5, -3,
-                                       -3, -2, -1, 0,
-                                       0, 0, 1, 1,
-                                       1, 2, 2, 3,
-                                       4, 6, 11, 18
-                               },
-                       },
-       },
-       .trip_temp = 45000,
-       .passive_delay = 15000,
+       .ndevs = ARRAY_SIZE(skin_devs),
+       .devs = skin_devs,
 };
 
 static struct throttle_table skin_throttle_table[] = {
index ddbd8a1..cbbd741 100644 (file)
@@ -651,56 +651,50 @@ static struct i2c_board_info __initdata bq20z45_pdata[] = {
 };
 
 #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)
-{
-       struct thermal_zone_device *thz;
-
-       thz = thermal_zone_device_find(data, tegra_skin_match);
-
-       if (!thz || thz->ops->get_temp(thz, temp))
-               *temp = 25000;
+static struct thermal_trip_info skin_trips[] = {
+       {
+               .cdev_type = "skin-balanced",
+               .trip_temp = 45000,
+               .trip_type = THERMAL_TRIP_PASSIVE,
+               .upper = THERMAL_NO_LIMIT,
+               .lower = THERMAL_NO_LIMIT,
+               .hysteresis = 0,
+       },
+};
 
-       return 0;
-}
+static struct therm_est_subdevice skin_devs[] = {
+       {
+               .dev_data = "nct_ext",
+               .coeffs = {
+                       2, 1, 1, 1,
+                       1, 1, 1, 1,
+                       1, 1, 1, 0,
+                       1, 1, 0, 0,
+                       0, 0, -1, -7
+               },
+       },
+       {
+               .dev_data = "nct_int",
+               .coeffs = {
+                       -11, -7, -5, -3,
+                       -3, -2, -1, 0,
+                       0, 0, 1, 1,
+                       1, 2, 2, 3,
+                       4, 6, 11, 18
+               },
+       },
+};
 
 static struct therm_est_data skin_data = {
-       .cdev_type = "skin-balanced",
+       .num_trips = ARRAY_SIZE(skin_trips),
+       .trips = skin_trips,
        .toffset = 9793,
        .polling_period = 1100,
-       .ndevs = 2,
+       .passive_delay = 15000,
        .tc1 = 10,
        .tc2 = 1,
-       .devs = {
-                       {
-                               .dev_data = "nct_ext",
-                               .get_temp = tegra_skin_get_temp,
-                               .coeffs = {
-                                       2, 1, 1, 1,
-                                       1, 1, 1, 1,
-                                       1, 1, 1, 0,
-                                       1, 1, 0, 0,
-                                       0, 0, -1, -7
-                               },
-                       },
-                       {
-                               .dev_data = "nct_int",
-                               .get_temp = tegra_skin_get_temp,
-                               .coeffs = {
-                                       -11, -7, -5, -3,
-                                       -3, -2, -1, 0,
-                                       0, 0, 1, 1,
-                                       1, 2, 2, 3,
-                                       4, 6, 11, 18
-                               },
-                       },
-       },
-       .trip_temp = 45000,
-       .passive_delay = 15000,
+       .ndevs = ARRAY_SIZE(skin_devs),
+       .devs = skin_devs,
 };
 
 static struct throttle_table skin_throttle_table[] = {
index b0200f6..c3788e1 100644 (file)
@@ -1010,56 +1010,50 @@ static int pluto_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)
-{
-       struct thermal_zone_device *thz;
-
-       thz = thermal_zone_device_find(data, tegra_skin_match);
-
-       if (!thz || thz->ops->get_temp(thz, temp))
-               *temp = 25000;
+static struct thermal_trip_info skin_trips[] = {
+       {
+               .cdev_type = "skin-balanced",
+               .trip_temp = 45000,
+               .trip_type = THERMAL_TRIP_PASSIVE,
+               .upper = THERMAL_NO_LIMIT,
+               .lower = THERMAL_NO_LIMIT,
+               .hysteresis = 0,
+       },
+};
 
-       return 0;
-}
+static struct therm_est_subdevice skin_devs[] = {
+       {
+               .dev_data = "nct_ext",
+               .coeffs = {
+                       2, 1, 1, 1,
+                       1, 1, 1, 1,
+                       1, 1, 1, 0,
+                       1, 1, 0, 0,
+                       0, 0, -1, -7
+               },
+       },
+       {
+               .dev_data = "nct_int",
+               .coeffs = {
+                       -11, -7, -5, -3,
+                       -3, -2, -1, 0,
+                       0, 0, 1, 1,
+                       1, 2, 2, 3,
+                       4, 6, 11, 18
+               },
+       },
+};
 
 static struct therm_est_data skin_data = {
-       .cdev_type = "skin-balanced",
+       .num_trips = ARRAY_SIZE(skin_trips),
+       .trips = skin_trips,
        .toffset = 9793,
        .polling_period = 1100,
-       .ndevs = 2,
+       .passive_delay = 15000,
        .tc1 = 10,
        .tc2 = 1,
-       .devs = {
-                       {
-                               .dev_data = "nct_ext",
-                               .get_temp = tegra_skin_get_temp,
-                               .coeffs = {
-                                       2, 1, 1, 1,
-                                       1, 1, 1, 1,
-                                       1, 1, 1, 0,
-                                       1, 1, 0, 0,
-                                       0, 0, -1, -7
-                               },
-                       },
-                       {
-                               .dev_data = "nct_int",
-                               .get_temp = tegra_skin_get_temp,
-                               .coeffs = {
-                                       -11, -7, -5, -3,
-                                       -3, -2, -1, 0,
-                                       0, 0, 1, 1,
-                                       1, 2, 2, 3,
-                                       4, 6, 11, 18
-                               },
-                       },
-       },
-       .trip_temp = 45000,
-       .passive_delay = 15000,
+       .ndevs = ARRAY_SIZE(skin_devs),
+       .devs = skin_devs,
 };
 
 static struct throttle_table skin_throttle_table[] = {
index 8180560..09ced4d 100644 (file)
@@ -291,56 +291,50 @@ static struct i2c_board_info __initdata bq20z45_pdata[] = {
 };
 
 #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)
-{
-       struct thermal_zone_device *thz;
-
-       thz = thermal_zone_device_find(data, tegra_skin_match);
-
-       if (!thz || thz->ops->get_temp(thz, temp))
-               *temp = 25000;
+static struct thermal_trip_info skin_trips[] = {
+       {
+               .cdev_type = "skin-balanced",
+               .trip_temp = 45000,
+               .trip_type = THERMAL_TRIP_PASSIVE,
+               .upper = THERMAL_NO_LIMIT,
+               .lower = THERMAL_NO_LIMIT,
+               .hysteresis = 0,
+       },
+};
 
-       return 0;
-}
+static struct therm_est_subdevice skin_devs[] = {
+       {
+               .dev_data = "nct_ext",
+               .coeffs = {
+                       2, 1, 1, 1,
+                       1, 1, 1, 1,
+                       1, 1, 1, 0,
+                       1, 1, 0, 0,
+                       0, 0, -1, -7
+               },
+       },
+       {
+               .dev_data = "nct_int",
+               .coeffs = {
+                       -11, -7, -5, -3,
+                       -3, -2, -1, 0,
+                       0, 0, 1, 1,
+                       1, 2, 2, 3,
+                       4, 6, 11, 18
+               },
+       },
+};
 
 static struct therm_est_data skin_data = {
-       .cdev_type = "skin-balanced",
+       .num_trips = ARRAY_SIZE(skin_trips),
+       .trips = skin_trips,
        .toffset = 9793,
        .polling_period = 1100,
-       .ndevs = 2,
+       .passive_delay = 15000,
        .tc1 = 10,
        .tc2 = 1,
-       .devs = {
-                       {
-                               .dev_data = "nct_ext",
-                               .get_temp = tegra_skin_get_temp,
-                               .coeffs = {
-                                       2, 1, 1, 1,
-                                       1, 1, 1, 1,
-                                       1, 1, 1, 0,
-                                       1, 1, 0, 0,
-                                       0, 0, -1, -7
-                               },
-                       },
-                       {
-                               .dev_data = "nct_int",
-                               .get_temp = tegra_skin_get_temp,
-                               .coeffs = {
-                                       -11, -7, -5, -3,
-                                       -3, -2, -1, 0,
-                                       0, 0, 1, 1,
-                                       1, 2, 2, 3,
-                                       4, 6, 11, 18
-                               },
-                       },
-       },
-       .trip_temp = 45000,
-       .passive_delay = 15000,
+       .ndevs = ARRAY_SIZE(skin_devs),
+       .devs = skin_devs,
 };
 
 static struct throttle_table skin_throttle_table[] = {