[ltp] Help needed to add support for the ThinkVantage (key) LED

Henrique de Moraes Holschuh linux-thinkpad@linux-thinkpad.org
Sat, 25 Oct 2008 13:20:20 -0200


Well, I have found how to control the X300 ThinkVantage blue led in the
ThinkVantage key.

It is ACPI method HKEY.TVLS,  or LED 0x0D   (thinkpad-acpi by default
doesn't let one touch leds above 0x07, which is just as well, as the only
leds we should be messing with are 0x00, 0x07, and 0x0D).

However, it appears that the led has two extra control bits (and it is
possible the other LEDs also have gained these two extra bits).

So, I'd appreciate if someone could test the LED control and check.
This test is NOT NECESSARILY SAFE, as it requires direct writes to the EC
registers, and could do *anything*.

WARNING: The tests need direct EC access.  Do not attempt on any thinkpad
which doesn't have a thinkvantage blue LED.  These tests make sense only on
the X300, and probably X301.  I can verify on others if you send me the
acpidump+dmidecode or you can do it yourself looking for calls to LED(0x0D,
something) in the DSDT.


Documentation for the LED control register (EC register 0x0C).  This
register is not available on very old thinkpads, check ACPI "LED" method
first before using. Register is a command register, thus, write-only since
reads will at most only echo the last command issued and not the led state.

Bits
 7,6 :  00 = led off.  10 = led on.  11 = led blink
 5,4 :  UNKNOWN, new to LED 0x0D, X300 firmware (HKEY.TVLS).
 3-0 :  LED number to modify state of
        0-7: see thinkwiki
	     the safe leds to play with are:
			00: power LED
			07: standby LED
	     don't mess with the bay or dock leds, it is not
	     a good idea as it may induce you into doing something
	     that will fry your dock/bay/bay-device/thinkpad.
        8,9: X6 dock (see above about not messing with dock leds)
        a-c: unknown
        d:   ThinkVantage (TVT)
        e-f: unknown (probably unused).

Procedures:
1. Enable ec write access in thinkpad-acpi, by loading it with the
"experimental=1" parameter.

2. Test the thinkvantage led, using the following set of commands:

(AND BE CAREFUL, TYPOS COULD CAUSE PROBLEMS)

echo 0x0c 0x0d >/proc/acpi/ibm/ecdump   (should turn off thinkvantage led)
echo 0x0c 0x8d >/proc/acpi/ibm/ecdump   (should turn on thinkvantage led)
echo 0x0c 0xcd >/proc/acpi/ibm/ecdump   (should blink thinkvantage led)

And, if you are willing to RISK testing an UNKNOWN feature, which might do
anything including damage your thinkpad:

3. testing the two new LED command bits on the thinkvantage led:

please run this command with different values for ZZ (using the ones above
to turn the led on or off, if needed):

echo 0x0c ZZ >/proc/acpi/ibm/ecdump

Where ZZ is:
0xFD, 0xBD, 0x3D, 0xED, 0xAD, 0x2D, 0xDD, 0x9D, 0x1D

The idea is to find out what the two new bits do, but they are probably
linked to the two already known command bits.

4. If you are really brave, test if the other LEDs didn't get extended as
well:

if you found some useful result from the ZZ testing above, please repeat it
with the last digit being 7 instead of D, i.e.:
0xF7, 0xB7, 0x37, 0xE7, 0xA7, 0x27, 0xD7, 0x97, 0x17

and check if the standby (moon) LED behaves exactly like the thinkvantage
LED or not.

5. If you are not afraid of burning out anything, try LEDs 0x0a, 0x0b and
0x0c, using ZZ=8a, 0a, 8b, 0b, 8c, 0c.  And tell us what LEDs they are.  One
of them might be the AC connected LED.

Thank you.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh