thermal/drivers/da9062: Use generic thermal_zone_get_trip() function
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 ops content logic into generic trip points and register them with the thermal zone. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com> Link: https://lore.kernel.org/r/20221003092602.1323944-25-daniel.lezcano@linaro.org
This commit is contained in:
parent
52945c1c65
commit
060b39d934
|
@ -120,44 +120,6 @@ static irqreturn_t da9062_thermal_irq_handler(int irq, void *data)
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int da9062_thermal_get_trip_type(struct thermal_zone_device *z,
|
|
||||||
int trip,
|
|
||||||
enum thermal_trip_type *type)
|
|
||||||
{
|
|
||||||
struct da9062_thermal *thermal = z->devdata;
|
|
||||||
|
|
||||||
switch (trip) {
|
|
||||||
case 0:
|
|
||||||
*type = THERMAL_TRIP_HOT;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
dev_err(thermal->dev,
|
|
||||||
"Driver does not support more than 1 trip-wire\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int da9062_thermal_get_trip_temp(struct thermal_zone_device *z,
|
|
||||||
int trip,
|
|
||||||
int *temp)
|
|
||||||
{
|
|
||||||
struct da9062_thermal *thermal = z->devdata;
|
|
||||||
|
|
||||||
switch (trip) {
|
|
||||||
case 0:
|
|
||||||
*temp = DA9062_MILLI_CELSIUS(125);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
dev_err(thermal->dev,
|
|
||||||
"Driver does not support more than 1 trip-wire\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int da9062_thermal_get_temp(struct thermal_zone_device *z,
|
static int da9062_thermal_get_temp(struct thermal_zone_device *z,
|
||||||
int *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
|
@ -172,8 +134,10 @@ static int da9062_thermal_get_temp(struct thermal_zone_device *z,
|
||||||
|
|
||||||
static struct thermal_zone_device_ops da9062_thermal_ops = {
|
static struct thermal_zone_device_ops da9062_thermal_ops = {
|
||||||
.get_temp = da9062_thermal_get_temp,
|
.get_temp = da9062_thermal_get_temp,
|
||||||
.get_trip_type = da9062_thermal_get_trip_type,
|
};
|
||||||
.get_trip_temp = da9062_thermal_get_trip_temp,
|
|
||||||
|
static struct thermal_trip trips[] = {
|
||||||
|
{ .temperature = DA9062_MILLI_CELSIUS(125), .type = THERMAL_TRIP_HOT },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct da9062_thermal_config da9062_config = {
|
static const struct da9062_thermal_config da9062_config = {
|
||||||
|
@ -228,8 +192,8 @@ static int da9062_thermal_probe(struct platform_device *pdev)
|
||||||
INIT_DELAYED_WORK(&thermal->work, da9062_thermal_poll_on);
|
INIT_DELAYED_WORK(&thermal->work, da9062_thermal_poll_on);
|
||||||
mutex_init(&thermal->lock);
|
mutex_init(&thermal->lock);
|
||||||
|
|
||||||
thermal->zone = thermal_zone_device_register(thermal->config->name,
|
thermal->zone = thermal_zone_device_register_with_trips(thermal->config->name,
|
||||||
1, 0, thermal,
|
trips, ARRAY_SIZE(trips), 0, thermal,
|
||||||
&da9062_thermal_ops, NULL, pp_tmp,
|
&da9062_thermal_ops, NULL, pp_tmp,
|
||||||
0);
|
0);
|
||||||
if (IS_ERR(thermal->zone)) {
|
if (IS_ERR(thermal->zone)) {
|
||||||
|
|
Loading…
Reference in New Issue