Re: [PATCH v1 23/26] thermal/drivers/acerhdf: Use generic thermal_zone_get_trip() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

some comments.  Please merge if those are considered.  Thanks.


On 05.08.22 16:57, Daniel Lezcano wrote:
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@xxxxxxxxxx>

Acked-by: Peter Kästle <peter@xxxxxxxx>

---
  drivers/platform/x86/acerhdf.c | 73 ++++++++++++----------------------
  1 file changed, 26 insertions(+), 47 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 3463629f8764..cf757f3a1e6b 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c

[...]

@@ -137,6 +139,15 @@ struct ctrl_settings {
  	int mcmd_enable;
  };
+static struct thermal_trip trips[] = {
+	[0] = { .temperature = ACERHDF_DEFAULT_TEMP_FANON,
+		.hysteresis = ACERHDF_DEFAULT_TEMP_FANON - ACERHDF_DEFAULT_TEMP_FANOFF,
+		.type = THERMAL_TRIP_ACTIVE },
+
+	[1] = { .temperature = ACERHDF_TEMP_CRIT,
+		.type = THERMAL_TRIP_CRITICAL }
+};
+
  static struct ctrl_settings ctrl_cfg __read_mostly;
/* Register addresses and values for different BIOS versions */
@@ -326,6 +337,15 @@ static void acerhdf_check_param(struct thermal_zone_device *thermal)
  		fanon = ACERHDF_MAX_FANON;
  	}
+ if (fanon < fanoff) {
+		pr_err("fanoff temperature (%d) is above fanon temperature (%d), clamping to %d\n",
+		       fanoff, fanon, fanon);
+		fanoff = fanon;
+	};
+	

Tab whitespace, please remove.

+	trips[0].temperature = fanon;
+	trips[0].hysteresis  = fanon - fanoff;
+	

Tab whitespace, please remove

  	if (kernelmode && prev_interval != interval) {
  		if (interval > ACERHDF_MAX_INTERVAL) {
  			pr_err("interval too high, set to %d\n",

I don't know the current behavior of the thermal layer well enough.
Is it ensured, that those new trips[0].temperature / trips[0].hysteresis values are taken into account?


--
best regards,
--peter;



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux