Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1466493pxb; Sat, 16 Oct 2021 10:37:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6D5POCV81Sf5vCSuo7k+z4SG4X/DHDRloGg1luBx1LyFZGyshZKrU6wwRT7L5lEv+lEm1 X-Received: by 2002:a17:90a:191a:: with SMTP id 26mr22289910pjg.79.1634405833039; Sat, 16 Oct 2021 10:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634405833; cv=none; d=google.com; s=arc-20160816; b=u31ScoTuL6PgdeYrEOFzEnz+awh8LOJgh0JBRzn9XRLWYqOG5pU+FMYhnrgY35ZfVF sCt0wPIDkn4J474iz25Tnun0KPcIittzCKvwXBwOSFHQ82D5RsLJZMWCRgOqIiaIs+0g LktPK+SO8tmGFC1lBVj6RKxqX+jw8f4k3Yx5wjENb5lb6bmWaYZu2Arwos58kQ4NJs7v 7DczZIZ841bH7lT+5t1NsWKxdWMrLTaksPDKq2/b/VH41+oLvEErc51jP9az7PVP74Eh H6p2NU7MpmpsZntdcQ0NniFghw32kzG8dirCkvnp7AJGVvLTJiCSrISXeEakARkvGzlT 2spw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=OCQ9JcHzOAPP3mbpyww0I6OfrG5HERyAVuwX64xl5BY=; b=YruyLnrlBEQlpxJSEV9oNfFE3w7pYJekGmsr4v21wZN0gas0VEHiiN2yU6oowmc7EE 1/LMlqz+Hu+zuS9vIHCFRVjq2T9/rRDBmPpx6eMXnmJCPprTa25s5ef0HfmZEXaEr7dj eM4KcPaDq8BkC8/GW8orqyNHQ7pny5fUSoYFncYbmZnnNq0LX1eqyc7+foRjKZWf+ygm jXPFhdJI21mR4+AADYYDGDxtUu4ezbLBu2HT0WM1DHKP96bU8i/iZ7p/Lcxb4ZJNCqd/ ws5wyjJw1gFe805w4xWg6YPpA/+HbtMy9W5efrJXKP3tds5xcocmBDyViGcOfNLcae4K vtkw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x2si7165768pfa.348.2021.10.16.10.36.58; Sat, 16 Oct 2021 10:37:13 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240913AbhJOOsi (ORCPT + 99 others); Fri, 15 Oct 2021 10:48:38 -0400 Received: from foss.arm.com ([217.140.110.172]:44106 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240835AbhJOOsU (ORCPT ); Fri, 15 Oct 2021 10:48:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 54D4C147A; Fri, 15 Oct 2021 07:46:14 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.23.184]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5B9133F66F; Fri, 15 Oct 2021 07:46:11 -0700 (PDT) From: Lukasz Luba To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, lukasz.luba@arm.com, sudeep.holla@arm.com, will@kernel.org, catalin.marinas@arm.com, linux@armlinux.org.uk, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, amitk@kernel.org, daniel.lezcano@linaro.org, amit.kachhap@gmail.com, thara.gopinath@linaro.org, bjorn.andersson@linaro.org, agross@kernel.org Subject: [PATCH v2 4/5] cpufreq: qcom-cpufreq-hw: Use new thermal pressure update function Date: Fri, 15 Oct 2021 15:45:49 +0100 Message-Id: <20211015144550.23719-5-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211015144550.23719-1-lukasz.luba@arm.com> References: <20211015144550.23719-1-lukasz.luba@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thermal pressure provides a new API, which allows to use CPU frequency as an argument. That removes the need of local conversion to capacity. Use this new API and remove old local conversion code. Signed-off-by: Lukasz Luba --- drivers/cpufreq/qcom-cpufreq-hw.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 0138b2ec406d..bf7871c2a4c9 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -275,10 +275,10 @@ static unsigned int qcom_lmh_get_throttle_freq(struct qcom_cpufreq_data *data) static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data) { - unsigned long max_capacity, capacity, freq_hz, throttled_freq; struct cpufreq_policy *policy = data->policy; int cpu = cpumask_first(policy->cpus); struct device *dev = get_cpu_device(cpu); + unsigned long freq_hz, throttled_freq; struct dev_pm_opp *opp; unsigned int freq; @@ -295,17 +295,12 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data) throttled_freq = freq_hz / HZ_PER_KHZ; - /* Update thermal pressure */ - - max_capacity = arch_scale_cpu_capacity(cpu); - capacity = mult_frac(max_capacity, throttled_freq, policy->cpuinfo.max_freq); - /* Don't pass boost capacity to scheduler */ - if (capacity > max_capacity) - capacity = max_capacity; + if (throttled_freq > policy->cpuinfo.max_freq) + throttled_freq = policy->cpuinfo.max_freq; - arch_set_thermal_pressure(policy->related_cpus, - max_capacity - capacity); + /* Update thermal pressure */ + arch_thermal_pressure_update(policy->related_cpus, throttled_freq); /* * In the unlikely case policy is unregistered do not enable -- 2.17.1