aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/thermal.c5
-rw-r--r--drivers/platform/x86/acerhdf.c2
-rw-r--r--drivers/platform/x86/intel_mid_thermal.c2
-rw-r--r--drivers/power/power_supply_core.c2
-rw-r--r--drivers/staging/omap-thermal/omap-thermal-common.c2
-rw-r--r--drivers/thermal/spear_thermal.c2
-rw-r--r--drivers/thermal/thermal_sys.c24
-rw-r--r--include/linux/thermal.h5
8 files changed, 13 insertions, 31 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index bb95709a6be8..07cb2172bd09 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -897,15 +897,12 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
897 tz->thermal_zone = 897 tz->thermal_zone =
898 thermal_zone_device_register("acpitz", trips, 0, tz, 898 thermal_zone_device_register("acpitz", trips, 0, tz,
899 &acpi_thermal_zone_ops, 899 &acpi_thermal_zone_ops,
900 tz->trips.passive.tc1,
901 tz->trips.passive.tc2,
902 tz->trips.passive.tsp*100, 900 tz->trips.passive.tsp*100,
903 tz->polling_frequency*100); 901 tz->polling_frequency*100);
904 else 902 else
905 tz->thermal_zone = 903 tz->thermal_zone =
906 thermal_zone_device_register("acpitz", trips, 0, tz, 904 thermal_zone_device_register("acpitz", trips, 0, tz,
907 &acpi_thermal_zone_ops, 905 &acpi_thermal_zone_ops, 0,
908 0, 0, 0,
909 tz->polling_frequency*100); 906 tz->polling_frequency*100);
910 if (IS_ERR(tz->thermal_zone)) 907 if (IS_ERR(tz->thermal_zone))
911 return -ENODEV; 908 return -ENODEV;
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index a207466f4ba8..84c56881ba80 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -662,7 +662,7 @@ static int acerhdf_register_thermal(void)
662 return -EINVAL; 662 return -EINVAL;
663 663
664 thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL, 664 thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
665 &acerhdf_dev_ops, 0, 0, 0, 665 &acerhdf_dev_ops, 0,
666 (kernelmode) ? interval*1000 : 0); 666 (kernelmode) ? interval*1000 : 0);
667 if (IS_ERR(thz_dev)) 667 if (IS_ERR(thz_dev))
668 return -EINVAL; 668 return -EINVAL;
diff --git a/drivers/platform/x86/intel_mid_thermal.c b/drivers/platform/x86/intel_mid_thermal.c
index 3a27113deda9..c8097616dd62 100644
--- a/drivers/platform/x86/intel_mid_thermal.c
+++ b/drivers/platform/x86/intel_mid_thermal.c
@@ -502,7 +502,7 @@ static int mid_thermal_probe(struct platform_device *pdev)
502 goto err; 502 goto err;
503 } 503 }
504 pinfo->tzd[i] = thermal_zone_device_register(name[i], 504 pinfo->tzd[i] = thermal_zone_device_register(name[i],
505 0, 0, td_info, &tzd_ops, 0, 0, 0, 0); 505 0, 0, td_info, &tzd_ops, 0, 0);
506 if (IS_ERR(pinfo->tzd[i])) { 506 if (IS_ERR(pinfo->tzd[i])) {
507 kfree(td_info); 507 kfree(td_info);
508 ret = PTR_ERR(pinfo->tzd[i]); 508 ret = PTR_ERR(pinfo->tzd[i]);
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
index 08cc8a3c15af..2436f1350013 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -201,7 +201,7 @@ static int psy_register_thermal(struct power_supply *psy)
201 for (i = 0; i < psy->num_properties; i++) { 201 for (i = 0; i < psy->num_properties; i++) {
202 if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) { 202 if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) {
203 psy->tzd = thermal_zone_device_register(psy->name, 0, 0, 203 psy->tzd = thermal_zone_device_register(psy->name, 0, 0,
204 psy, &psy_tzd_ops, 0, 0, 0, 0); 204 psy, &psy_tzd_ops, 0, 0);
205 if (IS_ERR(psy->tzd)) 205 if (IS_ERR(psy->tzd))
206 return PTR_ERR(psy->tzd); 206 return PTR_ERR(psy->tzd);
207 break; 207 break;
diff --git a/drivers/staging/omap-thermal/omap-thermal-common.c b/drivers/staging/omap-thermal/omap-thermal-common.c
index 0675a5e2f7c8..d543d5c37152 100644
--- a/drivers/staging/omap-thermal/omap-thermal-common.c
+++ b/drivers/staging/omap-thermal/omap-thermal-common.c
@@ -246,7 +246,7 @@ int omap_thermal_expose_sensor(struct omap_bandgap *bg_ptr, int id,
246 /* Create thermal zone */ 246 /* Create thermal zone */
247 data->omap_thermal = thermal_zone_device_register(domain, 247 data->omap_thermal = thermal_zone_device_register(domain,
248 OMAP_TRIP_NUMBER, 0, data, &omap_thermal_ops, 248 OMAP_TRIP_NUMBER, 0, data, &omap_thermal_ops,
249 0, FAST_TEMP_MONITORING_RATE, 0, 0); 249 0, FAST_TEMP_MONITORING_RATE);
250 if (IS_ERR_OR_NULL(data->omap_thermal)) { 250 if (IS_ERR_OR_NULL(data->omap_thermal)) {
251 dev_err(bg_ptr->dev, "thermal zone device is NULL\n"); 251 dev_err(bg_ptr->dev, "thermal zone device is NULL\n");
252 return PTR_ERR(data->omap_thermal); 252 return PTR_ERR(data->omap_thermal);
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
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 6a1d43d2ec92..38267a595d69 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -115,8 +115,6 @@ struct thermal_zone_device {
115 struct thermal_attr *trip_hyst_attrs; 115 struct thermal_attr *trip_hyst_attrs;
116 void *devdata; 116 void *devdata;
117 int trips; 117 int trips;
118 int tc1;
119 int tc2;
120 int passive_delay; 118 int passive_delay;
121 int polling_delay; 119 int polling_delay;
122 int temperature; 120 int temperature;
@@ -163,8 +161,7 @@ enum {
163#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1) 161#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1)
164 162
165struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, 163struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
166 void *, const struct thermal_zone_device_ops *, int tc1, 164 void *, const struct thermal_zone_device_ops *, int, int);
167 int tc2, int passive_freq, int polling_freq);
168void thermal_zone_device_unregister(struct thermal_zone_device *); 165void thermal_zone_device_unregister(struct thermal_zone_device *);
169 166
170int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, 167int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,