| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
|
| 3 |
Scope (\_SB) |
| 4 |
{ |
| 5 |
/* |
| 6 |
* Chrome EC Keyboard Backlight interface |
| 7 |
*/ |
| 8 |
Device (KBLT) |
| 9 |
{ |
| 10 |
Name (_HID, "GOOG0002") |
| 11 |
Name (_UID, 1) |
| 12 |
|
| 13 |
/* Ask EC if we even have a backlight |
| 14 |
* Return 0xf (present, enabled, show in UI, functioning) or 0 |
| 15 |
* |
| 16 |
* With older EC codebases that don't support the Device |
| 17 |
* Features bitfield, this reports the keyboard backlight as |
| 18 |
* enabled since reads to undefined addresses in EC address |
| 19 |
* space return 0xff and so KBLE will be 1. |
| 20 |
*/ |
| 21 |
Method (_STA, 0, NotSerialized) |
| 22 |
{ |
| 23 |
/* If query is unsupported, but this code is compiled |
| 24 |
* in, assume the backlight exists physically. |
| 25 |
*/ |
| 26 |
If (\_SB.PCI0.LPCB.EC0.DFUD == 1) { |
| 27 |
Return (0xf) |
| 28 |
} |
| 29 |
/* If EC reports that backlight exists, trust it */ |
| 30 |
If (\_SB.PCI0.LPCB.EC0.KBLE == 1) { |
| 31 |
Return (0xf) |
| 32 |
} |
| 33 |
/* Otherwise: no device -> disable */ |
| 34 |
Return (0) |
| 35 |
} |
| 36 |
|
| 37 |
/* Read current backlight value */ |
| 38 |
Method (KBQC, 0, NotSerialized) |
| 39 |
{ |
| 40 |
Return (\_SB.PCI0.LPCB.EC0.KBLV) |
| 41 |
} |
| 42 |
|
| 43 |
/* Write new backlight value */ |
| 44 |
Method (KBCM, 1, NotSerialized) |
| 45 |
{ |
| 46 |
\_SB.PCI0.LPCB.EC0.KBLV = Arg0 |
| 47 |
} |
| 48 |
} |
| 49 |
} |