Linux Tegra architecture development
 help / color / mirror / Atom feed
* [RESEND][PATCH v1 4/8] thermal: tegra: Introduce struct trip_temps for critical and hot trips
       [not found] <2211925.irdbgypaU6@rjwysocki.net>
@ 2024-07-29 16:02 ` Rafael J. Wysocki
  2024-08-02  9:40   ` Lukasz Luba
  2024-07-29 16:05 ` [RESEND][PATCH v1 5/8] thermal: tegra: Use thermal_zone_for_each_trip() for walking trip points Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2024-07-29 16:02 UTC (permalink / raw)
  To: Linux PM
  Cc: Daniel Lezcano, LKML, Lukasz Luba, Thierry Reding,
	Jonathan Hunter, linux-tegra

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Introduce a helper structure, struct trip_temps, for storing the
temperatures of the critical and hot trip points.

This helps to make the code in tegra_tsensor_get_hw_channel_trips()
somewhat cleaner and will be useful subsequently in eliminating
iteration over trip indices from the driver.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

This patch does not depend on the previous patch(es) in the series.

---
 drivers/thermal/tegra/tegra30-tsensor.c |   34 ++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

Index: linux-pm/drivers/thermal/tegra/tegra30-tsensor.c
===================================================================
--- linux-pm.orig/drivers/thermal/tegra/tegra30-tsensor.c
+++ linux-pm/drivers/thermal/tegra/tegra30-tsensor.c
@@ -303,8 +303,13 @@ stop_channel:
 	return 0;
 }
 
+struct trip_temps {
+	int hot_trip;
+	int crit_trip;
+};
+
 static void tegra_tsensor_get_hw_channel_trips(struct thermal_zone_device *tzd,
-					       int *hot_trip, int *crit_trip)
+					       struct trip_temps *temps)
 {
 	unsigned int i;
 
@@ -312,8 +317,8 @@ static void tegra_tsensor_get_hw_channel
 	 * 90C is the maximal critical temperature of all Tegra30 SoC variants,
 	 * use it for the default trip if unspecified in a device-tree.
 	 */
-	*hot_trip  = 85000;
-	*crit_trip = 90000;
+	temps->hot_trip  = 85000;
+	temps->crit_trip = 90000;
 
 	for (i = 0; i < thermal_zone_get_num_trips(tzd); i++) {
 
@@ -322,14 +327,14 @@ static void tegra_tsensor_get_hw_channel
 		thermal_zone_get_trip(tzd, i, &trip);
 
 		if (trip.type == THERMAL_TRIP_HOT)
-			*hot_trip = trip.temperature;
+			temps->hot_trip = trip.temperature;
 
 		if (trip.type == THERMAL_TRIP_CRITICAL)
-			*crit_trip = trip.temperature;
+			temps->crit_trip = trip.temperature;
 	}
 
 	/* clamp hardware trips to the calibration limits */
-	*hot_trip = clamp(*hot_trip, 25000, 90000);
+	temps->hot_trip = clamp(temps->hot_trip, 25000, 90000);
 
 	/*
 	 * Kernel will perform a normal system shut down if it will
@@ -338,7 +343,7 @@ static void tegra_tsensor_get_hw_channel
 	 * shut down gracefully before sending signal to the Power
 	 * Management controller.
 	 */
-	*crit_trip = clamp(*crit_trip + 5000, 25000, 90000);
+	temps->crit_trip = clamp(temps->crit_trip + 5000, 25000, 90000);
 }
 
 static int tegra_tsensor_enable_hw_channel(const struct tegra_tsensor *ts,
@@ -346,7 +351,8 @@ static int tegra_tsensor_enable_hw_chann
 {
 	const struct tegra_tsensor_channel *tsc = &ts->ch[id];
 	struct thermal_zone_device *tzd = tsc->tzd;
-	int err, hot_trip = 0, crit_trip = 0;
+	struct trip_temps temps = { 0 };
+	int err;
 	u32 val;
 
 	if (!tzd) {
@@ -357,24 +363,24 @@ static int tegra_tsensor_enable_hw_chann
 		return 0;
 	}
 
-	tegra_tsensor_get_hw_channel_trips(tzd, &hot_trip, &crit_trip);
+	tegra_tsensor_get_hw_channel_trips(tzd, &temps);
 
 	dev_info_once(ts->dev, "ch%u: PMC emergency shutdown trip set to %dC\n",
-		      id, DIV_ROUND_CLOSEST(crit_trip, 1000));
+		      id, DIV_ROUND_CLOSEST(temps.crit_trip, 1000));
 
-	hot_trip  = tegra_tsensor_temp_to_counter(ts, hot_trip);
-	crit_trip = tegra_tsensor_temp_to_counter(ts, crit_trip);
+	temps.hot_trip  = tegra_tsensor_temp_to_counter(ts, temps.hot_trip);
+	temps.crit_trip = tegra_tsensor_temp_to_counter(ts, temps.crit_trip);
 
 	/* program LEVEL2 counter threshold */
 	val = readl_relaxed(tsc->regs + TSENSOR_SENSOR0_CONFIG1);
 	val &= ~TSENSOR_SENSOR0_CONFIG1_TH2;
-	val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG1_TH2, hot_trip);
+	val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG1_TH2, temps.hot_trip);
 	writel_relaxed(val, tsc->regs + TSENSOR_SENSOR0_CONFIG1);
 
 	/* program LEVEL3 counter threshold */
 	val = readl_relaxed(tsc->regs + TSENSOR_SENSOR0_CONFIG2);
 	val &= ~TSENSOR_SENSOR0_CONFIG2_TH3;
-	val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG2_TH3, crit_trip);
+	val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG2_TH3, temps.crit_trip);
 	writel_relaxed(val, tsc->regs + TSENSOR_SENSOR0_CONFIG2);
 
 	/*




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RESEND][PATCH v1 5/8] thermal: tegra: Use thermal_zone_for_each_trip() for walking trip points
       [not found] <2211925.irdbgypaU6@rjwysocki.net>
  2024-07-29 16:02 ` [RESEND][PATCH v1 4/8] thermal: tegra: Introduce struct trip_temps for critical and hot trips Rafael J. Wysocki
@ 2024-07-29 16:05 ` Rafael J. Wysocki
  2024-08-02  9:47   ` Lukasz Luba
  1 sibling, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2024-07-29 16:05 UTC (permalink / raw)
  To: Linux PM
  Cc: Daniel Lezcano, LKML, Lukasz Luba, Thierry Reding,
	Jonathan Hunter, linux-tegra

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

It is generally inefficient to iterate over trip indices and call
thermal_zone_get_trip() every time to get the struct thermal_trip
corresponding to the given trip index, so modify the Tegra thermal
drivers to use thermal_zone_for_each_trip() for walking trips.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

This patch does not depend on patches [1-3/8].

---
 drivers/thermal/tegra/soctherm.c        |   38 ++++++++++++++++----------------
 drivers/thermal/tegra/tegra30-tsensor.c |   25 ++++++++++-----------
 2 files changed, 33 insertions(+), 30 deletions(-)

Index: linux-pm/drivers/thermal/tegra/soctherm.c
===================================================================
--- linux-pm.orig/drivers/thermal/tegra/soctherm.c
+++ linux-pm/drivers/thermal/tegra/soctherm.c
@@ -682,24 +682,25 @@ static const struct thermal_zone_device_
 	.set_trips = tegra_thermctl_set_trips,
 };
 
-static int get_hot_temp(struct thermal_zone_device *tz, int *trip_id, int *temp)
+static int get_hot_trip_cb(struct thermal_trip *trip, void *arg)
 {
-	int i, ret;
-	struct thermal_trip trip;
+	const struct thermal_trip **trip_ret = arg;
 
-	for (i = 0; i < thermal_zone_get_num_trips(tz); i++) {
+	if (trip->type != THERMAL_TRIP_HOT)
+		return 0;
 
-		ret = thermal_zone_get_trip(tz, i, &trip);
-		if (ret)
-			return -EINVAL;
-
-		if (trip.type == THERMAL_TRIP_HOT) {
-			*trip_id = i;
-			return 0;
-		}
-	}
+	*trip_ret = trip;
+	/* Return nonzero to terminate the search. */
+	return 1;
+}
 
-	return -EINVAL;
+static const struct thermal_trip *get_hot_trip(struct thermal_zone_device *tz)
+{
+	const struct thermal_trip *trip = NULL;
+
+	thermal_zone_for_each_trip(tz, get_hot_trip_cb, &trip);
+
+	return trip;
 }
 
 /**
@@ -731,8 +732,9 @@ static int tegra_soctherm_set_hwtrips(st
 				      struct thermal_zone_device *tz)
 {
 	struct tegra_soctherm *ts = dev_get_drvdata(dev);
+	const struct thermal_trip *hot_trip;
 	struct soctherm_throt_cfg *stc;
-	int i, trip, temperature, ret;
+	int i, temperature, ret;
 
 	/* Get thermtrips. If missing, try to get critical trips. */
 	temperature = tsensor_group_thermtrip_get(ts, sg->id);
@@ -749,8 +751,8 @@ static int tegra_soctherm_set_hwtrips(st
 	dev_info(dev, "thermtrip: will shut down when %s reaches %d mC\n",
 		 sg->name, temperature);
 
-	ret = get_hot_temp(tz, &trip, &temperature);
-	if (ret) {
+	hot_trip = get_hot_trip(tz);
+	if (!hot_trip) {
 		dev_info(dev, "throttrip: %s: missing hot temperature\n",
 			 sg->name);
 		return 0;
@@ -763,7 +765,7 @@ static int tegra_soctherm_set_hwtrips(st
 			continue;
 
 		cdev = ts->throt_cfgs[i].cdev;
-		if (get_thermal_instance(tz, cdev, trip))
+		if (thermal_trip_is_bound_to_cdev(tz, hot_trip, cdev))
 			stc = find_throttle_cfg_by_name(ts, cdev->type);
 		else
 			continue;
Index: linux-pm/drivers/thermal/tegra/tegra30-tsensor.c
===================================================================
--- linux-pm.orig/drivers/thermal/tegra/tegra30-tsensor.c
+++ linux-pm/drivers/thermal/tegra/tegra30-tsensor.c
@@ -308,6 +308,18 @@ struct trip_temps {
 	int crit_trip;
 };
 
+static int tegra_tsensor_get_trips_cb(struct thermal_trip *trip, void *arg)
+{
+	struct trip_temps *temps = arg;
+
+	if (trip->type == THERMAL_TRIP_HOT)
+		temps->hot_trip = trip->temperature;
+	else if (trip->type == THERMAL_TRIP_CRITICAL)
+		temps->crit_trip = trip->temperature;
+
+	return 0;
+}
+
 static void tegra_tsensor_get_hw_channel_trips(struct thermal_zone_device *tzd,
 					       struct trip_temps *temps)
 {
@@ -320,18 +332,7 @@ static void tegra_tsensor_get_hw_channel
 	temps->hot_trip  = 85000;
 	temps->crit_trip = 90000;
 
-	for (i = 0; i < thermal_zone_get_num_trips(tzd); i++) {
-
-		struct thermal_trip trip;
-
-		thermal_zone_get_trip(tzd, i, &trip);
-
-		if (trip.type == THERMAL_TRIP_HOT)
-			temps->hot_trip = trip.temperature;
-
-		if (trip.type == THERMAL_TRIP_CRITICAL)
-			temps->crit_trip = trip.temperature;
-	}
+	thermal_zone_for_each_trip(tzd, tegra_tsensor_get_trips_cb, temps);
 
 	/* clamp hardware trips to the calibration limits */
 	temps->hot_trip = clamp(temps->hot_trip, 25000, 90000);




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESEND][PATCH v1 4/8] thermal: tegra: Introduce struct trip_temps for critical and hot trips
  2024-07-29 16:02 ` [RESEND][PATCH v1 4/8] thermal: tegra: Introduce struct trip_temps for critical and hot trips Rafael J. Wysocki
@ 2024-08-02  9:40   ` Lukasz Luba
  0 siblings, 0 replies; 4+ messages in thread
From: Lukasz Luba @ 2024-08-02  9:40 UTC (permalink / raw)
  To: Rafael J. Wysocki, Linux PM
  Cc: Daniel Lezcano, LKML, Thierry Reding, Jonathan Hunter,
	linux-tegra



On 7/29/24 17:02, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Introduce a helper structure, struct trip_temps, for storing the
> temperatures of the critical and hot trip points.
> 
> This helps to make the code in tegra_tsensor_get_hw_channel_trips()
> somewhat cleaner and will be useful subsequently in eliminating
> iteration over trip indices from the driver.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> This patch does not depend on the previous patch(es) in the series.
> 
> ---
>   drivers/thermal/tegra/tegra30-tsensor.c |   34 ++++++++++++++++++--------------
>   1 file changed, 20 insertions(+), 14 deletions(-)
> 
> Index: linux-pm/drivers/thermal/tegra/tegra30-tsensor.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/tegra/tegra30-tsensor.c
> +++ linux-pm/drivers/thermal/tegra/tegra30-tsensor.c
> @@ -303,8 +303,13 @@ stop_channel:
>   	return 0;
>   }
>   
> +struct trip_temps {
> +	int hot_trip;
> +	int crit_trip;
> +};
> +
>   static void tegra_tsensor_get_hw_channel_trips(struct thermal_zone_device *tzd,
> -					       int *hot_trip, int *crit_trip)
> +					       struct trip_temps *temps)
>   {
>   	unsigned int i;
>   
> @@ -312,8 +317,8 @@ static void tegra_tsensor_get_hw_channel
>   	 * 90C is the maximal critical temperature of all Tegra30 SoC variants,
>   	 * use it for the default trip if unspecified in a device-tree.
>   	 */
> -	*hot_trip  = 85000;
> -	*crit_trip = 90000;
> +	temps->hot_trip  = 85000;
> +	temps->crit_trip = 90000;
>   
>   	for (i = 0; i < thermal_zone_get_num_trips(tzd); i++) {
>   
> @@ -322,14 +327,14 @@ static void tegra_tsensor_get_hw_channel
>   		thermal_zone_get_trip(tzd, i, &trip);
>   
>   		if (trip.type == THERMAL_TRIP_HOT)
> -			*hot_trip = trip.temperature;
> +			temps->hot_trip = trip.temperature;
>   
>   		if (trip.type == THERMAL_TRIP_CRITICAL)
> -			*crit_trip = trip.temperature;
> +			temps->crit_trip = trip.temperature;
>   	}
>   
>   	/* clamp hardware trips to the calibration limits */
> -	*hot_trip = clamp(*hot_trip, 25000, 90000);
> +	temps->hot_trip = clamp(temps->hot_trip, 25000, 90000);
>   
>   	/*
>   	 * Kernel will perform a normal system shut down if it will
> @@ -338,7 +343,7 @@ static void tegra_tsensor_get_hw_channel
>   	 * shut down gracefully before sending signal to the Power
>   	 * Management controller.
>   	 */
> -	*crit_trip = clamp(*crit_trip + 5000, 25000, 90000);
> +	temps->crit_trip = clamp(temps->crit_trip + 5000, 25000, 90000);
>   }
>   
>   static int tegra_tsensor_enable_hw_channel(const struct tegra_tsensor *ts,
> @@ -346,7 +351,8 @@ static int tegra_tsensor_enable_hw_chann
>   {
>   	const struct tegra_tsensor_channel *tsc = &ts->ch[id];
>   	struct thermal_zone_device *tzd = tsc->tzd;
> -	int err, hot_trip = 0, crit_trip = 0;
> +	struct trip_temps temps = { 0 };
> +	int err;
>   	u32 val;
>   
>   	if (!tzd) {
> @@ -357,24 +363,24 @@ static int tegra_tsensor_enable_hw_chann
>   		return 0;
>   	}
>   
> -	tegra_tsensor_get_hw_channel_trips(tzd, &hot_trip, &crit_trip);
> +	tegra_tsensor_get_hw_channel_trips(tzd, &temps);
>   
>   	dev_info_once(ts->dev, "ch%u: PMC emergency shutdown trip set to %dC\n",
> -		      id, DIV_ROUND_CLOSEST(crit_trip, 1000));
> +		      id, DIV_ROUND_CLOSEST(temps.crit_trip, 1000));
>   
> -	hot_trip  = tegra_tsensor_temp_to_counter(ts, hot_trip);
> -	crit_trip = tegra_tsensor_temp_to_counter(ts, crit_trip);
> +	temps.hot_trip  = tegra_tsensor_temp_to_counter(ts, temps.hot_trip);
> +	temps.crit_trip = tegra_tsensor_temp_to_counter(ts, temps.crit_trip);
>   
>   	/* program LEVEL2 counter threshold */
>   	val = readl_relaxed(tsc->regs + TSENSOR_SENSOR0_CONFIG1);
>   	val &= ~TSENSOR_SENSOR0_CONFIG1_TH2;
> -	val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG1_TH2, hot_trip);
> +	val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG1_TH2, temps.hot_trip);
>   	writel_relaxed(val, tsc->regs + TSENSOR_SENSOR0_CONFIG1);
>   
>   	/* program LEVEL3 counter threshold */
>   	val = readl_relaxed(tsc->regs + TSENSOR_SENSOR0_CONFIG2);
>   	val &= ~TSENSOR_SENSOR0_CONFIG2_TH3;
> -	val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG2_TH3, crit_trip);
> +	val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG2_TH3, temps.crit_trip);
>   	writel_relaxed(val, tsc->regs + TSENSOR_SENSOR0_CONFIG2);
>   
>   	/*
> 
> 
> 

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESEND][PATCH v1 5/8] thermal: tegra: Use thermal_zone_for_each_trip() for walking trip points
  2024-07-29 16:05 ` [RESEND][PATCH v1 5/8] thermal: tegra: Use thermal_zone_for_each_trip() for walking trip points Rafael J. Wysocki
@ 2024-08-02  9:47   ` Lukasz Luba
  0 siblings, 0 replies; 4+ messages in thread
From: Lukasz Luba @ 2024-08-02  9:47 UTC (permalink / raw)
  To: Rafael J. Wysocki, Linux PM
  Cc: Daniel Lezcano, LKML, Thierry Reding, Jonathan Hunter,
	linux-tegra



On 7/29/24 17:05, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> It is generally inefficient to iterate over trip indices and call
> thermal_zone_get_trip() every time to get the struct thermal_trip
> corresponding to the given trip index, so modify the Tegra thermal
> drivers to use thermal_zone_for_each_trip() for walking trips.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> This patch does not depend on patches [1-3/8].
> 
> ---
>   drivers/thermal/tegra/soctherm.c        |   38 ++++++++++++++++----------------
>   drivers/thermal/tegra/tegra30-tsensor.c |   25 ++++++++++-----------
>   2 files changed, 33 insertions(+), 30 deletions(-)
> 
> Index: linux-pm/drivers/thermal/tegra/soctherm.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/tegra/soctherm.c
> +++ linux-pm/drivers/thermal/tegra/soctherm.c
> @@ -682,24 +682,25 @@ static const struct thermal_zone_device_
>   	.set_trips = tegra_thermctl_set_trips,
>   };
>   
> -static int get_hot_temp(struct thermal_zone_device *tz, int *trip_id, int *temp)
> +static int get_hot_trip_cb(struct thermal_trip *trip, void *arg)
>   {
> -	int i, ret;
> -	struct thermal_trip trip;
> +	const struct thermal_trip **trip_ret = arg;
>   
> -	for (i = 0; i < thermal_zone_get_num_trips(tz); i++) {
> +	if (trip->type != THERMAL_TRIP_HOT)
> +		return 0;
>   
> -		ret = thermal_zone_get_trip(tz, i, &trip);
> -		if (ret)
> -			return -EINVAL;
> -
> -		if (trip.type == THERMAL_TRIP_HOT) {
> -			*trip_id = i;
> -			return 0;
> -		}
> -	}
> +	*trip_ret = trip;
> +	/* Return nonzero to terminate the search. */
> +	return 1;
> +}
>   
> -	return -EINVAL;
> +static const struct thermal_trip *get_hot_trip(struct thermal_zone_device *tz)
> +{
> +	const struct thermal_trip *trip = NULL;
> +
> +	thermal_zone_for_each_trip(tz, get_hot_trip_cb, &trip);
> +
> +	return trip;
>   }
>   
>   /**
> @@ -731,8 +732,9 @@ static int tegra_soctherm_set_hwtrips(st
>   				      struct thermal_zone_device *tz)
>   {
>   	struct tegra_soctherm *ts = dev_get_drvdata(dev);
> +	const struct thermal_trip *hot_trip;
>   	struct soctherm_throt_cfg *stc;
> -	int i, trip, temperature, ret;
> +	int i, temperature, ret;
>   
>   	/* Get thermtrips. If missing, try to get critical trips. */
>   	temperature = tsensor_group_thermtrip_get(ts, sg->id);
> @@ -749,8 +751,8 @@ static int tegra_soctherm_set_hwtrips(st
>   	dev_info(dev, "thermtrip: will shut down when %s reaches %d mC\n",
>   		 sg->name, temperature);
>   
> -	ret = get_hot_temp(tz, &trip, &temperature);
> -	if (ret) {
> +	hot_trip = get_hot_trip(tz);
> +	if (!hot_trip) {
>   		dev_info(dev, "throttrip: %s: missing hot temperature\n",
>   			 sg->name);
>   		return 0;
> @@ -763,7 +765,7 @@ static int tegra_soctherm_set_hwtrips(st
>   			continue;
>   
>   		cdev = ts->throt_cfgs[i].cdev;
> -		if (get_thermal_instance(tz, cdev, trip))
> +		if (thermal_trip_is_bound_to_cdev(tz, hot_trip, cdev))
>   			stc = find_throttle_cfg_by_name(ts, cdev->type);
>   		else
>   			continue;
> Index: linux-pm/drivers/thermal/tegra/tegra30-tsensor.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/tegra/tegra30-tsensor.c
> +++ linux-pm/drivers/thermal/tegra/tegra30-tsensor.c
> @@ -308,6 +308,18 @@ struct trip_temps {
>   	int crit_trip;
>   };
>   
> +static int tegra_tsensor_get_trips_cb(struct thermal_trip *trip, void *arg)
> +{
> +	struct trip_temps *temps = arg;
> +
> +	if (trip->type == THERMAL_TRIP_HOT)
> +		temps->hot_trip = trip->temperature;
> +	else if (trip->type == THERMAL_TRIP_CRITICAL)
> +		temps->crit_trip = trip->temperature;
> +
> +	return 0;
> +}
> +
>   static void tegra_tsensor_get_hw_channel_trips(struct thermal_zone_device *tzd,
>   					       struct trip_temps *temps)
>   {
> @@ -320,18 +332,7 @@ static void tegra_tsensor_get_hw_channel
>   	temps->hot_trip  = 85000;
>   	temps->crit_trip = 90000;
>   
> -	for (i = 0; i < thermal_zone_get_num_trips(tzd); i++) {
> -
> -		struct thermal_trip trip;
> -
> -		thermal_zone_get_trip(tzd, i, &trip);
> -
> -		if (trip.type == THERMAL_TRIP_HOT)
> -			temps->hot_trip = trip.temperature;
> -
> -		if (trip.type == THERMAL_TRIP_CRITICAL)
> -			temps->crit_trip = trip.temperature;
> -	}
> +	thermal_zone_for_each_trip(tzd, tegra_tsensor_get_trips_cb, temps);
>   
>   	/* clamp hardware trips to the calibration limits */
>   	temps->hot_trip = clamp(temps->hot_trip, 25000, 90000);
> 
> 
> 

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-02  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <2211925.irdbgypaU6@rjwysocki.net>
2024-07-29 16:02 ` [RESEND][PATCH v1 4/8] thermal: tegra: Introduce struct trip_temps for critical and hot trips Rafael J. Wysocki
2024-08-02  9:40   ` Lukasz Luba
2024-07-29 16:05 ` [RESEND][PATCH v1 5/8] thermal: tegra: Use thermal_zone_for_each_trip() for walking trip points Rafael J. Wysocki
2024-08-02  9:47   ` Lukasz Luba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox