diff options
author | Guenter Roeck <linux@roeck-us.net> | 2015-07-20 09:47:33 -0700 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2015-08-09 13:44:27 -0700 |
commit | 068c227056b9223fea1a759e08db2558d5cbb5ad (patch) | |
tree | 2b95f3e702580b1797554ebfba6123ee52a5f141 /drivers/hwmon | |
parent | ead8080351c988b9c4bb5ec261d7b4c97ebb2773 (diff) | |
download | linux-068c227056b9223fea1a759e08db2558d5cbb5ad.tar.bz2 |
hwmon: (pmbus) Add support for VR12
Newer chips such as MAX20751 support VR12. Add support for it.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/pmbus/pmbus.c | 1 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/pmbus.h | 2 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/pmbus_core.c | 16 |
3 files changed, 15 insertions, 4 deletions
diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c index 554d0249dcde..bbfa35d82e42 100644 --- a/drivers/hwmon/pmbus/pmbus.c +++ b/drivers/hwmon/pmbus/pmbus.c @@ -129,6 +129,7 @@ static int pmbus_identify(struct i2c_client *client, break; case 1: info->format[PSC_VOLTAGE_OUT] = vid; + info->vrm_version = vr11; break; case 2: info->format[PSC_VOLTAGE_OUT] = direct; diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h index 2427f6e7c641..eece5f5e2282 100644 --- a/drivers/hwmon/pmbus/pmbus.h +++ b/drivers/hwmon/pmbus/pmbus.h @@ -338,10 +338,12 @@ enum pmbus_sensor_classes { #define PMBUS_HAVE_STATUS_VMON (1 << 19) enum pmbus_data_format { linear = 0, direct, vid }; +enum vrm_version { vr11 = 0, vr12 }; struct pmbus_driver_info { int pages; /* Total number of pages */ enum pmbus_data_format format[PSC_NUM_CLASSES]; + enum vrm_version vrm_version; /* * Support one set of coefficients for each sensor type * Used for chips providing data in direct mode. diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 306a1b175557..398198140b81 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -515,16 +515,24 @@ static long pmbus_reg2data_direct(struct pmbus_data *data, /* * Convert VID sensor values to milli- or micro-units * depending on sensor type. - * We currently only support VR11. */ static long pmbus_reg2data_vid(struct pmbus_data *data, struct pmbus_sensor *sensor) { long val = sensor->data; + long rv = 0; - if (val < 0x02 || val > 0xb2) - return 0; - return DIV_ROUND_CLOSEST(160000 - (val - 2) * 625, 100); + switch (data->info->vrm_version) { + case vr11: + if (val >= 0x02 && val <= 0xb2) + rv = DIV_ROUND_CLOSEST(160000 - (val - 2) * 625, 100); + break; + case vr12: + if (val >= 0x01) + rv = 250 + (val - 1) * 5; + break; + } + return rv; } static long pmbus_reg2data(struct pmbus_data *data, struct pmbus_sensor *sensor) |