diff mbox series

[RFC,hwmon-next,v1,2/5] hwmon: (pmbus/core) Add support for Intel IMVP9 specification

Message ID 20200105105833.30196-3-vadimp@mellanox.com (mailing list archive)
State Superseded
Headers show
Series hwmon: (pmbus) Add support for vid mode calculation per page bases | expand

Commit Message

Vadim Pasternak Jan. 5, 2020, 10:58 a.m. UTC
Extend "vrm_version" with support for Intel IMVP9 specification.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
---
 drivers/hwmon/pmbus/pmbus.h      | 2 +-
 drivers/hwmon/pmbus/pmbus_core.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Guenter Roeck Jan. 5, 2020, 4:26 p.m. UTC | #1
On 1/5/20 2:58 AM, Vadim Pasternak wrote:
> Extend "vrm_version" with support for Intel IMVP9 specification.
> 
> Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
> ---
>   drivers/hwmon/pmbus/pmbus.h      | 2 +-
>   drivers/hwmon/pmbus/pmbus_core.c | 4 ++++
>   2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
> index 2bdebd0ea9c1..c6b2401f1c6c 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 };
>   
>   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..a9b7b555cf6e 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -709,6 +709,10 @@ 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;

There is also Intel VR14, and there is some indication that it is identical
to imvp9. If that is the case, I would prefer to use existing terminology.
Unfortunately, Intel is a bit close-lipped about both. If you have access
to documentation, can you check ?

Thanks,
Guenter

>   	}
>   	return rv;
>   }
>
Vadim Pasternak Jan. 5, 2020, 5:15 p.m. UTC | #2
> -----Original Message-----
> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> Sent: Sunday, January 05, 2020 6:26 PM
> To: Vadim Pasternak <vadimp@mellanox.com>; robh+dt@kernel.org;
> vijaykhemka@fb.com
> Cc: linux-hwmon@vger.kernel.org; devicetree@vger.kernel.org
> Subject: Re: [RFC PATCH hwmon-next v1 2/5] hwmon: (pmbus/core) Add support
> for Intel IMVP9 specification
> 
> On 1/5/20 2:58 AM, Vadim Pasternak wrote:
> > Extend "vrm_version" with support for Intel IMVP9 specification.
> >
> > Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
> > ---
> >   drivers/hwmon/pmbus/pmbus.h      | 2 +-
> >   drivers/hwmon/pmbus/pmbus_core.c | 4 ++++
> >   2 files changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
> > index 2bdebd0ea9c1..c6b2401f1c6c 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 };
> >
> >   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..a9b7b555cf6e 100644
> > --- a/drivers/hwmon/pmbus/pmbus_core.c
> > +++ b/drivers/hwmon/pmbus/pmbus_core.c
> > @@ -709,6 +709,10 @@ 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;
> 
> There is also Intel VR14, and there is some indication that it is identical to imvp9.
> If that is the case, I would prefer to use existing terminology.
> Unfortunately, Intel is a bit close-lipped about both. If you have access to
> documentation, can you check ?

Sure, I'll check it with our hw guys.

> 
> Thanks,
> Guenter
> 
> >   	}
> >   	return rv;
> >   }
> >
Vadim Pasternak Jan. 6, 2020, 12:14 p.m. UTC | #3
> -----Original Message-----
> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> Sent: Sunday, January 05, 2020 6:26 PM
> To: Vadim Pasternak <vadimp@mellanox.com>; robh+dt@kernel.org;
> vijaykhemka@fb.com
> Cc: linux-hwmon@vger.kernel.org; devicetree@vger.kernel.org
> Subject: Re: [RFC PATCH hwmon-next v1 2/5] hwmon: (pmbus/core) Add support
> for Intel IMVP9 specification
> 
> On 1/5/20 2:58 AM, Vadim Pasternak wrote:
> > Extend "vrm_version" with support for Intel IMVP9 specification.
> >
> > Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
> > ---
> >   drivers/hwmon/pmbus/pmbus.h      | 2 +-
> >   drivers/hwmon/pmbus/pmbus_core.c | 4 ++++
> >   2 files changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
> > index 2bdebd0ea9c1..c6b2401f1c6c 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 };
> >
> >   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..a9b7b555cf6e 100644
> > --- a/drivers/hwmon/pmbus/pmbus_core.c
> > +++ b/drivers/hwmon/pmbus/pmbus_core.c
> > @@ -709,6 +709,10 @@ 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;
> 
> There is also Intel VR14, and there is some indication that it is identical to imvp9.
> If that is the case, I would prefer to use existing terminology.
> Unfortunately, Intel is a bit close-lipped about both. If you have access to
> documentation, can you check ?

Hi Guenter,

It's really tricky to find some clear Intel doc on for that.
I checked it with ours and Infineon HW guys.

IMVP9 has a different VID table than VR13HC/VR14.

For v14 we can use the same formula as we are using for vr13.

IMVP9 is different because it has a different voltage range.

The 5mV VID table of VR14 supports a voltage range from
0.25V to 1.52V.
The 10mV VID table of VR14 supports a voltage range from
0.5V t0 3.04V.

The IMVP9 VID table also has a 10mV step, but the voltage range
is from 0.2 to 2.74V.

Thanks,
Vadim.

> 
> Thanks,
> Guenter
> 
> >   	}
> >   	return rv;
> >   }
> >
diff mbox series

Patch

diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
index 2bdebd0ea9c1..c6b2401f1c6c 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 };
 
 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..a9b7b555cf6e 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -709,6 +709,10 @@  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;
 	}
 	return rv;
 }