From patchwork Thu Jul 7 21:45:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 12910275 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 D9BB4C43334 for ; Thu, 7 Jul 2022 21:45:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236820AbiGGVpX (ORCPT ); Thu, 7 Jul 2022 17:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236462AbiGGVpX (ORCPT ); Thu, 7 Jul 2022 17:45:23 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 221821FCE7 for ; Thu, 7 Jul 2022 14:45:22 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id o19-20020a05600c4fd300b003a0489f414cso27059wmq.4 for ; Thu, 07 Jul 2022 14:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8W1S2KUuL89TqEwWGa5XSTCs1irHk/zbJh1P5bOgERI=; b=SqSqUqxqAI2sKxZVos7Co4QzIGi1f3CN8/Y6ICAv4knomV9jJQ+MzuOIxv5yFphd6Z hyVG1GkLXnkb6p7FUiSyRiDJAX5WjvD8Qk7Vv/77onUSrQTovATWLOll74H8QT+5yxuH 0lyhIrF9N8sG7KRuCeg22lCUNd1sZyjXQeJUtY+GyziIKL0FvTXbDICWaqPJ2YX3LMBG 8P+iBRUe/2VNM3fhQDz0vjO42GAW8HzkntdIuIg+SGLjVsV3w4XKIysOySe/guQZzcTy xSxGBAFaCLVE9w4dg9MC/lvpVi6hcaKYyo+csv4Qr64RYF7r9WEpdI2bVfGzynLPREyu f1sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8W1S2KUuL89TqEwWGa5XSTCs1irHk/zbJh1P5bOgERI=; b=AJy/HYgpiu15Y0/kRBBYkzdY7ZPwXPBjKC7tTMxfnjC0tCo7v1zci5WKoqEr9Gfbt+ yiYsaGrw8Q1wK44exGcEMPJlD67nnuBAfwpq/RrjOZ3A0rTw8kU5OHGLsxinFWXIHBry MVeBO6ure6e3HT139e3fY0FFMaSv+QKndw+Tk0UJ0iYX2HkY2w5Dof3/BNoHUJp2P5CC bVWAp4h9r38m2f4QBLHzOqDlZ7xBb8/yugYc5cFtuLurrPetT2DJrjdK/GSdlp+Dptgf z2MZEWHF5wFC10tAxtH+yMxMC94XxsABucM4y1aHI/K/+4YZxSWXRSir+VLKOCJQ4PLV u3iA== X-Gm-Message-State: AJIora+xl0TJMOKzNOI6n0tbC6l6azeRCTS+3u1Jh1yMsCaBiONxAPMc K50qSc81d6Zo/4CdUAd6NV/32Q== X-Google-Smtp-Source: AGRyM1tjrqDfvJ3OwjEIeWBSGVWnPWDN8kNAeLrt3r/jFFBqrQI8dN8WlH1hLerJFhlzLAzX37zKaA== X-Received: by 2002:a05:600c:35ca:b0:3a2:aee3:a8eb with SMTP id r10-20020a05600c35ca00b003a2aee3a8ebmr7139965wmq.86.1657230320619; Thu, 07 Jul 2022 14:45:20 -0700 (PDT) Received: from localhost.localdomain (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id j11-20020a5d604b000000b0021d87798237sm2417439wrt.20.2022.07.07.14.45.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 14:45:19 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: quic_manafm@quicinc.com, Amit Kucheria , Zhang Rui , linux-pm@vger.kernel.org (open list:THERMAL), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/3] thermal/core: Encapsulate the trip point crossed function Date: Thu, 7 Jul 2022 23:45:11 +0200 Message-Id: <20220707214513.1133506-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The routine where the trip point crossed is detected is a strategic place where different processing will happen. Encapsulate the code in a function, so all specific actions related with a trip point crossed can be grouped. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index cdc0552e8c42..d9f771b15ed8 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -358,6 +358,25 @@ static void handle_critical_trips(struct thermal_zone_device *tz, tz->ops->critical(tz); } +static void handle_thermal_trip_crossed(struct thermal_zone_device *tz, int trip, + int trip_temp, int trip_hyst, enum thermal_trip_type trip_type) +{ + if (tz->last_temperature == THERMAL_TEMP_INVALID) + return; + + if (tz->last_temperature < trip_temp && + tz->temperature >= trip_temp) { + thermal_notify_tz_trip_up(tz->id, trip, + tz->temperature); + } + + if (tz->last_temperature >= trip_temp && + tz->temperature < (trip_temp - trip_hyst)) { + thermal_notify_tz_trip_down(tz->id, trip, + tz->temperature); + } +} + static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) { enum thermal_trip_type type; @@ -372,16 +391,7 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) if (tz->ops->get_trip_hyst) tz->ops->get_trip_hyst(tz, trip, &hyst); - if (tz->last_temperature != THERMAL_TEMP_INVALID) { - if (tz->last_temperature < trip_temp && - tz->temperature >= trip_temp) - thermal_notify_tz_trip_up(tz->id, trip, - tz->temperature); - if (tz->last_temperature >= trip_temp && - tz->temperature < (trip_temp - hyst)) - thermal_notify_tz_trip_down(tz->id, trip, - tz->temperature); - } + handle_thermal_trip_crossed(tz, trip, trip_temp, hyst, type); if (type == THERMAL_TRIP_CRITICAL || type == THERMAL_TRIP_HOT) handle_critical_trips(tz, trip, type); From patchwork Thu Jul 7 21:45:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 12910276 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 1775BC433EF for ; Thu, 7 Jul 2022 21:45:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236876AbiGGVpZ (ORCPT ); Thu, 7 Jul 2022 17:45:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236462AbiGGVpY (ORCPT ); Thu, 7 Jul 2022 17:45:24 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89A531BE81 for ; Thu, 7 Jul 2022 14:45:23 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id o4so28092454wrh.3 for ; Thu, 07 Jul 2022 14:45:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VMSNl4aXxj8gUfbW/Yo0+vXzMXAM2NkamvbFD7ALP70=; b=Kl52qJEdiALhhqnTNTN0eMxx7VJsUaaM04zyR0BWDJf7fBuqigHltRInhQgkgnJOZX pIVGJO7Rb8Pc/o92epk+YnVapuspmLSqlFiJCvu476z1zlrkZXyeZckti+86tMDfZ9Ja 1ncOwJWyCtlmToGnowZYCKLlsZ4UEE1VL+fU57tGnW07/9qzlC4gyu56wh5vD/6NIEvW /LfXHhJQgpT9u5x5sU1Y3kcjNsyXV9AnOT+lx0SWCMU6I0dfBJQsMZNPO7/gAfKUxzgk W+v1Rsciu48jWGrgesS7Z+pCoQGAyqqN3+jDDt6N41mA+W2qubdJo0k35wJaHN9mq8t1 pPow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VMSNl4aXxj8gUfbW/Yo0+vXzMXAM2NkamvbFD7ALP70=; b=u5uxNb7J/sYMqFurpcpczN1gc8MfgfaxJsG0flRzOltSNTBBTferPk5XQZHxZKQ/4p L2sbYGUjqv03/xOoMKBcduv4IZ0JZcxuOgjAHrgR7nFxY4kEQqJh9sQjwYL5KSRzHChI X3zZjn9Aj2+V6rYc9dMpRZ+rLC6syv9iI4jWIWj1Eod18JoTd8+F7kXysz+J7CCzLkHG M/+ACTyoE92zcRiDmkfTZw5snHYVtG6VCS0b/yvwsVRhjP30bXXLQY3goTX4vHxkaMQI vcGkylnQGXexMv63q//LQxOGsEZoaOxoPEchcGjCp0n2Rv2xT1WcTcKYMGSHh1bxaIXU WcPg== X-Gm-Message-State: AJIora/ODMfNT8O02rZ2+I+2symqn0+1NfrlWr9eN98XpiVmsrSHr7Kg HLQDp5sTJJ4OKWsO+ParRHjRDA== X-Google-Smtp-Source: AGRyM1vfjGmJa2TKGa1NYBlA4z9HK6Y3AfPmRdtufUCZ4qLbX4jWtbfaNv720SkcvTrXeq3j0+WJ1g== X-Received: by 2002:a05:6000:2cb:b0:21d:7760:778c with SMTP id o11-20020a05600002cb00b0021d7760778cmr13961374wry.329.1657230322023; Thu, 07 Jul 2022 14:45:22 -0700 (PDT) Received: from localhost.localdomain (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id j11-20020a5d604b000000b0021d87798237sm2417439wrt.20.2022.07.07.14.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 14:45:21 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: quic_manafm@quicinc.com, Amit Kucheria , Zhang Rui , linux-pm@vger.kernel.org (open list:THERMAL), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/3] thermal/core: Passing a parameter instead of calling the function again Date: Thu, 7 Jul 2022 23:45:12 +0200 Message-Id: <20220707214513.1133506-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220707214513.1133506-1-daniel.lezcano@linaro.org> References: <20220707214513.1133506-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org As the trip temperature is already available when calling the function, pass it as a parameter instead of having the function calling the ops again to retrieve the same data. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index d9f771b15ed8..f66036b3daae 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -340,12 +340,8 @@ void thermal_zone_device_critical(struct thermal_zone_device *tz) EXPORT_SYMBOL(thermal_zone_device_critical); static void handle_critical_trips(struct thermal_zone_device *tz, - int trip, enum thermal_trip_type trip_type) + int trip, int trip_temp, enum thermal_trip_type trip_type) { - int trip_temp; - - tz->ops->get_trip_temp(tz, trip, &trip_temp); - /* If we have not crossed the trip_temp, we do not care. */ if (trip_temp <= 0 || tz->temperature < trip_temp) return; @@ -394,7 +390,7 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) handle_thermal_trip_crossed(tz, trip, trip_temp, hyst, type); if (type == THERMAL_TRIP_CRITICAL || type == THERMAL_TRIP_HOT) - handle_critical_trips(tz, trip, type); + handle_critical_trips(tz, trip, trip_temp, type); else handle_non_critical_trips(tz, trip); /* From patchwork Thu Jul 7 21:45:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 12910277 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 BD7A4C43334 for ; Thu, 7 Jul 2022 21:45:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236626AbiGGVp0 (ORCPT ); Thu, 7 Jul 2022 17:45:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236246AbiGGVpZ (ORCPT ); Thu, 7 Jul 2022 17:45:25 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DA031BE81 for ; Thu, 7 Jul 2022 14:45:25 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id a5so13398868wrx.12 for ; Thu, 07 Jul 2022 14:45:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EgPd6GhWpNC2cJZPhZQU4S/SGf/TiSE8ghvP1JzSEEE=; b=rUk2SFd6lgY+oU7z75O1tJexnI7cA7wY1b+2/TI/oXFupPTOjP8K9ik04VMR3s1jKj kNxHmu39aYokuBGF2gqJ7WfsBRuezAYVAYuQNAy2+FBCug/TRSwdeRLoxnnKYQC34omK s2uBdfp/MhbVzqt/H9l4L8SRe3gIauZ+nh79wfWw6ZvnWxzYBLxvPevhjlmDZuzl3lsN nBTrd8e1zdmTDbTKondAnQbnLqgFwR7T6oxZqqZYZWE526Urd0/Stf8SldE88CRiR78V iPRgB5cL62wxQh4tQHa9bhmXCOEZA/nWIcO65JM9Od1kKhzrnVStSZSK9cR2gXpDpMIh XeZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EgPd6GhWpNC2cJZPhZQU4S/SGf/TiSE8ghvP1JzSEEE=; b=FqE0cG38aMc3Ot8qBg1Fr571SXtKzyVNFyZwWqgjZx6L3PPP+CbmDokTUJiIgYPpWM VyfB9jU8NgTHeMA2XM7/EAKb4QBZzGFT+K6hgnuqMHMYgRr0Np/UZ8/mir58M/nYc7Sl I5W2CKLF6VK/LHYWuHlPtCRNHHgF8x0HFUxz4k+0X2507WICV3ANJl/WP5wm+uh6vvRZ gdrFaBspfZG62yxBuUnPPyfQ82JVpxf4uBY4L9+p5TRFhpu4gUbvviaZ6aBBNZtnkojz lWjC4RtsUzI5qEvt4MixkoHFCwAedKqRT2SsjUWc6DVLvCZl/QLcYtFBqrfVvDbvSoaS 0ZaA== X-Gm-Message-State: AJIora/SQC/RYclFWzmyh+YHWxRaYyxRBBbwL/AY9nxKoe3pygZsoe3e DQ1RVb77AFo6G/OTN3wAkpFxgg== X-Google-Smtp-Source: AGRyM1uTqzpkOCHuNbnuQeY/tdZWD6SZrX4x0gfwprILsh3oft9iYU5lLF/2S98mPgXAKuYMc02oPQ== X-Received: by 2002:adf:dc09:0:b0:218:5f6a:f5db with SMTP id t9-20020adfdc09000000b002185f6af5dbmr14400wri.480.1657230323385; Thu, 07 Jul 2022 14:45:23 -0700 (PDT) Received: from localhost.localdomain (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id j11-20020a5d604b000000b0021d87798237sm2417439wrt.20.2022.07.07.14.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 14:45:22 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: quic_manafm@quicinc.com, Amit Kucheria , Zhang Rui , linux-pm@vger.kernel.org (open list:THERMAL), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/3] thermal/core: Fix thermal trip cross point Date: Thu, 7 Jul 2022 23:45:13 +0200 Message-Id: <20220707214513.1133506-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220707214513.1133506-1-daniel.lezcano@linaro.org> References: <20220707214513.1133506-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The routine doing trip point crossing the way up or down is actually wrong. A trip point is composed with a trip temperature and a hysteresis. The trip temperature is used to detect when the trip point is crossed the way up. The trip temperature minus the hysteresis is used to detect when the trip point is crossed the way down. |-----------low--------high------------| |<--------->| | hyst | | | | -|--> crossed the way up | <---|-- crossed the way down For that, there is a two point comparison: the current temperature and the previous temperature. The actual code assumes if the current temperature is greater than the trip temperature and the previous temperature was lesser, then the trip point is crossed the way up. That is true only if we crossed the way down the low temperature boundary from the previous temperature or if the hysteresis is zero. The temperature can decrease between the low and high, so the trip point is not crossed the way down and then increase again and cross the high temperature raising a new trip point crossed detection which is incorrect. The same scenario happens when crossing the way down. The trip point crossing the way up and down must act as parenthesis, a trip point down must close a trip point up. Today we have multiple trip point up without the corresponding trip point down. In order to fix that, we store the previous trip point which gives the information about the previous trip. As a sidenote, the thermal_zone_device structure has already the prev_trip_low and prev_trip_high information which are used by the thermal_zone_set_trips() function. This one can be changed to be triggered by the trip temperature crossing function, which makes more sense, and the two fields will disappear. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 32 ++++++++++++++++++++++---------- include/linux/thermal.h | 2 ++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index f66036b3daae..92bc9ddb6904 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -357,19 +357,30 @@ static void handle_critical_trips(struct thermal_zone_device *tz, static void handle_thermal_trip_crossed(struct thermal_zone_device *tz, int trip, int trip_temp, int trip_hyst, enum thermal_trip_type trip_type) { + int trip_low_temp = trip_temp - trip_hyst; + if (tz->last_temperature == THERMAL_TEMP_INVALID) return; - if (tz->last_temperature < trip_temp && - tz->temperature >= trip_temp) { - thermal_notify_tz_trip_up(tz->id, trip, - tz->temperature); - } - - if (tz->last_temperature >= trip_temp && - tz->temperature < (trip_temp - trip_hyst)) { - thermal_notify_tz_trip_down(tz->id, trip, - tz->temperature); + /* + * Due to the hysteresis, a third information is needed to + * detect when the temperature is wavering between the + * trip_low_temp and the trip_temp. A trip point is crossed + * the way up only if the temperature is above it while the + * previous temperature was below *and* we crossed the + * trip_temp_low before. The previous trip point give us the + * previous trip point transition. The similar problem exists + * when crossing the way down. + */ + if (tz->last_temperature < trip_temp && tz->temperature >= trip_temp && + trip != tz->prev_trip) { + thermal_notify_tz_trip_up(tz->id, trip, tz->temperature); + tz->prev_trip = trip; + + } else if (tz->last_temperature >= trip_low_temp && tz->temperature < trip_low_temp && + trip == tz->prev_trip) { + thermal_notify_tz_trip_down(tz->id, trip, tz->temperature); + tz->prev_trip = trip - 1; } } @@ -427,6 +438,7 @@ static void thermal_zone_device_init(struct thermal_zone_device *tz) { struct thermal_instance *pos; tz->temperature = THERMAL_TEMP_INVALID; + tz->prev_trip = -1; tz->prev_low_trip = -INT_MAX; tz->prev_high_trip = INT_MAX; list_for_each_entry(pos, &tz->thermal_instances, tz_node) diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 231bac2768fb..5b3bfb902d10 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -124,6 +124,7 @@ struct thermal_cooling_device { * @last_temperature: previous temperature read * @emul_temperature: emulated temperature when using CONFIG_THERMAL_EMULATION * @passive: 1 if you've crossed a passive trip point, 0 otherwise. + * @prev_trip: previous trip point the thermal zone was, -1 if below all of them * @prev_low_trip: the low current temperature if you've crossed a passive trip point. * @prev_high_trip: the above current temperature if you've crossed a @@ -159,6 +160,7 @@ struct thermal_zone_device { int last_temperature; int emul_temperature; int passive; + int prev_trip; int prev_low_trip; int prev_high_trip; atomic_t need_update;