aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2012-06-26 21:51:12 -0400
committerZhang Rui <rui.zhang@intel.com>2012-09-24 02:44:36 -0400
commit1b7ddb840c3908464b19d4aa4f6dc4c463302442 (patch)
tree1fe5719ab4e3bc895dde8bfb0f480d18746498fb /drivers/thermal
parent601f3d4242be6ed6f72a2aadabc91e8255dad811 (diff)
Thermal: Remove tc1/tc2 in generic thermal layer.
Remove tc1/tc2 in generic thermal layer. .get_trend() callback starts to take effect from this patch. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Reviewed-by: Rafael J. Wysocki <rjw@sisk.pl> Reviewed-by: Valentin, Eduardo <eduardo.valentin@ti.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/spear_thermal.c2
-rw-r--r--drivers/thermal/thermal_sys.c24
2 files changed, 7 insertions, 19 deletions
diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
index 5f8ee39f2000..9bc969261d01 100644
--- a/drivers/thermal/spear_thermal.c
+++ b/drivers/thermal/spear_thermal.c
@@ -147,7 +147,7 @@ static int spear_thermal_probe(struct platform_device *pdev)
147 writel_relaxed(stdev->flags, stdev->thermal_base); 147 writel_relaxed(stdev->flags, stdev->thermal_base);
148 148
149 spear_thermal = thermal_zone_device_register("spear_thermal", 0, 0, 149 spear_thermal = thermal_zone_device_register("spear_thermal", 0, 0,
150 stdev, &ops, 0, 0, 0, 0); 150 stdev, &ops, 0, 0);
151 if (IS_ERR(spear_thermal)) { 151 if (IS_ERR(spear_thermal)) {
152 dev_err(&pdev->dev, "thermal zone device is NULL\n"); 152 dev_err(&pdev->dev, "thermal zone device is NULL\n");
153 ret = PTR_ERR(spear_thermal); 153 ret = PTR_ERR(spear_thermal);
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 146aa043f15b..0cf3dce55462 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -335,9 +335,6 @@ passive_store(struct device *dev, struct device_attribute *attr,
335 tz->passive_delay = 0; 335 tz->passive_delay = 0;
336 } 336 }
337 337
338 tz->tc1 = 1;
339 tz->tc2 = 1;
340
341 tz->forced_passive = state; 338 tz->forced_passive = state;
342 339
343 thermal_zone_device_update(tz); 340 thermal_zone_device_update(tz);
@@ -718,13 +715,12 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz,
718static void thermal_zone_device_passive(struct thermal_zone_device *tz, 715static void thermal_zone_device_passive(struct thermal_zone_device *tz,
719 int temp, int trip_temp, int trip) 716 int temp, int trip_temp, int trip)
720{ 717{
721 int trend = 0; 718 enum thermal_trend trend;
722 struct thermal_cooling_device_instance *instance; 719 struct thermal_cooling_device_instance *instance;
723 struct thermal_cooling_device *cdev; 720 struct thermal_cooling_device *cdev;
724 long state, max_state; 721 long state, max_state;
725 722
726 if (!tz->ops->get_trend || 723 if (!tz->ops->get_trend || tz->ops->get_trend(tz, trip, &trend)) {
727 tz->ops->get_trend(tz, trip, (enum thermal_trend *)&trend)) {
728 /* 724 /*
729 * compare the current temperature and previous temperature 725 * compare the current temperature and previous temperature
730 * to get the thermal trend, if no special requirement 726 * to get the thermal trend, if no special requirement
@@ -747,11 +743,8 @@ static void thermal_zone_device_passive(struct thermal_zone_device *tz,
747 if (temp >= trip_temp) { 743 if (temp >= trip_temp) {
748 tz->passive = true; 744 tz->passive = true;
749 745
750 trend = (tz->tc1 * (temp - tz->last_temperature)) +
751 (tz->tc2 * (temp - trip_temp));
752
753 /* Heating up? */ 746 /* Heating up? */
754 if (trend > 0) { 747 if (trend == THERMAL_TREND_RAISING) {
755 list_for_each_entry(instance, &tz->cooling_devices, 748 list_for_each_entry(instance, &tz->cooling_devices,
756 node) { 749 node) {
757 if (instance->trip != trip) 750 if (instance->trip != trip)
@@ -762,7 +755,7 @@ static void thermal_zone_device_passive(struct thermal_zone_device *tz,
762 if (state++ < max_state) 755 if (state++ < max_state)
763 cdev->ops->set_cur_state(cdev, state); 756 cdev->ops->set_cur_state(cdev, state);
764 } 757 }
765 } else if (trend < 0) { /* Cooling off? */ 758 } else if (trend == THERMAL_TREND_DROPPING) { /* Cooling off? */
766 list_for_each_entry(instance, &tz->cooling_devices, 759 list_for_each_entry(instance, &tz->cooling_devices,
767 node) { 760 node) {
768 if (instance->trip != trip) 761 if (instance->trip != trip)
@@ -1288,8 +1281,6 @@ static void remove_trip_attrs(struct thermal_zone_device *tz)
1288 * @mask: a bit string indicating the writeablility of trip points 1281 * @mask: a bit string indicating the writeablility of trip points
1289 * @devdata: private device data 1282 * @devdata: private device data
1290 * @ops: standard thermal zone device callbacks 1283 * @ops: standard thermal zone device callbacks
1291 * @tc1: thermal coefficient 1 for passive calculations
1292 * @tc2: thermal coefficient 2 for passive calculations
1293 * @passive_delay: number of milliseconds to wait between polls when 1284 * @passive_delay: number of milliseconds to wait between polls when
1294 * performing passive cooling 1285 * performing passive cooling
1295 * @polling_delay: number of milliseconds to wait between polls when checking 1286 * @polling_delay: number of milliseconds to wait between polls when checking
@@ -1297,13 +1288,12 @@ static void remove_trip_attrs(struct thermal_zone_device *tz)
1297 * driven systems) 1288 * driven systems)
1298 * 1289 *
1299 * thermal_zone_device_unregister() must be called when the device is no 1290 * thermal_zone_device_unregister() must be called when the device is no
1300 * longer needed. The passive cooling formula uses tc1 and tc2 as described in 1291 * longer needed. The passive cooling depends on the .get_trend() return value.
1301 * section 11.1.5.1 of the ACPI specification 3.0.
1302 */ 1292 */
1303struct thermal_zone_device *thermal_zone_device_register(const char *type, 1293struct thermal_zone_device *thermal_zone_device_register(const char *type,
1304 int trips, int mask, void *devdata, 1294 int trips, int mask, void *devdata,
1305 const struct thermal_zone_device_ops *ops, 1295 const struct thermal_zone_device_ops *ops,
1306 int tc1, int tc2, int passive_delay, int polling_delay) 1296 int passive_delay, int polling_delay)
1307{ 1297{
1308 struct thermal_zone_device *tz; 1298 struct thermal_zone_device *tz;
1309 struct thermal_cooling_device *pos; 1299 struct thermal_cooling_device *pos;
@@ -1339,8 +1329,6 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
1339 tz->device.class = &thermal_class; 1329 tz->device.class = &thermal_class;
1340 tz->devdata = devdata; 1330 tz->devdata = devdata;
1341 tz->trips = trips; 1331 tz->trips = trips;
1342 tz->tc1 = tc1;
1343 tz->tc2 = tc2;
1344 tz->passive_delay = passive_delay; 1332 tz->passive_delay = passive_delay;
1345 tz->polling_delay = polling_delay; 1333 tz->polling_delay = polling_delay;
1346 1334