Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp557718ybt; Fri, 10 Jul 2020 06:52:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3oUzviR/66dtu9VQXcNZiWCcJLKWv6aOS1hVHkaNlpT/0vkjTQeqDBLua6OFhRCGu4aEz X-Received: by 2002:a05:6402:1c0f:: with SMTP id ck15mr74387074edb.155.1594389151537; Fri, 10 Jul 2020 06:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594389151; cv=none; d=google.com; s=arc-20160816; b=u+ouOOhLXo+c6F9cenleBgqWjDDjuLmCn3x/NHEowoEApKrMTLWu2mh6ure3D6CW/n 2heX2OIpINxZYlaWxhJ7ZjecFEnt/bJUYTHHJGa618yus9lY2JUYHhVDRn2PXUbX0gI+ X9GbQSawGmnUd/PgvelwkBEqsCwRfkRhLjtDifHvyaNb1YgiLnG5pg3tHe+WNlAY6wVq 2rRe3HigntKVO7AhYjiMHiLAOJPy9UWkljX01YZVtK4N6ULl2L+kzPmpcaBui0EhB5H2 QR8qMWA1jo1YI6scuecMVFXDhxpFuSgXaFc6wEfc/bcPhAoJOfC5c2goLpk78CeVA90Z Qccg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jHIyzQC2ceqyL76cAxetV2VUM/9zPrieydXeUmPcEI8=; b=jzjqXlG2LXzwzD2r7JyN+XLVOIWTCaxN///5yESd500tav9KGd9wLk4wdzOei7pqC6 9zzBRJLuT8i8ZDoy4iG+ADh85QYPlyA3tTLaLMDex35FCDR1VlSswYXzrf426eU9TAs/ F7XAxyLfdLmZPjbSnjnAx3D9fBOM7Hh9g6pDnbDrPN8Sz0GynXQ+B5C4bnVrbIWY4S7Q 0Z6HlvUW/r7mp2vUFz+GJxpXqGRSiNXcfR5H5jo11KyKixHoLvjBEjv9WbAFbBW6Jb9I JBdTsdb9+5d3RS3FkJQ0drhNJ5jyT2nhupMrPvYVdGGCs2aFENr8nvCSFeYxju2G4aMV /euw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X+s9k0k6; 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 co20si4131143edb.131.2020.07.10.06.52.08; Fri, 10 Jul 2020 06:52:31 -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=X+s9k0k6; 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 S1726872AbgGJNwD (ORCPT + 99 others); Fri, 10 Jul 2020 09:52:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728178AbgGJNwB (ORCPT ); Fri, 10 Jul 2020 09:52:01 -0400 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F3B9C08C5DC for ; Fri, 10 Jul 2020 06:52:01 -0700 (PDT) Received: by mail-qv1-xf43.google.com with SMTP id h17so2585387qvr.0 for ; Fri, 10 Jul 2020 06:52:01 -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=jHIyzQC2ceqyL76cAxetV2VUM/9zPrieydXeUmPcEI8=; b=X+s9k0k68ktP2Yeh15hRqVvjhNy41w6Uzqg0Vk7k9inbT3pjbSWQdujNRt+liki46B FhIFz7QnKATwGL0EUwYendyIQozMppEvO0lv5zZ8HNsCgNbx+U+L0+zu2QX4C1I1E/T4 gWA5OsfL9+hh3KM5yFCGZZwdc9ddst3WpMG8BalN1+fQVC3B2NHsxl6kcmJ2dvKLp7lU RNlnDAYvHYmU5HDdr2ey81GCD8Q7IWO7qsApfKGadFssKOiT9hAhE+8ifWvyqEzDMNc/ 1txVL72Garh01uxaM/fVsIqoMP4d7V2DC4snZ1j09TUu7dv99ln0REkoCEeoQgAiPdzE KerA== 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=jHIyzQC2ceqyL76cAxetV2VUM/9zPrieydXeUmPcEI8=; b=p7epsna9WbqSH0P6rOzYHUUrL7G3hp4Rv6d0jP4eaO5K4OhAoVoiTjJlExSNmlLLPy kMiEaj4UljOFR5PhDVWfKCPnFUBmz+U8AlHqJX59z38kdhXGPUJZ4SUapQLUeNIUfI6P bXZskPsJm/V8bnPN2lbWN8Yb6vTVX4x46rI2wd3wzUZAr6MgDoCoL/YrFITlOJsRzxgM u2JJbk45hcRSx8sISHHX0KNFEMt18hB9Q306fRBQML96yt4yJpj65NvO6Rfykws+348e HdXM7z4Em54/YMlX6nmeDD4I0e0Lp37iJRredu4Kg8UwGSgK0Lc42dpR3cxZkSaITMHb TVSQ== X-Gm-Message-State: AOAM53043Q3OMz87kSpkVBVtXohz5To92TA/iaAGJWdcTZ74e16ex6ji 5993BuHGfrW1BmfYyPkqBF94aA== X-Received: by 2002:a0c:b791:: with SMTP id l17mr69514906qve.44.1594389120284; Fri, 10 Jul 2020 06:52:00 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id h197sm7574059qke.51.2020.07.10.06.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 06:51:59 -0700 (PDT) From: Thara Gopinath To: daniel.lezcano@linaro.org, rui.zhang@intel.com, robh+dt@kernel.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 4/4] thermal: Modify thermal governors to do nothing for "cold" trip points Date: Fri, 10 Jul 2020 09:51:54 -0400 Message-Id: <20200710135154.181454-5-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710135154.181454-1-thara.gopinath@linaro.org> References: <20200710135154.181454-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For now, thermal governors do not support monitoring of falling temperature. Hence, in case of calls to the governor for trip points marked as cold, return doing nothing. Signed-off-by: Thara Gopinath --- drivers/thermal/gov_bang_bang.c | 8 ++++++++ drivers/thermal/gov_fair_share.c | 8 ++++++++ drivers/thermal/gov_power_allocator.c | 8 ++++++++ drivers/thermal/gov_step_wise.c | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c index 991a1c54296d..8324d13de1e7 100644 --- a/drivers/thermal/gov_bang_bang.c +++ b/drivers/thermal/gov_bang_bang.c @@ -99,6 +99,14 @@ 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_type trip_type; + + /* Return doing nothing in case of cold trip point */ + if (trip != THERMAL_TRIPS_NONE) { + tz->ops->get_trip_type(tz, trip, &trip_type); + if (trip_type == THERMAL_TRIP_COLD) + 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..c0adce525faa 100644 --- a/drivers/thermal/gov_fair_share.c +++ b/drivers/thermal/gov_fair_share.c @@ -81,6 +81,14 @@ 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_type trip_type; + + /* Return doing nothing in case of cold trip point */ + if (trip != THERMAL_TRIPS_NONE) { + tz->ops->get_trip_type(tz, trip, &trip_type); + if (trip_type == THERMAL_TRIP_COLD) + 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 44636475b2a3..2644ad4d4032 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -613,8 +613,16 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) { int ret; int switch_on_temp, control_temp; + enum thermal_trip_type trip_type; struct power_allocator_params *params = tz->governor_data; + /* Return doing nothing in case of cold trip point */ + if (trip != THERMAL_TRIPS_NONE) { + tz->ops->get_trip_type(tz, trip, &trip_type); + if (trip_type == THERMAL_TRIP_COLD) + return 0; + } + /* * We get called for every trip point but we only need to do * our calculations once diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c index 2ae7198d3067..009aefda0441 100644 --- a/drivers/thermal/gov_step_wise.c +++ b/drivers/thermal/gov_step_wise.c @@ -186,6 +186,14 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) static int step_wise_throttle(struct thermal_zone_device *tz, int trip) { struct thermal_instance *instance; + enum thermal_trip_type trip_type; + + /* For now, return doing nothing in case of cold trip point */ + if (trip != THERMAL_TRIPS_NONE) { + tz->ops->get_trip_type(tz, trip, &trip_type); + if (trip_type == THERMAL_TRIP_COLD) + return 0; + } thermal_zone_trip_update(tz, trip); -- 2.25.1