diff options
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/imx_thermal.c | 18 | ||||
-rw-r--r-- | drivers/thermal/of-thermal.c | 7 | ||||
-rw-r--r-- | drivers/thermal/thermal_hwmon.c | 33 | ||||
-rw-r--r-- | drivers/thermal/ti-soc-thermal/ti-bandgap.c | 2 |
4 files changed, 30 insertions, 30 deletions
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index a99c63152b8d..2c516f2eebed 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c | |||
@@ -306,7 +306,7 @@ static int imx_get_sensor_data(struct platform_device *pdev) | |||
306 | { | 306 | { |
307 | struct imx_thermal_data *data = platform_get_drvdata(pdev); | 307 | struct imx_thermal_data *data = platform_get_drvdata(pdev); |
308 | struct regmap *map; | 308 | struct regmap *map; |
309 | int t1, t2, n1, n2; | 309 | int t1, n1; |
310 | int ret; | 310 | int ret; |
311 | u32 val; | 311 | u32 val; |
312 | u64 temp64; | 312 | u64 temp64; |
@@ -333,14 +333,10 @@ static int imx_get_sensor_data(struct platform_device *pdev) | |||
333 | /* | 333 | /* |
334 | * Sensor data layout: | 334 | * Sensor data layout: |
335 | * [31:20] - sensor value @ 25C | 335 | * [31:20] - sensor value @ 25C |
336 | * [19:8] - sensor value of hot | ||
337 | * [7:0] - hot temperature value | ||
338 | * Use universal formula now and only need sensor value @ 25C | 336 | * Use universal formula now and only need sensor value @ 25C |
339 | * slope = 0.4297157 - (0.0015976 * 25C fuse) | 337 | * slope = 0.4297157 - (0.0015976 * 25C fuse) |
340 | */ | 338 | */ |
341 | n1 = val >> 20; | 339 | n1 = val >> 20; |
342 | n2 = (val & 0xfff00) >> 8; | ||
343 | t2 = val & 0xff; | ||
344 | t1 = 25; /* t1 always 25C */ | 340 | t1 = 25; /* t1 always 25C */ |
345 | 341 | ||
346 | /* | 342 | /* |
@@ -366,16 +362,16 @@ static int imx_get_sensor_data(struct platform_device *pdev) | |||
366 | data->c2 = n1 * data->c1 + 1000 * t1; | 362 | data->c2 = n1 * data->c1 + 1000 * t1; |
367 | 363 | ||
368 | /* | 364 | /* |
369 | * Set the default passive cooling trip point to 20 °C below the | 365 | * Set the default passive cooling trip point, |
370 | * maximum die temperature. Can be changed from userspace. | 366 | * can be changed from userspace. |
371 | */ | 367 | */ |
372 | data->temp_passive = 1000 * (t2 - 20); | 368 | data->temp_passive = IMX_TEMP_PASSIVE; |
373 | 369 | ||
374 | /* | 370 | /* |
375 | * The maximum die temperature is t2, let's give 5 °C cushion | 371 | * The maximum die temperature set to 20 C higher than |
376 | * for noise and possible temperature rise between measurements. | 372 | * IMX_TEMP_PASSIVE. |
377 | */ | 373 | */ |
378 | data->temp_critical = 1000 * (t2 - 5); | 374 | data->temp_critical = 1000 * 20 + data->temp_passive; |
379 | 375 | ||
380 | return 0; | 376 | return 0; |
381 | } | 377 | } |
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 04b1be7fa018..4b2b999b7611 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c | |||
@@ -156,8 +156,8 @@ static int of_thermal_bind(struct thermal_zone_device *thermal, | |||
156 | 156 | ||
157 | ret = thermal_zone_bind_cooling_device(thermal, | 157 | ret = thermal_zone_bind_cooling_device(thermal, |
158 | tbp->trip_id, cdev, | 158 | tbp->trip_id, cdev, |
159 | tbp->min, | 159 | tbp->max, |
160 | tbp->max); | 160 | tbp->min); |
161 | if (ret) | 161 | if (ret) |
162 | return ret; | 162 | return ret; |
163 | } | 163 | } |
@@ -712,11 +712,12 @@ thermal_of_build_thermal_zone(struct device_node *np) | |||
712 | } | 712 | } |
713 | 713 | ||
714 | i = 0; | 714 | i = 0; |
715 | for_each_child_of_node(child, gchild) | 715 | for_each_child_of_node(child, gchild) { |
716 | ret = thermal_of_populate_bind_params(gchild, &tz->tbps[i++], | 716 | ret = thermal_of_populate_bind_params(gchild, &tz->tbps[i++], |
717 | tz->trips, tz->ntrips); | 717 | tz->trips, tz->ntrips); |
718 | if (ret) | 718 | if (ret) |
719 | goto free_tbps; | 719 | goto free_tbps; |
720 | } | ||
720 | 721 | ||
721 | finish: | 722 | finish: |
722 | of_node_put(child); | 723 | of_node_put(child); |
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index fdb07199d9c2..1967bee4f076 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c | |||
@@ -140,6 +140,12 @@ thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon, | |||
140 | return NULL; | 140 | return NULL; |
141 | } | 141 | } |
142 | 142 | ||
143 | static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz) | ||
144 | { | ||
145 | unsigned long temp; | ||
146 | return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp); | ||
147 | } | ||
148 | |||
143 | int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) | 149 | int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) |
144 | { | 150 | { |
145 | struct thermal_hwmon_device *hwmon; | 151 | struct thermal_hwmon_device *hwmon; |
@@ -189,21 +195,18 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) | |||
189 | if (result) | 195 | if (result) |
190 | goto free_temp_mem; | 196 | goto free_temp_mem; |
191 | 197 | ||
192 | if (tz->ops->get_crit_temp) { | 198 | if (thermal_zone_crit_temp_valid(tz)) { |
193 | unsigned long temperature; | 199 | snprintf(temp->temp_crit.name, |
194 | if (!tz->ops->get_crit_temp(tz, &temperature)) { | 200 | sizeof(temp->temp_crit.name), |
195 | snprintf(temp->temp_crit.name, | ||
196 | sizeof(temp->temp_crit.name), | ||
197 | "temp%d_crit", hwmon->count); | 201 | "temp%d_crit", hwmon->count); |
198 | temp->temp_crit.attr.attr.name = temp->temp_crit.name; | 202 | temp->temp_crit.attr.attr.name = temp->temp_crit.name; |
199 | temp->temp_crit.attr.attr.mode = 0444; | 203 | temp->temp_crit.attr.attr.mode = 0444; |
200 | temp->temp_crit.attr.show = temp_crit_show; | 204 | temp->temp_crit.attr.show = temp_crit_show; |
201 | sysfs_attr_init(&temp->temp_crit.attr.attr); | 205 | sysfs_attr_init(&temp->temp_crit.attr.attr); |
202 | result = device_create_file(hwmon->device, | 206 | result = device_create_file(hwmon->device, |
203 | &temp->temp_crit.attr); | 207 | &temp->temp_crit.attr); |
204 | if (result) | 208 | if (result) |
205 | goto unregister_input; | 209 | goto unregister_input; |
206 | } | ||
207 | } | 210 | } |
208 | 211 | ||
209 | mutex_lock(&thermal_hwmon_list_lock); | 212 | mutex_lock(&thermal_hwmon_list_lock); |
@@ -250,7 +253,7 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) | |||
250 | } | 253 | } |
251 | 254 | ||
252 | device_remove_file(hwmon->device, &temp->temp_input.attr); | 255 | device_remove_file(hwmon->device, &temp->temp_input.attr); |
253 | if (tz->ops->get_crit_temp) | 256 | if (thermal_zone_crit_temp_valid(tz)) |
254 | device_remove_file(hwmon->device, &temp->temp_crit.attr); | 257 | device_remove_file(hwmon->device, &temp->temp_crit.attr); |
255 | 258 | ||
256 | mutex_lock(&thermal_hwmon_list_lock); | 259 | mutex_lock(&thermal_hwmon_list_lock); |
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index a1271b55103a..634b6ce0e63a 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c | |||
@@ -1155,7 +1155,7 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev) | |||
1155 | /* register shadow for context save and restore */ | 1155 | /* register shadow for context save and restore */ |
1156 | bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) * | 1156 | bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) * |
1157 | bgp->conf->sensor_count, GFP_KERNEL); | 1157 | bgp->conf->sensor_count, GFP_KERNEL); |
1158 | if (!bgp) { | 1158 | if (!bgp->regval) { |
1159 | dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n"); | 1159 | dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n"); |
1160 | return ERR_PTR(-ENOMEM); | 1160 | return ERR_PTR(-ENOMEM); |
1161 | } | 1161 | } |