summaryrefslogtreecommitdiffstats
path: root/src/mainboard/razer/blade_stealth_kbl/acpi/ec.asl
blob: 5698dcbbcf6c031ec8e99944173771d5f499b4a1 (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
/* SPDX-License-Identifier: GPL-2.0-only */

Device (EC)
{
	Name (_HID, EisaId ("PNP0C09"))
	Name (_UID, 0)
	Name (_GPE, 0x50) // Copied over

	Name (_CRS, ResourceTemplate () {
		IO (Decode16, 0x62, 0x62, 0, 1)
		IO (Decode16, 0x66, 0x66, 0, 1)
	})

	Name (ACEX, 0)

	OperationRegion (ERAM, EmbeddedControl, 0x00, 0xFF)
	Field (ERAM, ByteAcc, NoLock, Preserve)
	{
		Offset (0x1C),
		ODP1,   8,
		ODP2,   8,
		Offset (0x56),
		CPUT,   8,
		CPU1,   8,
		GPUT,   8,
		ADPV,   16,
		ADPC,   16,
		FANC,   8,
		Offset (0x60),
		BSER,   256, // BAT Serial Number
		Offset (0x90),
		BIF0,   16,
		BDCP,   16, // BAT Design Capacity
		BFCP,   16, // BAT Full Capacity
		BRCH,   16, // BAT Rechargable
		BDVT,   16, // BAT Design Voltage
		BIF5,   16,
		BIF6,   16,
		BIF7,   16,
		BIF8,   16,
		BCST,   16, // BAT Current State
		BCRT,   16, // BAT Current Rate
		BRCP,   16, // BAT Remaining Capacity
		BCVT,   16, // BAT Current Voltage
		PWRS,   8,  // Power State (?)
		ECN0,   8,
		Offset (0xB0),
		SRNM,   16,
		MFDA,   16,
		PHMR,   8,
		BLDA,   8,
		Offset (0xE2),
		LIDS,   8   // Lid state
	}

	Method (_REG, 2, NotSerialized)
	{
		/* Initialize AC power state */
		Store (PWRS - 0x82, ACEX)

		/* Initialize LID switch state */
		Store (LIDS, \LIDS)
	}


	// Close ?
	Method (_Q14, 0, NotSerialized)
	{
		Store (LIDS, \LIDS)
		Notify (LID0, 0x80)
	}

	//Open
	Method (_Q15, 0, NotSerialized)
	{
		Store (LIDS, \LIDS)
		Notify (LID0, 0x80)
	}


	// AC plugged
	Method (_Q13, 0, NotSerialized)
	{
		Store (PWRS - 0x82, ACEX)
		Notify (BAT, 0x80) // Status Change
		Notify (BAT, 0x81) // Information Change
		Notify (AC, 0x80) // Status Change
	}

	#include "ac.asl"
	#include "battery.asl"
}