Duncan Laurie | 4a2558b | 2019-02-01 11:44:14 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2019 Google LLC |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; version 2 of |
| 9 | * the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | */ |
| 16 | |
| 17 | /* |
| 18 | * Intel Virtual Button driver compatible with the driver found in |
| 19 | * the Linux kernel at drivers/platform/x86/intel-vbtn.c |
| 20 | * |
| 21 | * For tablet/laptop and dock/undock events to work the board must |
| 22 | * select SYSTEM_TYPE_CONVERTIBLE for the SMBIOS enclosure type to |
| 23 | * indicate the device is a convertible. |
| 24 | */ |
| 25 | |
| 26 | Name (FLAP, 0x40) /* Flag indicating device is in laptop mode */ |
| 27 | |
| 28 | /* Virtual events */ |
| 29 | Name (VPPB, 0xc0) /* Power Button press */ |
| 30 | Name (VRPB, 0xc1) /* Power Button release */ |
| 31 | Name (VPSP, 0xc2) /* Special key press (LEFTMETA in Linux) */ |
| 32 | Name (VRSP, 0xc3) /* Special key release (LEFTMETA in Linux) */ |
| 33 | Name (VPVU, 0xc4) /* Volume Up press */ |
| 34 | Name (VRVU, 0xc5) /* Volume Up release */ |
| 35 | Name (VPVD, 0xc6) /* Volume Down press */ |
| 36 | Name (VRVD, 0xc7) /* Volume Down release */ |
| 37 | Name (VPRL, 0xc8) /* Rotate Lock press */ |
| 38 | Name (VRRL, 0xc9) /* Rotate Lock release */ |
| 39 | Name (VDOC, 0xca) /* Docked */ |
| 40 | Name (VUND, 0xcb) /* Undocked */ |
| 41 | Name (VTBL, 0xcc) /* Tablet Mode */ |
| 42 | Name (VLAP, 0xcd) /* Laptop Mode */ |
| 43 | |
| 44 | Device (VBTN) |
| 45 | { |
| 46 | Name (_HID, "INT33D6") |
| 47 | Name (_UID, One) |
| 48 | Name (_DDN, "Intel Virtual Button Driver") |
| 49 | |
| 50 | /* |
| 51 | * This method is called at driver probe time and must exist or |
| 52 | * the driver will not load. |
| 53 | */ |
| 54 | Method (VBDL) |
| 55 | { |
| 56 | } |
| 57 | |
| 58 | /* |
| 59 | * This method returns flags indicating tablet and dock modes. |
| 60 | * It is called at driver probe time so the OS knows what the |
| 61 | * state of the device is at boot. |
| 62 | */ |
| 63 | Method (VGBS) |
| 64 | { |
| 65 | Local0 = Zero |
| 66 | |
| 67 | /* Check EC orientation for tablet mode flag */ |
| 68 | If (R (OTBL)) { |
| 69 | Printf ("EC reports tablet mode at boot") |
| 70 | } Else { |
| 71 | Printf ("EC reports laptop mode at boot") |
| 72 | Local0 |= ^^FLAP |
| 73 | } |
| 74 | Return (Local0) |
| 75 | } |
| 76 | |
| 77 | Method(_STA, 0) |
| 78 | { |
| 79 | Return (0xF) |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | Device (VBTO) |
| 84 | { |
| 85 | Name (_HID, "INT33D3") |
| 86 | Name (_CID, "PNP0C60") |
| 87 | Name (_UID, One) |
| 88 | Name (_DDN, "Laptop/tablet mode indicator driver") |
| 89 | |
| 90 | Method (_STA, 0) |
| 91 | { |
| 92 | Return (0xF) |
| 93 | } |
| 94 | } |