Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp598775pxb; Wed, 3 Nov 2021 09:13:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLWsL9O3EIhXHt5R3lac09ZDsWZMNJxvA4yUt4oBW/zM8e1PT9r6RmqlPWvoQHKKkwaM5G X-Received: by 2002:a05:6402:152:: with SMTP id s18mr60670894edu.314.1635956034725; Wed, 03 Nov 2021 09:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635956034; cv=none; d=google.com; s=arc-20160816; b=iC9eKRkWjMF2OjK/M89nUpEwLbOVLKfBDzhIOuOf6Bup3Hnx0D5+tglxGQ5c5tU/K2 qLGlOsnI4uJ6IGPhfORBUWX9dfKBOeOs8gfCJsMWhkRdMsRULT4iw2R58n2h9eOkprfG Gpj8oORq/ixL6/1ACP6cRayiVMb5wAIA++leGJL9GtvpB5GW1xJkVDTddTQFs9qLlZFH 5r0Zgl5Wr6jaT+rJ8WOCmT7Ex9PVvmchdo4oxVk4+3dBWi6i0KLxf97G5pd+fuCWS64+ QOKV2gRZ3vBu6A8JoxrJgXCSl3gy2ZI/M6z+GlQPvfAE2G/sS9NefdioZlynGeIXojwK 4vyA== 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=LOyKt9vtLqlR67fWUxkCXPFKIiX4tst0msUED5N3nCU=; b=Umzc0Lb6aFmTgHzkpNuGmyoG/rYX/kQ3LhrFHeSSPlj90RKCphsH1sNINl1ZWRN4GB JOkA1zfx5TGYl50kwWufnmYWBKZh+F7gdRgUPIcFTAeTUqkWrcXifWN30cW4bwGYNzVc c4ujddguR3sXHN3vReB4WendoxU8IR46tVgo5LISQdDe/ZgHWKqsEXeu4H/eNn5qn7Dz BUzUya+dTBkjsyqY5pjpudRkxpjSU59UEcR8pHrvDLMK7uj4CdZCjiQsHgR/a+JoGtbt CanatqgkSaMXgkX8L3KPoCh9hQSyYE3RK5LWrrcR0CWkN00gQe9rQ+t+bk0tb3TR68O7 U6rA== 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 5si4008397ejj.698.2021.11.03.09.13.28; Wed, 03 Nov 2021 09:13:54 -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 S232926AbhKCQNo (ORCPT + 99 others); Wed, 3 Nov 2021 12:13:44 -0400 Received: from foss.arm.com ([217.140.110.172]:33056 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232959AbhKCQNd (ORCPT ); Wed, 3 Nov 2021 12:13:33 -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 ACB25ED1; Wed, 3 Nov 2021 09:10:56 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.26.226]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 46B483F7D7; Wed, 3 Nov 2021 09:10: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 v3 4/5] cpufreq: qcom-cpufreq-hw: Use new thermal pressure update function Date: Wed, 3 Nov 2021 16:10:19 +0000 Message-Id: <20211103161020.26714-5-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211103161020.26714-1-lukasz.luba@arm.com> References: <20211103161020.26714-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..425f351450ad 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_update_thermal_pressure(policy->related_cpus, throttled_freq); /* * In the unlikely case policy is unregistered do not enable -- 2.17.1