[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZsSWTtew8nCYWrxF@black.fi.intel.com>
Date: Tue, 20 Aug 2024 16:12:46 +0300
From: Raag Jadav <raag.jadav@...el.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: jani.nikula@...ux.intel.com, joonas.lahtinen@...ux.intel.com,
rodrigo.vivi@...el.com, tursulin@...ulin.net, airlied@...il.com,
daniel@...ll.ch, linux@...ck-us.net, andi.shyti@...ux.intel.com,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org,
anshuman.gupta@...el.com, badal.nilawar@...el.com,
riana.tauro@...el.com, ashutosh.dixit@...el.com,
karthik.poosa@...el.com
Subject: Re: [PATCH v6] drm/i915/hwmon: expose fan speed
On Tue, Aug 20, 2024 at 01:23:35PM +0300, Andy Shevchenko wrote:
> On Tue, Aug 20, 2024 at 11:50:10AM +0530, 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
>
> > v2: Handle overflow, add mutex protection and ABI documentation
> > Aesthetic adjustments (Riana)
> > v3: Change rotations data type, ABI date and version
> > v4: Fix wakeref leak
> > Drop switch case and simplify hwm_fan_xx() (Andi)
> > v5: Rework time calculation, aesthetic adjustments (Andy)
> > v6: Drop overflow logic (Andy)
> > Aesthetic adjustments (Badal)
>
> But it still has an issue with 64-bit division on 32-bit platforms, right?
>
> ...
>
> > + /*
> > + * Calculate fan speed in RPM by time averaging two subsequent
> > + * readings in minutes.
> > + * RPM = number of rotations * msecs per minute / time in msecs
> > + */
> > + *val = DIV_ROUND_UP(rotations * (MSEC_PER_SEC * 60), time);
>
> ...somewhere here?
Use div64_u64() instead? Or is there a better alternative?
Raag
Powered by blists - more mailing lists