Message ID | 20200113150841.17670-3-vadimp@mellanox.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | hwmon: (pmbus) Add support for vid mode calculation per page bases | expand |
On Mon, Jan 13, 2020 at 03:08:37PM +0000, Vadim Pasternak wrote: > 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> Applied to hwmon-next. Thanks, Guenter > --- > drivers/hwmon/pmbus/pmbus.h | 2 +- > drivers/hwmon/pmbus/pmbus_core.c | 8 ++++++++ > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h > index 2bdebd0ea9c1..a7f90e18119c 100644 > --- a/drivers/hwmon/pmbus/pmbus.h > +++ b/drivers/hwmon/pmbus/pmbus.h > @@ -377,7 +377,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 */ > diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c > index 98226e84b351..811819e41a72 100644 > --- a/drivers/hwmon/pmbus/pmbus_core.c > +++ b/drivers/hwmon/pmbus/pmbus_core.c > @@ -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; > }
diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h index 2bdebd0ea9c1..a7f90e18119c 100644 --- a/drivers/hwmon/pmbus/pmbus.h +++ b/drivers/hwmon/pmbus/pmbus.h @@ -377,7 +377,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 */ diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 98226e84b351..811819e41a72 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -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; }
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> --- drivers/hwmon/pmbus/pmbus.h | 2 +- drivers/hwmon/pmbus/pmbus_core.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)