mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]> Signed-off-by: Caesar Wang <[email protected]> Cc: Zhang Rui <[email protected]> Cc: Eduardo Valentin <[email protected]> Reviewed-by: Javi Merino <[email protected]> Signed-off-by: Eduardo Valentin <[email protected]> Signed-off-by: Zhang Rui <[email protected]>
This commit is contained in:
parent
060c034a97
commit
826386e731
2 changed files with 23 additions and 0 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue