linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 4/5] PM / devfreq: tegra30: Use clk_round_rate_unboundly()
Date: Tue, 31 Mar 2020 02:16:16 +0300	[thread overview]
Message-ID: <20200330231617.17079-5-digetx@gmail.com> (raw)
In-Reply-To: <20200330231617.17079-1-digetx@gmail.com>

The clk_round_rate() doesn't work for us properly if clock rate is bounded
by a min/max rate that is requested by some other clk-user because we're
building devfreq's OPP table based on the rounding.

In particular this becomes a problem if display driver is probed earlier
than devfreq, and thus, display adds a memory bandwidth request using
interconnect API, which results in a minimum clock-rate being set for
the memory clk. In a result, the lowest devfreq OPP rate is getting
limited to the minimum rate imposed by the display driver.

Let's use new clk_round_rate_unboundly() that resolves the problem by
rounding clock rate without taking into account min/max limits imposed by
active clk users.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/devfreq/tegra30-devfreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c
index 28b2c7ca416e..34f6291e880c 100644
--- a/drivers/devfreq/tegra30-devfreq.c
+++ b/drivers/devfreq/tegra30-devfreq.c
@@ -834,7 +834,7 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
 
 	reset_control_deassert(tegra->reset);
 
-	rate = clk_round_rate(tegra->emc_clock, ULONG_MAX);
+	rate = clk_round_rate_unboundly(tegra->emc_clock, ULONG_MAX);
 	if (rate < 0) {
 		dev_err(&pdev->dev, "Failed to round clock rate: %ld\n", rate);
 		return rate;
@@ -849,7 +849,7 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
 	}
 
 	for (rate = 0; rate <= tegra->max_freq * KHZ; rate++) {
-		rate = clk_round_rate(tegra->emc_clock, rate);
+		rate = clk_round_rate_unboundly(tegra->emc_clock, rate);
 
 		if (rate < 0) {
 			dev_err(&pdev->dev,
-- 
2.25.1


  parent reply	other threads:[~2020-03-30 23:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30 23:16 [PATCH v1 0/5] NVIDIA Tegra devfreq drivers improvements Dmitry Osipenko
2020-03-30 23:16 ` [PATCH v1 1/5] PM / devfreq: tegra: Add Dmitry as a maintainer Dmitry Osipenko
2020-03-31 23:13   ` Chanwoo Choi
2020-04-01 18:52     ` Dmitry Osipenko
2020-03-30 23:16 ` [PATCH v1 2/5] clk: Introduce clk_round_rate_unboundly() Dmitry Osipenko
2020-04-02  0:33   ` Michał Mirosław
2020-04-02 14:21     ` Dmitry Osipenko
2020-05-27  5:55   ` Stephen Boyd
2020-05-27 17:57     ` Dmitry Osipenko
2020-05-28  0:38       ` Stephen Boyd
2020-05-27  5:57   ` Stephen Boyd
2020-03-30 23:16 ` [PATCH v1 3/5] PM / devfreq: tegra20: Use clk_round_rate_unboundly() Dmitry Osipenko
2020-03-31 23:22   ` Chanwoo Choi
2020-03-31 23:23     ` Chanwoo Choi
2020-03-30 23:16 ` Dmitry Osipenko [this message]
2020-03-31 23:22   ` [PATCH v1 4/5] PM / devfreq: tegra30: " Chanwoo Choi
2020-03-31 23:23     ` Chanwoo Choi
2020-03-30 23:16 ` [PATCH v1 5/5] PM / devfreq: tegra30: Make CPUFreq notifier to take into account boosting Dmitry Osipenko
2020-03-31 23:29   ` Chanwoo Choi
2020-04-01 18:53     ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200330231617.17079-5-digetx@gmail.com \
    --to=digetx@gmail.com \
    --cc=cw00.choi@samsung.com \
    --cc=jonathanh@nvidia.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=sboyd@kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).