tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / mainboard / google / samus / acpi / mainboard.asl
blob17f6257038e04348ee927c930b47ff001fcbfbe5
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2014 Google Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
16 #undef ENABLE_TOUCH_WAKE
18 Scope (\_SB)
20         Device (LID0)
21         {
22                 Name (_HID, EisaId("PNP0C0D"))
23                 Method (_LID, 0)
24                 {
25                         Return (\_SB.PCI0.LPCB.EC0.LIDS)
26                 }
28                 // EC wake is GPIO27 which is a special DeepSX wake pin
29                 Name (_PRW, Package(){ 0x70, 5 }) // GP27_EN
30         }
32         Device (PWRB)
33         {
34                 Name(_HID, EisaId("PNP0C0C"))
35         }
39  * LPC Trusted Platform Module
40  */
41 Scope (\_SB.PCI0.LPCB)
43         #include <drivers/pc80/tpm/acpi/tpm.asl>
47  * WLAN connected to Root Port 3, becomes Root Port 1 after coalesce
48  */
49 Scope (\_SB.PCI0.RP01)
51         Device (WLAN)
52         {
53                 Name (_ADR, 0x00000000)
55                 /* GPIO10 is PCH_WLAN_WAKE_L */
56                 Name (GPIO, 10)
58                 Name (_PRW, Package() { GPIO, 3 })
60                 Method (_DSW, 3, NotSerialized)
61                 {
62                         If (LEqual (Arg0, 1)) {
63                                 // Enable GPIO as wake source
64                                 \_SB.PCI0.LPCB.GPIO.GWAK (^GPIO)
65                         }
66                 }
67         }
70 Scope (\_SB.PCI0.I2C0)
72         Device (ATPB)
73         {
74                 Name (_HID, "ATML0000")
75                 Name (_DDN, "Atmel Touchpad Bootloader")
76                 Name (_UID, 1)
77                 Name (_S0W, 4)
78                 Name (ISTP, 1) /* Touchpad */
80                 Name (_CRS, ResourceTemplate()
81                 {
82                         I2cSerialBus (
83                                 0x26,                     // SlaveAddress
84                                 ControllerInitiated,      // SlaveMode
85                                 400000,                   // ConnectionSpeed
86                                 AddressingMode7Bit,       // AddressingMode
87                                 "\\_SB.PCI0.I2C0",        // ResourceSource
88                         )
90                         // GPIO13 is PIRQL
91                         Interrupt (ResourceConsumer, Edge, ActiveLow) { 27 }
92                 })
94                 Method (_STA)
95                 {
96                         If (LEqual (\S1EN, 1)) {
97                                 Return (0xF)
98                         } Else {
99                                 Return (0x0)
100                         }
101                 }
102         }
104         Device (ATPA)
105         {
106                 Name (_HID, "ATML0000")
107                 Name (_DDN, "Atmel Touchpad")
108                 Name (_UID, 2)
109                 Name (_S0W, 4)
110                 Name (ISTP, 1) /* Touchpad */
111                 Name (GPIO, 9) /* TRACKPAD_INT_L (WAKE) */
113                 Name (_CRS, ResourceTemplate()
114                 {
115                         I2cSerialBus (
116                                 0x4a,                     // SlaveAddress
117                                 ControllerInitiated,      // SlaveMode
118                                 400000,                   // ConnectionSpeed
119                                 AddressingMode7Bit,       // AddressingMode
120                                 "\\_SB.PCI0.I2C0",        // ResourceSource
121                         )
123                         // GPIO13 is PIRQL
124                         Interrupt (ResourceConsumer, Edge, ActiveLow) { 27 }
125                 })
127                 Name (_PRW, Package() { GPIO, 3 })
129                 Method (_DSW, 3, NotSerialized)
130                 {
131                         If (LEqual (Arg0, 1)) {
132                                 // Enable GPIO as wake source
133                                 \_SB.PCI0.LPCB.GPIO.GWAK (^GPIO)
134                         }
135                 }
137                 Method (_STA)
138                 {
139                         If (LEqual (\S1EN, 1)) {
140                                 Return (0xF)
141                         } Else {
142                                 Return (0x0)
143                         }
144                 }
145         }
147         Device (CODC)
148         {
149                 /*
150                  * TODO(kane): Need official HID.
151                  *
152                  */
153                 Name (_HID, "RT5677CE")
154                 Name (_DDN, "RT5667 Codec")
155                 Name (_UID, 1)
156                 Name (WAKE, 45) /* DSP_INT (use as codec wake) */
158                 Name (MB1, 1)   /* MICBIAS1 = 2.970V */
159                 Name (DACR, 1)  /* Use codec internal 1.8V as DACREF source */
160                 Name (DCLK, 0)  /* RT5677_DMIC_CLK1 */
161                 Name (PCLK, 1)  /* RT5677_PDM_CLK_DIV2 (~3MHz) */
162                 Name (IN1, 1)   /* IN1 differential */
163                 Name (IN2, 0)   /* IN2 not differential */
164                 Name (OUT1, 1)  /* LOUT1 differential */
165                 Name (OUT2, 1)  /* LOUT2 differential */
166                 Name (OUT3, 0)  /* LOUT3 differential */
167                 Name (ASRC, 1)  /* Enable I2S1 ASRC */
168                 Name (JD1, 0)   /* JackDetect1 is not used */
169                 Name (JD2, 2)   /* Use GPIO5 as JackDetect2 */
170                 Name (JD3, 3)   /* Use GPIO6 as JackDetect3 */
172                 /* Add DT style bindings with _DSD */
173                 Name (_DSD, Package () {
174                         ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
175                         Package () {
176                                 Package () { "realtek,micbias1", 1 },
177                                 Package () { "realtek,internal-dacref-en", 1 },
178                                 Package () { "realtek,in1-differential", 1 },
179                                 Package () { "realtek,in2-differential", 0 },
180                                 Package () { "realtek,lout1-differential", 1 },
181                                 Package () { "realtek,lout2-differential", 1 },
182                                 Package () { "realtek,lout3-differential", 0 },
183                                 Package () { "realtek,pdm_clk_div", 1 },
184                                 Package () { "realtek,dmic2_clk_pin", 0 },
185                                 Package () { "realtek,asrc-en", 1 },
186                                 Package () { "realtek,jd1-gpio", 0 },
187                                 Package () { "realtek,jd2-gpio", 2 },
188                                 Package () { "realtek,jd3-gpio", 3 },
189                                 Package () { "realtek,gpio-config",
190                                         Package () { 0, 0, 0, 0, 0, 2 } },
191                         }
192                 })
194                 Name (_CRS, ResourceTemplate()
195                 {
196                         I2cSerialBus (
197                                 0x2c,                     // SlaveAddress
198                                 ControllerInitiated,      // SlaveMode
199                                 400000,                   // ConnectionSpeed
200                                 AddressingMode7Bit,       // AddressingMode
201                                 "\\_SB.PCI0.I2C0",        // ResourceSource
202                         )
204                         /* GPIO46 is PIRQO (use HOTWORD_DET as codec IRQ) */
205                         Interrupt (ResourceConsumer, Edge, ActiveHigh) { 30 }
207                         /*
208                          * Codec GPIOs are 1-based in the schematic
209                          *
210                          * [0] = Jack Detect (INPUT)
211                          * [1] = Mic Present (INPUT)
212                          * [2] = Interrupt to the host (OUTPUT)
213                          * [3] = Interrupt to the host (OUTPUT)
214                          * [4] = Headphone amp control (OUTPUT)
215                          */
217                         /* Index 0:  Jack Detect - PLUG_DET is GPIO5 */
218                         GpioIo (Exclusive, PullUp, , , IoRestrictionInputOnly,
219                                 "\\_SB.PCI0.I2C0.CODC") { 4 }
221                         /* Index 1:  Mic Present - MIC_PRESENT_L is GPIO6 */
222                         GpioIo (Exclusive, PullUp, , , IoRestrictionInputOnly,
223                                 "\\_SB.PCI0.I2C0.CODC") { 5 }
225                         /* Index 2:  Codec IRQ - HOTWORD_DET_L is GPIO1 */
226                         GpioIo (Exclusive, PullUp, , , IoRestrictionOutputOnly,
227                                 "\\_SB.PCI0.I2C0.CODC") { 0 }
229                         /* Index 3:  Codec Wake - DSP_INT is GPIO4 */
230                         GpioIo (Exclusive, PullUp, , , IoRestrictionOutputOnly,
231                                 "\\_SB.PCI0.I2C0.CODC") { 3 }
233                         /* Index 4:  Headphone amp - HP_AMP_SHDN_L is GPIO2 */
234                         GpioIo (Exclusive, PullDown, , , IoRestrictionOutputOnly,
235                                 "\\_SB.PCI0.I2C0.CODC") { 1 }
236                 })
238                 Name (_PRW, Package() { WAKE, 3 })
240                 Method (_DSW, 3, NotSerialized)
241                 {
242                         If (LEqual (Arg0, 1)) {
243                                 // Enable GPIO as wake source
244                                 \_SB.PCI0.LPCB.GPIO.GWAK (^WAKE)
245                         }
246                 }
248                 Method (_STA)
249                 {
250                         If (LEqual (\S1EN, 1)) {
251                                 Return (0xF)
252                         } Else {
253                                 Return (0x0)
254                         }
255                 }
256         }
259 Scope (\_SB.PCI0.I2C1)
261         Device (ATSB)
262         {
263                 Name (_HID, "ATML0001")
264                 Name (_DDN, "Atmel Touchscreen Bootloader")
265                 Name (_UID, 4)
266                 Name (_S0W, 4)
267                 Name (ISTP, 0) /* TouchScreen */
269                 Name (_CRS, ResourceTemplate()
270                 {
271                         I2cSerialBus (
272                                 0x27,                     // SlaveAddress
273                                 ControllerInitiated,      // SlaveMode
274                                 400000,                   // ConnectionSpeed
275                                 AddressingMode7Bit,       // AddressingMode
276                                 "\\_SB.PCI0.I2C1",        // ResourceSource
277                         )
279                         // GPIO14 is PIRQM
280                         Interrupt (ResourceConsumer, Edge, ActiveLow) { 28 }
281                 })
283                 Method (_STA)
284                 {
285                         If (LEqual (\S2EN, 1)) {
286                                 Return (0xF)
287                         } Else {
288                                 Return (0x0)
289                         }
290                 }
291         }
293         Device (ATSA)
294         {
295                 Name (_HID, "ATML0001")
296                 Name (_DDN, "Atmel Touchscreen")
297                 Name (_UID, 5)
298                 Name (_S0W, 4)
299                 Name (ISTP, 0) /* TouchScreen */
300                 Name (GPIO, 14) /* TOUCH_INT_L */
302                 Name (_CRS, ResourceTemplate()
303                 {
304                         I2cSerialBus (
305                                 0x4b,                     // SlaveAddress
306                                 ControllerInitiated,      // SlaveMode
307                                 400000,                   // ConnectionSpeed
308                                 AddressingMode7Bit,       // AddressingMode
309                                 "\\_SB.PCI0.I2C1",        // ResourceSource
310                         )
312                         // GPIO14 is PIRQM
313                         Interrupt (ResourceConsumer, Edge, ActiveLow) { 28 }
314                 })
316 #ifdef ENABLE_TOUCH_WAKE
317                 Name (_PRW, Package() { GPIO, 3 })
319                 Method (_DSW, 3, NotSerialized)
320                 {
321                         If (LEqual (Arg0, 1)) {
322                                 // Enable GPIO as wake source
323                                 \_SB.PCI0.LPCB.GPIO.GWAK (^GPIO)
324                         }
325                 }
326 #endif
328                 Method (_STA)
329                 {
330                         If (LEqual (\S2EN, 1)) {
331                                 Return (0xF)
332                         } Else {
333                                 Return (0x0)
334                         }
335                 }
336         }
339 Scope (\_SB.PCI0.SPI0)
341         Device (CODC)
342         {
343                 // TODO: Need official HID.
344                 Name (_HID, "RT5677AA")
345                 Name (_UID, 1)
346                 Name (_CRS, ResourceTemplate ()
347                 {
348                         SpiSerialBus (
349                                 0,                   // DeviceSelection (CS0?)
350                                 PolarityLow,         // DeviceSelectionPolarity
351                                 FourWireMode,        // WireMode
352                                 8,                   // DataBitLength
353                                 ControllerInitiated, // SlaveMode
354                                 1000000,             // ConnectionSpeed (1MHz)
355                                 ClockPolarityLow,    // ClockPolarity
356                                 ClockPhaseFirst,     // ClockPhase
357                                 "\\_SB.PCI0.SPI0",   // ResourceSource
358                                 0,                   // ResourceSourceIndex
359                                 ResourceConsumer,    // ResourceUsage
360                         )
361                 })
362         }