Skip to contentSkip to conversation

Add sq24905c support

PATCH Superseded ChiShih Tsai 3 participants 6 messages Aug 4, 2025 – Aug 5, 2025

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Add sq24905c support

The SQ24905C is also a Hot-swap controller similar to the ADM1278, with the following differences:
* The MFR_ID register data is different.
* The MFR_MODEL register data is different.

It also introduces two parameters "silergy,power-sample-average" and "silergy,volt-curr-sample-average" for Digital Power Monitor. Device tree bindings are updated accordingly.

The currently available ADM1275 driver supports the ADM1278 and this patch adds support for the SQ24905C. The datasheet see link for reference.
https://www.silergy.com/download/downloadFile?id=5669&type=product&ftype=note

ChiShih Tsai (2):
dt-bindings: hwmon: adm1275: add sq24905c support
hwmon: (pmbus/adm1275) add sq24905c support

 .../bindings/hwmon/adi,adm1275.yaml           | 20 ++++++++++++++
 Documentation/hwmon/adm1275.rst               | 24 +++++++++++------
 drivers/hwmon/pmbus/Kconfig                   |  5 ++--
 drivers/hwmon/pmbus/adm1275.c                 | 27 +++++++++++++------
 4 files changed, 58 insertions(+), 18 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 dt-bindings: hwmon: adm1275: add sq24905c support

Add support for sq24905c Hot-Swap Controller and Digital Power Monitor.

---
 .../bindings/hwmon/adi,adm1275.yaml           | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
Documentation/devicetree/bindings/hwmon/adi,adm1275.yaml +20 -0
index ddb72857c846..6aa300086c84 100644
@@ -30,6 +30,7 @@ properties:
       - adi,adm1281
       - adi,adm1293
       - adi,adm1294
+      - silergy,sq24905c
 
   reg:
     maxItems: 1
@@ -46,6 +47,18 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     enum: [1, 2, 4, 8, 16, 32, 64, 128]
 
+  silergy,volt-curr-sample-average:
+    description: |
+      Number of samples to be used to report voltage and current values.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [1, 2, 4, 8, 16, 32, 64, 128]
+
+  silergy,power-sample-average:
+    description: |
+      Number of samples to be used to report power values.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [1, 2, 4, 8, 16, 32, 64, 128]
+
 allOf:
   - $ref: hwmon-common.yaml#
   - if:
@@ -96,12 +109,17 @@ allOf:
               - adi,adm1281
               - adi,adm1293
               - adi,adm1294
+              - silergy,sq24905c
     then:
       properties:
         adi,volt-curr-sample-average:
           default: 128
         adi,power-sample-average:
           default: 1
+        silergy,volt-curr-sample-average:
+          default: 128
+        silergy,power-sample-average:
+          default: 1
 
 required:
   - compatible
@@ -121,5 +139,7 @@ examples:
             shunt-resistor-micro-ohms = <500>;
             adi,volt-curr-sample-average = <128>;
             adi,power-sample-average = <128>;
+            silergy,volt-curr-sample-average = <128>;
+            silergy,power-sample-average = <1>;
         };
     };
Signature · 1 line
2.43.0
#4 lore raw

PATCH 2/2 hwmon: (pmbus/adm1275) add sq24905c support

In reply to ChiShih Tsai

Add support for sq24905c which is similar to adm1275 and other chips of the series.

---
 Documentation/hwmon/adm1275.rst | 24 ++++++++++++++++--------
 drivers/hwmon/pmbus/Kconfig     |  5 +++--
 drivers/hwmon/pmbus/adm1275.c   | 27 +++++++++++++++++++--------
 3 files changed, 38 insertions(+), 18 deletions(-)
Documentation/hwmon/adm1275.rst +16 -8
index 57bd7a850558..914f009f34e0 100644
@@ -67,6 +67,14 @@ Supported chips:
 
     Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADM1293_1294.pdf
 
+  * Silergy SQ24905C
+
+    Prefix: 'sq24905c'
+
+    Addresses scanned: -
+
+    Datasheet: https://www.silergy.com/download/downloadFile?id=5669&type=product&ftype=note
+
 Author: Guenter Roeck <[email protected]>
 
 
@@ -74,14 +82,14 @@ Description
 -----------
 
 This driver supports hardware monitoring for Analog Devices ADM1075, ADM1272,
-ADM1273, ADM1275, ADM1276, ADM1278, ADM1281, ADM1293, and ADM1294 Hot-Swap
-Controller and Digital Power Monitors.
+ADM1273, ADM1275, ADM1276, ADM1278, ADM1281, ADM1293, ADM1294, and SQ24905C
+Hot-Swap Controller and Digital Power Monitors.
 
-ADM1075, ADM1272, ADM1273, ADM1275, ADM1276, ADM1278, ADM1281, ADM1293, and
-ADM1294 are hot-swap controllers that allow a circuit board to be removed from
-or inserted into a live backplane. They also feature current and voltage
-readback via an integrated 12 bit analog-to-digital converter (ADC), accessed
-using a PMBus interface.
+ADM1075, ADM1272, ADM1273, ADM1275, ADM1276, ADM1278, ADM1281, ADM1293,
+ADM1294 and SQ24905C are hot-swap controllers that allow a circuit board to be
+removed from or inserted into a live backplane. They also feature current and
+voltage readback via an integrated 12 bit analog-to-digital converter (ADC),
+accessed using a PMBus interface.
 
 The driver is a client driver to the core PMBus driver. Please see
 Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
@@ -160,5 +168,5 @@ temp1_highest		Highest observed temperature.
 temp1_reset_history	Write any value to reset history.
 
 			Temperature attributes are supported on ADM1272,
-			ADM1273, ADM1278, and ADM1281.
+			ADM1273, ADM1278, ADM1281 and SQ24905C.
 ======================= =======================================================
drivers/hwmon/pmbus/Kconfig +3 -2
index 55e492452ce8..7485bc6b2e8a 100644
@@ -51,8 +51,9 @@ config SENSORS_ADM1275
 	tristate "Analog Devices ADM1275 and compatibles"
 	help
 	  If you say yes here you get hardware monitoring support for Analog
-	  Devices ADM1075, ADM1272, ADM1273, ADM1275, ADM1276, ADM1278, ADM1281,
-	  ADM1293, and ADM1294 Hot-Swap Controller and Digital Power Monitors.
+	  Devices ADM1075, ADM1272, ADM1273, ADM1275, ADM1276, ADM1278,
+	  ADM1281, ADM1293, ADM1294 and SQ24905C Hot-Swap Controller and
+	  Digital Power Monitors.
 
 	  This driver can also be built as a module. If so, the module will
 	  be called adm1275.
drivers/hwmon/pmbus/adm1275.c +19 -8
index 7d175baa5de2..1c032aaac379 100644
@@ -18,7 +18,8 @@
 #include <linux/log2.h>
 #include "pmbus.h"
 
-enum chips { adm1075, adm1272, adm1273, adm1275, adm1276, adm1278, adm1281, adm1293, adm1294 };
+enum chips { adm1075, adm1272, adm1273, adm1275, adm1276, adm1278, adm1281,
+	 adm1293, adm1294, sq24905c };
 
 #define ADM1275_MFR_STATUS_IOUT_WARN2	BIT(0)
 #define ADM1293_MFR_STATUS_VAUX_UV_WARN	BIT(5)
@@ -486,6 +487,7 @@ static const struct i2c_device_id adm1275_id[] = {
 	{ "adm1281", adm1281 },
 	{ "adm1293", adm1293 },
 	{ "adm1294", adm1294 },
+	{ "MC09C", sq24905c },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, adm1275_id);
@@ -533,8 +535,10 @@ static int adm1275_probe(struct i2c_client *client)
 		return ret;
 	}
 	if (ret != 3 || strncmp(block_buffer, "ADI", 3)) {
-		dev_err(&client->dev, "Unsupported Manufacturer ID\n");
-		return -ENODEV;
+		if (ret != 2 || strncmp(block_buffer, "SY", 2)) {
+			dev_err(&client->dev, "Unsupported Manufacturer ID\n");
+			return -ENODEV;
+		}
 	}
 
 	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, block_buffer);
@@ -558,7 +562,8 @@ static int adm1275_probe(struct i2c_client *client)
 
 	if (mid->driver_data == adm1272 || mid->driver_data == adm1273 ||
 	    mid->driver_data == adm1278 || mid->driver_data == adm1281 ||
-	    mid->driver_data == adm1293 || mid->driver_data == adm1294)
+	    mid->driver_data == adm1293 || mid->driver_data == adm1294 ||
+	    mid->driver_data == sq24905c)
 		config_read_fn = i2c_smbus_read_word_data;
 	else
 		config_read_fn = i2c_smbus_read_byte_data;
@@ -708,6 +713,7 @@ static int adm1275_probe(struct i2c_client *client)
 		break;
 	case adm1278:
 	case adm1281:
+	case sq24905c:
 		data->have_vout = true;
 		data->have_pin_max = true;
 		data->have_temp_max = true;
@@ -786,9 +792,12 @@ static int adm1275_probe(struct i2c_client *client)
 		return -ENODEV;
 	}
 
-	if (data->have_power_sampling &&
+	if ((data->have_power_sampling &&
 	    of_property_read_u32(client->dev.of_node,
-				 "adi,power-sample-average", &avg) == 0) {
+				 "adi,power-sample-average", &avg) == 0) ||
+	    (data->have_power_sampling &&
+	    of_property_read_u32(client->dev.of_node,
+				 "silergy,power-sample-average", &avg) == 0)) {
 		if (!avg || avg > ADM1275_SAMPLES_AVG_MAX ||
 		    BIT(__fls(avg)) != avg) {
 			dev_err(&client->dev,
@@ -804,8 +813,10 @@ static int adm1275_probe(struct i2c_client *client)
 		}
 	}
 
-	if (of_property_read_u32(client->dev.of_node,
-				"adi,volt-curr-sample-average", &avg) == 0) {
+	if ((of_property_read_u32(client->dev.of_node,
+				"adi,volt-curr-sample-average", &avg) == 0) ||
+	    (of_property_read_u32(client->dev.of_node,
+				"silergy,volt-curr-sample-average", &avg) == 0)) {
 		if (!avg || avg > ADM1275_SAMPLES_AVG_MAX ||
 		    BIT(__fls(avg)) != avg) {
 			dev_err(&client->dev,
Signature · 1 line
2.43.0
maintainer
#2 lore raw

Re: [PATCH 1/2] dt-bindings: hwmon: adm1275: add sq24905c support

In reply to ChiShih Tsai
Quoted 44 lines · ChiShih Tsai

Add support for sq24905c Hot-Swap Controller and Digital Power Monitor.

---
  .../bindings/hwmon/adi,adm1275.yaml           | 20 +++++++++++++++++++
  1 file changed, 20 insertions(+)
Documentation/devicetree/bindings/hwmon/adi,adm1275.yaml +14 -0
index ddb72857c846..6aa300086c84 100644
@@ -30,6 +30,7 @@ properties:
        - adi,adm1281
        - adi,adm1293
        - adi,adm1294
+      - silergy,sq24905c
 
    reg:
      maxItems: 1
@@ -46,6 +47,18 @@ properties:
      $ref: /schemas/types.yaml#/definitions/uint32
      enum: [1, 2, 4, 8, 16, 32, 64, 128]
 
+  silergy,volt-curr-sample-average:
+    description: |
+      Number of samples to be used to report voltage and current values.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [1, 2, 4, 8, 16, 32, 64, 128]
+
+  silergy,power-sample-average:
+    description: |
+      Number of samples to be used to report power values.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [1, 2, 4, 8, 16, 32, 64, 128]
+
  allOf:
    - $ref: hwmon-common.yaml#
    - if:
@@ -96,12 +109,17 @@ allOf:
                - adi,adm1281
                - adi,adm1293
                - adi,adm1294
+              - silergy,sq24905c
      then:

Documentation/devicetree/bindings/hwmon/adi,adm1275.yaml allOf: · line 123

Quoted 10 lines
Documentation/devicetree/bindings/hwmon/adi,adm1275.yaml +4 -0
        properties:
          adi,volt-curr-sample-average:
            default: 128
          adi,power-sample-average:
            default: 1
+        silergy,volt-curr-sample-average:
+          default: 128
+        silergy,power-sample-average:
+          default: 1
 

I personally don't think this warrants new properties. However, if warranted, this needs to be qualified to only apply for the Silergy parts.

Guenter

Quoted 10 lines
Documentation/devicetree/bindings/hwmon/adi,adm1275.yaml +2 -0
  required:
    - compatible
@@ -121,5 +139,7 @@ examples:
              shunt-resistor-micro-ohms = <500>;
              adi,volt-curr-sample-average = <128>;
              adi,power-sample-average = <128>;
+            silergy,volt-curr-sample-average = <128>;
+            silergy,power-sample-average = <1>;
          };
      };
maintainer
#5 lore raw

Re: [PATCH 2/2] hwmon: (pmbus/adm1275) add sq24905c support

In reply to ChiShih Tsai
Quoted 89 lines · ChiShih Tsai

Add support for sq24905c which is similar to adm1275 and other chips of the series.

---
  Documentation/hwmon/adm1275.rst | 24 ++++++++++++++++--------
  drivers/hwmon/pmbus/Kconfig     |  5 +++--
  drivers/hwmon/pmbus/adm1275.c   | 27 +++++++++++++++++++--------
  3 files changed, 38 insertions(+), 18 deletions(-)
Documentation/hwmon/adm1275.rst +16 -8
index 57bd7a850558..914f009f34e0 100644
@@ -67,6 +67,14 @@ Supported chips:
 
      Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADM1293_1294.pdf
 
+  * Silergy SQ24905C
+
+    Prefix: 'sq24905c'
+
+    Addresses scanned: -
+
+    Datasheet: https://www.silergy.com/download/downloadFile?id=5669&type=product&ftype=note
+
  Author: Guenter Roeck <[email protected]>
 
 
@@ -74,14 +82,14 @@ Description
  -----------
 
  This driver supports hardware monitoring for Analog Devices ADM1075, ADM1272,
-ADM1273, ADM1275, ADM1276, ADM1278, ADM1281, ADM1293, and ADM1294 Hot-Swap
-Controller and Digital Power Monitors.
+ADM1273, ADM1275, ADM1276, ADM1278, ADM1281, ADM1293, ADM1294, and SQ24905C
+Hot-Swap Controller and Digital Power Monitors.
 
-ADM1075, ADM1272, ADM1273, ADM1275, ADM1276, ADM1278, ADM1281, ADM1293, and
-ADM1294 are hot-swap controllers that allow a circuit board to be removed from
-or inserted into a live backplane. They also feature current and voltage
-readback via an integrated 12 bit analog-to-digital converter (ADC), accessed
-using a PMBus interface.
+ADM1075, ADM1272, ADM1273, ADM1275, ADM1276, ADM1278, ADM1281, ADM1293,
+ADM1294 and SQ24905C are hot-swap controllers that allow a circuit board to be
+removed from or inserted into a live backplane. They also feature current and
+voltage readback via an integrated 12 bit analog-to-digital converter (ADC),
+accessed using a PMBus interface.
 
  The driver is a client driver to the core PMBus driver. Please see
  Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
@@ -160,5 +168,5 @@ temp1_highest		Highest observed temperature.
  temp1_reset_history	Write any value to reset history.
 
  			Temperature attributes are supported on ADM1272,
-			ADM1273, ADM1278, and ADM1281.
+			ADM1273, ADM1278, ADM1281 and SQ24905C.
  ======================= =======================================================
drivers/hwmon/pmbus/Kconfig +3 -2
index 55e492452ce8..7485bc6b2e8a 100644
@@ -51,8 +51,9 @@ config SENSORS_ADM1275
  	tristate "Analog Devices ADM1275 and compatibles"
  	help
  	  If you say yes here you get hardware monitoring support for Analog
-	  Devices ADM1075, ADM1272, ADM1273, ADM1275, ADM1276, ADM1278, ADM1281,
-	  ADM1293, and ADM1294 Hot-Swap Controller and Digital Power Monitors.
+	  Devices ADM1075, ADM1272, ADM1273, ADM1275, ADM1276, ADM1278,
+	  ADM1281, ADM1293, ADM1294 and SQ24905C Hot-Swap Controller and
+	  Digital Power Monitors.
 
  	  This driver can also be built as a module. If so, the module will
  	  be called adm1275.
drivers/hwmon/pmbus/adm1275.c +2 -1
index 7d175baa5de2..1c032aaac379 100644
@@ -18,7 +18,8 @@
  #include <linux/log2.h>
  #include "pmbus.h"
 
-enum chips { adm1075, adm1272, adm1273, adm1275, adm1276, adm1278, adm1281, adm1293, adm1294 };
+enum chips { adm1075, adm1272, adm1273, adm1275, adm1276, adm1278, adm1281,
+	 adm1293, adm1294, sq24905c };
 
  #define ADM1275_MFR_STATUS_IOUT_WARN2	BIT(0)
  #define ADM1293_MFR_STATUS_VAUX_UV_WARN	BIT(5)

drivers/hwmon/pmbus/adm1275.c static const struct i2c_device_id adm1275_id[] = { · line 490

Quoted 4 lines
drivers/hwmon/pmbus/adm1275.c +1 -0
@@ -486,6 +487,7 @@ static const struct i2c_device_id adm1275_id[] = {
  	{ "adm1281", adm1281 },
  	{ "adm1293", adm1293 },
  	{ "adm1294", adm1294 },
+	{ "MC09C", sq24905c },

mc09c (lower case). But how did you test this ? This seems to be intended to match PMBUS_MFR_MODEL, but it is not the ID suggested in devicetree properties (silergy,sq24905c). It seems to me that the match code in the probe function needs to be modified to handle situations where PMBUS_MFR_MODEL does not match the device id.

drivers/hwmon/pmbus/adm1275.c static int adm1275_probe(struct i2c_client *client) · line 541

Quoted 13 lines
drivers/hwmon/pmbus/adm1275.c +4 -2
  	{ }
  };
  MODULE_DEVICE_TABLE(i2c, adm1275_id);
@@ -533,8 +535,10 @@ static int adm1275_probe(struct i2c_client *client)
  		return ret;
  	}
  	if (ret != 3 || strncmp(block_buffer, "ADI", 3)) {
-		dev_err(&client->dev, "Unsupported Manufacturer ID\n");
-		return -ENODEV;
+		if (ret != 2 || strncmp(block_buffer, "SY", 2)) {
+			dev_err(&client->dev, "Unsupported Manufacturer ID\n");
+			return -ENODEV;
+		}

Combine to a single if statement.

	if ((ret != 3 || strncmp(block_buffer, "ADI", 3)) &&
	    (ret != 2 || strncmp(block_buffer, "SY", 2))) {
		dev_err(&client->dev, "Unsupported Manufacturer ID\n");
		return -ENODEV;
	}
Quoted 14 lines
drivers/hwmon/pmbus/adm1275.c +2 -1
  	}
 
  	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, block_buffer);
@@ -558,7 +562,8 @@ static int adm1275_probe(struct i2c_client *client)
 
  	if (mid->driver_data == adm1272 || mid->driver_data == adm1273 ||
  	    mid->driver_data == adm1278 || mid->driver_data == adm1281 ||
-	    mid->driver_data == adm1293 || mid->driver_data == adm1294)
+	    mid->driver_data == adm1293 || mid->driver_data == adm1294 ||
+	    mid->driver_data == sq24905c)
  		config_read_fn = i2c_smbus_read_word_data;
  	else
  		config_read_fn = i2c_smbus_read_byte_data;

drivers/hwmon/pmbus/adm1275.c static int adm1275_probe(struct i2c_client *client) · line 716

Quoted 4 lines
drivers/hwmon/pmbus/adm1275.c +1 -0
@@ -708,6 +713,7 @@ static int adm1275_probe(struct i2c_client *client)
  		break;
  	case adm1278:
  	case adm1281:
+	case sq24905c:

That suggests compatibility to ADM1278 and ADM1281, not ADM1275. That should be mentioned in the description.

Quoted 5 lines
drivers/hwmon/pmbus/adm1275.c +0 -0
  		data->have_vout = true;
  		data->have_pin_max = true;
  		data->have_temp_max = true;
@@ -786,9 +792,12 @@ static int adm1275_probe(struct i2c_client *client)
  		return -ENODEV;

drivers/hwmon/pmbus/adm1275.c static int adm1275_probe(struct i2c_client *client) · line 800

Quoted 10 lines
drivers/hwmon/pmbus/adm1275.c +5 -2
  	}
 
-	if (data->have_power_sampling &&
+	if ((data->have_power_sampling &&
  	    of_property_read_u32(client->dev.of_node,
-				 "adi,power-sample-average", &avg) == 0) {
+				 "adi,power-sample-average", &avg) == 0) ||
+	    (data->have_power_sampling &&
+	    of_property_read_u32(client->dev.of_node,
+				 "silergy,power-sample-average", &avg) == 0)) {

Checking for have_power_sampling twice just makes the code unnecessarily complex.

Also, if it is really even acceptable to have two properties for the same function, there will need to be a validation to ensure that only the "correct" one, based on the chip type, is used.

Quoted 16 lines
drivers/hwmon/pmbus/adm1275.c +4 -2
  		if (!avg || avg > ADM1275_SAMPLES_AVG_MAX ||
  		    BIT(__fls(avg)) != avg) {
  			dev_err(&client->dev,
@@ -804,8 +813,10 @@ static int adm1275_probe(struct i2c_client *client)
  		}
  	}
 
-	if (of_property_read_u32(client->dev.of_node,
-				"adi,volt-curr-sample-average", &avg) == 0) {
+	if ((of_property_read_u32(client->dev.of_node,
+				"adi,volt-curr-sample-average", &avg) == 0) ||
+	    (of_property_read_u32(client->dev.of_node,
+				"silergy,volt-curr-sample-average", &avg) == 0)) {
  		if (!avg || avg > ADM1275_SAMPLES_AVG_MAX ||
  		    BIT(__fls(avg)) != avg) {
  			dev_err(&client->dev,
#3 lore raw

Re: [PATCH 1/2] dt-bindings: hwmon: adm1275: add sq24905c support

In reply to Guenter Roeck
Quoted 12 lines · Guenter Roeck
Quoted 12 lines

allOf:
- $ref: hwmon-common.yaml#
- if:

Documentation/devicetree/bindings/hwmon/adi,adm1275.yaml +1 -0
@@ -96,12 +109,17 @@ allOf:
                - adi,adm1281
                - adi,adm1293
                - adi,adm1294
+              - silergy,sq24905c
      then:
        properties:
          adi,volt-curr-sample-average:
            default: 128
Quoted 8 lines

Documentation/devicetree/bindings/hwmon/adi,adm1275.yaml allOf: · line 122

Quoted 6 lines
Documentation/devicetree/bindings/hwmon/adi,adm1275.yaml +4 -0
          adi,power-sample-average:
            default: 1
+        silergy,volt-curr-sample-average:
+          default: 128
+        silergy,power-sample-average:
+          default: 1

I personally don't think this warrants new properties. However, if warranted,

These are the same properties as adi ones, right? Then I agree, re-use existing ones.

Best regards,
Krzysztof