From: Bai Ping Date: Tue, 13 Oct 2015 18:46:13 +0000 (+0800) Subject: MLK-11705 thermal: imx: make the critical trip temp changable for test X-Git-Tag: C0P2-H0.0--20200415~4139 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=b796dd4e47915eb7c69b6ecc3e2e5d5696cd46e7;p=linux.git 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 --- 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);