Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp107515pxk; Wed, 16 Sep 2020 20:33:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdzoegifwNwGvbzBwnIlM6v3cMBAHQd9X2bcZCqf1uomxvcvhyk3FEHo48Oq5nqFCOH9Hc X-Received: by 2002:a17:906:4107:: with SMTP id j7mr29889230ejk.533.1600313603304; Wed, 16 Sep 2020 20:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600313603; cv=none; d=google.com; s=arc-20160816; b=nfOCahyMOGnAE4TfNQJXlsjKwIS1mcnj6GnLH1juL8+j4Yal0AQipTmfPCP5XM/yYm kKNiN6DCfiRzW9x80EPagSOvjm8GpbKCCuHSLQrBgvjR9Al31tZUKto1z10xqA7FOOFL a8awPdcftm1j37kugD47gVlXRyIvKGsA5RrbPYUb1KjUIbSEipaQSUsJge+ecWj1guwU qoYT8MkVq8kkjDd3BHGBcwymGCVJgTTHC/nQXqBTpnsgexK/o4T8iMcGdHDvWLgQPGTs IyOAmCWMDWSJbtxqlDrputuSIZ0FGzdx1P1I5W4sXZjXwqrhjtxnK6d5DtBe/wq/XWrU EO4A== 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=qA8w6GQLbaTlzp5n8dcgkY3X2oVEZB3DGcmvh59/aDQ=; b=Mm/qcEcxUuZCfg6IIyvCiIH+mPSv7KUO7/vhNxxETdJDmFVcQmp5Y3K5zj3t82WKeP cCS4Q/l0Ofzy5AzzyuhzUM3FmwpTZkrGaxwMeA1AIY6td0zFrorGxb9qy4iaLrOrSWYZ lUVlWKsiw0AEAT0NlUN8+de0jBkzhoESyfDLz2UIBupyJf7NXXJxN3NRa/DeHBgoXqWv VL5FaGVY9kwdlV3119oCKcoBqFwtGeq2BJZ7hw1qgkvKHWwHGgf3AVz9QwNWHG8QBCJA +qp9SfPS2kcdF9KTa8y1pVjHo3492+n33gtD/vQjVYrXpn5SLiEI1RQ1YcgFAXzsAnZd QqmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mn11vOjh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 a8si13159792ejv.661.2020.09.16.20.33.00; Wed, 16 Sep 2020 20:33:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=Mn11vOjh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1726152AbgIQD3a (ORCPT + 99 others); Wed, 16 Sep 2020 23:29:30 -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 S1726102AbgIQD2C (ORCPT ); Wed, 16 Sep 2020 23:28:02 -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 03B1DC0611C1 for ; Wed, 16 Sep 2020 20:22:34 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id v54so793204qtj.7 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=dRhAIreJgIxgcrdzOL7dOVaTSd5f2sLaS4aGhvU1ftfOlLovlCGvxcrRov5YKFJD7e 4rDgtHb3KvLmy52k7GrnXXchDyrSK4MF0UV6HDjtVb/l1U32qN4fPmv0bxSOt53dXlIx SP/WDiujviyXmHQmIkvkGDKTBJTHd6G+PwBltq3e4smJbBhJHrpDyVgOWbTj4bVHInNf RD5Qi4Xim6gDknvC270DKFkFNac3s7m0XxxmZJc2U1XSHM/QilA03f8cQ0ZmH8RHhMfd wkDkG5/mbQ/GZu7Wx50j8MyY5yvJuKdG3d/8X/VwAJXlJsganmmNGMH09opKwVREYlm9 M9Vw== X-Gm-Message-State: AOAM533x6uSTg4hDXyKl56Blr3ZLkJZ+WANYpuf3KfOiT93t2m2szjXp NGKsKLGRjufHFGLUhoYJ3VMBcA== 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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)) { -- 2.25.1