From patchwork Thu Sep 17 03:22:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781353 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5BF27618 for ; Thu, 17 Sep 2020 03:28:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B85C208E4 for ; Thu, 17 Sep 2020 03:28:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kPWL4eCu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726269AbgIQD2b (ORCPT ); Wed, 16 Sep 2020 23:28:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbgIQD2T (ORCPT ); Wed, 16 Sep 2020 23:28:19 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16975C061351 for ; Wed, 16 Sep 2020 20:22:29 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id w186so888751qkd.1 for ; Wed, 16 Sep 2020 20:22:29 -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=gOjR8vxr5WwVeS1m/lfV7tbojY1ErwXvE0dsI9QW/uo=; b=kPWL4eCuolVXw35vyUzORP0/S/rIAepUZMAvp7ZZdAhaDRpkH1E25kh74NGxkqvub6 EHm7NsrHU7o8gAX4/7USoUt2l7awOKN6znJPoujEb9pcEkXkf6C0D+fZuW4s0eA0dKsL pYXjrlIcUsEe2LpunJ4kvAnWvvQSJ0NCJSXQ4dZ8R62GQw9TYY0cgCnEM+cmgHMfsMIu kLYLB+SnzfkuWKUf2lRGiJxt4TWy94+YT0h203bINrOr9nJvTELxnsSvjonnFlzPTfwb wyJcbIu0O1rtvGkQT61nfZ0I77Foo3LV8MySGrc2Vvt7r7QD1ULzvuaTFiGDgnFfq+/5 DTHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gOjR8vxr5WwVeS1m/lfV7tbojY1ErwXvE0dsI9QW/uo=; b=M+9YEN/uJAbYqdmcquoHg+tt5jiYT53eQqTKRNNOBcGCqlPKXJB+5xo3ksNq9Mpwey zbE/ZRFVO1VNQ2+/HVleIb0w62phxX6WIl4R0wyH/Dyi3y2YFB344LsM87KtX5auGwdZ eUmMbz3cMTdAjH8YLO8rHNYM1xJs+M3gcBFrvdB15vMEZg6w2H8OlWRSjmnZJB86FB4h d5ZMINsrZuUeckQOl46FARrQLmHR1q5J3Zkw4JxnRXQR6auxdr9MY+XtbuyYb6fBuPXK 574mOov5AuIIKSxSYCSxklUhFEuA0KUjO78wgcaTAxPfnT9U61XF6XXp6SZ2xTYYuFzP nDFg== X-Gm-Message-State: AOAM532Z0YCul0WNxweXbOYySYrxhs5sMI62XaRhQ1X6O7DyF/BVdnwX sJYD/xmRH0+rF6Xdta2aJhpJ/A== X-Google-Smtp-Source: ABdhPJwrZ4vSxdjRvdBIWTFXormzDUQW/UqI1T+x0gkPM8a4jmLPzyFxrDQyZ0xg8jAV6ESq5T3LxQ== X-Received: by 2002:a37:5042:: with SMTP id e63mr25056428qkb.453.1600312948930; Wed, 16 Sep 2020 20:22:28 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id g45sm21370801qtb.60.2020.09.16.20.22.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:28 -0700 (PDT) From: Thara Gopinath To: rui.zhang@intel.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, agross@kernel.org, bjorn.andersson@linaro.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, lukasz.luba@arm.com, amitk@kernel.org Subject: [PATCH RFC 1/8] dt-bindings: thermal: Introduce monitor-falling parameter to thermal trip point binding Date: Wed, 16 Sep 2020 23:22:19 -0400 Message-Id: <20200917032226.820371-2-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200917032226.820371-1-thara.gopinath@linaro.org> References: <20200917032226.820371-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Introduce a new binding parameter to thermal trip point description to indicate whether the temperature level specified by the trip point is monitored for a rise or fall in temperature. Signed-off-by: Thara Gopinath --- .../devicetree/bindings/thermal/thermal-zones.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml index 3ec9cc87ec50..cc1332ad6c16 100644 --- a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml +++ b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml @@ -161,6 +161,13 @@ patternProperties: The active trip type can be used to control other HW to help in cooling e.g. fans can be sped up or slowed down + monitor-falling: + description: | + boolean, If true, the trip point is being monitored for + falling temperature. If false/absent/default, the trip + point is being monitored for rising temperature. + type: boolean + required: - temperature - hysteresis From patchwork Thu Sep 17 03:22:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781347 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68186139F for ; Thu, 17 Sep 2020 03:28:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E5AF206D4 for ; Thu, 17 Sep 2020 03:28:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iYF9saol" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726196AbgIQD2H (ORCPT ); Wed, 16 Sep 2020 23:28:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726135AbgIQD2F (ORCPT ); Wed, 16 Sep 2020 23:28:05 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7C69C061355 for ; Wed, 16 Sep 2020 20:22:30 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id f142so816528qke.13 for ; Wed, 16 Sep 2020 20:22:30 -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=myxUO6gc+lFpyY6bxPaw2oxrXJNbpjbu9J+ggDGNP1Q=; b=iYF9saol7Uya9S+s+a5H00YbWk1vk/5ld+bL+/IoAQzNJ84leuLdIk4WZKQoc3IjJ7 458Luy1hzBiiGiPzkWs+JegOxXStBqnEASvcNydckoGa7tcJ7F3c14FGQttP7joLwjfZ qw1Eohni5Xmwr8EyOfpZyf2VSI2daffRU4FDuOU+ocHwwIEy8SsNZ8E3bJqTDd9NxNKz N1zHygoqOkMvs+n02vrxFKxNZrzLWawNw/FjF74zU0xzcGLt7BkPLhyCZ0MY8D39DkVl xia9YMQcIYE6ykJstBekisdhdf0vr588cfSuqVv09iHwjh9ydJg5kh0OXIX+1akr4yqs kD+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=myxUO6gc+lFpyY6bxPaw2oxrXJNbpjbu9J+ggDGNP1Q=; b=H1DYuApmHAmdfO29zbAaZvI4yLldCbkPnPYVbGdcV6l/aXuxpbACdo4vdlWvwpt5R6 nqddaj3fItO97gXPduYLSsRjjue7ldLcmAsNgfBUSAMElfFTledGOApUsNzrtaEYrfqD 4Hp3vGokBfc3db7BsMCHthgVBwiwGBRFp92n39VbciycHKgKEOXttUao/tEYeQQUuClG ymiJYAZM5h4W0EWMU6X8WU850ZVYjQke1tIiTaIQNvVWYH9tVWd+6/CE/aoEXzmvvtF2 vv445+G9XLE68+JF6DAcOk45p24DwsnZ1eTHT7gZtBpf+/r9A7tZhf4fEpENfxYP1pCE z4Mg== X-Gm-Message-State: AOAM5319wVX1taA0Yfzr8x/ijGai7QOWDkly6T6L+li159udh8MFLP2x z6voCGshJbFf0KLKXdKv9uxuEQ== X-Google-Smtp-Source: ABdhPJyC733LwHdlOPKyh0SJj9Ov7zceVdFCYbRyxyeI44PNS39rWktdOG6zOgaxjUTzbgJIqt7rUg== X-Received: by 2002:ae9:c310:: with SMTP id n16mr11085776qkg.318.1600312949899; Wed, 16 Sep 2020 20:22:29 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id g45sm21370801qtb.60.2020.09.16.20.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:29 -0700 (PDT) From: Thara Gopinath To: rui.zhang@intel.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, agross@kernel.org, bjorn.andersson@linaro.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, lukasz.luba@arm.com, amitk@kernel.org Subject: [PATCH RFC 2/8] thermal: Introduce new property monitor_type for trip point. Date: Wed, 16 Sep 2020 23:22:20 -0400 Message-Id: <20200917032226.820371-3-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200917032226.820371-1-thara.gopinath@linaro.org> References: <20200917032226.820371-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Thermal trip points can be defined to indicate whether a temperature rise or a temperature fall is to be monitored. This property can now be defined in the DT bindings for a trip point. To support this following three changes are introduced to thermal core and sysfs code. 1. Define a new variable in thermal_trip to capture the monitor rising/falling information from trip point DT bindings. 2. Define a new ops in thermal_zone_device_ops that can be populated to indicate whether a trip is being monitored for rising or falling temperature. If the ops is not populated or if the binding is missing in the DT, it is assumed that the trip is being monitored for rising temperature. (default behavior today) Signed-off-by: Thara Gopinath --- drivers/thermal/thermal_core.h | 2 ++ include/linux/thermal.h | 2 ++ include/uapi/linux/thermal.h | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index e00fc5585ea8..c56addfe2284 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -77,12 +77,14 @@ int power_actor_set_power(struct thermal_cooling_device *cdev, * @temperature: temperature value in miliCelsius * @hysteresis: relative hysteresis in miliCelsius * @type: trip point type + * @monitor_type: trip point monitor type */ struct thermal_trip { struct device_node *np; int temperature; int hysteresis; enum thermal_trip_type type; + enum thermal_trip_monitor_type monitor_type; }; int get_tz_trend(struct thermal_zone_device *tz, int trip); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 42ef807e5d84..a50ed958d0bd 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -72,6 +72,8 @@ struct thermal_zone_device_ops { int (*set_trip_temp) (struct thermal_zone_device *, int, int); int (*get_trip_hyst) (struct thermal_zone_device *, int, int *); int (*set_trip_hyst) (struct thermal_zone_device *, int, int); + int (*get_trip_mon_type)(struct thermal_zone_device *, int, + enum thermal_trip_monitor_type *); int (*get_crit_temp) (struct thermal_zone_device *, int *); int (*set_emul_temp) (struct thermal_zone_device *, int); int (*get_trend) (struct thermal_zone_device *, int, diff --git a/include/uapi/linux/thermal.h b/include/uapi/linux/thermal.h index c105054cbb57..d3bb4e4fad69 100644 --- a/include/uapi/linux/thermal.h +++ b/include/uapi/linux/thermal.h @@ -16,6 +16,11 @@ enum thermal_trip_type { THERMAL_TRIP_CRITICAL, }; +enum thermal_trip_monitor_type { + THERMAL_TRIP_MONITOR_RISING = 0, + THERMAL_TRIP_MONITOR_FALLING +}; + /* Adding event notification support elements */ #define THERMAL_GENL_FAMILY_NAME "thermal" #define THERMAL_GENL_VERSION 0x01 From patchwork Thu Sep 17 03:22:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781359 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12E9B618 for ; Thu, 17 Sep 2020 03:28:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECD3721974 for ; Thu, 17 Sep 2020 03:28:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZjT3HZ9I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726217AbgIQD2T (ORCPT ); Wed, 16 Sep 2020 23:28:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgIQD2P (ORCPT ); Wed, 16 Sep 2020 23:28:15 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F481C0612F2 for ; Wed, 16 Sep 2020 20:22:31 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id b2so783352qtp.8 for ; Wed, 16 Sep 2020 20:22:31 -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=1NcquyWzHDIuJiug62gYGv91t6olYNR2dy8wB4N3YW8=; b=ZjT3HZ9IWjRR2EMUmN6dGhhCAsiNbkb1deW8KLeL6QC+L2ejiNBxDXnA6PoXafOEeA 8hQzQMOism0hxclUr6bt1SZwSU6oplOEAFDa6VmagRr/5wXMtw9cpwwDW593D7M5vGOG +iwNVaWP8BEWDAIOR6fFPTyXAt1YbO69uuoyUUAX0FwirgmlXHYeInYlJIFf6/44gRd6 t5fqMzOMJocRgAb0SsdQQXsy+qN/oIm2sTU8S/kehGc6KzlLNVuFgIItfaFfCpt0Azcp yJlAAUi2gNynmw7ku7zJLgHuQ5CDWtpJiqsFn/FGPV257NxWv0MAK+/sM9DAUPfgp/xG uJHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1NcquyWzHDIuJiug62gYGv91t6olYNR2dy8wB4N3YW8=; b=Py7m/4FWpNx5iBgdH1IcwYK7f2DdUGiS0gSRdh4G/bF3oo+0MiwtTeiuEt+Bz1CBt3 s/MP8tANTXp63UUymjXxMr2EJ9CLjp7Og7+p9XQnIQZ3F4zVnoZnsa4XKf0by6eGDrI7 T7isTlqEayh/R6BD2sz9ESbj4J4/8ZpTyjDAHcqLzAuFpNk7bgU7zWtVCotU5Uz8wj4+ qzJkRjWJK1lc3C5QNjIphCwNBcOdFY2pAQXGylNCg4UIzjRgK9hDeh99IHucnPZ7Y9Pk qQHYgT4XAp6VGHpkdD+V4lvFJRA/VD7WJQBUWE3zcnvmYpbmilAat8b/PBqfBkZnhAET WWuQ== X-Gm-Message-State: AOAM533akT/ZX23QdBrr7UV55L5+cYbqNXQGCzoGow0xr6b6kL/4zchK yzpKcsuwIxR9A2Npc7kNot3mqw== X-Google-Smtp-Source: ABdhPJxxKJdjeTdjjcubP0PRHZMaX20uEdalLcV/FelHR/61pinL+LUVDzaruFtZmWuBsDezydob+w== X-Received: by 2002:ac8:c47:: with SMTP id l7mr26784465qti.112.1600312950684; Wed, 16 Sep 2020 20:22:30 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id g45sm21370801qtb.60.2020.09.16.20.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:30 -0700 (PDT) From: Thara Gopinath To: rui.zhang@intel.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, agross@kernel.org, bjorn.andersson@linaro.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, lukasz.luba@arm.com, amitk@kernel.org Subject: [PATCH RFC 3/8] thermal: thermal_of: Extend thermal dt driver to support bi-directional monitoring of a thermal trip point. Date: Wed, 16 Sep 2020 23:22:21 -0400 Message-Id: <20200917032226.820371-4-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200917032226.820371-1-thara.gopinath@linaro.org> References: <20200917032226.820371-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Introduce of_thermal_get_trip_monitor_type to return the direction of monitoring of a thermal trip point. Also translate the DT information regarding trip point monitor direction into the thermal framework. Signed-off-by: Thara Gopinath --- drivers/thermal/thermal_of.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 69ef12f852b7..5bc7f5bab772 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -328,6 +328,20 @@ static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip, return 0; } +static int of_thermal_get_trip_monitor_type + (struct thermal_zone_device *tz, int trip, + enum thermal_trip_monitor_type *type) +{ + struct __thermal_zone *data = tz->devdata; + + if (trip >= data->ntrips || trip < 0) + return -EDOM; + + *type = data->trips[trip].monitor_type; + + return 0; +} + static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip, int hyst) { @@ -363,6 +377,7 @@ static struct thermal_zone_device_ops of_thermal_ops = { .set_trip_temp = of_thermal_set_trip_temp, .get_trip_hyst = of_thermal_get_trip_hyst, .set_trip_hyst = of_thermal_set_trip_hyst, + .get_trip_mon_type = of_thermal_get_trip_monitor_type, .get_crit_temp = of_thermal_get_crit_temp, .bind = of_thermal_bind, @@ -801,6 +816,7 @@ static int thermal_of_populate_trip(struct device_node *np, { int prop; int ret; + bool is_monitor_falling; ret = of_property_read_u32(np, "temperature", &prop); if (ret < 0) { @@ -822,6 +838,12 @@ static int thermal_of_populate_trip(struct device_node *np, return ret; } + ret = of_property_read_bool(np, "monitor-falling"); + if (is_monitor_falling) + trip->monitor_type = THERMAL_TRIP_MONITOR_FALLING; + else + trip->monitor_type = THERMAL_TRIP_MONITOR_RISING; + /* Required for cooling map matching */ trip->np = np; of_node_get(np); From patchwork Thu Sep 17 03:22:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781367 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 876E3139F for ; Thu, 17 Sep 2020 03:28:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CC4A221E3 for ; Thu, 17 Sep 2020 03:28:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NyQoaVEh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726291AbgIQD2z (ORCPT ); Wed, 16 Sep 2020 23:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726115AbgIQD2S (ORCPT ); Wed, 16 Sep 2020 23:28:18 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64F81C06121F for ; Wed, 16 Sep 2020 20:22:32 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id n10so809086qtv.3 for ; Wed, 16 Sep 2020 20:22:32 -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=91xhdh0yMbg0WvS++faa8p3tfvFulTbKZKHM2XlY74k=; b=NyQoaVEhlCnIGRqdp321BmI4p2RYV5GPrX3iVW7IPq2tfUJ57cCEZoreEVlu1lbBWZ su5ozIUlgC8gHb1OaMDzEmpfZfLbFTBsoBBLxSNI2Lxcu6VABPH3NcjEYfo1nDSaG5+T oQCuRKV7f8ON4HPr3U6JmB1C09O990Js8g/DDiXG1W0NUbgyhXcWYKETNJcA2zSqDqT2 XkFyfa2T8xEvcAa1fMWzS4jPSjM7XhXkCqIubKkeJ7/1idKK8LLzoxuW7253bFWkJBA/ xy5ZyEK+L0Tx9r3N2KwW5hlwSiLLSyNC1jEWIuTeHNKy4xO4PNjiVvJwHMV63sKQFG2I 9X/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=91xhdh0yMbg0WvS++faa8p3tfvFulTbKZKHM2XlY74k=; b=kB3Z8lx5Pnp1/SPKum+sNC25rNHmmHSeaK1tWZkGebS44+I9BGdifv5xukToXRTcsS 53gT+PEXjLSbeaFdxNkk2ahNCb5p9LVfrJp/J6yjX1S0QEWB7VF6BTiWR6Icy05qe0fG ogWEhYmwONt4JxWjE5buqMl7Gwu7yKutjfZYR4ty75k3fHAR8S4+5g31cs36vUTozNU8 87YCVyrbqZpKhDqfH7292zBdXMlIwdk9XqHROMyVv2oDhFZoUTv2ByedDtiHgFLmQKRL Dghn6YYVteUMyf6BIZ9Soold2BhgBugS35UcG2xefMMrJmcpZHe6efHIicLid1CS3P7J Ec9g== X-Gm-Message-State: AOAM531HDmS2ommqhQDg4SUqPWm0PdD3UosRazRXhyVZuuBGE4w9ceAK pich4XQEPRRikRtDWKAStNqVBA== X-Google-Smtp-Source: ABdhPJzGVKbFfyn5rK7FIWROKX5Y6Ozb4GkKmDTocfvmrnEQHqR5zV7FnxxIy6zJL/wOmfKrZcsJSg== X-Received: by 2002:ac8:75ca:: with SMTP id z10mr13718611qtq.345.1600312951689; Wed, 16 Sep 2020 20:22:31 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id g45sm21370801qtb.60.2020.09.16.20.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:31 -0700 (PDT) From: Thara Gopinath To: rui.zhang@intel.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, agross@kernel.org, bjorn.andersson@linaro.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, lukasz.luba@arm.com, amitk@kernel.org Subject: [PATCH RFC 4/8] thermal:core:Add genetlink notifications for monitoring falling temperature Date: Wed, 16 Sep 2020 23:22:22 -0400 Message-Id: <20200917032226.820371-5-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200917032226.820371-1-thara.gopinath@linaro.org> References: <20200917032226.820371-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add notification calls for trip points that are being monitored for falling temperatures. Signed-off-by: Thara Gopinath --- drivers/thermal/thermal_core.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 72bf159bcecc..bfd436379408 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -417,6 +417,7 @@ static void handle_critical_trips(struct thermal_zone_device *tz, static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) { enum thermal_trip_type type; + enum thermal_trip_monitor_type mon_type; int trip_temp, hyst = 0; /* Ignore disabled trip points */ @@ -428,13 +429,25 @@ 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->ops->get_trip_mon_type) + tz->ops->get_trip_mon_type(tz, trip, &mon_type); + 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); - if (tz->last_temperature >= trip_temp && - tz->temperature < (trip_temp - hyst)) - thermal_notify_tz_trip_down(tz->id, trip); + if (mon_type == THERMAL_TRIP_MONITOR_FALLING) { + if (tz->last_temperature > trip_temp && + tz->temperature <= trip_temp) + thermal_notify_tz_trip_down(tz->id, trip); + if (tz->last_temperature <= trip_temp && + tz->temperature > (trip_temp + hyst)) + thermal_notify_tz_trip_up(tz->id, trip); + } else { + if (tz->last_temperature < trip_temp && + tz->temperature >= trip_temp) + thermal_notify_tz_trip_up(tz->id, trip); + if (tz->last_temperature >= trip_temp && + tz->temperature < (trip_temp - hyst)) + thermal_notify_tz_trip_down(tz->id, trip); + } } if (type == THERMAL_TRIP_CRITICAL || type == THERMAL_TRIP_HOT) From patchwork Thu Sep 17 03:22:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781375 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03661618 for ; Thu, 17 Sep 2020 03:29:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D8B96206D4 for ; Thu, 17 Sep 2020 03:29:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TMVcDNfE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726169AbgIQD3E (ORCPT ); Wed, 16 Sep 2020 23:29:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726157AbgIQD2M (ORCPT ); Wed, 16 Sep 2020 23:28:12 -0400 Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 409EBC061223 for ; Wed, 16 Sep 2020 20:22:33 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id p65so815054qtd.2 for ; Wed, 16 Sep 2020 20:22:33 -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=wyquXDsI5PpUswweH/QuIkj+hc4Cb9K+5Ghm5R3vs34=; b=TMVcDNfEewcm+Zlud5OWrLGCMtmG1XeduU2v6C81w3F27mDgOu5Dyjif/uvvhdsYNA ZF8agjfrxmavZWYFccuoVVZlNqDx0D0M8v89KjTasVKsAGJ0woopsXMrlfQW6hml+tj7 HbYKk+7NjJA1wjTkgwVq8paXmKSU7anwXtDDTxJ6UI0n9HIBv1l/7FIFf3nujZ/cMksP D30K4FMm77sR/DQzZYi3o8+kiBT5hGNj53VO3GKFGrms6Ft+lOz/pPXHxlP5KppRbvmu gvcisGJ/2G+AGfGNjBI+cqLJF6D8VAqNrlUesqay0E9Wqa6RHukc2cdU2ZZifdEo+a52 uZkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wyquXDsI5PpUswweH/QuIkj+hc4Cb9K+5Ghm5R3vs34=; b=pZaVUjGTWX3zWHzpNPlxYZEgnYF8kFbG8YfNwkS5k0LwXqJdeH+ejUX1Yrtfm4p92R MaEBzeYaFhZYuVYw/I3d8lWjELsPs+8ylCbi0zvxHKoL9s/UVRvkq4ds2I5p/v/RbE28 ZAtsMFQuX5VaMEWOE2WjSnmVKfeX5ZtFkemRfKiZmyo7hpuOZXTghG41h86nBR9fRxtk QfOCxtOT4Pg9saFcQSwIHUYoEn0VLjIi+QTQU29E8nMVxL9Q6eX/8RU3JsRapzwfJpiP s4y0faIpzQlicDcg/BnTrUK9h8Y6FnyTX5GEhA1eCeZyaVqWHGRI34yuqsM6JThEDKhq 6dQg== X-Gm-Message-State: AOAM533oCbwlV3w9V+ElVTOMqNPpD39AT9CoKlpg5wkE8OwkqV1godY7 1UMNaFs4kz8L7cRKbbYyamx8Uw== X-Google-Smtp-Source: ABdhPJyKE5XKI9TJVppgF3SUV9hJyConQ72DMtIOPoTixmFeCTdqRn/0DKS2tG949jP/2DuCt8Ac/A== X-Received: by 2002:ac8:1108:: with SMTP id c8mr13557566qtj.323.1600312952482; Wed, 16 Sep 2020 20:22:32 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id g45sm21370801qtb.60.2020.09.16.20.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:32 -0700 (PDT) From: Thara Gopinath To: rui.zhang@intel.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, agross@kernel.org, bjorn.andersson@linaro.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, lukasz.luba@arm.com, amitk@kernel.org Subject: [PATCH RFC 5/8] thermal: gov_step_wise: Extend thermal step-wise governor to monitor falling temperature. Date: Wed, 16 Sep 2020 23:22:23 -0400 Message-Id: <20200917032226.820371-6-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200917032226.820371-1-thara.gopinath@linaro.org> References: <20200917032226.820371-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From the step wise governor point of view, the policy decisions that has to taken on a thermal trip point that is defined to be monitored for falling temperature is the mirror opposite of the decisions it has to take on a trip point that is monitored for rising temperature. Signed-off-by: Thara Gopinath --- drivers/thermal/gov_step_wise.c | 62 +++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c index 2ae7198d3067..c036ff7b4fb2 100644 --- a/drivers/thermal/gov_step_wise.c +++ b/drivers/thermal/gov_step_wise.c @@ -35,7 +35,8 @@ * deactivate the thermal instance */ static unsigned long get_target_state(struct thermal_instance *instance, - enum thermal_trend trend, bool throttle) + enum thermal_trend trend, bool throttle, + enum thermal_trip_monitor_type type) { struct thermal_cooling_device *cdev = instance->cdev; unsigned long cur_state; @@ -65,11 +66,24 @@ static unsigned long get_target_state(struct thermal_instance *instance, switch (trend) { case THERMAL_TREND_RAISING: - if (throttle) { - next_target = cur_state < instance->upper ? - (cur_state + 1) : instance->upper; - if (next_target < instance->lower) - next_target = instance->lower; + if (type == THERMAL_TRIP_MONITOR_FALLING) { + if (cur_state <= instance->lower) { + if (!throttle) + next_target = THERMAL_NO_TARGET; + } else { + if (!throttle) { + next_target = cur_state - 1; + if (next_target > instance->upper) + next_target = instance->upper; + } + } + } else { + if (throttle) { + next_target = cur_state < instance->upper ? + (cur_state + 1) : instance->upper; + if (next_target < instance->lower) + next_target = instance->lower; + } } break; case THERMAL_TREND_RAISE_FULL: @@ -77,14 +91,23 @@ static unsigned long get_target_state(struct thermal_instance *instance, next_target = instance->upper; break; case THERMAL_TREND_DROPPING: - if (cur_state <= instance->lower) { - if (!throttle) - next_target = THERMAL_NO_TARGET; + if (type == THERMAL_TRIP_MONITOR_FALLING) { + if (throttle) { + next_target = cur_state < instance->upper ? + (cur_state + 1) : instance->upper; + if (next_target < instance->lower) + next_target = instance->lower; + } } else { - if (!throttle) { - next_target = cur_state - 1; - if (next_target > instance->upper) - next_target = instance->upper; + if (cur_state <= instance->lower) { + if (!throttle) + next_target = THERMAL_NO_TARGET; + } else { + if (!throttle) { + next_target = cur_state - 1; + if (next_target > instance->upper) + next_target = instance->upper; + } } } break; @@ -117,6 +140,8 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) { int trip_temp; enum thermal_trip_type trip_type; + enum thermal_trip_monitor_type monitor_type = + THERMAL_TRIP_MONITOR_RISING; enum thermal_trend trend; struct thermal_instance *instance; bool throttle = false; @@ -130,9 +155,15 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) tz->ops->get_trip_type(tz, trip, &trip_type); } + if (tz->ops->get_trip_mon_type) + tz->ops->get_trip_mon_type(tz, trip, &monitor_type); + trend = get_tz_trend(tz, trip); - if (tz->temperature >= trip_temp) { + if (((monitor_type == THERMAL_TRIP_MONITOR_RISING) && + (tz->temperature >= trip_temp)) || + ((monitor_type == THERMAL_TRIP_MONITOR_FALLING) && + (tz->temperature <= trip_temp))) { throttle = true; trace_thermal_zone_trip(tz, trip, trip_type); } @@ -147,7 +178,8 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) continue; old_target = instance->target; - instance->target = get_target_state(instance, trend, throttle); + instance->target = get_target_state(instance, trend, + throttle, monitor_type); dev_dbg(&instance->cdev->device, "old_target=%d, target=%d\n", old_target, (int)instance->target); From patchwork Thu Sep 17 03:22:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781393 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA88514B7 for ; Thu, 17 Sep 2020 03:29:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CEA1D20872 for ; Thu, 17 Sep 2020 03:29:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Mn11vOjh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726109AbgIQD32 (ORCPT ); Wed, 16 Sep 2020 23:29:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726106AbgIQD2C (ORCPT ); Wed, 16 Sep 2020 23:28:02 -0400 Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0389BC061226 for ; Wed, 16 Sep 2020 20:22:34 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id k25so805625qtu.4 for ; Wed, 16 Sep 2020 20:22:33 -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=qA8w6GQLbaTlzp5n8dcgkY3X2oVEZB3DGcmvh59/aDQ=; b=Mn11vOjh/Pgg9MhlRULSR7tXA6ZixO1ybWFY4R1A5pbm+l+dZi99Ik6Dz8/SFCJOZZ s1YfqhkXUuWOVzORUi9/hJLnBRejNT4uBEiqF1uhwCh+pGVe6rI8/wH0UBySQdONPnu2 yLjurEjdnc0DLZb4vBbq62+ijn8pt4QrMJPhkemj1PrGRBphp12LOpX4opxL05I0RVtj 4O8+mjdNL1tEpF8H1h0qLT9RgAl/fEtohF2mzCGlU5XBR+wBCslchXHtSLCafKXLJPmR zg2SqEEqEGnveFdXk3e4S3pvw9LtRrrTjsExiE6jAfAf8k8PpJCoWkHQ+RQB432IqekD qG9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qA8w6GQLbaTlzp5n8dcgkY3X2oVEZB3DGcmvh59/aDQ=; b=cYiPWgRQjY/DqfQjHz5kSXZTrzdy1isb34UX1Mwz9w0x9HfFKsbwdK0yg/Vq0PCPUC 3FhIgBO5JdYl6Sz/9VDw/xGKGq4Q9JOILmmOKstwc+Z/Txr6u3kf8ia3uG3f4EAj5UiU DtcJZd6BEVLjLq2OxTbGzFWsi6fB+s+sVlQeC8TQpzjZuhxsqvBWHQVnQp1FBoSp5utW 1ZWDeiB173ZMPI5juhUBaykBKdf9Fi3dKU0xY5d2qhpaLeAgZpZ8+vudMghJvzt9/0c3 FVGPL/B+d3T+3tBLs8zP5Zx39z+tIDSLZ99AqehmjpFCUXyVvQDPfoxqkVUPU94sZ1LP FifA== X-Gm-Message-State: AOAM530E+ZpcInS0/4VQtQMxH+PR2x7ZyHDWjvOF7A2MP95m+X98r4p7 UQkr2OcziSE3Vk5iimuUD1urvQ== X-Google-Smtp-Source: ABdhPJwE1MP6yxSojZ/oW1Dvar69y++Fse0YxIRP8jIkfmkccLGWZ2OFc+TBgA+kkS9idIbPZJJT8Q== X-Received: by 2002:ac8:44b5:: with SMTP id a21mr13087829qto.314.1600312953278; Wed, 16 Sep 2020 20:22:33 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id g45sm21370801qtb.60.2020.09.16.20.22.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:32 -0700 (PDT) From: Thara Gopinath To: rui.zhang@intel.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, agross@kernel.org, bjorn.andersson@linaro.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, lukasz.luba@arm.com, amitk@kernel.org Subject: [PATCH RFC 6/8] thermal: Modify thermal governors to do nothing for trip points being monitored for falling temperature Date: Wed, 16 Sep 2020 23:22:24 -0400 Message-Id: <20200917032226.820371-7-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200917032226.820371-1-thara.gopinath@linaro.org> References: <20200917032226.820371-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org For now, thermal governors other than step wise governorr do not support monitoring of falling temperature. Hence, in case of calls to the governor for trip points marked as THERMAL_TRIP_MONITOR_FALLING, return doing nothing. Signed-off-by: Thara Gopinath --- drivers/thermal/gov_bang_bang.c | 12 ++++++++++++ drivers/thermal/gov_fair_share.c | 12 ++++++++++++ drivers/thermal/gov_power_allocator.c | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c index 991a1c54296d..a662047e5961 100644 --- a/drivers/thermal/gov_bang_bang.c +++ b/drivers/thermal/gov_bang_bang.c @@ -99,6 +99,18 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) static int bang_bang_control(struct thermal_zone_device *tz, int trip) { struct thermal_instance *instance; + enum thermal_trip_monitor_type monitor_type = + THERMAL_TRIP_MONITOR_RISING; + + /* + * Return doing nothing if the trip point is monitored for + * falling temperature + */ + if (tz->ops->get_trip_mon_type) { + tz->ops->get_trip_mon_type(tz, trip, &monitor_type); + if (monitor_type == THERMAL_TRIP_MONITOR_FALLING) + return 0; + } thermal_zone_trip_update(tz, trip); diff --git a/drivers/thermal/gov_fair_share.c b/drivers/thermal/gov_fair_share.c index aaa07180ab48..064ad6ed67ad 100644 --- a/drivers/thermal/gov_fair_share.c +++ b/drivers/thermal/gov_fair_share.c @@ -81,6 +81,18 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip) int total_weight = 0; int total_instance = 0; int cur_trip_level = get_trip_level(tz); + enum thermal_trip_monitor_type monitor_type = + THERMAL_TRIP_MONITOR_RISING; + + /* + * Return doing nothing if the trip point is monitored for + * falling temperature + */ + if (tz->ops->get_trip_mon_type) { + tz->ops->get_trip_mon_type(tz, trip, &monitor_type); + if (monitor_type == THERMAL_TRIP_MONITOR_FALLING) + return 0; + } list_for_each_entry(instance, &tz->thermal_instances, tz_node) { if (instance->trip != trip) diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c index 5cb518d8f156..0f674cd1b9b8 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -606,6 +606,8 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) { int ret; int switch_on_temp, control_temp; + enum thermal_trip_monitor_type monitor_type = + THERMAL_TRIP_MONITOR_RISING; struct power_allocator_params *params = tz->governor_data; /* @@ -615,6 +617,16 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) if (trip != params->trip_max_desired_temperature) return 0; + /* + * Return doing nothing if the trip point is monitored for + * falling temperature + */ + if (tz->ops->get_trip_mon_type) { + tz->ops->get_trip_mon_type(tz, trip, &monitor_type); + if (monitor_type == THERMAL_TRIP_MONITOR_FALLING) + return 0; + } + ret = tz->ops->get_trip_temp(tz, params->trip_switch_on, &switch_on_temp); if (!ret && (tz->temperature < switch_on_temp)) { From patchwork Thu Sep 17 03:22:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781345 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4CF6C139F for ; Thu, 17 Sep 2020 03:28:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A781206D4 for ; Thu, 17 Sep 2020 03:28:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DjZr4sFD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726180AbgIQD2E (ORCPT ); Wed, 16 Sep 2020 23:28:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726115AbgIQD2C (ORCPT ); Wed, 16 Sep 2020 23:28:02 -0400 Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08801C0611BD for ; Wed, 16 Sep 2020 20:22:35 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id e7so768376qtj.11 for ; Wed, 16 Sep 2020 20:22:34 -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=01gqkFqr4FQwurKmO2Ck7GaScSK2pTFzpmpWBR1KqGU=; b=DjZr4sFDsbbUKj1uaHdAF9W4Ujbhv51Un18j9AS9uMZoLIwXHcZVEsoQ/3LUjLF37R kOzz8lsiUt9OGW4LKz8auX6fNumu1PA+PhrYM6M/GBek07tO30zzwpcWrbWiZZR2xZ0u sNtL6h8igfE0yYQQDktkCP7xALhwKdwBLXtb4ibt+9Vrlu0lLevRIoc9Mhq/MWVcK8y+ Xi8V5dj0CsAtOF6oPFFuxi+ViYpNojY7kYNS1hxEmAsopv8P79u3u56FpHNW13dCZgRS FeauQl4ILt0cQ7oSFWBTmubdxfvmll8AHyXyXfLwajcoBf5mPWb9dAiRQQMga2qGiHL8 dT6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=01gqkFqr4FQwurKmO2Ck7GaScSK2pTFzpmpWBR1KqGU=; b=I19rdzuHGcdLu9uY4LDA784gTPI7I9XHlOfCkE5OjzeaFSckI7dl7fIZikZJz/qOqi RrAcb9drMs5BZfpAuzER9rylX/7YLEJn0DA4lyv0k8qaeKUYqGdJkGpRNkGOCNln84JL tYZkxN7viuAJ6tgc5kARws5LwRfLuZBbkcEC7Zyk+TVKkvcKWgHLXLZng/c7AuisUetZ wh7n8mf4D+Xe8MLIsRTf9QmvLdmrrlMXtW+7jzuBB+IFcATLYSpnUu4KgLCwre5bUvRw yMAz2Eq85MW0U0/JBZJh9XeIormlxBTucKVnxW/dQpbbp/maUIU7eLGsJ/x6Us/hF58Y C3sA== X-Gm-Message-State: AOAM530Y3+iGi4uLwWEzkyDCss+pLXRe27r7gVQYzQmfw9p5wB1ybT9O 24bC5gX9nQFi/GWs21JYnUrd5A== X-Google-Smtp-Source: ABdhPJxAksp2eSmEPqN5uQeMl3cPNkYvy+YewZ8cg9q71F5mEGRa405mrOEZhL5wL6RqHhxDNGYHPg== X-Received: by 2002:ac8:39a7:: with SMTP id v36mr27385800qte.140.1600312954185; Wed, 16 Sep 2020 20:22:34 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id g45sm21370801qtb.60.2020.09.16.20.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:33 -0700 (PDT) From: Thara Gopinath To: rui.zhang@intel.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, agross@kernel.org, bjorn.andersson@linaro.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, lukasz.luba@arm.com, amitk@kernel.org Subject: [PATCH RFC 7/8] thermal:core: Add is_warming_dev and supporting warming device api's to the cooling dev framework. Date: Wed, 16 Sep 2020 23:22:25 -0400 Message-Id: <20200917032226.820371-8-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200917032226.820371-1-thara.gopinath@linaro.org> References: <20200917032226.820371-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Introduce a variable is_warming_dev to indicate if a "cooling" device is actually a warming device or not. Also introduce api's to register and unregister warming device. This is a temporary patch. If we agree to replace the term "cooling" with "mitigating" (or any other appropriate term) in the thermal framework, this patch can be dropped. Also I have not added warming_device_register api for all the versions of cooling_device_register because devm_thermal_of_warming_device_register is the only api needed in the kernel today as is evident by the next patch in this series. Signed-off-by: Thara Gopinath --- drivers/thermal/thermal_core.c | 88 +++++++++++++++++++++++++++++----- include/linux/thermal.h | 7 +++ 2 files changed, 83 insertions(+), 12 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index bfd436379408..4aae48a80e00 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1101,7 +1101,8 @@ static void bind_cdev(struct thermal_cooling_device *cdev) */ static struct thermal_cooling_device * __thermal_cooling_device_register(struct device_node *np, - const char *type, void *devdata, + const char *type, bool is_warming_dev, + void *devdata, const struct thermal_cooling_device_ops *ops) { struct thermal_cooling_device *cdev; @@ -1134,6 +1135,7 @@ __thermal_cooling_device_register(struct device_node *np, cdev->updated = false; cdev->device.class = &thermal_class; cdev->devdata = devdata; + cdev->is_warming_dev = is_warming_dev; thermal_cooling_device_setup_sysfs(cdev); dev_set_name(&cdev->device, "cooling_device%d", cdev->id); result = device_register(&cdev->device); @@ -1178,7 +1180,7 @@ struct thermal_cooling_device * thermal_cooling_device_register(const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { - return __thermal_cooling_device_register(NULL, type, devdata, ops); + return __thermal_cooling_device_register(NULL, type, false, devdata, ops); } EXPORT_SYMBOL_GPL(thermal_cooling_device_register); @@ -1202,7 +1204,7 @@ thermal_of_cooling_device_register(struct device_node *np, const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { - return __thermal_cooling_device_register(np, type, devdata, ops); + return __thermal_cooling_device_register(np, type, false, devdata, ops); } EXPORT_SYMBOL_GPL(thermal_of_cooling_device_register); @@ -1242,7 +1244,7 @@ devm_thermal_of_cooling_device_register(struct device *dev, if (!ptr) return ERR_PTR(-ENOMEM); - tcd = __thermal_cooling_device_register(np, type, devdata, ops); + tcd = __thermal_cooling_device_register(np, type, false, devdata, ops); if (IS_ERR(tcd)) { devres_free(ptr); return tcd; @@ -1255,6 +1257,49 @@ devm_thermal_of_cooling_device_register(struct device *dev, } EXPORT_SYMBOL_GPL(devm_thermal_of_cooling_device_register); +/** + * devm_thermal_of_warming_device_register() - register an OF thermal warming + * device + * @dev: a valid struct device pointer of a sensor device. + * @np: a pointer to a device tree node. + * @type: the thermal cooling device type. + * @devdata: device private data. + * @ops: standard thermal cooling devices callbacks. + * + * This function will register a warming device with device tree node reference. + * This interface function adds a new thermal warming device (fan/processor/...) + * to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself + * to all the thermal zone devices registered at the same time. + * + * Return: a pointer to the created struct thermal_cooling_device or an + * ERR_PTR. Caller must check return value with IS_ERR*() helpers. + */ +struct thermal_cooling_device * +devm_thermal_of_warming_device_register(struct device *dev, + struct device_node *np, + char *type, void *devdata, + const struct thermal_cooling_device_ops *ops) +{ + struct thermal_cooling_device **ptr, *tcd; + + ptr = devres_alloc(thermal_cooling_device_release, sizeof(*ptr), + GFP_KERNEL); + if (!ptr) + return ERR_PTR(-ENOMEM); + + tcd = __thermal_cooling_device_register(np, type, true, devdata, ops); + if (IS_ERR(tcd)) { + devres_free(ptr); + return tcd; + } + + *ptr = tcd; + devres_add(dev, ptr); + + return tcd; +} +EXPORT_SYMBOL_GPL(devm_thermal_of_warming_device_register); + static void __unbind(struct thermal_zone_device *tz, int mask, struct thermal_cooling_device *cdev) { @@ -1265,14 +1310,8 @@ static void __unbind(struct thermal_zone_device *tz, int mask, thermal_zone_unbind_cooling_device(tz, i, cdev); } -/** - * thermal_cooling_device_unregister - removes a thermal cooling device - * @cdev: the thermal cooling device to remove. - * - * thermal_cooling_device_unregister() must be called when a registered - * thermal cooling device is no longer needed. - */ -void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) +static void +__thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) { int i; const struct thermal_zone_params *tzp; @@ -1319,8 +1358,33 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) thermal_cooling_device_destroy_sysfs(cdev); put_device(&cdev->device); } + +/** + * thermal_cooling_device_unregister - removes a thermal cooling device + * @cdev: the thermal cooling device to remove. + * + * thermal_cooling_device_unregister() must be called when a registered + * thermal cooling device is no longer needed. + */ +void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) +{ + __thermal_cooling_device_unregister(cdev); +} EXPORT_SYMBOL_GPL(thermal_cooling_device_unregister); +/** + * thermal_warming_device_unregister - removes a thermal warming device + * @cdev: the thermal warming device to remove. + * + * thermal_warming_device_unregister() must be called when a registered + * thermal warming device is no longer needed. + */ +void thermal_warming_device_unregister(struct thermal_cooling_device *cdev) +{ + __thermal_cooling_device_unregister(cdev); +} +EXPORT_SYMBOL_GPL(thermal_warming_device_unregister); + static void bind_tz(struct thermal_zone_device *tz) { int i, ret; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index a50ed958d0bd..455120f485dd 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -96,6 +96,7 @@ struct thermal_cooling_device_ops { struct thermal_cooling_device { int id; + bool is_warming_dev; char type[THERMAL_NAME_LENGTH]; struct device device; struct device_node *np; @@ -393,7 +394,13 @@ devm_thermal_of_cooling_device_register(struct device *dev, struct device_node *np, char *type, void *devdata, const struct thermal_cooling_device_ops *ops); +struct thermal_cooling_device * +devm_thermal_of_warming_device_register(struct device *dev, + struct device_node *np, + char *type, void *devdata, + const struct thermal_cooling_device_ops *ops); void thermal_cooling_device_unregister(struct thermal_cooling_device *); +void thermal_warming_device_unregister(struct thermal_cooling_device *); struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name); int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp); int thermal_zone_get_slope(struct thermal_zone_device *tz); From patchwork Thu Sep 17 03:22:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781387 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 035B814B7 for ; Thu, 17 Sep 2020 03:29:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D8DA82137B for ; Thu, 17 Sep 2020 03:29:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WgQWIsUl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726151AbgIQD3R (ORCPT ); Wed, 16 Sep 2020 23:29:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726142AbgIQD2G (ORCPT ); Wed, 16 Sep 2020 23:28:06 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0114C061A10 for ; Wed, 16 Sep 2020 20:22:35 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id n10so809163qtv.3 for ; Wed, 16 Sep 2020 20:22:35 -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=7uYlLNN0UyKBRIab8OLOITLg387YzzBqmIZv+ipj1Bk=; b=WgQWIsUlbXN3VVXSecXh6NSwzMBUdXegJ1UbE5dZ5hL0zTZqMnJXK3IU1YodWCoeuB Y4OEpjgNajgPg+yhYvIAF872GecFsE1BgxlzwnqnA2jGT679cwonprKHeJe8p+UZy5J4 r72IIPcyanDumuLDsqhSxQlUc1HrTMomgmZd3gWrEDjF51lbPdFbSTdtKnYDJe3bi49z HEdjA9fmvjxIv9m2vCLCmsz7H6ZD+ixW5RTucdXqj8nak9ZZl5Ra/dU9HxJrqjt1fx3v 5Uc6+JFwsR2u575L2MXyGO88rbRgDz78wJEGc2KS0sgSp02IBTsoU+HrrDclIL7UUzD5 yPIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7uYlLNN0UyKBRIab8OLOITLg387YzzBqmIZv+ipj1Bk=; b=PT132b5j4IyiifO+K9wyL1CtSzpC5Zpfu/ZxivSVg0CJusPQtKIKZjGmsdNmhc8N53 KsiPOPNdhZwlJn7jIdP3AVFbvuOxsQS4lbp+nwiI6fEwAI6P+3G6JoarJHGijNS6Ejr1 CEuaeYI/EdZrr1U+/E5KG6uUx0UqsfcA+WePuoK9qi0hMk1Ljv3ZPIvzzVAuB5Dq6BeU qmnuiZYQcEWTDqbFmiwgEv1GdaBFqoeryeC3hnjaX2YGxo5vI7W75VoOIgpwfHNQG2E3 tvKgNKmCvvze3EKj/I2IIxda8tdMtyv+tKch2iYFBObRV76V6XrlA+vrr/kJUpkN//QK sk0A== X-Gm-Message-State: AOAM530kMNftGdyfsGKE9Ai5f6IMLdRzgw9BHgd/HLMCprm5pGbDDQt1 zobVR+h8/9GUuvBXeERqKIY1dg== X-Google-Smtp-Source: ABdhPJzGL4YEJnZLHDs2gCK48wqeWdvZlE8nmVrQmjPTUaQ1EXFV5sqoz+sP/iUjbWjWIJ3lhJr+wg== X-Received: by 2002:aed:2b86:: with SMTP id e6mr25582795qtd.86.1600312955087; Wed, 16 Sep 2020 20:22:35 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id g45sm21370801qtb.60.2020.09.16.20.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:34 -0700 (PDT) From: Thara Gopinath To: rui.zhang@intel.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, agross@kernel.org, bjorn.andersson@linaro.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, lukasz.luba@arm.com, amitk@kernel.org Subject: [PATCH RFC 8/8] soc:qcom:qcom_aoss: Change cooling_device_register to warming_device_register Date: Wed, 16 Sep 2020 23:22:26 -0400 Message-Id: <20200917032226.820371-9-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200917032226.820371-1-thara.gopinath@linaro.org> References: <20200917032226.820371-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Always on subsystem host resources cx and ebi that are used as warming devices. Use the newly introduce _warming_device_register to register these devices with the thermal framework. Signed-off-by: Thara Gopinath --- drivers/soc/qcom/qcom_aoss.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c index ed2c687c16b3..4f65c03a5def 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -461,7 +461,7 @@ static int qmp_cooling_device_add(struct qmp *qmp, qmp_cdev->qmp = qmp; qmp_cdev->state = !qmp_cdev_max_state; qmp_cdev->name = cdev_name; - qmp_cdev->cdev = devm_thermal_of_cooling_device_register + qmp_cdev->cdev = devm_thermal_of_warming_device_register (qmp->dev, node, cdev_name, qmp_cdev, &qmp_cooling_device_ops); @@ -501,7 +501,7 @@ static int qmp_cooling_devices_register(struct qmp *qmp) unroll: while (--count >= 0) - thermal_cooling_device_unregister + thermal_warming_device_unregister (qmp->cooling_devs[count].cdev); return ret; @@ -512,7 +512,7 @@ static void qmp_cooling_devices_remove(struct qmp *qmp) int i; for (i = 0; i < QMP_NUM_COOLING_RESOURCES; i++) - thermal_cooling_device_unregister(qmp->cooling_devs[i].cdev); + thermal_warming_device_unregister(qmp->cooling_devs[i].cdev); } static int qmp_probe(struct platform_device *pdev)