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: 256755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD608C43461 for ; Thu, 17 Sep 2020 03:28:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8DEA1208E4 for ; Thu, 17 Sep 2020 03:28:37 +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 S1726210AbgIQD2d (ORCPT ); Wed, 16 Sep 2020 23:28:33 -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 S1726200AbgIQD2T (ORCPT ); Wed, 16 Sep 2020 23:28:19 -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 105FEC061797 for ; Wed, 16 Sep 2020 20:22:29 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id q5so886373qkc.2 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=mOMHmR+h6hgFg8yR7lHsPZQuC+VWfvqre/78/M6UESgzy27K+MK7K0o8b9sdtCCe/E qouDzAk9KUXHoyNJ/HyExSwFi2+CSDhLs5iLmxAd30g+o8Fh8dBcJKAEJHuysGk4EhNJ W6L6F9ihMdnxvciHpCG1qBSN8Ne7/+8jsp+ig1fyZOlLvC7ap4atBfjYQrey3uBnOp8x OPmpWfrQcSCjsOyvPI5dxndGz4wcFsULt8RqxPZ8AkOvCnXuOUAR0Iv7XNXBwa2hDDUb lcKDMnMgumPYZ5MbIw5BlK3qene5bG5TDsBV9aKcH78LvZWK6r761HYNuwKF3MxC61WY hs2A== X-Gm-Message-State: AOAM530qHH7zVqWSbMeCwtZGZw7kI3vgJG/qqg0XLCu/BEoGSLbIlluJ cJXxN31psbdJZD7blBz4j4Df5g== 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-pm@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: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: 256754 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12881C433E2 for ; Thu, 17 Sep 2020 03:28:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D1C92206D4 for ; Thu, 17 Sep 2020 03:28:58 +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 S1726115AbgIQD24 (ORCPT ); Wed, 16 Sep 2020 23:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbgIQD2P (ORCPT ); Wed, 16 Sep 2020 23:28:15 -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 6E8A1C061356 for ; Wed, 16 Sep 2020 20:22:31 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id r8so757000qtp.13 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=GuIxvVgUOHvYNhShnEk+yu52CpD3q4I5k5QQVqme8Qd+TL/WKQiLe6vBkDvUCmM0lp tR8N9PoKxb2Ofl+j6kp/IJzX/oVUuRqCGr+6x77BrnO07LCWrj+bwpFKYz9xhXHP/x5h LZAv9fIYtBMkJBenzNwDh7rVI7TRXoFOacvt+YxyGgaDZ4/e/hvYiq1ReCuw04du7Mxz 6LZXU27qinbA0OWvhIa6Mm76xeJqknCdVycMEE75GRVpZuO06jSAPoY9gQsbN6sLvAYm BUvC3+Dh7QdFplxauzTUGiCpM3i/VRlQa5htQiaBIY4OQ7E5evOJnTQTjG2bYAXV88YZ kO0Q== X-Gm-Message-State: AOAM530UMGj+e5YpqgwNvhmDwM/Brb63kFWTQvXH0sFUnjy3/ECs1whv G6MKSRqM0ANKk/YRGIAU6YGhBQ== 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-pm@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: 312838 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp79560ilg; Wed, 16 Sep 2020 20:28:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdSfRp9j+XAUfVI+YpmvphCy4/ta1VUwzrXeYf8opnhU2zm8xLRKkQzpCWLnyuDZEFC72W X-Received: by 2002:a17:906:474f:: with SMTP id j15mr30449469ejs.468.1600313337986; Wed, 16 Sep 2020 20:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600313337; cv=none; d=google.com; s=arc-20160816; b=dYMytphhj9XrK0XaFNQJw7XFF6iGaEMjDJLTIGaG7rpB2RbaS7hujskF6VusvC45j7 CR6Sbh6s0MOhA7xubhsfpIGzJzCN+OY9XImvSd4AcOPf/vXmyC3mPpl1f8DXtgVqKzZ0 fYIWEOUpzoK6EPnxvwSgkKl5Tz6DNGebVnaPYq8ENV4cJD5UU+jyD6i3q27tmZSyFG/W WJWr7WWA05CA3+AyI/0HcuinRsB1g/QKk4w25MqKF6LrwFwjvDTUKcxzJ/01T291WiTk KzAgPK/1W7kXb97SeT29w9LJa5HewLEiiARdT01HibVqDLBcAwKFpELCebJyR0qc3cTl W+eA== 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:cc:to:from :dkim-signature; bh=91xhdh0yMbg0WvS++faa8p3tfvFulTbKZKHM2XlY74k=; b=gO5TNW+5S5RNYN6w0e0cOhkFWvDZBwR2zxkmyAmJ4B5jVvWx73OpvE2F14b9KVDaEG E6pdVO51V2LULgAaxktMPmpfV/hErIYfVTR1D8qmuL5l5AgrgCVhNJCZ34Hryrm8TOF+ KyvyVaIPx5g8C1PHs0GisPZZnNwiOuQJz/MSGfC1dUHirQAS8YXHrRIUmd2oludQVIAZ NwNZouSIIBvdfTBBdmRIybrgtQwg+bUVweqhQo/G6kFkZNFZX0q0CrKTgZj8ZgT85HRa uAoQAaCpBYE3SxYXbt9drOzk5BNazs3q9EsrtfY+jZzXRRYFXbBWI4ByHZRvQAu+yEMc PHrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NyQoaVEh; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p11si12721081eji.157.2020.09.16.20.28.57; Wed, 16 Sep 2020 20:28:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NyQoaVEh; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726285AbgIQD2t (ORCPT + 10 others); Wed, 16 Sep 2020 23:28:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726187AbgIQD2S (ORCPT ); Wed, 16 Sep 2020 23:28:18 -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 66C45C061221 for ; Wed, 16 Sep 2020 20:22:32 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id c18so800643qtw.5 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=bLIMVS/JdlqLHVyw33Dso4ZyZfxLfwD2YHCPaPpFO0ybRTOg98qXvRLQwm5AeAZqXF 0RAQcEZR1eXTxzcZhDnElBKkra6gbVdRPA4ZpIg9NyBDBLZuyKzrY/goc0hSx/qeea5q X75/oaMdLB7cTJUulJ3V5Ii9pgYpFYRO9gVG+mVWQbeiB1flClJgdECwIThFSmMICTt8 wMpkkvaCOSmtw7htuDD8QQeCGk+lA6BNhD2ZFdPKlIQHe4+vtnu9oCBp/fb4evAwBHN1 VuYexTHYTYm5m+ObjWMR/phmnR0sLrplLopGsyIbD8pYxMqOAvstY4LhawZcxyga+NRt gFBQ== X-Gm-Message-State: AOAM5321K8eecSyM/BzzbF52SOHGhUcUXb8IfMtuLFrJeSETrXPR6LgB G3CQoEonCeR44+Y1wwDYzLDYow== 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-pm@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(-) -- 2.25.1 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: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: 256756 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2275C43461 for ; Thu, 17 Sep 2020 03:28:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B13E620872 for ; Thu, 17 Sep 2020 03:28:03 +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 S1726152AbgIQD2C (ORCPT ); Wed, 16 Sep 2020 23:28:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbgIQD2C (ORCPT ); Wed, 16 Sep 2020 23:28:02 -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 03938C0611C0 for ; Wed, 16 Sep 2020 20:22:34 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id k25so805626qtu.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=SX0AMRj/RVniEp1A3AG3PZaCP6VZRP3mwMuS7ZqhKr0pDXp5Ki1ra2qZwF4rdGXHO9 IJAom5IgFcmVWftexhytChr0JeIErvBZr0Nkd09avoW9oKajHYRWe/y13oEJELu5sg9O jTBGiIgwFEcdtlnjwHI3tdEjzibTirYxPYS0VdXG+8VoffM5CMAEnLJwBi8BRItMoYoH 39jIED0A3mQmIv5OxiBL1V6fwqTNZ+H6eHJ7fCEhyVtdWGQj8XoakKhO5Tc16V7nepjl PLxPes8R1ogyuEy2xfB0gt0yNWs5huCribCSE5U1kmQ2R7ohkDWRKM5jZZooOUpX8JHX 3ZyA== X-Gm-Message-State: AOAM532Ems6uQw1J5MFINzolKU0xm/uLR202nuk9bpj5H/9QAd5MfLdz fbvZmg4iY9m33ddj4Umc8QqJCQ== 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-pm@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: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: 256753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67DD4C43461 for ; Thu, 17 Sep 2020 03:29:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 291992080C for ; Thu, 17 Sep 2020 03:29:20 +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 S1726187AbgIQD3P (ORCPT ); Wed, 16 Sep 2020 23:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726151AbgIQD2H (ORCPT ); Wed, 16 Sep 2020 23:28:07 -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 D2963C061A28 for ; Wed, 16 Sep 2020 20:22:35 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id c18so800720qtw.5 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=P9LmGeIONyTNcUbVMWeqLzQ2oM1is6BQunvAVzqBY5Ouv4lkCG9pL+ekgsS0vNpsAT 69kUb+gfDZf8gPOoQA3SV6ON9ZwpoA5S0eaS3SKdAxfIp/nPCpIlAVFubnUkqYmp1Kiv Hf+17pXQ19GoIot6Sg+P4mAA4TE8M4RbU+8HWyIA+9BWF6JOgLh8i9Lq5bg821KyNZLQ V+M9PVZMvOmtclte0WGwGd9w49YI+6GK1zG2KWKJdjxtCacjdDzYOUiEl6hC1AAXIGUk e7dLepRl/DHvp4SW0DYm/rl7Nt5uYps4zkrMCXzZ1DO6MwM1EZWIRNNSWiiaRXEpQfxl 5ruQ== X-Gm-Message-State: AOAM5323vP/jiBYtm540+1334Z7+xN3qbVs1h4Cz7Ji7BxsBswgQSXcQ g1jZcYHyI4p7zp0afx/mT7UoSQ== 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-pm@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)