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>
This commit is contained in:
parent
ead8080351
commit
068c227056
|
@ -129,6 +129,7 @@ static int pmbus_identify(struct i2c_client *client,
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
info->format[PSC_VOLTAGE_OUT] = vid;
|
info->format[PSC_VOLTAGE_OUT] = vid;
|
||||||
|
info->vrm_version = vr11;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
info->format[PSC_VOLTAGE_OUT] = direct;
|
info->format[PSC_VOLTAGE_OUT] = direct;
|
||||||
|
|
|
@ -338,10 +338,12 @@ enum pmbus_sensor_classes {
|
||||||
#define PMBUS_HAVE_STATUS_VMON (1 << 19)
|
#define PMBUS_HAVE_STATUS_VMON (1 << 19)
|
||||||
|
|
||||||
enum pmbus_data_format { linear = 0, direct, vid };
|
enum pmbus_data_format { linear = 0, direct, vid };
|
||||||
|
enum vrm_version { vr11 = 0, vr12 };
|
||||||
|
|
||||||
struct pmbus_driver_info {
|
struct pmbus_driver_info {
|
||||||
int pages; /* Total number of pages */
|
int pages; /* Total number of pages */
|
||||||
enum pmbus_data_format format[PSC_NUM_CLASSES];
|
enum pmbus_data_format format[PSC_NUM_CLASSES];
|
||||||
|
enum vrm_version vrm_version;
|
||||||
/*
|
/*
|
||||||
* Support one set of coefficients for each sensor type
|
* Support one set of coefficients for each sensor type
|
||||||
* Used for chips providing data in direct mode.
|
* Used for chips providing data in direct mode.
|
||||||
|
|
|
@ -515,16 +515,24 @@ static long pmbus_reg2data_direct(struct pmbus_data *data,
|
||||||
/*
|
/*
|
||||||
* Convert VID sensor values to milli- or micro-units
|
* Convert VID sensor values to milli- or micro-units
|
||||||
* depending on sensor type.
|
* depending on sensor type.
|
||||||
* We currently only support VR11.
|
|
||||||
*/
|
*/
|
||||||
static long pmbus_reg2data_vid(struct pmbus_data *data,
|
static long pmbus_reg2data_vid(struct pmbus_data *data,
|
||||||
struct pmbus_sensor *sensor)
|
struct pmbus_sensor *sensor)
|
||||||
{
|
{
|
||||||
long val = sensor->data;
|
long val = sensor->data;
|
||||||
|
long rv = 0;
|
||||||
|
|
||||||
if (val < 0x02 || val > 0xb2)
|
switch (data->info->vrm_version) {
|
||||||
return 0;
|
case vr11:
|
||||||
return DIV_ROUND_CLOSEST(160000 - (val - 2) * 625, 100);
|
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)
|
static long pmbus_reg2data(struct pmbus_data *data, struct pmbus_sensor *sensor)
|
||||||
|
|
Loading…
Reference in New Issue