Contribute
Register

HP Pavilion 15 (Kaby Lake) - Battery Status only working *sometimes*

Status
Not open for further replies.
After a combination of using ACPIDebug, studying a working DSDT for a machine similar to mine and harnessing my sheer obsessiveness/stubbornness, I managed to find the offending bit of code that is getting the battery stuck.

Code:
Method (SMRD, 4, NotSerialized)
    {
        If (LNot (ECOK))
            {
                Return (0xFF)
            }
....

So I changed this to the following...

Code:
Method (SMRD, 4, NotSerialized)
    {
        If (LEqual (ECOK, One))
            {
                Return (0xFF)
            }
....

... and now my issue is fixed! Battery and AC are working correctly, battery status no longer gets stuck and correct percentage is reported in both macOS and Windows upon every reboot :headbang:

In light of this, I'd like to mark this as resolved, but first I'm hoping you can answer a couple of questions for me:

1) What exactly does this change do to fix the status?
2) Is the edit I've made correct/safe as it stands or would you suggest implementing it another way?

What is setting ECOK to zero?

ACPI spec:
LNot is "Logical Not".
Description
If the value is zero True is returned; otherwise, False is returned.

The code is trying to check whether it is ok to access the EC before doing so. You should probably investigate why ECOK gets set to zero. Clearly, it should be non-zero.
 
What is setting ECOK to zero?

ACPI spec:
LNot is "Logical Not".
Description
If the value is zero True is returned; otherwise, False is returned.

The code is trying to check whether it is ok to access the EC before doing so. You should probably investigate why ECOK gets set to zero. Clearly, it should be non-zero.

Code:
Name (ECOK, Zero)

Would this be it? Have tried changing it to Name (ECOK, One) but doesn't seem to make any difference.

Please could you have a look at my DSDT for me? I'm happy to accept the fix that I've implemented as it returns the results that I want, but if there's a more proper way of fixing this I'd definitely like to use that instead.

I've attached my vanilla DSDT and the patched DSDT that I'm currently using... can't imagine you'd need the full problem reporting set as the issue has now been identified. Any help very much appreciated. Thanks in advance and thanks for all your help and advice so far :)
 

Attachments

  • DSDT (patched).aml
    130.4 KB · Views: 130
  • DSDT (vanilla).aml
    127.7 KB · Views: 99
Code:
Name (ECOK, Zero)

Would this be it? Have tried changing it to Name (ECOK, One) but doesn't seem to make any difference.

Please could you have a look at my DSDT for me? I'm happy to accept the fix that I've implemented as it returns the results that I want, but if there's a more proper way of fixing this I'd definitely like to use that instead.

I've attached my vanilla DSDT and the patched DSDT that I'm currently using... can't imagine you'd need the full problem reporting set as the issue has now been identified. Any help very much appreciated. Thanks in advance and thanks for all your help and advice so far :)

ECOK is set to 1 in _REG.

Note:
Code:
            Method (_REG, 2, NotSerialized)  // _REG: Region Availability
            {
                If (LAnd (LEqual (Arg0, 0x03), LEqual (Arg1, One)))
                {
                    Store (One, ECOK)
                    GBAS ()
                    ECMI ()
                }
            }
 
ECOK is set to 1 in _REG.

Note:
Code:
            Method (_REG, 2, NotSerialized)  // _REG: Region Availability
            {
                If (LAnd (LEqual (Arg0, 0x03), LEqual (Arg1, One)))
                {
                    Store (One, ECOK)
                    GBAS ()
                    ECMI ()
                }
            }

What does it need to be set to? What do I need to change?
 
What does it need to be set to? What do I need to change?

_REG should be called when the platform EC handler initializes.
At that time, ECOK would be set to 1.
You can use ACPIDebug.kext to verify that _REG is called and the method executes from beginning to end.
You can also use ACPIDebug.kext to see what the value of ECOK is at various methods in the battery code.
 
Is there a major drawback to just changing the query in SMRD as I've done? Will this run the risk of breaking other stuff?
 
Is there a major drawback to just changing the query in SMRD as I've done? Will this run the risk of breaking other stuff?

I would try to get at the root of the problem.
 
I would try to get at the root of the problem.
Fair enough, I'll delve into this when I have a little more time/energy/sanity. Happy that I've got the issue fixed temporarily anyhow. Cheers again for your help and I'll post back here when I get a chance to seek out the root problem.
 
Popyura can you tell me please which patch you used to make work f2 f3 thx.
 
Status
Not open for further replies.
Back
Top