Jump to content

HP DVx ACPI 3.x/4.x Battery Driver (10.6/10.7)


gsly
 Share

229 posts in this topic

Recommended Posts

sorry.. you mean to rename the patch_dv7 to dv6.. and use it

 

but I looked inside it.. and seen invidia patch.. and most dv6 (as mine) with sandybridge i7 hasn't invidia..

they have ATI HD

Link to comment
Share on other sites

sorry.. you mean to rename the patch_dv7 to dv6.. and use it

 

but I looked inside it.. and seen invidia patch.. and most dv6 (as mine) with sandybridge i7 hasn't invidia..

they have ATI HD

Yes, this is for the older version of DV6/DV7, without Sandy Bridge.

Just replace that part with your own DSDT fix for ATI (or whatever else). Make sure to add new line endings (\n) at the end of every line. There might be some other changes required, but I don't have the platform to test.

Also, guys, please don't OT, spamming and hijacking gsly's topic.

 

gsly, what about that beer? You said you don't turn down beer, so is there any way I can buy you one or two? :)

 

This patch doesn't make much sense to me, because if the original file had a missing or extra } the parser would fail

The parser does fail on the decompiled DV6 DSL, that's why that nasty hack is needed.

Link to comment
Share on other sites

ok. i'm not noob in scripting.. but prefer to do manually dsdt.

i'll check your patch.. only because I need to run audio!

i manually fixed 99% of my dsdt.. with experiences. lpc/smbus/hd3000/ati works.. but wlan 4313 and audio.. not.

 

to be not OT.. I'll test your patch to see the battery fixed!

 

see later

Link to comment
Share on other sites

please can someone post the fix dsdt for dv 6 i have a dv 6543 with 10.6.8 and i dont have dsdt and i dont know hot to produce it

 

please can someone post the fix dsdt for dv 6 i have a dv 6543 with 10.6.8 and i dont have dsdt and i dont know hot to produce it

Link to comment
Share on other sites

  • 3 weeks later...
Hello I tried to get your stuff into my dsdt.

But I do not know to put the things together.

May I ask you to help me?

 

Just in case I attached my dsdt.

 

Thanks in advance

 

dsdt_6510b.aml.zip

 

 

Hi.

 

Your laptop supports 2 batteries.

Here is your DSDT modified, i have renamed a few devices and methods.

Maybe you can try it and make a report with IORegistryExplorer, then post it here ?

Do you own the second battery (named "Travel" in DSDT) ?

 

dsdt_6510b.dsl.zip

Link to comment
Share on other sites

please can someone post the fix dsdt for dv 6 i have a dv 6543 with 10.6.8 and i dont have dsdt and i dont know hot to produce it

 

 

You can extract it from system with DSDT Editor, available here; http://www.insanelymac.com/forum/index.php?showtopic=223205

Direct link: http://www.insanelymac.com/forum/index.php...t&id=102945

 

Start DSDT Editor, then in File menu select Extract.

 

Do not use somebody's else DSDT, just build your own.

 

Edit:

 

According to HP website, your laptop uses same bios as mine (Phoenix F.5A, for Quanta motherboard).

I recommend that you extract your own, some addresses depends on installed memory size.

Once extracted, it is quite simple, just follow instructions in glsy's first post, apply all patches, use AppleSmartBatteryManager.kext in /S/L/E (backup existing one first) and enjoy.

On my lappy i need "UseExtraBatteryInformationMethod" set to true, otherwise no power info in System Profiler.

You can also find a modded bios (no whitelist) on http://forums.mydigitallife.info

Link to comment
Share on other sites

The parser does fail on the decompiled DV6 DSL, that's why that nasty hack is needed.

Actually not on the decompiled, but after these patches

into device name_adr 0x001C0004 code_regex \}\n\s*Else\n\s*\{ remove_matched;
#
into device name_adr 0x001C0004 code_regex PMSX,\s*1\n\s*}\n\s*If\s\(IGDS\)\n\s*\{ replace_matched
begin
PMSX,   1\n
}
end;
# in the second you could have used this with same effect
# [b]into device name_adr 0x001C0004 code_regex If\s\(IGDS\)\n\s*\{ remove_matched;[/b]

They remove

				If (IGDS)
			{
			}
			Else
			{

and leave this without pair

				}

which is removed by

into method label _RMV parent_type device parent_label J384 code_regex Return\s\(One\)\n\s*\} replace_matched
begin
Return (One)\n
end;

J384 is the last device inside that Else.

 

into method label PR08 parent_type device parent_label J384 code_regex Return\s\(PR08\)\n\s*\} replace_matched
begin
Return (One)\n    // shouldn't be [b]Return (PR08)\n[/b] here?
end;

 

Sorry for the OT. Should I move this discussion to the DSDT Editor topic?

Link to comment
Share on other sites

Hi.

 

Your laptop supports 2 batteries.

Here is your DSDT modified, i have renamed a few devices and methods.

Maybe you can try it and make a report with IORegistryExplorer, then post it here ?

Do you own the second battery (named "Travel" in DSDT) ?

 

Yes, I have one.

Using only the internal it looks pretty good.

The icon shows time and percentage

There is an error in collecting Sys information for power supply

 

If travel bat is connected the icon states not loading

nc6510_bat.ioreg.zip

Link to comment
Share on other sites

Yes, I have one.

Using only the internal it looks pretty good.

The icon shows time and percentage

There is an error in collecting Sys information for power supply

 

If travel bat is connected the icon states not loading

 

You are the tester glsy was looking for in this post

 

I'm still looking why System Profiler hangs with AppleSmartBatteryManager.kext as i got same problem.

Link to comment
Share on other sites

Yragael, did you saw that?

 

Sorry, i had no access to insanelymac since yersterday.

Do you mean you had AppleACPIPlatform.kext from 10.6.7 ?

The modifications i have made in DSDT are only cosmetic, just renamed a few devices and functions, then i have seen two batteries so i told you about glsy looking for tester with 2 batteries computer.

I have found a thread about dv6x20s with interesting informations, you can find it here.

I'm gonna look if i can help you, but i'm far from being an ACPI guru :-(

 

Edit:

 

Can you try this dsdt ? rewrote some parts of UPBS and UPBI to get 8 bits values from EC0.

Also added ARPT and FRWR devices, reorganized code so it is more readable in DSDT Editor.

 

let me know how it works please.

 

dsdt_6510b.zip

 

Another thing, can you check with AppleSmartBatteryManager, then with AppleACPIBatteryManager ?

Link to comment
Share on other sites

Can you try this dsdt ? rewrote some parts of UPBS and UPBI to get 8 bits values from EC0.

Also added ARPT and FRWR devices, reorganized code so it is more readable in DSDT Editor.

 

let me know how it works please.

 

dsdt_6510b.zip

 

Another thing, can you check with AppleSmartBatteryManager, then with AppleACPIBatteryManager ?

 

Thank you very much.

It looks pretty good now. (Correct kext from Lion loaded)

The behavior is the same. System profiler did not work on both.

What to look for in detail?

Link to comment
Share on other sites

Thank you very much.

It looks pretty good now. (Correct kext from Lion loaded)

The behavior is the same. System profiler did not work on both.

What to look for in detail?

 

As far as i can see, the problem with System Profiler comes from a null pointer, but i do not know nothing about debugging on Mac OS (trying to learn).

Launching /usr/sbin/system_profiler in gdb with parameter SPPowerDataType returns bad access memory at address 0x00000000

As i got same problem, i'll let you know as soon as i have found what is wrong.

Please send me IoregistryExplorer report for each kext.

What about battery icon or iStat/CoconutBattery ?

Do they report correctly ?

 

Forgot to mention, your DSDT includes a lot of windows specific stuff, that you can safely remove.

Link to comment
Share on other sites

Please send me IoregistryExplorer report for each next.

All ioreg are taken with travel bat attached

nc6510_apple_acpi_bat_mgmt.ioreg.zip

nc6510_apple_smart_bat_mgmt.ioreg.zip

 

What about battery icon or iStat/CoconutBattery ?

iStat craches, CoconutBattery shows nothing with acpi_bat kext and a bit more info with smart_bat kext

 

Do they report correctly ?

If the travel bat is not attached the time and percentage seems to be correct.

 

Forgot to mention, your DSDT includes a lot of windows specific stuff, that you can safely remove.

how to identify what could be deleted?

Link to comment
Share on other sites

Ok, little progress on my side, it seems that Lion's System Profiler requires some data returned by BBIX.

On my laptop, i need "UseExtraBatteryInformationMethod" to return some mandatory data, otherwise system_profiler SPPowerDataType hangs (null pointer to some string).

 

Using ACPI3 or ACPI4 method works fine, but only when returning extended informations.

 

As soon as i find the missing parameter, i think we'll be able to fake the system so system_profiler is happy.

 

Strange thing is that now i've lost Power Adapter informations :-(

 

About DSDT cleaning, a good start is to remove devices and methods used only by HP specific windows software, you may look for PNPxxxx strings to know about them, but i would recommend to do it only when your laptop is fully operational.

 

As i already told you, i'm not an ACPI guru :-)

Link to comment
Share on other sites

  • 2 weeks later...

Dear Yragael, I have read all the instruction on the first post but since I have zero knowledge of the DSDT I need to ask someone some clarification before proceeding. My laptop is an old HP pavilion DV6700 series (specifics in the signature). Considering my attached DSDT which are the steps that I need to follow? All the 1 2a, 2b, 2c? why some of them are called optional? Thanks for the clarification

Link to comment
Share on other sites

Thanks for the driver - works better then the previous (also quite good) version!

 

Even iStat Pro shows all the information (except cycles shown as 0, but its really not the big deal). System Profiler also shows all the info correctly (cycles also shown as 0).

 

Tested on HP DV1660se X.6.8. Used ACPI 3.X version.

Link to comment
Share on other sites

ASUS NOTEBOOK. Working both in Snow Leopard 10.6.8 and Lion 10.7.2

 

smartbatteryscreenshots.pngsmartbatteryscreenshotl.png

 

Yes. Got gsly's AppleSmartBatteryManager to work on my Asus M60J.

 

In the interest of helping other Asus notebook owners with similar dsdts, I'll provide how I made it happen. But, it is not my intent to steal gsly's glory. All this was made possible thanks to him. I'm only adapting his project to my Asus notebook. Also thanks to bcc9 for deriving the formula for taking a 16-bit reference and breaking it down into high-byte and low-byte to do byte (8-bit) references.

 

Back in post# 47, gsly provided abundant comments for another Asus notebook dsdt, the G53S. My BAT0 dsdt is nearly identical. So, all those comments on that Asus dsdt were really helpful in helping me figuring out what was going on with my own dsdt. Thanks gsly for doing that.

 

My Asus doesn't seem to use much SMBus access to the battery register sensors. It's making much use of EC access to the battery registers.

 

The Asus notebook BAT0 dsdt is quite different from the HP BAT0 dsdt. It has several more Method subroutines and it does all kinds of calculations based on what it detects. In the end, it does quite a good job of returning the battery values in accordance with the ACPI 3.x specs. The problem is that it was set to convert the units mAh to mWh and 2 things were happening wrong with that conversion. Design Capacity and Last Full Charge Capacity were kept in mAh and were 1000 times too small while the Current Capacity was converted to mWh. That created remaining percentages of over 115,000% and the inability to calculate remaining time. So, my goal was to prevent the conversion and fix it so it returns mAh units.

 

If the original Methods FBIF, CBIF and CBST in your Asus dsdt look like below, then the modification should work for you.

 

CODE

 

// If the Methods FBIF, CBIF and CBST in your original Asus notebook battery look like below, the

// recommended modifications shoud work for you

 

Method (FBIF, 5, NotSerialized)

{

Store (Arg0, PUNT)

Store (Arg1, Local1)

Store (Arg2, Local2)

If (LEqual (PUNT, 0x00))

{

Multiply (Local1, 0x0A, Local1)

Multiply (Local2, 0x0A, Local2)

}

 

Store (Arg0, Index (PBIF, 0x00))

Store (Local1, Index (PBIF, 0x01))

Store (Local2, Index (PBIF, 0x02))

Store (Local2, LFCC)

Store (Arg3, Index (PBIF, 0x03))

Store (Arg4, Index (PBIF, 0x04))

Divide (Local1, 0x0A, Local3, Local5)

Store (Local5, Index (PBIF, 0x05))

Divide (Local1, 0x64, Local3, Local6)

Store (Local6, Index (PBIF, 0x06))

Store (Local6, LOW2)

Divide (Local1, 0x64, Local3, Local7)

Store (Local7, Index (PBIF, 0x07))

Store (Local7, Index (PBIF, 0x08))

}

 

Method (CBIF, 0, NotSerialized)

{

If (PUNT)

{

Store (DerefOf (Index (PBIF, 0x04)), Local0)

Add (Local0, 0x01F4, Local0)

Divide (Local0, 0x03E8, Local1, DVOT)

Store (Zero, Index (PBIF, 0x00))

Multiply (DerefOf (Index (PBIF, 0x01)), DVOT, Index (PBIF, 0x01

))

Multiply (DerefOf (Index (PBIF, 0x02)), DVOT, Index (PBIF, 0x02

))

Multiply (DerefOf (Index (PBIF, 0x05)), DVOT, Index (PBIF, 0x05

))

Multiply (DerefOf (Index (PBIF, 0x06)), DVOT, Index (PBIF, 0x06

))

Multiply (DerefOf (Index (PBIF, 0x07)), DVOT, Index (PBIF, 0x07

))

Multiply (DerefOf (Index (PBIF, 0x08)), DVOT, Index (PBIF, 0x08

))

}

}

 

Method (CBST, 0, NotSerialized)

{

If (PUNT)

{

Multiply (DerefOf (Index (PBST, 0x01)), DVOT, Index (PBST, 0x01

))

Multiply (DerefOf (Index (PBST, 0x02)), DVOT, Index (PBST, 0x02

))

}

}

 

 

1) IN SNOW LEOPARD

 

-mWh Units

If you're fine with having the units in mWh, then all you need to do is change Store (Zero, Index (PBIF, 0x00)) to Store (One, Index (PBIF, 0x00)) in the Method CBIF. That's it! iStat will report a battery current about 10 times too high, but the capacity values and remaining times and percentages will all be accurate.

 

-mAh Units

This is the preferred unit in Mac OS X. It requires a little editing of Methods FBIF, CBIF and CBST. For some reason, when retrieving values in mAh, the capacities will be 1.85% too small. 1.85% doesn't sound like much, but my capacities are in the 4000 mAh range. That was causing them to be about 79 mAh too small compared to the mAh values in Windows 7 with BatteryEater Pro. It was also causing a little percentage anomaly. Percentages would go straight from 100% down to 97% when discharging and straight from 97% to 100% when recharging, never seeing 98% and 99%. That's why I'm applying a 1.85% correction (that's times 185 divided by 10,000)

 

Here's the Mehod FBIF, CBIF and CBST edits to accurately have to units in mAh. Just replace your Methods FBIF, CBIF and CBST with my corrected ones.

 

Asus_SnowLeo_Corrected.dsl.zip

 

 

2) LION 10.7.2

 

-mAh Units

Okay. I was in for a surprise on this one. My battery EC registers are all 16-bit at Offset (0xA0) from B0VL to B0DV. They're all mirrored by B1VL to B1DV also 16-bit. But those B1xx variables are never executed in the conditional loops, so the battery EC registers that matter are the B0xx. I converted all of those to 8-bit reference based on bcc9's method.

 

I did this for the all 8 battery B0xx registers and one B0SN register. With all that conversion to 8-bit, gsly's AppleSmartBattery was still working flawless in Snow Leopard, as a testimony that my 8-bit conversion was done correctly. But it wasn't working Lion, all I had was 0, -1 and unknown for the values.

 

Then I made a puzzling discovery. I discovered that the only reason why the Fill Battery Information Method (Method FBIF) or Method _BIF was failing in Lion, was not because the battery EC registers were accessed in 16-bit, but because the Method that extracts the Battery OEM information string (Method BIF9) has an incompatibility with Lion and that alone was causing the whole Method FBIF or Method _BIF to fail. There's something incompatible with this Method BIF9

 

CODE

Method (BIF9, 0, NotSerialized)

{

Name (BSTR, Buffer (0x20) {})

Store (SMBR (RDBL, BADR, 0x21), Local0)

If (LNotEqual (DerefOf (Index (Local0, Zero)), Zero))

{

Store (MNAM, BSTR)

Store (Zero, Index (BSTR, 0x04))

}

Else

{

Store (DerefOf (Index (Local0, 0x02)), BSTR)

Store (Zero, Index (BSTR, DerefOf (Index (Local0, One))))

}

 

Return (BSTR)

}

 

I don't know how to fix that one.

 

*** EDIT 26 Nov **: SOLVED!! With the help of gsly rewriting Method SMBR to read Word and Block (string) 8-bit at a time, combined with deleting one line in Method SMBR, SmartBattery fully works now in Lion and can extract the battery name string without crashing.

 

Below is my dsdt corrected for Lion on my Asus M60J. Attached are also the complete edit instructions that should apply to all Asus core i3/i5/i7 Notebooks.

 

Asus_Coreix_Lion_Edits.zipAsusM60J_Lion.zip

  • Like 5
Link to comment
Share on other sites

My Asus doesn't seem to use much SMBus access to the battery register sensors. It's making much use of EC access to the battery registers.

Excellent post Jingu! FWIW, the HP DVx was similar in that some of the EC registers are tried directly to the battery so they would sometimes read the information from there, rather than through the SBS. However, this makes it dependent on how the manufacturer implements the battery at the hardware level and the whole point of the SBS standard/controller, is to eliminate this dependency and make the code consistent regardless of the hardware platform.

 

Actually, your DSDT is reading the SMBus for some of the battery information (see below)

Then I made a puzzling discovery. I discovered that the only reason why the Fill Battery Information Method (Method FBIF) or Method _BIF was failing in Lion, was not because the battery EC registers were accessed in 16-bit, but because the Method that extracts the Battery OEM information string (Method BIF9) has an incompatibility with Lion and that alone was causing the whole Method FBIF or Method _BIF to fail. There's something incompatible with this Method BIF9

 

        Method (BIF9, 0, NotSerialized)
       {
           Name (BSTR, Buffer (0x20) {})
           Store (SMBR (RDBL, BADR, 0x21), Local0)
           If (LNotEqual (DerefOf (Index (Local0, Zero)), Zero))
           {
               Store (MNAM, BSTR)
               Store (Zero, Index (BSTR, 0x04))
           }
           Else
           {
               Store (DerefOf (Index (Local0, 0x02)), BSTR)
               Store (Zero, Index (BSTR, DerefOf (Index (Local0, One))))
           }

           Return (BSTR)
       }

 

I don't know how to fix that one.

I commented your DSDT. BIF9 is reading the DeviceName() via the SMBus and the issue is in the SMBR method (SMBus Read). You'll need to re-write that similar to what I did so that it only accesses 8-bits (BCC9's findings).

 

Oh, and your DSDT seems to define 2 SMBuses in your machine but I didn't look to see what the other one may talk to ;)

 

AsusM60J_gsly.zip

Link to comment
Share on other sites

Thanks much gsly.

 

I'll have a look at the comments you made for my Asus dsdt and see if I can come up with the re-write to 8-bit reference for the SMBus Read function.

Jingu, try the attached. I re-wrote SMBR similar to what I did for my HP by changing the Word and Block read code to do it 8-bits at a time. There is an additional Field definition for the 32 bytes of SMBus data and I added the PBFE method in your _SB scope. The latter is the only unknown as on my HP, it strangely uses a 32-bit field defined in what looks like integrated graphics memory to copy the byte data, even though this laptop has no integrated graphics! I found what looks like an "unused" 32-bit field in a similar operational region in your DSDT, but I have no idea if this will work :(

 

AsusM60J_gsly_rewrite.zip

Link to comment
Share on other sites

Thanks gsly.

 

That was very nice of you to do the edits on my dsdt.

 

Unfortunately, it doesn't work.

 

When I put back Store (^^LPCB.EC0.BIF9 (), Index (PBIF, 0x09)) in Method _BIF, Method _BIF fails and no battery information is returned. There is also an unexpected side effect from your edits. I lose the fan rpm sensor in iStat each time.

 

That was some really nice edits you came up. Too bad it doesn't work, but that's fine. I just won't be able to see battery information in system profiler under Lion, but everything else about your SmartBattery works perfect where before in Lion all I had was the battery icon, no percentages, no remaining time. Your project brought me so much further.

Link to comment
Share on other sites

Hi,

Thanks gsly for your good, hard work.

 

I've had same problem as Jingu on my Samsung with Lion 10.7.2.

...Unfortunately, battery information doesn't work in system profiler. But battery percentages and remaining times will work perfect...

Adding PBIG and BBIX code (from first post) resolved it - info in System Profiler appeared. Because of not enough my knowlege of EC registers I faked data in PBIG and skipped all procedures in BBIX to check if it works.

PBIG and BBIX seem to be mandatory and UseExtraBatteryInformationMethod=Yes. Using _BIX instead of _BIF is also possible.

We need help from gsly to adopt his idea to non HP machines. We'll be very thankful.

Link to comment
Share on other sites

 Share

×
×
  • Create New...