All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFT PATCH v2 1/2] regulator: core: Require regulator drivers to check uV for get_optimum_mode()
@ 2022-08-24 21:22 Douglas Anderson
  2022-08-24 21:22 ` [RFT PATCH v2 2/2] regulator: core: Don't err if allow-set-load but no allowed-modes Douglas Anderson
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Douglas Anderson @ 2022-08-24 21:22 UTC (permalink / raw)
  To: Mark Brown; +Cc: Andrew Halaney, Douglas Anderson, Liam Girdwood, linux-kernel

The get_optimum_mode() for regulator drivers is passed the input
voltage and output voltage as well as the current. This is because, in
theory, the optimum mode can depend on all three things.

It turns out that for all regulator drivers in mainline only the
current is looked at when implementing get_optimum_mode(). None of the
drivers take the input or output voltage into account. Despite the
fact that none of the drivers take the input or output voltage into
account, though, the regulator framework will error out before calling
into get_optimum_mode() if it doesn't know the input or output
voltage.

The above behavior turned out to be a probelm for some boards when we
landed commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
get_optimum_mode(), not set_load()"). Before that change we'd have no
problems running drms_uA_update() for RPMH regulators even if a
regulator's input or output voltage was unknown. After that change
drms_uA_update() started to fail. This is because typically boards
using RPMH regulators don't model the input supplies of RPMH
regulators. Input supplies for RPMH regulators nearly always come from
the output of other RPMH regulators (or always-on regulators) and RPMH
firmware is initialized with this knowledge and handles enabling (and
adjusting the voltage of) input supplies. While we could model the
parent/child relationship of the regulators in Linux, many boards
don't bother since it adds extra overhead.

Let's change the regulator core to make things work again. Now if we
fail to get the input or output voltage we'll still call into
get_optimum_mode() and we'll just pass error codes in for input_uV
and/or output_uV parameters.

Since no existing regulator drivers even look at input_uV and
output_uV we don't need to add this error handling anywhere right
now. We'll add some comments in the core so that it's obvious that (if
regulator drivers care) it's up to them to add the checks.

Reported-by: Andrew Halaney <ahalaney@redhat.com>
Fixes: efb0cb50c427 ("regulator: qcom-rpmh: Implement get_optimum_mode(), not set_load()")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

(no changes since v1)

 drivers/regulator/core.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5b5da14976c2..0bc4b9b0a885 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -979,10 +979,13 @@ static int drms_uA_update(struct regulator_dev *rdev)
 	} else {
 		/* get output voltage */
 		output_uV = regulator_get_voltage_rdev(rdev);
-		if (output_uV <= 0) {
-			rdev_err(rdev, "invalid output voltage found\n");
-			return -EINVAL;
-		}
+
+		/*
+		 * Don't return an error; if regulator driver cares about
+		 * output_uV then it's up to the driver to validate.
+		 */
+		if (output_uV <= 0)
+			rdev_dbg(rdev, "invalid output voltage found\n");
 
 		/* get input voltage */
 		input_uV = 0;
@@ -990,10 +993,13 @@ static int drms_uA_update(struct regulator_dev *rdev)
 			input_uV = regulator_get_voltage(rdev->supply);
 		if (input_uV <= 0)
 			input_uV = rdev->constraints->input_uV;
-		if (input_uV <= 0) {
-			rdev_err(rdev, "invalid input voltage found\n");
-			return -EINVAL;
-		}
+
+		/*
+		 * Don't return an error; if regulator driver cares about
+		 * input_uV then it's up to the driver to validate.
+		 */
+		if (input_uV <= 0)
+			rdev_dbg(rdev, "invalid input voltage found\n");
 
 		/* now get the optimum mode for our new total regulator load */
 		mode = rdev->desc->ops->get_optimum_mode(rdev, input_uV,
-- 
2.37.2.672.g94769d06f0-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFT PATCH v2 2/2] regulator: core: Don't err if allow-set-load but no allowed-modes
  2022-08-24 21:22 [RFT PATCH v2 1/2] regulator: core: Require regulator drivers to check uV for get_optimum_mode() Douglas Anderson
@ 2022-08-24 21:22 ` Douglas Anderson
  2022-08-25 15:14   ` Andrew Halaney
  2022-08-25 15:15 ` [RFT PATCH v2 1/2] regulator: core: Require regulator drivers to check uV for get_optimum_mode() Andrew Halaney
  2022-08-28 21:03 ` Mark Brown
  2 siblings, 1 reply; 7+ messages in thread
From: Douglas Anderson @ 2022-08-24 21:22 UTC (permalink / raw)
  To: Mark Brown; +Cc: Andrew Halaney, Douglas Anderson, Liam Girdwood, linux-kernel

Apparently the device trees of some boards have the property
"regulator-allow-set-load" for some of their regulators but then they
don't specify anything for "regulator-allowed-modes". That's not
really legit, but...

...before commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
get_optimum_mode(), not set_load()") they used to get away with it, at
least on boards using RPMH regulators. That's because when a regulator
driver implements set_load() then the core doesn't look at
"regulator-allowed-modes" when trying to automatically adjust things
in response to the regulator's load. The core doesn't know what mode
we'll end up in, so how could it validate it?

Said another way: before commit efb0cb50c427 ("regulator: qcom-rpmh:
Implement get_optimum_mode(), not set_load()") some boards _were_
having the regulator mode adjusted despite listing no allowed
modes. After commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
get_optimum_mode(), not set_load()") these same boards were now
getting an error returned when trying to use their regulators, since
simply enabling a regulator tries to update its load and that was
failing.

We don't really want to go back to the behavior from before commit
efb0cb50c427 ("regulator: qcom-rpmh: Implement get_optimum_mode(), not
set_load()"). Boards shouldn't have been changing modes if no allowed
modes were listed. However, the behavior after commit efb0cb50c427
("regulator: qcom-rpmh: Implement get_optimum_mode(), not set_load()")
isn't the best because now boards can't even turn their regulators on.

Let's choose to detect this case and return "no error" from
drms_uA_update(). The net-result will be _different_ behavior than we
had before commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
get_optimum_mode(), not set_load()"), but this new behavior seems more
correct. If a board truly needed the mode switched then its device
tree should be updated to list the allowed modes.

Reported-by: Andrew Halaney <ahalaney@redhat.com>
Fixes: efb0cb50c427 ("regulator: qcom-rpmh: Implement get_optimum_mode(), not set_load()")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

Changes in v2:
- Added ("Don't err if allow-set-load but no allowed-modes").

 drivers/regulator/core.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 0bc4b9b0a885..1d030831aeae 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -977,6 +977,18 @@ static int drms_uA_update(struct regulator_dev *rdev)
 			rdev_err(rdev, "failed to set load %d: %pe\n",
 				 current_uA, ERR_PTR(err));
 	} else {
+		/*
+		 * Unfortunately in some cases the constraints->valid_ops has
+		 * REGULATOR_CHANGE_DRMS but there are no valid modes listed.
+		 * That's not really legit but we won't consider it a fatal
+		 * error here. We'll treat it as if REGULATOR_CHANGE_DRMS
+		 * wasn't set.
+		 */
+		if (!rdev->constraints->valid_modes_mask) {
+			rdev_dbg(rdev, "Can change modes; but no valid mode\n");
+			return 0;
+		}
+
 		/* get output voltage */
 		output_uV = regulator_get_voltage_rdev(rdev);
 
-- 
2.37.2.672.g94769d06f0-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFT PATCH v2 2/2] regulator: core: Don't err if allow-set-load but no allowed-modes
  2022-08-24 21:22 ` [RFT PATCH v2 2/2] regulator: core: Don't err if allow-set-load but no allowed-modes Douglas Anderson
@ 2022-08-25 15:14   ` Andrew Halaney
  2022-08-25 16:43     ` Doug Anderson
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Halaney @ 2022-08-25 15:14 UTC (permalink / raw)
  To: Douglas Anderson; +Cc: Mark Brown, Liam Girdwood, linux-kernel

On Wed, Aug 24, 2022 at 02:22:57PM -0700, Douglas Anderson wrote:
> Apparently the device trees of some boards have the property
> "regulator-allow-set-load" for some of their regulators but then they
> don't specify anything for "regulator-allowed-modes". That's not
> really legit, but...
>
> ...before commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
> get_optimum_mode(), not set_load()") they used to get away with it, at
> least on boards using RPMH regulators. That's because when a regulator
> driver implements set_load() then the core doesn't look at
> "regulator-allowed-modes" when trying to automatically adjust things
> in response to the regulator's load. The core doesn't know what mode
> we'll end up in, so how could it validate it?
>
> Said another way: before commit efb0cb50c427 ("regulator: qcom-rpmh:
> Implement get_optimum_mode(), not set_load()") some boards _were_
> having the regulator mode adjusted despite listing no allowed
> modes. After commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
> get_optimum_mode(), not set_load()") these same boards were now
> getting an error returned when trying to use their regulators, since
> simply enabling a regulator tries to update its load and that was
> failing.
>
> We don't really want to go back to the behavior from before commit
> efb0cb50c427 ("regulator: qcom-rpmh: Implement get_optimum_mode(), not
> set_load()"). Boards shouldn't have been changing modes if no allowed
> modes were listed. However, the behavior after commit efb0cb50c427
> ("regulator: qcom-rpmh: Implement get_optimum_mode(), not set_load()")
> isn't the best because now boards can't even turn their regulators on.
>
> Let's choose to detect this case and return "no error" from
> drms_uA_update(). The net-result will be _different_ behavior than we
> had before commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
> get_optimum_mode(), not set_load()"), but this new behavior seems more
> correct. If a board truly needed the mode switched then its device
> tree should be updated to list the allowed modes.
>
> Reported-by: Andrew Halaney <ahalaney@redhat.com>
> Fixes: efb0cb50c427 ("regulator: qcom-rpmh: Implement get_optimum_mode(), not set_load()")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

Tested-by: Andrew Halaney <ahalaney@redhat.com>

As you made clear in the commit message, a good number of boards will
have a change in behavior since efb0cb50c427 ("regulator: qcom-rpmh: Implement
get_optimum_mode(), not set_load()") and associated fixes. I agree that
these devices are not properly described. Is there any sort of heads up we
should give? Just looking at the Qualcomm devicetrees for aarch64, I see all
of these are affected:

    apq8016-sbc.dts
    apq8096-db820c.dts
    apq8096-ifc6640.dts
    msm8916-alcatel-idol347.dts
    msm8916-asus-z00l.dts
    msm8916-huawei-g7.dts
    msm8916-longcheer-l8150.dts
    msm8916-longcheer-l8910.dts
    msm8916-samsung-a2015-common.dtsi
    msm8916-samsung-j5.dts
    msm8916-samsung-serranove.dts
    msm8916-wingtech-wt88047.dts
    msm8992-lg-bullhead.dtsi
    msm8992-xiaomi-libra.dts
    msm8994-msft-lumia-octagon.dtsi
    msm8994-sony-xperia-kitakami.dtsi
    msm8996-sony-xperia-tone.dtsi
    msm8996-xiaomi-common.dtsi
    msm8998-clamshell.dtsi
    msm8998-fxtec-pro1.dts
    msm8998-mtp.dts
    msm8998-oneplus-common.dtsi
    msm8998-sony-xperia-yoshino.dtsi
    sa8155p-adp.dts
    sa8xxxp-auto-adp.dtsi
    sc8280xp-crd.dts
    sc8280xp-lenovo-thinkpad-x13s.dts
    sda660-inforce-ifc6560.dts
    sdm630-sony-xperia-nile.dtsi
    sdm660-xiaomi-lavender.dts
    sm8150-sony-xperia-kumano.dtsi
    sm8250-sony-xperia-edo.dtsi
    sm8350-hdk.dts

Thanks,
Andrew


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFT PATCH v2 1/2] regulator: core: Require regulator drivers to check uV for get_optimum_mode()
  2022-08-24 21:22 [RFT PATCH v2 1/2] regulator: core: Require regulator drivers to check uV for get_optimum_mode() Douglas Anderson
  2022-08-24 21:22 ` [RFT PATCH v2 2/2] regulator: core: Don't err if allow-set-load but no allowed-modes Douglas Anderson
@ 2022-08-25 15:15 ` Andrew Halaney
  2022-08-28 21:03 ` Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Andrew Halaney @ 2022-08-25 15:15 UTC (permalink / raw)
  To: Douglas Anderson; +Cc: Mark Brown, Liam Girdwood, linux-kernel

On Wed, Aug 24, 2022 at 02:22:56PM -0700, Douglas Anderson wrote:
> The get_optimum_mode() for regulator drivers is passed the input
> voltage and output voltage as well as the current. This is because, in
> theory, the optimum mode can depend on all three things.
> 
> It turns out that for all regulator drivers in mainline only the
> current is looked at when implementing get_optimum_mode(). None of the
> drivers take the input or output voltage into account. Despite the
> fact that none of the drivers take the input or output voltage into
> account, though, the regulator framework will error out before calling
> into get_optimum_mode() if it doesn't know the input or output
> voltage.
> 
> The above behavior turned out to be a probelm for some boards when we
> landed commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
> get_optimum_mode(), not set_load()"). Before that change we'd have no
> problems running drms_uA_update() for RPMH regulators even if a
> regulator's input or output voltage was unknown. After that change
> drms_uA_update() started to fail. This is because typically boards
> using RPMH regulators don't model the input supplies of RPMH
> regulators. Input supplies for RPMH regulators nearly always come from
> the output of other RPMH regulators (or always-on regulators) and RPMH
> firmware is initialized with this knowledge and handles enabling (and
> adjusting the voltage of) input supplies. While we could model the
> parent/child relationship of the regulators in Linux, many boards
> don't bother since it adds extra overhead.
> 
> Let's change the regulator core to make things work again. Now if we
> fail to get the input or output voltage we'll still call into
> get_optimum_mode() and we'll just pass error codes in for input_uV
> and/or output_uV parameters.
> 
> Since no existing regulator drivers even look at input_uV and
> output_uV we don't need to add this error handling anywhere right
> now. We'll add some comments in the core so that it's obvious that (if
> regulator drivers care) it's up to them to add the checks.
> 
> Reported-by: Andrew Halaney <ahalaney@redhat.com>
> Fixes: efb0cb50c427 ("regulator: qcom-rpmh: Implement get_optimum_mode(), not set_load()")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

Tested-by: Andrew Halaney <ahalaney@redhat.com>

Thanks again for the quick patches!
 - Andrew


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFT PATCH v2 2/2] regulator: core: Don't err if allow-set-load but no allowed-modes
  2022-08-25 15:14   ` Andrew Halaney
@ 2022-08-25 16:43     ` Doug Anderson
  2022-08-25 17:00       ` Andrew Halaney
  0 siblings, 1 reply; 7+ messages in thread
From: Doug Anderson @ 2022-08-25 16:43 UTC (permalink / raw)
  To: Andrew Halaney; +Cc: Mark Brown, Liam Girdwood, LKML

Hi,

On Thu, Aug 25, 2022 at 8:14 AM Andrew Halaney <ahalaney@redhat.com> wrote:
>
> On Wed, Aug 24, 2022 at 02:22:57PM -0700, Douglas Anderson wrote:
> > Apparently the device trees of some boards have the property
> > "regulator-allow-set-load" for some of their regulators but then they
> > don't specify anything for "regulator-allowed-modes". That's not
> > really legit, but...
> >
> > ...before commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
> > get_optimum_mode(), not set_load()") they used to get away with it, at
> > least on boards using RPMH regulators. That's because when a regulator
> > driver implements set_load() then the core doesn't look at
> > "regulator-allowed-modes" when trying to automatically adjust things
> > in response to the regulator's load. The core doesn't know what mode
> > we'll end up in, so how could it validate it?
> >
> > Said another way: before commit efb0cb50c427 ("regulator: qcom-rpmh:
> > Implement get_optimum_mode(), not set_load()") some boards _were_
> > having the regulator mode adjusted despite listing no allowed
> > modes. After commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
> > get_optimum_mode(), not set_load()") these same boards were now
> > getting an error returned when trying to use their regulators, since
> > simply enabling a regulator tries to update its load and that was
> > failing.
> >
> > We don't really want to go back to the behavior from before commit
> > efb0cb50c427 ("regulator: qcom-rpmh: Implement get_optimum_mode(), not
> > set_load()"). Boards shouldn't have been changing modes if no allowed
> > modes were listed. However, the behavior after commit efb0cb50c427
> > ("regulator: qcom-rpmh: Implement get_optimum_mode(), not set_load()")
> > isn't the best because now boards can't even turn their regulators on.
> >
> > Let's choose to detect this case and return "no error" from
> > drms_uA_update(). The net-result will be _different_ behavior than we
> > had before commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
> > get_optimum_mode(), not set_load()"), but this new behavior seems more
> > correct. If a board truly needed the mode switched then its device
> > tree should be updated to list the allowed modes.
> >
> > Reported-by: Andrew Halaney <ahalaney@redhat.com>
> > Fixes: efb0cb50c427 ("regulator: qcom-rpmh: Implement get_optimum_mode(), not set_load()")
> > Signed-off-by: Douglas Anderson <dianders@chromium.org>
>
> Tested-by: Andrew Halaney <ahalaney@redhat.com>
>
> As you made clear in the commit message, a good number of boards will
> have a change in behavior since efb0cb50c427 ("regulator: qcom-rpmh: Implement
> get_optimum_mode(), not set_load()") and associated fixes. I agree that
> these devices are not properly described. Is there any sort of heads up we
> should give? Just looking at the Qualcomm devicetrees for aarch64, I see all
> of these are affected:
>
>     apq8016-sbc.dts
>     apq8096-db820c.dts
>     apq8096-ifc6640.dts
>     msm8916-alcatel-idol347.dts
>     msm8916-asus-z00l.dts
>     msm8916-huawei-g7.dts
>     msm8916-longcheer-l8150.dts
>     msm8916-longcheer-l8910.dts
>     msm8916-samsung-a2015-common.dtsi
>     msm8916-samsung-j5.dts
>     msm8916-samsung-serranove.dts
>     msm8916-wingtech-wt88047.dts
>     msm8992-lg-bullhead.dtsi
>     msm8992-xiaomi-libra.dts
>     msm8994-msft-lumia-octagon.dtsi
>     msm8994-sony-xperia-kitakami.dtsi
>     msm8996-sony-xperia-tone.dtsi
>     msm8996-xiaomi-common.dtsi
>     msm8998-clamshell.dtsi
>     msm8998-fxtec-pro1.dts
>     msm8998-mtp.dts
>     msm8998-oneplus-common.dtsi
>     msm8998-sony-xperia-yoshino.dtsi
>     sa8155p-adp.dts
>     sa8xxxp-auto-adp.dtsi
>     sc8280xp-crd.dts
>     sc8280xp-lenovo-thinkpad-x13s.dts
>     sda660-inforce-ifc6560.dts
>     sdm630-sony-xperia-nile.dtsi
>     sdm660-xiaomi-lavender.dts
>     sm8150-sony-xperia-kumano.dtsi
>     sm8250-sony-xperia-edo.dtsi
>     sm8350-hdk.dts

True, it would be a good idea to send out fixes. OK, so let's see. We
can probably get fairly close to seeing who is affected with these
greps:

rpmh_users=$(git grep -l -i rpmh -- arch/arm*/boot/dts/qcom)
set_modes=$(grep -l regulator-allow-set-load ${rpmh_users})
but_no_allowed_modes=$(grep -l -v regulator-allowed-modes ${set_modes})

That actually gives a (much)shorter list than yours. Why?

Ah. Your list includes not just RPMH users but also RPM users. RPM
users _won't_ be affected. In RPM regulators we don't actually track
the modes in the kernel--we actually pass the load directly to the
remote processor and it handles translating that into loads. RPM
regulators don't even have a way to directly set the mode.

...so we only need to fix a small number (7) boards.

Posting up patches now. OK, the cover letter should show up shortly at:

https://lore.kernel.org/r/20220825164205.4060647-1-dianders@chromium.org

-Doug

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFT PATCH v2 2/2] regulator: core: Don't err if allow-set-load but no allowed-modes
  2022-08-25 16:43     ` Doug Anderson
@ 2022-08-25 17:00       ` Andrew Halaney
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Halaney @ 2022-08-25 17:00 UTC (permalink / raw)
  To: Doug Anderson; +Cc: Mark Brown, Liam Girdwood, LKML

On Thu, Aug 25, 2022 at 09:43:45AM -0700, Doug Anderson wrote:
> Hi,
> 
> On Thu, Aug 25, 2022 at 8:14 AM Andrew Halaney <ahalaney@redhat.com> wrote:
> >
> > On Wed, Aug 24, 2022 at 02:22:57PM -0700, Douglas Anderson wrote:
> > > Apparently the device trees of some boards have the property
> > > "regulator-allow-set-load" for some of their regulators but then they
> > > don't specify anything for "regulator-allowed-modes". That's not
> > > really legit, but...
> > >
> > > ...before commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
> > > get_optimum_mode(), not set_load()") they used to get away with it, at
> > > least on boards using RPMH regulators. That's because when a regulator
> > > driver implements set_load() then the core doesn't look at
> > > "regulator-allowed-modes" when trying to automatically adjust things
> > > in response to the regulator's load. The core doesn't know what mode
> > > we'll end up in, so how could it validate it?
> > >
> > > Said another way: before commit efb0cb50c427 ("regulator: qcom-rpmh:
> > > Implement get_optimum_mode(), not set_load()") some boards _were_
> > > having the regulator mode adjusted despite listing no allowed
> > > modes. After commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
> > > get_optimum_mode(), not set_load()") these same boards were now
> > > getting an error returned when trying to use their regulators, since
> > > simply enabling a regulator tries to update its load and that was
> > > failing.
> > >
> > > We don't really want to go back to the behavior from before commit
> > > efb0cb50c427 ("regulator: qcom-rpmh: Implement get_optimum_mode(), not
> > > set_load()"). Boards shouldn't have been changing modes if no allowed
> > > modes were listed. However, the behavior after commit efb0cb50c427
> > > ("regulator: qcom-rpmh: Implement get_optimum_mode(), not set_load()")
> > > isn't the best because now boards can't even turn their regulators on.
> > >
> > > Let's choose to detect this case and return "no error" from
> > > drms_uA_update(). The net-result will be _different_ behavior than we
> > > had before commit efb0cb50c427 ("regulator: qcom-rpmh: Implement
> > > get_optimum_mode(), not set_load()"), but this new behavior seems more
> > > correct. If a board truly needed the mode switched then its device
> > > tree should be updated to list the allowed modes.
> > >
> > > Reported-by: Andrew Halaney <ahalaney@redhat.com>
> > > Fixes: efb0cb50c427 ("regulator: qcom-rpmh: Implement get_optimum_mode(), not set_load()")
> > > Signed-off-by: Douglas Anderson <dianders@chromium.org>
> >
> > Tested-by: Andrew Halaney <ahalaney@redhat.com>
> >
> > As you made clear in the commit message, a good number of boards will
> > have a change in behavior since efb0cb50c427 ("regulator: qcom-rpmh: Implement
> > get_optimum_mode(), not set_load()") and associated fixes. I agree that
> > these devices are not properly described. Is there any sort of heads up we
> > should give? Just looking at the Qualcomm devicetrees for aarch64, I see all
> > of these are affected:
> >
> >     apq8016-sbc.dts
> >     apq8096-db820c.dts
> >     apq8096-ifc6640.dts
> >     msm8916-alcatel-idol347.dts
> >     msm8916-asus-z00l.dts
> >     msm8916-huawei-g7.dts
> >     msm8916-longcheer-l8150.dts
> >     msm8916-longcheer-l8910.dts
> >     msm8916-samsung-a2015-common.dtsi
> >     msm8916-samsung-j5.dts
> >     msm8916-samsung-serranove.dts
> >     msm8916-wingtech-wt88047.dts
> >     msm8992-lg-bullhead.dtsi
> >     msm8992-xiaomi-libra.dts
> >     msm8994-msft-lumia-octagon.dtsi
> >     msm8994-sony-xperia-kitakami.dtsi
> >     msm8996-sony-xperia-tone.dtsi
> >     msm8996-xiaomi-common.dtsi
> >     msm8998-clamshell.dtsi
> >     msm8998-fxtec-pro1.dts
> >     msm8998-mtp.dts
> >     msm8998-oneplus-common.dtsi
> >     msm8998-sony-xperia-yoshino.dtsi
> >     sa8155p-adp.dts
> >     sa8xxxp-auto-adp.dtsi
> >     sc8280xp-crd.dts
> >     sc8280xp-lenovo-thinkpad-x13s.dts
> >     sda660-inforce-ifc6560.dts
> >     sdm630-sony-xperia-nile.dtsi
> >     sdm660-xiaomi-lavender.dts
> >     sm8150-sony-xperia-kumano.dtsi
> >     sm8250-sony-xperia-edo.dtsi
> >     sm8350-hdk.dts
> 
> True, it would be a good idea to send out fixes. OK, so let's see. We
> can probably get fairly close to seeing who is affected with these
> greps:
> 
> rpmh_users=$(git grep -l -i rpmh -- arch/arm*/boot/dts/qcom)
> set_modes=$(grep -l regulator-allow-set-load ${rpmh_users})
> but_no_allowed_modes=$(grep -l -v regulator-allowed-modes ${set_modes})
> 
> That actually gives a (much)shorter list than yours. Why?
> 
> Ah. Your list includes not just RPMH users but also RPM users. RPM
> users _won't_ be affected. In RPM regulators we don't actually track
> the modes in the kernel--we actually pass the load directly to the
> remote processor and it handles translating that into loads. RPM
> regulators don't even have a way to directly set the mode.
> 
> ...so we only need to fix a small number (7) boards.
> 
> Posting up patches now. OK, the cover letter should show up shortly at:
> 
> https://lore.kernel.org/r/20220825164205.4060647-1-dianders@chromium.org
> 
> -Doug
> 

Thanks for the grep-fu, I didn't even think about RPM vs RPMH,
I will try and review those today!

 - Andrew


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFT PATCH v2 1/2] regulator: core: Require regulator drivers to check uV for get_optimum_mode()
  2022-08-24 21:22 [RFT PATCH v2 1/2] regulator: core: Require regulator drivers to check uV for get_optimum_mode() Douglas Anderson
  2022-08-24 21:22 ` [RFT PATCH v2 2/2] regulator: core: Don't err if allow-set-load but no allowed-modes Douglas Anderson
  2022-08-25 15:15 ` [RFT PATCH v2 1/2] regulator: core: Require regulator drivers to check uV for get_optimum_mode() Andrew Halaney
@ 2022-08-28 21:03 ` Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2022-08-28 21:03 UTC (permalink / raw)
  To: dianders; +Cc: lgirdwood, ahalaney, linux-kernel

On Wed, 24 Aug 2022 14:22:56 -0700, Douglas Anderson wrote:
> The get_optimum_mode() for regulator drivers is passed the input
> voltage and output voltage as well as the current. This is because, in
> theory, the optimum mode can depend on all three things.
> 
> It turns out that for all regulator drivers in mainline only the
> current is looked at when implementing get_optimum_mode(). None of the
> drivers take the input or output voltage into account. Despite the
> fact that none of the drivers take the input or output voltage into
> account, though, the regulator framework will error out before calling
> into get_optimum_mode() if it doesn't know the input or output
> voltage.
> 
> [...]

Applied to

   broonie/regulator.git for-next

Thanks!

[1/2] regulator: core: Require regulator drivers to check uV for get_optimum_mode()
      commit: 55841199050d0c6c44eb7f24717816e6e372599f
[2/2] regulator: core: Don't err if allow-set-load but no allowed-modes
      commit: 57919f4a2ea47f75ac6117f7d99831f7fbd89bc7

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-28 21:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-24 21:22 [RFT PATCH v2 1/2] regulator: core: Require regulator drivers to check uV for get_optimum_mode() Douglas Anderson
2022-08-24 21:22 ` [RFT PATCH v2 2/2] regulator: core: Don't err if allow-set-load but no allowed-modes Douglas Anderson
2022-08-25 15:14   ` Andrew Halaney
2022-08-25 16:43     ` Doug Anderson
2022-08-25 17:00       ` Andrew Halaney
2022-08-25 15:15 ` [RFT PATCH v2 1/2] regulator: core: Require regulator drivers to check uV for get_optimum_mode() Andrew Halaney
2022-08-28 21:03 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.