thermal/drivers/st: Use generic trip points
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert to the generic trip points Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-21-daniel.lezcano@linaro.org
This commit is contained in:
parent
aacfbf15e0
commit
28fd2cd9b3
@ -134,48 +134,12 @@ static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int st_thermal_get_trip_type(struct thermal_zone_device *th,
|
||||
int trip, enum thermal_trip_type *type)
|
||||
{
|
||||
struct st_thermal_sensor *sensor = th->devdata;
|
||||
struct device *dev = sensor->dev;
|
||||
|
||||
switch (trip) {
|
||||
case 0:
|
||||
*type = THERMAL_TRIP_CRITICAL;
|
||||
break;
|
||||
default:
|
||||
dev_err(dev, "invalid trip point\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int st_thermal_get_trip_temp(struct thermal_zone_device *th,
|
||||
int trip, int *temp)
|
||||
{
|
||||
struct st_thermal_sensor *sensor = th->devdata;
|
||||
struct device *dev = sensor->dev;
|
||||
|
||||
switch (trip) {
|
||||
case 0:
|
||||
*temp = mcelsius(sensor->cdata->crit_temp);
|
||||
break;
|
||||
default:
|
||||
dev_err(dev, "Invalid trip point\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct thermal_zone_device_ops st_tz_ops = {
|
||||
.get_temp = st_thermal_get_temp,
|
||||
.get_trip_type = st_thermal_get_trip_type,
|
||||
.get_trip_temp = st_thermal_get_trip_temp,
|
||||
};
|
||||
|
||||
static struct thermal_trip trip;
|
||||
|
||||
int st_thermal_register(struct platform_device *pdev,
|
||||
const struct of_device_id *st_thermal_of_match)
|
||||
{
|
||||
@ -238,8 +202,11 @@ int st_thermal_register(struct platform_device *pdev,
|
||||
|
||||
polling_delay = sensor->ops->register_enable_irq ? 0 : 1000;
|
||||
|
||||
trip.temperature = sensor->cdata->crit_temp;
|
||||
trip.type = THERMAL_TRIP_CRITICAL;
|
||||
|
||||
sensor->thermal_dev =
|
||||
thermal_zone_device_register(dev_name(dev), 1, 0, sensor,
|
||||
thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, 0, sensor,
|
||||
&st_tz_ops, NULL, 0, polling_delay);
|
||||
if (IS_ERR(sensor->thermal_dev)) {
|
||||
dev_err(dev, "failed to register thermal zone device\n");
|
||||
|
Loading…
Reference in New Issue
Block a user