summaryrefslogtreecommitdiff
path: root/src/ec/starlabs/merlin/acpi/battery.asl
blob: 63f46013a3f6edb77e91dbfc53ff818970060b48 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* SPDX-License-Identifier: GPL-2.0-only */

Device (BAT0)
{
	Name (_HID, EisaId("PNP0C0A"))
	Name (_UID, 0)
	Method (_STA, 0, NotSerialized)
	{
		// Battery Status
		// 0x80 BIT1 0x01 = Present
		// 0x80 BIT1 0x00 = Not Present
		If (ECPS & 0x02)
		{
			Return (0x1F)
		}
		Return (0x0F)
	}

	Name (SBIF, Package (13)
	{
		1,					//  0: Power Unit			0:	mWh
							//					1:	mA
		0xffffffff,				//  1: Design Capacity
		0xffffffff,				//  2: Last Full Charge Capacity
		1,					//  3: Battery Technology		0:	Primary (non-rechargeable)
							//					1:	Secondary (rechargeable)
		0xffffffff,				//  4: Design Voltage
		0,					//  5: Design capacity of Warning
		0,					//  6: Design capacity of Low
		0xffffffff,				//  7: Battery capacity Decrement Granularity
		0xffffffff,				//  8: Battery capacity Increment Granularity
		CONFIG_EC_STARLABS_BATTERY_MODEL,	//  9: Model Number
		"Unknown",				// 10: Serial Number
		CONFIG_EC_STARLABS_BATTERY_TYPE,	// 11: Battery Type
		CONFIG_EC_STARLABS_BATTERY_OEM		// 12: OEM Information
	})
	Method (_BIF, 0, NotSerialized)
	{
		If (B1DC) {
			SBIF  [1] = B1DC
			If (B1FC != 0xffff) {
				SBIF  [2] = B1FC
			} Else {
				SBIF  [2] = B1DC
			}
			SBIF  [4] = B1DV
			SBIF  [5] = B1DC / 5	// 20%
			SBIF  [6] = B1DC / 20	// 5%
			SBIF  [7] = B1DC / 500	// 0.2%
			SBIF  [8] = B1DC / 500	// 0.2%
			If (B1SN != 0xffff) {
				SBIF [10] = B1SN
			}
		}
		Return (SBIF)
	}

	Name (XBIF, Package (21)
	{
		1,					//  0: Revision				0:	3.0
							//					1:	4.0
		1,					//  1: Power Unit			0:	mWh
							//					1:	mA
		0xffffffff,				//  2: Design Capacity
		0xffffffff,				//  3: Last Full Charge Capacity
		1,					//  4: Battery Technology		0:	Primary (non-rechargeable)
							//					1:	Secondary (rechargeable)
		0xffffffff,				//  5: Design Voltage
		0xffffffff,				//  6: Design Capacity of Warning
		0xffffffff,				//  7: Design Capacity of Low
		0xffffffff,				//  8: Cycle Count
		2,					//  9: Measurement Accuracy
		5000,					// 10: Max Sampling Time (ms)
		1000,					// 11: Min Sampling Time (ms)
		5000,					// 12: Max Averaging Interval
		1000,					// 13: Min Averaging Interval
		0xffffffff,				// 14: Battery Capacity Decrement Granularity
		0xffffffff,				// 15: Battery Capacity Increment Granularity
		CONFIG_EC_STARLABS_BATTERY_MODEL,	// 16: Model Number
		"Unknown",				// 17: Serial Number
		CONFIG_EC_STARLABS_BATTERY_TYPE,	// 18: Battery Type
		CONFIG_EC_STARLABS_BATTERY_OEM,		// 19: OEM Information
		1,					// 20: Swapping Capability		0:	Non swappable
							//					1:	Cold swappable
							//					16:	Hot swappable
	})
	Method (_BIX, 0, NotSerialized)
	{
		If (B1DC) {
			XBIF  [2] = B1DC
			If (B1FC != 0xffff) {
				XBIF  [3] = B1FC
			} Else {
				XBIF  [3] = B1DC
			}
			XBIF  [5] = B1DV
			XBIF  [6] = B1DC / 5	// 20%
			XBIF  [7] = B1DC / 20	// 5%
			If (B1CC != 0xffff) {
				XBIF  [8] = B1CC
			}
			XBIF [14] = B1DC / 500	// 0.2%
			XBIF [15] = B1DC / 500	// 0.2%
			If (B1SN != 0xffff) {
				XBIF [17] = B1SN
			}
		}
		Return (XBIF)
	}

	Name (PKG1, Package (4)
	{
		0xffffffff,	//  0: Battery State
		0xffffffff,	//  1: Battery Present Rate
		0xffffffff,	//  2: Battery Remaining Capacity
		0xffffffff,	//  3: Battery Present Voltage
	})
	Method (_BST, 0, NotSerialized)
	{
		PKG1[0] = (B1ST & 0x07)
		PKG1[1] = B1PR
		If (B1RC != 0xffff) {
			PKG1[2] = B1RC
		} Else {
			PKG1[2] = B1RP * (B1DC / 100)
		}
		PKG1[3] = B1PV
		Return (PKG1)
	}
	Method (_PCL, 0, NotSerialized)
	{
		Return (
			Package() { _SB }
		)
	}
}