[ltp] Re: [T410s] Fan running constantly

Daniel Näslund linux-thinkpad@linux-thinkpad.org
Thu, 19 May 2011 22:40:44 +0200


Hi Henrique,

Thanks for your answer. Find inline some questions.

On Wed, May 18, 2011 at 09:17:48PM -0300, Henrique de Moraes Holschuh wrote:
> On Wed, 18 May 2011, Daniel Näslund wrote:
> > 2) There's a bug in the thinkpad-acpi kernel module causing the
> > erroneus behaviour.
> 
> Thinkpad-acpi doesn't write to the fan controller until you tell it to for
> the first time. 

Ok... I think I had one fundamental misconception. I thought that the
thinkpad-acpi driver was capable of reading the values of some sensors
and give direct feedback to the fan. It appears as if what it is doing
is writing to some EC registers to set trippoints. It can also take over
the control of the fan and manually start, stop it as well as report
current settings. Is that a correct description of the purpose
of the thinkpad_acpi's fan subdriver?

>From the long comment in drivers/platform/x86/thinkpad_acpi.c:7142:

 * 	Bits
 *	 7	automatic mode engaged;
 *  		(default operation mode of the ThinkPad)
 * 		fan level is ignored in this mode.
 *	 6	full speed mode (takes precedence over bit 7);
 *		not available on all thinkpads.  May disable
 *		the tachometer while the fan controller ramps up
 *		the speed (which can take up to a few *minutes*).
 *		Speeds up fan to 100% duty-cycle, which is far above
 *		the standard RPM levels.  It is not impossible that
 *		it could cause hardware damage.
 *	5-3	unused in some models.  Extra bits for fan level
 *		in others, but still useless as all values above
 *		7 map to the same speed as level 7 in these models.
 *	2-0	fan level (0..7 usually)
 *			0x00 = stop
 * 			0x07 = max (set when temperatures critical)
 * 		Some ThinkPads may have other levels, see
 * 		TPACPI_FAN_WR_ACPI_FANS (X31/X40/X41)

> It has specific logic to track that, even across suspend/hibernation:
> if userspace never ordered the driver to mess with the fan since the
> module was loaded, it will NOT write to the fan control registers for
> any reason.  The ACPI DSDT still might, and so could the ACPI fan
> driver (if Lenovo implemented any hooks for that).

What does the acpi fan driver do? When reading the source code in
drivers/acpi/fan.c it appears as if it only handles functionality for
putting the driver to sleep and waking it up after a suspend/hibernate.
But there's fan_suspend() and fan_resume() in thinkpad_acpi.c

> Set the fan_control=0 parameter, and thinkpad-acpi will refuse to ever
> write to the fan control registers, no matter what (and THAT is the kernel
> default, BTW...  but some annoying distros out there insist in messing
> with this and load it with fan_control=1 by default).

Ok, found that part in drivers/platform/x86/thinkpad_acpi.c::fan_init()

	/* fan control master switch */
	if (!fan_control_allowed) {
		fan_control_access_mode = TPACPI_FAN_WR_NONE;
		fan_control_commands = 0;
		dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_FAN,
			   "fan control features disabled by parameter\n");

> > understanding of how the BIOS and acpi systems interact. AFAICT the
> > fan is either controlled by the acpi system or it's not and then it's
> > controlled directly by firmware in the BIOS. If that's a correct
> 
> It is controlled by the EC, and disturbed by the BIOS, by ACPI, or by
> thinkpad-acpi.  But thinkpad-acpi won't disturb it if you don't tell it to
> (or don't load thinkpad-acpi).  The kernel will not disturb it if you
> remove the ACPI "fan" module.  

  $ lsmod | grep fan
  <nothing>

Can you come up with a reason why the fan module is not loaded? On your
description, it sounded like it would always be present. Not suspecting
that it has anything to do with my current problems; just curious.

> The ACPI DSDT (and BIOS) might change fan parameters due to thermal
> alarms, battery operation / AC operation / battery-charge operation.

> It is easy to test.  Blacklist both modules, reboot, and check whether
> behaviour changes.  If it does, we have something we can work on.

Will test that tomorrow when I have access to my thinkpad again (it's my
work laptop).

> > thread, I tested to supply the boot argument "acpi=off" but the fan
> 
> It is a really bad idea to run a modern thinkpad with acpi=off.  YOU HAVE
> BEEN WARNED.

Hepp! Thanks for the warning.

To sum up, it appears to me as if thinkpad_acpi does not alter the
behaviour of the fan when fan_control=0. If the fan runs too fast then
it's either because the EC firmware is defect or some issue with the
hardware or just a physical limitation on the efficiency of the colling
system.

Daniel