Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1153663pxb; Thu, 7 Oct 2021 01:48:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGlrEF1YWBQZ8+DGcE0DKAfKArpVC+QI4irzj9LUwqWLQPpCk+qeoRT1gRsgG27AVtD0CM X-Received: by 2002:a17:902:a38b:b0:13d:9c41:92ec with SMTP id x11-20020a170902a38b00b0013d9c4192ecmr2816137pla.39.1633596507092; Thu, 07 Oct 2021 01:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633596507; cv=none; d=google.com; s=arc-20160816; b=QDZycpAw+GKQ98HKf/ZvQcEySnCUw9s+j9UwZ93QrvJmYR98dbJ6A/5xfie3NQpp9M d6uJzDFgPQMAlwXFteX+GVrtnTyEcwlF/geEaGYRVbm1NA8MnCY//DcBYKQJF32XpN6P wjLtiQjHmeqO6d4LGERDAL2r66eA1rPQjM8hI6s2UAHlMdIZki/GB0RcxqtdzPsVkA4R ixlq84xpp2UqRS8IJz6LA0bqXENQCrh9Di8ehM/qYWkCFrJXU2ppCBGfvBcRB2eih3Jr /VqRBIC5wR0+DKFc/2tF/vtAItaSUhQ9X5Y2uiORYYTuWN+pFqqyeNxv0uhztIptjPjW f+tg== 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=b4HCcN+4mcHflN1/N0JN6azmQBmm0RoUmQ3Dx4aumjOYT/LsReV4fJprVVEKMr4snu 3Tbcnvuh0k4TFDWcaDKqT7m61aNBs4FKQGl944d3m9sYVQbsHpBgx2IbbDpEwcC5goMQ QxdxebrwyoNMFUO2mHoMXE8+BEACkAJIdm0kLV3nDfgqkqL7NxyUJz/ZSP5jOIXkxrcS 9z2EUceAQ04bU/AfMCLZEUyFih4kwBNv5UjXJEcOaQDeYg6fk9e5SXaeRcxqN35DrB3l ALw66Ixt8+EitOw9GgyBnNQHvBxgBkeHHzxlkhGf17KRJRQcFSUn3IsXji4hR1OVLwDx mD/A== 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 ij18si31463762plb.412.2021.10.07.01.48.13; Thu, 07 Oct 2021 01:48:27 -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 S240597AbhJGIJx (ORCPT + 99 others); Thu, 7 Oct 2021 04:09:53 -0400 Received: from foss.arm.com ([217.140.110.172]:35578 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240574AbhJGIJt (ORCPT ); Thu, 7 Oct 2021 04:09:49 -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 8E5DD1FB; Thu, 7 Oct 2021 01:07:55 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.18.236]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9D47B3F766; Thu, 7 Oct 2021 01:07:52 -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 4/5] cpufreq: qcom-cpufreq-hw: Use new thermal pressure update function Date: Thu, 7 Oct 2021 09:07:28 +0100 Message-Id: <20211007080729.8262-5-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211007080729.8262-1-lukasz.luba@arm.com> References: <20211007080729.8262-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