linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] Add supply into PWBUS_REGULATOR macro
@ 2022-02-21 11:09 Marcello Sylvester Bauer
  2022-02-21 11:09 ` [PATCH v2 1/1] hwmon: (pmbus) Add regulator supply into macro Marcello Sylvester Bauer
  0 siblings, 1 reply; 6+ messages in thread
From: Marcello Sylvester Bauer @ 2022-02-21 11:09 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare
  Cc: linux-kernel, linux-hwmon, Patrick Rudolph, Marcello Sylvester Bauer

Hi,

I would like to extend the PWBUS_REGULATOR macro to be able to define
a vin-supply. This makes it possible to regulate the voltage input
supply and even turn it off, if not required.

Change in v2:
- Adapt commit message.

Marcello Sylvester Bauer (1):
  hwmon: (pmbus) Add regulator supply into macro

 drivers/hwmon/pmbus/pmbus.h | 1 +
 1 file changed, 1 insertion(+)

-- 
2.34.1


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

* [PATCH v2 1/1] hwmon: (pmbus) Add regulator supply into macro
  2022-02-21 11:09 [PATCH v2 0/1] Add supply into PWBUS_REGULATOR macro Marcello Sylvester Bauer
@ 2022-02-21 11:09 ` Marcello Sylvester Bauer
  2022-02-22 16:51   ` Guenter Roeck
  0 siblings, 1 reply; 6+ messages in thread
From: Marcello Sylvester Bauer @ 2022-02-21 11:09 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare
  Cc: linux-kernel, linux-hwmon, Patrick Rudolph, Marcello Sylvester Bauer

Add regulator supply into PWBUS_REGULATOR macro. This makes it optional
to define a vin-supply in DT. Not defining a supply will add a dummy
regulator supply instead and only cause the following debug output:

```
Looking up vin-supply property in node [...] failed
```

Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io>
---
 drivers/hwmon/pmbus/pmbus.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
index e0aa8aa46d8c..38f049d68d32 100644
--- a/drivers/hwmon/pmbus/pmbus.h
+++ b/drivers/hwmon/pmbus/pmbus.h
@@ -464,6 +464,7 @@ extern const struct regulator_ops pmbus_regulator_ops;
 #define PMBUS_REGULATOR(_name, _id)				\
 	[_id] = {						\
 		.name = (_name # _id),				\
+		.supply_name = "vin",				\
 		.id = (_id),					\
 		.of_match = of_match_ptr(_name # _id),		\
 		.regulators_node = of_match_ptr("regulators"),	\
-- 
2.34.1


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

* Re: [PATCH v2 1/1] hwmon: (pmbus) Add regulator supply into macro
  2022-02-21 11:09 ` [PATCH v2 1/1] hwmon: (pmbus) Add regulator supply into macro Marcello Sylvester Bauer
@ 2022-02-22 16:51   ` Guenter Roeck
  2022-11-04 22:30     ` Zev Weiss
  0 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2022-02-22 16:51 UTC (permalink / raw)
  To: Marcello Sylvester Bauer
  Cc: Jean Delvare, linux-kernel, linux-hwmon, Patrick Rudolph

On Mon, Feb 21, 2022 at 12:09:56PM +0100, Marcello Sylvester Bauer wrote:
> Add regulator supply into PWBUS_REGULATOR macro. This makes it optional
> to define a vin-supply in DT. Not defining a supply will add a dummy
> regulator supply instead and only cause the following debug output:
> 
> ```
> Looking up vin-supply property in node [...] failed
> ```
> 
> Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io>

Applied to hwmon-next. That should give it some time to mature,
and we can pull or modify it if it causes any problems.

Thanks,
Guenter

> ---
>  drivers/hwmon/pmbus/pmbus.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
> index e0aa8aa46d8c..38f049d68d32 100644
> --- a/drivers/hwmon/pmbus/pmbus.h
> +++ b/drivers/hwmon/pmbus/pmbus.h
> @@ -464,6 +464,7 @@ extern const struct regulator_ops pmbus_regulator_ops;
>  #define PMBUS_REGULATOR(_name, _id)				\
>  	[_id] = {						\
>  		.name = (_name # _id),				\
> +		.supply_name = "vin",				\
>  		.id = (_id),					\
>  		.of_match = of_match_ptr(_name # _id),		\
>  		.regulators_node = of_match_ptr("regulators"),	\

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

* Re: [PATCH v2 1/1] hwmon: (pmbus) Add regulator supply into macro
  2022-02-22 16:51   ` Guenter Roeck
@ 2022-11-04 22:30     ` Zev Weiss
  2022-11-04 23:42       ` Guenter Roeck
  0 siblings, 1 reply; 6+ messages in thread
From: Zev Weiss @ 2022-11-04 22:30 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Marcello Sylvester Bauer, Jean Delvare, linux-kernel,
	linux-hwmon, Patrick Rudolph

On Tue, Feb 22, 2022 at 08:51:04AM PST, Guenter Roeck wrote:
>On Mon, Feb 21, 2022 at 12:09:56PM +0100, Marcello Sylvester Bauer wrote:
>> Add regulator supply into PWBUS_REGULATOR macro. This makes it optional
>> to define a vin-supply in DT. Not defining a supply will add a dummy
>> regulator supply instead and only cause the following debug output:
>>
>> ```
>> Looking up vin-supply property in node [...] failed
>> ```
>>
>> Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io>
>
>Applied to hwmon-next. That should give it some time to mature,
>and we can pull or modify it if it causes any problems.
>

Wish I'd caught this sooner, but unfortunately I've just discovered that 
this does in fact cause breakage on my systems -- having regulator-dummy 
set as a supply on my PMBus regulators (instead of having them as their 
own top-level regulators without an upstream supply) leads to 
enable-count underflow errors when disabling them:

     # echo 0 > /sys/bus/platform/devices/efuse01/state
     [  906.094477] regulator-dummy: Underflow of regulator enable count
     [  906.100563] Failed to disable vout: -EINVAL
     [  136.992676] reg-userspace-consumer efuse01: Failed to configure state: -22

A simple revert solves the problem for me, but since I'm honestly a 
little unclear on the intent of the patch itself I'm not sure what a 
revert might break and hence I don't know if that's necessarily the 
right fix.  Marcello (or others), any thoughts?


Thanks,
Zev


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

* Re: [PATCH v2 1/1] hwmon: (pmbus) Add regulator supply into macro
  2022-11-04 22:30     ` Zev Weiss
@ 2022-11-04 23:42       ` Guenter Roeck
  2022-11-05  1:43         ` Marcello Sylverster Bauer
  0 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2022-11-04 23:42 UTC (permalink / raw)
  To: Zev Weiss
  Cc: Marcello Sylvester Bauer, Jean Delvare, linux-kernel,
	linux-hwmon, Patrick Rudolph

On Fri, Nov 04, 2022 at 03:30:30PM -0700, Zev Weiss wrote:
> On Tue, Feb 22, 2022 at 08:51:04AM PST, Guenter Roeck wrote:
> > On Mon, Feb 21, 2022 at 12:09:56PM +0100, Marcello Sylvester Bauer wrote:
> > > Add regulator supply into PWBUS_REGULATOR macro. This makes it optional
> > > to define a vin-supply in DT. Not defining a supply will add a dummy
> > > regulator supply instead and only cause the following debug output:
> > > 
> > > ```
> > > Looking up vin-supply property in node [...] failed
> > > ```
> > > 
> > > Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io>
> > 
> > Applied to hwmon-next. That should give it some time to mature,
> > and we can pull or modify it if it causes any problems.
> > 
> 
> Wish I'd caught this sooner, but unfortunately I've just discovered that
> this does in fact cause breakage on my systems -- having regulator-dummy set
> as a supply on my PMBus regulators (instead of having them as their own
> top-level regulators without an upstream supply) leads to enable-count
> underflow errors when disabling them:
> 
>     # echo 0 > /sys/bus/platform/devices/efuse01/state
>     [  906.094477] regulator-dummy: Underflow of regulator enable count
>     [  906.100563] Failed to disable vout: -EINVAL
>     [  136.992676] reg-userspace-consumer efuse01: Failed to configure state: -22
> 
> A simple revert solves the problem for me, but since I'm honestly a little
> unclear on the intent of the patch itself I'm not sure what a revert might
> break and hence I don't know if that's necessarily the right fix.  Marcello
> (or others), any thoughts?

Revert now, ask questions later. I'll send a patch.

Guenter

> 
> 
> Thanks,
> Zev
> 

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

* Re: [PATCH v2 1/1] hwmon: (pmbus) Add regulator supply into macro
  2022-11-04 23:42       ` Guenter Roeck
@ 2022-11-05  1:43         ` Marcello Sylverster Bauer
  0 siblings, 0 replies; 6+ messages in thread
From: Marcello Sylverster Bauer @ 2022-11-05  1:43 UTC (permalink / raw)
  To: Guenter Roeck, Zev Weiss
  Cc: Jean Delvare, linux-kernel, linux-hwmon, Patrick Rudolph


On 11/5/22 00:42, Guenter Roeck wrote:
> On Fri, Nov 04, 2022 at 03:30:30PM -0700, Zev Weiss wrote:
>> On Tue, Feb 22, 2022 at 08:51:04AM PST, Guenter Roeck wrote:
>>> On Mon, Feb 21, 2022 at 12:09:56PM +0100, Marcello Sylvester Bauer wrote:
>>>> Add regulator supply into PWBUS_REGULATOR macro. This makes it optional
>>>> to define a vin-supply in DT. Not defining a supply will add a dummy
>>>> regulator supply instead and only cause the following debug output:
>>>>
>>>> ```
>>>> Looking up vin-supply property in node [...] failed
>>>> ```
>>>>
>>>> Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io>
>>> Applied to hwmon-next. That should give it some time to mature,
>>> and we can pull or modify it if it causes any problems.
>>>
>> Wish I'd caught this sooner, but unfortunately I've just discovered that
>> this does in fact cause breakage on my systems -- having regulator-dummy set
>> as a supply on my PMBus regulators (instead of having them as their own
>> top-level regulators without an upstream supply) leads to enable-count
>> underflow errors when disabling them:
>>
>>      # echo 0 > /sys/bus/platform/devices/efuse01/state
>>      [  906.094477] regulator-dummy: Underflow of regulator enable count
>>      [  906.100563] Failed to disable vout: -EINVAL
>>      [  136.992676] reg-userspace-consumer efuse01: Failed to configure state: -22
>>
>> A simple revert solves the problem for me, but since I'm honestly a little
>> unclear on the intent of the patch itself I'm not sure what a revert might
>> break and hence I don't know if that's necessarily the right fix.  Marcello
>> (or others), any thoughts?
Oh, my bad. I thought this makes it optional to add a supply without 
having a negative effect.
Reverting this patch makes sense, but I'm not sure how else to integrate 
this.

Thanks,
Marcello

> Revert now, ask questions later. I'll send a patch.
>
> Guenter
>
>>
>> Thanks,
>> Zev
>>

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

end of thread, other threads:[~2022-11-05  1:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-21 11:09 [PATCH v2 0/1] Add supply into PWBUS_REGULATOR macro Marcello Sylvester Bauer
2022-02-21 11:09 ` [PATCH v2 1/1] hwmon: (pmbus) Add regulator supply into macro Marcello Sylvester Bauer
2022-02-22 16:51   ` Guenter Roeck
2022-11-04 22:30     ` Zev Weiss
2022-11-04 23:42       ` Guenter Roeck
2022-11-05  1:43         ` Marcello Sylverster Bauer

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).