| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
|
| 3 |
|
| 4 |
Scope(\_SB.PCI0.LPCB.EC) |
| 5 |
{ |
| 6 |
Field (ERAM, ByteAcc, NoLock, Preserve) |
| 7 |
{ |
| 8 |
Offset (0xb0), |
| 9 |
TSL0, 8, /* Battery0 start threshold */ |
| 10 |
Offset (0xb1), |
| 11 |
TSH0, 8, /* Battery0 stop threshold */ |
| 12 |
Offset (0xb2), |
| 13 |
TSL1, 8, /* Battery1 start threshold */ |
| 14 |
Offset (0xb3), |
| 15 |
TSH1, 8, /* Battery1 stop threshold */ |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
Scope(\_SB.PCI0.LPCB.EC.BAT0) |
| 20 |
{ |
| 21 |
/* |
| 22 |
* Set threshold on battery0 |
| 23 |
* |
| 24 |
* Arg0: 0: Start threshold |
| 25 |
* 1: Stop threshold |
| 26 |
* Arg1: Percentage |
| 27 |
*/ |
| 28 |
Method (SETT, 2, NotSerialized) |
| 29 |
{ |
| 30 |
if (Arg1 <= 100) |
| 31 |
{ |
| 32 |
if (Arg0 == 0) |
| 33 |
{ |
| 34 |
TSL0 = Arg1 |
| 35 |
} |
| 36 |
if (Arg0 == 1) |
| 37 |
{ |
| 38 |
TSH0 = Arg1 |
| 39 |
} |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Get threshold on battery0 |
| 45 |
* |
| 46 |
* Arg0: 0: Start threshold |
| 47 |
* 1: Stop threshold |
| 48 |
*/ |
| 49 |
Method (GETT, 1, NotSerialized) |
| 50 |
{ |
| 51 |
if (Arg0 == 0) |
| 52 |
{ |
| 53 |
Return (TSL0) |
| 54 |
} |
| 55 |
if (Arg0 == 1) |
| 56 |
{ |
| 57 |
Return (TSH0) |
| 58 |
} |
| 59 |
Return (0) |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
Scope(\_SB.PCI0.LPCB.EC.BAT1) |
| 64 |
{ |
| 65 |
/* |
| 66 |
* Set threshold on battery1 |
| 67 |
* |
| 68 |
* Arg0: 0: Start threshold |
| 69 |
* 1: Stop threshold |
| 70 |
* Arg1: Percentage |
| 71 |
*/ |
| 72 |
Method (SETT, 2, NotSerialized) |
| 73 |
{ |
| 74 |
if (Arg1 <= 100) |
| 75 |
{ |
| 76 |
if (Arg0 == 0) |
| 77 |
{ |
| 78 |
TSL1 = Arg1 |
| 79 |
} |
| 80 |
if (Arg0 == 1) |
| 81 |
{ |
| 82 |
TSH1 = Arg1 |
| 83 |
} |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Get threshold on battery1 |
| 89 |
* |
| 90 |
* Arg0: 0: Start threshold |
| 91 |
* 1: Stop threshold |
| 92 |
*/ |
| 93 |
Method (GETT, 1, NotSerialized) |
| 94 |
{ |
| 95 |
if (Arg0 == 0) |
| 96 |
{ |
| 97 |
Return (TSL1) |
| 98 |
} |
| 99 |
if (Arg0 == 1) |
| 100 |
{ |
| 101 |
Return (TSH1 & ~0x80) |
| 102 |
} |
| 103 |
Return (0) |
| 104 |
} |
| 105 |
} |