From patchwork Thu Feb 4 07:40:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: thermal-bot for Julien Panis X-Patchwork-Id: 377346 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=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED 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 A1543C433E9 for ; Thu, 4 Feb 2021 07:41:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64EDB614A5 for ; Thu, 4 Feb 2021 07:41:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234702AbhBDHli (ORCPT ); Thu, 4 Feb 2021 02:41:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234750AbhBDHl2 (ORCPT ); Thu, 4 Feb 2021 02:41:28 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01CD2C0613ED for ; Wed, 3 Feb 2021 23:40:48 -0800 (PST) Date: Thu, 04 Feb 2021 07:40:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1612424446; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1lh6uaHQifMDtHh9mupc8ntP1hfl8K2baZn6QMWvSDE=; b=ualkLkvwC2gXrWNDLdYYLpfvwE2yzKkQsr3OLl2oz4Cq3uqg8d2AJ7KJFhLri4q625p6iW SUYi7PoQtavfE/P9utpwZr4DO9OB3ghr+5g64jDh8pEpmK64Nh9TGXCO1FrlA7j/N4mjs4 QlIjPYtB1G7wEhUDJVOdYkRVRG8+rWHUZg91JL+jC8v6PG7ia39oBbCuMtwXAidpS2/e3N 7A/OYvxeSvTro+fCcRc6JCaG+qqGVryuX5m+cFg1MHjupQiK78C3UY2/URI0gmo8mJdJtH HxTV+A3dM6yswkJYMjlqZmplomTWwH6amrQ7eIo7bLnAZqAdJSG3Oy2mTM+T1g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1612424446; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1lh6uaHQifMDtHh9mupc8ntP1hfl8K2baZn6QMWvSDE=; b=6AfRgGd/R7EM6CVbP4vneM3xZqjM+NxZ9ke1YVuMJV405FGCVJ0pv2HirAwTNvWCPpyV8s v0w3W94jxturMlDg== From: "thermal-bot for Kai-Heng Feng" Sender: tip-bot2@linutronix.de Reply-to: linux-pm@vger.kernel.org To: linux-pm@vger.kernel.org Subject: [thermal: thermal/next] thermal: int340x: Fix unexpected shutdown at critical temperature Cc: "Kai-Heng Feng" , Daniel Lezcano , rui.zhang@intel.com, amitk@kernel.org In-Reply-To: <20201221172345.36976-1-kai.heng.feng@canonical.com> References: <20201221172345.36976-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 Message-ID: <161242444551.23325.8894385262578414322.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The following commit has been merged into the thermal/next branch of thermal: Commit-ID: dd47366aaa9b93ac3d97cb4ee7641d38a28a771e Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//dd47366aaa9b93ac3d97cb4ee7641d38a28a771e Author: Kai-Heng Feng AuthorDate: Tue, 22 Dec 2020 01:23:43 +08:00 Committer: Daniel Lezcano CommitterDate: Tue, 19 Jan 2021 22:30:25 +01:00 thermal: int340x: Fix unexpected shutdown at critical temperature 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 Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20201221172345.36976-1-kai.heng.feng@canonical.com --- drivers/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 6e479de..d1248ba 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,