Skip to content

Commit ed4b51b

Browse files
committed
thermal/drivers/imx: Use the thermal framework for the trip point
The thermal framework provides an API to get the trip related to a trip point id. We want to consolidate the generic trip points code, thus preventing the different drivers to deal with the trip points after they registered them. The set_trip_temp ops will be changed regarding the above changes but first we need to rework a bit the different implementation in the drivers. The goal is to prevent using the trip id but use a trip point passed as parameter which will contain all the needed information. As we don't have the trip point passed as parameter yet, we get the trip point using the generic trip thermal framewrok APIs and use it to take exactly the same decisions. The difference with this change and the previous code is from where we get the thermal trip point (which is the same). No functional change intended. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Fabio Estevam <festevam@gmail.com> Link: https://lore.kernel.org/r/20230309092821.1590586-2-daniel.lezcano@linaro.org Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
1 parent 53c9ce4 commit ed4b51b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

drivers/thermal/imx_thermal.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,26 +330,29 @@ static int imx_change_mode(struct thermal_zone_device *tz,
330330
return 0;
331331
}
332332

333-
static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
333+
static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip_id,
334334
int temp)
335335
{
336336
struct imx_thermal_data *data = thermal_zone_device_priv(tz);
337+
struct thermal_trip trip;
337338
int ret;
338339

339340
ret = pm_runtime_resume_and_get(data->dev);
340341
if (ret < 0)
341342
return ret;
342343

344+
ret = __thermal_zone_get_trip(tz, trip_id, &trip);
345+
if (ret)
346+
return ret;
347+
343348
/* do not allow changing critical threshold */
344-
if (trip == IMX_TRIP_CRITICAL)
349+
if (trip.type == THERMAL_TRIP_CRITICAL)
345350
return -EPERM;
346351

347352
/* do not allow passive to be set higher than critical */
348353
if (temp < 0 || temp > trips[IMX_TRIP_CRITICAL].temperature)
349354
return -EINVAL;
350355

351-
trips[IMX_TRIP_PASSIVE].temperature = temp;
352-
353356
imx_set_alarm_temp(data, temp);
354357

355358
pm_runtime_put(data->dev);

0 commit comments

Comments
 (0)