|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | + |
| 3 | +// Notifications: |
| 4 | +// 0x80 - hardware backlight toggle |
| 5 | +// 0x81 - backlight toggle |
| 6 | +// 0x82 - backlight down |
| 7 | +// 0x83 - backlight up |
| 8 | +// 0x84 - backlight color change |
| 9 | +// 0x85 - OLED screen toggle |
| 10 | +Device (S76D) { |
| 11 | + Name (_HID, "17761776") |
| 12 | + Name (_UID, 0) |
| 13 | + // Hide the device so that Windows does not warn about a missing driver. |
| 14 | + Name (_STA, 0xB) |
| 15 | + |
| 16 | + OperationRegion (HMIO, SystemIO, 0x295, 0x02) |
| 17 | + Field (HMIO, ByteAcc, NoLock, Preserve) { |
| 18 | + // Hardware manager index |
| 19 | + HMID, 8, |
| 20 | + // Hardware manager data |
| 21 | + HMDT, 8, |
| 22 | + } |
| 23 | + |
| 24 | + Method (INIT, 0, Serialized) { |
| 25 | + Printf ("S76D: INIT") |
| 26 | + Return (0) |
| 27 | + } |
| 28 | + |
| 29 | + Method (FINI, 0, Serialized) { |
| 30 | + Printf ("S76D: FINI") |
| 31 | + Return (0) |
| 32 | + } |
| 33 | + |
| 34 | + // Get Airplane LED |
| 35 | + Method (GAPL, 0, Serialized) { |
| 36 | + Return (0) |
| 37 | + } |
| 38 | + |
| 39 | + // Set Airplane LED |
| 40 | + Method (SAPL, 1, Serialized) {} |
| 41 | + |
| 42 | + // Get Keyboard Backlight Kind |
| 43 | + // 0 - No backlight |
| 44 | + // 1 - White backlight |
| 45 | + // 2 - RGB backlight |
| 46 | + Method (GKBK, 0, Serialized) { |
| 47 | + Return (0) |
| 48 | + } |
| 49 | + |
| 50 | + // Get Keyboard Brightness |
| 51 | + Method (GKBB, 0, Serialized) { |
| 52 | + Return (0) |
| 53 | + } |
| 54 | + |
| 55 | + // Set Keyboard Brightness |
| 56 | + Method (SKBB, 1, Serialized) {} |
| 57 | + |
| 58 | + // Get Keyboard Color |
| 59 | + Method (GKBC, 0, Serialized) { |
| 60 | + Return (0) |
| 61 | + } |
| 62 | + |
| 63 | + // Set Keyboard Color |
| 64 | + Method (SKBC, 1, Serialized) {} |
| 65 | + |
| 66 | + // Fan names |
| 67 | + Method (NFAN, 0, Serialized) { |
| 68 | + Return (Package() { |
| 69 | + "CPU fan" |
| 70 | + }) |
| 71 | + } |
| 72 | + |
| 73 | + // Get fan duty cycle and RPM as a single value |
| 74 | + Method (GFAN, 1, Serialized) { |
| 75 | + // Set bank 0 |
| 76 | + HMID = 0x4E |
| 77 | + HMDT = 0x80 |
| 78 | + |
| 79 | + // Read fan duty cycle |
| 80 | + HMID = 0x4B |
| 81 | + Local0 = HMDT |
| 82 | + |
| 83 | + // Read fan RPM (low) |
| 84 | + HMID = 0x33 |
| 85 | + Local1 = HMDT |
| 86 | + |
| 87 | + // Read fan RPM (high) |
| 88 | + HMID = 0x32 |
| 89 | + Local2 = HMDT |
| 90 | + |
| 91 | + Return ((Local2 << 16) | (Local1 << 8) | Local0) |
| 92 | + } |
| 93 | + |
| 94 | + // Temperature names |
| 95 | + Method (NTMP, 0, Serialized) { |
| 96 | + Return (Package() { |
| 97 | + "CPU temp" |
| 98 | + }) |
| 99 | + } |
| 100 | + |
| 101 | + // Get temperature |
| 102 | + Method (GTMP, 1, Serialized) { |
| 103 | + // Set bank 0 |
| 104 | + HMID = 0x4E |
| 105 | + HMDT = 0x80 |
| 106 | + |
| 107 | + // Read temperature |
| 108 | + HMID = 0x19 |
| 109 | + Local0 = HMDT |
| 110 | + |
| 111 | + Return (Local0) |
| 112 | + } |
| 113 | +} |
0 commit comments