On 7/23/2024 3:53 PM, Raag Jadav wrote:
On Mon, Jul 22, 2024 at 04:20:51PM +0530, Riana Tauro wrote:
Hi Raag
On 7/12/2024 5:53 PM, Raag Jadav wrote:
Add hwmon support for fan1_input attribute, which will expose fan speed
in RPM. With this in place we can monitor fan speed using lm-sensors tool.
$ sensors
i915-pci-0300
Adapter: PCI adapter
in0: 653.00 mV
fan1: 3833 RPM
power1: N/A (max = 43.00 W)
energy1: 32.02 kJ
Add fixes tag with the bug link
We still need temperature information to mark it as a fix.
@@ -771,6 +834,14 @@ hwm_get_preregistration_info(struct drm_i915_private *i915)
for_each_gt(gt, i915, i)
hwm_energy(&hwmon->ddat_gt[i], &energy);
}
+
+ if (i915_mmio_reg_valid(hwmon->rg.fan_speed)) {
+ /* Take initial readings and use it while calculating actual fan speed. */
+ with_intel_runtime_pm(uncore->rpm, wakeref)
+ ddat->fi.reg_val_prev = intel_uncore_read(ddat->uncore,
+ hwmon->rg.fan_speed);
+ ddat->fi.time_prev = jiffies_to_msecs(jiffies);
+ }
Move this under with_intel_runtime_pm condition used above.
We don't need to fiddle with runtime_pm if it is INVALID_MMIO_REG.
Doesn't this make more sense? Or am I missing something?
Wouldn't it be better to move under the condition where
energy prev value changes are. Just an ordering change so up to you.
Thanks,
Riana
Raag