From patchwork Mon Dec 21 17:23:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 11985041 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0050EC433DB for ; Mon, 21 Dec 2020 17:24:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B92BA22B45 for ; Mon, 21 Dec 2020 17:24:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726000AbgLURYi (ORCPT ); Mon, 21 Dec 2020 12:24:38 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:32906 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725997AbgLURYi (ORCPT ); Mon, 21 Dec 2020 12:24:38 -0500 Received: from 36-229-229-222.dynamic-ip.hinet.net ([36.229.229.222] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1krOuU-0003TV-7K; Mon, 21 Dec 2020 17:23:51 +0000 From: Kai-Heng Feng To: rui.zhang@intel.com, daniel.lezcano@linaro.org, amitk@kernel.org Cc: andrzej.p@collabora.com, mjg59@google.com, srinivas.pandruvada@linux.intel.com, Kai-Heng Feng , Akinobu Mita , Andrew Morton , Andy Shevchenko , linux-pm@vger.kernel.org (open list:THERMAL), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 1/2] thermal: int340x: Fix unexpected shutdown at critical temperature Date: Tue, 22 Dec 2020 01:23:43 +0800 Message-Id: <20201221172345.36976-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org We are seeing thermal shutdown on Intel based mobile workstations, the shutdown happens during the first trip handle in thermal_zone_device_register(): kernel: thermal thermal_zone15: critical temperature reached (101 C), shutting down However, we shouldn't do a thermal shutdown here, since 1) We may want to use a dedicated daemon, Intel's thermald in this case, to handle thermal shutdown. 2) For ACPI based system, _CRT doesn't mean shutdown unless it's inside ThermalZone namespace. ACPI Spec, 11.4.4 _CRT (Critical Temperature): "... If this object it present under a device, the device’s driver evaluates this object to determine the device’s critical cooling temperature trip point. This value may then be used by the device’s driver to program an internal device temperature sensor trip point." So a "critical trip" here merely means we should take a more aggressive cooling method. As int340x device isn't present under ACPI ThermalZone, override the default .critical callback to prevent surprising thermal shutdown. Signed-off-by: Kai-Heng Feng --- v2: - Amend subject. - Remove int3400 device. .../thermal/intel/int340x_thermal/int340x_thermal_zone.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c index 6e479deff76b..d1248ba943a4 100644 --- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c @@ -146,12 +146,18 @@ static int int340x_thermal_get_trip_hyst(struct thermal_zone_device *zone, return 0; } +static void int340x_thermal_critical(struct thermal_zone_device *zone) +{ + dev_dbg(&zone->device, "%s: critical temperature reached\n", zone->type); +} + static struct thermal_zone_device_ops int340x_thermal_zone_ops = { .get_temp = int340x_thermal_get_zone_temp, .get_trip_temp = int340x_thermal_get_trip_temp, .get_trip_type = int340x_thermal_get_trip_type, .set_trip_temp = int340x_thermal_set_trip_temp, .get_trip_hyst = int340x_thermal_get_trip_hyst, + .critical = int340x_thermal_critical, }; static int int340x_thermal_get_trip_config(acpi_handle handle, char *name, From patchwork Mon Dec 21 17:23:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 11985043 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAC9CC433DB for ; Mon, 21 Dec 2020 17:25:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BCD5322B45 for ; Mon, 21 Dec 2020 17:25:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726044AbgLURYs (ORCPT ); Mon, 21 Dec 2020 12:24:48 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:32918 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbgLURYs (ORCPT ); Mon, 21 Dec 2020 12:24:48 -0500 Received: from 36-229-229-222.dynamic-ip.hinet.net ([36.229.229.222] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1krOub-0003Tq-14; Mon, 21 Dec 2020 17:23:57 +0000 From: Kai-Heng Feng To: rui.zhang@intel.com, daniel.lezcano@linaro.org, amitk@kernel.org Cc: andrzej.p@collabora.com, mjg59@google.com, srinivas.pandruvada@linux.intel.com, Kai-Heng Feng , Sumeet Pawnikar , Andy Shevchenko , Gayatri Kammela , Randy Dunlap , Andres Freund , Chuhong Yuan , Akinobu Mita , linux-pm@vger.kernel.org (open list:THERMAL), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 2/2] thermal: intel: pch: Fix unexpected shutdown at critical temperature Date: Tue, 22 Dec 2020 01:23:44 +0800 Message-Id: <20201221172345.36976-2-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201221172345.36976-1-kai.heng.feng@canonical.com> References: <20201221172345.36976-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Like previous patch, the intel_pch_thermal device is not in ACPI ThermalZone namespace, so a critical trip doesn't mean shutdown. Override the default .critical callback to prevent surprising thermal shutdoown. Signed-off-by: Kai-Heng Feng --- v2: - Amend subject. drivers/thermal/intel/intel_pch_thermal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/intel_pch_thermal.c index 41723c6c6c0c..527c91f5960b 100644 --- a/drivers/thermal/intel/intel_pch_thermal.c +++ b/drivers/thermal/intel/intel_pch_thermal.c @@ -326,10 +326,16 @@ static int pch_get_trip_temp(struct thermal_zone_device *tzd, int trip, int *tem return 0; } +static void pch_critical(struct thermal_zone_device *tzd) +{ + dev_dbg(&tzd->device, "%s: critical temperature reached\n", tzd->type); +} + static struct thermal_zone_device_ops tzd_ops = { .get_temp = pch_thermal_get_temp, .get_trip_type = pch_get_trip_type, .get_trip_temp = pch_get_trip_temp, + .critical = pch_critical, }; enum board_ids {