From patchwork Tue Dec 12 22:13:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 177627 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp8034670vqy; Tue, 12 Dec 2023 14:17:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMxhFrs502hgvcng2WgkT3jODCzTQm4mQQyhvj7Nro+84URg2y5ssQIEKuRHIatCH7R7WW X-Received: by 2002:a05:6a00:138c:b0:6ce:6beb:9a42 with SMTP id t12-20020a056a00138c00b006ce6beb9a42mr4455794pfg.64.1702419426618; Tue, 12 Dec 2023 14:17:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702419426; cv=none; d=google.com; s=arc-20160816; b=niIUCVD4entLv5+E4gz3D8eClB0e4h2T4sfcQpdu/vHtR9v4idWPMVc0+TIzw4VtYo i4BlMR5HXLGlFAkhfoGsjn2fYKC/zSLZrQl7NYKgPRqEYIcDvFzGeK4atL3RBI8/v2L7 Th24xY/EbRnnELkkQLrXhCoknByZzPQhXh0KNYBhrzWif3gqErX0YzvuK1sq3280v060 zSCchK2LAHo643QCOeW36BP6emQ9BOqgaXVPmXxdeusbMyoxCy++hltu/A9Q/O4DLW0z 56g98zhBwdcemLvxTK7t92TDVLWJBWdSjNvvLezl+pcxFb8P7c6BOSggCfFEkwLYOdHg cyGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=mMdH27R0nN/kULVb9qDYym6teaR7gKvUH7s4Uj8Xhzk=; fh=ErNIe1wpWhLZG5o/AQnmhEEYA4RvBSCAQPu9u9yDwTQ=; b=YAch/nhB2O/TGM60TFPjzqqT3H0bPLInLuZPZ3DweuVm/Q162Trk4Pv0xroXD4F0HG IvSeDbdRr3BncKvzYZ/qlmYms/Uf13g064x7ZA1MbesgB80HJveNDuI091rp4fV4j1uD DkZB7Gael0i5sYazotlYaiSuMyk79faIv0bUw0jqSHqCyggoGV1P95hSX4NvybLbe3g4 0s43Gy2p3sj0bRcL+9TBkhIHEmchFVPJ+M/fav3pil6O3oVCHDrVURcpUkclQBieuyFN a4dlgos9JwwA2GwuQFbdT+5Z1brPxnEoocer6pxjSbXNx4EW6XFyVNx4QTiLg4S1aRHS LMLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XBEqpIys; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id w189-20020a6362c6000000b005c6b97e40c4si8032208pgb.297.2023.12.12.14.17.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 14:17:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XBEqpIys; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 82B9A8060669; Tue, 12 Dec 2023 14:17:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377753AbjLLWQ4 (ORCPT + 99 others); Tue, 12 Dec 2023 17:16:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231980AbjLLWQz (ORCPT ); Tue, 12 Dec 2023 17:16:55 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA6F5AC; Tue, 12 Dec 2023 14:17:00 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40c3984f0cdso47326275e9.1; Tue, 12 Dec 2023 14:17:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702419419; x=1703024219; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=mMdH27R0nN/kULVb9qDYym6teaR7gKvUH7s4Uj8Xhzk=; b=XBEqpIysjMlPITg+9VrSdvec9/FPZFZQS2POFtZ4LQJNJHbcvM/NwWnqP+Z+LY8gYR VMLMXMV7qhavqanbvEFLF5odbenSTaHxaGc781lRB2nABjXqJodNruNOuWwcRHx0UZLa ppc+YKw9tzEbcOziaGbf+p6mN4/DbbziV/ntngRbyQgjJWG3CDv0XLtXqW2plFDnpSqT alSrIxo/8jG7ZHJkqNTa7bnY/KSXp9sEkM0ovkyktnb5wJick8jA9LK1G6UVmxjwKDkN CtgD2x9GdIBjgezQewPk1i4mmPVmmsfBVfK3wj4ZT9kNzX0gTnyCBymdTiqxgyTB9sxp tG0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702419419; x=1703024219; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mMdH27R0nN/kULVb9qDYym6teaR7gKvUH7s4Uj8Xhzk=; b=izs6Q++Md9Ry4nwbyB6ey/r01jk/3FS/uxLWswLcywGMS5NAjiSuJxZaudzLqLox4r Y7QX1m1IDfvpKdM4BsvAsTNSSgPM+Kgjolb9sh0h8VOl2ppDee4WFEocari02vrUMNHv phefhhfckqIlsL00awEyqpx4pCKWytGwjKGveCqS1VhAhd3jhm0mMYxA35o5pAmhmfNa 50FtW4oToTLET441PbHbEv/1iV4j3g8DOOBR++nZyX+S7xdCdGRCvVwGZJ5h2/N8VEue x1TegDGSfENQ3eJAZu0fbL7KGKDt6AxtIIkiJeI+19rK6ktqy723yFEPqk8LU76hDiL2 iXeQ== X-Gm-Message-State: AOJu0YzgwxneTUWHmcm1PCxzz2IXBbRZIx1i/vlZWY7xowayqS6NTjYk N+4IbWEfJoXR62kRsqH20MM= X-Received: by 2002:a7b:ce13:0:b0:40c:311d:c676 with SMTP id m19-20020a7bce13000000b0040c311dc676mr3727486wmc.137.1702419418813; Tue, 12 Dec 2023 14:16:58 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id m11-20020a056000008b00b0033332524235sm11669113wrx.82.2023.12.12.14.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 14:16:58 -0800 (PST) From: Christian Marangi To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Christian Marangi , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] thermal: core: add initial support for cold and critical_cold trip point Date: Tue, 12 Dec 2023 23:13:00 +0100 Message-Id: <20231212221301.12581-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 12 Dec 2023 14:17:05 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785116152883855059 X-GMAIL-MSGID: 1785116152883855059 Add initial support for cold and critical_cold trip point. Many if not all hwmon and thermal device have normally trip point for hot temperature and for cold temperature. Till now only hot temperature were supported. Add support for also cold temperature to permit complete definition of cold trip point in DT. Thermal driver may use these additional trip point to correctly set interrupt for cold temperature values and react based on that with various measure like enabling attached heater, forcing higher voltage and other specialaized peripherals. For hwmon drivers this is needed as currently there is a problem with setting the full operating range of the device for thermal devices defined with hwmon. To better describe the problem, the following example is needed: In the scenario of a simple hwmon with an active trip point declared and a cooling device attached, the hwmon subsystem currently set the min and max trip point based on the single active trip point. Thermal subsystem parse all the trip points and calculate the lowest and the highest trip point and calls the .set_trip of hwmon to setup the trip points. The fact that we currently don't have a way to declare the cold/min temperature values, makes the thermal subsystem to set the low value as -INT_MAX. For hwmon drivers that doesn't use clamp_value and actually reject invalid values for the trip point, this results in the hwmon settings to be rejected. To permit to pass the correct range of trip point, permit to set in DT also cold and critical_cold trip point. Thermal driver may also define .cold and .critical_cold to act on these trip point tripped and apply the required measure. Signed-off-by: Christian Marangi --- drivers/thermal/thermal_core.c | 13 +++++++++++++ drivers/thermal/thermal_of.c | 2 ++ drivers/thermal/thermal_sysfs.c | 4 ++++ drivers/thermal/thermal_trace.h | 4 ++++ include/linux/thermal.h | 2 ++ include/uapi/linux/thermal.h | 2 ++ 6 files changed, 27 insertions(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 9c17d35ccbbd..3c5ab560e72f 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -344,6 +344,17 @@ static void handle_critical_trips(struct thermal_zone_device *tz, tz->ops->hot(tz); } +static void handle_critical_cold_trips(struct thermal_zone_device *tz, + const struct thermal_trip *trip) +{ + trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, trip), trip->type); + + if (trip->type == THERMAL_TRIP_CRITICAL_COLD && tz->ops->critical_cold) + tz->ops->critical_cold(tz); + else if (trip->type == THERMAL_TRIP_COLD && tz->ops->cold) + tz->ops->cold(tz); +} + static void handle_thermal_trip(struct thermal_zone_device *tz, const struct thermal_trip *trip) { @@ -365,6 +376,8 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, if (trip->type == THERMAL_TRIP_CRITICAL || trip->type == THERMAL_TRIP_HOT) handle_critical_trips(tz, trip); + else if (trip->type == THERMAL_TRIP_CRITICAL_COLD || trip->type == THERMAL_TRIP_COLD) + handle_critical_cold_trips(tz, trip); else handle_non_critical_trips(tz, trip); } diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 1e0655b63259..95bc600bb4b8 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -60,6 +60,8 @@ static const char * const trip_types[] = { [THERMAL_TRIP_PASSIVE] = "passive", [THERMAL_TRIP_HOT] = "hot", [THERMAL_TRIP_CRITICAL] = "critical", + [THERMAL_TRIP_COLD] = "cold", + [THERMAL_TRIP_CRITICAL_COLD] = "critical_cold", }; /** diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index eef40d4f3063..e1e69e0991c2 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -106,6 +106,10 @@ trip_point_type_show(struct device *dev, struct device_attribute *attr, return sprintf(buf, "critical\n"); case THERMAL_TRIP_HOT: return sprintf(buf, "hot\n"); + case THERMAL_TRIP_COLD: + return sprintf(buf, "cold\n"); + case THERMAL_TRIP_CRITICAL_COLD: + return sprintf(buf, "critical_cold\n"); case THERMAL_TRIP_PASSIVE: return sprintf(buf, "passive\n"); case THERMAL_TRIP_ACTIVE: diff --git a/drivers/thermal/thermal_trace.h b/drivers/thermal/thermal_trace.h index 459c8ce6cf3b..0a4f96075d7d 100644 --- a/drivers/thermal/thermal_trace.h +++ b/drivers/thermal/thermal_trace.h @@ -11,6 +11,8 @@ TRACE_DEFINE_ENUM(THERMAL_TRIP_CRITICAL); TRACE_DEFINE_ENUM(THERMAL_TRIP_HOT); +TRACE_DEFINE_ENUM(THERMAL_TRIP_COLD); +TRACE_DEFINE_ENUM(THERMAL_TRIP_CRITICAL_COLD); TRACE_DEFINE_ENUM(THERMAL_TRIP_PASSIVE); TRACE_DEFINE_ENUM(THERMAL_TRIP_ACTIVE); @@ -18,6 +20,8 @@ TRACE_DEFINE_ENUM(THERMAL_TRIP_ACTIVE); __print_symbolic(type, \ { THERMAL_TRIP_CRITICAL, "CRITICAL"}, \ { THERMAL_TRIP_HOT, "HOT"}, \ + { THERMAL_TRIP_COLD, "COLD"}, \ + { THERMAL_TRIP_CRITICAL_COLD, "CRITICAL_COLD"}, \ { THERMAL_TRIP_PASSIVE, "PASSIVE"}, \ { THERMAL_TRIP_ACTIVE, "ACTIVE"}) diff --git a/include/linux/thermal.h b/include/linux/thermal.h index cee814d5d1ac..d6345c9ec50d 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -84,6 +84,8 @@ struct thermal_zone_device_ops { const struct thermal_trip *, enum thermal_trend *); void (*hot)(struct thermal_zone_device *); void (*critical)(struct thermal_zone_device *); + void (*cold)(struct thermal_zone_device *); + void (*critical_cold)(struct thermal_zone_device *); }; struct thermal_cooling_device_ops { diff --git a/include/uapi/linux/thermal.h b/include/uapi/linux/thermal.h index fc78bf3aead7..7fa1ba0dff05 100644 --- a/include/uapi/linux/thermal.h +++ b/include/uapi/linux/thermal.h @@ -14,6 +14,8 @@ enum thermal_trip_type { THERMAL_TRIP_PASSIVE, THERMAL_TRIP_HOT, THERMAL_TRIP_CRITICAL, + THERMAL_TRIP_COLD, + THERMAL_TRIP_CRITICAL_COLD, }; /* Adding event notification support elements */ From patchwork Tue Dec 12 22:13:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 177628 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp8034712vqy; Tue, 12 Dec 2023 14:17:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+D7nB5ix6Dlhz0bgk9NJ911nFOzfgSd7E7Rj9N32AO4JAuukWfd43joAGs6x1W74Tpes7 X-Received: by 2002:a05:6e02:184c:b0:35d:a8c0:8c92 with SMTP id b12-20020a056e02184c00b0035da8c08c92mr10960481ilv.99.1702419431867; Tue, 12 Dec 2023 14:17:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702419431; cv=none; d=google.com; s=arc-20160816; b=WUCUZqPPwKXV41sKdDLCyHjeuBPOq5PaoYIeFxyFwXE3YFIi4cWiJ9dUJVdYKm7bjD 8vjR6T+PsrBL3kFSNlIfihZO3rdgB/pO2EjFK2oSt6HZweUcwUVobLRsZdGCQ0RVyxIi 3dLesPw+TlhzggQf10jGmGmLMLvH9LjQp+KNwcnefTvt8YsOdg1FaRVbzuuz+B2hUjgo m3Hb7zmYoV1w6aeo51lltf+7nAEVvlPHdMVvdAZV3Y3Dr/IVG4Zi0zOfl4hpGIr1KOxa PJHA4rj4gX9XgLjIf8MhCJP1gY6EIywyMF3SuRUcYSZAeX2hn9eT2afxHseEUXN4s2HW UJLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dZ89YvrOqku4UfXm1LiD3M7ba2ZGC3MrhjCGhcqvrpM=; fh=ErNIe1wpWhLZG5o/AQnmhEEYA4RvBSCAQPu9u9yDwTQ=; b=NFlYwwvxYRx02R2HwdiTkcil/nhu4NDq8FBs6Kqkb5yT2scbuW/s7pj5vSlVhXB1M/ bmLXvAeMieQNI7jI0UwXZyVZDha/NHPwOqXC4qBQN0RdeTiWFVo+tFfb3shNQH36S1jR pf9BIJbVqPrlQ02RM5M1lF8r8VOO677+vsH0NqMlmKSGt0LRu4WQkXxyrapKIwzDs1JL OURxbHwGfkQqxWEmS1wC7NoNfCu491J8luO3PCkSwukodRoMzT3dHPNHrAbW4MDGciIT 1lERLYwUTjfCKEoHDtbWt5s7nz+0QftMeEIXnWtVsFIOr9+PRW1F7P0xRhBdi1ZVI9y+ RPxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PMo1bj+E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i1-20020a635401000000b005c65ed0f680si8268834pgb.463.2023.12.12.14.17.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 14:17:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PMo1bj+E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CF0F3805F640; Tue, 12 Dec 2023 14:17:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377760AbjLLWQ6 (ORCPT + 99 others); Tue, 12 Dec 2023 17:16:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232371AbjLLWQz (ORCPT ); Tue, 12 Dec 2023 17:16:55 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA723BD; Tue, 12 Dec 2023 14:17:01 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3333074512bso3898435f8f.1; Tue, 12 Dec 2023 14:17:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702419420; x=1703024220; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=dZ89YvrOqku4UfXm1LiD3M7ba2ZGC3MrhjCGhcqvrpM=; b=PMo1bj+EzKDopEu7dedF3dK2z5Q+EZmfciPbRhOkg/3cOD7LRvuLiBBsIakJLDebvC Vq8hCeeyh3SyLsZSZmrgPI8nanXLvyD8VRmBFBn8X+z107pE2kOxaWgMdsumP4yDiok9 XjyKUUrgddbB1Pixfd3BB7D0BMoQSF6yNNzMTzl+JeTET9ZjiSKXOosz8BZ6RW6LgOGA YovI9967CUsYfQOuK6zlFwrX3UQRgdteMG7YWMgrcvdWyZFZI5sKQb8bGho1ZVShmDwg dvkeQPR0vMf76ErYOjYYQB1+W4Uc1DNp+B2pkVvocH3sPxrXoY0mbNdhRcw293AQDDHA yjwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702419420; x=1703024220; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dZ89YvrOqku4UfXm1LiD3M7ba2ZGC3MrhjCGhcqvrpM=; b=hqVuiGLJcRFJpt15iThBq2zLyXPXCi5QYuKCFZo4xER0Z+CZRBwmyAMDIrmMk1oUNV G+72XgAQJb9wqyjD/kh49Ig+aa/M2ppe4iA/jyuQu7dh+WVNHo2Fe8RyjDQfnSoCWt+V kaQEkj6rCX2oWhdZs5VWHUSai+fbU+4TUEeTnDDQvsvUUhVaazAC0n/eyAk8l+DMsFZh 6bJjRm3RkuaWa/3wNRAF5gDy0Pmy2wMtX5W/Uk7qwTcPNywQRnL2CikJdTDOQctc/OV0 h/ED9/C8iP7nIODDqP7zrtYXHB+OFF4u86iBJKiVIfKsWLKxPyhjdvgmVz6iEfcD48WJ MY+A== X-Gm-Message-State: AOJu0Ywr08JGXVf0EqXbqsKwvC+jFauEaSDPJLe6V+BvlVULvkhEzh87 OYk3uprAjNjdBNibN7lSZz8s7EIZkkA= X-Received: by 2002:a05:600c:3acd:b0:40c:451b:45e0 with SMTP id d13-20020a05600c3acd00b0040c451b45e0mr2270512wms.120.1702419419910; Tue, 12 Dec 2023 14:16:59 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id m11-20020a056000008b00b0033332524235sm11669113wrx.82.2023.12.12.14.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 14:16:59 -0800 (PST) From: Christian Marangi To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Christian Marangi , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] tools/thermal: tmon: add support for cold and critical cold trip point Date: Tue, 12 Dec 2023 23:13:01 +0100 Message-Id: <20231212221301.12581-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231212221301.12581-1-ansuelsmth@gmail.com> References: <20231212221301.12581-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 12 Dec 2023 14:17:11 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785116158195404389 X-GMAIL-MSGID: 1785116158195404389 Add support for cold and critical cold trip point. Add new char to represent these new values. Saddly trip point name initial char can't be used as it does conflicts with the Critical trip name conflicts with them, still a more or less symbolic char is used to represent these new trip points. Use: - N as Negative for Cold trip point - Z as Zero for Critical Cold trip point Signed-off-by: Christian Marangi --- tools/thermal/tmon/tmon.h | 2 ++ tools/thermal/tmon/tui.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/thermal/tmon/tmon.h b/tools/thermal/tmon/tmon.h index 44d16d778f04..26d1c829af7d 100644 --- a/tools/thermal/tmon/tmon.h +++ b/tools/thermal/tmon/tmon.h @@ -58,6 +58,8 @@ struct cdev_info { enum trip_type { THERMAL_TRIP_CRITICAL, THERMAL_TRIP_HOT, + THERMAL_TRIP_COLD, + THERMAL_TRIP_CRITICAL_COLD, THERMAL_TRIP_PASSIVE, THERMAL_TRIP_ACTIVE, NR_THERMAL_TRIP_TYPE, diff --git a/tools/thermal/tmon/tui.c b/tools/thermal/tmon/tui.c index 031b258667d8..6b58ffa4df6c 100644 --- a/tools/thermal/tmon/tui.c +++ b/tools/thermal/tmon/tui.c @@ -307,7 +307,7 @@ void show_dialogue(void) wattroff(w, A_BOLD); /* print legend at the bottom line */ mvwprintw(w, rows - 2, 1, - "Legend: A=Active, P=Passive, C=Critical"); + "Legend: A=Active, P=Passive, C=Critical, N=Cold, Z=Critical Cold"); wrefresh(dialogue_window); } @@ -535,6 +535,8 @@ static char trip_type_to_char(int type) switch (type) { case THERMAL_TRIP_CRITICAL: return 'C'; case THERMAL_TRIP_HOT: return 'H'; + case THERMAL_TRIP_COLD: return 'N'; + case THERMAL_TRIP_CRITICAL_COLD: return 'Z'; case THERMAL_TRIP_PASSIVE: return 'P'; case THERMAL_TRIP_ACTIVE: return 'A'; default: