Elyes HAOUAS | 7cf47cf | 2020-07-18 10:51:06 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Matthew Garrett | 2f62a35 | 2018-07-24 14:06:39 -0700 | [diff] [blame] | 2 | |
| 3 | Device (EC) |
| 4 | { |
| 5 | Name (_HID, EisaId ("PNP0C09")) |
| 6 | Name (_UID, 0) |
| 7 | |
| 8 | Name (_GPE, 0x4F) // _GPE: General Purpose Events |
| 9 | Name (_CRS, ResourceTemplate () { |
| 10 | IO (Decode16, 0x62, 0x62, 1, 1) |
| 11 | IO (Decode16, 0x66, 0x66, 1, 1) |
| 12 | }) |
| 13 | |
Felix Singer | fa06bcb | 2022-12-26 09:32:47 +0100 | [diff] [blame^] | 14 | OperationRegion (ERAM, EmbeddedControl, 0, 0xFF) |
Matthew Garrett | 2f62a35 | 2018-07-24 14:06:39 -0700 | [diff] [blame] | 15 | Field (ERAM, ByteAcc, Lock, Preserve) |
| 16 | { |
| 17 | Offset (0x50), |
| 18 | CTMP, 8, |
| 19 | CFAN, 8, |
| 20 | B1SS, 1, |
| 21 | BSTS, 2, |
| 22 | ACIN, 1, |
| 23 | Offset (0x53), |
| 24 | BKLG, 8, |
| 25 | TOUP, 1, |
| 26 | WIRE, 1, |
| 27 | BLTH, 1, |
| 28 | LIDC, 1, |
| 29 | APFG, 1, |
| 30 | WRST, 1, |
| 31 | BTST, 1, |
| 32 | ACEB, 1, |
| 33 | CAME, 1, |
| 34 | Offset (0x60), |
| 35 | DGCP, 16, |
| 36 | FLCP, 16, |
| 37 | DGVO, 16, |
| 38 | BDW, 16, |
| 39 | BDL, 16, |
| 40 | BPR, 16, |
| 41 | BRC, 16, |
| 42 | BPV, 16 |
| 43 | } |
| 44 | |
| 45 | Method (_REG, 2, NotSerialized) |
| 46 | { |
| 47 | /* Initialize AC power state */ |
Felix Singer | b26e255 | 2022-12-12 03:32:49 +0100 | [diff] [blame] | 48 | \PWRS = ACIN |
Matthew Garrett | 2f62a35 | 2018-07-24 14:06:39 -0700 | [diff] [blame] | 49 | |
| 50 | /* Initialize LID switch state */ |
Felix Singer | b26e255 | 2022-12-12 03:32:49 +0100 | [diff] [blame] | 51 | \LIDS = LIDC |
Matthew Garrett | 2f62a35 | 2018-07-24 14:06:39 -0700 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | /* KEY_BRIGHTNESSUP */ |
| 55 | Method (_Q04) |
| 56 | { |
| 57 | Notify(\_SB.PCI0.GFX0.LCD, 0x86) |
| 58 | } |
| 59 | |
| 60 | /* KEY_BRIGHTNESSDOWN */ |
| 61 | Method (_Q05) |
| 62 | { |
| 63 | Notify(\_SB.PCI0.GFX0.LCD, 0x87) |
| 64 | } |
| 65 | |
| 66 | /* Battery Information Event */ |
| 67 | Method (_Q0C) |
| 68 | { |
| 69 | Notify (BAT, 0x81) |
| 70 | } |
| 71 | |
| 72 | /* AC event */ |
| 73 | Method (_Q0D) |
| 74 | { |
Felix Singer | b26e255 | 2022-12-12 03:32:49 +0100 | [diff] [blame] | 75 | \PWRS = ACIN |
Matthew Garrett | 2f62a35 | 2018-07-24 14:06:39 -0700 | [diff] [blame] | 76 | Notify (AC, 0x80) |
| 77 | } |
| 78 | |
| 79 | /* Lid event */ |
| 80 | Method (_Q0E) |
| 81 | { |
Felix Singer | b26e255 | 2022-12-12 03:32:49 +0100 | [diff] [blame] | 82 | \LIDS = LIDC |
Matthew Garrett | 2f62a35 | 2018-07-24 14:06:39 -0700 | [diff] [blame] | 83 | Notify (LID0, 0x80) |
| 84 | } |
| 85 | |
| 86 | /* Battery Information Event */ |
| 87 | Method (_Q13) |
| 88 | { |
| 89 | Notify (BAT, 0x81) |
| 90 | } |
| 91 | |
| 92 | /* Battery Status Event */ |
| 93 | Method (_Q14) |
| 94 | { |
| 95 | Notify (BAT, 0x80) |
| 96 | } |
| 97 | |
| 98 | Device (AC) |
| 99 | { |
| 100 | Name (_HID, "ACPI0003") |
| 101 | Name (_PCL, Package () { \_SB }) |
| 102 | |
| 103 | Method (_STA) |
| 104 | { |
| 105 | Return (0x0F) |
| 106 | } |
| 107 | Method (_PSR) |
| 108 | { |
| 109 | Return (\PWRS) |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | #include "battery.asl" |
| 114 | } |