summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorBai Ping <b51503@freescale.com>2015-10-14 02:46:13 +0800
committerOctavian Purdila <octavian.purdila@nxp.com>2017-02-23 14:21:42 +0200
commitfc4fcd6894196a61ba88ed285953d39cd726d4f7 (patch)
tree7a3e56f8d7ece552bf56b47ac83d3fb45ef46342 /drivers/thermal
parent98a5a0b3620b47ab7a79d55ed5b34089b9b35dc3 (diff)
MLK-11705 thermal: imx: make the critical trip temp changable for test
In order to test the critical trip point funtion, the critical trip point temp should be writable from userspace. Signed-off-by: Bai Ping <b51503@freescale.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/imx_thermal.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index 29c83d4c7bac..1ae06c5f81a8 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -453,17 +453,18 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
{
struct imx_thermal_data *data = tz->devdata;
- /* do not allow changing critical threshold */
- if (trip == IMX_TRIP_CRITICAL)
- return -EPERM;
-
- /* do not allow passive to be set higher than critical */
- if (temp < 0 || temp > data->temp_critical)
- return -EINVAL;
-
- data->temp_passive = temp;
+ if (trip == IMX_TRIP_CRITICAL) {
+ data->temp_critical = temp;
+ if (data->socdata->version == TEMPMON_IMX6SX)
+ imx_set_panic_temp(data, temp);
+ }
- imx_set_alarm_temp(data, temp);
+ if (trip == IMX_TRIP_PASSIVE) {
+ if (temp > IMX_TRIP_PASSIVE)
+ return -EINVAL;
+ data->temp_passive = temp;
+ imx_set_alarm_temp(data, temp);
+ }
return 0;
}
@@ -841,7 +842,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
mutex_init(&data->mutex);
data->tz = thermal_zone_device_register("imx_thermal_zone",
IMX_TRIP_NUM,
- BIT(IMX_TRIP_PASSIVE), data,
+ (1 << IMX_TRIP_NUM) - 1, data,
&imx_tz_ops, NULL,
IMX_PASSIVE_DELAY,
IMX_POLLING_DELAY);