Merge tag 'thermal-6.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 29 Mar 2024 18:50:38 +0000 (11:50 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 29 Mar 2024 18:50:38 +0000 (11:50 -0700)
Pull thermal control fixes from Rafael Wysocki:
 "These revert a problematic optimization commit and address a devfreq
  cooling device issue.

  Specifics:

   - Revert thermal core optimization that introduced a functional issue
     causing a critical trip point to be crossed in some cases (Daniel
     Lezcano)

   - Add missing conversion between different state ranges to the
     devfreq cooling device driver (Ye Zhang)"

* tag 'thermal-6.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  thermal: devfreq_cooling: Fix perf state when calculate dfc res_util
  Revert "thermal: core: Don't update trip points inside the hysteresis range"

drivers/thermal/devfreq_cooling.c
drivers/thermal/thermal_trip.c

index 50dec24e967a00deddcb77ecf9709ab22c486d62..8fd7cf1932cd44fd7abdbfed80ffee25f574c842 100644 (file)
@@ -214,7 +214,7 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd
 
                res = dfc->power_ops->get_real_power(df, power, freq, voltage);
                if (!res) {
-                       state = dfc->capped_state;
+                       state = dfc->max_state - dfc->capped_state;
 
                        /* Convert EM power into milli-Watts first */
                        rcu_read_lock();
index 09f6050dd04161f2ef5697cf197b771291859079..497abf0d47cac59bbb09db7d40f680cfcffbfe1e 100644 (file)
@@ -65,7 +65,6 @@ void __thermal_zone_set_trips(struct thermal_zone_device *tz)
 {
        const struct thermal_trip *trip;
        int low = -INT_MAX, high = INT_MAX;
-       bool same_trip = false;
        int ret;
 
        lockdep_assert_held(&tz->lock);
@@ -74,36 +73,22 @@ void __thermal_zone_set_trips(struct thermal_zone_device *tz)
                return;
 
        for_each_trip(tz, trip) {
-               bool low_set = false;
                int trip_low;
 
                trip_low = trip->temperature - trip->hysteresis;
 
-               if (trip_low < tz->temperature && trip_low > low) {
+               if (trip_low < tz->temperature && trip_low > low)
                        low = trip_low;
-                       low_set = true;
-                       same_trip = false;
-               }
 
                if (trip->temperature > tz->temperature &&
-                   trip->temperature < high) {
+                   trip->temperature < high)
                        high = trip->temperature;
-                       same_trip = low_set;
-               }
        }
 
        /* No need to change trip points */
        if (tz->prev_low_trip == low && tz->prev_high_trip == high)
                return;
 
-       /*
-        * If "high" and "low" are the same, skip the change unless this is the
-        * first time.
-        */
-       if (same_trip && (tz->prev_low_trip != -INT_MAX ||
-           tz->prev_high_trip != INT_MAX))
-               return;
-
        tz->prev_low_trip = low;
        tz->prev_high_trip = high;