]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
hwmon: (adm1275) Enable adm1278 VOUT sampling
authorYi Li <adamliyi@msn.com>
Mon, 17 Oct 2016 08:08:53 +0000 (18:38 +1030)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 2 Dec 2016 21:28:07 +0000 (13:28 -0800)
The adm1278 can optionally monitor the VOUT pin. This functionality is
not enabled at reset, so PMON_CONFIG needs to be modified in order to
enable it.

Signed-off-by: Yi Li <adamliyi@msn.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/adm1275.c

index 3baa4f4a8c5e8bfd23d2fa79cb132b0f495ca49a..4ab5293c7bf0d5589868efd15f6c596b783856a3 100644 (file)
@@ -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;
+
+               /* Enable VOUT if not enabled (it is disabled by default) */
+               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: