FROMLIST: drivers/thermal/thermal_of: Add critical/hot ops support for thermal_of sensor
The sensor driver which register through thermal_of interface doesn't have an option to get thermal zone critical, hot trip violation notification from thermal core. Add support for these ops in thermal_of interface so that sensor driver can use these ops. Signed-off-by: Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com> Bug: 226570053 Change-Id: I5e3d5a4b360d134ae70e9fcdb88ca2b4de0b79b2 Link: https://lore.kernel.org/all/20220601131400.24627-2-quic_manafm@quicinc.com/ Signed-off-by: Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com>
This commit is contained in:
committed by
Carlos Llamas
parent
50bca2f782
commit
d6f34bc835
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user