From patchwork Tue Nov 24 09:36:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thermal-bot for Julien Panis X-Patchwork-Id: 331794 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=-20.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED 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 616F1C56201 for ; Tue, 24 Nov 2020 09:36:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB16220897 for ; Tue, 24 Nov 2020 09:36:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mKkdpUNC"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="8ahQzYDV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731419AbgKXJgs (ORCPT ); Tue, 24 Nov 2020 04:36:48 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:42112 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731384AbgKXJgr (ORCPT ); Tue, 24 Nov 2020 04:36:47 -0500 Date: Tue, 24 Nov 2020 09:36:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1606210605; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E7JX6Pzemlt727AZxrgxhUPVgUk8XmClNLTEFP9IKWM=; b=mKkdpUNCw2PH9tY+2CoW5jHdUxUF6WIcryYj3G9idZUK2SWEDJk6XzUtZCHgxN16rGgmyC hO2KeRT4lOVe2SoDgLQtoNNybvDiKFBYxFGdzeAws7A3N7jMIghaL73OifzR8tUj31Agdq EpxYjjQzJPiPjY1vH3XT4FwcArsEh1bzpeiUZjCSJ8VdbmDcSYAW4ATw5ekulBskgF4C1L RZz8V9gZhBXtAl70swDogG7haB2lkD+KPOeKRoxhTFd6s45XU+EGtLDZli47qpCWse4dXJ m3u90lFLjxMvyHYMaJ+oxoE7VWOXhIW31MuzBT4+i23M92k8mecPx/rmw+YPow== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1606210605; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E7JX6Pzemlt727AZxrgxhUPVgUk8XmClNLTEFP9IKWM=; b=8ahQzYDVr2wRI73rDoC+va0zBazbgzV+FfhgbWXAUpI4WfIiqtiaJtjqzuCTcgt/bOSZN6 DEjg5opLMVXdYQCg== From: "thermal-bot for Lukasz Luba" Sender: tip-bot2@linutronix.de Reply-to: linux-pm@vger.kernel.org To: linux-pm@vger.kernel.org Subject: [thermal: thermal/next] thermal: power_allocator: Respect upper and lower bounds for cooling device Cc: Lukasz Luba , Daniel Lezcano , rui.zhang@intel.com, amitk@kernel.org In-Reply-To: <20201015112441.4056-3-lukasz.luba@arm.com> References: <20201015112441.4056-3-lukasz.luba@arm.com> MIME-Version: 1.0 Message-ID: <160621060492.11115.4305995116543175135.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The following commit has been merged into the thermal/next branch of thermal: Commit-ID: 8132df3a06a41823aa370dbb4ff08f48fa07f6df Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//8132df3a06a41823aa370dbb4ff08f48fa07f6df Author: Lukasz Luba AuthorDate: Thu, 15 Oct 2020 12:24:39 +01:00 Committer: Daniel Lezcano CommitterDate: Tue, 27 Oct 2020 09:44:32 +01:00 thermal: power_allocator: Respect upper and lower bounds for cooling device The thermal cooling device specified in DT might be instantiated for a thermal zone trip point with a limited set of OPPs to operate on. This configuration should be supported by Intelligent Power Allocation (IPA), since it is a standard for other governors. Change the code and allow IPA to get power value of lower and upper bound set for a given cooling device. Signed-off-by: Lukasz Luba Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20201015112441.4056-3-lukasz.luba@arm.com --- drivers/thermal/gov_power_allocator.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c index ab0be26..eb8c9af 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -96,7 +96,10 @@ static u32 estimate_sustainable_power(struct thermal_zone_device *tz) if (instance->trip != params->trip_max_desired_temperature) continue; - if (power_actor_get_min_power(cdev, &min_power)) + if (!cdev_is_power_actor(cdev)) + continue; + + if (cdev->ops->state2power(cdev, instance->upper, &min_power)) continue; sustainable_power += min_power; @@ -398,7 +401,8 @@ static int allocate_power(struct thermal_zone_device *tz, weighted_req_power[i] = frac_to_int(weight * req_power[i]); - if (power_actor_get_max_power(cdev, &max_power[i])) + if (cdev->ops->state2power(cdev, instance->lower, + &max_power[i])) continue; total_req_power += req_power[i];