diff options
-rw-r--r-- | drivers/thermal/int340x_thermal/int340x_thermal_zone.c | 20 | ||||
-rw-r--r-- | drivers/thermal/int340x_thermal/int340x_thermal_zone.h | 3 |
2 files changed, 20 insertions, 3 deletions
diff --git a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c index 162e545cc93a..f88b08877025 100644 --- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c +++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c | |||
@@ -33,8 +33,17 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone, | |||
33 | if (ACPI_FAILURE(status)) | 33 | if (ACPI_FAILURE(status)) |
34 | return -EIO; | 34 | return -EIO; |
35 | 35 | ||
36 | /* _TMP returns the temperature in tenths of degrees Kelvin */ | 36 | if (d->lpat_table) { |
37 | *temp = DECI_KELVIN_TO_MILLICELSIUS(tmp); | 37 | int conv_temp; |
38 | |||
39 | conv_temp = acpi_lpat_raw_to_temp(d->lpat_table, (int)tmp); | ||
40 | if (conv_temp < 0) | ||
41 | return conv_temp; | ||
42 | |||
43 | *temp = (unsigned long)conv_temp * 10; | ||
44 | } else | ||
45 | /* _TMP returns the temperature in tenths of degrees Kelvin */ | ||
46 | *temp = DECI_KELVIN_TO_MILLICELSIUS(tmp); | ||
38 | 47 | ||
39 | return 0; | 48 | return 0; |
40 | } | 49 | } |
@@ -227,6 +236,8 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, | |||
227 | int34x_thermal_zone->act_trips[i].id = trip_cnt++; | 236 | int34x_thermal_zone->act_trips[i].id = trip_cnt++; |
228 | int34x_thermal_zone->act_trips[i].valid = true; | 237 | int34x_thermal_zone->act_trips[i].valid = true; |
229 | } | 238 | } |
239 | int34x_thermal_zone->lpat_table = acpi_lpat_get_conversion_table( | ||
240 | adev->handle); | ||
230 | 241 | ||
231 | int34x_thermal_zone->zone = thermal_zone_device_register( | 242 | int34x_thermal_zone->zone = thermal_zone_device_register( |
232 | acpi_device_bid(adev), | 243 | acpi_device_bid(adev), |
@@ -237,11 +248,13 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, | |||
237 | 0, 0); | 248 | 0, 0); |
238 | if (IS_ERR(int34x_thermal_zone->zone)) { | 249 | if (IS_ERR(int34x_thermal_zone->zone)) { |
239 | ret = PTR_ERR(int34x_thermal_zone->zone); | 250 | ret = PTR_ERR(int34x_thermal_zone->zone); |
240 | goto free_mem; | 251 | goto free_lpat; |
241 | } | 252 | } |
242 | 253 | ||
243 | return int34x_thermal_zone; | 254 | return int34x_thermal_zone; |
244 | 255 | ||
256 | free_lpat: | ||
257 | acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table); | ||
245 | free_mem: | 258 | free_mem: |
246 | kfree(int34x_thermal_zone); | 259 | kfree(int34x_thermal_zone); |
247 | return ERR_PTR(ret); | 260 | return ERR_PTR(ret); |
@@ -252,6 +265,7 @@ void int340x_thermal_zone_remove(struct int34x_thermal_zone | |||
252 | *int34x_thermal_zone) | 265 | *int34x_thermal_zone) |
253 | { | 266 | { |
254 | thermal_zone_device_unregister(int34x_thermal_zone->zone); | 267 | thermal_zone_device_unregister(int34x_thermal_zone->zone); |
268 | acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table); | ||
255 | kfree(int34x_thermal_zone); | 269 | kfree(int34x_thermal_zone); |
256 | } | 270 | } |
257 | EXPORT_SYMBOL_GPL(int340x_thermal_zone_remove); | 271 | EXPORT_SYMBOL_GPL(int340x_thermal_zone_remove); |
diff --git a/drivers/thermal/int340x_thermal/int340x_thermal_zone.h b/drivers/thermal/int340x_thermal/int340x_thermal_zone.h index 11f2f5260c3a..9f38ab72c4bf 100644 --- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.h +++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.h | |||
@@ -16,6 +16,8 @@ | |||
16 | #ifndef __INT340X_THERMAL_ZONE_H__ | 16 | #ifndef __INT340X_THERMAL_ZONE_H__ |
17 | #define __INT340X_THERMAL_ZONE_H__ | 17 | #define __INT340X_THERMAL_ZONE_H__ |
18 | 18 | ||
19 | #include <acpi/acpi_lpat.h> | ||
20 | |||
19 | #define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10 | 21 | #define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10 |
20 | 22 | ||
21 | struct active_trip { | 23 | struct active_trip { |
@@ -38,6 +40,7 @@ struct int34x_thermal_zone { | |||
38 | struct thermal_zone_device *zone; | 40 | struct thermal_zone_device *zone; |
39 | struct thermal_zone_device_ops *override_ops; | 41 | struct thermal_zone_device_ops *override_ops; |
40 | void *priv_data; | 42 | void *priv_data; |
43 | struct acpi_lpat_conversion_table *lpat_table; | ||
41 | }; | 44 | }; |
42 | 45 | ||
43 | struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *, | 46 | struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *, |