mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Erico Nunes <nunes.erico@gmail.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	Qiang Yu <yuq825@gmail.com>, David Airlie <airlied@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Cc: Erico Nunes <nunes.erico@gmail.com>
Subject: [PATCH] drm/lima: Fix dev_pm_opp_set_config in case of missing regulator
Date: Wed, 26 Oct 2022 10:39:50 +0200	[thread overview]
Message-ID: <20221026083950.3712598-1-nunes.erico@gmail.com> (raw)

Commit d8c32d3971e4 ("drm/lima: Migrate to dev_pm_opp_set_config()")
introduced a regression as it may undo the clk_names setting in case
the optional regulator is missing. This resulted in test and performance
regressions with lima.

Restore the old behavior where clk_names is set separately so it is not
undone in case of a missing optional regulator.

Fixes: d8c32d3971e4 ("drm/lima: Migrate to dev_pm_opp_set_config()")
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
---
 drivers/gpu/drm/lima/lima_devfreq.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/lima/lima_devfreq.c b/drivers/gpu/drm/lima/lima_devfreq.c
index 011be7ff51e1..9c8654934fea 100644
--- a/drivers/gpu/drm/lima/lima_devfreq.c
+++ b/drivers/gpu/drm/lima/lima_devfreq.c
@@ -113,10 +113,12 @@ int lima_devfreq_init(struct lima_device *ldev)
 	int ret;
 	const char *regulator_names[] = { "mali", NULL };
 	const char *clk_names[] = { "core", NULL };
-	struct dev_pm_opp_config config = {
-		.regulator_names = regulator_names,
+	struct dev_pm_opp_config config_clk_names = {
 		.clk_names = clk_names,
 	};
+	struct dev_pm_opp_config config_regulator_names = {
+		.regulator_names = regulator_names,
+	};
 
 	if (!device_property_present(dev, "operating-points-v2"))
 		/* Optional, continue without devfreq */
@@ -124,7 +126,15 @@ int lima_devfreq_init(struct lima_device *ldev)
 
 	spin_lock_init(&ldevfreq->lock);
 
-	ret = devm_pm_opp_set_config(dev, &config);
+	/*
+	 * Set clk_names separately so it is not undone in case of
+	 * a missing optional regulator.
+	 */
+	ret = devm_pm_opp_set_config(dev, &config_clk_names);
+	if (ret)
+		return ret;
+
+	ret = devm_pm_opp_set_config(dev, &config_regulator_names);
 	if (ret) {
 		/* Continue if the optional regulator is missing */
 		if (ret != -ENODEV)
-- 
2.37.3


             reply	other threads:[~2022-10-26  8:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  8:39 Erico Nunes [this message]
2022-10-26  9:36 ` Viresh Kumar
2022-10-26 13:02   ` Erico Nunes

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=20221026083950.3712598-1-nunes.erico@gmail.com \
    --to=nunes.erico@gmail.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lima@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=yuq825@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

all inboxes | Powered by JetHome®