From: Steven Price <steven.price@arm.com>
To: Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/panfrost: Fix regulator_get_optional() misuse
Date: Fri, 6 Sep 2019 16:23:26 +0100 [thread overview]
Message-ID: <ccd81530-2dbd-3c02-ca0a-1085b00663b5@arm.com> (raw)
In-Reply-To: <20190904123032.23263-1-broonie@kernel.org>
On 04/09/2019 13:30, Mark Brown wrote:
> The panfrost driver requests a supply using regulator_get_optional()
> but both the name of the supply and the usage pattern suggest that it is
> being used for the main power for the device and is not at all optional
> for the device for function, there is no meaningful handling for absent
> supplies. Such regulators should use the vanilla regulator_get()
> interface, it will ensure that even if a supply is not described in the
> system integration one will be provided in software.
>
> Signed-off-by: Mark Brown <broonie@kernel.org>
Tested-by: Steven Price <steven.price@arm.com>
Looks like my approach to this was wrong - so we should also revert the
changes I made previously.
----8<----
From fe20f8abcde8444bb41a8f72fb35de943a27ec5c Mon Sep 17 00:00:00 2001
From: Steven Price <steven.price@arm.com>
Date: Fri, 6 Sep 2019 15:20:53 +0100
Subject: [PATCH] drm/panfrost: Revert changes to cope with NULL regulator
Handling a NULL return from devm_regulator_get_optional() doesn't seem
like the correct way of handling this. Instead revert the changes in
favour of switching to using devm_regulator_get() which will return a
dummy regulator instead.
Reverts commit 52282163dfa6 ("drm/panfrost: Add missing check for pfdev->regulator")
Reverts commit e21dd290881b ("drm/panfrost: Enable devfreq to work without regulator")
Signed-off-by: Steven Price <steven.price@arm.com>
---
drivers/gpu/drm/panfrost/panfrost_devfreq.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
index a1f5fa6a742a..076983071e58 100644
--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
@@ -39,7 +39,7 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq,
* If frequency scaling from low to high, adjust voltage first.
* If frequency scaling from high to low, adjust frequency first.
*/
- if (old_clk_rate < target_rate && pfdev->regulator) {
+ if (old_clk_rate < target_rate) {
err = regulator_set_voltage(pfdev->regulator, target_volt,
target_volt);
if (err) {
@@ -53,14 +53,12 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq,
if (err) {
dev_err(dev, "Cannot set frequency %lu (%d)\n", target_rate,
err);
- if (pfdev->regulator)
- regulator_set_voltage(pfdev->regulator,
- pfdev->devfreq.cur_volt,
- pfdev->devfreq.cur_volt);
+ regulator_set_voltage(pfdev->regulator, pfdev->devfreq.cur_volt,
+ pfdev->devfreq.cur_volt);
return err;
}
- if (old_clk_rate > target_rate && pfdev->regulator) {
+ if (old_clk_rate > target_rate) {
err = regulator_set_voltage(pfdev->regulator, target_volt,
target_volt);
if (err)
@@ -138,6 +136,9 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
int ret;
struct dev_pm_opp *opp;
+ if (!pfdev->regulator)
+ return 0;
+
ret = dev_pm_opp_of_add_table(&pfdev->pdev->dev);
if (ret == -ENODEV) /* Optional, continue without devfreq */
return 0;
--
2.20.1
next prev parent reply other threads:[~2019-09-06 15:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 12:30 [PATCH] drm/panfrost: Fix regulator_get_optional() misuse Mark Brown
2019-09-05 8:21 ` Rob Herring
2019-09-05 9:37 ` Steven Price
2019-09-05 12:40 ` Mark Brown
2019-09-05 13:02 ` Steven Price
2019-09-05 13:49 ` Neil Armstrong
2019-09-05 16:34 ` Mark Brown
2019-09-06 10:00 ` Steven Price
2019-09-06 10:55 ` Mark Brown
2019-09-06 14:45 ` Steven Price
2019-09-06 15:23 ` Steven Price [this message]
2019-09-09 15:41 ` Rob Herring
2019-09-09 16:22 ` Steven Price
2019-09-19 16:55 ` Rob Herring
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=ccd81530-2dbd-3c02-ca0a-1085b00663b5@arm.com \
--to=steven.price@arm.com \
--cc=airlied@linux.ie \
--cc=broonie@kernel.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=tomeu.vizoso@collabora.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