| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
|
| 3 |
/* WARNING |
| 4 |
* Switchable graphics not yet tested! |
| 5 |
*/ |
| 6 |
|
| 7 |
/* Hybrid graphics enable/disable GPIO bitfields */ |
| 8 |
Name (HYG1, 0x004A0000) |
| 9 |
Name (HYG2, 0x00020000) |
| 10 |
|
| 11 |
/* GPIO control port */ |
| 12 |
Name (GPCP, DEFAULT_GPIOBASE) |
| 13 |
|
| 14 |
/* GPIO control map */ |
| 15 |
OperationRegion (GPCM, SystemIO, GPCP, 0x3F) |
| 16 |
Field (GPCM, ByteAcc, NoLock, Preserve) { |
| 17 |
GPUS, 32, |
| 18 |
GPIS, 32, |
| 19 |
Offset (0x0C), |
| 20 |
GPLV, 32, |
| 21 |
Offset (0x30), |
| 22 |
GQUS, 32, |
| 23 |
GQIS, 32, |
| 24 |
GQLV, 32 |
| 25 |
} |
| 26 |
|
| 27 |
Method(SHYB, 1) { |
| 28 |
/* Switch hybrid graphics */ |
| 29 |
if (Arg0 == 1) |
| 30 |
{ |
| 31 |
/* Discrete graphics requested */ |
| 32 |
GPLV |= HYG1 |
| 33 |
GQLV |= HYG2 |
| 34 |
} |
| 35 |
else |
| 36 |
{ |
| 37 |
/* Integrated graphics requested */ |
| 38 |
Local0 = HYG1 ^ 0xFFFFFFFF |
| 39 |
GPLV &= Local0 |
| 40 |
Local0 = HYG2 ^ 0xFFFFFFFF |
| 41 |
GQLV &= Local0 |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
Method (ATPX, 2, Serialized) { |
| 46 |
/* Create local variables */ |
| 47 |
Name (ATPR, Buffer (0x08) { |
| 48 |
0x0, 0x0, 0x0, 0x0, |
| 49 |
0x0, 0x0, 0x0, 0x0 |
| 50 |
}) |
| 51 |
CreateWordField (ATPR, 0x00, SIZE) |
| 52 |
CreateWordField (ATPR, 0x02, VERS) |
| 53 |
CreateDWordField (ATPR, 0x04, FUNC) |
| 54 |
|
| 55 |
/* Version request */ |
| 56 |
if (Arg0 == 0x0) |
| 57 |
{ |
| 58 |
/* Assemble and return version information */ |
| 59 |
SIZE = 0x08 /* Response length */ |
| 60 |
VERS = 0x01 /* Version number */ |
| 61 |
FUNC = 0x0F /* Supported functions? */ |
| 62 |
Return (ATPR) |
| 63 |
} |
| 64 |
|
| 65 |
/* Mux select */ |
| 66 |
if (Arg0 == 0x2) |
| 67 |
{ |
| 68 |
CreateByteField (Arg1, 0x02, PWST) |
| 69 |
Local0 = PWST |
| 70 |
Local0 &= 0x01 |
| 71 |
If (Local0) |
| 72 |
{ |
| 73 |
/* Enable discrete graphics */ |
| 74 |
SHYB(0x01) |
| 75 |
} |
| 76 |
else |
| 77 |
{ |
| 78 |
/* Enable integrated graphics */ |
| 79 |
SHYB(0x00) |
| 80 |
} |
| 81 |
} |
| 82 |
Return(0) |
| 83 |
} |