diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-06-22 10:42:02 +0200 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2016-09-27 08:02:16 +0200 |
commit | 826386e73193e0b58c6d797fbbab409bc98b1d9c (patch) | |
tree | d1c03aeba883d0c9d312929e68ccb9e75566398f /drivers/thermal/of-thermal.c | |
parent | thermal: Add support for hardware-tracked trip points (diff) | |
download | linux-826386e73193e0b58c6d797fbbab409bc98b1d9c.tar.xz linux-826386e73193e0b58c6d797fbbab409bc98b1d9c.zip |
thermal: of: implement .set_trips for device tree thermal zones
This patch implements .set_trips for device tree thermal zones.
As the hardware-tracked trip points is supported by thermal core patch[0].
patch[0]
"thermal: Add support for hardware-tracked trip points".
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Reviewed-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal/of-thermal.c')
-rw-r--r-- | drivers/thermal/of-thermal.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index b8e509c60848..2d2a06f155e2 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -101,6 +101,17 @@ static int of_thermal_get_temp(struct thermal_zone_device *tz, return data->ops->get_temp(data->sensor_data, temp); } +static int of_thermal_set_trips(struct thermal_zone_device *tz, + int low, int high) +{ + struct __thermal_zone *data = tz->devdata; + + if (!data->ops || !data->ops->set_trips) + return -EINVAL; + + return data->ops->set_trips(data->sensor_data, low, high); +} + /** * of_thermal_get_ntrips - function to export number of available trip * points. @@ -427,6 +438,14 @@ thermal_zone_of_add_sensor(struct device_node *zone, tzd->ops->get_temp = of_thermal_get_temp; tzd->ops->get_trend = of_thermal_get_trend; + + /* + * The thermal zone core will calculate the window if they have set the + * optional set_trips pointer. + */ + if (ops->set_trips) + tzd->ops->set_trips = of_thermal_set_trips; + tzd->ops->set_emul_temp = of_thermal_set_emul_temp; mutex_unlock(&tzd->lock); |