hwmon: (pmbus/core) Add support for Intel IMVP9 and AMD 6.25mV modes
authorVadim Pasternak <vadimp@mellanox.com>
Mon, 13 Jan 2020 15:08:37 +0000 (15:08 +0000)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 23 Jan 2020 21:15:10 +0000 (13:15 -0800)
Extend "vrm_version" with the type for Intel IMVP9 and AMD 6.25mV VID
modes.
Add calculation for those types.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Link: https://lore.kernel.org/r/20200113150841.17670-3-vadimp@mellanox.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/pmbus.h
drivers/hwmon/pmbus/pmbus_core.c

index 423c1464bf52b54498bbc7f1ba0e83f2476f6076..13b34bd67f2315db0c0ce38bb7d592150b24a713 100644 (file)
@@ -388,7 +388,7 @@ enum pmbus_sensor_classes {
 #define PMBUS_PAGE_VIRTUAL     BIT(31)
 
 enum pmbus_data_format { linear = 0, direct, vid };
-enum vrm_version { vr11 = 0, vr12, vr13 };
+enum vrm_version { vr11 = 0, vr12, vr13, imvp9, amd625mv };
 
 struct pmbus_driver_info {
        int pages;              /* Total number of pages */
index 5ba92d1486778303571663a874560e2eb76c10e2..d9c17feb7b4ac4f8367f0507cf6693ba18efbc96 100644 (file)
@@ -709,6 +709,14 @@ static long pmbus_reg2data_vid(struct pmbus_data *data,
                if (val >= 0x01)
                        rv = 500 + (val - 1) * 10;
                break;
+       case imvp9:
+               if (val >= 0x01)
+                       rv = 200 + (val - 1) * 10;
+               break;
+       case amd625mv:
+               if (val >= 0x0 && val <= 0xd8)
+                       rv = DIV_ROUND_CLOSEST(155000 - val * 625, 100);
+               break;
        }
        return rv;
 }