Skip to contentSkip to conversation

Support XDPE112

PATCH Superseded Marcello Sylvester Bauer 3 participants 13 messages Feb 17, 2022 – Feb 26, 2022

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Support XDPE112

Add support for Infineon Multi-phase XDPE112 family regulator. The main difference to the XDPE122 family is it uses a different format for voltage out. Add the required logic to the existing xdpe12284 driver accordingly.

Changes in v2:
- Rebase on current hwmon-next branch

Marcello Sylvester Bauer (3):
dt-bindings: trivial-devices: Add xdpe11280
hwmon (xdpe12284): Add support for xdpe11280
hwmon (xdpe12284): Add regulator support

 .../devicetree/bindings/trivial-devices.yaml  |  2 ++
 Documentation/hwmon/xdpe12284.rst             | 10 +++++--
 drivers/hwmon/pmbus/Kconfig                   |  6 ++++
 drivers/hwmon/pmbus/xdpe12284.c               | 28 ++++++++++++++++++-
 4 files changed, 42 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/3 dt-bindings: trivial-devices: Add xdpe11280

Add Infineon Multi-phase Digital Controller XDPE11280.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index 091792ba993e..8a42aea3b8a6 100644
@@ -137,6 +137,8 @@ properties:
           - infineon,slb9645tt
             # Infineon TLV493D-A1B6 I2C 3D Magnetic Sensor
           - infineon,tlv493d-a1b6
+            # Infineon Multi-phase Digital VR Controller xdpe11280
+          - infineon,xdpe11280
             # Infineon Multi-phase Digital VR Controller xdpe12254
           - infineon,xdpe12254
             # Infineon Multi-phase Digital VR Controller xdpe12284
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 2/3 hwmon (xdpe12284): Add support for xdpe11280

In reply to Marcello Sylvester Bauer

Add support for another family of Infineon Multi-phase controllers. The xdpe11280 uses linear instead of vid data format for VOUT. Add the required logic to detect VOUT_MODE during identification, and set the format accordingly.

---
 Documentation/hwmon/xdpe12284.rst | 10 +++++++---
 drivers/hwmon/pmbus/xdpe12284.c   | 17 ++++++++++++++++-
 2 files changed, 23 insertions(+), 4 deletions(-)
Documentation/hwmon/xdpe12284.rst +7 -3
index 67d1f87808e5..e9a5a19b0c3d 100644
@@ -5,6 +5,10 @@ Kernel driver xdpe122
 
 Supported chips:
 
+  * Infineon XDPE11280
+
+    Prefix: 'xdpe11280'
+
   * Infineon XDPE12254
 
     Prefix: 'xdpe12254'
@@ -20,9 +24,9 @@ Authors:
 Description
 -----------
 
-This driver implements support for Infineon Multi-phase XDPE122 family
-dual loop voltage regulators.
-The family includes XDPE12284 and XDPE12254 devices.
+This driver implements support for Infineon Multi-phase XDPE112 and XDPE122
+family dual loop voltage regulators.
+These families include XDPE11280, XDPE12284 and XDPE12254 devices.
 The devices from this family complaint with:
 
 - Intel VR13 and VR13HC rev 1.3, IMVP8 rev 1.2 and IMPVP9 rev 1.3 DC-DC
drivers/hwmon/pmbus/xdpe12284.c +16 -1
index b07da06a40c9..ec947c697670 100644
@@ -27,6 +27,9 @@ static int xdpe122_read_word_data(struct i2c_client *client, int page,
 	s32 mantissa;
 	int ret;
 
+	if (info->format[PSC_VOLTAGE_OUT] == linear)
+		return -ENODATA;
+
 	switch (reg) {
 	case PMBUS_VOUT_OV_FAULT_LIMIT:
 	case PMBUS_VOUT_UV_FAULT_LIMIT:
@@ -75,9 +78,19 @@ static int xdpe122_read_word_data(struct i2c_client *client, int page,
 static int xdpe122_identify(struct i2c_client *client,
 			    struct pmbus_driver_info *info)
 {
-	u8 vout_params;
+	u8 vout_mode, vout_params;
 	int i, ret;
 
+	ret = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
+	if (ret < 0)
+		return ret;
+
+	vout_mode = ret >> 5;
+	if (vout_mode == 0) {
+		info->format[PSC_VOLTAGE_OUT] = linear;
+		return 0;
+	}
+
 	for (i = 0; i < XDPE122_PAGE_NUM; i++) {
 		/* Read the register with VOUT scaling value.*/
 		ret = pmbus_read_byte_data(client, i, PMBUS_VOUT_MODE);
@@ -140,6 +153,7 @@ static int xdpe122_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id xdpe122_id[] = {
+	{"xdpe11280", 0},
 	{"xdpe12254", 0},
 	{"xdpe12284", 0},
 	{}
@@ -148,6 +162,7 @@ static const struct i2c_device_id xdpe122_id[] = {
 MODULE_DEVICE_TABLE(i2c, xdpe122_id);
 
 static const struct of_device_id __maybe_unused xdpe122_of_match[] = {
+	{.compatible = "infineon,xdpe11280"},
 	{.compatible = "infineon,xdpe12254"},
 	{.compatible = "infineon,xdpe12284"},
 	{}
Signature · 1 line
2.34.1
maintainer
#4 lore raw

Re: [PATCH v2 2/3] hwmon (xdpe12284): Add support for xdpe11280

Quoted 5 lines · Marcello Sylvester Bauer

Add support for another family of Infineon Multi-phase controllers. The xdpe11280 uses linear instead of vid data format for VOUT. Add the required logic to detect VOUT_MODE during identification, and set the format accordingly.

This talks about the chip, but ...

Quoted 22 lines
---
  Documentation/hwmon/xdpe12284.rst | 10 +++++++---
  drivers/hwmon/pmbus/xdpe12284.c   | 17 ++++++++++++++++-
  2 files changed, 23 insertions(+), 4 deletions(-)
Documentation/hwmon/xdpe12284.rst +4 -0
index 67d1f87808e5..e9a5a19b0c3d 100644
@@ -5,6 +5,10 @@ Kernel driver xdpe122
 
  Supported chips:
 
+  * Infineon XDPE11280
+
+    Prefix: 'xdpe11280'
+
    * Infineon XDPE12254
 
      Prefix: 'xdpe12254'

Documentation/hwmon/xdpe12284.rst Authors: · line 30

Quoted 10 lines
Documentation/hwmon/xdpe12284.rst +3 -3
@@ -20,9 +24,9 @@ Authors:
  Description
  -----------
 
-This driver implements support for Infineon Multi-phase XDPE122 family
-dual loop voltage regulators.
-The family includes XDPE12284 and XDPE12254 devices.
+This driver implements support for Infineon Multi-phase XDPE112 and XDPE122
+family dual loop voltage regulators.
+These families include XDPE11280, XDPE12284 and XDPE12254 devices.
  The devices from this family complaint with:

Hmm, s/complaint/compliant/.

Anyway, is it still correct that the XDPE11280 is compliant with the Intel specifications ? The datasheet isn't public, so I can not check myself what the chip actually supports.

Quoted 23 lines
Documentation/hwmon/xdpe12284.rst +0 -0
  - Intel VR13 and VR13HC rev 1.3, IMVP8 rev 1.2 and IMPVP9 rev 1.3 DC-DC
drivers/hwmon/pmbus/xdpe12284.c +4 -1
index b07da06a40c9..ec947c697670 100644
@@ -27,6 +27,9 @@ static int xdpe122_read_word_data(struct i2c_client *client, int page,
  	s32 mantissa;
  	int ret;
 
+	if (info->format[PSC_VOLTAGE_OUT] == linear)
+		return -ENODATA;
+
  	switch (reg) {
  	case PMBUS_VOUT_OV_FAULT_LIMIT:
  	case PMBUS_VOUT_UV_FAULT_LIMIT:
@@ -75,9 +78,19 @@ static int xdpe122_read_word_data(struct i2c_client *client, int page,
  static int xdpe122_identify(struct i2c_client *client,
  			    struct pmbus_driver_info *info)
  {
-	u8 vout_params;
+	u8 vout_mode, vout_params;
  	int i, ret;

drivers/hwmon/pmbus/xdpe12284.c static int xdpe122_read_word_data(struct i2c_client *client, int page, · line 92

Quoted 10 lines
drivers/hwmon/pmbus/xdpe12284.c +9 -0
 
+	ret = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
+	if (ret < 0)
+		return ret;
+
+	vout_mode = ret >> 5;
+	if (vout_mode == 0) {
+		info->format[PSC_VOLTAGE_OUT] = linear;
+		return 0;
+	}

.... the code above is not chip dependent but this code checks the mode register on page 0. At the very least this is confusing.

What the driver should do instead is to check the chip type during probe and make the necessary changes there, ie set the output format for xdpe11280 to linear and drop the pointers to the .identify and .read_word_data.

Guenter

Quoted 20 lines
drivers/hwmon/pmbus/xdpe12284.c +3 -0
+
  	for (i = 0; i < XDPE122_PAGE_NUM; i++) {
  		/* Read the register with VOUT scaling value.*/
  		ret = pmbus_read_byte_data(client, i, PMBUS_VOUT_MODE);
@@ -140,6 +153,7 @@ static int xdpe122_probe(struct i2c_client *client)
  }
 
  static const struct i2c_device_id xdpe122_id[] = {
+	{"xdpe11280", 0},
  	{"xdpe12254", 0},
  	{"xdpe12284", 0},
  	{}
@@ -148,6 +162,7 @@ static const struct i2c_device_id xdpe122_id[] = {
  MODULE_DEVICE_TABLE(i2c, xdpe122_id);
 
  static const struct of_device_id __maybe_unused xdpe122_of_match[] = {
+	{.compatible = "infineon,xdpe11280"},
  	{.compatible = "infineon,xdpe12254"},
  	{.compatible = "infineon,xdpe12284"},
  	{}
author
#5 lore raw

Re: [PATCH v2 2/3] hwmon (xdpe12284): Add support for xdpe11280

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

Add support for another family of Infineon Multi-phase controllers. The xdpe11280 uses linear instead of vid data format for VOUT. Add the required logic to detect VOUT_MODE during identification, and set the format accordingly.

This talks about the chip, but ...

Oh, sure. I should be more clear that it is a chip of a different family.

Quoted 30 lines
Quoted 30 lines

---
  Documentation/hwmon/xdpe12284.rst | 10 +++++++--- drivers/hwmon/pmbus/xdpe12284.c   | 17 ++++++++++++++++-

  2 files changed, 23 insertions(+), 4 deletions(-)
Documentation/hwmon/xdpe12284.rst +0 -0
index 67d1f87808e5..e9a5a19b0c3d 100644
@@ -5,6 +5,10 @@ Kernel driver xdpe122


  Supported chips:

+  * Infineon XDPE11280

Documentation/hwmon/xdpe12284.rst +3 -0
+
+    Prefix: 'xdpe11280'
+

    * Infineon XDPE12254

      Prefix: 'xdpe12254'

Documentation/hwmon/xdpe12284.rst +0 -0
@@ -20,9 +24,9 @@ Authors:

  Description
  -----------

-This driver implements support for Infineon Multi-phase XDPE122 family
-dual loop voltage regulators.

Quoted 8 lines
Quoted 6 lines
Documentation/hwmon/xdpe12284.rst +1 -1
-The family includes XDPE12284 and XDPE12254 devices.
+This driver implements support for Infineon Multi-phase XDPE112

and XDPE122

Documentation/hwmon/xdpe12284.rst +2 -0
+family dual loop voltage regulators.
+These families include XDPE11280, XDPE12284 and XDPE12254 devices.

  The devices from this family complaint with:

Hmm, s/complaint/compliant/.

ack

Quoted 5 lines

Anyway, is it still correct that the XDPE11280 is compliant with the Intel specifications ? The datasheet isn't public, so I can not check myself
what the chip actually supports.

The hardware we are testing on is an Intel Cascade Lake, which uses this chip. The datasheet tells us it is compliant:

```
The XDPE11280B implements a fully compliant Intel® VR 13, VR12, VR
12.5, VR13.HC, and IMVP8 Serial VID (SVID)
interface.
```
Quoted 42 lines
Quoted 30 lines


  - Intel VR13 and VR13HC rev 1.3, IMVP8 rev 1.2 and IMPVP9 rev 1.3 DC-DC

drivers/hwmon/pmbus/xdpe12284.c +0 -0
index b07da06a40c9..ec947c697670 100644
@@ -27,6 +27,9 @@ static int xdpe122_read_word_data(struct
 i2c_client *client, int page,
         s32 mantissa;
         int ret;


+       if (info->format[PSC_VOLTAGE_OUT] == linear) +               return -ENODATA;
+
        switch (reg) {
        case PMBUS_VOUT_OV_FAULT_LIMIT:
        case PMBUS_VOUT_UV_FAULT_LIMIT:

drivers/hwmon/pmbus/xdpe12284.c +1 -1
@@ -75,9 +78,19 @@ static int xdpe122_read_word_data(struct
 i2c_client *client, int page,
   static int xdpe122_identify(struct i2c_client *client,
                             struct pmbus_driver_info *info)
   {
-       u8 vout_params;
+       u8 vout_mode, vout_params;
         int i, ret;


+       ret = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);

Quoted 8 lines

+       if (ret < 0)
+               return ret;
+
+       vout_mode = ret >> 5;
+       if (vout_mode == 0) {
+               info->format[PSC_VOLTAGE_OUT] = linear; +               return 0;
+       }

.... the code above is not chip dependent but this code checks the mode register on page 0. At the very least this is confusing.

Quoted 4 lines

What the driver should do instead is to check the chip type during probe and make the necessary changes there, ie set the output format for xdpe11280 to linear and drop the pointers to the .identify and .read_word_data.

Sgtm. This sounds like a better approach indeed.

Thanks,
Marcello

Quoted 28 lines

Guenter

Quoted 24 lines

+
        for (i = 0; i < XDPE122_PAGE_NUM; i++) {
                /* Read the register with VOUT scaling value.*/ ret = pmbus_read_byte_data(client, i, PMBUS_VOUT_MODE);

drivers/hwmon/pmbus/xdpe12284.c +0 -0
@@ -140,6 +153,7 @@ static int xdpe122_probe(struct i2c_client
 *client)
   }


  static const struct i2c_device_id xdpe122_id[] = { +       {"xdpe11280", 0},
        {"xdpe12254", 0},
        {"xdpe12284", 0},
        {}

drivers/hwmon/pmbus/xdpe12284.c +0 -0
@@ -148,6 +162,7 @@ static const struct i2c_device_id xdpe122_id[]
 = {
   MODULE_DEVICE_TABLE(i2c, xdpe122_id);


  static const struct of_device_id __maybe_unused
xdpe122_of_match[] = {
+       {.compatible = "infineon,xdpe11280"},
        {.compatible = "infineon,xdpe12254"},
        {.compatible = "infineon,xdpe12284"},
        {}

maintainer
#6 lore raw

Re: [PATCH v2 2/3] hwmon (xdpe12284): Add support for xdpe11280

Quoted 59 lines · sylv
Quoted 7 lines · Guenter Roeck
Quoted 5 lines · Marcello Sylvester Bauer

Add support for another family of Infineon Multi-phase controllers. The xdpe11280 uses linear instead of vid data format for VOUT. Add the required logic to detect VOUT_MODE during identification, and set the format accordingly.

This talks about the chip, but ...

Oh, sure. I should be more clear that it is a chip of a different family.

Quoted 27 lines
Quoted 27 lines
---
   Documentation/hwmon/xdpe12284.rst | 10 +++++++---
   drivers/hwmon/pmbus/xdpe12284.c   | 17 ++++++++++++++++-
   2 files changed, 23 insertions(+), 4 deletions(-)
Documentation/hwmon/xdpe12284.rst +4 -0
index 67d1f87808e5..e9a5a19b0c3d 100644
@@ -5,6 +5,10 @@ Kernel driver xdpe122
 
   Supported chips:
 
+  * Infineon XDPE11280
+
+    Prefix: 'xdpe11280'
+
     * Infineon XDPE12254
 
       Prefix: 'xdpe12254'
@@ -20,9 +24,9 @@ Authors:
   Description
   -----------
 
Quoted 11 lines

Documentation/hwmon/xdpe12284.rst Authors: · line 30

Quoted 9 lines
Documentation/hwmon/xdpe12284.rst +0 -1
-This driver implements support for Infineon Multi-phase XDPE122

family

Documentation/hwmon/xdpe12284.rst +1 -2
-dual loop voltage regulators.
-The family includes XDPE12284 and XDPE12254 devices.
+This driver implements support for Infineon Multi-phase XDPE112

and XDPE122

Documentation/hwmon/xdpe12284.rst +2 -0
+family dual loop voltage regulators.
+These families include XDPE11280, XDPE12284 and XDPE12254 devices.
   The devices from this family complaint with:

Hmm, s/complaint/compliant/.

ack

Quoted 5 lines

Anyway, is it still correct that the XDPE11280 is compliant with the Intel specifications ? The datasheet isn't public, so I can not check myself
what the chip actually supports.

Quoted 9 lines

The hardware we are testing on is an Intel Cascade Lake, which uses this chip. The datasheet tells us it is compliant:

```
The XDPE11280B implements a fully compliant Intel® VR 13, VR12, VR
12.5, VR13.HC, and IMVP8 Serial VID (SVID)
interface.
```

This seems to be one of those chips where the vendor doesn't even admit that it exists unless one signs an NDA. Sigh :-(.

Quoted 42 lines
Quoted 42 lines
Quoted 28 lines

  - Intel VR13 and VR13HC rev 1.3, IMVP8 rev 1.2 and IMPVP9 rev 1.3
DC-DC

drivers/hwmon/pmbus/xdpe12284.c +3 -0
index b07da06a40c9..ec947c697670 100644
@@ -27,6 +27,9 @@ static int xdpe122_read_word_data(struct
 i2c_client *client, int page,
         s32 mantissa;
         int ret;
 
+       if (info->format[PSC_VOLTAGE_OUT] == linear)
+               return -ENODATA;
+
         switch (reg) {
         case PMBUS_VOUT_OV_FAULT_LIMIT:

        case PMBUS_VOUT_UV_FAULT_LIMIT:

drivers/hwmon/pmbus/xdpe12284.c +1 -1
@@ -75,9 +78,19 @@ static int xdpe122_read_word_data(struct
 i2c_client *client, int page,
   static int xdpe122_identify(struct i2c_client *client,
                             struct pmbus_driver_info *info)
   {
-       u8 vout_params;
+       u8 vout_mode, vout_params;
         int i, ret;

drivers/hwmon/pmbus/xdpe12284.c static int xdpe122_read_word_data(struct · line 93

Quoted 10 lines
drivers/hwmon/pmbus/xdpe12284.c +9 -0
 
+       ret = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
+       if (ret < 0)
+               return ret;
+
+       vout_mode = ret >> 5;
+       if (vout_mode == 0) {
+               info->format[PSC_VOLTAGE_OUT] = linear;
+               return 0;
+       }

.... the code above is not chip dependent but this code checks the mode register on page 0. At the very least this is confusing.

Quoted 7 lines
Quoted 4 lines

What the driver should do instead is to check the chip type during probe and make the necessary changes there, ie set the output format for xdpe11280 to linear and drop the pointers to the .identify and .read_word_data.

Sgtm. This sounds like a better approach indeed.

That makes me wonder if the chip needs to be added to this driver in the first place, or if it could be added to pmbus.c instead. Any idea ?

Thanks,
Guenter

Quoted 32 lines

Thanks,
Marcello

Quoted 28 lines

Guenter

Quoted 24 lines
drivers/hwmon/pmbus/xdpe12284.c +1 -0
+
         for (i = 0; i < XDPE122_PAGE_NUM; i++) {
                 /* Read the register with VOUT scaling value.*/

                ret = pmbus_read_byte_data(client, i,
PMBUS_VOUT_MODE);

drivers/hwmon/pmbus/xdpe12284.c +1 -0
@@ -140,6 +153,7 @@ static int xdpe122_probe(struct i2c_client
 *client)
   }
 
   static const struct i2c_device_id xdpe122_id[] = {
+       {"xdpe11280", 0},
         {"xdpe12254", 0},
         {"xdpe12284", 0},

        {}

drivers/hwmon/pmbus/xdpe12284.c +1 -0
@@ -148,6 +162,7 @@ static const struct i2c_device_id xdpe122_id[]
 = {
   MODULE_DEVICE_TABLE(i2c, xdpe122_id);
 
   static const struct of_device_id __maybe_unused
 xdpe122_of_match[] = {
+       {.compatible = "infineon,xdpe11280"},
         {.compatible = "infineon,xdpe12254"},

        {.compatible = "infineon,xdpe12284"},
        {}

author
#7 lore raw

Re: [PATCH v2 2/3] hwmon (xdpe12284): Add support for xdpe11280

Quoted 77 lines · Guenter Roeck
Quoted 66 lines · sylv
Quoted 9 lines · Guenter Roeck
Quoted 7 lines · Marcello Sylvester Bauer

Add support for another family of Infineon Multi-phase controllers.
The xdpe11280 uses linear instead of vid data format for VOUT. Add the required logic to detect VOUT_MODE during identification,
and set the format accordingly.

This talks about the chip, but ...

Oh, sure. I should be more clear that it is a chip of a different family.

Quoted 33 lines
Quoted 33 lines

---
   Documentation/hwmon/xdpe12284.rst | 10 +++++++--- drivers/hwmon/pmbus/xdpe12284.c   | 17 ++++++++++++++++-

   2 files changed, 23 insertions(+), 4 deletions(-)
Documentation/hwmon/xdpe12284.rst +0 -0
index 67d1f87808e5..e9a5a19b0c3d 100644
@@ -5,6 +5,10 @@ Kernel driver xdpe122


   Supported chips:

+  * Infineon XDPE11280

Documentation/hwmon/xdpe12284.rst +3 -0
+
+    Prefix: 'xdpe11280'
+

     * Infineon XDPE12254

       Prefix: 'xdpe12254'

Documentation/hwmon/xdpe12284.rst +0 -0
@@ -20,9 +24,9 @@ Authors:

   Description
   -----------

-This driver implements support for Infineon Multi-phase XDPE122
family

Documentation/hwmon/xdpe12284.rst +1 -2
-dual loop voltage regulators.
-The family includes XDPE12284 and XDPE12254 devices.
+This driver implements support for Infineon Multi-phase
Quoted 8 lines
Quoted 6 lines

XDPE112
and XDPE122

Documentation/hwmon/xdpe12284.rst +2 -0
+family dual loop voltage regulators.
+These families include XDPE11280, XDPE12284 and XDPE12254

devices.
   The devices from this family complaint with:

Hmm, s/complaint/compliant/.

ack

Quoted 7 lines

Anyway, is it still correct that the XDPE11280 is compliant with the
Intel specifications ? The datasheet isn't public, so I can not check
myself
what the chip actually supports.

Quoted 9 lines

The hardware we are testing on is an Intel Cascade Lake, which uses this chip. The datasheet tells us it is compliant:

```
The XDPE11280B implements a fully compliant Intel® VR 13, VR12, VR
12.5, VR13.HC, and IMVP8 Serial VID (SVID)
interface.
```
Quoted 3 lines

This seems to be one of those chips where the vendor doesn't even admit
that it exists unless one signs an NDA. Sigh :-(.

Yeah, it's pretty... We do not understand the reasoning.

Quoted 52 lines
Quoted 52 lines
Quoted 51 lines
Quoted 32 lines


   - Intel VR13 and VR13HC rev 1.3, IMVP8 rev 1.2 and IMPVP9 rev 1.3
DC-DC

drivers/hwmon/pmbus/xdpe12284.c +0 -0
index b07da06a40c9..ec947c697670 100644
@@ -27,6 +27,9 @@ static int xdpe122_read_word_data(struct
 i2c_client *client, int page,
          s32 mantissa;
          int ret;


+       if (info->format[PSC_VOLTAGE_OUT] == linear) +               return -ENODATA;
+
         switch (reg) {
         case PMBUS_VOUT_OV_FAULT_LIMIT:
         case PMBUS_VOUT_UV_FAULT_LIMIT:

drivers/hwmon/pmbus/xdpe12284.c +1 -1
@@ -75,9 +78,19 @@ static int xdpe122_read_word_data(struct
 i2c_client *client, int page,
    static int xdpe122_identify(struct i2c_client *client,
                              struct pmbus_driver_info *info)
    {
-       u8 vout_params;
+       u8 vout_mode, vout_params;
          int i, ret;


+       ret = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);

Quoted 8 lines

+       if (ret < 0)
+               return ret;
+
+       vout_mode = ret >> 5;
+       if (vout_mode == 0) {
+               info->format[PSC_VOLTAGE_OUT] = linear; +               return 0;
+       }

.... the code above is not chip dependent but this code checks the
mode register on page 0. At the very least this is confusing.

What the driver should do instead is to check the chip type during
probe and make the necessary changes there, ie set the output format
for xdpe11280 to linear and drop the pointers to the .identify and .read_word_data.

Quoted 6 lines
Quoted 2 lines

Sgtm. This sounds like a better approach indeed.

That makes me wonder if the chip needs to be added to this driver in the first
place, or if it could be added to pmbus.c instead. Any idea ?

Oh, we did wrote a standalone driver too, and it works fine. Maybe it's better to upsteam it instead. :)

Quoted 39 lines

Thanks,
Guenter

Quoted 34 lines

Thanks,
Marcello

Quoted 30 lines

Guenter

Quoted 26 lines

+
         for (i = 0; i < XDPE122_PAGE_NUM; i++) { /* Read the register with VOUT scaling value.*/
                 ret = pmbus_read_byte_data(client, i, PMBUS_VOUT_MODE);

drivers/hwmon/pmbus/xdpe12284.c +0 -0
@@ -140,6 +153,7 @@ static int xdpe122_probe(struct i2c_client
 *client)
    }


   static const struct i2c_device_id xdpe122_id[] = { +       {"xdpe11280", 0},
         {"xdpe12254", 0},
         {"xdpe12284", 0},
         {}

drivers/hwmon/pmbus/xdpe12284.c +0 -0
@@ -148,6 +162,7 @@ static const struct i2c_device_id

xdpe122_id[]
= {
   MODULE_DEVICE_TABLE(i2c, xdpe122_id);

   static const struct of_device_id __maybe_unused xdpe122_of_match[] = {
+       {.compatible = "infineon,xdpe11280"}, {.compatible = "infineon,xdpe12254"}, {.compatible = "infineon,xdpe12284"}, {}

maintainer
#8 lore raw

Re: [PATCH v2 2/3] hwmon (xdpe12284): Add support for xdpe11280

On 2/17/22 10:38, sylv wrote:
[ ... ]

Quoted 7 lines
Quoted 4 lines

That makes me wonder if the chip needs to be added to this driver in the first
place, or if it could be added to pmbus.c instead. Any idea ?

Oh, we did wrote a standalone driver too, and it works fine. Maybe it's better to upsteam it instead. :)

No, I meant if it would make sense to just add something like

	{"xdpe11280", (kernel_ulong_t)&pmbus_info_one },

to drivers/hwmon/pmbus/pmbus.c.

You only really need a standalone driver if it does something special, such as a workaround for some register access (like the xdpe12284 driver), or if support for manufacturer specific registers is desired or needed. That would, for example, be useful if the xdpe11280 supports per-phase sensors.

Thanks,
Guenter

author
#9 lore raw

Re: [PATCH v2 2/3] hwmon (xdpe12284): Add support for xdpe11280

Quoted 18 lines · Guenter Roeck

On 2/17/22 10:38, sylv wrote:
[ ... ]

Quoted 8 lines
Quoted 5 lines

That makes me wonder if the chip needs to be added to this driver in
the first
place, or if it could be added to pmbus.c instead. Any idea ?

Oh, we did wrote a standalone driver too, and it works fine. Maybe it's better to upsteam it instead. :)

No, I meant if it would make sense to just add something like

        {"xdpe11280", (kernel_ulong_t)&pmbus_info_one },

to drivers/hwmon/pmbus/pmbus.c.

Quoted 8 lines

You only really need a standalone driver if it does something special, such as a workaround for some register access (like the xdpe12284 driver), or if support for manufacturer specific registers is desired or needed. That would, for example, be useful if the xdpe11280 supports per-phase sensors.

Thanks,
Guenter

Hi,

I tested if the xdpe11280 can use the generic pmbus driver. Everything works fine except it does only detect READ_TEMPERATURE_1 on page 0. Looking at the pmbus_find_sensor_groups function it looks like only some commands are probed on each page (READ_VOUT, READ_IOUT, and READ_POUT) but not READ_TEMPERATURE_1.
The PMBus spec 1.3.1 tells us: "Each page may offer the full range of PMBus commands available for each output or non-PMBus device." How could we adapt the generic driver so that it is possible to probe commands for each page?

Furthermore, It would be great to add regulator and DT support. I created a WIP branch on GitHub with a possible way to implement this:
https://github.com/9elements/linux/tree/upstreaming_pmbus_regulator_wip

What do you think?

Thanks,
Marcello

maintainer
#10 lore raw

Re: [PATCH v2 2/3] hwmon (xdpe12284): Add support for xdpe11280

Quoted 30 lines · sylv
Quoted 18 lines · Guenter Roeck

On 2/17/22 10:38, sylv wrote:
[ ... ]

Quoted 8 lines
Quoted 5 lines

That makes me wonder if the chip needs to be added to this driver in
the first
place, or if it could be added to pmbus.c instead. Any idea ?

Oh, we did wrote a standalone driver too, and it works fine. Maybe it's better to upsteam it instead. :)

No, I meant if it would make sense to just add something like

        {"xdpe11280", (kernel_ulong_t)&pmbus_info_one },

to drivers/hwmon/pmbus/pmbus.c.

Quoted 8 lines

You only really need a standalone driver if it does something special, such as a workaround for some register access (like the xdpe12284 driver), or if support for manufacturer specific registers is desired or needed. That would, for example, be useful if the xdpe11280 supports per-phase sensors.

Thanks,
Guenter

Hi,

Quoted 10 lines

I tested if the xdpe11280 can use the generic pmbus driver. Everything works fine except it does only detect READ_TEMPERATURE_1 on page 0. Looking at the pmbus_find_sensor_groups function it looks like only some commands are probed on each page (READ_VOUT, READ_IOUT, and READ_POUT) but not READ_TEMPERATURE_1.
The PMBus spec 1.3.1 tells us: "Each page may offer the full range of PMBus commands available for each output or non-PMBus device." How could we adapt the generic driver so that it is possible to probe commands for each page?

The problem is the "may". Some chips don't implement multi-page support especially for temperature sensors. So we'll have to go with adding support to the existing driver.

Guenter

Quoted 9 lines

Furthermore, It would be great to add regulator and DT support. I created a WIP branch on GitHub with a possible way to implement this:
https://github.com/9elements/linux/tree/upstreaming_pmbus_regulator_wip

What do you think?

Thanks,
Marcello

#11 lore raw

Re: [PATCH v2 2/3] hwmon (xdpe12284): Add support for xdpe11280

Quoted 46 lines · Guenter Roeck
Quoted 32 lines · sylv
Quoted 26 lines · Guenter Roeck

On 2/17/22 10:38, sylv wrote:
[ ... ]

Quoted 9 lines
Quoted 6 lines

That makes me wonder if the chip needs to be added to this driver
in
the first
place, or if it could be added to pmbus.c instead. Any idea ?

Oh, we did wrote a standalone driver too, and it works fine. Maybe it's better to upsteam it instead. :)

No, I meant if it would make sense to just add something like

         {"xdpe11280", (kernel_ulong_t)&pmbus_info_one },

to drivers/hwmon/pmbus/pmbus.c.

You only really need a standalone driver if it does something special, such as a workaround for some register access (like the xdpe12284 driver), or if support for manufacturer specific registers is desired or needed. That would, for example, be useful
if the xdpe11280 supports per-phase sensors.

Quoted 2 lines

Thanks,
Guenter

Hi,

Quoted 12 lines

I tested if the xdpe11280 can use the generic pmbus driver. Everything
works fine except it does only detect READ_TEMPERATURE_1 on page 0. Looking at the pmbus_find_sensor_groups function it looks like only some commands are probed on each page (READ_VOUT, READ_IOUT, and READ_POUT) but not READ_TEMPERATURE_1.
The PMBus spec 1.3.1 tells us: "Each page may offer the full range of
PMBus commands available for each output or non-PMBus device." How could we adapt the generic driver so that it is possible to probe commands for each page?

Quoted 5 lines

The problem is the "may". Some chips don't implement multi-page support especially for temperature sensors. So we'll have to go with adding support to the existing driver.

Guenter

sgtm. So I'll continue working on this patch set.

Quoted 12 lines
Quoted 11 lines

Furthermore, It would be great to add regulator and DT support. I created a WIP branch on GitHub with a possible way to implement this:
https://github.com/9elements/linux/tree/upstreaming_pmbus_regulator_wip

What do you think?

Thanks,
Marcello

#12 lore raw

PATCH v2 3/3 hwmon (xdpe12284): Add regulator support

In reply to Marcello Sylvester Bauer

Add simple on/off regulator support for xdpe12284 and other pmbus parts supported by the xdpe12284 driver.

---
 drivers/hwmon/pmbus/Kconfig     |  6 ++++++
 drivers/hwmon/pmbus/xdpe12284.c | 11 +++++++++++
 2 files changed, 17 insertions(+)
drivers/hwmon/pmbus/Kconfig +6 -0
index c96f7b7338bd..e0e9b67bf3eb 100644
@@ -394,6 +394,12 @@ config SENSORS_XDPE122
 	  This driver can also be built as a module. If so, the module will
 	  be called xdpe12284.
 
+config SENSORS_XDPE122_REGULATOR
+	bool "Regulator support for XDPE122 and compatibles"
+	depends on SENSORS_XDPE122 && REGULATOR
+	help
+	  Uses the xdpe12284 or compatible as regulator.
+
 config SENSORS_ZL6100
 	tristate "Intersil ZL6100 and compatibles"
 	help
drivers/hwmon/pmbus/xdpe12284.c +11 -0
index ec947c697670..c58776ef0311 100644
@@ -10,6 +10,8 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/regulator/driver.h>
+
 #include "pmbus.h"
 
 #define XDPE122_PROT_VR12_5MV		0x01 /* VR12.0 mode, 5-mV DAC */
@@ -120,6 +122,11 @@ static int xdpe122_identify(struct i2c_client *client,
 	return 0;
 }
 
+static const struct regulator_desc xdpe122_reg_desc[] = {
+	PMBUS_REGULATOR("vout", 0),
+	PMBUS_REGULATOR("vout", 1),
+};
+
 static struct pmbus_driver_info xdpe122_info = {
 	.pages = XDPE122_PAGE_NUM,
 	.format[PSC_VOLTAGE_IN] = linear,
@@ -138,6 +145,10 @@ static struct pmbus_driver_info xdpe122_info = {
 		PMBUS_HAVE_POUT | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT,
 	.identify = xdpe122_identify,
 	.read_word_data = xdpe122_read_word_data,
+#if IS_ENABLED(CONFIG_SENSORS_XDPE122_REGULATOR)
+	.num_regulators = 2,
+	.reg_desc = xdpe122_reg_desc,
+#endif
 };
 
 static int xdpe122_probe(struct i2c_client *client)
Signature · 1 line
2.34.1