[ltp] Re: Thinkpad keyboard backlight ACPI interface

Fabio D'Urso linux-thinkpad@linux-thinkpad.org
Thu, 13 Aug 2015 23:25:51 +0200


On Sunday, August 09, 2015 11:26:04 PM Pali Roh=E1r wrote:
> On Sunday 09 August 2015 23:20:26 Fabio D'Urso wrote:
> > On Tuesday, July 28, 2015 02:05:03 PM Pali Roh=E1r wrote:
> > > On Tuesday 28 July 2015 13:56:32 Bj=F8rn Mork wrote:
> > > > Pali Roh=E1r <pali.rohar@gmail.com> writes:
> > > > > On Tuesday 28 July 2015 13:17:58 Bj=F8rn Mork wrote:
> > > > >> Pali Roh=E1r <pali.rohar@gmail.com> writes:
> > > > >> > I would like to write kernel patch for thinkpad_acpi.c to
> > > > >> > support keyboard backlight (like other modules in
> > > > >> > drivers/platform/x86/ tree),
> > > > >> > but last missing information is how to detect current leve=
l
> > > > >> > of brightness and check if backlight is supported...
> > > > >>=20
> > > > >> Based on the code you posted, I would assume that MLCG retur=
ns
> > > > >> the current brightness level.  Did you test that?
> > > > >=20
> > > > > Of course and it returns:
> > > > >=20
> > > > > 0x50200 - off
> > > > > 0x50201 - level 1
> > > > > 0x50202 - level 2
> > > > >=20
> > > > > But I do not understand why it returns 0x5020{0,1,2} and not
> > > > > only 0,1,2.
> > > >=20
> > > > Looks like it might have several bitfields with different
> > > > meanings. You'll probably have to guess what they are.
> > >=20
> > > Yes... Last number looks like current level. But what others? May=
be
> > > it represent if backlight feature is supported? Do not know.
> > >=20
> > > But it would be good, if more people with Thinkpad machines with
> > > and also without keyboard backligth send output from "MLCG" ACPI
> > > call.
> >=20
> > I can confirm that everything is as you described also on my W541
> > (with backlight), except for the line
> >=20
> >  OperationRegion (MNVS, SystemMemory, 0xCCD7D018, 0x1000)
> >=20
> > which is actually
> >=20
> >  OperationRegion (MNVS, SystemMemory, 0x7CE7D018, 0x1000)
> >=20
> > The rest of the DSDT code is like yours, MLCG always returns
> > 0x5020{0,1,2} and MLCS {0,1,2} works as expected and returns 0x0.
> >=20
> > I have also toggled the Fn lock and Ctrl/Fn swapping, but the
> > mysterious 0x5020n did not change. I have the latest BIOS version
> > (2.21).
> >=20
> > Fabio D'Urso
>=20
> Thanks for confirmation. Now I need dumps also from machines without
> backlight keyboard, but with MLCG method.

Hi, I have news from the I-have-the-backlight side:

If you set the 0x20000 bit in /proc/acpi/ibm/hotkey, you'll get a 0x101=
2=20
hotkey notification when the backlight brightness changes.

xev shows such events as XF86KbdLightOnOff key.

This notification happens when you press Fn+SPACE, but also when you ca=
ll=20
MLCS. Even with this bit set, the hardware still takes care of cycling =
the=20
brightness levels on its own.

By the way, in my previous message I forgot to point out that MLCG actu=
ally=20
takes a numeric argument, but then ignores it. This can be seen from th=
e DSDT=20
dump you posted, so I'm sure you already noticed. But maybe this inform=
ation=20
can be useful to those who want to report data from their ThinkPads.

Fabio D'Urso