InfiniteMac OSx86

InfiniteMac OSx86 (http://infinitemac.com/forum.php)
-   10.X (http://infinitemac.com/forumdisplay.php?f=36)
-   -   DSDT editing needed to fix brightness/sleep HP DV3XXX (http://infinitemac.com/showthread.php?t=5605)

uninc 02-24-2010 04:56 AM

DSDT editing needed to fix brightness/sleep HP DV3XXX
 
I was poking around in the dsdt.aml trying to find what the sleep error and the brightness errors could be for the DV3XXX, and I stumbled upon this interesting info earlier:

projectosx.com/forum/index.php?showtopic=461

specifically post #4. It explains what code is used for controlling the brightness > (BCL) and (BCM). I was comparing our dsdt to others like the Dell 1340 in the above thread and HP 6XXX series here:
http://www.insanelymac.com/forum/lof...p/t135410.html
Compare the (_BCL) ASL Code differences below.
i see a major difference in that their _BCL and _BCM are serialized and the DV3XXX is not. Also, because of this difference the DV3XXX is missing a crucial string of code after "Method (_BCL... Not Serialized)" to the end of the string below.

Does anyone have any idea as to how to read code or better, fix this issue? I believe it is the same problem as our sleep, as 0x80 is code for sleep and 0x02 is code for wake, and the two are always referenced under BCL and BCM.

HP DV3XXX series dsdt:

Code:

                  Device (LCD)
                    {
                        Name (_ADR, 0x0110)
                        Name (_DCS, 0x1F)
                        Name (_DGS, Zero)
                        Method (_DSS, 1, NotSerialized)
                        {
                            And (GDGS, 0x12, GDGS)
                            If (And (Arg0, One))
                            {
                                Or (GDGS, One, GDGS)
                            }
                        }

                        Name (BCL1, Package (0x0D)
                        {
                            0x64,
                            0x28,
                            Zero,
                            0x0A,
                            0x14,
                            0x1E,
                            0x28,
                            0x32,
                            0x3C,
                            0x46,
                            0x50,
                            0x5A,
                            0x64
                        })
                        Method (_BCL, 0, NotSerialized)
                        {
                            Return (BCL1)
                        }

                        Method (_BQC, 0, NotSerialized)
                        {
                            Add (BRTL, 0x02, Local0)
                            Return (DerefOf (Index (BCL1, Local0)))
                        }

                        Method (_BCM, 1, NotSerialized)
                        {
                            Store (0x02, Local0)
                            While (LNotEqual (Arg0, DerefOf (Index (BCL1, Local0))))
                            {
                                Increment (Local0)
                            }

                            Subtract (Local0, 0x02, BRTL)
                        }
                    }

HP Pavilion 6XXX Series dsdt:


Code:

  Device (C1AD)
                {
                    Method (_ADR, 0, Serialized)
                    {
                        Return (C163 (Zero))
                    }

                    Method (_DCS, 0, NotSerialized)
                    {
                        Return (C15B (Zero))
                    }

                    Method (_DGS, 0, NotSerialized)
                    {
                        Return (C15C (Zero))
                    }

                    Method (_DSS, 1, NotSerialized)
                    {
                        C167 (Zero, Arg0)
                    }

                    Name (C1AE, Package (0x0D)
                    {
                        0x64,
                        0x33,
                        0x1E,
                        0x25,
                        0x2C,
                        0x33,
                        0x3A,
                        0x41,
                        0x48,
                        0x4F,
                        0x56,
                        0x5D,
                        0x64
                    })
                    Name (C1AF, Zero)
                    Method (_BCL, 0, Serialized)
                    {
                        If (LAnd (LEqual (C1AF, Zero), And (C06B, 0x10)))
                        {
                            Store (C06D, Local0)
                            Store (Zero, Local1)
                            While (LLess (Local1, 0x0B))
                            {
                                Store (DerefOf (Index (Local0, Local1)), Local2)
                                Multiply (Local2, 0x64, Local3)
                                Divide (Add (Local3, 0x7F), 0xFF, Local4, Local2)
                                Store (Local2, Index (C1AE, Add (Local1, 0x02)))
                                Increment (Local1)
                            }

                            Store (DerefOf (Index (C1AE, 0x05)), Index (C1AE, One))
                            Store (Local2, Index (C1AE, Zero))
                            Store (One, C1AF)
                        }

                        Return (C1AE)
                    }

                    Name (C1B0, 0x64)
                    Method (_BCM, 1, Serialized)
                    {
                        Store (Zero, Local0)
                        If (LGreater (\C009 (), 0x05))
                        {
                            Or (C05A, 0x40, C05A)
                            Store (One, Local0)
                        }

                        Store (Arg0, C1B0)
                        Store (Match (C1AE, MGE, Arg0, MTR, Zero, 0x02), Local1)
                        If (LEqual (Local1, Ones))
                        {
                            Subtract (SizeOf (C1AE), One, Local1)
                        }

                        Subtract (Local1, 0x02, Local1)
                        If (Local0)
                        {
                            Store (Local1, C071)
                            If (LEqual (C168 (), Zero))
                            {
                                C1B1 (0xEA74, 0x04, Local1, Zero, Zero)
                            }

                            Signal (C1AB)
                        }
                    }

                    Method (_BQC, 0, Serialized)
                    {
                        Store (C1B0, Local0)
                        Return (Local0)
                    }
                }

any ideas to change DV3XXX so screen dimming/sleep may work?

uman 02-27-2010 01:55 AM

uninc,

I don't think that's the solution. For example, my DSDT has this (and I have no issue with brightness, either from sleep, or from the keyboard):
Code:

                      Method (_BCL, 0, NotSerialized)
                        {
                            Return (\_SB.PCI0.LBCL)
                        }

                        Method (_BCM, 1, NotSerialized)
                        {
                            \_SB.PCI0.LBCM (Arg0)
                        }

Is your brightness issue one of resuming from sleep, or are you just trying to adjust the brightness from the keyboard? Do you have a PS2 keyboard (typically your DSDT will have a Device (PS2K) entry)?

If the PS2 keyboard dimming, you could try adding the following to the PS2K device:

Code:

                    Method (_DSM, 4, NotSerialized)
                    {
                        Store (Package ()
                            {
                                // We are telling the system that we have FN keys
                                "AAPL,has-embedded-fn-keys",                                                                             
                                Buffer (0x04)
                                {
                                    0x01, 0x00, 0x00, 0x00
                                }               
                            }, Local0)
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                    }


uninc 03-02-2010 05:48 AM

thanks for the reply uman, i dont have a solution. i have a problem.

your post is very helpful, i think you are right about looking in the wrong place.

i dont think the ps2 fix is the issue; however i am going to try it as i dont have that key in the dsdt. i will report back...

uman 03-02-2010 05:12 PM

uninc,

I'm am still not sure what your issue is. Is it:

1. When returning from sleep, your display doesn't wake up, or the screen is very dim? If so, there's a DSDT fix for that.

2. You can't control the brightness from the keyboard?

3. The keyboard does control the brightness, but the OS X "sun" icon doesn't display? (I have that problem-- when controlling sound from my keyboard, I see the speaker icon, but not when controlling brightness.

Re PS2: If you don't have a PS2K device in your DSDT, then you probably have a USB keyboard and mouse which is good! So I wouldn't add the PS2K device into your DSDT. (The sure way to tell whether you have PS2 keyboard or mouse is if during install, you needed VoodooPS2Controller.kext, or ApplePS2SomethingOrOther.kext.)

I find that the people who are doing the most advanced DSDT work are the Gigabyte mobo folks. Unfortunately there are pages upon pages of cruft to wade through on insanely, not to mention the ACPI Programmers guide, and the datasheets for your motherboard chipset. Even here, the Gigabyte topics are lengthy. But good on them-- they have the passion.

Try using google search to help cut down on the cruft:

site:www.insanelymac.com HP DV3510nr DSDT brightness

turned up some of your posts, but also: http://www.insanelymac.com/forum/ind...&#entry1095891

You could also try this: http://www.splasm.com/products/productbrightness.html

Hmm, your laptop has an nvidia display right? Can you check if AppleIntegratedFrameBuffer is loaded (use kextstat in terminal). Apparently that kext takes control of brightness (LCD backlight). There's a patch that gets it to relinquish control (see the comment by Timo: http://blog.stuart.shelton.me/archives/209)

Can you post your unmodified (original) DSDT? I'd need to see if your LCD panel has a _DSS method defined to control brightness. Macbooks (and my Gateway) don't. The _DSS method is where you see some people suggesting fixes where they use 0x86, 0x87, 0x89 to cycle, increase, decrease or zero brightness. But that doesn't work unless your hardware is defined that way. The ACPI spec has details on that.

I can't promise that I can examine your DSDT right away (and I made need a gentle nudge as I might forget), since I am installing SL over the next day or two. But I'll try to look into it later this wee or early next week. I'm curious how this wholething works because I'd like to get the litle sun icon to show up on my gateway!

Cheers.

uninc 03-03-2010 10:20 AM

1 Attachment(s)
my battery died on me while the EFI partition was mounted - the EFI was f'd. i had to take out the drive and repair from another mac. so, i haven't tried any of your suggestions yet uman, although i am grateful.

the dv3XXX does use PS2 input, and in the dsdt i believe it is called
Code:

Device (KBC)
i have a feeling the (_DSM) addition will not work, but i will try.

to help you understand, sleep does not work at all (contrary to the threads you reference on insanely). I have been active in those for some time now, but they are dead.

sleep does not work. if i push sleep, the monitor shuts off, and ps2 shuts off - thats it. i have to hard restart.

brightness does not work. i am using shades right now - it kills my battery. every other hotkey works (volume, media keys, sleep, print etc...). i checked kextstat and AppleIntegratedFrameBuffer is not loaded.

the dv3XXX is very vanilla, very tasty. its running SL excellent in 64 except for brightness and sleep. i can FEEL it can be fixed via dsdt
here is the original dsdt, unfortunately it is long. ill also attach it:

EDIT : i can only attach it - "the text...is too long"
good luck with your install.
and thank you for the links i will go over them in hopes of discovery

uman 03-03-2010 11:23 PM

I'm having a hell of a time with my install. No joy today. And my Gateway is very vanilla (my DSDT compares amazingly with a MacBook DSDT).

No luck with prasys' method #1 - USB stick. Tried his second one using Conti's hack. No joy.

I then tried to install thru Leopard onto the external drive (which will be my new hard drive once finished). It dies with a bless error.

So now I'm installing from a MacBook Pro to the external drive. After that, I'm not sure. I think I can just install Chameleon.

uninc 03-04-2010 09:21 PM

i thought you were allergic to macbooks?!
those are strange failures. have you read this thread? - there is a link to install guide here.

http://www.insanelymac.com/forum/lof...:/t187471.html

are you dual booting? keep in mind gma950 is only 32 bit and chameleon rc3/4 automatically boots 64.

so i tried adding the PS2 dimming to dsdt and it compiled fine, but it did not solve the problem. and i see that there is a _DSS method in my dsdt, do you have a link that explains adding the cycle commands?

uman 03-05-2010 04:25 PM

Quote:

Originally Posted by uninc (Post 45869)
i thought you were allergic to macbooks?!

I can tolerate using them for about 1/2 hr, then I lose sensitivity in my fingertips and my palms itch.

Quote:

Originally Posted by uninc (Post 45869)
sleep does not work. if i push sleep, the monitor shuts off, and ps2 shuts off - thats it. i have to hard restart.

I think we can fix this in DSDT. But it may take some research into your specific DSDT.

Quote:

Originally Posted by uninc (Post 45869)
brightness does not work. i am using shades right now - it kills my battery. every other hotkey works (volume, media keys, sleep, print etc...).

I think we can tackle this too, but I think the first step may be just dimming the display. Again, I'll need to study your DSDT, and right now I am caught up with my SL install problems (I've detailed where I am here: http://www.infinitemac.com/f57/help-...sb-hard-t5669/)

Quote:

Originally Posted by uninc (Post 45869)
the dv3XXX does use PS2 input, and in the dsdt i believe it is called KBC

Please confirm with ioreg that it is indeed a the PS2 device. You should see:
Code:

    | +-o KBC  <class IOACPIPlatformDevice, registered, matched, active, busy 0, retain 8>
    | | +-o ps2controller  <class AppleACPIPS2Nub, registered, matched, active, busy 0, retain 8>
    | |  +-o ApplePS2Controller  <class ApplePS2Controller, !registered, !matched, active, busy 0, retain 9>
    | |    +-o ApplePS2KeyboardDevice  <class ApplePS2KeyboardDevice, registered, matched, active, busy 0, retain 7>
    | |    | +-o ApplePS2Keyboard  <class ApplePS2Keyboard, registered, matched, active, busy 0, retain 9>

Quote:

Originally Posted by uninc (Post 45869)
so i tried adding the PS2 dimming to dsdt and it compiled fine, but it did not solve the problem.

Where did you add it? Under KBC? (BTW, I find editing my DSDT to look more Mac-like helps when comparing to ioregs etc of a real mac. So I encourage you to search/replace KBC to PS2K if it's the right device).

Quote:

Originally Posted by uninc (Post 45869)
and i see that there is a _DSS method in my dsdt, do you have a link that explains adding the cycle commands?

The problem is tracing it down from the keyboard to the change in brightness. As a start, if you just want to dim the display to begin with, you could change the value in the _BCL list (below is from the ACPI 4.0 spec):

Quote:

Code:

Method (_BCL, 0) {
  // List of supported brightness levels
  Return (Package(7){
    80,  // level when machine has full power
    50,  // level when machine is on batteries
      // other supported levels:
    20, 40, 60, 80, 100}
 }

The first number in the package is the level of the panel when full power is connected to the machine. The second number in the package is the level of the panel when the machine is on batteries. All other numbers are treated as a list of levels OSPM will cycle through when the user toggles (via a keystroke) the brightness level of the display. These levels will be set using the _BCM method described in the following section.

B.6.3 _BCM (Set the Brightness Level)
This method allows OSPM to set the brightness level of a built-in display output device.

The OS will only set levels that were reported via the _BCL method. This method is required if _BCL is
implemented.

Arguments: (1)
Arg0 – An Integer containing the new brightness level
Return Value:
None
Example:

Code:

Method (_BCM, 1) { // Set the requested level }
The method will be called in response to a power source change or at the specific request of the end user, for example, when the user presses a function key that represents brightness control.

uninc 03-08-2010 03:02 AM

uman, glad you succeeded with SL.

i have replaced KBC with PS2K and compiled w/o error-there is no visible difference yet.

ive been reading the ACPIspec sheet, but don't really know where to start in understanding my own dsdt. indeed it prol'y needs to be looked at in order to edit the brightness and sleep issues.

i have tried adding the values you referenced in the ACPIspec but can't compile w/o errors. i don't really know how or where to edit. can you help?

Code:

  Device (LCD)
                    {
                        Name (_ADR, 0x0110)
                        Name (_DCS, 0x1F)
                        Name (_DGS, Zero)
                        Method (_DSS, 1, NotSerialized)
                        {
                            And (GDGS, 0x12, GDGS)
                            If (And (Arg0, One))
                            {
                                Or (GDGS, One, GDGS)
                            }
                        }

                        Name (BCL1, Package (0x0D)
                        {
                            0x64,
                            0x28,
                            Zero,
                            0x0A,
                            0x14,
                            0x1E,
                            0x28,
                            0x32,
                            0x3C,
                            0x46,
                            0x50,
                            0x5A,
                            0x64
                        })
                        Method (_BCL, 0, NotSerialized)
                        {
                            Return (BCL1)
                        }

                        Method (_BQC, 0, NotSerialized)
                        {
                            Add (BRTL, 0x02, Local0)
                            Return (DerefOf (Index (BCL1, Local0)))
                        }

                        Method (_BCM, 1, NotSerialized)
                        {
                            Store (0x02, Local0)
                            While (LNotEqual (Arg0, DerefOf (Index (BCL1, Local0))))
                            {
                                Increment (Local0)
                            }

                            Subtract (Local0, 0x02, BRTL)
                        }
                    }


uman 03-08-2010 12:26 PM

Please post the two dsdts: the one that compiles okay with PS2K, and the broken one. I should be able to take a look midday.