blob: f3ff7f97ff302e62abed3220b7f4a138eadb483a [file] [log] [blame]
Angel Pons89ab2502020-04-03 01:22:28 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Timothy Pearson36aed742015-04-05 23:22:18 -05002
3/* WARNING
4 * Switchable graphics not yet tested!
5 */
6
7/* Hybrid graphics enable/disable GPIO bitfields */
8Name (HYG1, 0x004A0000)
9Name (HYG2, 0x00020000)
10
11/* GPIO control port */
12Name (GPCP, DEFAULT_GPIOBASE)
13
14/* GPIO control map */
15OperationRegion (GPCM, SystemIO, GPCP, 0x3F)
16Field (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
27Method(SHYB, 1) {
28 /* Switch hybrid graphics */
Felix Singerdfbb6342022-12-26 08:39:35 +010029 if (Arg0 == 1)
Timothy Pearson36aed742015-04-05 23:22:18 -050030 {
31 /* Discrete graphics requested */
Elyes HAOUAS433bc3e2020-10-08 09:52:56 +020032 GPLV |= HYG1
33 GQLV |= HYG2
Timothy Pearson36aed742015-04-05 23:22:18 -050034 }
35 else
36 {
37 /* Integrated graphics requested */
Elyes HAOUAS433bc3e2020-10-08 09:52:56 +020038 Local0 = HYG1 ^ 0xFFFFFFFF
39 GPLV &= Local0
40 Local0 = HYG2 ^ 0xFFFFFFFF
41 GQLV &= Local0
Timothy Pearson36aed742015-04-05 23:22:18 -050042 }
43}
44
Martin Roth601ea3d2015-11-23 12:37:22 -070045Method (ATPX, 2, Serialized) {
Timothy Pearson36aed742015-04-05 23:22:18 -050046 /* 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)
Timothy Pearson36aed742015-04-05 23:22:18 -050053 CreateDWordField (ATPR, 0x04, FUNC)
Timothy Pearson36aed742015-04-05 23:22:18 -050054
55 /* Version request */
Elyes HAOUAS433bc3e2020-10-08 09:52:56 +020056 if (Arg0 == 0x0)
Timothy Pearson36aed742015-04-05 23:22:18 -050057 {
58 /* Assemble and return version information */
Elyes HAOUAS433bc3e2020-10-08 09:52:56 +020059 SIZE = 0x08 /* Response length */
60 VERS = 0x01 /* Version number */
61 FUNC = 0x0F /* Supported functions? */
Timothy Pearson36aed742015-04-05 23:22:18 -050062 Return (ATPR)
63 }
64
65 /* Mux select */
Elyes HAOUAS433bc3e2020-10-08 09:52:56 +020066 if (Arg0 == 0x2)
Timothy Pearson36aed742015-04-05 23:22:18 -050067 {
68 CreateByteField (Arg1, 0x02, PWST)
Elyes HAOUAS433bc3e2020-10-08 09:52:56 +020069 Local0 = PWST
70 Local0 &= 0x01
Timothy Pearson36aed742015-04-05 23:22:18 -050071 If (Local0)
72 {
73 /* Enable discrete graphics */
74 SHYB(0x01)
75 }
76 else
77 {
78 /* Enable integrated graphics */
79 SHYB(0x00)
80 }
81 }
Felix Singerfa06bcb2022-12-26 09:32:47 +010082 Return(0)
Timothy Pearson36aed742015-04-05 23:22:18 -050083}