ec/compal: Convert to ASL 2.0 syntax
Change-Id: I934f9d1664f657597f15daed2d2d0c41cd124d21 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46096 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
This commit is contained in:
parent
fafd512842
commit
5b880a1333
3 changed files with 39 additions and 39 deletions
|
@ -9,7 +9,7 @@ Device (AC)
|
||||||
|
|
||||||
Method (_PSR)
|
Method (_PSR)
|
||||||
{
|
{
|
||||||
Store(ADPT, Local0)
|
Local0 = ADPT
|
||||||
Return(Local0)
|
Return(Local0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,13 +38,13 @@ Device (BATX)
|
||||||
// Method to enable full battery workaround
|
// Method to enable full battery workaround
|
||||||
Method (BFWE)
|
Method (BFWE)
|
||||||
{
|
{
|
||||||
Store (One, BFWK)
|
BFWK = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method to disable full battery workaround
|
// Method to disable full battery workaround
|
||||||
Method (BFWD)
|
Method (BFWD)
|
||||||
{
|
{
|
||||||
Store (Zero, BFWK)
|
BFWK = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Method (_STA, 0, Serialized)
|
Method (_STA, 0, Serialized)
|
||||||
|
@ -59,22 +59,22 @@ Device (BATX)
|
||||||
Method (_BIF, 0, Serialized)
|
Method (_BIF, 0, Serialized)
|
||||||
{
|
{
|
||||||
// Update fields from EC
|
// Update fields from EC
|
||||||
Store (BAM0, Index (PBIF, 0))
|
PBIF [0] = BAM0
|
||||||
Store (BDC0, Index (PBIF, 1))
|
PBIF [1] = BDC0
|
||||||
Store (BFC0, Index (PBIF, 2))
|
PBIF [2] = BFC0
|
||||||
Store (BDV0, Index (PBIF, 4))
|
PBIF [4] = BDV0
|
||||||
Divide(BFC0, 0x64, , Local1)
|
Local1 = BFC0 / 100
|
||||||
Multiply(Local1, 0x0A, Local1)
|
Local1 *= 10
|
||||||
Store(Local1, Index(PBIF, 5))
|
PBIF [5] = Local1
|
||||||
Divide(BFC0, 0x64, , Local1)
|
Local1 = BFC0 / 100
|
||||||
Multiply(Local1, 0x03, Local1)
|
Local1 *= 3
|
||||||
Store (Local1, Index (PBIF, 6))
|
PBIF [6] = Local1
|
||||||
|
|
||||||
Store (ToString(Concatenate(BATD, 0x00)), Index (PBIF, 9)) // model
|
PBIF [9] = ToString (Concatenate (BATD, 0x00)) // model
|
||||||
Store (ToHexString(BSN0), Index (PBIF, 10)) // serial
|
PBIF [10] = ToHexString (BSN0) // serial
|
||||||
Store (ToString(BMFN), Index (PBIF, 12)) // vendor
|
PBIF [12] = ToString (BMFN) // vendor
|
||||||
|
|
||||||
Store(BDN0, BTNM) // Save the battery number
|
BTNM = BDN0 // Save the battery number
|
||||||
|
|
||||||
Return (PBIF)
|
Return (PBIF)
|
||||||
}
|
}
|
||||||
|
@ -90,47 +90,47 @@ Device (BATX)
|
||||||
//
|
//
|
||||||
|
|
||||||
// Get battery state from EC and save it for the charging workaround
|
// Get battery state from EC and save it for the charging workaround
|
||||||
Store (BST0, Local0)
|
Local0 = BST0
|
||||||
Store (Local0, Index (PBST, 0))
|
PBST [0] = Local0
|
||||||
|
|
||||||
//
|
//
|
||||||
// 1: BATTERY PRESENT RATE/CURRENT
|
// 1: BATTERY PRESENT RATE/CURRENT
|
||||||
//
|
//
|
||||||
|
|
||||||
Store (BAC0, Local1)
|
Local1 = BAC0
|
||||||
Subtract(0xFFFF, Local1, Local1)
|
Local1 = 0xFFFF - Local1
|
||||||
Store (Local1, Index (PBST, 1))
|
PBST [1] = Local1
|
||||||
|
|
||||||
//
|
//
|
||||||
// 2: BATTERY REMAINING CAPACITY
|
// 2: BATTERY REMAINING CAPACITY
|
||||||
//
|
//
|
||||||
Multiply(BFC0, GAU0, Local1)
|
Local1 = BFC0 * GAU0
|
||||||
Divide(Local1, 0x64, Local2, Local1)
|
Local2 = Local1 % 100
|
||||||
|
Local1 /= 100
|
||||||
|
|
||||||
If (LAnd (BFWK, LAnd (ADPT, LNot (Local0)))) {
|
If (BFWK && ADPT && !Local0) {
|
||||||
// On AC power and battery is neither charging
|
// On AC power and battery is neither charging
|
||||||
// nor discharging. Linux expects a full battery
|
// nor discharging. Linux expects a full battery
|
||||||
// to report same capacity as last full charge.
|
// to report same capacity as last full charge.
|
||||||
// https://bugzilla.kernel.org/show_bug.cgi?id=12632
|
// https://bugzilla.kernel.org/show_bug.cgi?id=12632
|
||||||
Store (GAU0, Local2)
|
Local2 = GAU0
|
||||||
|
|
||||||
// See if within ~3% of full
|
// See if within ~3% of full
|
||||||
ShiftRight (Local2, 5, Local3)
|
Local3 = Local2 >> 5
|
||||||
If (LAnd (LGreater (Local1, Subtract (Local2, Local3)),
|
If ((Local1 > (Local2 - Local3)) && (Local1 < (Local2 + Local3)))
|
||||||
LLess (Local1, Add (Local2, Local3))))
|
|
||||||
{
|
{
|
||||||
Store (Local2, Local1)
|
Local1 = Local2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Store (Local1, Index (PBST, 2))
|
PBST [2] = Local1
|
||||||
|
|
||||||
//
|
//
|
||||||
// 3: BATTERY PRESENT VOLTAGE
|
// 3: BATTERY PRESENT VOLTAGE
|
||||||
//
|
//
|
||||||
Store (BPV0, Index (PBST, 3))
|
PBST [3] = BPV0
|
||||||
|
|
||||||
// Check the Battery Number
|
// Check the Battery Number
|
||||||
If(LNotEqual(BDN0, BTNM)) {
|
If(BDN0 != BTNM) {
|
||||||
Notify(BATX, 0x81)
|
Notify(BATX, 0x81)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -252,12 +252,12 @@ Device (EC0)
|
||||||
Method (_REG, 2, NotSerialized)
|
Method (_REG, 2, NotSerialized)
|
||||||
{
|
{
|
||||||
// Initialize AC power state
|
// Initialize AC power state
|
||||||
Store (ADPT, \PWRS)
|
\PWRS = ADPT
|
||||||
|
|
||||||
// Force a read of CPU temperature
|
// Force a read of CPU temperature
|
||||||
Store (CTML, Local0)
|
Local0 = CTML
|
||||||
/* So that we don't get a warning that Local0 is unused. */
|
/* So that we don't get a warning that Local0 is unused. */
|
||||||
Increment (Local0)
|
Local0++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ Device (EC0)
|
||||||
// AC Power Connected
|
// AC Power Connected
|
||||||
Method (_Q37, 0, NotSerialized)
|
Method (_Q37, 0, NotSerialized)
|
||||||
{
|
{
|
||||||
Store (One, \PWRS)
|
\PWRS = 1
|
||||||
Notify (AC, 0x80)
|
Notify (AC, 0x80)
|
||||||
Notify (BATX, 0x80)
|
Notify (BATX, 0x80)
|
||||||
// TODO ADD CPU power profile
|
// TODO ADD CPU power profile
|
||||||
|
@ -332,7 +332,7 @@ Device (EC0)
|
||||||
// AC Power Removed
|
// AC Power Removed
|
||||||
Method (_Q38, 0, NotSerialized)
|
Method (_Q38, 0, NotSerialized)
|
||||||
{
|
{
|
||||||
Store (Zero, \PWRS)
|
\PWRS = 0
|
||||||
Notify (AC, 0x80)
|
Notify (AC, 0x80)
|
||||||
Notify (BATX, 0x80)
|
Notify (BATX, 0x80)
|
||||||
// TODO ADD CPU power profile
|
// TODO ADD CPU power profile
|
||||||
|
@ -363,7 +363,7 @@ Device (EC0)
|
||||||
{
|
{
|
||||||
IF(WLEX) //if Wlan exist
|
IF(WLEX) //if Wlan exist
|
||||||
{
|
{
|
||||||
//TODO Store(WLAT, LANE)
|
//TODO LANE = WLAT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue