[Intel-gfx] [PATCH 2/7] drm/i915/hwmon: Add HWMON current voltage support

Dixit, Ashutosh ashutosh.dixit at intel.com
Wed Sep 21 00:02:50 UTC 2022


On Thu, 15 Sep 2022 07:40:37 -0700, Nilawar, Badal wrote:
>
> On 29-08-2022 23:00, Dixit, Ashutosh wrote:
> > On Thu, 25 Aug 2022 06:21:13 -0700, Badal Nilawar wrote:
> >>
> >> +static int
> >> +hwm_in_read(struct hwm_drvdata *ddat, u32 attr, long *val)
> >> +{
> >> +	struct i915_hwmon *hwmon = ddat->hwmon;
> >> +	intel_wakeref_t wakeref;
> >> +	u32 reg_value;
> >> +
> >> +	switch (attr) {
> >> +	case hwmon_in_input:
> >> +		with_intel_runtime_pm(ddat->uncore->rpm, wakeref)
> >> +			reg_value = intel_uncore_read(ddat->uncore, hwmon->rg.gt_perf_status);
> >> +		/* In units of 2.5 millivolt */
> >> +		*val = DIV_ROUND_CLOSEST(REG_FIELD_GET(GEN12_VOLTAGE_MASK, reg_value) * 25, 10);
>
> And use above scale factors here.
> *val = DIV_ROUND_CLOSEST(REG_FIELD_GET(GEN12_VOLTAGE_MASK, reg_value) *
> SF_VOLTAGE_MUL, SF_VOLTAGE_DIV);
> Regards,
> Badal
> >
> > Let's complete this comment to so that it is clear what's happening:
> >
> >		/* HW register value is in units of 2.5 millivolt */

This was missed in the latest rev so if we could remember to add this that would be great.


More information about the Intel-gfx mailing list