Re: [PATCH v2 1/2] i8k: Autodetect maximal fan speed and fan RPM multiplier

Pali Rohár
2014-12-21T09:15:35Z

[-- Attachment #1: Type: Text/Plain, Size: 1279 bytes --]

On Saturday 20 December 2014 20:02:31 Guenter Roeck wrote:
> > + for (fan = 0; fan < ARRAY_SIZE(i8k_fan_mult); ++fan) {
> > + i8k_fan_mult[fan] = I8K_FAN_DEFAULT_MULT;
> > + if (i8k_get_fan_speed(fan) > I8K_FAN_MAX_RPM) {
> > + i8k_fan_mult[fan] = 1;
> > + continue;
> > + }
>
> Another note: On one of my systems, reading the current fan
> speed literally halts the entire system for a second or two.
> Given this, is the above really necessary ? It might be
> better to just try to use the nominal fan speeds and only
> read the actual fan speed if that doesn't work.
>

Ok. I added fallback to i8k_get_fan_speed() only if function
i8k_get_fan_nominal_speed() failed.

> > + for (val = 0; val < 256; ++val) {
> > + ret = i8k_get_fan_nominal_speed(fan, val);
> > + if (ret > I8K_FAN_MAX_RPM) {
> > + i8k_fan_mult[fan] = 1;
> > + break;
> > + } else if (ret < 0) {
> > + break;
> > + }
> > + }
>
> I wonder if it would help to detect the maximum fan speed
> first. Once that is known, it should be possible to just read
> the nominal fan speed once, for the known maximum speed. With
> this, the 'val' loop here would be unnecessary.
>

Right, good point.

--
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]