Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4631370pxb; Tue, 2 Nov 2021 13:04:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycwH9eGZffZDHhjIGKoZbAjMzaJgc44YflUCpDrHrfEqtARh/GJ77JXYpBRSukrhMSWUYE X-Received: by 2002:a17:906:7802:: with SMTP id u2mr46604723ejm.422.1635883449067; Tue, 02 Nov 2021 13:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635883449; cv=none; d=google.com; s=arc-20160816; b=CbgchrbPffm6pfGXE6V/nJCGIYNOKvMhf9Ajcn0GbpxAf9ycRpgM67Ywk9X0zhT6lg OnwZ+kbqXKHVCcQ6vKEoUJaLNqdLWXDH1GPpEuqR70wBgx+wSglMTncagZ1YCHVIcrNl sx+5octGlFGI2kUZ/yvtYlnr5vbtQPjWrm0kzZNBeRER3xHreInXrKpth1NWA4yLImkJ kFUx/+0/gOAZSEL+by8AQ7m+/u2SV05KWeoHotfJqD/ZBGkuW8gmps+To0scYl+9NjM5 s8sxjMPcCA6vuXt1kaK+QS2gRRAyHgnsCNMUqJdRXqeuxvoPKrZkWyRzUTqiFWpr5gdl 2Gyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:dmarc-filter :sender:dkim-signature; bh=PM2vqsyPhigju6bhWFQKUBBtAyKhjiTZ3RomQD8TF4k=; b=LfW0rcyp/TeSkI1ElONNbRYu0Fzql+ttoklS7HOXgkmgcJ2IY3QRcSSlEXyLokTyKo N6ktVSpo2glvt2GWoaR/gtEPRHtKxhBf0yoQUh9cHlSM/Yy7aYO1pR5QOiP8w9npssHq Mym8aEGNMZXJVoelspi9V/+6W2sxy/ftnBhNemNufvyfhgCsvrsUg6HnKbURdt/QZqN6 D95Ib3jw41sCVeLrG0ZraC231ZI8kS8OQ/7noZZFUWNiXxcFJnHWCm2LKkUSvXlAiPij LGNAiRer5MHP2td51iFn4PfYbAVp5/A6ddopX75jHx5ozPTCd2AG7QLwaq+kE2reK9C3 +Y8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=QezvhduC; 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 z7si3109237edc.483.2021.11.02.13.03.44; Tue, 02 Nov 2021 13:04:09 -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=QezvhduC; 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 S230376AbhKBUEN (ORCPT + 99 others); Tue, 2 Nov 2021 16:04:13 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:23382 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbhKBUEN (ORCPT ); Tue, 2 Nov 2021 16:04:13 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1635883298; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=PM2vqsyPhigju6bhWFQKUBBtAyKhjiTZ3RomQD8TF4k=; b=QezvhduCwdW6h1h8maI2JUtIicT7YPdFEOe6dPRjOzEwKge2OXHZXH1KbdhO2ZO/NQTgt+A4 QBlVbHEYgQvGElPLJA+wZSJkJaHpCXvCcxD7pgEGXO2LP6uJyT/NTQQh2RqBV961bt47HPov 871aqfin6iJdUNPUHsldL3W4FPI= X-Mailgun-Sending-Ip: 198.61.254.9 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-n03.prod.us-east-1.postgun.com with SMTP id 618198fc545d7d365f1e8a64 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 02 Nov 2021 20:01:00 GMT Sender: manafm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 81250C4338F; Tue, 2 Nov 2021 20:00:59 +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,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from codeaurora.org (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: manafm) by smtp.codeaurora.org (Postfix) with ESMTPSA id 76BBDC4360C; Tue, 2 Nov 2021 20:00:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 76BBDC4360C Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Manaf Meethalavalappu Pallikunhi To: Zhang Rui , Daniel Lezcano , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Manaf Meethalavalappu Pallikunhi Subject: [PATCH] drivers: thermal: Reset previous low and high trip during thermal zone init Date: Wed, 3 Nov 2021 01:30:40 +0530 Message-Id: <1635883240-24293-1-git-send-email-manafm@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project