Angel Pons | c3f58f6 | 2020-04-05 15:46:41 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Shawn Nematbakhsh | 51d787a | 2014-01-16 17:52:21 -0800 | [diff] [blame] | 2 | |
| 3 | Device (LPEA) |
| 4 | { |
| 5 | Name (_HID, "80860F28") |
| 6 | Name (_CID, "80860F28") |
| 7 | Name (_UID, 1) |
| 8 | Name (_DDN, "Low Power Audio Controller") |
| 9 | Name (_PR0, Package () { PLPE }) |
| 10 | |
| 11 | Name (RBUF, ResourceTemplate() |
| 12 | { |
| 13 | Memory32Fixed (ReadWrite, 0, 0x00200000, BAR0) |
| 14 | Memory32Fixed (ReadWrite, 0, 0x00001000, BAR1) |
| 15 | Memory32Fixed (ReadWrite, 0, 0x00100000, BAR2) |
| 16 | Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive,,,) |
| 17 | { |
| 18 | LPE_DMA0_IRQ |
| 19 | } |
| 20 | Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive,,,) |
| 21 | { |
| 22 | LPE_DMA1_IRQ |
| 23 | } |
| 24 | Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive,,,) |
| 25 | { |
| 26 | LPE_SSP0_IRQ |
| 27 | } |
| 28 | Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive,,,) |
| 29 | { |
| 30 | LPE_SSP1_IRQ |
| 31 | } |
| 32 | Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive,,,) |
| 33 | { |
| 34 | LPE_SSP2_IRQ |
| 35 | } |
| 36 | Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive,,,) |
| 37 | { |
| 38 | LPE_IPC2HOST_IRQ |
| 39 | } |
| 40 | }) |
| 41 | |
| 42 | Method (_CRS) |
| 43 | { |
| 44 | /* Update BAR0 from NVS */ |
| 45 | CreateDwordField (^RBUF, ^BAR0._BAS, BAS0) |
Felix Singer | 476fe6a | 2022-12-12 07:30:07 +0100 | [diff] [blame] | 46 | BAS0 = \LPB0 |
Shawn Nematbakhsh | 51d787a | 2014-01-16 17:52:21 -0800 | [diff] [blame] | 47 | |
| 48 | /* Update BAR1 from NVS */ |
| 49 | CreateDwordField (^RBUF, ^BAR1._BAS, BAS1) |
Felix Singer | 476fe6a | 2022-12-12 07:30:07 +0100 | [diff] [blame] | 50 | BAS1 = \LPB1 |
Shawn Nematbakhsh | 51d787a | 2014-01-16 17:52:21 -0800 | [diff] [blame] | 51 | |
| 52 | /* Update LPE FW from NVS */ |
| 53 | CreateDwordField (^RBUF, ^BAR2._BAS, BAS2) |
Felix Singer | 476fe6a | 2022-12-12 07:30:07 +0100 | [diff] [blame] | 54 | BAS2 = \LPFW |
Shawn Nematbakhsh | 51d787a | 2014-01-16 17:52:21 -0800 | [diff] [blame] | 55 | |
| 56 | /* Append any Mainboard defined GPIOs */ |
Martin Roth | 10f7f50 | 2015-12-08 15:26:03 -0700 | [diff] [blame] | 57 | If (CondRefOf (^GBUF)) { |
Aaron Durbin | 4177db5 | 2014-02-05 14:55:26 -0600 | [diff] [blame] | 58 | ConcatenateResTemplate (^RBUF, ^GBUF, Local1) |
Shawn Nematbakhsh | 51d787a | 2014-01-16 17:52:21 -0800 | [diff] [blame] | 59 | Return (Local1) |
| 60 | } |
| 61 | |
| 62 | Return (^RBUF) |
| 63 | } |
| 64 | |
| 65 | Method (_STA) |
| 66 | { |
Felix Singer | 26c7672 | 2022-12-11 21:15:05 +0100 | [diff] [blame] | 67 | If (\LPEN == 1) { |
Shawn Nematbakhsh | 51d787a | 2014-01-16 17:52:21 -0800 | [diff] [blame] | 68 | Return (0xF) |
| 69 | } Else { |
| 70 | Return (0x0) |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | OperationRegion (KEYS, SystemMemory, LPB1, 0x100) |
| 75 | Field (KEYS, DWordAcc, NoLock, WriteAsZeros) |
| 76 | { |
| 77 | Offset (0x84), |
| 78 | PSAT, 32, |
| 79 | } |
| 80 | |
| 81 | PowerResource (PLPE, 0, 0) |
| 82 | { |
| 83 | Method (_STA) |
| 84 | { |
| 85 | Return (1) |
| 86 | } |
| 87 | |
| 88 | Method (_OFF) |
| 89 | { |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 90 | PSAT |= 3 |
| 91 | PSAT |= 0 |
Shawn Nematbakhsh | 51d787a | 2014-01-16 17:52:21 -0800 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | Method (_ON) |
| 95 | { |
Felix Singer | 35e65a8 | 2022-12-16 07:11:17 +0100 | [diff] [blame] | 96 | PSAT &= 0xfffffffc |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 97 | PSAT |= 0 |
Shawn Nematbakhsh | 51d787a | 2014-01-16 17:52:21 -0800 | [diff] [blame] | 98 | } |
| 99 | } |
| 100 | } |