Skip to contentSkip to conversation

hwmon/ir38064: Add support for IR38060, IR38164 IR38263

PATCH Superseded [email protected] 2 participants 5 messages Dec 13, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 hwmon/ir38064: Add support for IR38060, IR38164 IR38263

From: Patrick Rudolph <[email protected]>

---
 .../devicetree/bindings/trivial-devices.yaml  |  6 ++++
 Documentation/hwmon/ir38064.rst               | 28 +++++++++++++++++--
 drivers/hwmon/pmbus/Kconfig                   |  4 +--
 drivers/hwmon/pmbus/ir38064.c                 |  5 +++-
 4 files changed, 38 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/trivial-devices.yaml +6 -0
index 791079021f1b..38c3264b3dcb 100644
@@ -121,8 +121,14 @@ properties:
           - ibm,cffps2
             # Infineon IR36021 digital POL buck controller
           - infineon,ir36021
+          # Infineon IR38060 Voltage Regulator
+          - infineon,ir38060
             # Infineon IR38064 Voltage Regulator
           - infineon,ir38064
+          # Infineon IR38164 Voltage Regulator
+          - infineon,ir38164
+          # Infineon IR38263 Voltage Regulator
+          - infineon,ir38263
             # Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 100khz)
           - infineon,slb9635tt
             # Infineon SLB9645 I2C TPM (new protocol, max 400khz)
Documentation/hwmon/ir38064.rst +26 -2
index c455d755a267..e1148f21ea2a 100644
@@ -3,14 +3,38 @@ Kernel driver ir38064
 
 Supported chips:
 
+  * Infineon IR38060
+
+    Prefix: 'IR38060'
+    Addresses scanned: -
+
+    Datasheet: Publicly available at the Infineon website
+      https://www.infineon.com/dgdl/Infineon-IR38060M-DS-v03_16-EN.pdf?fileId=5546d4625c167129015c3291ea9a4cee
+
   * Infineon IR38064
 
     Prefix: 'ir38064'
     Addresses scanned: -
 
-    Datasheet: Publicly available at the Infineon webiste
+    Datasheet: Publicly available at the Infineon website
       https://www.infineon.com/dgdl/Infineon-IR38064MTRPBF-DS-v03_07-EN.pdf?fileId=5546d462584d1d4a0158db0d9efb67ca
 
+  * Infineon IR38164
+
+    Prefix: 'ir38164'
+    Addresses scanned: -
+
+    Datasheet: Publicly available at the Infineon website
+      https://www.infineon.com/dgdl/Infineon-IR38164M-DS-v02_02-EN.pdf?fileId=5546d462636cc8fb01640046efea1248
+
+  * Infineon ir38263
+
+    Prefix: 'ir38263'
+    Addresses scanned: -
+
+    Datasheet:  Publicly available at the Infineon website
+      https://www.infineon.com/dgdl/Infineon-IR38263M-DataSheet-v03_05-EN.pdf?fileId=5546d4625b62cd8a015bcf81f90a6e52
+
 Authors:
       - Maxim Sloyko <[email protected]>
       - Patrick Venture <[email protected]>
@@ -18,7 +42,7 @@ Authors:
 Description
 -----------
 
-IR38064 is a Single-input Voltage, Synchronous Buck Regulator, DC-DC Converter.
+IR38x6x are a Single-input Voltage, Synchronous Buck Regulator, DC-DC Converter.
 
 Usage Notes
 -----------
drivers/hwmon/pmbus/Kconfig +2 -2
index ffb609cee3a4..d2b178a902f0 100644
@@ -123,10 +123,10 @@ config SENSORS_IR36021
 	  be called ir36021.
 
 config SENSORS_IR38064
-	tristate "Infineon IR38064"
+	tristate "Infineon IR38064 and compatibles"
 	help
 	  If you say yes here you get hardware monitoring support for Infineon
-	  IR38064.
+	  IR38060, IR38064, IR38164 and IR38263.
 
 	  This driver can also be built as a module. If so, the module will
 	  be called ir38064.
drivers/hwmon/pmbus/ir38064.c +4 -1
index 1fb7f1248639..4e91d3e54a4a 100644
@@ -41,7 +41,10 @@ static int ir38064_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id ir38064_id[] = {
+	{"ir38060", 0},
 	{"ir38064", 0},
+	{"ir38164", 0},
+	{"ir38263", 0},
 	{}
 };
 
@@ -59,6 +62,6 @@ static struct i2c_driver ir38064_driver = {
 module_i2c_driver(ir38064_driver);
 
 MODULE_AUTHOR("Maxim Sloyko <[email protected]>");
-MODULE_DESCRIPTION("PMBus driver for Infineon IR38064");
+MODULE_DESCRIPTION("PMBus driver for Infineon IR38064 and comaptible chips");
 MODULE_LICENSE("GPL");
 MODULE_IMPORT_NS(PMBUS);
Signature · 1 line
2.33.1
#1 lore raw

PATCH 2/3 pmbus/ir38064: Add of_match_table

From: Arthur Heymans <[email protected]>

---
 drivers/hwmon/pmbus/ir38064.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/hwmon/pmbus/ir38064.c +11 -0
index 4e91d3e54a4a..429577b027b4 100644
@@ -16,6 +16,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include "pmbus.h"
 
 static struct pmbus_driver_info ir38064_info = {
@@ -50,10 +51,20 @@ static const struct i2c_device_id ir38064_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, ir38064_id);
 
+static const struct of_device_id ir38064_of_match[] = {
+	{ .compatible = "infineon,ir38060" },
+	{ .compatible = "infineon,ir38064" },
+	{ .compatible = "infineon,ir38164" },
+	{ .compatible = "infineon,ir38263" },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, ir38064_of_match);
+
 /* This is the driver that will be inserted */
 static struct i2c_driver ir38064_driver = {
 	.driver = {
 		   .name = "ir38064",
+		   .of_match_table = ir38064_of_match,
 		   },
 	.probe_new = ir38064_probe,
 	.id_table = ir38064_id,
Signature · 1 line
2.33.1
#2 lore raw

PATCH 3/3 ir38064: Expose a regulator

In reply to [email protected]

From: Patrick Rudolph <[email protected]>

---
 drivers/hwmon/pmbus/Kconfig   |  6 ++++++
 drivers/hwmon/pmbus/ir38064.c | 17 +++++++++++++++++
 2 files changed, 23 insertions(+)
drivers/hwmon/pmbus/Kconfig +6 -0
index d2b178a902f0..fdfe1cd54799 100644
@@ -131,6 +131,12 @@ config SENSORS_IR38064
 	  This driver can also be built as a module. If so, the module will
 	  be called ir38064.
 
+config SENSORS_IR38064_REGULATOR
+	bool "Regulator support for IR38064 and compatibles"
+	depends on SENSORS_IR38064 && REGULATOR
+	help
+	  Uses the IR38064 or compatible as regulator.
+
 config SENSORS_IRPS5401
 	tristate "Infineon IRPS5401"
 	help
drivers/hwmon/pmbus/ir38064.c +17 -0
index 429577b027b4..61cbe5063688 100644
@@ -17,8 +17,15 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
+#include <linux/regulator/driver.h>
 #include "pmbus.h"
 
+#if IS_ENABLED(CONFIG_SENSORS_IR38064_REGULATOR)
+static const struct regulator_desc ir38064_reg_desc[] = {
+	PMBUS_REGULATOR("vout", 0),
+};
+#endif /* CONFIG_SENSORS_IR38064_REGULATOR */
+
 static struct pmbus_driver_info ir38064_info = {
 	.pages = 1,
 	.format[PSC_VOLTAGE_IN] = linear,
@@ -33,9 +40,19 @@ static struct pmbus_driver_info ir38064_info = {
 	    | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP
 	    | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
 	    | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
+#if IS_ENABLED(CONFIG_SENSORS_IR38064_REGULATOR)
+#ifdef PMBUS_HAVE_VOUT_COMMAND
+		| PMBUS_HAVE_VOUT_COMMAND
+#endif
+#endif
 	    | PMBUS_HAVE_POUT,
+#if IS_ENABLED(CONFIG_SENSORS_IR38064_REGULATOR)
+	.num_regulators = 1,
+	.reg_desc = ir38064_reg_desc,
+#endif
 };
 
+
 static int ir38064_probe(struct i2c_client *client)
 {
 	return pmbus_do_probe(client, &ir38064_info);
Signature · 1 line
2.33.1
maintainer
#3 lore raw

Re: [PATCH 3/3] ir38064: Expose a regulator

Quoted 46 lines · On 12/13/21 2:19 AM, [email protected] wrote:

From: Patrick Rudolph <[email protected]>

---
  drivers/hwmon/pmbus/Kconfig   |  6 ++++++
  drivers/hwmon/pmbus/ir38064.c | 17 +++++++++++++++++
  2 files changed, 23 insertions(+)
drivers/hwmon/pmbus/Kconfig +6 -0
index d2b178a902f0..fdfe1cd54799 100644
@@ -131,6 +131,12 @@ config SENSORS_IR38064
  	  This driver can also be built as a module. If so, the module will
  	  be called ir38064.
 
+config SENSORS_IR38064_REGULATOR
+	bool "Regulator support for IR38064 and compatibles"
+	depends on SENSORS_IR38064 && REGULATOR
+	help
+	  Uses the IR38064 or compatible as regulator.
+
  config SENSORS_IRPS5401
  	tristate "Infineon IRPS5401"
  	help
drivers/hwmon/pmbus/ir38064.c +7 -0
index 429577b027b4..61cbe5063688 100644
@@ -17,8 +17,15 @@
  #include <linux/kernel.h>
  #include <linux/module.h>
  #include <linux/of_device.h>
+#include <linux/regulator/driver.h>
  #include "pmbus.h"
 
+#if IS_ENABLED(CONFIG_SENSORS_IR38064_REGULATOR)
+static const struct regulator_desc ir38064_reg_desc[] = {
+	PMBUS_REGULATOR("vout", 0),
+};
+#endif /* CONFIG_SENSORS_IR38064_REGULATOR */
+
  static struct pmbus_driver_info ir38064_info = {
  	.pages = 1,
  	.format[PSC_VOLTAGE_IN] = linear,

drivers/hwmon/pmbus/ir38064.c static struct pmbus_driver_info ir38064_info = { · line 47

Quoted 8 lines
drivers/hwmon/pmbus/ir38064.c +5 -0
@@ -33,9 +40,19 @@ static struct pmbus_driver_info ir38064_info = {
  	    | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP
  	    | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
  	    | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
+#if IS_ENABLED(CONFIG_SENSORS_IR38064_REGULATOR)
+#ifdef PMBUS_HAVE_VOUT_COMMAND
+		| PMBUS_HAVE_VOUT_COMMAND
+#endif
+#endif

Please drop. PMBUS_HAVE_VOUT_COMMAND is not defined in the upstream kernel. Yes, code introducing it was suggested two years ago, and I rejected it. The reasons are still valid. If you have out-of tree code which enables setting voltages values and voltage margins with hwmon sysfs attributes, please keep it out-of-tree.

Thanks,
Guenter

Quoted 12 lines
drivers/hwmon/pmbus/ir38064.c +5 -0
  	    | PMBUS_HAVE_POUT,
+#if IS_ENABLED(CONFIG_SENSORS_IR38064_REGULATOR)
+	.num_regulators = 1,
+	.reg_desc = ir38064_reg_desc,
+#endif
  };
 
+
  static int ir38064_probe(struct i2c_client *client)
  {
  	return pmbus_do_probe(client, &ir38064_info);
maintainer
#4 lore raw
In reply to [email protected]
Quoted 2 lines · On 12/13/21 2:19 AM, [email protected] wrote:

From: Patrick Rudolph <[email protected]>

Description goes here. the same applies to the other patches in the series.

Guenter

Quoted 122 lines
---
  .../devicetree/bindings/trivial-devices.yaml  |  6 ++++
  Documentation/hwmon/ir38064.rst               | 28 +++++++++++++++++--
  drivers/hwmon/pmbus/Kconfig                   |  4 +--
  drivers/hwmon/pmbus/ir38064.c                 |  5 +++-
  4 files changed, 38 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/trivial-devices.yaml +6 -0
index 791079021f1b..38c3264b3dcb 100644
@@ -121,8 +121,14 @@ properties:
            - ibm,cffps2
              # Infineon IR36021 digital POL buck controller
            - infineon,ir36021
+          # Infineon IR38060 Voltage Regulator
+          - infineon,ir38060
              # Infineon IR38064 Voltage Regulator
            - infineon,ir38064
+          # Infineon IR38164 Voltage Regulator
+          - infineon,ir38164
+          # Infineon IR38263 Voltage Regulator
+          - infineon,ir38263
              # Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 100khz)
            - infineon,slb9635tt
              # Infineon SLB9645 I2C TPM (new protocol, max 400khz)
Documentation/hwmon/ir38064.rst +26 -2
index c455d755a267..e1148f21ea2a 100644
@@ -3,14 +3,38 @@ Kernel driver ir38064
 
  Supported chips:
 
+  * Infineon IR38060
+
+    Prefix: 'IR38060'
+    Addresses scanned: -
+
+    Datasheet: Publicly available at the Infineon website
+      https://www.infineon.com/dgdl/Infineon-IR38060M-DS-v03_16-EN.pdf?fileId=5546d4625c167129015c3291ea9a4cee
+
    * Infineon IR38064
 
      Prefix: 'ir38064'
      Addresses scanned: -
 
-    Datasheet: Publicly available at the Infineon webiste
+    Datasheet: Publicly available at the Infineon website
        https://www.infineon.com/dgdl/Infineon-IR38064MTRPBF-DS-v03_07-EN.pdf?fileId=5546d462584d1d4a0158db0d9efb67ca
 
+  * Infineon IR38164
+
+    Prefix: 'ir38164'
+    Addresses scanned: -
+
+    Datasheet: Publicly available at the Infineon website
+      https://www.infineon.com/dgdl/Infineon-IR38164M-DS-v02_02-EN.pdf?fileId=5546d462636cc8fb01640046efea1248
+
+  * Infineon ir38263
+
+    Prefix: 'ir38263'
+    Addresses scanned: -
+
+    Datasheet:  Publicly available at the Infineon website
+      https://www.infineon.com/dgdl/Infineon-IR38263M-DataSheet-v03_05-EN.pdf?fileId=5546d4625b62cd8a015bcf81f90a6e52
+
  Authors:
        - Maxim Sloyko <[email protected]>
        - Patrick Venture <[email protected]>
@@ -18,7 +42,7 @@ Authors:
  Description
  -----------
 
-IR38064 is a Single-input Voltage, Synchronous Buck Regulator, DC-DC Converter.
+IR38x6x are a Single-input Voltage, Synchronous Buck Regulator, DC-DC Converter.
 
  Usage Notes
  -----------
drivers/hwmon/pmbus/Kconfig +2 -2
index ffb609cee3a4..d2b178a902f0 100644
@@ -123,10 +123,10 @@ config SENSORS_IR36021
  	  be called ir36021.
 
  config SENSORS_IR38064
-	tristate "Infineon IR38064"
+	tristate "Infineon IR38064 and compatibles"
  	help
  	  If you say yes here you get hardware monitoring support for Infineon
-	  IR38064.
+	  IR38060, IR38064, IR38164 and IR38263.
 
  	  This driver can also be built as a module. If so, the module will
  	  be called ir38064.
drivers/hwmon/pmbus/ir38064.c +4 -1
index 1fb7f1248639..4e91d3e54a4a 100644
@@ -41,7 +41,10 @@ static int ir38064_probe(struct i2c_client *client)
  }
 
  static const struct i2c_device_id ir38064_id[] = {
+	{"ir38060", 0},
  	{"ir38064", 0},
+	{"ir38164", 0},
+	{"ir38263", 0},
  	{}
  };
 
@@ -59,6 +62,6 @@ static struct i2c_driver ir38064_driver = {
  module_i2c_driver(ir38064_driver);
 
  MODULE_AUTHOR("Maxim Sloyko <[email protected]>");
-MODULE_DESCRIPTION("PMBus driver for Infineon IR38064");
+MODULE_DESCRIPTION("PMBus driver for Infineon IR38064 and comaptible chips");
  MODULE_LICENSE("GPL");
  MODULE_IMPORT_NS(PMBUS);