diff options
author | Wei Ni <wni@nvidia.com> | 2016-03-29 18:29:17 +0800 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2016-05-17 07:28:28 -0700 |
commit | c35095215a80b13af2f521e1ab1c727a5224e53b (patch) | |
tree | 65b5f909335917a5c763b2557b15cbdbb8d0330a /drivers/thermal | |
parent | d753b22d8b2d500377bc85c4909cc0d6f199d1c8 (diff) | |
download | lwn-c35095215a80b13af2f521e1ab1c727a5224e53b.tar.gz lwn-c35095215a80b13af2f521e1ab1c727a5224e53b.zip |
thermal: of-thermal: allow setting trip_temp on hardware
In current of-thermal, the .set_trip_temp only support to
set trip_temp for SW. But some sensors support to set
trip_temp on hardware, so that can trigger interrupt,
shutdown or any other events.
This patch adds .set_trip_temp() callback in
thermal_zone_of_device_ops{}, so that the sensor device can
use it to set trip_temp on hardware.
Signed-off-by: Wei Ni <wni@nvidia.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/of-thermal.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 82dd82afa555..b8e509c60848 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -331,6 +331,14 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip, if (trip >= data->ntrips || trip < 0) return -EDOM; + if (data->ops->set_trip_temp) { + int ret; + + ret = data->ops->set_trip_temp(data->sensor_data, trip, temp); + if (ret) + return ret; + } + /* thermal framework should take care of data->mask & (1 << trip) */ data->trips[trip].temperature = temp; |