[PATCH v2] drm/i915/hwmon: expose package temperature
Andi Shyti
andi.shyti at kernel.org
Mon Sep 9 22:23:41 UTC 2024
Hi Raag,
...
> +static int
> +hwm_temp_read(struct hwm_drvdata *ddat, u32 attr, long *val)
> +{
> + struct i915_hwmon *hwmon = ddat->hwmon;
> + intel_wakeref_t wakeref;
> + u32 reg_val;
> +
> + switch (attr) {
> + case hwmon_temp_input:
> + with_intel_runtime_pm(ddat->uncore->rpm, wakeref)
> + reg_val = intel_uncore_read(ddat->uncore, hwmon->rg.pkg_temp);
> +
> + /* HW register value is in degrees, convert to millidegrees. */
> + *val = REG_FIELD_GET(TEMP_MASK, reg_val) * MILLIDEGREE_PER_DEGREE;
> + return 0;
> + default:
> + return -EOPNOTSUPP;
> + }
I don't understand this love for single case switches.
Reviewed-by: Andi Shyti <andi.shyti at linux.intel.com>
Thanks,
Andi
More information about the Intel-gfx
mailing list