public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: manafm@codeaurora.org
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	Zhang Rui <rui.zhang@intel.com>, Amit Kucheria <amitk@kernel.org>,
	Thara Gopinath <thara.gopinath@linaro.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers: thermal: Reset previous low and high trip during thermal zone init
Date: Fri, 05 Nov 2021 23:16:49 +0530	[thread overview]
Message-ID: <efb9e319537b888c8848bc67dc552c6b@codeaurora.org> (raw)
In-Reply-To: <CAJZ5v0g-N0WOASc7RzFpSYC+Y8nFdiw6DmPHcYr5Y7HQeCetkA@mail.gmail.com>

On 2021-11-05 20:52, Rafael J. Wysocki wrote:
> On Tue, Nov 2, 2021 at 9:01 PM Manaf Meethalavalappu Pallikunhi
> <manafm@codeaurora.org> wrote:
>> 
>> During the suspend is in process, thermal_zone_device_update bails out
>> thermal zone re-evaluation for any sensor trip violation without
>> setting next valid trip to that sensor. It assumes during resume
>> it will re-evaluate same thermal zone and update trip. But when it is
>> in suspend temperature goes down and on resume path while updating
>> thermal zone if temperature is less than previously violated trip,
>> thermal zone set trip function evaluates the same previous high and
>> previous low trip as new high and low trip. Since there is no change
>> in high/low trip, it bails out from thermal zone set trip API without
>> setting any trip. It leads to a case where sensor high trip or low
>> trip is disabled forever even though thermal zone has a valid high
>> or low trip.
>> 
>> During thermal zone device init, reset thermal zone previous high
>> and low trip. It resolves above mentioned scenario.
> 
> Makes sense to me.
> 
> Daniel?
> 
>> Signed-off-by: Manaf Meethalavalappu Pallikunhi 
>> <manafm@codeaurora.org>
>> ---
>>  drivers/thermal/thermal_core.c | 2 ++
>>  1 file changed, 2 insertions(+)
>> 
>> diff --git a/drivers/thermal/thermal_core.c 
>> b/drivers/thermal/thermal_core.c
>> index 21db445..2b7a0b4 100644
>> --- a/drivers/thermal/thermal_core.c
>> +++ b/drivers/thermal/thermal_core.c
>> @@ -477,6 +477,8 @@ static void thermal_zone_device_init(struct 
>> thermal_zone_device *tz)
>>  {
>>         struct thermal_instance *pos;
>>         tz->temperature = THERMAL_TEMP_INVALID;
>> +       tz->prev_low_trip = -INT_MAX;
> 
> Why not use INT_MIN instead?
> 
The thermal_zone_set_trips API uses -INT_MAX as default low trip to 
start trip aggregation. I used the same default values here as well.

>> +       tz->prev_high_trip = INT_MAX;
>>         list_for_each_entry(pos, &tz->thermal_instances, tz_node)
>>                 pos->initialized = false;
>>  }
>> --

  reply	other threads:[~2021-11-05 17:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 20:00 [PATCH] drivers: thermal: Reset previous low and high trip during thermal zone init Manaf Meethalavalappu Pallikunhi
2021-11-05  9:46 ` manafm
2021-11-05 15:22 ` Rafael J. Wysocki
2021-11-05 17:46   ` manafm [this message]
2021-11-05 18:48 ` Thara Gopinath
2021-11-16 19:31   ` Rafael J. Wysocki

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=efb9e319537b888c8848bc67dc552c6b@codeaurora.org \
    --to=manafm@codeaurora.org \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=thara.gopinath@linaro.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