Skip to contentSkip to conversation

Support XDPE112

PATCH Superseded Marcello Sylvester Bauer 2 participants 6 messages Mar 1, 2022

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#1 lore raw

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

In reply to Marcello Sylvester Bauer

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 1c49bbc654ee..da929cb08463 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.35.1
#0 lore raw

v3 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 v3:
- detect VOUT_MODE during probing
- set xdpe122_identify/xdpe122_read_word_data only if VOUT is vid

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             | 12 ++++---
 drivers/hwmon/pmbus/Kconfig                   |  6 ++++
 drivers/hwmon/pmbus/xdpe12284.c               | 33 +++++++++++++++++--
 4 files changed, 46 insertions(+), 7 deletions(-)
Signature · 1 line
2.35.1
#2 lore raw

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

Add support for another Infineon Multi-phase controller chip. The xdpe11280 uses linear instead of vid data format for VOUT. Detect VOUT_MODE format during probing and set the xdpe122 related pointers in case it uses vid.

---
 Documentation/hwmon/xdpe12284.rst | 12 ++++++++----
 drivers/hwmon/pmbus/xdpe12284.c   | 22 +++++++++++++++++++---
 2 files changed, 27 insertions(+), 7 deletions(-)
Documentation/hwmon/xdpe12284.rst +8 -4
index 67d1f87808e5..a224dc74ad35 100644
@@ -5,6 +5,10 @@ Kernel driver xdpe122
 
 Supported chips:
 
+  * Infineon XDPE11280
+
+    Prefix: 'xdpe11280'
+
   * Infineon XDPE12254
 
     Prefix: 'xdpe12254'
@@ -20,10 +24,10 @@ Authors:
 Description
 -----------
 
-This driver implements support for Infineon Multi-phase XDPE122 family
-dual loop voltage regulators.
-The family includes XDPE12284 and XDPE12254 devices.
-The devices from this family complaint with:
+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 compliant with:
 
 - Intel VR13 and VR13HC rev 1.3, IMVP8 rev 1.2 and IMPVP9 rev 1.3 DC-DC
   converter specification.
drivers/hwmon/pmbus/xdpe12284.c +19 -3
index b07da06a40c9..3413aba9d5be 100644
@@ -110,7 +110,6 @@ static int xdpe122_identify(struct i2c_client *client,
 static struct pmbus_driver_info xdpe122_info = {
 	.pages = XDPE122_PAGE_NUM,
 	.format[PSC_VOLTAGE_IN] = linear,
-	.format[PSC_VOLTAGE_OUT] = vid,
 	.format[PSC_TEMPERATURE] = linear,
 	.format[PSC_CURRENT_IN] = linear,
 	.format[PSC_CURRENT_OUT] = linear,
@@ -123,23 +122,39 @@ static struct pmbus_driver_info xdpe122_info = {
 		PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
 		PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
 		PMBUS_HAVE_POUT | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT,
-	.identify = xdpe122_identify,
-	.read_word_data = xdpe122_read_word_data,
 };
 
 static int xdpe122_probe(struct i2c_client *client)
 {
 	struct pmbus_driver_info *info;
+	int vout_mode;
 
 	info = devm_kmemdup(&client->dev, &xdpe122_info, sizeof(*info),
 			    GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
 
+	vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
+	if (vout_mode >= 0 && vout_mode != 0xff) {
+		switch (vout_mode >> 5) {
+		case 0:
+			info->format[PSC_VOLTAGE_OUT] = linear;
+			break;
+		case 1:
+			info->format[PSC_VOLTAGE_OUT] = vid;
+			info->identify = xdpe122_identify;
+			info->read_word_data = xdpe122_read_word_data;
+			break;
+		default:
+			return -ENODEV;
+		}
+	}
+
 	return pmbus_do_probe(client, info);
 }
 
 static const struct i2c_device_id xdpe122_id[] = {
+	{"xdpe11280", 0},
 	{"xdpe12254", 0},
 	{"xdpe12284", 0},
 	{}
@@ -148,6 +163,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.35.1
#5 lore raw

PATCH v3 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 6552467c588d..a2ea1d5a8765 100644
@@ -417,6 +417,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 3413aba9d5be..495c62005aed 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 */
@@ -107,6 +109,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,
@@ -122,6 +129,10 @@ static struct pmbus_driver_info xdpe122_info = {
 		PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
 		PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
 		PMBUS_HAVE_POUT | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT,
+#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.35.1
maintainer
#3 lore raw

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

In reply to Marcello Sylvester Bauer
Quoted 76 lines · Marcello Sylvester Bauer

Add support for another Infineon Multi-phase controller chip. The xdpe11280 uses linear instead of vid data format for VOUT. Detect VOUT_MODE format during probing and set the xdpe122 related pointers in case it uses vid.

---
  Documentation/hwmon/xdpe12284.rst | 12 ++++++++----
  drivers/hwmon/pmbus/xdpe12284.c   | 22 +++++++++++++++++++---
  2 files changed, 27 insertions(+), 7 deletions(-)
Documentation/hwmon/xdpe12284.rst +8 -4
index 67d1f87808e5..a224dc74ad35 100644
@@ -5,6 +5,10 @@ Kernel driver xdpe122
 
  Supported chips:
 
+  * Infineon XDPE11280
+
+    Prefix: 'xdpe11280'
+
    * Infineon XDPE12254
 
      Prefix: 'xdpe12254'
@@ -20,10 +24,10 @@ Authors:
  Description
  -----------
 
-This driver implements support for Infineon Multi-phase XDPE122 family
-dual loop voltage regulators.
-The family includes XDPE12284 and XDPE12254 devices.
-The devices from this family complaint with:
+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 compliant with:
 
  - Intel VR13 and VR13HC rev 1.3, IMVP8 rev 1.2 and IMPVP9 rev 1.3 DC-DC
    converter specification.
drivers/hwmon/pmbus/xdpe12284.c +6 -3
index b07da06a40c9..3413aba9d5be 100644
@@ -110,7 +110,6 @@ static int xdpe122_identify(struct i2c_client *client,
  static struct pmbus_driver_info xdpe122_info = {
  	.pages = XDPE122_PAGE_NUM,
  	.format[PSC_VOLTAGE_IN] = linear,
-	.format[PSC_VOLTAGE_OUT] = vid,
  	.format[PSC_TEMPERATURE] = linear,
  	.format[PSC_CURRENT_IN] = linear,
  	.format[PSC_CURRENT_OUT] = linear,
@@ -123,23 +122,39 @@ static struct pmbus_driver_info xdpe122_info = {
  		PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
  		PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
  		PMBUS_HAVE_POUT | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT,
-	.identify = xdpe122_identify,
-	.read_word_data = xdpe122_read_word_data,
  };
 
  static int xdpe122_probe(struct i2c_client *client)
  {
  	struct pmbus_driver_info *info;
+	int vout_mode;
 
  	info = devm_kmemdup(&client->dev, &xdpe122_info, sizeof(*info),
  			    GFP_KERNEL);
  	if (!info)
  		return -ENOMEM;
 
+	vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
+	if (vout_mode >= 0 && vout_mode != 0xff) {
+		switch (vout_mode >> 5) {
+		case 0:
+			info->format[PSC_VOLTAGE_OUT] = linear;

drivers/hwmon/pmbus/xdpe12284.c static struct pmbus_driver_info xdpe122_info = { · line 151

Quoted 10 lines
drivers/hwmon/pmbus/xdpe12284.c +10 -0
+			break;
+		case 1:
+			info->format[PSC_VOLTAGE_OUT] = vid;
+			info->identify = xdpe122_identify;
+			info->read_word_data = xdpe122_read_word_data;
+			break;
+		default:
+			return -ENODEV;
+		}
+	}

I am not entirely happy with this. Why not detect the mode (linear vs. vid) in the identify function ?

Thanks,
Guenter

Quoted 17 lines
drivers/hwmon/pmbus/xdpe12284.c +3 -0
+
  	return pmbus_do_probe(client, info);
  }
 
  static const struct i2c_device_id xdpe122_id[] = {
+	{"xdpe11280", 0},
  	{"xdpe12254", 0},
  	{"xdpe12284", 0},
  	{}
@@ -148,6 +163,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"},
  	{}
#4 lore raw

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

Quoted 96 lines · Guenter Roeck
Quoted 95 lines · Marcello Sylvester Bauer

Add support for another Infineon Multi-phase controller chip. The xdpe11280 uses linear instead of vid data format for VOUT. Detect VOUT_MODE format during probing and set the xdpe122 related pointers
in case it uses vid.

---
  Documentation/hwmon/xdpe12284.rst | 12 ++++++++---- drivers/hwmon/pmbus/xdpe12284.c   | 22 +++++++++++++++++++---

  2 files changed, 27 insertions(+), 7 deletions(-)
Documentation/hwmon/xdpe12284.rst +0 -0
index 67d1f87808e5..a224dc74ad35 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,10 +24,10 @@ Authors:

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

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

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

and XDPE122

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


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

drivers/hwmon/pmbus/xdpe12284.c +0 -1
index b07da06a40c9..3413aba9d5be 100644
@@ -110,7 +110,6 @@ static int xdpe122_identify(struct i2c_client
 *client,
   static struct pmbus_driver_info xdpe122_info = {
         .pages = XDPE122_PAGE_NUM,
         .format[PSC_VOLTAGE_IN] = linear,
-       .format[PSC_VOLTAGE_OUT] = vid,
         .format[PSC_TEMPERATURE] = linear,
         .format[PSC_CURRENT_IN] = linear,

        .format[PSC_CURRENT_OUT] = linear,

drivers/hwmon/pmbus/xdpe12284.c +0 -0
@@ -123,23 +122,39 @@ static struct pmbus_driver_info xdpe122_info
 = {

                PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
                PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP | PMBUS_HAVE_POUT | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT,
-       .identify = xdpe122_identify,
-       .read_word_data = xdpe122_read_word_data,
  };

  static int xdpe122_probe(struct i2c_client *client) {
        struct pmbus_driver_info *info;
+       int vout_mode;

        info = devm_kmemdup(&client->dev, &xdpe122_info, sizeof(*info),
                            GFP_KERNEL);
        if (!info)
                return -ENOMEM;

+       vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
+       if (vout_mode >= 0 && vout_mode != 0xff) {
+               switch (vout_mode >> 5) {
+               case 0:
+                       info->format[PSC_VOLTAGE_OUT] = linear; +                       break;
+               case 1:
+                       info->format[PSC_VOLTAGE_OUT] = vid; +                       info->identify = xdpe122_identify; +                       info->read_word_data = xdpe122_read_word_data;
+                       break;

Quoted 8 lines
Quoted 4 lines

+               default:
+                       return -ENODEV;
+               }
+       }

I am not entirely happy with this. Why not detect the mode (linear vs. vid)
in the identify function ?

Oh, my bad. I misunderstood your last comment.
I'll move it into the identify function.

Thanks
Marcello

Quoted 24 lines

Thanks,
Guenter

Quoted 19 lines

+
        return pmbus_do_probe(client, info); }

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

drivers/hwmon/pmbus/xdpe12284.c +0 -0
@@ -148,6 +163,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"},
        {}