Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2675833pxb; Fri, 5 Nov 2021 02:47:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDpNWpweDPcGWsJzX76f7NgmtUb5c4dEj5gp8gVYUrh618Bavyfxp//0wZ1WZKwjcpaiSO X-Received: by 2002:a92:d8ca:: with SMTP id l10mr37012972ilo.218.1636105659614; Fri, 05 Nov 2021 02:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636105659; cv=none; d=google.com; s=arc-20160816; b=v7Qg0LmrXLZAtrkc0EVcZwcSzDLWGALiXwE5NmgSYN84EdRPP2vjhO/n/t2/ea3Xka jUfxePY+b7r4NwRtyUFNItso/GINq3e2VWtkOBu55U66OgryK1s1S0Fp99thHspg0vRu 574jo8JeFH+/CzZ/00nSysL5jHjpsM2B7oek8/2wsj7QKW/mQo5W7mcWQ5YZddQMvsn6 v5Dov0tS3HEpQJm/N9A4WgWP88kvsRqWrMP0UY8CU7wLQmUteZHIExoibvJfH+oB8gP7 tgOR6NXOBs24yl4Uu/3CWh7Exdu1zjhJ4v0D6Mim+qenmQmNO444ehwVX7a3lZmnuFRv YtYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=R+UMD8HkfHT9XgKs6EYLYkwkLi3PZwCEgoFSlEbrpcM=; b=WPrbMG3xFOjY3PYVIqsIPIrJnN1/7SrzenEb14FI2FTsALnFjOZ60sUbHpsup3e1J1 RJrkRFqrMPdt0zutS2FekUyPVLe82XHEfqt03/YEu9T3moQGmB7WsDnjs9mF4GZJrnc3 fYNsCpbmDfXU8nLampc70sXRiFu/DB0gs4ylOyek8WJPQ9Yo5i8C9GWk/as+siRVxx1g jG5HTdW8rVBZH8ugN5woih4205z2Qn78ZfvpDFNS4xcx6dnbyD9aqixMpeRlpweKXbMu sutEoOqB8Zp2SwHjsRxJAaDZIh/2yH4f2ruLg8Fu1Ho8LuhCRfbtwotiXzq9lBcfKl5R efYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=b7pkkPkv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si16040987iow.41.2021.11.05.02.47.26; Fri, 05 Nov 2021 02:47:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=b7pkkPkv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232715AbhKEJtB (ORCPT + 99 others); Fri, 5 Nov 2021 05:49:01 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:15109 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbhKEJs7 (ORCPT ); Fri, 5 Nov 2021 05:48:59 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1636105579; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=R+UMD8HkfHT9XgKs6EYLYkwkLi3PZwCEgoFSlEbrpcM=; b=b7pkkPkvlp85cKKwEJzAptBfLLx2uZ4qlXo/Xjn6JhUagRbGzas46UxWfPRpCTeevqz3fe3u wC8SHKXFQ+rV+XKDn7iyAfbWpwPQccfjFxpEPJVnLcNbf/ezVMoHGhcRgK1DDda6dqajGU5a 1y5ZJvL/+q4agK2Q97+iIaUGMQc= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-west-2.postgun.com with SMTP id 6184fd6b4d8c23a9d2d10604 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 05 Nov 2021 09:46:19 GMT Sender: manafm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 0DE73C43460; Fri, 5 Nov 2021 09:46:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: manafm) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6C35AC4338F; Fri, 5 Nov 2021 09:46:18 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 05 Nov 2021 15:16:18 +0530 From: manafm@codeaurora.org To: Zhang Rui , Daniel Lezcano , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drivers: thermal: Reset previous low and high trip during thermal zone init In-Reply-To: <1635883240-24293-1-git-send-email-manafm@codeaurora.org> References: <1635883240-24293-1-git-send-email-manafm@codeaurora.org> Message-ID: <85d1774df789ec8d528c9b3ea8afef38@codeaurora.org> X-Sender: manafm@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Gentle reminder. On 2021-11-03 01:30, Manaf Meethalavalappu Pallikunhi 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. > > Signed-off-by: Manaf Meethalavalappu Pallikunhi > --- > 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; > + tz->prev_high_trip = INT_MAX; > list_for_each_entry(pos, &tz->thermal_instances, tz_node) > pos->initialized = false; > }