| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
|
| 3 |
/* The _PTS method (Prepare To Sleep) is called before the OS is |
| 4 |
* entering a sleep state. The sleep state number is passed in Arg0 |
| 5 |
*/ |
| 6 |
|
| 7 |
Method(_PTS,1) |
| 8 |
{ |
| 9 |
GP08 = 0 // Disable Bluetooth |
| 10 |
|
| 11 |
If (Arg0 == 3) { |
| 12 |
// NVS has a flag to determine USB policy in S3 |
| 13 |
If (S3U0) { |
| 14 |
GP47 = 1 // Enable USB0 |
| 15 |
} Else { |
| 16 |
GP47 = 0 // Disable USB0 |
| 17 |
} |
| 18 |
|
| 19 |
// NVS has a flag to determine USB policy in S3 |
| 20 |
If (S3U1) { |
| 21 |
GP56 = 1 // Enable USB1 |
| 22 |
} Else { |
| 23 |
GP56 = 0 // Disable USB1 |
| 24 |
} |
| 25 |
} |
| 26 |
If (Arg0 == 5) { |
| 27 |
// NVS has a flag to determine USB policy in S5 |
| 28 |
If (S5U0) { |
| 29 |
GP47 = 1 // Enable USB0 |
| 30 |
} Else { |
| 31 |
GP47 = 0 // Disable USB0 |
| 32 |
} |
| 33 |
|
| 34 |
// NVS has a flag to determine USB policy in S5 |
| 35 |
If (S5U1) { |
| 36 |
GP56 = 1 // Enable USB1 |
| 37 |
} Else { |
| 38 |
GP56 = 0 // Disable USB1 |
| 39 |
} |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
/* The _WAK method is called on system wakeup */ |
| 44 |
|
| 45 |
Method(_WAK,1) |
| 46 |
{ |
| 47 |
Return(Package(){0,0}) |
| 48 |
} |
| 49 |
|
| 50 |
/* CMOS Access */ |
| 51 |
OperationRegion (CMOS, SystemIO, 0x70, 0x71) |
| 52 |
Field (CMOS, ByteAcc, NoLock, Preserve) |
| 53 |
{ |
| 54 |
NVRI, 8, |
| 55 |
NVRD, 8, |
| 56 |
} |
| 57 |
|
| 58 |
IndexField (NVRI, NVRD, ByteAcc, NoLock, Preserve) |
| 59 |
{ |
| 60 |
Offset (0x32), |
| 61 |
US3B, 8, // USB Controller Reset S3 behavior |
| 62 |
} |
| 63 |
|
| 64 |
#define USB_RESET_DISABLE_MAGIC 0xdd |
| 65 |
|
| 66 |
/* Disable USB Controller Reset in S3 (defaults to enabled) */ |
| 67 |
Method (USBR, 0, Serialized) |
| 68 |
{ |
| 69 |
US3B = USB_RESET_DISABLE_MAGIC |
| 70 |
} |