Skip to contentSkip to conversation

hwmon: (adm1275) Enable adm1278 VOUT sampling

PATCH Applied Joel Stanley 2 participants 3 messages Oct 17, 2016 – Oct 18, 2016 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hwmon: (adm1275) Enable adm1278 VOUT sampling

From: Yi Li <[email protected]>

The adm1278 can optionally monitor the VOUT pin. This functioanltiy is not enabled at reset, so PMON_CONFIG needs to be modified in order to enable it.

---
v2:
Return an error when unable to enable VOUT monitoring as suggestd by Guenter

 drivers/hwmon/pmbus/adm1275.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/hwmon/pmbus/adm1275.c +16 -4
index 3baa4f4a8c5e..9940849351a1 100644
@@ -499,15 +499,27 @@ static int adm1275_probe(struct i2c_client *client,
 		pindex = 2;
 		tindex = 3;
 
-		info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT;
+		info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
+			PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
+
+		/* By default when reset VOUT is not enabled */
+		if (!(config & ADM1278_VOUT_EN)) {
+			config |= ADM1278_VOUT_EN;
+			ret = i2c_smbus_write_byte_data(client,
+							ADM1275_PMON_CONFIG,
+							config);
+			if (ret < 0) {
+				dev_err(&client->dev,
+					"Failed to enable VOUT monitoring\n");
+				return -ENODEV;
+			}
+		}
+
 		if (config & ADM1278_TEMP1_EN)
 			info->func[0] |=
 				PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
 		if (config & ADM1278_VIN_EN)
 			info->func[0] |= PMBUS_HAVE_VIN;
-		if (config & ADM1278_VOUT_EN)
-			info->func[0] |=
-				PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
 		break;
 	case adm1293:
 	case adm1294:
Signature · 1 line
2.9.3
maintainer Applied
#1 lore raw
Quoted 8 lines · Joel Stanley

From: Yi Li <[email protected]>

The adm1278 can optionally monitor the VOUT pin. This functioanltiy is not enabled at reset, so PMON_CONFIG needs to be modified in order to enable it.

Applied to -next, after s/functioanltiy/functionality/

Thanks,
Guenter

Quoted 12 lines

---
v2:
Return an error when unable to enable VOUT monitoring as suggestd by Guenter

 drivers/hwmon/pmbus/adm1275.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/hwmon/pmbus/adm1275.c +0 -0
index 3baa4f4a8c5e..9940849351a1 100644

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

Quoted 8 lines
drivers/hwmon/pmbus/adm1275.c +4 -1
@@ -499,15 +499,27 @@ static int adm1275_probe(struct i2c_client *client,
 		pindex = 2;
 		tindex = 3;
 
-		info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT;
+		info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
+			PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
+
+		/* By default when reset VOUT is not enabled */

I also rephrased the comment a bit to make it easier to understand.

Quoted 30 lines
drivers/hwmon/pmbus/adm1275.c +12 -3
+		if (!(config & ADM1278_VOUT_EN)) {
+			config |= ADM1278_VOUT_EN;
+			ret = i2c_smbus_write_byte_data(client,
+							ADM1275_PMON_CONFIG,
+							config);
+			if (ret < 0) {
+				dev_err(&client->dev,
+					"Failed to enable VOUT monitoring\n");
+				return -ENODEV;
+			}
+		}
+
 		if (config & ADM1278_TEMP1_EN)
 			info->func[0] |=
 				PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
 		if (config & ADM1278_VIN_EN)
 			info->func[0] |= PMBUS_HAVE_VIN;
-		if (config & ADM1278_VOUT_EN)
-			info->func[0] |=
-				PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
 		break;
 	case adm1293:
 	case adm1294:
Signature · 6 lines
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 11 lines · Guenter Roeck
Quoted 8 lines · Joel Stanley

From: Yi Li <[email protected]>

The adm1278 can optionally monitor the VOUT pin. This functioanltiy is not enabled at reset, so PMON_CONFIG needs to be modified in order to enable it.

Applied to -next, after s/functioanltiy/functionality/

Thank you!

And thanks for fixing the grammar and spelling. The author is not a native speaker, but I could have done a better job at checking.

Cheers,

Joel

Quoted 57 lines

Thanks,
Guenter

Quoted 12 lines

---
v2:
Return an error when unable to enable VOUT monitoring as suggestd by Guenter

 drivers/hwmon/pmbus/adm1275.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/hwmon/pmbus/adm1275.c +0 -0
index 3baa4f4a8c5e..9940849351a1 100644

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

Quoted 8 lines
drivers/hwmon/pmbus/adm1275.c +4 -1
@@ -499,15 +499,27 @@ static int adm1275_probe(struct i2c_client *client,
              pindex = 2;
              tindex = 3;
 
-             info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT;
+             info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
+                     PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
+
+             /* By default when reset VOUT is not enabled */

I also rephrased the comment a bit to make it easier to understand.

Quoted 30 lines
drivers/hwmon/pmbus/adm1275.c +12 -4
+             if (!(config & ADM1278_VOUT_EN)) {
+                     config |= ADM1278_VOUT_EN;
+                     ret = i2c_smbus_write_byte_data(client,
+                                                     ADM1275_PMON_CONFIG,
+                                                     config);
+                     if (ret < 0) {
+                             dev_err(&client->dev,
+                                     "Failed to enable VOUT monitoring\n");
+                             return -ENODEV;
+                     }
+             }
+
              if (config & ADM1278_TEMP1_EN)
                      info->func[0] |=
                              PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
              if (config & ADM1278_VIN_EN)
                      info->func[0] |= PMBUS_HAVE_VIN;
-             if (config & ADM1278_VOUT_EN)
-                     info->func[0] |=
-                             PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
              break;
      case adm1293:
      case adm1294:
--

2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html