blob: 1edce819d106aaeb438fb0120354b3336a4ce0c9 [file] [log] [blame]
Duncan Laurieef549a02015-09-01 09:47:55 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2015 Google Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Duncan Laurieef549a02015-09-01 09:47:55 -070014 */
15
16Scope (\_SB)
17{
18 /*
19 * Chrome EC Keyboard Backlight interface
20 */
21 Device (KBLT)
22 {
23 Name (_HID, "GOOG0002")
24 Name (_UID, 1)
25
Patrick Georgi4bd68b82017-08-18 21:06:24 +020026 /* Ask EC if we even have a backlight
27 * Return 0xf (present, enabled, show in UI, functioning) or 0
28 *
29 * With older EC codebases that don't support the Device
30 * Features bitfield, this reports the keyboard backlight as
31 * enabled since reads to undefined addresses in EC address
32 * space return 0xff and so KBLE will be 1.
33 */
34 Method (_STA, 0, NotSerialized)
35 {
Patrick Georgif9267f92017-08-24 23:12:55 +020036 /* If query is unsupported, but this code is compiled
37 * in, assume the backlight exists physically.
38 */
39 If (LEqual (1, \_SB.PCI0.LPCB.EC0.DFUD)) {
40 Return (0xf)
41 }
42 /* If EC reports that backlight exists, trust it */
43 If (LEqual (1, \_SB.PCI0.LPCB.EC0.KBLE)) {
44 Return (0xf)
45 }
46 /* Otherwise: no device -> disable */
47 Return (0)
Patrick Georgi4bd68b82017-08-18 21:06:24 +020048 }
49
Duncan Laurieef549a02015-09-01 09:47:55 -070050 /* Read current backlight value */
51 Method (KBQC, 0, NotSerialized)
52 {
53 Return (\_SB.PCI0.LPCB.EC0.KBLV)
54 }
55
56 /* Write new backlight value */
57 Method (KBCM, 1, NotSerialized)
58 {
59 Store (Arg0, \_SB.PCI0.LPCB.EC0.KBLV)
60 }
61 }
62}