diff options
44 files changed, 509 insertions, 197 deletions
diff --git a/Documentation/thermal/sysfs-api.txt b/Documentation/thermal/sysfs-api.txt index c1f6864a8c5d..10f062ea6bc2 100644 --- a/Documentation/thermal/sysfs-api.txt +++ b/Documentation/thermal/sysfs-api.txt | |||
| @@ -180,6 +180,7 @@ Thermal zone device sys I/F, created once it's registered: | |||
| 180 | |---temp: Current temperature | 180 | |---temp: Current temperature |
| 181 | |---mode: Working mode of the thermal zone | 181 | |---mode: Working mode of the thermal zone |
| 182 | |---policy: Thermal governor used for this zone | 182 | |---policy: Thermal governor used for this zone |
| 183 | |---available_policies: Available thermal governors for this zone | ||
| 183 | |---trip_point_[0-*]_temp: Trip point temperature | 184 | |---trip_point_[0-*]_temp: Trip point temperature |
| 184 | |---trip_point_[0-*]_type: Trip point type | 185 | |---trip_point_[0-*]_type: Trip point type |
| 185 | |---trip_point_[0-*]_hyst: Hysteresis value for this trip point | 186 | |---trip_point_[0-*]_hyst: Hysteresis value for this trip point |
| @@ -256,6 +257,10 @@ policy | |||
| 256 | One of the various thermal governors used for a particular zone. | 257 | One of the various thermal governors used for a particular zone. |
| 257 | RW, Required | 258 | RW, Required |
| 258 | 259 | ||
| 260 | available_policies | ||
| 261 | Available thermal governors which can be used for a particular zone. | ||
| 262 | RO, Required | ||
| 263 | |||
| 259 | trip_point_[0-*]_temp | 264 | trip_point_[0-*]_temp |
| 260 | The temperature above which trip point will be fired. | 265 | The temperature above which trip point will be fired. |
| 261 | Unit: millidegree Celsius | 266 | Unit: millidegree Celsius |
| @@ -417,6 +422,7 @@ method, the sys I/F structure will be built like this: | |||
| 417 | |---temp: 37000 | 422 | |---temp: 37000 |
| 418 | |---mode: enabled | 423 | |---mode: enabled |
| 419 | |---policy: step_wise | 424 | |---policy: step_wise |
| 425 | |---available_policies: step_wise fair_share | ||
| 420 | |---trip_point_0_temp: 100000 | 426 | |---trip_point_0_temp: 100000 |
| 421 | |---trip_point_0_type: critical | 427 | |---trip_point_0_type: critical |
| 422 | |---trip_point_1_temp: 80000 | 428 | |---trip_point_1_temp: 80000 |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index fc28b9f5aa84..30d8518b25fb 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
| @@ -525,8 +525,7 @@ static void acpi_thermal_check(void *data) | |||
| 525 | 525 | ||
| 526 | /* sys I/F for generic thermal sysfs support */ | 526 | /* sys I/F for generic thermal sysfs support */ |
| 527 | 527 | ||
| 528 | static int thermal_get_temp(struct thermal_zone_device *thermal, | 528 | static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) |
| 529 | unsigned long *temp) | ||
| 530 | { | 529 | { |
| 531 | struct acpi_thermal *tz = thermal->devdata; | 530 | struct acpi_thermal *tz = thermal->devdata; |
| 532 | int result; | 531 | int result; |
| @@ -633,7 +632,7 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal, | |||
| 633 | } | 632 | } |
| 634 | 633 | ||
| 635 | static int thermal_get_trip_temp(struct thermal_zone_device *thermal, | 634 | static int thermal_get_trip_temp(struct thermal_zone_device *thermal, |
| 636 | int trip, unsigned long *temp) | 635 | int trip, int *temp) |
| 637 | { | 636 | { |
| 638 | struct acpi_thermal *tz = thermal->devdata; | 637 | struct acpi_thermal *tz = thermal->devdata; |
| 639 | int i; | 638 | int i; |
| @@ -686,7 +685,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, | |||
| 686 | } | 685 | } |
| 687 | 686 | ||
| 688 | static int thermal_get_crit_temp(struct thermal_zone_device *thermal, | 687 | static int thermal_get_crit_temp(struct thermal_zone_device *thermal, |
| 689 | unsigned long *temperature) { | 688 | int *temperature) |
| 689 | { | ||
| 690 | struct acpi_thermal *tz = thermal->devdata; | 690 | struct acpi_thermal *tz = thermal->devdata; |
| 691 | 691 | ||
| 692 | if (tz->trips.critical.flags.valid) { | 692 | if (tz->trips.critical.flags.valid) { |
| @@ -709,8 +709,8 @@ static int thermal_get_trend(struct thermal_zone_device *thermal, | |||
| 709 | return -EINVAL; | 709 | return -EINVAL; |
| 710 | 710 | ||
| 711 | if (type == THERMAL_TRIP_ACTIVE) { | 711 | if (type == THERMAL_TRIP_ACTIVE) { |
| 712 | unsigned long trip_temp; | 712 | int trip_temp; |
| 713 | unsigned long temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET( | 713 | int temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET( |
| 714 | tz->temperature, tz->kelvin_offset); | 714 | tz->temperature, tz->kelvin_offset); |
| 715 | if (thermal_get_trip_temp(thermal, trip, &trip_temp)) | 715 | if (thermal_get_trip_temp(thermal, trip, &trip_temp)) |
| 716 | return -EINVAL; | 716 | return -EINVAL; |
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index fe41d5ae7cb2..e4e57bbafb10 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
| @@ -104,7 +104,7 @@ static inline long lm75_reg_to_mc(s16 temp, u8 resolution) | |||
| 104 | 104 | ||
| 105 | /* sysfs attributes for hwmon */ | 105 | /* sysfs attributes for hwmon */ |
| 106 | 106 | ||
| 107 | static int lm75_read_temp(void *dev, long *temp) | 107 | static int lm75_read_temp(void *dev, int *temp) |
| 108 | { | 108 | { |
| 109 | struct lm75_data *data = lm75_update_device(dev); | 109 | struct lm75_data *data = lm75_update_device(dev); |
| 110 | 110 | ||
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index dc0b76c5e302..feed30646d91 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c | |||
| @@ -477,7 +477,7 @@ static int ntc_thermistor_get_ohm(struct ntc_data *data) | |||
| 477 | return -EINVAL; | 477 | return -EINVAL; |
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | static int ntc_read_temp(void *dev, long *temp) | 480 | static int ntc_read_temp(void *dev, int *temp) |
| 481 | { | 481 | { |
| 482 | struct ntc_data *data = dev_get_drvdata(dev); | 482 | struct ntc_data *data = dev_get_drvdata(dev); |
| 483 | int ohm; | 483 | int ohm; |
diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c index 9da2735f1424..65482624ea2c 100644 --- a/drivers/hwmon/tmp102.c +++ b/drivers/hwmon/tmp102.c | |||
| @@ -98,7 +98,7 @@ static struct tmp102 *tmp102_update_device(struct device *dev) | |||
| 98 | return tmp102; | 98 | return tmp102; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | static int tmp102_read_temp(void *dev, long *temp) | 101 | static int tmp102_read_temp(void *dev, int *temp) |
| 102 | { | 102 | { |
| 103 | struct tmp102 *tmp102 = tmp102_update_device(dev); | 103 | struct tmp102 *tmp102 = tmp102_update_device(dev); |
| 104 | 104 | ||
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c index c0116994067d..485794376ee5 100644 --- a/drivers/input/touchscreen/sun4i-ts.c +++ b/drivers/input/touchscreen/sun4i-ts.c | |||
| @@ -191,7 +191,7 @@ static void sun4i_ts_close(struct input_dev *dev) | |||
| 191 | writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); | 191 | writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | static int sun4i_get_temp(const struct sun4i_ts_data *ts, long *temp) | 194 | static int sun4i_get_temp(const struct sun4i_ts_data *ts, int *temp) |
| 195 | { | 195 | { |
| 196 | /* No temp_data until the first irq */ | 196 | /* No temp_data until the first irq */ |
| 197 | if (ts->temp_data == -1) | 197 | if (ts->temp_data == -1) |
| @@ -202,7 +202,7 @@ static int sun4i_get_temp(const struct sun4i_ts_data *ts, long *temp) | |||
| 202 | return 0; | 202 | return 0; |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | static int sun4i_get_tz_temp(void *data, long *temp) | 205 | static int sun4i_get_tz_temp(void *data, int *temp) |
| 206 | { | 206 | { |
| 207 | return sun4i_get_temp(data, temp); | 207 | return sun4i_get_temp(data, temp); |
| 208 | } | 208 | } |
| @@ -215,14 +215,14 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, | |||
| 215 | char *buf) | 215 | char *buf) |
| 216 | { | 216 | { |
| 217 | struct sun4i_ts_data *ts = dev_get_drvdata(dev); | 217 | struct sun4i_ts_data *ts = dev_get_drvdata(dev); |
| 218 | long temp; | 218 | int temp; |
| 219 | int error; | 219 | int error; |
| 220 | 220 | ||
| 221 | error = sun4i_get_temp(ts, &temp); | 221 | error = sun4i_get_temp(ts, &temp); |
| 222 | if (error) | 222 | if (error) |
| 223 | return error; | 223 | return error; |
| 224 | 224 | ||
| 225 | return sprintf(buf, "%ld\n", temp); | 225 | return sprintf(buf, "%d\n", temp); |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | static ssize_t show_temp_label(struct device *dev, | 228 | static ssize_t show_temp_label(struct device *dev, |
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 1ef02daddb60..460fa6708bfc 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c | |||
| @@ -346,8 +346,7 @@ static void acerhdf_check_param(struct thermal_zone_device *thermal) | |||
| 346 | * as late as the polling interval is since we can't do that in the respective | 346 | * as late as the polling interval is since we can't do that in the respective |
| 347 | * accessors of the module parameters. | 347 | * accessors of the module parameters. |
| 348 | */ | 348 | */ |
| 349 | static int acerhdf_get_ec_temp(struct thermal_zone_device *thermal, | 349 | static int acerhdf_get_ec_temp(struct thermal_zone_device *thermal, int *t) |
| 350 | unsigned long *t) | ||
| 351 | { | 350 | { |
| 352 | int temp, err = 0; | 351 | int temp, err = 0; |
| 353 | 352 | ||
| @@ -453,7 +452,7 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip, | |||
| 453 | } | 452 | } |
| 454 | 453 | ||
| 455 | static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip, | 454 | static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip, |
| 456 | unsigned long *temp) | 455 | int *temp) |
| 457 | { | 456 | { |
| 458 | if (trip != 0) | 457 | if (trip != 0) |
| 459 | return -EINVAL; | 458 | return -EINVAL; |
| @@ -464,7 +463,7 @@ static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip, | |||
| 464 | } | 463 | } |
| 465 | 464 | ||
| 466 | static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip, | 465 | static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip, |
| 467 | unsigned long *temp) | 466 | int *temp) |
| 468 | { | 467 | { |
| 469 | if (trip == 0) | 468 | if (trip == 0) |
| 470 | *temp = fanon; | 469 | *temp = fanon; |
| @@ -477,7 +476,7 @@ static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip, | |||
| 477 | } | 476 | } |
| 478 | 477 | ||
| 479 | static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal, | 478 | static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal, |
| 480 | unsigned long *temperature) | 479 | int *temperature) |
| 481 | { | 480 | { |
| 482 | *temperature = ACERHDF_TEMP_CRIT; | 481 | *temperature = ACERHDF_TEMP_CRIT; |
| 483 | return 0; | 482 | return 0; |
diff --git a/drivers/platform/x86/intel_mid_thermal.c b/drivers/platform/x86/intel_mid_thermal.c index 0944e834af8d..9f713b832ba3 100644 --- a/drivers/platform/x86/intel_mid_thermal.c +++ b/drivers/platform/x86/intel_mid_thermal.c | |||
| @@ -132,7 +132,7 @@ static int is_valid_adc(uint16_t adc_val, uint16_t min, uint16_t max) | |||
| 132 | * to achieve very close approximate temp value with less than | 132 | * to achieve very close approximate temp value with less than |
| 133 | * 0.5C error | 133 | * 0.5C error |
| 134 | */ | 134 | */ |
| 135 | static int adc_to_temp(int direct, uint16_t adc_val, unsigned long *tp) | 135 | static int adc_to_temp(int direct, uint16_t adc_val, int *tp) |
| 136 | { | 136 | { |
| 137 | int temp; | 137 | int temp; |
| 138 | 138 | ||
| @@ -174,14 +174,13 @@ static int adc_to_temp(int direct, uint16_t adc_val, unsigned long *tp) | |||
| 174 | * | 174 | * |
| 175 | * Can sleep | 175 | * Can sleep |
| 176 | */ | 176 | */ |
| 177 | static int mid_read_temp(struct thermal_zone_device *tzd, unsigned long *temp) | 177 | static int mid_read_temp(struct thermal_zone_device *tzd, int *temp) |
| 178 | { | 178 | { |
| 179 | struct thermal_device_info *td_info = tzd->devdata; | 179 | struct thermal_device_info *td_info = tzd->devdata; |
| 180 | uint16_t adc_val, addr; | 180 | uint16_t adc_val, addr; |
| 181 | uint8_t data = 0; | 181 | uint8_t data = 0; |
| 182 | int ret; | 182 | int ret; |
| 183 | unsigned long curr_temp; | 183 | int curr_temp; |
| 184 | |||
| 185 | 184 | ||
| 186 | addr = td_info->chnl_addr; | 185 | addr = td_info->chnl_addr; |
| 187 | 186 | ||
| @@ -453,7 +452,7 @@ static SIMPLE_DEV_PM_OPS(mid_thermal_pm, | |||
| 453 | * | 452 | * |
| 454 | * Can sleep | 453 | * Can sleep |
| 455 | */ | 454 | */ |
| 456 | static int read_curr_temp(struct thermal_zone_device *tzd, unsigned long *temp) | 455 | static int read_curr_temp(struct thermal_zone_device *tzd, int *temp) |
| 457 | { | 456 | { |
| 458 | WARN_ON(tzd == NULL); | 457 | WARN_ON(tzd == NULL); |
| 459 | return mid_read_temp(tzd, temp); | 458 | return mid_read_temp(tzd, temp); |
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 1c202ccbd2a6..907293e6f2a4 100644 --- a/drivers/power/charger-manager.c +++ b/drivers/power/charger-manager.c | |||
| @@ -619,7 +619,7 @@ static int cm_get_battery_temperature(struct charger_manager *cm, | |||
| 619 | 619 | ||
| 620 | #ifdef CONFIG_THERMAL | 620 | #ifdef CONFIG_THERMAL |
| 621 | if (cm->tzd_batt) { | 621 | if (cm->tzd_batt) { |
| 622 | ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp); | 622 | ret = thermal_zone_get_temp(cm->tzd_batt, temp); |
| 623 | if (!ret) | 623 | if (!ret) |
| 624 | /* Calibrate temperature unit */ | 624 | /* Calibrate temperature unit */ |
| 625 | *temp /= 100; | 625 | *temp /= 100; |
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 869284c2e1e8..456987c88baa 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
| @@ -557,7 +557,7 @@ EXPORT_SYMBOL_GPL(power_supply_unreg_notifier); | |||
| 557 | 557 | ||
| 558 | #ifdef CONFIG_THERMAL | 558 | #ifdef CONFIG_THERMAL |
| 559 | static int power_supply_read_temp(struct thermal_zone_device *tzd, | 559 | static int power_supply_read_temp(struct thermal_zone_device *tzd, |
| 560 | unsigned long *temp) | 560 | int *temp) |
| 561 | { | 561 | { |
| 562 | struct power_supply *psy; | 562 | struct power_supply *psy; |
| 563 | union power_supply_propval val; | 563 | union power_supply_propval val; |
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 118938ee8552..039004400987 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig | |||
| @@ -340,6 +340,14 @@ config ACPI_THERMAL_REL | |||
| 340 | tristate | 340 | tristate |
| 341 | depends on ACPI | 341 | depends on ACPI |
| 342 | 342 | ||
| 343 | config INTEL_PCH_THERMAL | ||
| 344 | tristate "Intel PCH Thermal Reporting Driver" | ||
| 345 | depends on X86 && PCI | ||
| 346 | help | ||
| 347 | Enable this to support thermal reporting on certain intel PCHs. | ||
| 348 | Thermal reporting device will provide temperature reading, | ||
| 349 | programmable trip points and other information. | ||
| 350 | |||
| 343 | menu "Texas Instruments thermal drivers" | 351 | menu "Texas Instruments thermal drivers" |
| 344 | source "drivers/thermal/ti-soc-thermal/Kconfig" | 352 | source "drivers/thermal/ti-soc-thermal/Kconfig" |
| 345 | endmenu | 353 | endmenu |
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index 535dfee1496f..26f160809959 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile | |||
| @@ -41,6 +41,7 @@ obj-$(CONFIG_INTEL_SOC_DTS_THERMAL) += intel_soc_dts_thermal.o | |||
| 41 | obj-$(CONFIG_INTEL_QUARK_DTS_THERMAL) += intel_quark_dts_thermal.o | 41 | obj-$(CONFIG_INTEL_QUARK_DTS_THERMAL) += intel_quark_dts_thermal.o |
| 42 | obj-$(CONFIG_TI_SOC_THERMAL) += ti-soc-thermal/ | 42 | obj-$(CONFIG_TI_SOC_THERMAL) += ti-soc-thermal/ |
| 43 | obj-$(CONFIG_INT340X_THERMAL) += int340x_thermal/ | 43 | obj-$(CONFIG_INT340X_THERMAL) += int340x_thermal/ |
| 44 | obj-$(CONFIG_INTEL_PCH_THERMAL) += intel_pch_thermal.o | ||
| 44 | obj-$(CONFIG_ST_THERMAL) += st/ | 45 | obj-$(CONFIG_ST_THERMAL) += st/ |
| 45 | obj-$(CONFIG_TEGRA_SOCTHERM) += tegra_soctherm.o | 46 | obj-$(CONFIG_TEGRA_SOCTHERM) += tegra_soctherm.o |
| 46 | obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o | 47 | obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o |
diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 01255fd65135..26b8d326546a 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c | |||
| @@ -155,7 +155,7 @@ static bool armada_is_valid(struct armada_thermal_priv *priv) | |||
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | static int armada_get_temp(struct thermal_zone_device *thermal, | 157 | static int armada_get_temp(struct thermal_zone_device *thermal, |
| 158 | unsigned long *temp) | 158 | int *temp) |
| 159 | { | 159 | { |
| 160 | struct armada_thermal_priv *priv = thermal->devdata; | 160 | struct armada_thermal_priv *priv = thermal->devdata; |
| 161 | unsigned long reg; | 161 | unsigned long reg; |
diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c index 2fb273c4baa9..652acd8fbe48 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c | |||
| @@ -107,8 +107,7 @@ static int db8500_cdev_unbind(struct thermal_zone_device *thermal, | |||
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | /* Callback to get current temperature */ | 109 | /* Callback to get current temperature */ |
| 110 | static int db8500_sys_get_temp(struct thermal_zone_device *thermal, | 110 | static int db8500_sys_get_temp(struct thermal_zone_device *thermal, int *temp) |
| 111 | unsigned long *temp) | ||
| 112 | { | 111 | { |
| 113 | struct db8500_thermal_zone *pzone = thermal->devdata; | 112 | struct db8500_thermal_zone *pzone = thermal->devdata; |
| 114 | 113 | ||
| @@ -180,7 +179,7 @@ static int db8500_sys_get_trip_type(struct thermal_zone_device *thermal, | |||
| 180 | 179 | ||
| 181 | /* Callback to get trip point temperature */ | 180 | /* Callback to get trip point temperature */ |
| 182 | static int db8500_sys_get_trip_temp(struct thermal_zone_device *thermal, | 181 | static int db8500_sys_get_trip_temp(struct thermal_zone_device *thermal, |
| 183 | int trip, unsigned long *temp) | 182 | int trip, int *temp) |
| 184 | { | 183 | { |
| 185 | struct db8500_thermal_zone *pzone = thermal->devdata; | 184 | struct db8500_thermal_zone *pzone = thermal->devdata; |
| 186 | struct db8500_thsens_platform_data *ptrips = pzone->trip_tab; | 185 | struct db8500_thsens_platform_data *ptrips = pzone->trip_tab; |
| @@ -195,7 +194,7 @@ static int db8500_sys_get_trip_temp(struct thermal_zone_device *thermal, | |||
| 195 | 194 | ||
| 196 | /* Callback to get critical trip point temperature */ | 195 | /* Callback to get critical trip point temperature */ |
| 197 | static int db8500_sys_get_crit_temp(struct thermal_zone_device *thermal, | 196 | static int db8500_sys_get_crit_temp(struct thermal_zone_device *thermal, |
| 198 | unsigned long *temp) | 197 | int *temp) |
| 199 | { | 198 | { |
| 200 | struct db8500_thermal_zone *pzone = thermal->devdata; | 199 | struct db8500_thermal_zone *pzone = thermal->devdata; |
| 201 | struct db8500_thsens_platform_data *ptrips = pzone->trip_tab; | 200 | struct db8500_thsens_platform_data *ptrips = pzone->trip_tab; |
diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index 09f6e304c274..a0bc9de42553 100644 --- a/drivers/thermal/dove_thermal.c +++ b/drivers/thermal/dove_thermal.c | |||
| @@ -93,7 +93,7 @@ static int dove_init_sensor(const struct dove_thermal_priv *priv) | |||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | static int dove_get_temp(struct thermal_zone_device *thermal, | 95 | static int dove_get_temp(struct thermal_zone_device *thermal, |
| 96 | unsigned long *temp) | 96 | int *temp) |
| 97 | { | 97 | { |
| 98 | unsigned long reg; | 98 | unsigned long reg; |
| 99 | struct dove_thermal_priv *priv = thermal->devdata; | 99 | struct dove_thermal_priv *priv = thermal->devdata; |
diff --git a/drivers/thermal/fair_share.c b/drivers/thermal/fair_share.c index c2c10bbe24d6..34fe36504a55 100644 --- a/drivers/thermal/fair_share.c +++ b/drivers/thermal/fair_share.c | |||
| @@ -34,7 +34,7 @@ | |||
| 34 | static int get_trip_level(struct thermal_zone_device *tz) | 34 | static int get_trip_level(struct thermal_zone_device *tz) |
| 35 | { | 35 | { |
| 36 | int count = 0; | 36 | int count = 0; |
| 37 | unsigned long trip_temp; | 37 | int trip_temp; |
| 38 | enum thermal_trip_type trip_type; | 38 | enum thermal_trip_type trip_type; |
| 39 | 39 | ||
| 40 | if (tz->trips == 0 || !tz->ops->get_trip_temp) | 40 | if (tz->trips == 0 || !tz->ops->get_trip_temp) |
diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c index c5dd76b2ee74..70836c5b89bc 100644 --- a/drivers/thermal/gov_bang_bang.c +++ b/drivers/thermal/gov_bang_bang.c | |||
| @@ -25,14 +25,13 @@ | |||
| 25 | 25 | ||
| 26 | static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) | 26 | static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) |
| 27 | { | 27 | { |
| 28 | long trip_temp; | 28 | int trip_temp, trip_hyst; |
| 29 | unsigned long trip_hyst; | ||
| 30 | struct thermal_instance *instance; | 29 | struct thermal_instance *instance; |
| 31 | 30 | ||
| 32 | tz->ops->get_trip_temp(tz, trip, &trip_temp); | 31 | tz->ops->get_trip_temp(tz, trip, &trip_temp); |
| 33 | tz->ops->get_trip_hyst(tz, trip, &trip_hyst); | 32 | tz->ops->get_trip_hyst(tz, trip, &trip_hyst); |
| 34 | 33 | ||
| 35 | dev_dbg(&tz->device, "Trip%d[temp=%ld]:temp=%d:hyst=%ld\n", | 34 | dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n", |
| 36 | trip, trip_temp, tz->temperature, | 35 | trip, trip_temp, tz->temperature, |
| 37 | trip_hyst); | 36 | trip_hyst); |
| 38 | 37 | ||
diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index b49f97c734d0..36d07295f8e3 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c | |||
| @@ -155,7 +155,7 @@ static void hisi_thermal_disable_sensor(struct hisi_thermal_data *data) | |||
| 155 | mutex_unlock(&data->thermal_lock); | 155 | mutex_unlock(&data->thermal_lock); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | static int hisi_thermal_get_temp(void *_sensor, long *temp) | 158 | static int hisi_thermal_get_temp(void *_sensor, int *temp) |
| 159 | { | 159 | { |
| 160 | struct hisi_thermal_sensor *sensor = _sensor; | 160 | struct hisi_thermal_sensor *sensor = _sensor; |
| 161 | struct hisi_thermal_data *data = sensor->thermal; | 161 | struct hisi_thermal_data *data = sensor->thermal; |
| @@ -178,7 +178,7 @@ static int hisi_thermal_get_temp(void *_sensor, long *temp) | |||
| 178 | data->irq_bind_sensor = sensor_id; | 178 | data->irq_bind_sensor = sensor_id; |
| 179 | mutex_unlock(&data->thermal_lock); | 179 | mutex_unlock(&data->thermal_lock); |
| 180 | 180 | ||
| 181 | dev_dbg(&data->pdev->dev, "id=%d, irq=%d, temp=%ld, thres=%d\n", | 181 | dev_dbg(&data->pdev->dev, "id=%d, irq=%d, temp=%d, thres=%d\n", |
| 182 | sensor->id, data->irq_enabled, *temp, sensor->thres_temp); | 182 | sensor->id, data->irq_enabled, *temp, sensor->thres_temp); |
| 183 | /* | 183 | /* |
| 184 | * Bind irq to sensor for two cases: | 184 | * Bind irq to sensor for two cases: |
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index fde4c2876d14..4bec1d3c3d27 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c | |||
| @@ -98,10 +98,10 @@ struct imx_thermal_data { | |||
| 98 | enum thermal_device_mode mode; | 98 | enum thermal_device_mode mode; |
| 99 | struct regmap *tempmon; | 99 | struct regmap *tempmon; |
| 100 | u32 c1, c2; /* See formula in imx_get_sensor_data() */ | 100 | u32 c1, c2; /* See formula in imx_get_sensor_data() */ |
| 101 | unsigned long temp_passive; | 101 | int temp_passive; |
| 102 | unsigned long temp_critical; | 102 | int temp_critical; |
| 103 | unsigned long alarm_temp; | 103 | int alarm_temp; |
| 104 | unsigned long last_temp; | 104 | int last_temp; |
| 105 | bool irq_enabled; | 105 | bool irq_enabled; |
| 106 | int irq; | 106 | int irq; |
| 107 | struct clk *thermal_clk; | 107 | struct clk *thermal_clk; |
| @@ -109,7 +109,7 @@ struct imx_thermal_data { | |||
| 109 | }; | 109 | }; |
| 110 | 110 | ||
| 111 | static void imx_set_panic_temp(struct imx_thermal_data *data, | 111 | static void imx_set_panic_temp(struct imx_thermal_data *data, |
| 112 | signed long panic_temp) | 112 | int panic_temp) |
| 113 | { | 113 | { |
| 114 | struct regmap *map = data->tempmon; | 114 | struct regmap *map = data->tempmon; |
| 115 | int critical_value; | 115 | int critical_value; |
| @@ -121,7 +121,7 @@ static void imx_set_panic_temp(struct imx_thermal_data *data, | |||
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | static void imx_set_alarm_temp(struct imx_thermal_data *data, | 123 | static void imx_set_alarm_temp(struct imx_thermal_data *data, |
| 124 | signed long alarm_temp) | 124 | int alarm_temp) |
| 125 | { | 125 | { |
| 126 | struct regmap *map = data->tempmon; | 126 | struct regmap *map = data->tempmon; |
| 127 | int alarm_value; | 127 | int alarm_value; |
| @@ -133,7 +133,7 @@ static void imx_set_alarm_temp(struct imx_thermal_data *data, | |||
| 133 | TEMPSENSE0_ALARM_VALUE_SHIFT); | 133 | TEMPSENSE0_ALARM_VALUE_SHIFT); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | static int imx_get_temp(struct thermal_zone_device *tz, unsigned long *temp) | 136 | static int imx_get_temp(struct thermal_zone_device *tz, int *temp) |
| 137 | { | 137 | { |
| 138 | struct imx_thermal_data *data = tz->devdata; | 138 | struct imx_thermal_data *data = tz->devdata; |
| 139 | struct regmap *map = data->tempmon; | 139 | struct regmap *map = data->tempmon; |
| @@ -189,13 +189,13 @@ static int imx_get_temp(struct thermal_zone_device *tz, unsigned long *temp) | |||
| 189 | if (data->alarm_temp == data->temp_critical && | 189 | if (data->alarm_temp == data->temp_critical && |
| 190 | *temp < data->temp_passive) { | 190 | *temp < data->temp_passive) { |
| 191 | imx_set_alarm_temp(data, data->temp_passive); | 191 | imx_set_alarm_temp(data, data->temp_passive); |
| 192 | dev_dbg(&tz->device, "thermal alarm off: T < %lu\n", | 192 | dev_dbg(&tz->device, "thermal alarm off: T < %d\n", |
| 193 | data->alarm_temp / 1000); | 193 | data->alarm_temp / 1000); |
| 194 | } | 194 | } |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | if (*temp != data->last_temp) { | 197 | if (*temp != data->last_temp) { |
| 198 | dev_dbg(&tz->device, "millicelsius: %ld\n", *temp); | 198 | dev_dbg(&tz->device, "millicelsius: %d\n", *temp); |
| 199 | data->last_temp = *temp; | 199 | data->last_temp = *temp; |
| 200 | } | 200 | } |
| 201 | 201 | ||
| @@ -262,8 +262,7 @@ static int imx_get_trip_type(struct thermal_zone_device *tz, int trip, | |||
| 262 | return 0; | 262 | return 0; |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | static int imx_get_crit_temp(struct thermal_zone_device *tz, | 265 | static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp) |
| 266 | unsigned long *temp) | ||
| 267 | { | 266 | { |
| 268 | struct imx_thermal_data *data = tz->devdata; | 267 | struct imx_thermal_data *data = tz->devdata; |
| 269 | 268 | ||
| @@ -272,7 +271,7 @@ static int imx_get_crit_temp(struct thermal_zone_device *tz, | |||
| 272 | } | 271 | } |
| 273 | 272 | ||
| 274 | static int imx_get_trip_temp(struct thermal_zone_device *tz, int trip, | 273 | static int imx_get_trip_temp(struct thermal_zone_device *tz, int trip, |
| 275 | unsigned long *temp) | 274 | int *temp) |
| 276 | { | 275 | { |
| 277 | struct imx_thermal_data *data = tz->devdata; | 276 | struct imx_thermal_data *data = tz->devdata; |
| 278 | 277 | ||
| @@ -282,7 +281,7 @@ static int imx_get_trip_temp(struct thermal_zone_device *tz, int trip, | |||
| 282 | } | 281 | } |
| 283 | 282 | ||
| 284 | static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip, | 283 | static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip, |
| 285 | unsigned long temp) | 284 | int temp) |
| 286 | { | 285 | { |
| 287 | struct imx_thermal_data *data = tz->devdata; | 286 | struct imx_thermal_data *data = tz->devdata; |
| 288 | 287 | ||
| @@ -434,7 +433,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev) | |||
| 434 | { | 433 | { |
| 435 | struct imx_thermal_data *data = dev; | 434 | struct imx_thermal_data *data = dev; |
| 436 | 435 | ||
| 437 | dev_dbg(&data->tz->device, "THERMAL ALARM: T > %lu\n", | 436 | dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n", |
| 438 | data->alarm_temp / 1000); | 437 | data->alarm_temp / 1000); |
| 439 | 438 | ||
| 440 | thermal_zone_device_update(data->tz); | 439 | thermal_zone_device_update(data->tz); |
diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c b/drivers/thermal/int340x_thermal/int3400_thermal.c index 031018e7a65b..5836e5554433 100644 --- a/drivers/thermal/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/int340x_thermal/int3400_thermal.c | |||
| @@ -186,7 +186,7 @@ static int int3400_thermal_run_osc(acpi_handle handle, | |||
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | static int int3400_thermal_get_temp(struct thermal_zone_device *thermal, | 188 | static int int3400_thermal_get_temp(struct thermal_zone_device *thermal, |
| 189 | unsigned long *temp) | 189 | int *temp) |
| 190 | { | 190 | { |
| 191 | *temp = 20 * 1000; /* faked temp sensor with 20C */ | 191 | *temp = 20 * 1000; /* faked temp sensor with 20C */ |
| 192 | return 0; | 192 | return 0; |
diff --git a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c index 1e25133d35e2..b9b2666aa94c 100644 --- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c +++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #include "int340x_thermal_zone.h" | 20 | #include "int340x_thermal_zone.h" |
| 21 | 21 | ||
| 22 | static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone, | 22 | static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone, |
| 23 | unsigned long *temp) | 23 | int *temp) |
| 24 | { | 24 | { |
| 25 | struct int34x_thermal_zone *d = zone->devdata; | 25 | struct int34x_thermal_zone *d = zone->devdata; |
| 26 | unsigned long long tmp; | 26 | unsigned long long tmp; |
| @@ -49,7 +49,7 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone, | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | static int int340x_thermal_get_trip_temp(struct thermal_zone_device *zone, | 51 | static int int340x_thermal_get_trip_temp(struct thermal_zone_device *zone, |
| 52 | int trip, unsigned long *temp) | 52 | int trip, int *temp) |
| 53 | { | 53 | { |
| 54 | struct int34x_thermal_zone *d = zone->devdata; | 54 | struct int34x_thermal_zone *d = zone->devdata; |
| 55 | int i; | 55 | int i; |
| @@ -114,7 +114,7 @@ static int int340x_thermal_get_trip_type(struct thermal_zone_device *zone, | |||
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, | 116 | static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, |
| 117 | int trip, unsigned long temp) | 117 | int trip, int temp) |
| 118 | { | 118 | { |
| 119 | struct int34x_thermal_zone *d = zone->devdata; | 119 | struct int34x_thermal_zone *d = zone->devdata; |
| 120 | acpi_status status; | 120 | acpi_status status; |
| @@ -136,7 +136,7 @@ static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, | |||
| 136 | 136 | ||
| 137 | 137 | ||
| 138 | static int int340x_thermal_get_trip_hyst(struct thermal_zone_device *zone, | 138 | static int int340x_thermal_get_trip_hyst(struct thermal_zone_device *zone, |
| 139 | int trip, unsigned long *temp) | 139 | int trip, int *temp) |
| 140 | { | 140 | { |
| 141 | struct int34x_thermal_zone *d = zone->devdata; | 141 | struct int34x_thermal_zone *d = zone->devdata; |
| 142 | acpi_status status; | 142 | acpi_status status; |
| @@ -163,7 +163,7 @@ static struct thermal_zone_device_ops int340x_thermal_zone_ops = { | |||
| 163 | }; | 163 | }; |
| 164 | 164 | ||
| 165 | static int int340x_thermal_get_trip_config(acpi_handle handle, char *name, | 165 | static int int340x_thermal_get_trip_config(acpi_handle handle, char *name, |
| 166 | unsigned long *temp) | 166 | int *temp) |
| 167 | { | 167 | { |
| 168 | unsigned long long r; | 168 | unsigned long long r; |
| 169 | acpi_status status; | 169 | acpi_status status; |
diff --git a/drivers/thermal/int340x_thermal/int340x_thermal_zone.h b/drivers/thermal/int340x_thermal/int340x_thermal_zone.h index 9f38ab72c4bf..aaadf724ff2e 100644 --- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.h +++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10 | 21 | #define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10 |
| 22 | 22 | ||
| 23 | struct active_trip { | 23 | struct active_trip { |
| 24 | unsigned long temp; | 24 | int temp; |
| 25 | int id; | 25 | int id; |
| 26 | bool valid; | 26 | bool valid; |
| 27 | }; | 27 | }; |
| @@ -31,11 +31,11 @@ struct int34x_thermal_zone { | |||
| 31 | struct active_trip act_trips[INT340X_THERMAL_MAX_ACT_TRIP_COUNT]; | 31 | struct active_trip act_trips[INT340X_THERMAL_MAX_ACT_TRIP_COUNT]; |
| 32 | unsigned long *aux_trips; | 32 | unsigned long *aux_trips; |
| 33 | int aux_trip_nr; | 33 | int aux_trip_nr; |
| 34 | unsigned long psv_temp; | 34 | int psv_temp; |
| 35 | int psv_trip_id; | 35 | int psv_trip_id; |
| 36 | unsigned long crt_temp; | 36 | int crt_temp; |
| 37 | int crt_trip_id; | 37 | int crt_trip_id; |
| 38 | unsigned long hot_temp; | 38 | int hot_temp; |
| 39 | int hot_trip_id; | 39 | int hot_trip_id; |
| 40 | struct thermal_zone_device *zone; | 40 | struct thermal_zone_device *zone; |
| 41 | struct thermal_zone_device_ops *override_ops; | 41 | struct thermal_zone_device_ops *override_ops; |
diff --git a/drivers/thermal/int340x_thermal/processor_thermal_device.c b/drivers/thermal/int340x_thermal/processor_thermal_device.c index 3df3dc34b124..ccc0ad02d066 100644 --- a/drivers/thermal/int340x_thermal/processor_thermal_device.c +++ b/drivers/thermal/int340x_thermal/processor_thermal_device.c | |||
| @@ -145,7 +145,7 @@ static int get_tjmax(void) | |||
| 145 | return -EINVAL; | 145 | return -EINVAL; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | static int read_temp_msr(unsigned long *temp) | 148 | static int read_temp_msr(int *temp) |
| 149 | { | 149 | { |
| 150 | int cpu; | 150 | int cpu; |
| 151 | u32 eax, edx; | 151 | u32 eax, edx; |
| @@ -177,7 +177,7 @@ err_ret: | |||
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | static int proc_thermal_get_zone_temp(struct thermal_zone_device *zone, | 179 | static int proc_thermal_get_zone_temp(struct thermal_zone_device *zone, |
| 180 | unsigned long *temp) | 180 | int *temp) |
| 181 | { | 181 | { |
| 182 | int ret; | 182 | int ret; |
| 183 | 183 | ||
diff --git a/drivers/thermal/intel_pch_thermal.c b/drivers/thermal/intel_pch_thermal.c new file mode 100644 index 000000000000..1650a62484bd --- /dev/null +++ b/drivers/thermal/intel_pch_thermal.c | |||
| @@ -0,0 +1,286 @@ | |||
| 1 | /* intel_pch_thermal.c - Intel PCH Thermal driver | ||
| 2 | * | ||
| 3 | * Copyright (c) 2015, Intel Corporation. | ||
| 4 | * | ||
| 5 | * Authors: | ||
| 6 | * Tushar Dave <tushar.n.dave@intel.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms and conditions of the GNU General Public License, | ||
| 10 | * version 2, as published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 15 | * more details. | ||
| 16 | * | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/module.h> | ||
| 20 | #include <linux/types.h> | ||
| 21 | #include <linux/init.h> | ||
| 22 | #include <linux/pci.h> | ||
| 23 | #include <linux/thermal.h> | ||
| 24 | |||
| 25 | /* Intel PCH thermal Device IDs */ | ||
| 26 | #define PCH_THERMAL_DID_WPT 0x9CA4 /* Wildcat Point */ | ||
| 27 | |||
| 28 | /* Wildcat Point-LP PCH Thermal registers */ | ||
| 29 | #define WPT_TEMP 0x0000 /* Temperature */ | ||
| 30 | #define WPT_TSC 0x04 /* Thermal Sensor Control */ | ||
| 31 | #define WPT_TSS 0x06 /* Thermal Sensor Status */ | ||
| 32 | #define WPT_TSEL 0x08 /* Thermal Sensor Enable and Lock */ | ||
| 33 | #define WPT_TSREL 0x0A /* Thermal Sensor Report Enable and Lock */ | ||
| 34 | #define WPT_TSMIC 0x0C /* Thermal Sensor SMI Control */ | ||
| 35 | #define WPT_CTT 0x0010 /* Catastrophic Trip Point */ | ||
| 36 | #define WPT_TAHV 0x0014 /* Thermal Alert High Value */ | ||
| 37 | #define WPT_TALV 0x0018 /* Thermal Alert Low Value */ | ||
| 38 | #define WPT_TL 0x00000040 /* Throttle Value */ | ||
| 39 | #define WPT_PHL 0x0060 /* PCH Hot Level */ | ||
| 40 | #define WPT_PHLC 0x62 /* PHL Control */ | ||
| 41 | #define WPT_TAS 0x80 /* Thermal Alert Status */ | ||
| 42 | #define WPT_TSPIEN 0x82 /* PCI Interrupt Event Enables */ | ||
| 43 | #define WPT_TSGPEN 0x84 /* General Purpose Event Enables */ | ||
| 44 | |||
| 45 | /* Wildcat Point-LP PCH Thermal Register bit definitions */ | ||
| 46 | #define WPT_TEMP_TSR 0x00ff /* Temp TS Reading */ | ||
| 47 | #define WPT_TSC_CPDE 0x01 /* Catastrophic Power-Down Enable */ | ||
| 48 | #define WPT_TSS_TSDSS 0x10 /* Thermal Sensor Dynamic Shutdown Status */ | ||
| 49 | #define WPT_TSS_GPES 0x08 /* GPE status */ | ||
| 50 | #define WPT_TSEL_ETS 0x01 /* Enable TS */ | ||
| 51 | #define WPT_TSEL_PLDB 0x80 /* TSEL Policy Lock-Down Bit */ | ||
| 52 | #define WPT_TL_TOL 0x000001FF /* T0 Level */ | ||
| 53 | #define WPT_TL_T1L 0x1ff00000 /* T1 Level */ | ||
| 54 | #define WPT_TL_TTEN 0x20000000 /* TT Enable */ | ||
| 55 | |||
| 56 | static char driver_name[] = "Intel PCH thermal driver"; | ||
| 57 | |||
| 58 | struct pch_thermal_device { | ||
| 59 | void __iomem *hw_base; | ||
| 60 | const struct pch_dev_ops *ops; | ||
| 61 | struct pci_dev *pdev; | ||
| 62 | struct thermal_zone_device *tzd; | ||
| 63 | int crt_trip_id; | ||
| 64 | unsigned long crt_temp; | ||
| 65 | int hot_trip_id; | ||
| 66 | unsigned long hot_temp; | ||
| 67 | }; | ||
| 68 | |||
| 69 | static int pch_wpt_init(struct pch_thermal_device *ptd, int *nr_trips) | ||
| 70 | { | ||
| 71 | u8 tsel; | ||
| 72 | u16 trip_temp; | ||
| 73 | |||
| 74 | *nr_trips = 0; | ||
| 75 | |||
| 76 | /* Check if BIOS has already enabled thermal sensor */ | ||
| 77 | if (WPT_TSS_TSDSS & readb(ptd->hw_base + WPT_TSS)) | ||
| 78 | goto read_trips; | ||
| 79 | |||
| 80 | tsel = readb(ptd->hw_base + WPT_TSEL); | ||
| 81 | /* | ||
| 82 | * When TSEL's Policy Lock-Down bit is 1, TSEL become RO. | ||
| 83 | * If so, thermal sensor cannot enable. Bail out. | ||
| 84 | */ | ||
| 85 | if (tsel & WPT_TSEL_PLDB) { | ||
| 86 | dev_err(&ptd->pdev->dev, "Sensor can't be enabled\n"); | ||
| 87 | return -ENODEV; | ||
| 88 | } | ||
| 89 | |||
| 90 | writeb(tsel|WPT_TSEL_ETS, ptd->hw_base + WPT_TSEL); | ||
| 91 | if (!(WPT_TSS_TSDSS & readb(ptd->hw_base + WPT_TSS))) { | ||
| 92 | dev_err(&ptd->pdev->dev, "Sensor can't be enabled\n"); | ||
| 93 | return -ENODEV; | ||
| 94 | } | ||
| 95 | |||
| 96 | read_trips: | ||
| 97 | ptd->crt_trip_id = -1; | ||
| 98 | trip_temp = readw(ptd->hw_base + WPT_CTT); | ||
| 99 | trip_temp &= 0x1FF; | ||
| 100 | if (trip_temp) { | ||
| 101 | /* Resolution of 1/2 degree C and an offset of -50C */ | ||
| 102 | ptd->crt_temp = trip_temp * 1000 / 2 - 50000; | ||
| 103 | ptd->crt_trip_id = 0; | ||
| 104 | ++(*nr_trips); | ||
| 105 | } | ||
| 106 | |||
| 107 | ptd->hot_trip_id = -1; | ||
| 108 | trip_temp = readw(ptd->hw_base + WPT_PHL); | ||
| 109 | trip_temp &= 0x1FF; | ||
| 110 | if (trip_temp) { | ||
| 111 | /* Resolution of 1/2 degree C and an offset of -50C */ | ||
| 112 | ptd->hot_temp = trip_temp * 1000 / 2 - 50000; | ||
| 113 | ptd->hot_trip_id = *nr_trips; | ||
| 114 | ++(*nr_trips); | ||
| 115 | } | ||
| 116 | |||
| 117 | return 0; | ||
| 118 | } | ||
| 119 | |||
| 120 | static int pch_wpt_get_temp(struct pch_thermal_device *ptd, | ||
| 121 | unsigned long *temp) | ||
| 122 | { | ||
| 123 | u8 wpt_temp; | ||
| 124 | |||
| 125 | wpt_temp = WPT_TEMP_TSR & readl(ptd->hw_base + WPT_TEMP); | ||
| 126 | |||
| 127 | /* Resolution of 1/2 degree C and an offset of -50C */ | ||
| 128 | *temp = (wpt_temp * 1000 / 2 - 50000); | ||
| 129 | |||
| 130 | return 0; | ||
| 131 | } | ||
| 132 | |||
| 133 | struct pch_dev_ops { | ||
| 134 | int (*hw_init)(struct pch_thermal_device *ptd, int *nr_trips); | ||
| 135 | int (*get_temp)(struct pch_thermal_device *ptd, unsigned long *temp); | ||
| 136 | }; | ||
| 137 | |||
| 138 | |||
| 139 | /* dev ops for Wildcat Point */ | ||
| 140 | static struct pch_dev_ops pch_dev_ops_wpt = { | ||
| 141 | .hw_init = pch_wpt_init, | ||
| 142 | .get_temp = pch_wpt_get_temp, | ||
| 143 | }; | ||
| 144 | |||
| 145 | static int pch_thermal_get_temp(struct thermal_zone_device *tzd, | ||
| 146 | unsigned long *temp) | ||
| 147 | { | ||
| 148 | struct pch_thermal_device *ptd = tzd->devdata; | ||
| 149 | |||
| 150 | return ptd->ops->get_temp(ptd, temp); | ||
| 151 | } | ||
| 152 | |||
| 153 | static int pch_get_trip_type(struct thermal_zone_device *tzd, int trip, | ||
| 154 | enum thermal_trip_type *type) | ||
| 155 | { | ||
| 156 | struct pch_thermal_device *ptd = tzd->devdata; | ||
| 157 | |||
| 158 | if (ptd->crt_trip_id == trip) | ||
| 159 | *type = THERMAL_TRIP_CRITICAL; | ||
| 160 | else if (ptd->hot_trip_id == trip) | ||
| 161 | *type = THERMAL_TRIP_HOT; | ||
| 162 | else | ||
| 163 | return -EINVAL; | ||
| 164 | |||
| 165 | return 0; | ||
| 166 | } | ||
| 167 | |||
| 168 | static int pch_get_trip_temp(struct thermal_zone_device *tzd, int trip, | ||
| 169 | unsigned long *temp) | ||
| 170 | { | ||
| 171 | struct pch_thermal_device *ptd = tzd->devdata; | ||
| 172 | |||
| 173 | if (ptd->crt_trip_id == trip) | ||
| 174 | *temp = ptd->crt_temp; | ||
| 175 | else if (ptd->hot_trip_id == trip) | ||
| 176 | *temp = ptd->hot_temp; | ||
| 177 | else | ||
| 178 | return -EINVAL; | ||
| 179 | |||
| 180 | return 0; | ||
| 181 | } | ||
| 182 | |||
| 183 | static struct thermal_zone_device_ops tzd_ops = { | ||
| 184 | .get_temp = pch_thermal_get_temp, | ||
| 185 | .get_trip_type = pch_get_trip_type, | ||
| 186 | .get_trip_temp = pch_get_trip_temp, | ||
| 187 | }; | ||
| 188 | |||
| 189 | |||
| 190 | static int intel_pch_thermal_probe(struct pci_dev *pdev, | ||
| 191 | const struct pci_device_id *id) | ||
| 192 | { | ||
| 193 | struct pch_thermal_device *ptd; | ||
| 194 | int err; | ||
| 195 | int nr_trips; | ||
| 196 | char *dev_name; | ||
| 197 | |||
| 198 | ptd = devm_kzalloc(&pdev->dev, sizeof(*ptd), GFP_KERNEL); | ||
| 199 | if (!ptd) | ||
| 200 | return -ENOMEM; | ||
| 201 | |||
| 202 | switch (pdev->device) { | ||
| 203 | case PCH_THERMAL_DID_WPT: | ||
| 204 | ptd->ops = &pch_dev_ops_wpt; | ||
| 205 | dev_name = "pch_wildcat_point"; | ||
| 206 | break; | ||
| 207 | default: | ||
| 208 | dev_err(&pdev->dev, "unknown pch thermal device\n"); | ||
| 209 | return -ENODEV; | ||
| 210 | } | ||
| 211 | |||
| 212 | pci_set_drvdata(pdev, ptd); | ||
| 213 | ptd->pdev = pdev; | ||
| 214 | |||
| 215 | err = pci_enable_device(pdev); | ||
| 216 | if (err) { | ||
| 217 | dev_err(&pdev->dev, "failed to enable pci device\n"); | ||
| 218 | return err; | ||
| 219 | } | ||
| 220 | |||
| 221 | err = pci_request_regions(pdev, driver_name); | ||
| 222 | if (err) { | ||
| 223 | dev_err(&pdev->dev, "failed to request pci region\n"); | ||
| 224 | goto error_disable; | ||
| 225 | } | ||
| 226 | |||
| 227 | ptd->hw_base = pci_ioremap_bar(pdev, 0); | ||
| 228 | if (!ptd->hw_base) { | ||
| 229 | err = -ENOMEM; | ||
| 230 | dev_err(&pdev->dev, "failed to map mem base\n"); | ||
| 231 | goto error_release; | ||
| 232 | } | ||
| 233 | |||
| 234 | err = ptd->ops->hw_init(ptd, &nr_trips); | ||
| 235 | if (err) | ||
| 236 | goto error_cleanup; | ||
| 237 | |||
| 238 | ptd->tzd = thermal_zone_device_register(dev_name, nr_trips, 0, ptd, | ||
| 239 | &tzd_ops, NULL, 0, 0); | ||
| 240 | if (IS_ERR(ptd->tzd)) { | ||
| 241 | dev_err(&pdev->dev, "Failed to register thermal zone %s\n", | ||
| 242 | dev_name); | ||
| 243 | err = PTR_ERR(ptd->tzd); | ||
| 244 | goto error_cleanup; | ||
| 245 | } | ||
| 246 | |||
| 247 | return 0; | ||
| 248 | |||
| 249 | error_cleanup: | ||
| 250 | iounmap(ptd->hw_base); | ||
| 251 | error_release: | ||
| 252 | pci_release_regions(pdev); | ||
| 253 | error_disable: | ||
| 254 | pci_disable_device(pdev); | ||
| 255 | dev_err(&pdev->dev, "pci device failed to probe\n"); | ||
| 256 | return err; | ||
| 257 | } | ||
| 258 | |||
| 259 | static void intel_pch_thermal_remove(struct pci_dev *pdev) | ||
| 260 | { | ||
| 261 | struct pch_thermal_device *ptd = pci_get_drvdata(pdev); | ||
| 262 | |||
| 263 | thermal_zone_device_unregister(ptd->tzd); | ||
| 264 | iounmap(ptd->hw_base); | ||
| 265 | pci_set_drvdata(pdev, NULL); | ||
| 266 | pci_release_region(pdev, 0); | ||
| 267 | pci_disable_device(pdev); | ||
| 268 | } | ||
| 269 | |||
| 270 | static struct pci_device_id intel_pch_thermal_id[] = { | ||
| 271 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_WPT) }, | ||
| 272 | { 0, }, | ||
| 273 | }; | ||
| 274 | MODULE_DEVICE_TABLE(pci, intel_pch_thermal_id); | ||
| 275 | |||
| 276 | static struct pci_driver intel_pch_thermal_driver = { | ||
| 277 | .name = "intel_pch_thermal", | ||
| 278 | .id_table = intel_pch_thermal_id, | ||
| 279 | .probe = intel_pch_thermal_probe, | ||
| 280 | .remove = intel_pch_thermal_remove, | ||
| 281 | }; | ||
| 282 | |||
| 283 | module_pci_driver(intel_pch_thermal_driver); | ||
| 284 | |||
| 285 | MODULE_LICENSE("GPL v2"); | ||
| 286 | MODULE_DESCRIPTION("Intel PCH Thermal driver"); | ||
diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c index 2ac0c704bcb8..6c79588251d5 100644 --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c | |||
| @@ -693,11 +693,14 @@ static const struct x86_cpu_id intel_powerclamp_ids[] __initconst = { | |||
| 693 | { X86_VENDOR_INTEL, 6, 0x3f}, | 693 | { X86_VENDOR_INTEL, 6, 0x3f}, |
| 694 | { X86_VENDOR_INTEL, 6, 0x45}, | 694 | { X86_VENDOR_INTEL, 6, 0x45}, |
| 695 | { X86_VENDOR_INTEL, 6, 0x46}, | 695 | { X86_VENDOR_INTEL, 6, 0x46}, |
| 696 | { X86_VENDOR_INTEL, 6, 0x47}, | ||
| 696 | { X86_VENDOR_INTEL, 6, 0x4c}, | 697 | { X86_VENDOR_INTEL, 6, 0x4c}, |
| 697 | { X86_VENDOR_INTEL, 6, 0x4d}, | 698 | { X86_VENDOR_INTEL, 6, 0x4d}, |
| 699 | { X86_VENDOR_INTEL, 6, 0x4e}, | ||
| 698 | { X86_VENDOR_INTEL, 6, 0x4f}, | 700 | { X86_VENDOR_INTEL, 6, 0x4f}, |
| 699 | { X86_VENDOR_INTEL, 6, 0x56}, | 701 | { X86_VENDOR_INTEL, 6, 0x56}, |
| 700 | { X86_VENDOR_INTEL, 6, 0x57}, | 702 | { X86_VENDOR_INTEL, 6, 0x57}, |
| 703 | { X86_VENDOR_INTEL, 6, 0x5e}, | ||
| 701 | {} | 704 | {} |
| 702 | }; | 705 | }; |
| 703 | MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids); | 706 | MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids); |
diff --git a/drivers/thermal/intel_quark_dts_thermal.c b/drivers/thermal/intel_quark_dts_thermal.c index 4434ec812cb7..5ed90e6c8a64 100644 --- a/drivers/thermal/intel_quark_dts_thermal.c +++ b/drivers/thermal/intel_quark_dts_thermal.c | |||
| @@ -186,7 +186,7 @@ static int soc_dts_disable(struct thermal_zone_device *tzd) | |||
| 186 | return ret; | 186 | return ret; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | static int _get_trip_temp(int trip, unsigned long *temp) | 189 | static int _get_trip_temp(int trip, int *temp) |
| 190 | { | 190 | { |
| 191 | int status; | 191 | int status; |
| 192 | u32 out; | 192 | u32 out; |
| @@ -212,19 +212,18 @@ static int _get_trip_temp(int trip, unsigned long *temp) | |||
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | static inline int sys_get_trip_temp(struct thermal_zone_device *tzd, | 214 | static inline int sys_get_trip_temp(struct thermal_zone_device *tzd, |
| 215 | int trip, unsigned long *temp) | 215 | int trip, int *temp) |
| 216 | { | 216 | { |
| 217 | return _get_trip_temp(trip, temp); | 217 | return _get_trip_temp(trip, temp); |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | static inline int sys_get_crit_temp(struct thermal_zone_device *tzd, | 220 | static inline int sys_get_crit_temp(struct thermal_zone_device *tzd, int *temp) |
| 221 | unsigned long *temp) | ||
| 222 | { | 221 | { |
| 223 | return _get_trip_temp(QRK_DTS_ID_TP_CRITICAL, temp); | 222 | return _get_trip_temp(QRK_DTS_ID_TP_CRITICAL, temp); |
| 224 | } | 223 | } |
| 225 | 224 | ||
| 226 | static int update_trip_temp(struct soc_sensor_entry *aux_entry, | 225 | static int update_trip_temp(struct soc_sensor_entry *aux_entry, |
| 227 | int trip, unsigned long temp) | 226 | int trip, int temp) |
| 228 | { | 227 | { |
| 229 | u32 out; | 228 | u32 out; |
| 230 | u32 temp_out; | 229 | u32 temp_out; |
| @@ -272,7 +271,7 @@ failed: | |||
| 272 | } | 271 | } |
| 273 | 272 | ||
| 274 | static inline int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, | 273 | static inline int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, |
| 275 | unsigned long temp) | 274 | int temp) |
| 276 | { | 275 | { |
| 277 | return update_trip_temp(tzd->devdata, trip, temp); | 276 | return update_trip_temp(tzd->devdata, trip, temp); |
| 278 | } | 277 | } |
| @@ -289,7 +288,7 @@ static int sys_get_trip_type(struct thermal_zone_device *thermal, | |||
| 289 | } | 288 | } |
| 290 | 289 | ||
| 291 | static int sys_get_curr_temp(struct thermal_zone_device *tzd, | 290 | static int sys_get_curr_temp(struct thermal_zone_device *tzd, |
| 292 | unsigned long *temp) | 291 | int *temp) |
| 293 | { | 292 | { |
| 294 | u32 out; | 293 | u32 out; |
| 295 | int ret; | 294 | int ret; |
diff --git a/drivers/thermal/intel_soc_dts_iosf.c b/drivers/thermal/intel_soc_dts_iosf.c index 42e4b6ac3875..5841d1d72996 100644 --- a/drivers/thermal/intel_soc_dts_iosf.c +++ b/drivers/thermal/intel_soc_dts_iosf.c | |||
| @@ -80,7 +80,7 @@ err_ret: | |||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | static int sys_get_trip_temp(struct thermal_zone_device *tzd, int trip, | 82 | static int sys_get_trip_temp(struct thermal_zone_device *tzd, int trip, |
| 83 | unsigned long *temp) | 83 | int *temp) |
| 84 | { | 84 | { |
| 85 | int status; | 85 | int status; |
| 86 | u32 out; | 86 | u32 out; |
| @@ -106,7 +106,7 @@ static int sys_get_trip_temp(struct thermal_zone_device *tzd, int trip, | |||
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts, | 108 | static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts, |
| 109 | int thres_index, unsigned long temp, | 109 | int thres_index, int temp, |
| 110 | enum thermal_trip_type trip_type) | 110 | enum thermal_trip_type trip_type) |
| 111 | { | 111 | { |
| 112 | int status; | 112 | int status; |
| @@ -196,7 +196,7 @@ err_restore_ptps: | |||
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, | 198 | static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, |
| 199 | unsigned long temp) | 199 | int temp) |
| 200 | { | 200 | { |
| 201 | struct intel_soc_dts_sensor_entry *dts = tzd->devdata; | 201 | struct intel_soc_dts_sensor_entry *dts = tzd->devdata; |
| 202 | struct intel_soc_dts_sensors *sensors = dts->sensors; | 202 | struct intel_soc_dts_sensors *sensors = dts->sensors; |
| @@ -226,7 +226,7 @@ static int sys_get_trip_type(struct thermal_zone_device *tzd, | |||
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | static int sys_get_curr_temp(struct thermal_zone_device *tzd, | 228 | static int sys_get_curr_temp(struct thermal_zone_device *tzd, |
| 229 | unsigned long *temp) | 229 | int *temp) |
| 230 | { | 230 | { |
| 231 | int status; | 231 | int status; |
| 232 | u32 out; | 232 | u32 out; |
diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c index 11041fe63dc2..892236621767 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c | |||
| @@ -33,7 +33,7 @@ struct kirkwood_thermal_priv { | |||
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | static int kirkwood_get_temp(struct thermal_zone_device *thermal, | 35 | static int kirkwood_get_temp(struct thermal_zone_device *thermal, |
| 36 | unsigned long *temp) | 36 | int *temp) |
| 37 | { | 37 | { |
| 38 | unsigned long reg; | 38 | unsigned long reg; |
| 39 | struct kirkwood_thermal_priv *priv = thermal->devdata; | 39 | struct kirkwood_thermal_priv *priv = thermal->devdata; |
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index b295b2b6c191..42b7d4253b94 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c | |||
| @@ -91,7 +91,7 @@ struct __thermal_zone { | |||
| 91 | /*** DT thermal zone device callbacks ***/ | 91 | /*** DT thermal zone device callbacks ***/ |
| 92 | 92 | ||
| 93 | static int of_thermal_get_temp(struct thermal_zone_device *tz, | 93 | static int of_thermal_get_temp(struct thermal_zone_device *tz, |
| 94 | unsigned long *temp) | 94 | int *temp) |
| 95 | { | 95 | { |
| 96 | struct __thermal_zone *data = tz->devdata; | 96 | struct __thermal_zone *data = tz->devdata; |
| 97 | 97 | ||
| @@ -177,7 +177,7 @@ EXPORT_SYMBOL_GPL(of_thermal_get_trip_points); | |||
| 177 | * Return: zero on success, error code otherwise | 177 | * Return: zero on success, error code otherwise |
| 178 | */ | 178 | */ |
| 179 | static int of_thermal_set_emul_temp(struct thermal_zone_device *tz, | 179 | static int of_thermal_set_emul_temp(struct thermal_zone_device *tz, |
| 180 | unsigned long temp) | 180 | int temp) |
| 181 | { | 181 | { |
| 182 | struct __thermal_zone *data = tz->devdata; | 182 | struct __thermal_zone *data = tz->devdata; |
| 183 | 183 | ||
| @@ -311,7 +311,7 @@ static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip, | |||
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip, | 313 | static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip, |
| 314 | unsigned long *temp) | 314 | int *temp) |
| 315 | { | 315 | { |
| 316 | struct __thermal_zone *data = tz->devdata; | 316 | struct __thermal_zone *data = tz->devdata; |
| 317 | 317 | ||
| @@ -324,7 +324,7 @@ static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip, | |||
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip, | 326 | static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip, |
| 327 | unsigned long temp) | 327 | int temp) |
| 328 | { | 328 | { |
| 329 | struct __thermal_zone *data = tz->devdata; | 329 | struct __thermal_zone *data = tz->devdata; |
| 330 | 330 | ||
| @@ -338,7 +338,7 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip, | |||
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip, | 340 | static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip, |
| 341 | unsigned long *hyst) | 341 | int *hyst) |
| 342 | { | 342 | { |
| 343 | struct __thermal_zone *data = tz->devdata; | 343 | struct __thermal_zone *data = tz->devdata; |
| 344 | 344 | ||
| @@ -351,7 +351,7 @@ static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip, | |||
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip, | 353 | static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip, |
| 354 | unsigned long hyst) | 354 | int hyst) |
| 355 | { | 355 | { |
| 356 | struct __thermal_zone *data = tz->devdata; | 356 | struct __thermal_zone *data = tz->devdata; |
| 357 | 357 | ||
| @@ -365,7 +365,7 @@ static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip, | |||
| 365 | } | 365 | } |
| 366 | 366 | ||
| 367 | static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, | 367 | static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, |
| 368 | unsigned long *temp) | 368 | int *temp) |
| 369 | { | 369 | { |
| 370 | struct __thermal_zone *data = tz->devdata; | 370 | struct __thermal_zone *data = tz->devdata; |
| 371 | int i; | 371 | int i; |
diff --git a/drivers/thermal/power_allocator.c b/drivers/thermal/power_allocator.c index 251676902869..9c8a7aad0252 100644 --- a/drivers/thermal/power_allocator.c +++ b/drivers/thermal/power_allocator.c | |||
| @@ -92,8 +92,8 @@ struct power_allocator_params { | |||
| 92 | * Return: The power budget for the next period. | 92 | * Return: The power budget for the next period. |
| 93 | */ | 93 | */ |
| 94 | static u32 pid_controller(struct thermal_zone_device *tz, | 94 | static u32 pid_controller(struct thermal_zone_device *tz, |
| 95 | unsigned long current_temp, | 95 | int current_temp, |
| 96 | unsigned long control_temp, | 96 | int control_temp, |
| 97 | u32 max_allocatable_power) | 97 | u32 max_allocatable_power) |
| 98 | { | 98 | { |
| 99 | s64 p, i, d, power_range; | 99 | s64 p, i, d, power_range; |
| @@ -102,7 +102,7 @@ static u32 pid_controller(struct thermal_zone_device *tz, | |||
| 102 | 102 | ||
| 103 | max_power_frac = int_to_frac(max_allocatable_power); | 103 | max_power_frac = int_to_frac(max_allocatable_power); |
| 104 | 104 | ||
| 105 | err = ((s32)control_temp - (s32)current_temp); | 105 | err = control_temp - current_temp; |
| 106 | err = int_to_frac(err); | 106 | err = int_to_frac(err); |
| 107 | 107 | ||
| 108 | /* Calculate the proportional term */ | 108 | /* Calculate the proportional term */ |
| @@ -223,8 +223,8 @@ static void divvy_up_power(u32 *req_power, u32 *max_power, int num_actors, | |||
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | static int allocate_power(struct thermal_zone_device *tz, | 225 | static int allocate_power(struct thermal_zone_device *tz, |
| 226 | unsigned long current_temp, | 226 | int current_temp, |
| 227 | unsigned long control_temp) | 227 | int control_temp) |
| 228 | { | 228 | { |
| 229 | struct thermal_instance *instance; | 229 | struct thermal_instance *instance; |
| 230 | struct power_allocator_params *params = tz->governor_data; | 230 | struct power_allocator_params *params = tz->governor_data; |
| @@ -331,7 +331,7 @@ static int allocate_power(struct thermal_zone_device *tz, | |||
| 331 | granted_power, total_granted_power, | 331 | granted_power, total_granted_power, |
| 332 | num_actors, power_range, | 332 | num_actors, power_range, |
| 333 | max_allocatable_power, current_temp, | 333 | max_allocatable_power, current_temp, |
| 334 | (s32)control_temp - (s32)current_temp); | 334 | control_temp - current_temp); |
| 335 | 335 | ||
| 336 | kfree(req_power); | 336 | kfree(req_power); |
| 337 | unlock: | 337 | unlock: |
| @@ -416,7 +416,7 @@ static int power_allocator_bind(struct thermal_zone_device *tz) | |||
| 416 | { | 416 | { |
| 417 | int ret; | 417 | int ret; |
| 418 | struct power_allocator_params *params; | 418 | struct power_allocator_params *params; |
| 419 | unsigned long switch_on_temp, control_temp; | 419 | int switch_on_temp, control_temp; |
| 420 | u32 temperature_threshold; | 420 | u32 temperature_threshold; |
| 421 | 421 | ||
| 422 | if (!tz->tzp || !tz->tzp->sustainable_power) { | 422 | if (!tz->tzp || !tz->tzp->sustainable_power) { |
| @@ -481,7 +481,7 @@ static void power_allocator_unbind(struct thermal_zone_device *tz) | |||
| 481 | static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) | 481 | static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) |
| 482 | { | 482 | { |
| 483 | int ret; | 483 | int ret; |
| 484 | unsigned long switch_on_temp, control_temp, current_temp; | 484 | int switch_on_temp, control_temp, current_temp; |
| 485 | struct power_allocator_params *params = tz->governor_data; | 485 | struct power_allocator_params *params = tz->governor_data; |
| 486 | 486 | ||
| 487 | /* | 487 | /* |
diff --git a/drivers/thermal/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom-spmi-temp-alarm.c index c8d27b8fb9ec..b677aada5b52 100644 --- a/drivers/thermal/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom-spmi-temp-alarm.c | |||
| @@ -117,7 +117,7 @@ static int qpnp_tm_update_temp_no_adc(struct qpnp_tm_chip *chip) | |||
| 117 | return 0; | 117 | return 0; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | static int qpnp_tm_get_temp(void *data, long *temp) | 120 | static int qpnp_tm_get_temp(void *data, int *temp) |
| 121 | { | 121 | { |
| 122 | struct qpnp_tm_chip *chip = data; | 122 | struct qpnp_tm_chip *chip = data; |
| 123 | int ret, mili_celsius; | 123 | int ret, mili_celsius; |
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index fe4e767018c4..5d4ae7d705e0 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
| @@ -200,8 +200,7 @@ err_out_unlock: | |||
| 200 | return ret; | 200 | return ret; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, | 203 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) |
| 204 | unsigned long *temp) | ||
| 205 | { | 204 | { |
| 206 | struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); | 205 | struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); |
| 207 | 206 | ||
| @@ -235,7 +234,7 @@ static int rcar_thermal_get_trip_type(struct thermal_zone_device *zone, | |||
| 235 | } | 234 | } |
| 236 | 235 | ||
| 237 | static int rcar_thermal_get_trip_temp(struct thermal_zone_device *zone, | 236 | static int rcar_thermal_get_trip_temp(struct thermal_zone_device *zone, |
| 238 | int trip, unsigned long *temp) | 237 | int trip, int *temp) |
| 239 | { | 238 | { |
| 240 | struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); | 239 | struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); |
| 241 | struct device *dev = rcar_priv_to_dev(priv); | 240 | struct device *dev = rcar_priv_to_dev(priv); |
| @@ -299,7 +298,7 @@ static void _rcar_thermal_irq_ctrl(struct rcar_thermal_priv *priv, int enable) | |||
| 299 | static void rcar_thermal_work(struct work_struct *work) | 298 | static void rcar_thermal_work(struct work_struct *work) |
| 300 | { | 299 | { |
| 301 | struct rcar_thermal_priv *priv; | 300 | struct rcar_thermal_priv *priv; |
| 302 | unsigned long cctemp, nctemp; | 301 | int cctemp, nctemp; |
| 303 | 302 | ||
| 304 | priv = container_of(work, struct rcar_thermal_priv, work.work); | 303 | priv = container_of(work, struct rcar_thermal_priv, work.work); |
| 305 | 304 | ||
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index cd8f5f93b42c..c89ffb26a354 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c | |||
| @@ -64,7 +64,7 @@ struct rockchip_tsadc_chip { | |||
| 64 | void (*control)(void __iomem *reg, bool on); | 64 | void (*control)(void __iomem *reg, bool on); |
| 65 | 65 | ||
| 66 | /* Per-sensor methods */ | 66 | /* Per-sensor methods */ |
| 67 | int (*get_temp)(int chn, void __iomem *reg, long *temp); | 67 | int (*get_temp)(int chn, void __iomem *reg, int *temp); |
| 68 | void (*set_tshut_temp)(int chn, void __iomem *reg, long temp); | 68 | void (*set_tshut_temp)(int chn, void __iomem *reg, long temp); |
| 69 | void (*set_tshut_mode)(int chn, void __iomem *reg, enum tshut_mode m); | 69 | void (*set_tshut_mode)(int chn, void __iomem *reg, enum tshut_mode m); |
| 70 | }; | 70 | }; |
| @@ -191,7 +191,7 @@ static u32 rk_tsadcv2_temp_to_code(long temp) | |||
| 191 | return 0; | 191 | return 0; |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | static long rk_tsadcv2_code_to_temp(u32 code) | 194 | static int rk_tsadcv2_code_to_temp(u32 code) |
| 195 | { | 195 | { |
| 196 | unsigned int low = 0; | 196 | unsigned int low = 0; |
| 197 | unsigned int high = ARRAY_SIZE(v2_code_table) - 1; | 197 | unsigned int high = ARRAY_SIZE(v2_code_table) - 1; |
| @@ -277,7 +277,7 @@ static void rk_tsadcv2_control(void __iomem *regs, bool enable) | |||
| 277 | writel_relaxed(val, regs + TSADCV2_AUTO_CON); | 277 | writel_relaxed(val, regs + TSADCV2_AUTO_CON); |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | static int rk_tsadcv2_get_temp(int chn, void __iomem *regs, long *temp) | 280 | static int rk_tsadcv2_get_temp(int chn, void __iomem *regs, int *temp) |
| 281 | { | 281 | { |
| 282 | u32 val; | 282 | u32 val; |
| 283 | 283 | ||
| @@ -366,7 +366,7 @@ static irqreturn_t rockchip_thermal_alarm_irq_thread(int irq, void *dev) | |||
| 366 | return IRQ_HANDLED; | 366 | return IRQ_HANDLED; |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | static int rockchip_thermal_get_temp(void *_sensor, long *out_temp) | 369 | static int rockchip_thermal_get_temp(void *_sensor, int *out_temp) |
| 370 | { | 370 | { |
| 371 | struct rockchip_thermal_sensor *sensor = _sensor; | 371 | struct rockchip_thermal_sensor *sensor = _sensor; |
| 372 | struct rockchip_thermal_data *thermal = sensor->thermal; | 372 | struct rockchip_thermal_data *thermal = sensor->thermal; |
| @@ -374,7 +374,7 @@ static int rockchip_thermal_get_temp(void *_sensor, long *out_temp) | |||
| 374 | int retval; | 374 | int retval; |
| 375 | 375 | ||
| 376 | retval = tsadc->get_temp(sensor->id, thermal->regs, out_temp); | 376 | retval = tsadc->get_temp(sensor->id, thermal->regs, out_temp); |
| 377 | dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %ld, retval: %d\n", | 377 | dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %d, retval: %d\n", |
| 378 | sensor->id, *out_temp, retval); | 378 | sensor->id, *out_temp, retval); |
| 379 | 379 | ||
| 380 | return retval; | 380 | return retval; |
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index c96ff10b869e..0bae8cc6c23a 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c | |||
| @@ -207,8 +207,7 @@ struct exynos_tmu_data { | |||
| 207 | int (*tmu_initialize)(struct platform_device *pdev); | 207 | int (*tmu_initialize)(struct platform_device *pdev); |
| 208 | void (*tmu_control)(struct platform_device *pdev, bool on); | 208 | void (*tmu_control)(struct platform_device *pdev, bool on); |
| 209 | int (*tmu_read)(struct exynos_tmu_data *data); | 209 | int (*tmu_read)(struct exynos_tmu_data *data); |
| 210 | void (*tmu_set_emulation)(struct exynos_tmu_data *data, | 210 | void (*tmu_set_emulation)(struct exynos_tmu_data *data, int temp); |
| 211 | unsigned long temp); | ||
| 212 | void (*tmu_clear_irqs)(struct exynos_tmu_data *data); | 211 | void (*tmu_clear_irqs)(struct exynos_tmu_data *data); |
| 213 | }; | 212 | }; |
| 214 | 213 | ||
| @@ -216,7 +215,7 @@ static void exynos_report_trigger(struct exynos_tmu_data *p) | |||
| 216 | { | 215 | { |
| 217 | char data[10], *envp[] = { data, NULL }; | 216 | char data[10], *envp[] = { data, NULL }; |
| 218 | struct thermal_zone_device *tz = p->tzd; | 217 | struct thermal_zone_device *tz = p->tzd; |
| 219 | unsigned long temp; | 218 | int temp; |
| 220 | unsigned int i; | 219 | unsigned int i; |
| 221 | 220 | ||
| 222 | if (!tz) { | 221 | if (!tz) { |
| @@ -517,7 +516,7 @@ static int exynos5433_tmu_initialize(struct platform_device *pdev) | |||
| 517 | struct thermal_zone_device *tz = data->tzd; | 516 | struct thermal_zone_device *tz = data->tzd; |
| 518 | unsigned int status, trim_info; | 517 | unsigned int status, trim_info; |
| 519 | unsigned int rising_threshold = 0, falling_threshold = 0; | 518 | unsigned int rising_threshold = 0, falling_threshold = 0; |
| 520 | unsigned long temp, temp_hist; | 519 | int temp, temp_hist; |
| 521 | int ret = 0, threshold_code, i, sensor_id, cal_type; | 520 | int ret = 0, threshold_code, i, sensor_id, cal_type; |
| 522 | 521 | ||
| 523 | status = readb(data->base + EXYNOS_TMU_REG_STATUS); | 522 | status = readb(data->base + EXYNOS_TMU_REG_STATUS); |
| @@ -610,7 +609,7 @@ static int exynos5440_tmu_initialize(struct platform_device *pdev) | |||
| 610 | struct exynos_tmu_data *data = platform_get_drvdata(pdev); | 609 | struct exynos_tmu_data *data = platform_get_drvdata(pdev); |
| 611 | unsigned int trim_info = 0, con, rising_threshold; | 610 | unsigned int trim_info = 0, con, rising_threshold; |
| 612 | int ret = 0, threshold_code; | 611 | int ret = 0, threshold_code; |
| 613 | unsigned long crit_temp = 0; | 612 | int crit_temp = 0; |
| 614 | 613 | ||
| 615 | /* | 614 | /* |
| 616 | * For exynos5440 soc triminfo value is swapped between TMU0 and | 615 | * For exynos5440 soc triminfo value is swapped between TMU0 and |
| @@ -663,7 +662,7 @@ static int exynos7_tmu_initialize(struct platform_device *pdev) | |||
| 663 | unsigned int status, trim_info; | 662 | unsigned int status, trim_info; |
| 664 | unsigned int rising_threshold = 0, falling_threshold = 0; | 663 | unsigned int rising_threshold = 0, falling_threshold = 0; |
| 665 | int ret = 0, threshold_code, i; | 664 | int ret = 0, threshold_code, i; |
| 666 | unsigned long temp, temp_hist; | 665 | int temp, temp_hist; |
| 667 | unsigned int reg_off, bit_off; | 666 | unsigned int reg_off, bit_off; |
| 668 | 667 | ||
| 669 | status = readb(data->base + EXYNOS_TMU_REG_STATUS); | 668 | status = readb(data->base + EXYNOS_TMU_REG_STATUS); |
| @@ -876,7 +875,7 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on) | |||
| 876 | writel(con, data->base + EXYNOS_TMU_REG_CONTROL); | 875 | writel(con, data->base + EXYNOS_TMU_REG_CONTROL); |
| 877 | } | 876 | } |
| 878 | 877 | ||
| 879 | static int exynos_get_temp(void *p, long *temp) | 878 | static int exynos_get_temp(void *p, int *temp) |
| 880 | { | 879 | { |
| 881 | struct exynos_tmu_data *data = p; | 880 | struct exynos_tmu_data *data = p; |
| 882 | 881 | ||
| @@ -896,7 +895,7 @@ static int exynos_get_temp(void *p, long *temp) | |||
| 896 | 895 | ||
| 897 | #ifdef CONFIG_THERMAL_EMULATION | 896 | #ifdef CONFIG_THERMAL_EMULATION |
| 898 | static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val, | 897 | static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val, |
| 899 | unsigned long temp) | 898 | int temp) |
| 900 | { | 899 | { |
| 901 | if (temp) { | 900 | if (temp) { |
| 902 | temp /= MCELSIUS; | 901 | temp /= MCELSIUS; |
| @@ -926,7 +925,7 @@ static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val, | |||
| 926 | } | 925 | } |
| 927 | 926 | ||
| 928 | static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data, | 927 | static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data, |
| 929 | unsigned long temp) | 928 | int temp) |
| 930 | { | 929 | { |
| 931 | unsigned int val; | 930 | unsigned int val; |
| 932 | u32 emul_con; | 931 | u32 emul_con; |
| @@ -946,7 +945,7 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data, | |||
| 946 | } | 945 | } |
| 947 | 946 | ||
| 948 | static void exynos5440_tmu_set_emulation(struct exynos_tmu_data *data, | 947 | static void exynos5440_tmu_set_emulation(struct exynos_tmu_data *data, |
| 949 | unsigned long temp) | 948 | int temp) |
| 950 | { | 949 | { |
| 951 | unsigned int val; | 950 | unsigned int val; |
| 952 | 951 | ||
| @@ -955,7 +954,7 @@ static void exynos5440_tmu_set_emulation(struct exynos_tmu_data *data, | |||
| 955 | writel(val, data->base + EXYNOS5440_TMU_S0_7_DEBUG); | 954 | writel(val, data->base + EXYNOS5440_TMU_S0_7_DEBUG); |
| 956 | } | 955 | } |
| 957 | 956 | ||
| 958 | static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp) | 957 | static int exynos_tmu_set_emulation(void *drv_data, int temp) |
| 959 | { | 958 | { |
| 960 | struct exynos_tmu_data *data = drv_data; | 959 | struct exynos_tmu_data *data = drv_data; |
| 961 | int ret = -EINVAL; | 960 | int ret = -EINVAL; |
| @@ -978,7 +977,7 @@ out: | |||
| 978 | #else | 977 | #else |
| 979 | #define exynos4412_tmu_set_emulation NULL | 978 | #define exynos4412_tmu_set_emulation NULL |
| 980 | #define exynos5440_tmu_set_emulation NULL | 979 | #define exynos5440_tmu_set_emulation NULL |
| 981 | static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp) | 980 | static int exynos_tmu_set_emulation(void *drv_data, int temp) |
| 982 | { return -EINVAL; } | 981 | { return -EINVAL; } |
| 983 | #endif /* CONFIG_THERMAL_EMULATION */ | 982 | #endif /* CONFIG_THERMAL_EMULATION */ |
| 984 | 983 | ||
diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c index bddb71744a6c..534dd9136662 100644 --- a/drivers/thermal/spear_thermal.c +++ b/drivers/thermal/spear_thermal.c | |||
| @@ -38,7 +38,7 @@ struct spear_thermal_dev { | |||
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | static inline int thermal_get_temp(struct thermal_zone_device *thermal, | 40 | static inline int thermal_get_temp(struct thermal_zone_device *thermal, |
| 41 | unsigned long *temp) | 41 | int *temp) |
| 42 | { | 42 | { |
| 43 | struct spear_thermal_dev *stdev = thermal->devdata; | 43 | struct spear_thermal_dev *stdev = thermal->devdata; |
| 44 | 44 | ||
diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 88c759d746c3..be637e6b01d2 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c | |||
| @@ -111,8 +111,7 @@ static int st_thermal_calibration(struct st_thermal_sensor *sensor) | |||
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | /* Callback to get temperature from HW*/ | 113 | /* Callback to get temperature from HW*/ |
| 114 | static int st_thermal_get_temp(struct thermal_zone_device *th, | 114 | static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature) |
| 115 | unsigned long *temperature) | ||
| 116 | { | 115 | { |
| 117 | struct st_thermal_sensor *sensor = th->devdata; | 116 | struct st_thermal_sensor *sensor = th->devdata; |
| 118 | struct device *dev = sensor->dev; | 117 | struct device *dev = sensor->dev; |
| @@ -159,7 +158,7 @@ static int st_thermal_get_trip_type(struct thermal_zone_device *th, | |||
| 159 | } | 158 | } |
| 160 | 159 | ||
| 161 | static int st_thermal_get_trip_temp(struct thermal_zone_device *th, | 160 | static int st_thermal_get_trip_temp(struct thermal_zone_device *th, |
| 162 | int trip, unsigned long *temp) | 161 | int trip, int *temp) |
| 163 | { | 162 | { |
| 164 | struct st_thermal_sensor *sensor = th->devdata; | 163 | struct st_thermal_sensor *sensor = th->devdata; |
| 165 | struct device *dev = sensor->dev; | 164 | struct device *dev = sensor->dev; |
diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c index 5a0f12d08e8b..2f9f7086ac3d 100644 --- a/drivers/thermal/step_wise.c +++ b/drivers/thermal/step_wise.c | |||
| @@ -113,7 +113,7 @@ static void update_passive_instance(struct thermal_zone_device *tz, | |||
| 113 | 113 | ||
| 114 | static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) | 114 | static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) |
| 115 | { | 115 | { |
| 116 | long trip_temp; | 116 | int trip_temp; |
| 117 | enum thermal_trip_type trip_type; | 117 | enum thermal_trip_type trip_type; |
| 118 | enum thermal_trend trend; | 118 | enum thermal_trend trend; |
| 119 | struct thermal_instance *instance; | 119 | struct thermal_instance *instance; |
| @@ -135,7 +135,7 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) | |||
| 135 | trace_thermal_zone_trip(tz, trip, trip_type); | 135 | trace_thermal_zone_trip(tz, trip, trip_type); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | dev_dbg(&tz->device, "Trip%d[type=%d,temp=%ld]:trend=%d,throttle=%d\n", | 138 | dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n", |
| 139 | trip, trip_type, trip_temp, trend, throttle); | 139 | trip, trip_type, trip_temp, trend, throttle); |
| 140 | 140 | ||
| 141 | mutex_lock(&tz->lock); | 141 | mutex_lock(&tz->lock); |
diff --git a/drivers/thermal/tegra_soctherm.c b/drivers/thermal/tegra_soctherm.c index 9197fc05c5cc..74ea5765938b 100644 --- a/drivers/thermal/tegra_soctherm.c +++ b/drivers/thermal/tegra_soctherm.c | |||
| @@ -293,7 +293,7 @@ static int enable_tsensor(struct tegra_soctherm *tegra, | |||
| 293 | * H denotes an addition of 0.5 Celsius and N denotes negation | 293 | * H denotes an addition of 0.5 Celsius and N denotes negation |
| 294 | * of the final value. | 294 | * of the final value. |
| 295 | */ | 295 | */ |
| 296 | static long translate_temp(u16 val) | 296 | static int translate_temp(u16 val) |
| 297 | { | 297 | { |
| 298 | long t; | 298 | long t; |
| 299 | 299 | ||
| @@ -306,7 +306,7 @@ static long translate_temp(u16 val) | |||
| 306 | return t; | 306 | return t; |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | static int tegra_thermctl_get_temp(void *data, long *out_temp) | 309 | static int tegra_thermctl_get_temp(void *data, int *out_temp) |
| 310 | { | 310 | { |
| 311 | struct tegra_thermctl_zone *zone = data; | 311 | struct tegra_thermctl_zone *zone = data; |
| 312 | u32 val; | 312 | u32 val; |
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 4ca211be4c0f..5e5fc7015c7f 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c | |||
| @@ -426,7 +426,7 @@ static void handle_non_critical_trips(struct thermal_zone_device *tz, | |||
| 426 | static void handle_critical_trips(struct thermal_zone_device *tz, | 426 | static void handle_critical_trips(struct thermal_zone_device *tz, |
| 427 | int trip, enum thermal_trip_type trip_type) | 427 | int trip, enum thermal_trip_type trip_type) |
| 428 | { | 428 | { |
| 429 | long trip_temp; | 429 | int trip_temp; |
| 430 | 430 | ||
| 431 | tz->ops->get_trip_temp(tz, trip, &trip_temp); | 431 | tz->ops->get_trip_temp(tz, trip, &trip_temp); |
| 432 | 432 | ||
| @@ -465,7 +465,7 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) | |||
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | /** | 467 | /** |
| 468 | * thermal_zone_get_temp() - returns its the temperature of thermal zone | 468 | * thermal_zone_get_temp() - returns the temperature of a thermal zone |
| 469 | * @tz: a valid pointer to a struct thermal_zone_device | 469 | * @tz: a valid pointer to a struct thermal_zone_device |
| 470 | * @temp: a valid pointer to where to store the resulting temperature. | 470 | * @temp: a valid pointer to where to store the resulting temperature. |
| 471 | * | 471 | * |
| @@ -474,14 +474,12 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) | |||
| 474 | * | 474 | * |
| 475 | * Return: On success returns 0, an error code otherwise | 475 | * Return: On success returns 0, an error code otherwise |
| 476 | */ | 476 | */ |
| 477 | int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp) | 477 | int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) |
| 478 | { | 478 | { |
| 479 | int ret = -EINVAL; | 479 | int ret = -EINVAL; |
| 480 | #ifdef CONFIG_THERMAL_EMULATION | ||
| 481 | int count; | 480 | int count; |
| 482 | unsigned long crit_temp = -1UL; | 481 | int crit_temp = INT_MAX; |
| 483 | enum thermal_trip_type type; | 482 | enum thermal_trip_type type; |
| 484 | #endif | ||
| 485 | 483 | ||
| 486 | if (!tz || IS_ERR(tz) || !tz->ops->get_temp) | 484 | if (!tz || IS_ERR(tz) || !tz->ops->get_temp) |
| 487 | goto exit; | 485 | goto exit; |
| @@ -489,25 +487,26 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp) | |||
| 489 | mutex_lock(&tz->lock); | 487 | mutex_lock(&tz->lock); |
| 490 | 488 | ||
| 491 | ret = tz->ops->get_temp(tz, temp); | 489 | ret = tz->ops->get_temp(tz, temp); |
| 492 | #ifdef CONFIG_THERMAL_EMULATION | ||
| 493 | if (!tz->emul_temperature) | ||
| 494 | goto skip_emul; | ||
| 495 | |||
| 496 | for (count = 0; count < tz->trips; count++) { | ||
| 497 | ret = tz->ops->get_trip_type(tz, count, &type); | ||
| 498 | if (!ret && type == THERMAL_TRIP_CRITICAL) { | ||
| 499 | ret = tz->ops->get_trip_temp(tz, count, &crit_temp); | ||
| 500 | break; | ||
| 501 | } | ||
| 502 | } | ||
| 503 | 490 | ||
| 504 | if (ret) | 491 | if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) { |
| 505 | goto skip_emul; | 492 | for (count = 0; count < tz->trips; count++) { |
| 493 | ret = tz->ops->get_trip_type(tz, count, &type); | ||
| 494 | if (!ret && type == THERMAL_TRIP_CRITICAL) { | ||
| 495 | ret = tz->ops->get_trip_temp(tz, count, | ||
| 496 | &crit_temp); | ||
| 497 | break; | ||
| 498 | } | ||
| 499 | } | ||
| 506 | 500 | ||
| 507 | if (*temp < crit_temp) | 501 | /* |
| 508 | *temp = tz->emul_temperature; | 502 | * Only allow emulating a temperature when the real temperature |
| 509 | skip_emul: | 503 | * is below the critical temperature so that the emulation code |
| 510 | #endif | 504 | * cannot hide critical conditions. |
| 505 | */ | ||
| 506 | if (!ret && *temp < crit_temp) | ||
| 507 | *temp = tz->emul_temperature; | ||
| 508 | } | ||
| 509 | |||
| 511 | mutex_unlock(&tz->lock); | 510 | mutex_unlock(&tz->lock); |
| 512 | exit: | 511 | exit: |
| 513 | return ret; | 512 | return ret; |
| @@ -516,8 +515,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_temp); | |||
| 516 | 515 | ||
| 517 | static void update_temperature(struct thermal_zone_device *tz) | 516 | static void update_temperature(struct thermal_zone_device *tz) |
| 518 | { | 517 | { |
| 519 | long temp; | 518 | int temp, ret; |
| 520 | int ret; | ||
| 521 | 519 | ||
| 522 | ret = thermal_zone_get_temp(tz, &temp); | 520 | ret = thermal_zone_get_temp(tz, &temp); |
| 523 | if (ret) { | 521 | if (ret) { |
| @@ -577,15 +575,14 @@ static ssize_t | |||
| 577 | temp_show(struct device *dev, struct device_attribute *attr, char *buf) | 575 | temp_show(struct device *dev, struct device_attribute *attr, char *buf) |
| 578 | { | 576 | { |
| 579 | struct thermal_zone_device *tz = to_thermal_zone(dev); | 577 | struct thermal_zone_device *tz = to_thermal_zone(dev); |
| 580 | long temperature; | 578 | int temperature, ret; |
| 581 | int ret; | ||
| 582 | 579 | ||
| 583 | ret = thermal_zone_get_temp(tz, &temperature); | 580 | ret = thermal_zone_get_temp(tz, &temperature); |
| 584 | 581 | ||
| 585 | if (ret) | 582 | if (ret) |
| 586 | return ret; | 583 | return ret; |
| 587 | 584 | ||
| 588 | return sprintf(buf, "%ld\n", temperature); | 585 | return sprintf(buf, "%d\n", temperature); |
| 589 | } | 586 | } |
| 590 | 587 | ||
| 591 | static ssize_t | 588 | static ssize_t |
| @@ -689,7 +686,7 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr, | |||
| 689 | { | 686 | { |
| 690 | struct thermal_zone_device *tz = to_thermal_zone(dev); | 687 | struct thermal_zone_device *tz = to_thermal_zone(dev); |
| 691 | int trip, ret; | 688 | int trip, ret; |
| 692 | long temperature; | 689 | int temperature; |
| 693 | 690 | ||
| 694 | if (!tz->ops->get_trip_temp) | 691 | if (!tz->ops->get_trip_temp) |
| 695 | return -EPERM; | 692 | return -EPERM; |
| @@ -702,7 +699,7 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr, | |||
| 702 | if (ret) | 699 | if (ret) |
| 703 | return ret; | 700 | return ret; |
| 704 | 701 | ||
| 705 | return sprintf(buf, "%ld\n", temperature); | 702 | return sprintf(buf, "%d\n", temperature); |
| 706 | } | 703 | } |
| 707 | 704 | ||
| 708 | static ssize_t | 705 | static ssize_t |
| @@ -711,7 +708,7 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr, | |||
| 711 | { | 708 | { |
| 712 | struct thermal_zone_device *tz = to_thermal_zone(dev); | 709 | struct thermal_zone_device *tz = to_thermal_zone(dev); |
| 713 | int trip, ret; | 710 | int trip, ret; |
| 714 | unsigned long temperature; | 711 | int temperature; |
| 715 | 712 | ||
| 716 | if (!tz->ops->set_trip_hyst) | 713 | if (!tz->ops->set_trip_hyst) |
| 717 | return -EPERM; | 714 | return -EPERM; |
| @@ -719,7 +716,7 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr, | |||
| 719 | if (!sscanf(attr->attr.name, "trip_point_%d_hyst", &trip)) | 716 | if (!sscanf(attr->attr.name, "trip_point_%d_hyst", &trip)) |
| 720 | return -EINVAL; | 717 | return -EINVAL; |
| 721 | 718 | ||
| 722 | if (kstrtoul(buf, 10, &temperature)) | 719 | if (kstrtoint(buf, 10, &temperature)) |
| 723 | return -EINVAL; | 720 | return -EINVAL; |
| 724 | 721 | ||
| 725 | /* | 722 | /* |
| @@ -738,7 +735,7 @@ trip_point_hyst_show(struct device *dev, struct device_attribute *attr, | |||
| 738 | { | 735 | { |
| 739 | struct thermal_zone_device *tz = to_thermal_zone(dev); | 736 | struct thermal_zone_device *tz = to_thermal_zone(dev); |
| 740 | int trip, ret; | 737 | int trip, ret; |
| 741 | unsigned long temperature; | 738 | int temperature; |
| 742 | 739 | ||
| 743 | if (!tz->ops->get_trip_hyst) | 740 | if (!tz->ops->get_trip_hyst) |
| 744 | return -EPERM; | 741 | return -EPERM; |
| @@ -748,7 +745,7 @@ trip_point_hyst_show(struct device *dev, struct device_attribute *attr, | |||
| 748 | 745 | ||
| 749 | ret = tz->ops->get_trip_hyst(tz, trip, &temperature); | 746 | ret = tz->ops->get_trip_hyst(tz, trip, &temperature); |
| 750 | 747 | ||
| 751 | return ret ? ret : sprintf(buf, "%ld\n", temperature); | 748 | return ret ? ret : sprintf(buf, "%d\n", temperature); |
| 752 | } | 749 | } |
| 753 | 750 | ||
| 754 | static ssize_t | 751 | static ssize_t |
| @@ -847,7 +844,27 @@ policy_show(struct device *dev, struct device_attribute *devattr, char *buf) | |||
| 847 | return sprintf(buf, "%s\n", tz->governor->name); | 844 | return sprintf(buf, "%s\n", tz->governor->name); |
| 848 | } | 845 | } |
| 849 | 846 | ||
| 850 | #ifdef CONFIG_THERMAL_EMULATION | 847 | static ssize_t |
| 848 | available_policies_show(struct device *dev, struct device_attribute *devattr, | ||
| 849 | char *buf) | ||
| 850 | { | ||
| 851 | struct thermal_governor *pos; | ||
| 852 | ssize_t count = 0; | ||
| 853 | ssize_t size = PAGE_SIZE; | ||
| 854 | |||
| 855 | mutex_lock(&thermal_governor_lock); | ||
| 856 | |||
| 857 | list_for_each_entry(pos, &thermal_governor_list, governor_list) { | ||
| 858 | size = PAGE_SIZE - count; | ||
| 859 | count += scnprintf(buf + count, size, "%s ", pos->name); | ||
| 860 | } | ||
| 861 | count += scnprintf(buf + count, size, "\n"); | ||
| 862 | |||
| 863 | mutex_unlock(&thermal_governor_lock); | ||
| 864 | |||
| 865 | return count; | ||
| 866 | } | ||
| 867 | |||
| 851 | static ssize_t | 868 | static ssize_t |
| 852 | emul_temp_store(struct device *dev, struct device_attribute *attr, | 869 | emul_temp_store(struct device *dev, struct device_attribute *attr, |
| 853 | const char *buf, size_t count) | 870 | const char *buf, size_t count) |
| @@ -873,7 +890,6 @@ emul_temp_store(struct device *dev, struct device_attribute *attr, | |||
| 873 | return ret ? ret : count; | 890 | return ret ? ret : count; |
| 874 | } | 891 | } |
| 875 | static DEVICE_ATTR(emul_temp, S_IWUSR, NULL, emul_temp_store); | 892 | static DEVICE_ATTR(emul_temp, S_IWUSR, NULL, emul_temp_store); |
| 876 | #endif/*CONFIG_THERMAL_EMULATION*/ | ||
| 877 | 893 | ||
| 878 | static ssize_t | 894 | static ssize_t |
| 879 | sustainable_power_show(struct device *dev, struct device_attribute *devattr, | 895 | sustainable_power_show(struct device *dev, struct device_attribute *devattr, |
| @@ -1032,6 +1048,7 @@ static DEVICE_ATTR(temp, 0444, temp_show, NULL); | |||
| 1032 | static DEVICE_ATTR(mode, 0644, mode_show, mode_store); | 1048 | static DEVICE_ATTR(mode, 0644, mode_show, mode_store); |
| 1033 | static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show, passive_store); | 1049 | static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show, passive_store); |
| 1034 | static DEVICE_ATTR(policy, S_IRUGO | S_IWUSR, policy_show, policy_store); | 1050 | static DEVICE_ATTR(policy, S_IRUGO | S_IWUSR, policy_show, policy_store); |
| 1051 | static DEVICE_ATTR(available_policies, S_IRUGO, available_policies_show, NULL); | ||
| 1035 | 1052 | ||
| 1036 | /* sys I/F for cooling device */ | 1053 | /* sys I/F for cooling device */ |
| 1037 | #define to_cooling_device(_dev) \ | 1054 | #define to_cooling_device(_dev) \ |
| @@ -1803,11 +1820,12 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, | |||
| 1803 | goto unregister; | 1820 | goto unregister; |
| 1804 | } | 1821 | } |
| 1805 | 1822 | ||
| 1806 | #ifdef CONFIG_THERMAL_EMULATION | 1823 | if (IS_ENABLED(CONFIG_THERMAL_EMULATION)) { |
| 1807 | result = device_create_file(&tz->device, &dev_attr_emul_temp); | 1824 | result = device_create_file(&tz->device, &dev_attr_emul_temp); |
| 1808 | if (result) | 1825 | if (result) |
| 1809 | goto unregister; | 1826 | goto unregister; |
| 1810 | #endif | 1827 | } |
| 1828 | |||
| 1811 | /* Create policy attribute */ | 1829 | /* Create policy attribute */ |
| 1812 | result = device_create_file(&tz->device, &dev_attr_policy); | 1830 | result = device_create_file(&tz->device, &dev_attr_policy); |
| 1813 | if (result) | 1831 | if (result) |
| @@ -1818,6 +1836,11 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, | |||
| 1818 | if (result) | 1836 | if (result) |
| 1819 | goto unregister; | 1837 | goto unregister; |
| 1820 | 1838 | ||
| 1839 | /* Create available_policies attribute */ | ||
| 1840 | result = device_create_file(&tz->device, &dev_attr_available_policies); | ||
| 1841 | if (result) | ||
| 1842 | goto unregister; | ||
| 1843 | |||
| 1821 | /* Update 'this' zone's governor information */ | 1844 | /* Update 'this' zone's governor information */ |
| 1822 | mutex_lock(&thermal_governor_lock); | 1845 | mutex_lock(&thermal_governor_lock); |
| 1823 | 1846 | ||
| @@ -1849,9 +1872,6 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, | |||
| 1849 | 1872 | ||
| 1850 | INIT_DELAYED_WORK(&(tz->poll_queue), thermal_zone_device_check); | 1873 | INIT_DELAYED_WORK(&(tz->poll_queue), thermal_zone_device_check); |
| 1851 | 1874 | ||
| 1852 | if (!tz->ops->get_temp) | ||
| 1853 | thermal_zone_device_set_polling(tz, 0); | ||
| 1854 | |||
| 1855 | thermal_zone_device_update(tz); | 1875 | thermal_zone_device_update(tz); |
| 1856 | 1876 | ||
| 1857 | return tz; | 1877 | return tz; |
| @@ -1918,6 +1938,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) | |||
| 1918 | if (tz->ops->get_mode) | 1938 | if (tz->ops->get_mode) |
| 1919 | device_remove_file(&tz->device, &dev_attr_mode); | 1939 | device_remove_file(&tz->device, &dev_attr_mode); |
| 1920 | device_remove_file(&tz->device, &dev_attr_policy); | 1940 | device_remove_file(&tz->device, &dev_attr_policy); |
| 1941 | device_remove_file(&tz->device, &dev_attr_available_policies); | ||
| 1921 | remove_trip_attrs(tz); | 1942 | remove_trip_attrs(tz); |
| 1922 | thermal_set_governor(tz, NULL); | 1943 | thermal_set_governor(tz, NULL); |
| 1923 | 1944 | ||
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index 1967bee4f076..06fd2ed9ef9d 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c | |||
| @@ -69,7 +69,7 @@ static DEVICE_ATTR(name, 0444, name_show, NULL); | |||
| 69 | static ssize_t | 69 | static ssize_t |
| 70 | temp_input_show(struct device *dev, struct device_attribute *attr, char *buf) | 70 | temp_input_show(struct device *dev, struct device_attribute *attr, char *buf) |
| 71 | { | 71 | { |
| 72 | long temperature; | 72 | int temperature; |
| 73 | int ret; | 73 | int ret; |
| 74 | struct thermal_hwmon_attr *hwmon_attr | 74 | struct thermal_hwmon_attr *hwmon_attr |
| 75 | = container_of(attr, struct thermal_hwmon_attr, attr); | 75 | = container_of(attr, struct thermal_hwmon_attr, attr); |
| @@ -83,7 +83,7 @@ temp_input_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
| 83 | if (ret) | 83 | if (ret) |
| 84 | return ret; | 84 | return ret; |
| 85 | 85 | ||
| 86 | return sprintf(buf, "%ld\n", temperature); | 86 | return sprintf(buf, "%d\n", temperature); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | static ssize_t | 89 | static ssize_t |
| @@ -95,14 +95,14 @@ temp_crit_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
| 95 | = container_of(hwmon_attr, struct thermal_hwmon_temp, | 95 | = container_of(hwmon_attr, struct thermal_hwmon_temp, |
| 96 | temp_crit); | 96 | temp_crit); |
| 97 | struct thermal_zone_device *tz = temp->tz; | 97 | struct thermal_zone_device *tz = temp->tz; |
| 98 | long temperature; | 98 | int temperature; |
| 99 | int ret; | 99 | int ret; |
| 100 | 100 | ||
| 101 | ret = tz->ops->get_trip_temp(tz, 0, &temperature); | 101 | ret = tz->ops->get_trip_temp(tz, 0, &temperature); |
| 102 | if (ret) | 102 | if (ret) |
| 103 | return ret; | 103 | return ret; |
| 104 | 104 | ||
| 105 | return sprintf(buf, "%ld\n", temperature); | 105 | return sprintf(buf, "%d\n", temperature); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | 108 | ||
| @@ -142,7 +142,7 @@ thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon, | |||
| 142 | 142 | ||
| 143 | static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz) | 143 | static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz) |
| 144 | { | 144 | { |
| 145 | unsigned long temp; | 145 | int temp; |
| 146 | return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp); | 146 | return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp); |
| 147 | } | 147 | } |
| 148 | 148 | ||
diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index c7c5b3779dac..b213a1222295 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c | |||
| @@ -76,14 +76,14 @@ static inline int ti_thermal_hotspot_temperature(int t, int s, int c) | |||
| 76 | 76 | ||
| 77 | /* thermal zone ops */ | 77 | /* thermal zone ops */ |
| 78 | /* Get temperature callback function for thermal zone */ | 78 | /* Get temperature callback function for thermal zone */ |
| 79 | static inline int __ti_thermal_get_temp(void *devdata, long *temp) | 79 | static inline int __ti_thermal_get_temp(void *devdata, int *temp) |
| 80 | { | 80 | { |
| 81 | struct thermal_zone_device *pcb_tz = NULL; | 81 | struct thermal_zone_device *pcb_tz = NULL; |
| 82 | struct ti_thermal_data *data = devdata; | 82 | struct ti_thermal_data *data = devdata; |
| 83 | struct ti_bandgap *bgp; | 83 | struct ti_bandgap *bgp; |
| 84 | const struct ti_temp_sensor *s; | 84 | const struct ti_temp_sensor *s; |
| 85 | int ret, tmp, slope, constant; | 85 | int ret, tmp, slope, constant; |
| 86 | unsigned long pcb_temp; | 86 | int pcb_temp; |
| 87 | 87 | ||
| 88 | if (!data) | 88 | if (!data) |
| 89 | return 0; | 89 | return 0; |
| @@ -119,7 +119,7 @@ static inline int __ti_thermal_get_temp(void *devdata, long *temp) | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal, | 121 | static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal, |
| 122 | unsigned long *temp) | 122 | int *temp) |
| 123 | { | 123 | { |
| 124 | struct ti_thermal_data *data = thermal->devdata; | 124 | struct ti_thermal_data *data = thermal->devdata; |
| 125 | 125 | ||
| @@ -229,7 +229,7 @@ static int ti_thermal_get_trip_type(struct thermal_zone_device *thermal, | |||
| 229 | 229 | ||
| 230 | /* Get trip temperature callback functions for thermal zone */ | 230 | /* Get trip temperature callback functions for thermal zone */ |
| 231 | static int ti_thermal_get_trip_temp(struct thermal_zone_device *thermal, | 231 | static int ti_thermal_get_trip_temp(struct thermal_zone_device *thermal, |
| 232 | int trip, unsigned long *temp) | 232 | int trip, int *temp) |
| 233 | { | 233 | { |
| 234 | if (!ti_thermal_is_valid_trip(trip)) | 234 | if (!ti_thermal_is_valid_trip(trip)) |
| 235 | return -EINVAL; | 235 | return -EINVAL; |
| @@ -280,7 +280,7 @@ static int ti_thermal_get_trend(struct thermal_zone_device *thermal, | |||
| 280 | 280 | ||
| 281 | /* Get critical temperature callback functions for thermal zone */ | 281 | /* Get critical temperature callback functions for thermal zone */ |
| 282 | static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal, | 282 | static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal, |
| 283 | unsigned long *temp) | 283 | int *temp) |
| 284 | { | 284 | { |
| 285 | /* shutdown zone */ | 285 | /* shutdown zone */ |
| 286 | return ti_thermal_get_trip_temp(thermal, OMAP_TRIP_NUMBER - 1, temp); | 286 | return ti_thermal_get_trip_temp(thermal, OMAP_TRIP_NUMBER - 1, temp); |
diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c index 50d1d2cb091a..7fc919f7da4d 100644 --- a/drivers/thermal/x86_pkg_temp_thermal.c +++ b/drivers/thermal/x86_pkg_temp_thermal.c | |||
| @@ -164,7 +164,7 @@ err_ret: | |||
| 164 | return err; | 164 | return err; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | static int sys_get_curr_temp(struct thermal_zone_device *tzd, unsigned long *temp) | 167 | static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp) |
| 168 | { | 168 | { |
| 169 | u32 eax, edx; | 169 | u32 eax, edx; |
| 170 | struct phy_dev_entry *phy_dev_entry; | 170 | struct phy_dev_entry *phy_dev_entry; |
| @@ -175,7 +175,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, unsigned long *tem | |||
| 175 | if (eax & 0x80000000) { | 175 | if (eax & 0x80000000) { |
| 176 | *temp = phy_dev_entry->tj_max - | 176 | *temp = phy_dev_entry->tj_max - |
| 177 | ((eax >> 16) & 0x7f) * 1000; | 177 | ((eax >> 16) & 0x7f) * 1000; |
| 178 | pr_debug("sys_get_curr_temp %ld\n", *temp); | 178 | pr_debug("sys_get_curr_temp %d\n", *temp); |
| 179 | return 0; | 179 | return 0; |
| 180 | } | 180 | } |
| 181 | 181 | ||
| @@ -183,7 +183,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, unsigned long *tem | |||
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | static int sys_get_trip_temp(struct thermal_zone_device *tzd, | 185 | static int sys_get_trip_temp(struct thermal_zone_device *tzd, |
| 186 | int trip, unsigned long *temp) | 186 | int trip, int *temp) |
| 187 | { | 187 | { |
| 188 | u32 eax, edx; | 188 | u32 eax, edx; |
| 189 | struct phy_dev_entry *phy_dev_entry; | 189 | struct phy_dev_entry *phy_dev_entry; |
| @@ -214,13 +214,13 @@ static int sys_get_trip_temp(struct thermal_zone_device *tzd, | |||
| 214 | *temp = phy_dev_entry->tj_max - thres_reg_value * 1000; | 214 | *temp = phy_dev_entry->tj_max - thres_reg_value * 1000; |
| 215 | else | 215 | else |
| 216 | *temp = 0; | 216 | *temp = 0; |
| 217 | pr_debug("sys_get_trip_temp %ld\n", *temp); | 217 | pr_debug("sys_get_trip_temp %d\n", *temp); |
| 218 | 218 | ||
| 219 | return 0; | 219 | return 0; |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, | 222 | static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, |
| 223 | unsigned long temp) | 223 | int temp) |
| 224 | { | 224 | { |
| 225 | u32 l, h; | 225 | u32 l, h; |
| 226 | struct phy_dev_entry *phy_dev_entry; | 226 | struct phy_dev_entry *phy_dev_entry; |
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 037e9df2f610..17292fee8686 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
| @@ -92,23 +92,19 @@ struct thermal_zone_device_ops { | |||
| 92 | struct thermal_cooling_device *); | 92 | struct thermal_cooling_device *); |
| 93 | int (*unbind) (struct thermal_zone_device *, | 93 | int (*unbind) (struct thermal_zone_device *, |
| 94 | struct thermal_cooling_device *); | 94 | struct thermal_cooling_device *); |
| 95 | int (*get_temp) (struct thermal_zone_device *, unsigned long *); | 95 | int (*get_temp) (struct thermal_zone_device *, int *); |
| 96 | int (*get_mode) (struct thermal_zone_device *, | 96 | int (*get_mode) (struct thermal_zone_device *, |
| 97 | enum thermal_device_mode *); | 97 | enum thermal_device_mode *); |
| 98 | int (*set_mode) (struct thermal_zone_device *, | 98 | int (*set_mode) (struct thermal_zone_device *, |
| 99 | enum thermal_device_mode); | 99 | enum thermal_device_mode); |
| 100 | int (*get_trip_type) (struct thermal_zone_device *, int, | 100 | int (*get_trip_type) (struct thermal_zone_device *, int, |
| 101 | enum thermal_trip_type *); | 101 | enum thermal_trip_type *); |
| 102 | int (*get_trip_temp) (struct thermal_zone_device *, int, | 102 | int (*get_trip_temp) (struct thermal_zone_device *, int, int *); |
| 103 | unsigned long *); | 103 | int (*set_trip_temp) (struct thermal_zone_device *, int, int); |
| 104 | int (*set_trip_temp) (struct thermal_zone_device *, int, | 104 | int (*get_trip_hyst) (struct thermal_zone_device *, int, int *); |
| 105 | unsigned long); | 105 | int (*set_trip_hyst) (struct thermal_zone_device *, int, int); |
| 106 | int (*get_trip_hyst) (struct thermal_zone_device *, int, | 106 | int (*get_crit_temp) (struct thermal_zone_device *, int *); |
| 107 | unsigned long *); | 107 | int (*set_emul_temp) (struct thermal_zone_device *, int); |
| 108 | int (*set_trip_hyst) (struct thermal_zone_device *, int, | ||
| 109 | unsigned long); | ||
| 110 | int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); | ||
| 111 | int (*set_emul_temp) (struct thermal_zone_device *, unsigned long); | ||
| 112 | int (*get_trend) (struct thermal_zone_device *, int, | 108 | int (*get_trend) (struct thermal_zone_device *, int, |
| 113 | enum thermal_trend *); | 109 | enum thermal_trend *); |
| 114 | int (*notify) (struct thermal_zone_device *, int, | 110 | int (*notify) (struct thermal_zone_device *, int, |
| @@ -332,9 +328,9 @@ struct thermal_genl_event { | |||
| 332 | * temperature. | 328 | * temperature. |
| 333 | */ | 329 | */ |
| 334 | struct thermal_zone_of_device_ops { | 330 | struct thermal_zone_of_device_ops { |
| 335 | int (*get_temp)(void *, long *); | 331 | int (*get_temp)(void *, int *); |
| 336 | int (*get_trend)(void *, long *); | 332 | int (*get_trend)(void *, long *); |
| 337 | int (*set_emul_temp)(void *, unsigned long); | 333 | int (*set_emul_temp)(void *, int); |
| 338 | }; | 334 | }; |
| 339 | 335 | ||
| 340 | /** | 336 | /** |
| @@ -406,7 +402,7 @@ thermal_of_cooling_device_register(struct device_node *np, char *, void *, | |||
| 406 | const struct thermal_cooling_device_ops *); | 402 | const struct thermal_cooling_device_ops *); |
| 407 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); | 403 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); |
| 408 | struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name); | 404 | struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name); |
| 409 | int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp); | 405 | int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp); |
| 410 | 406 | ||
| 411 | int get_tz_trend(struct thermal_zone_device *, int); | 407 | int get_tz_trend(struct thermal_zone_device *, int); |
| 412 | struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, | 408 | struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, |
| @@ -457,7 +453,7 @@ static inline struct thermal_zone_device *thermal_zone_get_zone_by_name( | |||
| 457 | const char *name) | 453 | const char *name) |
| 458 | { return ERR_PTR(-ENODEV); } | 454 | { return ERR_PTR(-ENODEV); } |
| 459 | static inline int thermal_zone_get_temp( | 455 | static inline int thermal_zone_get_temp( |
| 460 | struct thermal_zone_device *tz, unsigned long *temp) | 456 | struct thermal_zone_device *tz, int *temp) |
| 461 | { return -ENODEV; } | 457 | { return -ENODEV; } |
| 462 | static inline int get_tz_trend(struct thermal_zone_device *tz, int trip) | 458 | static inline int get_tz_trend(struct thermal_zone_device *tz, int trip) |
| 463 | { return -ENODEV; } | 459 | { return -ENODEV; } |
diff --git a/include/trace/events/thermal_power_allocator.h b/include/trace/events/thermal_power_allocator.h index 12e1321c4e0c..5afae8fe3795 100644 --- a/include/trace/events/thermal_power_allocator.h +++ b/include/trace/events/thermal_power_allocator.h | |||
| @@ -11,7 +11,7 @@ TRACE_EVENT(thermal_power_allocator, | |||
| 11 | u32 total_req_power, u32 *granted_power, | 11 | u32 total_req_power, u32 *granted_power, |
| 12 | u32 total_granted_power, size_t num_actors, | 12 | u32 total_granted_power, size_t num_actors, |
| 13 | u32 power_range, u32 max_allocatable_power, | 13 | u32 power_range, u32 max_allocatable_power, |
| 14 | unsigned long current_temp, s32 delta_temp), | 14 | int current_temp, s32 delta_temp), |
| 15 | TP_ARGS(tz, req_power, total_req_power, granted_power, | 15 | TP_ARGS(tz, req_power, total_req_power, granted_power, |
| 16 | total_granted_power, num_actors, power_range, | 16 | total_granted_power, num_actors, power_range, |
| 17 | max_allocatable_power, current_temp, delta_temp), | 17 | max_allocatable_power, current_temp, delta_temp), |
| @@ -24,7 +24,7 @@ TRACE_EVENT(thermal_power_allocator, | |||
| 24 | __field(size_t, num_actors ) | 24 | __field(size_t, num_actors ) |
| 25 | __field(u32, power_range ) | 25 | __field(u32, power_range ) |
| 26 | __field(u32, max_allocatable_power ) | 26 | __field(u32, max_allocatable_power ) |
| 27 | __field(unsigned long, current_temp ) | 27 | __field(int, current_temp ) |
| 28 | __field(s32, delta_temp ) | 28 | __field(s32, delta_temp ) |
| 29 | ), | 29 | ), |
| 30 | TP_fast_assign( | 30 | TP_fast_assign( |
| @@ -42,7 +42,7 @@ TRACE_EVENT(thermal_power_allocator, | |||
| 42 | __entry->delta_temp = delta_temp; | 42 | __entry->delta_temp = delta_temp; |
| 43 | ), | 43 | ), |
| 44 | 44 | ||
| 45 | TP_printk("thermal_zone_id=%d req_power={%s} total_req_power=%u granted_power={%s} total_granted_power=%u power_range=%u max_allocatable_power=%u current_temperature=%lu delta_temperature=%d", | 45 | TP_printk("thermal_zone_id=%d req_power={%s} total_req_power=%u granted_power={%s} total_granted_power=%u power_range=%u max_allocatable_power=%u current_temperature=%d delta_temperature=%d", |
| 46 | __entry->tz_id, | 46 | __entry->tz_id, |
| 47 | __print_array(__get_dynamic_array(req_power), | 47 | __print_array(__get_dynamic_array(req_power), |
| 48 | __entry->num_actors, 4), | 48 | __entry->num_actors, 4), |
