[ltp] Re: Thinkpad keyboard backlight ACPI interface

Fabio D'Urso linux-thinkpad@linux-thinkpad.org
Sun, 9 Aug 2015 23:20:26 +0200


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 supp=
ort
> > >> > keyboard backlight (like other modules in drivers/platform/x86=
/
> > >> > tree),
> > >> > but last missing information is how to detect current level of=

> > >> > brightness and check if backlight is supported...
> > >>=20
> > >> Based on the code you posted, I would assume that MLCG returns t=
he
> > >> 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? Maybe i=
t
> 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.

I can confirm that everything is as you described also on my W541 (with=
=20
backlight), except for the line
 OperationRegion (MNVS, SystemMemory, 0xCCD7D018, 0x1000)
which is actually
 OperationRegion (MNVS, SystemMemory, 0x7CE7D018, 0x1000)

The rest of the DSDT code is like yours, MLCG always returns 0x5020{0,1=
,2} and=20
MLCS {0,1,2} works as expected and returns 0x0.

I have also toggled the Fn lock and Ctrl/Fn swapping, but the mysteriou=
s=20
0x5020n did not change. I have the latest BIOS version (2.21).

Fabio D'Urso

> >From output from one machine I'm not able to decode what it means.
>=20
> If you look at posted ACPI DSDT code, you will see that MLCG is just
> wrapper around SMI call which return that value. It is not generated =
or
> constructed by ACPI....
>=20
> > > MLCS returns 0x0.
> > >=20
> > >> The thinkpad_acpi driver use code like this to test for supporte=
d
> > >>=20
> > >> features:
> > >>       tp_features.bluetooth =3D hkey_handle && acpi_evalf(hkey_h=
andle,
> > >>       &status, "GBDC", "qd");> >>=20
> > >> You could do something similar for the keyboard backlight featur=
e,
> > >> couldn't you?
> > >=20
> > > Sounds good, but I do not know what "GBDC" and "qd" means... :-(
> > > So because of that I need some "documentation" which say how to d=
o it.
> >=20
> > The "qd" part is documented in the driver source - it's specific to=
 the
> > acpi_evalf() helper.  For the "GBDC" I don't think there is any
> > documentation.  People have done what you have: Looked at the DSDT,=

> > added some intelligent guesswork, and then tested the result.
>=20
> Yes and for that I need output from as many Thinkpad machines, so I c=
an
> do some "statistic" output.