[ltp] Thinkpad keyboard backlight ACPI interface

Pali Rohár linux-thinkpad@linux-thinkpad.org
Mon, 27 Jul 2015 23:55:49 +0200


--nextPart5899721.mdFe692qY7
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hello,

I'm trying to control backlight of Thinkpad X1 Carbon via software ACPI=20
calls. With doing some tests I come up to conclusion that ACPI method=20
MLCS from LEN0068 ACPI device controls level of keyboard backlight.

With this shell snippet and acpi_call.ko kernel module I can control=20
keyboard backlight.

 level=3D2 # 0, 1 or 2
 sudo modprobe acpi_call
 path=3D`cat /sys/bus/acpi/devices/LEN0068:00/path`
 sudo sh -c "echo $path.MLCS $level > /proc/acpi/call"

Here is relevant AML code from DSDT table for it:

 Method (MLCG, 1, NotSerialized)
 {
     Store (\KBLS (0x00, 0x00), Local0)
     Return (Local0)
 }
=20
 Method (MLCS, 1, NotSerialized)
 {
     Store (\KBLS (0x01, Arg0), Local0)
     If (LNot (And (Local0, 0x80000000)))
     {
         If (And (Arg0, 0x00010000))
         {
             \_SB.PCI0.LPC.EC.HKEY.MHKQ (0x6001)
         }
         Else
         {
             If (\_SB.PCI0.LPC.EC.HKEY.MHKK (0x00020000))
             {
                 \_SB.PCI0.LPC.EC.HKEY.MHKQ (0x1012)
             }
         }
     }
=20
     Return (Local0)
 }

I would like to ask you: It is safe to call MLCS function? Do you=20
somebody have any documentation for Thinkpad machines which describe=20
this ACPI functionality? Is there any way to detect (via ACPI call) if=20
some Thinkpad model has backlight keyboard?

I would like to write kernel patch for thinkpad_acpi.c to support=20
keyboard backlight (like other modules in drivers/platform/x86/ tree),=20
but last missing information is how to detect current level of=20
brightness and check if backlight is supported...

Can you somebody help me?

=2D-=20
Pali Roh=C3=A1r
pali.rohar@gmail.com

--nextPart5899721.mdFe692qY7
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEABECAAYFAlW2qOUACgkQi/DJPQPkQ1IljACgisQSlTOru0DBT9d2Mwhu5a/N
4MEAn3y/n+CvLrwnfqEg1iOA9lnwNhJD
=qOs7
-----END PGP SIGNATURE-----

--nextPart5899721.mdFe692qY7--