Skip to contentSkip to conversation

thermal/drivers/imx: Remove get_trip_temp ops

PATCH Applied Daniel Lezcano 2 participants 5 messages Mar 9, 2023 – Mar 13, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 thermal/drivers/imx: Remove get_trip_temp ops

The i.MX thermal sensor uses the generic trip points. The thermal framework can return the critical temperature directly.

Remove the pointless get_trip_temp ops.

---
 drivers/thermal/imx_thermal.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/thermal/imx_thermal.c +0 -8
index c3136978adee..69ed482167f7 100644
@@ -330,13 +330,6 @@ static int imx_change_mode(struct thermal_zone_device *tz,
 	return 0;
 }
 
-static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp)
-{
-	*temp = trips[IMX_TRIP_CRITICAL].temperature;
-
-	return 0;
-}
-
 static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
 			     int temp)
 {
@@ -384,7 +377,6 @@ static struct thermal_zone_device_ops imx_tz_ops = {
 	.unbind = imx_unbind,
 	.get_temp = imx_get_temp,
 	.change_mode = imx_change_mode,
-	.get_crit_temp = imx_get_crit_temp,
 	.set_trip_temp = imx_set_trip_temp,
 };
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/2 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.

---
V2:
- Remove extra tab inserted in the previous version

---
 drivers/thermal/imx_thermal.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/thermal/imx_thermal.c +7 -4
index 69ed482167f7..13c56e45cdbc 100644
@@ -330,26 +330,29 @@ static int imx_change_mode(struct thermal_zone_device *tz,
 	return 0;
 }
 
-static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
+static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip_id,
 			     int temp)
 {
 	struct imx_thermal_data *data = thermal_zone_device_priv(tz);
+	struct thermal_trip trip;
 	int ret;
 
 	ret = pm_runtime_resume_and_get(data->dev);
 	if (ret < 0)
 		return ret;
 
+	ret = __thermal_zone_get_trip(tz, trip_id, &trip);
+	if (ret)
+		return ret;
+
 	/* do not allow changing critical threshold */
-	if (trip == IMX_TRIP_CRITICAL)
+	if (trip.type == THERMAL_TRIP_CRITICAL)
 		return -EPERM;
 
 	/* do not allow passive to be set higher than critical */
 	if (temp < 0 || temp > trips[IMX_TRIP_CRITICAL].temperature)
 		return -EINVAL;
 
-	trips[IMX_TRIP_PASSIVE].temperature = temp;
-
 	imx_set_alarm_temp(data, temp);
 
 	pm_runtime_put(data->dev);
Signature · 1 line
2.34.1
reviewer Reviewed-by on v2 2/2
#2 lore raw

Re: [PATCH v2 2/2] thermal/drivers/imx: Use the thermal framework for the trip point

Quoted 20 lines · Daniel Lezcano

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).

Quoted 6 lines

No functional change intended.

---
V2:
- Remove extra tab inserted in the previous version

author Applied
#4 lore raw
In reply to Daniel Lezcano
Quoted 7 lines · Daniel Lezcano

The i.MX thermal sensor uses the generic trip points. The thermal framework can return the critical temperature directly.

Remove the pointless get_trip_temp ops.

---

Applied, thanks

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog