blob: 9ca592f40187476ed546ecebe6d69699b432ea46 [file] [log] [blame]
Angel Pons58c0d322020-04-05 13:20:46 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Duncan Laurieddc3e422013-10-02 16:10:54 -07002
Duncan Laurie3b6a88e2014-09-29 09:27:13 -07003#undef ENABLE_TOUCH_WAKE
4
Duncan Laurie25c6f752014-05-22 08:25:36 -07005Scope (\_SB.PCI0.I2C0)
6{
Duncan Laurie25c6f752014-05-22 08:25:36 -07007 Device (ATPA)
8 {
9 Name (_HID, "ATML0000")
10 Name (_DDN, "Atmel Touchpad")
11 Name (_UID, 2)
12 Name (_S0W, 4)
13 Name (ISTP, 1) /* Touchpad */
14
15 Name (_CRS, ResourceTemplate()
16 {
17 I2cSerialBus (
Matt DeVillier45e11aa2016-12-18 11:59:58 -060018 BOARD_TRACKPAD_I2C_ADDR, // SlaveAddress
19 ControllerInitiated, // SlaveMode
20 400000, // ConnectionSpeed
21 AddressingMode7Bit, // AddressingMode
22 "\\_SB.PCI0.I2C0", // ResourceSource
Duncan Laurie25c6f752014-05-22 08:25:36 -070023 )
24
25 // GPIO13 is PIRQL
Matt DeVillier45e11aa2016-12-18 11:59:58 -060026 Interrupt (ResourceConsumer, Level, ActiveLow) { 27 }
Duncan Laurie25c6f752014-05-22 08:25:36 -070027 })
28
Matt DeVillier45e11aa2016-12-18 11:59:58 -060029 Name (_PRW, Package() { BOARD_TRACKPAD_WAKE_GPIO, 3 })
Duncan Laurie3b6a88e2014-09-29 09:27:13 -070030
Duncan Laurie3b6a88e2014-09-29 09:27:13 -070031 Method (_DSW, 3, NotSerialized)
32 {
Elyes HAOUAS9c19a4f2020-10-08 09:30:03 +020033 Local0 = BOARD_TRACKPAD_WAKE_GPIO
34 If (Arg0 == 1) {
Duncan Laurie3b6a88e2014-09-29 09:27:13 -070035 // Enable GPIO as wake source
Matt DeVillier45e11aa2016-12-18 11:59:58 -060036 \_SB.PCI0.LPCB.GPIO.GWAK (Local0)
Duncan Laurie3b6a88e2014-09-29 09:27:13 -070037 }
38 }
Duncan Laurie3b6a88e2014-09-29 09:27:13 -070039
Duncan Laurie25c6f752014-05-22 08:25:36 -070040 Method (_STA)
41 {
Elyes HAOUAS9c19a4f2020-10-08 09:30:03 +020042 If (\S1EN == 1) {
Duncan Laurie25c6f752014-05-22 08:25:36 -070043 Return (0xF)
44 } Else {
45 Return (0x0)
46 }
47 }
48 }
Kane Chen00aedc52014-07-11 16:24:39 -070049
50 Device (CODC)
51 {
52 /*
53 * TODO(kane): Need official HID.
54 *
55 */
56 Name (_HID, "RT5677CE")
57 Name (_DDN, "RT5667 Codec")
58 Name (_UID, 1)
Duncan Laurie84297862014-09-29 09:30:36 -070059
Ben Zhang99e952d2014-11-21 11:17:53 -080060 Name (MB1, 1) /* MICBIAS1 = 2.970V */
Ben Zhangb7f328f2014-12-10 17:44:18 -080061 Name (DACR, 1) /* Use codec internal 1.8V as DACREF source */
Duncan Laurie88b004d2014-10-03 15:33:10 -070062 Name (DCLK, 0) /* RT5677_DMIC_CLK1 */
Ben Zhang573429b2014-11-17 17:21:09 -080063 Name (PCLK, 1) /* RT5677_PDM_CLK_DIV2 (~3MHz) */
Duncan Laurie88b004d2014-10-03 15:33:10 -070064 Name (IN1, 1) /* IN1 differential */
65 Name (IN2, 0) /* IN2 not differential */
66 Name (OUT1, 1) /* LOUT1 differential */
67 Name (OUT2, 1) /* LOUT2 differential */
68 Name (OUT3, 0) /* LOUT3 differential */
69 Name (ASRC, 1) /* Enable I2S1 ASRC */
Ben Zhange1ca8a32014-10-20 17:27:42 -070070 Name (JD1, 0) /* JackDetect1 is not used */
71 Name (JD2, 2) /* Use GPIO5 as JackDetect2 */
72 Name (JD3, 3) /* Use GPIO6 as JackDetect3 */
Duncan Laurie88b004d2014-10-03 15:33:10 -070073
Duncan Laurieb75fb0a2015-01-06 15:22:41 -080074 /* Add DT style bindings with _DSD */
75 Name (_DSD, Package () {
76 ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
77 Package () {
Ben Zhang99e952d2014-11-21 11:17:53 -080078 Package () { "realtek,micbias1", 1 },
Ben Zhangb7f328f2014-12-10 17:44:18 -080079 Package () { "realtek,internal-dacref-en", 1 },
Duncan Laurieb75fb0a2015-01-06 15:22:41 -080080 Package () { "realtek,in1-differential", 1 },
81 Package () { "realtek,in2-differential", 0 },
82 Package () { "realtek,lout1-differential", 1 },
83 Package () { "realtek,lout2-differential", 1 },
84 Package () { "realtek,lout3-differential", 0 },
85 Package () { "realtek,pdm_clk_div", 1 },
86 Package () { "realtek,dmic2_clk_pin", 0 },
87 Package () { "realtek,asrc-en", 1 },
88 Package () { "realtek,jd1-gpio", 0 },
89 Package () { "realtek,jd2-gpio", 2 },
90 Package () { "realtek,jd3-gpio", 3 },
91 Package () { "realtek,gpio-config",
92 Package () { 0, 0, 0, 0, 0, 2 } },
93 }
94 })
95
Kane Chen00aedc52014-07-11 16:24:39 -070096 Name (_CRS, ResourceTemplate()
97 {
98 I2cSerialBus (
Matt DeVillier45e11aa2016-12-18 11:59:58 -060099 BOARD_CODEC_I2C_ADDR, // SlaveAddress
100 ControllerInitiated, // SlaveMode
101 400000, // ConnectionSpeed
102 AddressingMode7Bit, // AddressingMode
103 "\\_SB.PCI0.I2C0", // ResourceSource
Kane Chen00aedc52014-07-11 16:24:39 -0700104 )
Duncan Laurie84297862014-09-29 09:30:36 -0700105
106 /* GPIO46 is PIRQO (use HOTWORD_DET as codec IRQ) */
Ben Zhangdcf2d382014-09-30 12:55:04 -0700107 Interrupt (ResourceConsumer, Edge, ActiveHigh) { 30 }
Duncan Laurie84297862014-09-29 09:30:36 -0700108
109 /*
110 * Codec GPIOs are 1-based in the schematic
111 *
112 * [0] = Jack Detect (INPUT)
113 * [1] = Mic Present (INPUT)
114 * [2] = Interrupt to the host (OUTPUT)
115 * [3] = Interrupt to the host (OUTPUT)
Ben Zhangd4161242014-09-30 17:00:05 -0700116 * [4] = Headphone amp control (OUTPUT)
Duncan Laurie84297862014-09-29 09:30:36 -0700117 */
118
119 /* Index 0: Jack Detect - PLUG_DET is GPIO5 */
120 GpioIo (Exclusive, PullUp, , , IoRestrictionInputOnly,
121 "\\_SB.PCI0.I2C0.CODC") { 4 }
122
123 /* Index 1: Mic Present - MIC_PRESENT_L is GPIO6 */
124 GpioIo (Exclusive, PullUp, , , IoRestrictionInputOnly,
125 "\\_SB.PCI0.I2C0.CODC") { 5 }
126
127 /* Index 2: Codec IRQ - HOTWORD_DET_L is GPIO1 */
128 GpioIo (Exclusive, PullUp, , , IoRestrictionOutputOnly,
129 "\\_SB.PCI0.I2C0.CODC") { 0 }
130
131 /* Index 3: Codec Wake - DSP_INT is GPIO4 */
132 GpioIo (Exclusive, PullUp, , , IoRestrictionOutputOnly,
133 "\\_SB.PCI0.I2C0.CODC") { 3 }
Ben Zhangd4161242014-09-30 17:00:05 -0700134
135 /* Index 4: Headphone amp - HP_AMP_SHDN_L is GPIO2 */
136 GpioIo (Exclusive, PullDown, , , IoRestrictionOutputOnly,
137 "\\_SB.PCI0.I2C0.CODC") { 1 }
Kane Chen00aedc52014-07-11 16:24:39 -0700138 })
Duncan Laurie84297862014-09-29 09:30:36 -0700139
Matt DeVillier45e11aa2016-12-18 11:59:58 -0600140 Name (_PRW, Package() { BOARD_CODEC_WAKE_GPIO, 3 })
Duncan Laurie84297862014-09-29 09:30:36 -0700141
142 Method (_DSW, 3, NotSerialized)
143 {
Elyes HAOUAS9c19a4f2020-10-08 09:30:03 +0200144 Local0 = BOARD_CODEC_WAKE_GPIO
145 If (Arg0 == 1) {
Duncan Laurie84297862014-09-29 09:30:36 -0700146 // Enable GPIO as wake source
Matt DeVillier45e11aa2016-12-18 11:59:58 -0600147 \_SB.PCI0.LPCB.GPIO.GWAK (Local0)
Duncan Laurie84297862014-09-29 09:30:36 -0700148 }
149 }
150
Kane Chen00aedc52014-07-11 16:24:39 -0700151 Method (_STA)
152 {
Elyes HAOUAS9c19a4f2020-10-08 09:30:03 +0200153 If (\S1EN == 1) {
Kane Chen00aedc52014-07-11 16:24:39 -0700154 Return (0xF)
155 } Else {
156 Return (0x0)
157 }
158 }
159 }
Duncan Laurie25c6f752014-05-22 08:25:36 -0700160}
161
162Scope (\_SB.PCI0.I2C1)
163{
Duncan Laurie25c6f752014-05-22 08:25:36 -0700164 Device (ATSA)
165 {
166 Name (_HID, "ATML0001")
167 Name (_DDN, "Atmel Touchscreen")
168 Name (_UID, 5)
169 Name (_S0W, 4)
170 Name (ISTP, 0) /* TouchScreen */
171
172 Name (_CRS, ResourceTemplate()
173 {
174 I2cSerialBus (
Matt DeVillier45e11aa2016-12-18 11:59:58 -0600175 BOARD_TOUCHSCREEN_I2C_ADDR, // SlaveAddress
176 ControllerInitiated, // SlaveMode
177 400000, // ConnectionSpeed
178 AddressingMode7Bit, // AddressingMode
179 "\\_SB.PCI0.I2C1", // ResourceSource
Duncan Laurie25c6f752014-05-22 08:25:36 -0700180 )
181
182 // GPIO14 is PIRQM
Matt DeVillier45e11aa2016-12-18 11:59:58 -0600183 Interrupt (ResourceConsumer, Level, ActiveLow) { 28 }
Duncan Laurie25c6f752014-05-22 08:25:36 -0700184 })
185
Duncan Lauriec37dd502014-11-03 12:48:11 -0800186#ifdef ENABLE_TOUCH_WAKE
Matt DeVillier45e11aa2016-12-18 11:59:58 -0600187 Name (_PRW, Package() { BOARD_TOUCHSCREEN_WAKE_GPIO, 3 })
Duncan Laurie3b6a88e2014-09-29 09:27:13 -0700188
Duncan Laurie3b6a88e2014-09-29 09:27:13 -0700189 Method (_DSW, 3, NotSerialized)
190 {
Elyes HAOUAS9c19a4f2020-10-08 09:30:03 +0200191 Local0 = BOARD_CODEC_WAKE_GPIO
192 If (Arg0 == 1) {
Duncan Laurie3b6a88e2014-09-29 09:27:13 -0700193 // Enable GPIO as wake source
Matt DeVillier45e11aa2016-12-18 11:59:58 -0600194 \_SB.PCI0.LPCB.GPIO.GWAK (Local0)
Duncan Laurie3b6a88e2014-09-29 09:27:13 -0700195 }
196 }
197#endif
198
Duncan Laurie25c6f752014-05-22 08:25:36 -0700199 Method (_STA)
200 {
Elyes HAOUAS9c19a4f2020-10-08 09:30:03 +0200201 If (\S2EN == 1) {
Duncan Laurie25c6f752014-05-22 08:25:36 -0700202 Return (0xF)
203 } Else {
204 Return (0x0)
205 }
206 }
Duncan Laurieddc3e422013-10-02 16:10:54 -0700207 }
208}
Ben Zhangc05710f2014-12-15 17:38:11 -0800209
210Scope (\_SB.PCI0.SPI0)
211{
212 Device (CODC)
213 {
214 // TODO: Need official HID.
215 Name (_HID, "RT5677AA")
216 Name (_UID, 1)
217 Name (_CRS, ResourceTemplate ()
218 {
219 SpiSerialBus (
220 0, // DeviceSelection (CS0?)
221 PolarityLow, // DeviceSelectionPolarity
222 FourWireMode, // WireMode
223 8, // DataBitLength
224 ControllerInitiated, // SlaveMode
225 1000000, // ConnectionSpeed (1MHz)
226 ClockPolarityLow, // ClockPolarity
227 ClockPhaseFirst, // ClockPhase
228 "\\_SB.PCI0.SPI0", // ResourceSource
229 0, // ResourceSourceIndex
230 ResourceConsumer, // ResourceUsage
231 )
232 })
233 }
234}