[Intel-gfx] [PATCH 3/3] drm/i915/hwmon: Add HWMON current voltage support
Dixit, Ashutosh
ashutosh.dixit at intel.com
Fri Jun 10 22:35:23 UTC 2022
On Mon, 23 May 2022 04:08:41 -0700, Badal Nilawar wrote:
>
> @@ -370,6 +386,41 @@ i915_power_write(struct i915_hwmon_drvdata *ddat, u32 attr, int chan, long val)
> return ret;
> }
>
> +static umode_t
> +i915_in_is_visible(const struct i915_hwmon_drvdata *ddat, u32 attr)
> +{
> + struct drm_i915_private *i915 = ddat->dd_uncore->i915;
> +
> + switch (attr) {
> + case hwmon_in_input:
> + return (IS_DG1(i915) || IS_DG2(i915)) ? 0444 : 0;
> + default:
> + return 0;
> + }
> +
> + return 0444;
Don't return 0444 by default, let's just delete this line (return 0 by
default from the switch statement).
> +}
> +
> +static int
> +i915_in_read(struct i915_hwmon_drvdata *ddat, u32 attr, long *val)
> +{
> + struct i915_hwmon *hwmon = ddat->dd_hwmon;
> + intel_wakeref_t wakeref;
> + u32 reg_value;
> +
> + switch (attr) {
> + case hwmon_in_input:
> + with_intel_runtime_pm(ddat->dd_uncore->rpm, wakeref)
> + reg_value = intel_uncore_read(ddat->dd_uncore, hwmon->rg.gt_perf_status);
> + *val = DIV_ROUND_CLOSEST(REG_FIELD_GET(GEN12_VOLTAGE_MASK, reg_value) * 25, 10);
> + break;
> + default:
> + return -EOPNOTSUPP;
> + }
> +
> + return 0;
Don't return 0 by default, let's just delete this line (return -EOPNOTSUPP
by default from the switch statement).
More information about the Intel-gfx
mailing list