* [PATCH v1 08/14] thermal: qcom: Use thermal_zone_get_crit_temp() in qpnp_tm_init()
[not found] <8409966.T7Z3S40VBb@kreacher>
@ 2024-06-17 18:00 ` Rafael J. Wysocki
0 siblings, 0 replies; only message in thread
From: Rafael J. Wysocki @ 2024-06-17 18:00 UTC (permalink / raw)
To: Linux PM
Cc: LKML, Rafael J. Wysocki, Lukasz Luba, Daniel Lezcano,
Thara Gopinath, linux-arm-msm
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Modify qpnp_tm_init() to use thermal_zone_get_crit_temp() to get the
critical trip temperature instead of iterating over trip indices and
using thermal_zone_get_trip() to get from a trip index to struct
thermal_trip until it finds the critical one.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 22 +++-------------------
1 file changed, 3 insertions(+), 19 deletions(-)
Index: linux-pm/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
===================================================================
--- linux-pm.orig/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
+++ linux-pm/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
@@ -291,24 +291,6 @@ static irqreturn_t qpnp_tm_isr(int irq,
return IRQ_HANDLED;
}
-static int qpnp_tm_get_critical_trip_temp(struct qpnp_tm_chip *chip)
-{
- struct thermal_trip trip;
- int i, ret;
-
- for (i = 0; i < thermal_zone_get_num_trips(chip->tz_dev); i++) {
-
- ret = thermal_zone_get_trip(chip->tz_dev, i, &trip);
- if (ret)
- continue;
-
- if (trip.type == THERMAL_TRIP_CRITICAL)
- return trip.temperature;
- }
-
- return THERMAL_TEMP_INVALID;
-}
-
/*
* This function initializes the internal temp value based on only the
* current thermal stage and threshold. Setup threshold control and
@@ -343,7 +325,9 @@ static int qpnp_tm_init(struct qpnp_tm_c
mutex_unlock(&chip->lock);
- crit_temp = qpnp_tm_get_critical_trip_temp(chip);
+ ret = thermal_zone_get_crit_temp(chip->tz_dev, &crit_temp);
+ if (ret)
+ crit_temp = THERMAL_TEMP_INVALID;
mutex_lock(&chip->lock);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-06-17 18:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <8409966.T7Z3S40VBb@kreacher>
2024-06-17 18:00 ` [PATCH v1 08/14] thermal: qcom: Use thermal_zone_get_crit_temp() in qpnp_tm_init() Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox