diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index da484800906f..ca73c9767891 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -211,6 +211,20 @@ static int of_thermal_change_mode(struct thermal_zone_device *tz, return data->ops->change_mode(data->sensor_data, mode); } +static void of_thermal_hot_notify(struct thermal_zone_device *tz) +{ + struct __thermal_zone *data = tz->devdata; + + data->ops->hot(data->sensor_data); +} + +static void of_thermal_critical_notify(struct thermal_zone_device *tz) +{ + struct __thermal_zone *data = tz->devdata; + + data->ops->critical(data->sensor_data); +} + static int of_thermal_bind(struct thermal_zone_device *thermal, struct thermal_cooling_device *cdev) { @@ -419,6 +433,11 @@ thermal_zone_of_add_sensor(struct device_node *zone, if (ops->change_mode) tzd->ops->change_mode = of_thermal_change_mode; + if (ops->hot) + tzd->ops->hot = of_thermal_hot_notify; + + if (ops->critical) + tzd->ops->critical = of_thermal_critical_notify; mutex_unlock(&tzd->lock); return tzd; @@ -581,6 +600,8 @@ void thermal_zone_of_sensor_unregister(struct device *dev, tzd->ops->get_trend = NULL; tzd->ops->set_emul_temp = NULL; tzd->ops->change_mode = NULL; + tzd->ops->hot = NULL; + tzd->ops->critical = NULL; tz->ops = NULL; tz->sensor_data = NULL; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index f195baf4ea89..84fd13ecea8d 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -316,6 +316,10 @@ struct thermal_zone_params { * hardware. * @change_mode: a pointer to a function that notifies the thermal zone * mode change. + * @hot: a pointer to a function that notifies the thermal zone + * hot trip violation. + * @critical: a pointer to a function that notifies the thermal zone + * critical trip violation. */ struct thermal_zone_of_device_ops { int (*get_temp)(void *, int *); @@ -324,6 +328,8 @@ struct thermal_zone_of_device_ops { int (*set_emul_temp)(void *, int); int (*set_trip_temp)(void *, int, int); int (*change_mode) (void *, enum thermal_device_mode); + void (*hot)(void *sensor_data); + void (*critical)(void *sensor_data); ANDROID_KABI_RESERVE(1); };