Skip to contentSkip to conversation

Add supply into PWBUS_REGULATOR macro

PATCH Superseded Marcello Sylvester Bauer 2 participants 5 messages Feb 17, 2022 – Feb 21, 2022 Hardware monitoring

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 hwmon: (pmbus) Add regulator supply into macro

In reply to 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
```
---
 drivers/hwmon/pmbus/pmbus.h | 1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/pmbus/pmbus.h +1 -0
index e0aa8aa46d8c..38f049d68d32 100644
@@ -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"),	\
Signature · 1 line
2.34.1
#0 lore raw

cover Add supply into PWBUS_REGULATOR macro

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(+)
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH v1 1/1] hwmon: (pmbus) Add regulator supply into macro

In reply to Marcello Sylvester Bauer
Quoted 1 line · Marcello Sylvester Bauer

Add optional regulator supply into PWBUS_REGULATOR macro. This makes it

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

Quoted 17 lines

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
```
---
  drivers/hwmon/pmbus/pmbus.h | 1 +
  1 file changed, 1 insertion(+)
drivers/hwmon/pmbus/pmbus.h +0 -0
index e0aa8aa46d8c..38f049d68d32 100644

drivers/hwmon/pmbus/pmbus.h extern const struct regulator_ops pmbus_regulator_ops; · line 470

Quoted 7 lines
drivers/hwmon/pmbus/pmbus.h +1 -0
@@ -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

author
#3 lore raw

Re: [PATCH v1 1/1] hwmon: (pmbus) Add regulator supply into macro

Quoted 5 lines · Guenter Roeck
Quoted 2 lines · Marcello Sylvester Bauer

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.

Quoted 35 lines
Quoted 27 lines

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
```

---
  drivers/hwmon/pmbus/pmbus.h | 1 +

  1 file changed, 1 insertion(+)
drivers/hwmon/pmbus/pmbus.h +1 -0
index e0aa8aa46d8c..38f049d68d32 100644
@@ -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),          \
Quoted 1 line

                .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

author
#4 lore raw

Re: [PATCH v1 1/1] hwmon: (pmbus) Add regulator supply into macro

Quoted 47 lines · sylv
Quoted 5 lines · Guenter Roeck
Quoted 2 lines · Marcello Sylvester Bauer

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.

Quoted 36 lines
Quoted 27 lines

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
```

---
  drivers/hwmon/pmbus/pmbus.h | 1 +

  1 file changed, 1 insertion(+)
drivers/hwmon/pmbus/pmbus.h +1 -0
index e0aa8aa46d8c..38f049d68d32 100644
@@ -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),          \
Quoted 1 line

                .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