summaryrefslogtreecommitdiff
path: root/src/soc/intel/braswell/acpi/lpe.asl
blob: d655ae8c4fd930d0f3d9a2d73a58c5ef09e69ca2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* SPDX-License-Identifier: GPL-2.0-only */

Device (LPEA)
{
	Name (_HID, "808622A8")
	Name (_CID, "808622A8")
	Name (_UID, 1)
	Name (_DDN, "Intel(R) Low Power Audio Controller - 808622A8")
	Name (_PR0, Package () { PLPE })

	Name (RBUF, ResourceTemplate()
	{
		Memory32Fixed (ReadWrite, 0, 0x00200000, BAR0)
		Memory32Fixed (ReadWrite, 0, 0x00001000, BAR1)
		Memory32Fixed (ReadWrite, 0, 0x00200000, BAR2)
		Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive,,,)
		{
			LPE_DMA0_IRQ
		}
		Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive,,,)
		{
			LPE_DMA1_IRQ
		}
		Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive,,,)
		{
			LPE_SSP0_IRQ
		}
		Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive,,,)
		{
			LPE_SSP1_IRQ
		}
		Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive,,,)
		{
			LPE_SSP2_IRQ
		}
		Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive,,,)
		{
			LPE_IPC2HOST_IRQ
		}
	})

	Method (_CRS)
	{
		/* Update BAR0 from NVS */
		CreateDwordField (^RBUF, ^BAR0._BAS, BAS0)
		Store (\LPB0, BAS0)

		/* Update BAR1 from NVS */
		CreateDwordField (^RBUF, ^BAR1._BAS, BAS1)
		Store (\LPB1, BAS1)

		/* Update LPE FW from NVS */
		CreateDwordField (^RBUF, ^BAR2._BAS, BAS2)
		Store (\LPFW, BAS2)

		/* Append any Mainboard defined GPIOs */
		If (CondRefOf (^GBUF)) {
			ConcatenateResTemplate (^RBUF, ^GBUF, Local1)
			Return (Local1)
		}

		Return (^RBUF)
	}

	Method (_STA)
	{
		If (LEqual (\LPEN, 1)) {
			Return (0xF)
		} Else {
			Return (0x0)
		}
	}

	OperationRegion (KEYS, SystemMemory, LPB1, 0x100)
	Field (KEYS, DWordAcc, NoLock, WriteAsZeros)
	{
		Offset (0x84),
		PSAT, 32,
	}

	PowerResource (PLPE, 0, 0)
	{
		Method (_STA)
		{
			Return (1)
		}

		Method (_OFF)
		{
			Or (PSAT, 0x00000003, PSAT)
			Or (PSAT, 0x00000000, PSAT)
		}

		Method (_ON)
		{
			And (PSAT, 0xfffffffc, PSAT)
			Or (PSAT, 0x00000000, PSAT)
		}
	}
}