Linux Power Management development
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: daniel.lezcano@linaro.org, rafael@kernel.org
Cc: linux-pm@vger.kernel.org, lukasz.luba@arm.com, quic_manafm@quicinc.com
Subject: [PATCH v2 3/7] thermal/core: Connect the threshold with the core
Date: Fri, 16 Aug 2024 10:12:34 +0200	[thread overview]
Message-ID: <20240816081241.1925221-4-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <20240816081241.1925221-1-daniel.lezcano@linaro.org>

Initialize, de-initialize and handle the threshold in the same place
than the trip points.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/thermal_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 166f48071487..0a4d7f6e5cf5 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -591,6 +591,8 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
 			high = td->threshold;
 	}
 
+	thermal_thresholds_handle(tz, &low, &high);
+
 	thermal_zone_set_trips(tz, low, high);
 
 	list_sort(NULL, &way_up_list, thermal_trip_notify_cmp);
@@ -1561,6 +1563,10 @@ thermal_zone_device_register_with_trips(const char *type,
 			goto unregister;
 	}
 
+	result = thermal_thresholds_init(tz);
+	if (result)
+		goto remove_hwmon;
+
 	mutex_lock(&thermal_list_lock);
 	mutex_lock(&tz->lock);
 	list_add_tail(&tz->node, &thermal_tz_list);
@@ -1581,6 +1587,8 @@ thermal_zone_device_register_with_trips(const char *type,
 
 	return tz;
 
+remove_hwmon:
+	thermal_remove_hwmon_sysfs(tz);
 unregister:
 	device_del(&tz->device);
 release_device:
@@ -1669,6 +1677,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
 
 	thermal_set_governor(tz, NULL);
 
+	thermal_thresholds_exit(tz);
 	thermal_remove_hwmon_sysfs(tz);
 	ida_free(&thermal_tz_ida, tz->id);
 	ida_destroy(&tz->ida);
-- 
2.43.0


  parent reply	other threads:[~2024-08-16  8:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-16  8:12 [PATCH v2 0/7] Add thermal thresholds support Daniel Lezcano
2024-08-16  8:12 ` [PATCH v2 1/7] thermal/core: Compute low and high boundaries in thermal_zone_device_update() Daniel Lezcano
2024-08-16 11:34   ` Rafael J. Wysocki
2024-08-16 12:06     ` Daniel Lezcano
2024-08-19 14:07       ` Rafael J. Wysocki
2024-08-16  8:12 ` [PATCH v2 2/7] thermal/core: Add thresholds support Daniel Lezcano
2024-08-21 20:05   ` Rafael J. Wysocki
2024-08-22 11:30     ` Rafael J. Wysocki
2024-09-04  8:43       ` Daniel Lezcano
2024-08-22 17:20     ` Daniel Lezcano
2024-08-22 20:09       ` Rafael J. Wysocki
2024-08-16  8:12 ` Daniel Lezcano [this message]
2024-08-16  8:12 ` [PATCH v2 4/7] thermal/netlink: Add the commands and the events for the thresholds Daniel Lezcano
2024-08-16  8:12 ` [PATCH v2 5/7] tools/lib/thermal: Make more generic the command encoding function Daniel Lezcano
2024-08-16  8:12 ` [PATCH v2 6/7] tools/lib/thermal: Add the threshold netlink ABI Daniel Lezcano
2024-08-16  8:12 ` [PATCH v2 7/7] tools/thermal/thermal-engine: Take into account the thresholds API Daniel Lezcano
2024-08-21 19:06 ` [PATCH v2 0/7] Add thermal thresholds support Rafael J. Wysocki
2024-08-21 20:04 ` Pandruvada, Srinivas
2024-08-21 20:20   ` Rafael J. Wysocki
2024-08-21 22:16     ` Pandruvada, Srinivas
2024-08-22  9:41       ` Rafael J. Wysocki
2024-08-22 12:11         ` Pandruvada, Srinivas
2024-08-22 12:52           ` Pandruvada, Srinivas
2024-08-22 13:01             ` Rafael J. Wysocki
2024-08-22 17:08           ` Daniel Lezcano
2024-08-22 18:12             ` Pandruvada, Srinivas
2024-08-22 16:51   ` Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240816081241.1925221-4-daniel.lezcano@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=quic_manafm@quicinc.com \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox