ACPI: ibm-acpi: workaround for EC 0x2f initialization bug
commitb4f4a7b2c643b1823756da32e4c1fba98a2d0b54
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Fri, 24 Nov 2006 13:47:14 +0000 (24 11:47 -0200)
committerHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Sat, 3 Mar 2007 22:55:11 +0000 (3 19:55 -0300)
tree97fa2a708f5e32cf7d32a085d065a636d3846fd1
parent92b92882087acf82963494fb9fda95171b1ba332
ACPI: ibm-acpi: workaround for EC 0x2f initialization bug

A few ThinkPads fail to initialize EC register 0x2f both in the EC
firmware and ACPI DSDT.  If the BIOS and the ACPI DSDT also do not
initialize it, then the initial status of that register does not
correspond to reality.

On all reported buggy machines, EC 0x2f will read 0x07 (fan level 7) upon
cold boot, when the EC is actually in mode 0x80 (auto mode).  Since
returning a text string ("unknown") would break a number of userspace
programs, instead we correct the reading for the most probably correct
answer, and return it is in auto mode.

The workaround flags the status and level as unknown on module load/kernel
boot, until we are certain at least one fan control command was issued,
either by us, or by something else.

We don't work around the bug by doing a "fan enable" at module
load/startup (which would initialize the EC register) because it is not
known if these ThinkPad ACPI DSDT might have set the fan to level 7
instead of "auto" (we don't know if they can do this or not) due to a
thermal condition, and we don't want to override that, should they be
capable of it.

We should be setting the workaround flag to "status known" upon resume, as
both reports and a exaustive search on the DSDT tables at acpi.sf.net show
that the DSDTs always enable the fan on resume, thus working around the
bug.  But since we don't have suspend/resume handlers in ibm-acpi yet and
the "EC register 0x2f was modified" logic is likely to catch the change
anyway, we don't.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
drivers/acpi/ibm_acpi.c