]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
hwmon: (pmbus/bpa-rs600) Don't use rated limits as warn limits
authorChris Packham <chris.packham@alliedtelesis.co.nz>
Thu, 12 Aug 2021 01:39:59 +0000 (13:39 +1200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Sep 2021 08:00:49 +0000 (10:00 +0200)
[ Upstream commit 7a8c68c57fd09541377f6971f25efdeb9a926c37 ]

In the initial implementation a number of PMBUS_x_WARN_LIMITs were
mapped to MFR fields. This was incorrect as these MFR limits reflect the
rated limit as opposed to a limit which will generate warning. Instead
return -ENXIO like we were already doing for other WARN_LIMITs.

Subsequently these rated limits have been exposed generically as new
fields in the sysfs ABI so the values are still available.

Fixes: 15b2703e5e02 ("hwmon: (pmbus) Add driver for BluTek BPA-RS600")
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20210812014000.26293-2-chris.packham@alliedtelesis.co.nz
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwmon/pmbus/bpa-rs600.c

index 2be69fedfa361a00303c640dbb0946114d8b52c9..be76efe67d83fabed6f337c6497bc2939409f16c 100644 (file)
 #include <linux/pmbus.h>
 #include "pmbus.h"
 
-#define BPARS600_MFR_VIN_MIN   0xa0
-#define BPARS600_MFR_VIN_MAX   0xa1
-#define BPARS600_MFR_IIN_MAX   0xa2
-#define BPARS600_MFR_PIN_MAX   0xa3
-#define BPARS600_MFR_VOUT_MIN  0xa4
-#define BPARS600_MFR_VOUT_MAX  0xa5
-#define BPARS600_MFR_IOUT_MAX  0xa6
-#define BPARS600_MFR_POUT_MAX  0xa7
-
 static int bpa_rs600_read_byte_data(struct i2c_client *client, int page, int reg)
 {
        int ret;
@@ -81,29 +72,13 @@ static int bpa_rs600_read_word_data(struct i2c_client *client, int page, int pha
 
        switch (reg) {
        case PMBUS_VIN_UV_WARN_LIMIT:
-               ret = pmbus_read_word_data(client, 0, 0xff, BPARS600_MFR_VIN_MIN);
-               break;
        case PMBUS_VIN_OV_WARN_LIMIT:
-               ret = pmbus_read_word_data(client, 0, 0xff, BPARS600_MFR_VIN_MAX);
-               break;
        case PMBUS_VOUT_UV_WARN_LIMIT:
-               ret = pmbus_read_word_data(client, 0, 0xff, BPARS600_MFR_VOUT_MIN);
-               break;
        case PMBUS_VOUT_OV_WARN_LIMIT:
-               ret = pmbus_read_word_data(client, 0, 0xff, BPARS600_MFR_VOUT_MAX);
-               break;
        case PMBUS_IIN_OC_WARN_LIMIT:
-               ret = pmbus_read_word_data(client, 0, 0xff, BPARS600_MFR_IIN_MAX);
-               break;
        case PMBUS_IOUT_OC_WARN_LIMIT:
-               ret = pmbus_read_word_data(client, 0, 0xff, BPARS600_MFR_IOUT_MAX);
-               break;
        case PMBUS_PIN_OP_WARN_LIMIT:
-               ret = pmbus_read_word_data(client, 0, 0xff, BPARS600_MFR_PIN_MAX);
-               break;
        case PMBUS_POUT_OP_WARN_LIMIT:
-               ret = pmbus_read_word_data(client, 0, 0xff, BPARS600_MFR_POUT_MAX);
-               break;
        case PMBUS_VIN_UV_FAULT_LIMIT:
        case PMBUS_VIN_OV_FAULT_LIMIT:
        case PMBUS_VOUT_UV_FAULT_LIMIT: