diff options
author | Bai Ping <b51503@freescale.com> | 2015-10-14 02:46:13 +0800 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:23:33 +0800 |
commit | dfd5b0d1f4700195a14d51590e3bbb55b72c7359 (patch) | |
tree | abef00b85c0b9bcf9c6631ee086225ff21a40077 /drivers/thermal | |
parent | 7023e27e0f8c833349f3788ca0f0193dd1da1b00 (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.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 91acd0edf500..c3cfd3b38812 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -455,17 +455,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 > (data->temp_max - (1000 * 10))) + return -EINVAL; + data->temp_passive = temp; + imx_set_alarm_temp(data, temp); + } return 0; } @@ -855,7 +856,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); |