[ltp] Thinkpad keyboard backlight ACPI interface

Pali Rohár linux-thinkpad@linux-thinkpad.org
Tue, 28 Jul 2015 14:05:03 +0200


On Tuesday 28 July 2015 13:56:32 Bjørn Mork wrote:
> Pali Rohár <pali.rohar@gmail.com> writes:
> 
> > On Tuesday 28 July 2015 13:17:58 Bjørn Mork wrote:
> >> Pali Rohár <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 level of 
> >> > brightness and check if backlight is supported...
> >> 
> >> Based on the code you posted, I would assume that MLCG returns the
> >> current brightness level.  Did you test that?
> >> 
> >
> > Of course and it returns:
> >
> > 0x50200 - off
> > 0x50201 - level 1
> > 0x50202 - level 2
> >
> > But I do not understand why it returns 0x5020{0,1,2} and not only 0,1,2.
> 
> Looks like it might have several bitfields with different meanings.
> You'll probably have to guess what they are.
> 

Yes... Last number looks like current level. But what others? Maybe it
represent if backlight feature is supported? Do not know.

But it would be good, if more people with Thinkpad machines with and
also without keyboard backligth send output from "MLCG" ACPI call.

>From output from one machine I'm not able to decode what it means.

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....

> > MLCS returns 0x0.
> >
> >> The thinkpad_acpi driver use code like this to test for supported
> >> features:
> >> 
> >>       tp_features.bluetooth = hkey_handle && acpi_evalf(hkey_handle, &status, "GBDC", "qd");
> >> 
> >> You could do something similar for the keyboard backlight feature,
> >> couldn't you?
> >> 
> >
> > Sounds good, but I do not know what "GBDC" and "qd" means... :-(
> > So because of that I need some "documentation" which say how to do it.
> 
> 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.
> 

Yes and for that I need output from as many Thinkpad machines, so I can
do some "statistic" output.

-- 
Pali Rohár
pali.rohar@gmail.com