RehabMan / Laptop-DSDT-Patch

Common DSDT patches for Ivy/Sandy/Haswell laptops for running OS X
Other
679 stars 319 forks source link

/battery/battery_HP-Pavilion-n012tx.txt also works for HP-Pavilion-bc015tx #89

Open the-eric-kwok opened 4 years ago

the-eric-kwok commented 4 years ago

battery_HP-Pavilion-n012tx.txt This patch is working for HP-Pavilion-bc015tx

the-eric-kwok commented 4 years ago

It seems that battery percentage cannot update after booted up.

the-eric-kwok commented 4 years ago
#Maintained by: RehabMan for: Laptop Patches
#battery_HP-Pavilion-bc015tx.txt

# Modified from battery_HP-Pavilion-n012tx.txt by rockvignesh25
# 2020-2-17 modified by the-eric-kwok

# Works for:
HP-Pavilion-bc015tx

# Split BADC -> ADC0, ADC1
into device label EC0 code_regex BADC,\s+16, replace_matched begin ADC0,8,ADC1,8, end;

# Split BFCC -> FCC0, FCC1
into device label EC0 code_regex BFCC,\s+16, replace_matched begin FCC0,8,FCC1,8, end;
into method label UPBI code_regex \(\^\^PCI0\.LPCB\.EC0\.BFCC, replaceall_matched begin (B1B2(\^\^PCI0\.LPCB\.EC0\.FCC0,\^\^PCI0\.LPCB\.EC0\.FCC1), end;

# Split MCUR -> CUR0, CUR1
into device label EC0 code_regex MCUR,\s+16, replace_matched begin CUR0,8,CUR1,8, end;
into method label UPBS code_regex \(\^\^PCI0\.LPCB\.EC0\.MCUR, replaceall_matched begin (B1B2(\^\^PCI0\.LPCB\.EC0\.CUR0,\^\^PCI0\.LPCB\.EC0\.CUR1), end;

# Split MBRM -> BRM0, BRM1
into device label EC0 code_regex MBRM,\s+16, replace_matched begin BRM0,8,BRM1,8, end;
into method label UPBS code_regex \(\^\^PCI0\.LPCB\.EC0\.MBRM, replaceall_matched begin (B1B2(\^\^PCI0\.LPCB\.EC0\.BRM0,\^\^PCI0\.LPCB\.EC0\.BRM1), end;
into method label CLRI code_regex \(\^\^LPCB\.EC0\.MBRM, replaceall_matched begin (B1B2(\^\^LPCB\.EC0\.BRM0,\^\^LPCB\.EC0\.BRM1), end;

# Split MBCV -> BCV0, BCV1
into device label EC0 code_regex MBCV,\s+16, replace_matched begin BCV0,8,BCV1,8, end;
into method label UPBS code_regex \(\^\^PCI0\.LPCB\.EC0\.MBCV, replaceall_matched begin (B1B2(\^\^PCI0\.LPCB\.EC0\.BCV0,\^\^PCI0\.LPCB\.EC0\.BCV1), end;

into device label EC0 code_regex (SMD0,)\s+(256) replace_matched begin SMDX,%2,//%1%2 end;

# Method: 16 bit -> 2 x 8 bit
into method label B1B2 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B2, 2, NotSerialized) { Return(Or(Arg0, ShiftLeft(Arg1, 8))) }\n
end;

# Method to write/read buffers to/from EC0
into method label WE1B parent_label EC0 remove_entry;
into method label WECB parent_label EC0 remove_entry;
into device label EC0 insert
begin
Method (WE1B, 2, NotSerialized)\n
{\n
    OperationRegion(ERAM, EmbeddedControl, Arg0, 1)\n
    Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }\n
    Store(Arg1, BYTE)\n
}\n
Method (WECB, 3, Serialized)\n
// Arg0 - offset in bytes from zero-based EC\n
// Arg1 - size of buffer in bits\n
// Arg2 - value to write\n
{\n
    ShiftRight(Arg1, 3, Arg1)\n
    Name(TEMP, Buffer(Arg1) { })\n
    Store(Arg2, TEMP)\n
    Add(Arg0, Arg1, Arg1)\n
    Store(0, Local0)\n
    While (LLess(Arg0, Arg1))\n
    {\n
        WE1B(Arg0, DerefOf(Index(TEMP, Local0)))\n
        Increment(Arg0)\n
        Increment(Local0)\n
    }\n
}\n
end;

into method label SMWR code_regex Store\s?\(Arg3,\s?\SMD0\) replaceall_matched begin WECB(0x04,256,Arg3) end;

this is my battery patch