Devicetree
 help / color / mirror / Atom feed
* [PATCH v4 0/2] Add support for Infineon eFuse xdp730
@ 2026-06-08  6:15 ASHISH YADAV
  2026-06-08  6:15 ` [PATCH v4 1/2] dt-bindings: hwmon/pmbus: Add Infineon xdp730 ASHISH YADAV
  2026-06-08  6:15 ` [PATCH v4 2/2] hwmon:(pmbus/xdp720) Add support for efuse xdp730 ASHISH YADAV
  0 siblings, 2 replies; 7+ messages in thread
From: ASHISH YADAV @ 2026-06-08  6:15 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-hwmon, devicetree, linux-kernel, Ashish Yadav

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 2519 bytes --]

From: Ashish Yadav <ashish.yadav@infineon.com>

Hi,

These patches add support for the Infineon XDP730 Digital eFuse Controller
by updating the existing XDP720 driver.

The XDP720 and XDP730 are PMBus-compliant digital eFuse controllers
with an integrated current sensor.They provide accurate system
telemetry (V, I, P, T) and report analog current at the IMON pin for
post-processing.

Both parts share the same PMBus register map and direct-format
coefficients; they differ in the GIMON gain step exposed via the
TELEMETRY_AVG register (bit 10) and in the VDD_VIN pin number
(XDP720: pin 9, XDP730: pin 20).

The Current and Power measurement depends on the RIMON and GIMON values.
The GIMON (microA/A) depends on the 10th bit of TELEMETRY_AVG PMBUS Register.
The value of RIMON (kohm) can be provided by the user through device tree using
infineon,rimon-micro-ohms  property.

Datasheets:
 - XDP720: https://www.infineon.com/assets/row/public/documents/24/49/infineon-xdp720-001-datasheet-en.pdf
 - XDP730: https://www.infineon.com/assets/row/public/documents/24/49/infineon-xdp730-001-datasheet-en.pdf

With Best Regards,
 Ashish Yadav
---
Changes in v4:
- Link to v3:
https://lore.kernel.org/all/20260601090925.3781-1-Ashish.Yadav@infineon.com/
- Drop extra I2C Device node and add rename node info in commit.
https://lore.kernel.org/all/20260601-first-attentive-puffin-d7ca66@quoll/
- Revert back patch formatting.
https://lore.kernel.org/all/bf947dcd-2028-4dfd-a007-c4f39d2b7649@roeck-us.net/

Changes in v3:
- Link to v2:
https://lore.kernel.org/all/20260529054218.5184-1-Ashish.Yadav@infineon.com/
- Revert back the DT info file name to infineon,xdp720.yaml and added
  xdp730 info
https://lore.kernel.org/all/20260529-partake-myself-baa76ed4e279@spud/
- Revert back the driver file name to xdp720.c and added xdp730 support
https://lore.kernel.org/all/20260529062937.646091F00893@smtp.kernel.org/

Changes in v2:
- Link to v1:
https://lore.kernel.org/all/20260519075558.91466-1-Ashish.Yadav@infineon.com/
- Integrated XDP720/XDP730 drivers into one driver.
https://lore.kernel.org/all/51133193-57fb-4a22-bf9e-9817f1f52ad5@roeck-us.net/

Ashish Yadav (2):
  dt-bindings: hwmon/pmbus: Add Infineon xdp730
  hwmon:(pmbus/xdp720) Add support for efuse xdp730

 .../bindings/hwmon/pmbus/infineon,xdp720.yaml | 28 ++++--
 drivers/hwmon/pmbus/Kconfig                   |  2 +-
 drivers/hwmon/pmbus/xdp720.c                  | 97 ++++++++++++-------
 3 files changed, 83 insertions(+), 44 deletions(-)

-- 
2.39.5


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

* [PATCH v4 1/2] dt-bindings: hwmon/pmbus: Add Infineon xdp730
  2026-06-08  6:15 [PATCH v4 0/2] Add support for Infineon eFuse xdp730 ASHISH YADAV
@ 2026-06-08  6:15 ` ASHISH YADAV
  2026-06-08  6:22   ` sashiko-bot
  2026-06-08 17:18   ` Conor Dooley
  2026-06-08  6:15 ` [PATCH v4 2/2] hwmon:(pmbus/xdp720) Add support for efuse xdp730 ASHISH YADAV
  1 sibling, 2 replies; 7+ messages in thread
From: ASHISH YADAV @ 2026-06-08  6:15 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-hwmon, devicetree, linux-kernel, Ashish Yadav

From: Ashish Yadav <ashish.yadav@infineon.com>

Add documentation for the device tree binding of the XDP730 eFuse.
Rename node to efuse to accurately reflect its hardware function.

Signed-off-by: Ashish Yadav <ashish.yadav@infineon.com>
---
 .../bindings/hwmon/pmbus/infineon,xdp720.yaml | 28 ++++++++++++-------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/infineon,xdp720.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/infineon,xdp720.yaml
index 72bc3a5e7139..4a949c53f7ae 100644
--- a/Documentation/devicetree/bindings/hwmon/pmbus/infineon,xdp720.yaml
+++ b/Documentation/devicetree/bindings/hwmon/pmbus/infineon,xdp720.yaml
@@ -5,23 +5,31 @@
 $id: http://devicetree.org/schemas/hwmon/pmbus/infineon,xdp720.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Infineon XDP720 Digital eFuse Controller
+title: Infineon XDP720 / XDP730 Digital eFuse Controllers
 
 maintainers:
   - Ashish Yadav <ashish.yadav@infineon.com>
 
 description: |
-  The XDP720 is an eFuse with integrated current sensor and digital
-  controller. It provides accurate system telemetry (V, I, P, T) and
-  reports analog current at the IMON pin for post-processing.
+  The XDP720 and XDP730 are PMBus-compliant digital eFuse controllers
+  with an integrated current sensor.  They provide accurate system
+  telemetry (V, I, P, T) and report analog current at the IMON pin for
+  post-processing.
 
-  Datasheet:
-     https://www.infineon.com/assets/row/public/documents/24/49/infineon-xdp720-001-datasheet-en.pdf
+  Both parts share the same PMBus register map and direct-format
+  coefficients; they differ in the GIMON gain step exposed via the
+  TELEMETRY_AVG register (bit 10) and in the VDD_VIN pin number
+  (XDP720: pin 9, XDP730: pin 20).
+
+  Datasheets:
+    - XDP720: https://www.infineon.com/assets/row/public/documents/24/49/infineon-xdp720-001-datasheet-en.pdf
+    - XDP730: https://www.infineon.com/assets/row/public/documents/24/49/infineon-xdp730-001-datasheet-en.pdf
 
 properties:
   compatible:
     enum:
       - infineon,xdp720
+      - infineon,xdp730
 
   reg:
     maxItems: 1
@@ -33,9 +41,9 @@ properties:
 
   vdd-vin-supply:
     description:
-      Supply for the VDD_VIN pin (pin 9), the IC controller power supply.
-      Typically connected to the input bus (VIN) through a 100 ohm / 100 nF
-      RC filter.
+      Supply for the VDD_VIN pin (XDP720 pin 9, XDP730 pin 20), the IC
+      controller power supply.  Typically connected to the input bus
+      (VIN) through a 100 ohm / 100 nF RC filter.
 
 required:
   - compatible
@@ -50,7 +58,7 @@ examples:
         #address-cells = <1>;
         #size-cells = <0>;
 
-        hwmon@11 {
+        efuse@11 {
             compatible = "infineon,xdp720";
             reg = <0x11>;
             vdd-vin-supply = <&vdd_vin>;
-- 
2.39.5


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

* [PATCH v4 2/2] hwmon:(pmbus/xdp720) Add support for efuse xdp730
  2026-06-08  6:15 [PATCH v4 0/2] Add support for Infineon eFuse xdp730 ASHISH YADAV
  2026-06-08  6:15 ` [PATCH v4 1/2] dt-bindings: hwmon/pmbus: Add Infineon xdp730 ASHISH YADAV
@ 2026-06-08  6:15 ` ASHISH YADAV
  2026-06-08  6:23   ` sashiko-bot
  2026-06-08 13:49   ` Guenter Roeck
  1 sibling, 2 replies; 7+ messages in thread
From: ASHISH YADAV @ 2026-06-08  6:15 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-hwmon, devicetree, linux-kernel, Ashish Yadav

From: Ashish Yadav <ashish.yadav@infineon.com>

Adds support for the Infineon XDP730 Digital eFuse Controller by
updating the existing XDP720 driver.

Signed-off-by: Ashish Yadav <ashish.yadav@infineon.com>
---
XDP720/XDP730 Digital eFuse Controllers provides accurate system telemetry
(V, I, P, T) and reports analog current at the IMON pin for post-processing.

Both parts share the same PMBus register map and direct-format
coefficients; they differ in the GIMON gain step exposed via the
TELEMETRY_AVG register (bit 10) and in the VDD_VIN pin number
(XDP720: pin 9, XDP730: pin 20).

The Current and Power measurement depends on the RIMON and GIMON values.
The GIMON (microA/A) depends on the 10th bit of TELEMETRY_AVG PMBUS Register.
The value of RIMON (kohm) can be provided by the user through device tree using
infineon,rimon-micro-ohms  property.
---
 drivers/hwmon/pmbus/Kconfig  |  2 +-
 drivers/hwmon/pmbus/xdp720.c | 97 ++++++++++++++++++++++++------------
 2 files changed, 65 insertions(+), 34 deletions(-)

diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index 8f4bff375ecb..a9e86d92b044 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -715,7 +715,7 @@ config SENSORS_XDP720
 	tristate "Infineon XDP720 family"
 	help
 	  If you say yes here you get hardware monitoring support for Infineon
-	  XDP720.
+	  XDP720 and XDP730 Digital eFuse Controllers.
 
 	  This driver can also be built as a module. If so, the module will
 	  be called xdp720.
diff --git a/drivers/hwmon/pmbus/xdp720.c b/drivers/hwmon/pmbus/xdp720.c
index 8729a771f216..9bdeac2d82f5 100644
--- a/drivers/hwmon/pmbus/xdp720.c
+++ b/drivers/hwmon/pmbus/xdp720.c
@@ -1,27 +1,46 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Hardware monitoring driver for Infineon XDP720 Digital eFuse Controller
+ * Hardware monitoring driver for Infineon XDP720 / XDP730 Digital
+ * eFuse Controllers.
+ *
+ * Both parts share the same PMBus register map and direct-format
+ * coefficients; they differ in the GIMON gain step exposed via
+ * the TELEMETRY_AVG register and in the VDD_VIN pin number.
  *
  * Copyright (c) 2026 Infineon Technologies. All rights reserved.
  */
 
+#include <linux/bitops.h>
 #include <linux/i2c.h>
-#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <linux/of_device.h>
-#include <linux/bitops.h>
 #include <linux/math64.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/property.h>
+#include <linux/regulator/consumer.h>
 #include "pmbus.h"
 
 /*
  * The IMON resistor required to generate the system overcurrent protection.
  * Arbitrary default Rimon value: 2k Ohm
  */
-#define XDP720_DEFAULT_RIMON 2000000000 /* 2k ohm */
+#define XDP720_DEFAULT_RIMON 2000000000U /* 2k ohm */
 #define XDP720_TELEMETRY_AVG 0xE9
+#define XDP720_TELEMETRY_AVG_GIMON BIT(10) /* high/low GIMON select */
+
+/* Chip identifiers carried in OF match-data and i2c_device_id->driver_data. */
+enum xdp720_chip_id {
+	CHIP_XDP720 = 0,
+	CHIP_XDP730,
+};
 
-static struct pmbus_driver_info xdp720_info = {
+struct xdp720_data {
+	enum xdp720_chip_id	 id;
+	struct pmbus_driver_info info;
+};
+
+static const struct pmbus_driver_info xdp720_info = {
 	.pages = 1,
 	.format[PSC_VOLTAGE_IN] = direct,
 	.format[PSC_VOLTAGE_OUT] = direct,
@@ -56,57 +75,69 @@ static struct pmbus_driver_info xdp720_info = {
 
 static int xdp720_probe(struct i2c_client *client)
 {
-	struct pmbus_driver_info *info;
+	struct xdp720_data *data;
 	int ret;
-	u32 rimon;
 	int gimon;
+	u32 rimon;
 
-	info = devm_kmemdup(&client->dev, &xdp720_info, sizeof(*info),
-			    GFP_KERNEL);
-	if (!info)
+	data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
 		return -ENOMEM;
 
+	data->id = (enum xdp720_chip_id)(uintptr_t)i2c_get_match_data(client);
+	data->info = xdp720_info;
+
 	ret = devm_regulator_get_enable(&client->dev, "vdd-vin");
 	if (ret)
 		return dev_err_probe(&client->dev, ret,
 			"failed to enable vdd-vin supply\n");
 
 	ret = i2c_smbus_read_word_data(client, XDP720_TELEMETRY_AVG);
-	if (ret < 0) {
-		dev_err(&client->dev, "Can't get TELEMETRY_AVG\n");
-		return ret;
+	if (ret < 0)
+		return dev_err_probe(&client->dev, ret,
+			"failed to read TELEMETRY_AVG\n");
+
+	/* Bit 10 of TELEMETRY_AVG selects the GIMON gain step in microA/A */
+	switch (data->id) {
+	case CHIP_XDP720:
+		gimon = (ret & XDP720_TELEMETRY_AVG_GIMON) ? 18200 : 9100;
+		dev_info(&client->dev, "Initialised XDP720 instance\n");
+		break;
+	case CHIP_XDP730:
+		gimon = (ret & XDP720_TELEMETRY_AVG_GIMON) ? 20000 : 10000;
+		dev_info(&client->dev, "Initialised XDP730 instance\n");
+		break;
+	default:
+		return -EINVAL;
 	}
 
-	ret >>= 10; /* 10th bit of TELEMETRY_AVG REG for GIMON Value */
-	ret &= GENMASK(0, 0);
-	if (ret == 1)
-		gimon = 18200; /* output gain 18.2 microA/A */
-	else
-		gimon = 9100; /* output gain 9.1 microA/A */
-
-	if (of_property_read_u32(client->dev.of_node,
-				 "infineon,rimon-micro-ohms", &rimon))
-		rimon = XDP720_DEFAULT_RIMON; /* Default if not set via DT */
+	if (device_property_read_u32(&client->dev,
+				     "infineon,rimon-micro-ohms", &rimon))
+		rimon = XDP720_DEFAULT_RIMON;	/* Default if not in FW */
 	if (rimon == 0)
 		return -EINVAL;
 
 	/* Adapt the current and power scale for each instance */
-	info->m[PSC_CURRENT_OUT] = DIV64_U64_ROUND_CLOSEST((u64)
-		info->m[PSC_CURRENT_OUT] * rimon * gimon, 1000000000000ULL);
-	info->m[PSC_POWER] = DIV64_U64_ROUND_CLOSEST((u64)
-		info->m[PSC_POWER] * rimon * gimon, 1000000000000000ULL);
-
-	return pmbus_do_probe(client, info);
+	data->info.m[PSC_CURRENT_OUT] = DIV64_U64_ROUND_CLOSEST((u64)
+		data->info.m[PSC_CURRENT_OUT] * rimon * gimon,
+		1000000000000ULL);
+	data->info.m[PSC_POWER] = DIV64_U64_ROUND_CLOSEST((u64)
+		data->info.m[PSC_POWER] * rimon * gimon,
+		1000000000000000ULL);
+
+	return pmbus_do_probe(client, &data->info);
 }
 
 static const struct of_device_id xdp720_of_match[] = {
-	{ .compatible = "infineon,xdp720" },
+	{ .compatible = "infineon,xdp720", .data = (void *)CHIP_XDP720 },
+	{ .compatible = "infineon,xdp730", .data = (void *)CHIP_XDP730 },
 	{}
 };
 MODULE_DEVICE_TABLE(of, xdp720_of_match);
 
 static const struct i2c_device_id xdp720_id[] = {
-	{ "xdp720" },
+	{ "xdp720", CHIP_XDP720 },
+	{ "xdp730", CHIP_XDP730 },
 	{}
 };
 MODULE_DEVICE_TABLE(i2c, xdp720_id);
@@ -123,6 +154,6 @@ static struct i2c_driver xdp720_driver = {
 module_i2c_driver(xdp720_driver);
 
 MODULE_AUTHOR("Ashish Yadav <ashish.yadav@infineon.com>");
-MODULE_DESCRIPTION("PMBus driver for Infineon XDP720 Digital eFuse Controller");
+MODULE_DESCRIPTION("PMBus driver for Infineon XDP720/XDP730 Digital eFuse Controllers");
 MODULE_LICENSE("GPL");
 MODULE_IMPORT_NS("PMBUS");
-- 
2.39.5


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

* Re: [PATCH v4 1/2] dt-bindings: hwmon/pmbus: Add Infineon xdp730
  2026-06-08  6:15 ` [PATCH v4 1/2] dt-bindings: hwmon/pmbus: Add Infineon xdp730 ASHISH YADAV
@ 2026-06-08  6:22   ` sashiko-bot
  2026-06-08 17:18   ` Conor Dooley
  1 sibling, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-06-08  6:22 UTC (permalink / raw)
  To: ASHISH YADAV; +Cc: linux-hwmon, robh, conor+dt, devicetree

> From: Ashish Yadav <ashish.yadav@infineon.com>
> 
> Add documentation for the device tree binding of the XDP730 eFuse.
> Rename node to efuse to accurately reflect its hardware function.
> 
> Signed-off-by: Ashish Yadav <ashish.yadav@infineon.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260608061544.5613-1-Ashish.Yadav@infineon.com?part=1


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

* Re: [PATCH v4 2/2] hwmon:(pmbus/xdp720) Add support for efuse xdp730
  2026-06-08  6:15 ` [PATCH v4 2/2] hwmon:(pmbus/xdp720) Add support for efuse xdp730 ASHISH YADAV
@ 2026-06-08  6:23   ` sashiko-bot
  2026-06-08 13:49   ` Guenter Roeck
  1 sibling, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-06-08  6:23 UTC (permalink / raw)
  To: ASHISH YADAV; +Cc: conor+dt, linux-hwmon, robh, devicetree

> From: Ashish Yadav <ashish.yadav@infineon.com>
> 
> Adds support for the Infineon XDP730 Digital eFuse Controller by
> updating the existing XDP720 driver.
> 
> Signed-off-by: Ashish Yadav <ashish.yadav@infineon.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260608061544.5613-1-Ashish.Yadav@infineon.com?part=2


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

* Re: [PATCH v4 2/2] hwmon:(pmbus/xdp720) Add support for efuse xdp730
  2026-06-08  6:15 ` [PATCH v4 2/2] hwmon:(pmbus/xdp720) Add support for efuse xdp730 ASHISH YADAV
  2026-06-08  6:23   ` sashiko-bot
@ 2026-06-08 13:49   ` Guenter Roeck
  1 sibling, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2026-06-08 13:49 UTC (permalink / raw)
  To: ASHISH YADAV, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-hwmon, devicetree, linux-kernel, Ashish Yadav

On 6/7/26 23:15, ASHISH YADAV wrote:
> From: Ashish Yadav <ashish.yadav@infineon.com>
> 
> Adds support for the Infineon XDP730 Digital eFuse Controller by
> updating the existing XDP720 driver.
> 
> Signed-off-by: Ashish Yadav <ashish.yadav@infineon.com>
> ---
> XDP720/XDP730 Digital eFuse Controllers provides accurate system telemetry
> (V, I, P, T) and reports analog current at the IMON pin for post-processing.
> 
> Both parts share the same PMBus register map and direct-format
> coefficients; they differ in the GIMON gain step exposed via the
> TELEMETRY_AVG register (bit 10) and in the VDD_VIN pin number
> (XDP720: pin 9, XDP730: pin 20).
> 
> The Current and Power measurement depends on the RIMON and GIMON values.
> The GIMON (microA/A) depends on the 10th bit of TELEMETRY_AVG PMBUS Register.
> The value of RIMON (kohm) can be provided by the user through device tree using
> infineon,rimon-micro-ohms  property.
> ---
>   drivers/hwmon/pmbus/Kconfig  |  2 +-
>   drivers/hwmon/pmbus/xdp720.c | 97 ++++++++++++++++++++++++------------
>   2 files changed, 65 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
> index 8f4bff375ecb..a9e86d92b044 100644
> --- a/drivers/hwmon/pmbus/Kconfig
> +++ b/drivers/hwmon/pmbus/Kconfig
> @@ -715,7 +715,7 @@ config SENSORS_XDP720
>   	tristate "Infineon XDP720 family"
>   	help
>   	  If you say yes here you get hardware monitoring support for Infineon
> -	  XDP720.
> +	  XDP720 and XDP730 Digital eFuse Controllers.
>   
>   	  This driver can also be built as a module. If so, the module will
>   	  be called xdp720.
> diff --git a/drivers/hwmon/pmbus/xdp720.c b/drivers/hwmon/pmbus/xdp720.c
> index 8729a771f216..9bdeac2d82f5 100644
> --- a/drivers/hwmon/pmbus/xdp720.c
> +++ b/drivers/hwmon/pmbus/xdp720.c
> @@ -1,27 +1,46 @@
>   // SPDX-License-Identifier: GPL-2.0+
>   /*
> - * Hardware monitoring driver for Infineon XDP720 Digital eFuse Controller
> + * Hardware monitoring driver for Infineon XDP720 / XDP730 Digital
> + * eFuse Controllers.
> + *
> + * Both parts share the same PMBus register map and direct-format
> + * coefficients; they differ in the GIMON gain step exposed via
> + * the TELEMETRY_AVG register and in the VDD_VIN pin number.
>    *
>    * Copyright (c) 2026 Infineon Technologies. All rights reserved.
>    */
>   
> +#include <linux/bitops.h>
>   #include <linux/i2c.h>
> -#include <linux/module.h>
>   #include <linux/init.h>
>   #include <linux/kernel.h>
> -#include <linux/of_device.h>
> -#include <linux/bitops.h>
>   #include <linux/math64.h>
> +#include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/property.h>
> +#include <linux/regulator/consumer.h>

Reordering include files and adding the regulator include
is an unrelated change and would need to be done in a separate patch.

>   #include "pmbus.h"
>   
>   /*
>    * The IMON resistor required to generate the system overcurrent protection.
>    * Arbitrary default Rimon value: 2k Ohm
>    */
> -#define XDP720_DEFAULT_RIMON 2000000000 /* 2k ohm */
> +#define XDP720_DEFAULT_RIMON 2000000000U /* 2k ohm */

Is this preference or needed ? Either case, it is an unrelated change.

>   #define XDP720_TELEMETRY_AVG 0xE9
> +#define XDP720_TELEMETRY_AVG_GIMON BIT(10) /* high/low GIMON select */
> +
> +/* Chip identifiers carried in OF match-data and i2c_device_id->driver_data. */
> +enum xdp720_chip_id {
> +	CHIP_XDP720 = 0,
> +	CHIP_XDP730,
> +};
>   
> -static struct pmbus_driver_info xdp720_info = {
> +struct xdp720_data {
> +	enum xdp720_chip_id	 id;
> +	struct pmbus_driver_info info;
> +};
> +
> +static const struct pmbus_driver_info xdp720_info = {
>   	.pages = 1,
>   	.format[PSC_VOLTAGE_IN] = direct,
>   	.format[PSC_VOLTAGE_OUT] = direct,
> @@ -56,57 +75,69 @@ static struct pmbus_driver_info xdp720_info = {
>   
>   static int xdp720_probe(struct i2c_client *client)
>   {
> -	struct pmbus_driver_info *info;
> +	struct xdp720_data *data;
>   	int ret;
> -	u32 rimon;
>   	int gimon;
> +	u32 rimon;

Why this change ?

>   
> -	info = devm_kmemdup(&client->dev, &xdp720_info, sizeof(*info),
> -			    GFP_KERNEL);
> -	if (!info)
> +	data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
> +	if (!data)
>   		return -ENOMEM;
>   
> +	data->id = (enum xdp720_chip_id)(uintptr_t)i2c_get_match_data(client);
> +	data->info = xdp720_info;
> +
>   	ret = devm_regulator_get_enable(&client->dev, "vdd-vin");
>   	if (ret)
>   		return dev_err_probe(&client->dev, ret,
>   			"failed to enable vdd-vin supply\n");
>   
>   	ret = i2c_smbus_read_word_data(client, XDP720_TELEMETRY_AVG);
> -	if (ret < 0) {
> -		dev_err(&client->dev, "Can't get TELEMETRY_AVG\n");
> -		return ret;
> +	if (ret < 0)
> +		return dev_err_probe(&client->dev, ret,
> +			"failed to read TELEMETRY_AVG\n");

Another unrelated change.

Please, if you want to clean up the driver, that is fine, but please do it
with separate patches. It is ok to make a simple cleanup change as part of
a patch like this, but it needs to be mentioned in the commit message.
But this goes beyond "simple". The patch

- Reorders include files to alphabetic order
- Adds the missing regulator include
- Declares XDP720_DEFAULT_RIMON as unsigned constant
- Changes error return to dev_err_probe()
- (unnecessarily) changes the rimon/gimon declaration order

in addition to adding support for the new chip. This is just too much.
Please split that out.

Thanks,
Guenter

> +
> +	/* Bit 10 of TELEMETRY_AVG selects the GIMON gain step in microA/A */
> +	switch (data->id) {
> +	case CHIP_XDP720:
> +		gimon = (ret & XDP720_TELEMETRY_AVG_GIMON) ? 18200 : 9100;
> +		dev_info(&client->dev, "Initialised XDP720 instance\n");
> +		break;
> +	case CHIP_XDP730:
> +		gimon = (ret & XDP720_TELEMETRY_AVG_GIMON) ? 20000 : 10000;
> +		dev_info(&client->dev, "Initialised XDP730 instance\n");
> +		break;
> +	default:
> +		return -EINVAL;
>   	}
>   
> -	ret >>= 10; /* 10th bit of TELEMETRY_AVG REG for GIMON Value */
> -	ret &= GENMASK(0, 0);
> -	if (ret == 1)
> -		gimon = 18200; /* output gain 18.2 microA/A */
> -	else
> -		gimon = 9100; /* output gain 9.1 microA/A */
> -
> -	if (of_property_read_u32(client->dev.of_node,
> -				 "infineon,rimon-micro-ohms", &rimon))
> -		rimon = XDP720_DEFAULT_RIMON; /* Default if not set via DT */
> +	if (device_property_read_u32(&client->dev,
> +				     "infineon,rimon-micro-ohms", &rimon))
> +		rimon = XDP720_DEFAULT_RIMON;	/* Default if not in FW */
>   	if (rimon == 0)
>   		return -EINVAL;
>   
>   	/* Adapt the current and power scale for each instance */
> -	info->m[PSC_CURRENT_OUT] = DIV64_U64_ROUND_CLOSEST((u64)
> -		info->m[PSC_CURRENT_OUT] * rimon * gimon, 1000000000000ULL);
> -	info->m[PSC_POWER] = DIV64_U64_ROUND_CLOSEST((u64)
> -		info->m[PSC_POWER] * rimon * gimon, 1000000000000000ULL);
> -
> -	return pmbus_do_probe(client, info);
> +	data->info.m[PSC_CURRENT_OUT] = DIV64_U64_ROUND_CLOSEST((u64)
> +		data->info.m[PSC_CURRENT_OUT] * rimon * gimon,
> +		1000000000000ULL);
> +	data->info.m[PSC_POWER] = DIV64_U64_ROUND_CLOSEST((u64)
> +		data->info.m[PSC_POWER] * rimon * gimon,
> +		1000000000000000ULL);
> +
> +	return pmbus_do_probe(client, &data->info);
>   }
>   
>   static const struct of_device_id xdp720_of_match[] = {
> -	{ .compatible = "infineon,xdp720" },
> +	{ .compatible = "infineon,xdp720", .data = (void *)CHIP_XDP720 },
> +	{ .compatible = "infineon,xdp730", .data = (void *)CHIP_XDP730 },
>   	{}
>   };
>   MODULE_DEVICE_TABLE(of, xdp720_of_match);
>   
>   static const struct i2c_device_id xdp720_id[] = {
> -	{ "xdp720" },
> +	{ "xdp720", CHIP_XDP720 },
> +	{ "xdp730", CHIP_XDP730 },
>   	{}
>   };
>   MODULE_DEVICE_TABLE(i2c, xdp720_id);
> @@ -123,6 +154,6 @@ static struct i2c_driver xdp720_driver = {
>   module_i2c_driver(xdp720_driver);
>   
>   MODULE_AUTHOR("Ashish Yadav <ashish.yadav@infineon.com>");
> -MODULE_DESCRIPTION("PMBus driver for Infineon XDP720 Digital eFuse Controller");
> +MODULE_DESCRIPTION("PMBus driver for Infineon XDP720/XDP730 Digital eFuse Controllers");
>   MODULE_LICENSE("GPL");
>   MODULE_IMPORT_NS("PMBUS");


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

* Re: [PATCH v4 1/2] dt-bindings: hwmon/pmbus: Add Infineon xdp730
  2026-06-08  6:15 ` [PATCH v4 1/2] dt-bindings: hwmon/pmbus: Add Infineon xdp730 ASHISH YADAV
  2026-06-08  6:22   ` sashiko-bot
@ 2026-06-08 17:18   ` Conor Dooley
  1 sibling, 0 replies; 7+ messages in thread
From: Conor Dooley @ 2026-06-08 17:18 UTC (permalink / raw)
  To: ASHISH YADAV
  Cc: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-hwmon, devicetree, linux-kernel, Ashish Yadav

[-- Attachment #1: Type: text/plain, Size: 75 bytes --]

Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2026-06-08 17:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-08  6:15 [PATCH v4 0/2] Add support for Infineon eFuse xdp730 ASHISH YADAV
2026-06-08  6:15 ` [PATCH v4 1/2] dt-bindings: hwmon/pmbus: Add Infineon xdp730 ASHISH YADAV
2026-06-08  6:22   ` sashiko-bot
2026-06-08 17:18   ` Conor Dooley
2026-06-08  6:15 ` [PATCH v4 2/2] hwmon:(pmbus/xdp720) Add support for efuse xdp730 ASHISH YADAV
2026-06-08  6:23   ` sashiko-bot
2026-06-08 13:49   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox