Angel Pons | 58c0d32 | 2020-04-05 13:20:46 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Duncan Laurie | ddc3e42 | 2013-10-02 16:10:54 -0700 | [diff] [blame] | 2 | |
Duncan Laurie | 3b6a88e | 2014-09-29 09:27:13 -0700 | [diff] [blame] | 3 | #undef ENABLE_TOUCH_WAKE |
| 4 | |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 5 | Scope (\_SB.PCI0.I2C0) |
| 6 | { |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 7 | 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 DeVillier | 45e11aa | 2016-12-18 11:59:58 -0600 | [diff] [blame] | 18 | BOARD_TRACKPAD_I2C_ADDR, // SlaveAddress |
| 19 | ControllerInitiated, // SlaveMode |
| 20 | 400000, // ConnectionSpeed |
| 21 | AddressingMode7Bit, // AddressingMode |
| 22 | "\\_SB.PCI0.I2C0", // ResourceSource |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 23 | ) |
| 24 | |
| 25 | // GPIO13 is PIRQL |
Matt DeVillier | 45e11aa | 2016-12-18 11:59:58 -0600 | [diff] [blame] | 26 | Interrupt (ResourceConsumer, Level, ActiveLow) { 27 } |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 27 | }) |
| 28 | |
Matt DeVillier | 45e11aa | 2016-12-18 11:59:58 -0600 | [diff] [blame] | 29 | Name (_PRW, Package() { BOARD_TRACKPAD_WAKE_GPIO, 3 }) |
Duncan Laurie | 3b6a88e | 2014-09-29 09:27:13 -0700 | [diff] [blame] | 30 | |
Duncan Laurie | 3b6a88e | 2014-09-29 09:27:13 -0700 | [diff] [blame] | 31 | Method (_DSW, 3, NotSerialized) |
| 32 | { |
Elyes HAOUAS | 9c19a4f | 2020-10-08 09:30:03 +0200 | [diff] [blame^] | 33 | Local0 = BOARD_TRACKPAD_WAKE_GPIO |
| 34 | If (Arg0 == 1) { |
Duncan Laurie | 3b6a88e | 2014-09-29 09:27:13 -0700 | [diff] [blame] | 35 | // Enable GPIO as wake source |
Matt DeVillier | 45e11aa | 2016-12-18 11:59:58 -0600 | [diff] [blame] | 36 | \_SB.PCI0.LPCB.GPIO.GWAK (Local0) |
Duncan Laurie | 3b6a88e | 2014-09-29 09:27:13 -0700 | [diff] [blame] | 37 | } |
| 38 | } |
Duncan Laurie | 3b6a88e | 2014-09-29 09:27:13 -0700 | [diff] [blame] | 39 | |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 40 | Method (_STA) |
| 41 | { |
Elyes HAOUAS | 9c19a4f | 2020-10-08 09:30:03 +0200 | [diff] [blame^] | 42 | If (\S1EN == 1) { |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 43 | Return (0xF) |
| 44 | } Else { |
| 45 | Return (0x0) |
| 46 | } |
| 47 | } |
| 48 | } |
Kane Chen | 00aedc5 | 2014-07-11 16:24:39 -0700 | [diff] [blame] | 49 | |
| 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 Laurie | 8429786 | 2014-09-29 09:30:36 -0700 | [diff] [blame] | 59 | |
Ben Zhang | 99e952d | 2014-11-21 11:17:53 -0800 | [diff] [blame] | 60 | Name (MB1, 1) /* MICBIAS1 = 2.970V */ |
Ben Zhang | b7f328f | 2014-12-10 17:44:18 -0800 | [diff] [blame] | 61 | Name (DACR, 1) /* Use codec internal 1.8V as DACREF source */ |
Duncan Laurie | 88b004d | 2014-10-03 15:33:10 -0700 | [diff] [blame] | 62 | Name (DCLK, 0) /* RT5677_DMIC_CLK1 */ |
Ben Zhang | 573429b | 2014-11-17 17:21:09 -0800 | [diff] [blame] | 63 | Name (PCLK, 1) /* RT5677_PDM_CLK_DIV2 (~3MHz) */ |
Duncan Laurie | 88b004d | 2014-10-03 15:33:10 -0700 | [diff] [blame] | 64 | 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 Zhang | e1ca8a3 | 2014-10-20 17:27:42 -0700 | [diff] [blame] | 70 | Name (JD1, 0) /* JackDetect1 is not used */ |
| 71 | Name (JD2, 2) /* Use GPIO5 as JackDetect2 */ |
| 72 | Name (JD3, 3) /* Use GPIO6 as JackDetect3 */ |
Duncan Laurie | 88b004d | 2014-10-03 15:33:10 -0700 | [diff] [blame] | 73 | |
Duncan Laurie | b75fb0a | 2015-01-06 15:22:41 -0800 | [diff] [blame] | 74 | /* Add DT style bindings with _DSD */ |
| 75 | Name (_DSD, Package () { |
| 76 | ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), |
| 77 | Package () { |
Ben Zhang | 99e952d | 2014-11-21 11:17:53 -0800 | [diff] [blame] | 78 | Package () { "realtek,micbias1", 1 }, |
Ben Zhang | b7f328f | 2014-12-10 17:44:18 -0800 | [diff] [blame] | 79 | Package () { "realtek,internal-dacref-en", 1 }, |
Duncan Laurie | b75fb0a | 2015-01-06 15:22:41 -0800 | [diff] [blame] | 80 | 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 Chen | 00aedc5 | 2014-07-11 16:24:39 -0700 | [diff] [blame] | 96 | Name (_CRS, ResourceTemplate() |
| 97 | { |
| 98 | I2cSerialBus ( |
Matt DeVillier | 45e11aa | 2016-12-18 11:59:58 -0600 | [diff] [blame] | 99 | BOARD_CODEC_I2C_ADDR, // SlaveAddress |
| 100 | ControllerInitiated, // SlaveMode |
| 101 | 400000, // ConnectionSpeed |
| 102 | AddressingMode7Bit, // AddressingMode |
| 103 | "\\_SB.PCI0.I2C0", // ResourceSource |
Kane Chen | 00aedc5 | 2014-07-11 16:24:39 -0700 | [diff] [blame] | 104 | ) |
Duncan Laurie | 8429786 | 2014-09-29 09:30:36 -0700 | [diff] [blame] | 105 | |
| 106 | /* GPIO46 is PIRQO (use HOTWORD_DET as codec IRQ) */ |
Ben Zhang | dcf2d38 | 2014-09-30 12:55:04 -0700 | [diff] [blame] | 107 | Interrupt (ResourceConsumer, Edge, ActiveHigh) { 30 } |
Duncan Laurie | 8429786 | 2014-09-29 09:30:36 -0700 | [diff] [blame] | 108 | |
| 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 Zhang | d416124 | 2014-09-30 17:00:05 -0700 | [diff] [blame] | 116 | * [4] = Headphone amp control (OUTPUT) |
Duncan Laurie | 8429786 | 2014-09-29 09:30:36 -0700 | [diff] [blame] | 117 | */ |
| 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 Zhang | d416124 | 2014-09-30 17:00:05 -0700 | [diff] [blame] | 134 | |
| 135 | /* Index 4: Headphone amp - HP_AMP_SHDN_L is GPIO2 */ |
| 136 | GpioIo (Exclusive, PullDown, , , IoRestrictionOutputOnly, |
| 137 | "\\_SB.PCI0.I2C0.CODC") { 1 } |
Kane Chen | 00aedc5 | 2014-07-11 16:24:39 -0700 | [diff] [blame] | 138 | }) |
Duncan Laurie | 8429786 | 2014-09-29 09:30:36 -0700 | [diff] [blame] | 139 | |
Matt DeVillier | 45e11aa | 2016-12-18 11:59:58 -0600 | [diff] [blame] | 140 | Name (_PRW, Package() { BOARD_CODEC_WAKE_GPIO, 3 }) |
Duncan Laurie | 8429786 | 2014-09-29 09:30:36 -0700 | [diff] [blame] | 141 | |
| 142 | Method (_DSW, 3, NotSerialized) |
| 143 | { |
Elyes HAOUAS | 9c19a4f | 2020-10-08 09:30:03 +0200 | [diff] [blame^] | 144 | Local0 = BOARD_CODEC_WAKE_GPIO |
| 145 | If (Arg0 == 1) { |
Duncan Laurie | 8429786 | 2014-09-29 09:30:36 -0700 | [diff] [blame] | 146 | // Enable GPIO as wake source |
Matt DeVillier | 45e11aa | 2016-12-18 11:59:58 -0600 | [diff] [blame] | 147 | \_SB.PCI0.LPCB.GPIO.GWAK (Local0) |
Duncan Laurie | 8429786 | 2014-09-29 09:30:36 -0700 | [diff] [blame] | 148 | } |
| 149 | } |
| 150 | |
Kane Chen | 00aedc5 | 2014-07-11 16:24:39 -0700 | [diff] [blame] | 151 | Method (_STA) |
| 152 | { |
Elyes HAOUAS | 9c19a4f | 2020-10-08 09:30:03 +0200 | [diff] [blame^] | 153 | If (\S1EN == 1) { |
Kane Chen | 00aedc5 | 2014-07-11 16:24:39 -0700 | [diff] [blame] | 154 | Return (0xF) |
| 155 | } Else { |
| 156 | Return (0x0) |
| 157 | } |
| 158 | } |
| 159 | } |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | Scope (\_SB.PCI0.I2C1) |
| 163 | { |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 164 | 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 DeVillier | 45e11aa | 2016-12-18 11:59:58 -0600 | [diff] [blame] | 175 | BOARD_TOUCHSCREEN_I2C_ADDR, // SlaveAddress |
| 176 | ControllerInitiated, // SlaveMode |
| 177 | 400000, // ConnectionSpeed |
| 178 | AddressingMode7Bit, // AddressingMode |
| 179 | "\\_SB.PCI0.I2C1", // ResourceSource |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 180 | ) |
| 181 | |
| 182 | // GPIO14 is PIRQM |
Matt DeVillier | 45e11aa | 2016-12-18 11:59:58 -0600 | [diff] [blame] | 183 | Interrupt (ResourceConsumer, Level, ActiveLow) { 28 } |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 184 | }) |
| 185 | |
Duncan Laurie | c37dd50 | 2014-11-03 12:48:11 -0800 | [diff] [blame] | 186 | #ifdef ENABLE_TOUCH_WAKE |
Matt DeVillier | 45e11aa | 2016-12-18 11:59:58 -0600 | [diff] [blame] | 187 | Name (_PRW, Package() { BOARD_TOUCHSCREEN_WAKE_GPIO, 3 }) |
Duncan Laurie | 3b6a88e | 2014-09-29 09:27:13 -0700 | [diff] [blame] | 188 | |
Duncan Laurie | 3b6a88e | 2014-09-29 09:27:13 -0700 | [diff] [blame] | 189 | Method (_DSW, 3, NotSerialized) |
| 190 | { |
Elyes HAOUAS | 9c19a4f | 2020-10-08 09:30:03 +0200 | [diff] [blame^] | 191 | Local0 = BOARD_CODEC_WAKE_GPIO |
| 192 | If (Arg0 == 1) { |
Duncan Laurie | 3b6a88e | 2014-09-29 09:27:13 -0700 | [diff] [blame] | 193 | // Enable GPIO as wake source |
Matt DeVillier | 45e11aa | 2016-12-18 11:59:58 -0600 | [diff] [blame] | 194 | \_SB.PCI0.LPCB.GPIO.GWAK (Local0) |
Duncan Laurie | 3b6a88e | 2014-09-29 09:27:13 -0700 | [diff] [blame] | 195 | } |
| 196 | } |
| 197 | #endif |
| 198 | |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 199 | Method (_STA) |
| 200 | { |
Elyes HAOUAS | 9c19a4f | 2020-10-08 09:30:03 +0200 | [diff] [blame^] | 201 | If (\S2EN == 1) { |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 202 | Return (0xF) |
| 203 | } Else { |
| 204 | Return (0x0) |
| 205 | } |
| 206 | } |
Duncan Laurie | ddc3e42 | 2013-10-02 16:10:54 -0700 | [diff] [blame] | 207 | } |
| 208 | } |
Ben Zhang | c05710f | 2014-12-15 17:38:11 -0800 | [diff] [blame] | 209 | |
| 210 | Scope (\_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 | } |