linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/1] Add supply into PWBUS_REGULATOR macro
@ 2022-02-17 10:23 Marcello Sylvester Bauer
  2022-02-17 10:23 ` [PATCH v1 1/1] hwmon: (pmbus) Add regulator supply into macro Marcello Sylvester Bauer
  0 siblings, 1 reply; 5+ messages in thread
From: Marcello Sylvester Bauer @ 2022-02-17 10:23 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.

Thanks,
Marcello

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] 5+ messages in thread

* [PATCH v1 1/1] hwmon: (pmbus) Add regulator supply into macro
  2022-02-17 10:23 [PATCH v1 0/1] Add supply into PWBUS_REGULATOR macro Marcello Sylvester Bauer
@ 2022-02-17 10:23 ` Marcello Sylvester Bauer
  2022-02-17 17:36   ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Marcello Sylvester Bauer @ 2022-02-17 10:23 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare
  Cc: linux-kernel, linux-hwmon, Patrick Rudolph, Marcello Sylvester Bauer

Add optional regulator supply into PWBUS_REGULATOR macro. This makes it
possible to define a vin-supply in DT. Not defining a supply will 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] 5+ messages in thread

* Re: [PATCH v1 1/1] hwmon: (pmbus) Add regulator supply into macro
  2022-02-17 10:23 ` [PATCH v1 1/1] hwmon: (pmbus) Add regulator supply into macro Marcello Sylvester Bauer
@ 2022-02-17 17:36   ` Guenter Roeck
  2022-02-17 17:40     ` sylv
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2022-02-17 17:36 UTC (permalink / raw)
  To: Marcello Sylvester Bauer, Jean Delvare
  Cc: linux-kernel, linux-hwmon, Patrick Rudolph

On 2/17/22 02:23, Marcello Sylvester Bauer wrote:
> Add optional regulator supply into PWBUS_REGULATOR macro. This makes it

The code doesn't look optional to me. What exactly is optional ?

> possible to define a vin-supply in DT. Not defining a supply will 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"),	\

That seems to be quite far reaching. How does this affect / change behavior
of existing systems which so far did not expect supply_name to be set ?

Guenter

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

* Re: [PATCH v1 1/1] hwmon: (pmbus) Add regulator supply into macro
  2022-02-17 17:36   ` Guenter Roeck
@ 2022-02-17 17:40     ` sylv
  2022-02-21 10:59       ` sylv
  0 siblings, 1 reply; 5+ messages in thread
From: sylv @ 2022-02-17 17:40 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare; +Cc: linux-kernel, linux-hwmon, Patrick Rudolph

On Thu, 2022-02-17 at 09:36 -0800, Guenter Roeck wrote:
> On 2/17/22 02:23, Marcello Sylvester Bauer wrote:
> > Add optional regulator supply into PWBUS_REGULATOR macro. This
> > makes it
> 
> The code doesn't look optional to me. What exactly is optional ?

I mean, it is optional to add a supply. It should not cause errors if
you don't. I should probably reword this, too.

> 
> > possible to define a vin-supply in DT. Not defining a supply will
> > 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"),  \
> 
> That seems to be quite far reaching. How does this affect / change
> behavior
> of existing systems which so far did not expect supply_name to be set
> ?
> 
> Guenter


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

* Re: [PATCH v1 1/1] hwmon: (pmbus) Add regulator supply into macro
  2022-02-17 17:40     ` sylv
@ 2022-02-21 10:59       ` sylv
  0 siblings, 0 replies; 5+ messages in thread
From: sylv @ 2022-02-21 10:59 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare; +Cc: linux-kernel, linux-hwmon, Patrick Rudolph

On Thu, 2022-02-17 at 18:40 +0100, sylv wrote:
> On Thu, 2022-02-17 at 09:36 -0800, Guenter Roeck wrote:
> > On 2/17/22 02:23, Marcello Sylvester Bauer wrote:
> > > Add optional regulator supply into PWBUS_REGULATOR macro. This
> > > makes it
> > 
> > The code doesn't look optional to me. What exactly is optional ?
> 
> I mean, it is optional to add a supply. It should not cause errors if
> you don't. I should probably reword this, too.
> 
> > 
> > > possible to define a vin-supply in DT. Not defining a supply will
> > > 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"),  \
> > 
> > That seems to be quite far reaching. How does this affect / change
> > behavior
> > of existing systems which so far did not expect supply_name to be
> > set
> > ?
> > 
> > Guenter
> 


My goal is to make it optional to define a supply regulator so that it
is possible to regulate the incoming voltage regulator.
IIUIC, it is required to set a supply_name to tell the regulator core
which supply it should look up from DT. (see: of_get_regulator 
drivers/regulator/core.c:402)
This should not cause a change of behavior even if no supply is
defined. It would register a dummy regulator as supply instead.

Am I right, or did I misunderstanding something?

Thanks,
Marcello

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

end of thread, other threads:[~2022-02-21 11:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 10:23 [PATCH v1 0/1] Add supply into PWBUS_REGULATOR macro Marcello Sylvester Bauer
2022-02-17 10:23 ` [PATCH v1 1/1] hwmon: (pmbus) Add regulator supply into macro Marcello Sylvester Bauer
2022-02-17 17:36   ` Guenter Roeck
2022-02-17 17:40     ` sylv
2022-02-21 10:59       ` sylv

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