From patchwork Thu May 19 14:35:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Rui X-Patchwork-Id: 574825 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DD84C433F5 for ; Thu, 19 May 2022 14:34:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239328AbiESOe6 (ORCPT ); Thu, 19 May 2022 10:34:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbiESOe5 (ORCPT ); Thu, 19 May 2022 10:34:57 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BB9E79398 for ; Thu, 19 May 2022 07:34:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652970897; x=1684506897; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D3ZZxLXW0g++7yQ4TCcNc5rHJLllJ4ihW+EZESk4M/k=; b=Q/UuZByf0LwEMwRru8aYs0Dkmyec3SrmGHooL7p9WXGNQqD4BSLFG59D XtzPh4ZRrJ7QLA7i9OBC3pI1hElH3xDPCFuV5xT5oAFPhZOuTcWuAxZ7k s9EjT5O+kvcuPTRZGCi+qKl1Zl0zBESjZiGr02kaQ2OSxN2+hb6Gkn98b Du+qaPM2Mtfngjk6LmpTh1BtE0l9MuBS7buj9uAPePQmmwPuk0JRG/vCJ G5TvoDfjVYmPjHCDoSyEW9eGSnNhTTV4mIs8S3oyyBxWB0HTfRJ31JIAp +t16J5N3xwZQK/hdAlnoJqUbhk1j5HOhn5mem1E+1w+7Tj9uJUGVNqGMC w==; X-IronPort-AV: E=McAfee;i="6400,9594,10352"; a="259804219" X-IronPort-AV: E=Sophos;i="5.91,237,1647327600"; d="scan'208";a="259804219" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2022 07:34:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,237,1647327600"; d="scan'208";a="570244525" Received: from rzhang1-dev.sh.intel.com ([10.239.48.43]) by orsmga007.jf.intel.com with ESMTP; 19 May 2022 07:34:55 -0700 From: Zhang Rui To: rjw@rjwysocki.net Cc: linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, sumeet.r.pawnikar@intel.com, len.brown@intel.com Subject: [PATCH V2 1/4] PM: wakeup: expose pm_wakeup_pending to modules Date: Thu, 19 May 2022 22:35:05 +0800 Message-Id: <20220519143508.3803894-2-rui.zhang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220519143508.3803894-1-rui.zhang@intel.com> References: <20220519143508.3803894-1-rui.zhang@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org intel_pch_thermal driver needs a long delay to cool itself (60 seconds in maximum) during suspend. When a wakeup event occures during the delay, it is better for the intel_pch_thermal driver to detect this and quit cooling because the suspend is likely to abort anyway. Thus expose pm_wakeup_pending to modules so that intel_pch_thermal driver can be aware of the wakeup events. Signed-off-by: Zhang Rui Tested-by: Sumeet Pawnikar --- drivers/base/power/wakeup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index a57d469676ca..11a4ffe91367 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -930,6 +930,7 @@ bool pm_wakeup_pending(void) return ret || atomic_read(&pm_abort_suspend) > 0; } +EXPORT_SYMBOL_GPL(pm_wakeup_pending); void pm_system_wakeup(void) { From patchwork Thu May 19 14:35:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Rui X-Patchwork-Id: 574439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2278DC433F5 for ; Thu, 19 May 2022 14:35:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239714AbiESOfA (ORCPT ); Thu, 19 May 2022 10:35:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbiESOe7 (ORCPT ); Thu, 19 May 2022 10:34:59 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F262F79398 for ; Thu, 19 May 2022 07:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652970898; x=1684506898; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tmNxs/F3ojtRb9sOqI1KH8epaDv6aemsd0izOCkyu8E=; b=czi8Wk0ykNnDTMDbilKXdKOzk+ftp+inW4QjZeGDD744yrntuGAOGxcp m0K7wKMyp/6oPNvJHQoK+dJJhQ9w7Lh5xzT8TmsBOaRQYB7PSBuZSIv7w hAnRRywiWkl6F3bCVVyXMdjAw4hVbwxWpA0gnkr8pD/rg/p37/YyUZxqn 8oJqzcghUGF9eqaZPeMbbhNQQmpwJIc94ZmKAU0jnMHF8gLT0KY7zCMjl M18MziyMgw8dDXS4uQbCazc/w64wD0y127Rd0mBFl8deFOW5nm8eIS9Ge f5rK6T35G0vYVuy0r9BkzKSBgueXBWZV1l/DAjOuBJu1N3fz9L12pyPPq w==; X-IronPort-AV: E=McAfee;i="6400,9594,10352"; a="259804223" X-IronPort-AV: E=Sophos;i="5.91,237,1647327600"; d="scan'208";a="259804223" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2022 07:34:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,237,1647327600"; d="scan'208";a="570244538" Received: from rzhang1-dev.sh.intel.com ([10.239.48.43]) by orsmga007.jf.intel.com with ESMTP; 19 May 2022 07:34:57 -0700 From: Zhang Rui To: rjw@rjwysocki.net Cc: linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, sumeet.r.pawnikar@intel.com, len.brown@intel.com Subject: [PATCH V2 2/4] thermal: intel: pch: move cooling delay to suspend_noirq phase Date: Thu, 19 May 2022 22:35:06 +0800 Message-Id: <20220519143508.3803894-3-rui.zhang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220519143508.3803894-1-rui.zhang@intel.com> References: <20220519143508.3803894-1-rui.zhang@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Move the PCH Thermal driver suspend callback to suspend_noirq to do cooling while the system is more quiescent. Signed-off-by: Zhang Rui Tested-by: Sumeet Pawnikar --- drivers/thermal/intel/intel_pch_thermal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/intel_pch_thermal.c index 527c91f5960b..c0f651b5905d 100644 --- a/drivers/thermal/intel/intel_pch_thermal.c +++ b/drivers/thermal/intel/intel_pch_thermal.c @@ -193,6 +193,7 @@ static int pch_wpt_get_temp(struct pch_thermal_device *ptd, int *temp) return 0; } +/* Cool the PCH when it's overheat in .suspend_noirq phase */ static int pch_wpt_suspend(struct pch_thermal_device *ptd) { u8 tsel; @@ -455,7 +456,7 @@ static void intel_pch_thermal_remove(struct pci_dev *pdev) pci_disable_device(pdev); } -static int intel_pch_thermal_suspend(struct device *device) +static int intel_pch_thermal_suspend_noirq(struct device *device) { struct pch_thermal_device *ptd = dev_get_drvdata(device); @@ -495,7 +496,7 @@ static const struct pci_device_id intel_pch_thermal_id[] = { MODULE_DEVICE_TABLE(pci, intel_pch_thermal_id); static const struct dev_pm_ops intel_pch_pm_ops = { - .suspend = intel_pch_thermal_suspend, + .suspend_noirq = intel_pch_thermal_suspend_noirq, .resume = intel_pch_thermal_resume, }; From patchwork Thu May 19 14:35:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Rui X-Patchwork-Id: 574824 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B5BAC433EF for ; Thu, 19 May 2022 14:35:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239819AbiESOfC (ORCPT ); Thu, 19 May 2022 10:35:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbiESOfB (ORCPT ); Thu, 19 May 2022 10:35:01 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8B2079398 for ; Thu, 19 May 2022 07:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652970900; x=1684506900; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=grVHVfnQcCkY5NNHHusPqfHhqogqTiQtd6RoR7OdIBc=; b=FazwNPB91SPYzkENZvl0JLdKCCr8vjkhpcpXAN9859ru3OYIjX0y8rOg KI5SenwFryVnYW3vA4sjv3O7OpKtKOZk41f3JPq5vGggstZDylCwAA3lo Wsn4ZJZPNtjiVMm1zY0vWJIeGcW97Tmrs+h2AD1cpTnMJiTdMox3bzPUo /4FInH0+MflZ9inXOc9P9aPM1i7L/XebCJo6OeygexJfgS7hCFWFI8z1E aSIusKT2aAgY3hTa1lTajljF0u8+UBJfikbySTX7vVucOaRa6VR1MT8Jf /cAAq8XWT6qyLb73t1V+PmuPlEXXm4u4cNCY2+lkmOO7ka1Klbx/apXlq g==; X-IronPort-AV: E=McAfee;i="6400,9594,10352"; a="259804229" X-IronPort-AV: E=Sophos;i="5.91,237,1647327600"; d="scan'208";a="259804229" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2022 07:35:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,237,1647327600"; d="scan'208";a="570244553" Received: from rzhang1-dev.sh.intel.com ([10.239.48.43]) by orsmga007.jf.intel.com with ESMTP; 19 May 2022 07:34:59 -0700 From: Zhang Rui To: rjw@rjwysocki.net Cc: linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, sumeet.r.pawnikar@intel.com, len.brown@intel.com Subject: [PATCH V2 3/4] thermal: intel: pch: enhance overheat handling Date: Thu, 19 May 2022 22:35:07 +0800 Message-Id: <20220519143508.3803894-4-rui.zhang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220519143508.3803894-1-rui.zhang@intel.com> References: <20220519143508.3803894-1-rui.zhang@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Commit ef63b043ac86 ("thermal: intel: pch: fix S0ix failure due to PCH temperature above threshold") introduces delay loop mechanism that allows PCH temperature to go down below threshold during suspend so it won't block S0ix. And the default overall delay timeout is 1 second. However, in practice, we found that the time it takes to cool the PCH down below threshold highly depends on the initial PCH temperature when the delay starts, as well as the ambient temperature. And in some cases, the 1 second delay is not sufficient. As a result, the system stays in a shallower power state like PCx instead of S0ix, and drains the battery power, without user' notice. To make sure S0ix is not blocked by the PCH overheating, we 1. expand the default overall timeout to 60 seconds. 2. make sure the temperature is below threshold rather than equal to it. At the same time, as the cooling delay can be much longer and many wakeup events (ACPI Power Button press, USB mouse move, etc) becomes valid in the suspend_noirq phase, add detection of wakeup event so that the driver does not delay blindly when the system suspend is likely to abort soon. This patch may introduce longer suspend time, but only in the cases when the system overheats and Linux used to enter a shallower S2idle state, say, PCx instead of S0ix. Signed-off-by: Zhang Rui Tested-by: Sumeet Pawnikar --- drivers/thermal/intel/intel_pch_thermal.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/intel_pch_thermal.c index c0f651b5905d..b7b32e2f5ae2 100644 --- a/drivers/thermal/intel/intel_pch_thermal.c +++ b/drivers/thermal/intel/intel_pch_thermal.c @@ -70,8 +70,8 @@ static unsigned int delay_timeout = 100; module_param(delay_timeout, int, 0644); MODULE_PARM_DESC(delay_timeout, "amount of time delay for each iteration."); -/* Number of iterations for cooling delay, 10 counts by default for now */ -static unsigned int delay_cnt = 10; +/* Number of iterations for cooling delay, 600 counts by default for now */ +static unsigned int delay_cnt = 600; module_param(delay_cnt, int, 0644); MODULE_PARM_DESC(delay_cnt, "total number of iterations for time delay."); @@ -197,7 +197,7 @@ static int pch_wpt_get_temp(struct pch_thermal_device *ptd, int *temp) static int pch_wpt_suspend(struct pch_thermal_device *ptd) { u8 tsel; - u8 pch_delay_cnt = 1; + int pch_delay_cnt = 1; u16 pch_thr_temp, pch_cur_temp; /* Shutdown the thermal sensor if it is not enabled by BIOS */ @@ -234,7 +234,10 @@ static int pch_wpt_suspend(struct pch_thermal_device *ptd) * which helps to indentify the reason why S0ix entry was rejected. */ while (pch_delay_cnt <= delay_cnt) { - if (pch_cur_temp <= pch_thr_temp) + if (pch_cur_temp < pch_thr_temp) + break; + + if (pm_wakeup_pending()) break; dev_warn(&ptd->pdev->dev, @@ -246,7 +249,7 @@ static int pch_wpt_suspend(struct pch_thermal_device *ptd) pch_delay_cnt++; } - if (pch_cur_temp > pch_thr_temp) + if (pch_cur_temp >= pch_thr_temp) dev_warn(&ptd->pdev->dev, "CPU-PCH is hot [%dC] even after delay, continue to suspend. S0ix might fail\n", pch_cur_temp); From patchwork Thu May 19 14:35:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Rui X-Patchwork-Id: 574438 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D8BCC4332F for ; Thu, 19 May 2022 14:35:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231470AbiESOfF (ORCPT ); Thu, 19 May 2022 10:35:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239838AbiESOfD (ORCPT ); Thu, 19 May 2022 10:35:03 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BCD9BA54F for ; Thu, 19 May 2022 07:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652970902; x=1684506902; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WMMQI6LaG8XnQdWUmuMOfgF6HNdtWI8KYOOxX5jpl9E=; b=nFCg8hU+RIAuuCNQqLPmOL2zQmSjkT7U/PQXYrJ1muqV39tiI12muFeD 7w+XOMUTkiLdE63tnxqyGwuH+/AlnMrAFbxTZylPCRaEsViA8wsS73TpS APkQyr6FgkHsUYUpIaguhd77CsGeYc5HC9TupjT2YC4lAWlhMzkbggguC 7kgFn5/n25DLqpp9UaTQi5FaFEtPvWV0YOwodDd8cn1zBjrUhryUvAHNH Q6HlsJmRjZjXJrjgIytmJ+fPBGdlkNo0XQQPYt1FSkN4UM04xgoLyx4bO a/REQXprQsFK1ZL9psYiLUs4TGvoWpL0rLybCM18Q71Bcg1+p1yVA1bMk g==; X-IronPort-AV: E=McAfee;i="6400,9594,10352"; a="259804233" X-IronPort-AV: E=Sophos;i="5.91,237,1647327600"; d="scan'208";a="259804233" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2022 07:35:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,237,1647327600"; d="scan'208";a="570244580" Received: from rzhang1-dev.sh.intel.com ([10.239.48.43]) by orsmga007.jf.intel.com with ESMTP; 19 May 2022 07:35:00 -0700 From: Zhang Rui To: rjw@rjwysocki.net Cc: linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, sumeet.r.pawnikar@intel.com, len.brown@intel.com Subject: [PATCH V2 4/4] thermal: intel: pch: improve the cooling delay log Date: Thu, 19 May 2022 22:35:08 +0800 Message-Id: <20220519143508.3803894-5-rui.zhang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220519143508.3803894-1-rui.zhang@intel.com> References: <20220519143508.3803894-1-rui.zhang@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Previously, during suspend, intel_pch_thermal driver logs for every cooling iteration, about the current PCH temperature and number of cooling iterations that have been tried, like below [ 100.955526] intel_pch_thermal 0000:00:14.2: CPU-PCH current temp [53C] higher than the threshold temp [50C], sleep 1 times for 100 ms duration [ 101.064156] intel_pch_thermal 0000:00:14.2: CPU-PCH current temp [53C] higher than the threshold temp [50C], sleep 2 times for 100 ms duration After changing the default delay_cnt to 600, in practice, it is common to see tens of the above messages if the system is suspended when PCH overheats. Thus, change this log message from dev_warn to dev_dbg because it is only useful when we want to check the temperature trend. At the same time, there is always a one-line message given by the driver with the patch applied, with below four possibilities. 1. PCH is cool, no cooling delay needed [ 1791.902853] intel_pch_thermal 0000:00:12.0: CPU-PCH is cool [48C] 2. PCH overheats and becomes cool after the cooling delays [ 1475.511617] intel_pch_thermal 0000:00:12.0: CPU-PCH is cool [49C] after 30700 ms delay 3. PCH still overheats after the overall cooling timeout [ 2250.157487] intel_pch_thermal 0000:00:12.0: CPU-PCH is hot [60C] after 60000 ms delay. S0ix might fail 4. PCH aborts cooling because of wakeup event detected during the delay [ 1933.639509] intel_pch_thermal 0000:00:12.0: Wakeup event detected, abort cooling Signed-off-by: Zhang Rui Tested-by: Sumeet Pawnikar --- drivers/thermal/intel/intel_pch_thermal.c | 31 +++++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/intel_pch_thermal.c index b7b32e2f5ae2..c1fa2b29b153 100644 --- a/drivers/thermal/intel/intel_pch_thermal.c +++ b/drivers/thermal/intel/intel_pch_thermal.c @@ -197,7 +197,7 @@ static int pch_wpt_get_temp(struct pch_thermal_device *ptd, int *temp) static int pch_wpt_suspend(struct pch_thermal_device *ptd) { u8 tsel; - int pch_delay_cnt = 1; + int pch_delay_cnt = 0; u16 pch_thr_temp, pch_cur_temp; /* Shutdown the thermal sensor if it is not enabled by BIOS */ @@ -233,29 +233,38 @@ static int pch_wpt_suspend(struct pch_thermal_device *ptd) * temperature stays above threshold, notify the warning message * which helps to indentify the reason why S0ix entry was rejected. */ - while (pch_delay_cnt <= delay_cnt) { + while (pch_delay_cnt < delay_cnt) { if (pch_cur_temp < pch_thr_temp) break; - if (pm_wakeup_pending()) - break; + if (pm_wakeup_pending()) { + dev_warn(&ptd->pdev->dev, "Wakeup event detected, abort cooling\n"); + return 0; + } - dev_warn(&ptd->pdev->dev, + pch_delay_cnt++; + dev_dbg(&ptd->pdev->dev, "CPU-PCH current temp [%dC] higher than the threshold temp [%dC], sleep %d times for %d ms duration\n", pch_cur_temp, pch_thr_temp, pch_delay_cnt, delay_timeout); msleep(delay_timeout); /* Read the PCH current temperature for next cycle. */ pch_cur_temp = GET_PCH_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); - pch_delay_cnt++; } if (pch_cur_temp >= pch_thr_temp) dev_warn(&ptd->pdev->dev, - "CPU-PCH is hot [%dC] even after delay, continue to suspend. S0ix might fail\n", - pch_cur_temp); - else - dev_info(&ptd->pdev->dev, - "CPU-PCH is cool [%dC], continue to suspend\n", pch_cur_temp); + "CPU-PCH is hot [%dC] after %d ms delay. S0ix might fail\n", + pch_cur_temp, pch_delay_cnt * delay_timeout); + else { + if (pch_delay_cnt) + dev_info(&ptd->pdev->dev, + "CPU-PCH is cool [%dC] after %d ms delay\n", + pch_cur_temp, pch_delay_cnt * delay_timeout); + else + dev_info(&ptd->pdev->dev, + "CPU-PCH is cool [%dC]\n", + pch_cur_temp); + } return 0; }