hwmon fixes for v5.6-rc5
Fix an error return in the adt7462 driver, bad voltage limits reported by the xdpe12284 driver, and a broken documentation reference in the adm1177 driver documentation. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAl5idy0ACgkQyx8mb86f mYFiRQ//Xp5JP1QMSTJqcGlM98ai/ZesCM0OB7ocBTt592T/VON8D2eEJapuECve /065OGs1L25HBqPV+1riPUZ+Q9bkhnqyqXZuDx92ShClOpSK9Yy7GQXhXT3Y6D5g bdrwnJK0dwGMR0nkNPKomSodeXP+qub3z5am/5QGIqfhG+ssckNhWYI7eYaKV0js +4L/NcRAJF+hvcmeWQ+mOxKOWkcCAXYCIxo7iJWnnc3BeNplFjKRknUu9FER/bDh gb9tJFZ7zVdH4TsPvl1axJtWYN2whTRljv/Xn5gSeJUM+0X1nrFJ2vP72nOm4goV TZG2vTu3PZvw7uvCXC7P/q0qalgju2cdGr6b91brjrOCzxzj9uijzMGmmEG58rD2 Ls5qnWl5gyit5KuKjKyiyMzkZi0q5OycZaZeIKHenu9TqmHB1tj9h5S9EzKT+gJ/ 8wWEsNR8kw73iTKtB09loxXnAUhxNtNcCzx05zPP5m+MG/iVgJslfaRRxmwnprxG bq4VWT6DQwMCx+98olVURASkl+bIwpkKXvCMIzKRg8oAy7/WKqw0YgXZWUFop7Hi qsWqBjjYTZfB1nz/i9gTRarpLtYAi7xQ8ib6VTP3qsOA/Nws43ffOqDqIZD5YGob fA5Ytdk+c5cwO5Wrjsh9v7TuWpXlC+AQbZkD3icuXWlN9orD4Ck= =AHoG -----END PGP SIGNATURE----- Merge tag 'hwmon-for-v5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon fixes from Guenter Roeck: "Fix an error return in the adt7462 driver, bad voltage limits reported by the xdpe12284 driver, and a broken documentation reference in the adm1177 driver documentation" * tag 'hwmon-for-v5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (adt7462) Fix an error return in ADT7462_REG_VOLT() hwmon: (pmbus/xdpe12284) Add callback for vout limits conversion docs: adm1177: fix a broken reference
This commit is contained in:
commit
08e39fcb92
|
@ -20,8 +20,7 @@ Usage Notes
|
|||
-----------
|
||||
|
||||
This driver does not auto-detect devices. You will have to instantiate the
|
||||
devices explicitly. Please see Documentation/i2c/instantiating-devices for
|
||||
details.
|
||||
devices explicitly. Please see :doc:`/i2c/instantiating-devices` for details.
|
||||
|
||||
|
||||
Sysfs entries
|
||||
|
|
|
@ -413,7 +413,7 @@ static int ADT7462_REG_VOLT(struct adt7462_data *data, int which)
|
|||
return 0x95;
|
||||
break;
|
||||
}
|
||||
return -ENODEV;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Provide labels for sysfs */
|
||||
|
|
|
@ -18,6 +18,59 @@
|
|||
#define XDPE122_AMD_625MV 0x10 /* AMD mode 6.25mV */
|
||||
#define XDPE122_PAGE_NUM 2
|
||||
|
||||
static int xdpe122_read_word_data(struct i2c_client *client, int page, int reg)
|
||||
{
|
||||
const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
|
||||
long val;
|
||||
s16 exponent;
|
||||
s32 mantissa;
|
||||
int ret;
|
||||
|
||||
switch (reg) {
|
||||
case PMBUS_VOUT_OV_FAULT_LIMIT:
|
||||
case PMBUS_VOUT_UV_FAULT_LIMIT:
|
||||
ret = pmbus_read_word_data(client, page, reg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Convert register value to LINEAR11 data. */
|
||||
exponent = ((s16)ret) >> 11;
|
||||
mantissa = ((s16)((ret & GENMASK(10, 0)) << 5)) >> 5;
|
||||
val = mantissa * 1000L;
|
||||
if (exponent >= 0)
|
||||
val <<= exponent;
|
||||
else
|
||||
val >>= -exponent;
|
||||
|
||||
/* Convert data to VID register. */
|
||||
switch (info->vrm_version[page]) {
|
||||
case vr13:
|
||||
if (val >= 500)
|
||||
return 1 + DIV_ROUND_CLOSEST(val - 500, 10);
|
||||
return 0;
|
||||
case vr12:
|
||||
if (val >= 250)
|
||||
return 1 + DIV_ROUND_CLOSEST(val - 250, 5);
|
||||
return 0;
|
||||
case imvp9:
|
||||
if (val >= 200)
|
||||
return 1 + DIV_ROUND_CLOSEST(val - 200, 10);
|
||||
return 0;
|
||||
case amd625mv:
|
||||
if (val >= 200 && val <= 1550)
|
||||
return DIV_ROUND_CLOSEST((1550 - val) * 100,
|
||||
625);
|
||||
return 0;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
default:
|
||||
return -ENODATA;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int xdpe122_identify(struct i2c_client *client,
|
||||
struct pmbus_driver_info *info)
|
||||
{
|
||||
|
@ -70,6 +123,7 @@ static struct pmbus_driver_info xdpe122_info = {
|
|||
PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
|
||||
PMBUS_HAVE_POUT | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT,
|
||||
.identify = xdpe122_identify,
|
||||
.read_word_data = xdpe122_read_word_data,
|
||||
};
|
||||
|
||||
static int xdpe122_probe(struct i2c_client *client,
|
||||
|
|
Loading…
Reference in a new issue