summaryrefslogtreecommitdiff
path: root/src/ec/purism/librem-ec/acpi/battery_thresholds.asl
blob: 3bb1330fbf0b5bcbdddfcf6b73904645e221c21b (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
/* SPDX-License-Identifier: GPL-2.0-only */

Field (ERAM, ByteAcc, Lock, Preserve)
{
	Offset (0xBC),
	BTL0,   8,      /* BAT0 charging start threshold */
	BTH0,   8,      /* BAT0 charging end threshold */
}

/*
 * Get battery charging threshold
 *
 * Arg0: 0: Start threshold
 *       1: Stop threshold
 */
Method (GBCT, 1, NotSerialized)
{
	If (Arg0 == 0) {
		Return (BTL0)
	}

	If (Arg0 == 1) {
		Return (BTH0)
	}

	Return (0xFF)
}

/*
 * Set battery charging threshold
 *
 * Arg0: 0: Start threshold
 *       1: Stop threshold
 * Arg1: Percentage
 */
Method (SBCT, 2, NotSerialized)
{
	If (Arg1 <= 100) {
		If (Arg0 == 0) {
			BTL0 = Arg1
		}
		If (Arg0 == 1) {
			BTH0 = Arg1
		}
	}
}