Angel Pons | 210a008 | 2020-04-02 23:48:24 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Duncan Laurie | 4a2558b | 2019-02-01 11:44:14 -0800 | [diff] [blame] | 2 | |
| 3 | /* |
| 4 | * Intel Virtual Button driver compatible with the driver found in |
| 5 | * the Linux kernel at drivers/platform/x86/intel-vbtn.c |
| 6 | * |
| 7 | * For tablet/laptop and dock/undock events to work the board must |
Kyösti Mälkki | 44a4c0a | 2020-06-07 14:11:50 +0300 | [diff] [blame] | 8 | * have SMBIOS_ENCLOSURE_CONVERTIBLE for the SMBIOS enclosure type to |
Duncan Laurie | 4a2558b | 2019-02-01 11:44:14 -0800 | [diff] [blame] | 9 | * indicate the device is a convertible. |
| 10 | */ |
| 11 | |
| 12 | Name (FLAP, 0x40) /* Flag indicating device is in laptop mode */ |
| 13 | |
| 14 | /* Virtual events */ |
| 15 | Name (VPPB, 0xc0) /* Power Button press */ |
| 16 | Name (VRPB, 0xc1) /* Power Button release */ |
| 17 | Name (VPSP, 0xc2) /* Special key press (LEFTMETA in Linux) */ |
| 18 | Name (VRSP, 0xc3) /* Special key release (LEFTMETA in Linux) */ |
| 19 | Name (VPVU, 0xc4) /* Volume Up press */ |
| 20 | Name (VRVU, 0xc5) /* Volume Up release */ |
| 21 | Name (VPVD, 0xc6) /* Volume Down press */ |
| 22 | Name (VRVD, 0xc7) /* Volume Down release */ |
| 23 | Name (VPRL, 0xc8) /* Rotate Lock press */ |
| 24 | Name (VRRL, 0xc9) /* Rotate Lock release */ |
| 25 | Name (VDOC, 0xca) /* Docked */ |
| 26 | Name (VUND, 0xcb) /* Undocked */ |
| 27 | Name (VTBL, 0xcc) /* Tablet Mode */ |
| 28 | Name (VLAP, 0xcd) /* Laptop Mode */ |
| 29 | |
| 30 | Device (VBTN) |
| 31 | { |
| 32 | Name (_HID, "INT33D6") |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 33 | Name (_UID, 1) |
Duncan Laurie | 4a2558b | 2019-02-01 11:44:14 -0800 | [diff] [blame] | 34 | Name (_DDN, "Intel Virtual Button Driver") |
| 35 | |
| 36 | /* |
| 37 | * This method is called at driver probe time and must exist or |
| 38 | * the driver will not load. |
| 39 | */ |
| 40 | Method (VBDL) |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | /* |
| 45 | * This method returns flags indicating tablet and dock modes. |
| 46 | * It is called at driver probe time so the OS knows what the |
| 47 | * state of the device is at boot. |
| 48 | */ |
| 49 | Method (VGBS) |
| 50 | { |
| 51 | Local0 = Zero |
| 52 | |
| 53 | /* Check EC orientation for tablet mode flag */ |
| 54 | If (R (OTBL)) { |
| 55 | Printf ("EC reports tablet mode at boot") |
| 56 | } Else { |
| 57 | Printf ("EC reports laptop mode at boot") |
| 58 | Local0 |= ^^FLAP |
| 59 | } |
| 60 | Return (Local0) |
| 61 | } |
| 62 | |
| 63 | Method(_STA, 0) |
| 64 | { |
| 65 | Return (0xF) |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | Device (VBTO) |
| 70 | { |
| 71 | Name (_HID, "INT33D3") |
| 72 | Name (_CID, "PNP0C60") |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 73 | Name (_UID, 1) |
Duncan Laurie | 4a2558b | 2019-02-01 11:44:14 -0800 | [diff] [blame] | 74 | Name (_DDN, "Laptop/tablet mode indicator driver") |
| 75 | |
| 76 | Method (_STA, 0) |
| 77 | { |
| 78 | Return (0xF) |
| 79 | } |
| 80 | } |