Contribute
Register

p750dm brightness - help injecting through DSDT

Status
Not open for further replies.
Joined
Nov 2, 2015
Messages
20
Mac
  1. 0
Classic Mac
  1. 0
Mobile Phone
  1. 0
Hi RehabMan,

I'm struggling to get brightness to work on a p750dm laptop. This laptop has no integrated graphics card enabled (although it seems to exist in SSDT-2, there is no option in the bios to change it).

The laptop also uses a desktop CPU, if this information is of any use.

I'm using NVidia web drivers 346.03.04f02, on El Capitan 10.11.2, working well so far.

My display is detected in IORegistryExplorer as AppleDisplay, and as you mentioned in another post, this could be a FrameBuffer problem.

In addition, a second method using the standard PNLF patch ("Brightness Fix") can be used.

I've added to namespace \_SB in the DSDT the following:
Code:
        Device (PNLF)        {
            Name (_HID, EisaId ("APP0002"))
            Name (_CID, "backlight")
            Name (_UID, 0x0A)
            Name (_STA, 0x0B)
        }

But no brightness control appears in SysPref -> Displays

In order to implement brightness you must have working graphics drivers (QE/CI), and you must be using a laptop snb-platorm-id/ig-platform-id.

This is something I thought I was missing, so I used Clover Configurator to add to ig-platform-id injection in the Clover config.plist the codes from https://pikeralpha.wordpress.com/2015/10/14/os-x-10-11-1-beta-4-adds-skylake-support/ (except the ones that said Desktop on them):
Code:
[COLOR=#444444][FONT=Open Sans][ 1] : 0x191e0000 – Skylake ULX GT2[/FONT][/COLOR]
[COLOR=#444444][FONT=Open Sans][ 2] : 0x19160000 – Skylake ULT GT2[/FONT][/COLOR]
[COLOR=#444444][FONT=Open Sans][ 3] : 0x19260000 – Skylake ULT GT3[/FONT][/COLOR]
[COLOR=#444444][FONT=Open Sans][ 4] : 0x191b0000 – Skylake HALO GT2[/FONT][/COLOR]
[COLOR=#444444][FONT=Open Sans][ 5] : 0x19120000 – Skylake Desktop GT2[/FONT][/COLOR]
[COLOR=#444444][FONT=Open Sans][ 6] : 0x19020001 – Skylake Desktop GT1 (currently inactive)[/FONT][/COLOR]
[COLOR=#444444][FONT=Open Sans][ 7] : 0x19170001 – Skylake Desktop GT1.5 (currently inactive)[/FONT][/COLOR]
[COLOR=#444444][FONT=Open Sans][ 8] : 0x19120001 – Skylake Desktop GT2 (currently inactive)[/FONT][/COLOR]
[COLOR=#444444][FONT=Open Sans][ 9] : 0x19320001 – Skylake Desktop GT4 (currently inactive)[/FONT][/COLOR]
[COLOR=#444444][FONT=Open Sans][10] : 0x19160002 – Skylake ULT GT2[/FONT][/COLOR]
[COLOR=#444444][FONT=Open Sans][11] : 0x19260002 – Skylake ULT GT3[/FONT][/COLOR]
[COLOR=#444444][FONT=Open Sans][12] : 0x191e0003 – Skylake ULX GT2[/FONT][/COLOR]

However, after trying a few codes with no success I skimmed through the Clover sources, specifically at Platform/gma.c and got the impression that ig-platform-id is only applied if an Intel Graphics Cards. I was not sure if the ig of ig-platform-id was of "Integrated Graphics", but now I get the impression it is for "Intel Graphics".

Brightness controls are available only for internal LVDS displays.

In the Windows hardware info application, it says that my display connector is DisplayPort.

Since, I don't care about perfect functionality, just a way to dim the screen to use the laptop at night better, I started looking at my DSDT/SSDTs using your ACPIDebug utility + ioio to call the following:

In SSDT-1 I have a \_SB.PCI0.PEG0.PEGP.LCD0._BCM method:
Code:
           Method (_BCM, 1, NotSerialized)  // _BCM: Brightness Control Method
            {
                Store (Arg0, BRTL)

                If (LEqual (PBCC, One))
                {
                    Store (Zero, Local0)
                    Store (ShiftLeft (Multiply (BRTL, 0x0A), 0x08), PBDI)
                    While (LLess (Local0, 0x03E8))
                    {
                        Store (One, PBMX)
                        Store (0x86100000, PBCR)
                        Stall (0x64)
                        Increment (Local0)
                        If (LEqual (And (PBCR, 0xFF), One))
                        {
                            Store (0x03E8, Local0)
                        }
                    }
                    Store (Zero, PBCR)
                    Store (Zero, PBMX)
                }
                Store (BRTL, P80H)
            }

But the condition If (LEqual (PBCC, One) is never true, as PBCC's value is 0x16. Commenting this condition to skip the if made no change. I put print messages to check the conditions to validate that the method is being called and what are the values of the variables.

In SSDT-1 I do have a PWMF field which holds the PWM Frequency in Hz for the display brightness. Its value is read from a call to \_SC.PCI0.WMMX method, which should implement the MXM2 standard. The \_SC.PCI0.WMMX does some changes to its arguments, creating new fields to as parameters in a call to \_SB.PCI0.PEG0.PEGP._DSM
where the following code reads the PWMF value:
Code:
If (LEqual (_T_3, 0x14)) // query backlight 
{
       Name (BLPK, Package (0x09)
       {
                 0x8000A450, 
                 0x0100, 
                 Zero, 
                 Zero, 
                 One, 
                 One, 
                 0xFA, 
                 Zero, 
                 0x03E8
         })
         If (SDIL)
         {
                  Store (SDIL, Index (BLPK, Zero))
          }


          If (LOr (LGreaterEqual (OSYS, 0x07D9), LEqual (OSYS, 0x03E8)))
          {
                   Store (0x0200, Index (BLPK, One))
          }


          Store (PWMF, Index (BLPK, 0x06))
          Store (MIND, Index (BLPK, 0x07))
          Store (MAXD, Index (BLPK, 0x08))
          Return (BLPK)
}

Which has a structure similar to the MXM2 spec from Nvidia [ http://www.nvidia.com/object/IO_13290.html , page 16] , however the spec seems to have less fields than the package returned above, and the order of the MAX, MIN, CURRENT seems to be reversed from what is in the document:

Screen Shot 2016-01-21 at 2.35.55 AM.png


In SSDT-2 I have a \_SB.PCI0.GFX0.LCD0._BCM method:
Code:
          Method (_BCM, 1, NotSerialized)  // _BCM: Brightness Control Method
            {
                If (LAnd (LGreaterEqual (Arg0, Zero), LLessEqual (Arg0, 0x64)))
                {
                    If (And (TCHE, 0x02))
                    {
                        If (LNot (ARDY))
                        {
                            Sleep (ASLP)
                        }
                        If (And (ARDY, One))
                        {
                            Store (Add (Divide (Multiply (Arg0, Subtract (0xFF, And (PFMB, 0xFF))
                                ), 0x64, ), And (PFMB, 0xFF)), BCLP)
                            Or (BCLP, 0x80000000, BCLP)
                            Store (0x02, ASLC)
                            Store (One, ASLE)
                        }
                    }
                    Store (Arg0, BRTL)
                }
                Store (BRTL, P80H)
            }

With the exception of If (LAnd (LGreaterEqual (Arg0, Zero), LLessEqual (Arg0, 0x64))), all conditions are false. I tried commenting them all and run this _BCM method with your utility ioio, passing a value of 1 or 10, or 50, to execute the part of the Store(Add...), there is no change in brightness.

In a post of a similar laptop [ http://www.tonymacx86.com/yosemite-laptop-support/162926-p750zm-brightness-help-2.html ] you mentioned that it likely needs to have HasPanel injected in the DSDT. So I looked at https://github.com/RehabMan/Laptop-DSDT-Patch/blob/master/graphics/graphics_nvidia_laptop.txt and am trying to create a DSDT injection that would hopefully enable the variables that make those if statements work so I can use any of the _BCM methods.

My aim was to create a patch that first did nothing except reproduce the current working state that I have now, since I have QE/CI and working graphics, and then, as second step, add the HasPanel.

So I took the information from IORegistryExplorer and tried to merge with the patch on your repo, taking care to update the Buffer(sizes) as I changed them.

What I changed to match mine was the EDID, NVCAP, model, rom-version. And added the other display ports as my display shown on NVDA,Display-D which I understood as @3, in the injection:

The result was the following:
Code:
[FONT=-webkit-standard]Method(_DSM, 4, NotSerialized)[/FONT]
[FONT=-webkit-standard]{[/FONT]
[FONT=-webkit-standard]    If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }[/FONT]
[FONT=-webkit-standard]    Return (Package()[/FONT]
[FONT=-webkit-standard]    {[/FONT]

[FONT=-webkit-standard]        "AAPL,backlight-control", Buffer (0x04) { 0x01, 0x00, 0x00, 0x00 },[/FONT]
[FONT=-webkit-standard]        "AAPL,aux-power-connected", Buffer (0x04) { 0x01, 0x00, 0x00, 0x00 },[/FONT]
[FONT=-webkit-standard]        "@0,AAPL,boot-display", Buffer (One) { 0x01 },[/FONT]
[FONT=-webkit-standard]        "@0,display-cfg", Buffer (0x04) { 0xFF, 0xFF, 0xFF, 0xFF },[/FONT]
[FONT=-webkit-standard]        "@1,display-cfg", Buffer (0x04) { 0xFF, 0xFF, 0xFF, 0xFF },[/FONT]
[FONT=-webkit-standard]      //  "@0,connector-type", Buffer (0x04) { 0x00, 0x08, 0x00, 0x00 },[/FONT]
[FONT=-webkit-standard]      //  "@1,connector-type", Buffer (0x04) { 0x00, 0x08, 0x00, 0x00 },[/FONT]
[FONT=-webkit-standard]        "@0,built-in", Buffer (0x04) { 0x00, 0x00, 0x00, 0x01 },[/FONT]
[FONT=-webkit-standard]        "@0,use-backlight-blanking", Buffer (0x04) {},[/FONT]
[FONT=-webkit-standard]        "AAPL,gray-page", Buffer (0x04) { 0x01, 0x00, 0x00, 0x00 },[/FONT]
[FONT=-webkit-standard]        "AAPL00,inverter", Buffer (0x04) { 0x00, 0x00, 0x00, 0x00 },[/FONT]
[FONT=-webkit-standard]        "@1,can-hot-plug", Buffer (0x04) {},[/FONT]
[FONT=-webkit-standard]        "AAPL00,blackscreen.preferences", Buffer (0x04) { 0x00, 0x00, 0x00, 0x08 },[/FONT]
[FONT=-webkit-standard]        "AAPL01,blackscreen.preferences", Buffer (0x04) { 0x00, 0x00, 0x00, 0x08 },[/FONT]
[FONT=-webkit-standard]        “@3,backlight-control", Buffer (0x04) { 0x01, 0x00, 0x00, 0x00 },[/FONT]
[FONT=-webkit-standard]        “@3,pwm-info", Buffer (0x18)[/FONT]
[FONT=-webkit-standard]        {[/FONT]
[FONT=-webkit-standard]            /* 0000 */    0x02, 0x18, 0x00, 0x64, 0x90, 0x59, 0x02, 0x00, [/FONT]
[FONT=-webkit-standard]            /* 0008 */    0x08, 0x52, 0x00, 0x00, 0xA5, 0x1C, 0x00, 0x00, [/FONT]
[FONT=-webkit-standard]            /* 0010 */    0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00[/FONT]
[FONT=-webkit-standard]        }, [/FONT]
[FONT=-webkit-standard]        "NVPM", Buffer (0x1C) [/FONT]
[FONT=-webkit-standard]        {[/FONT]
[FONT=-webkit-standard]            /* 0000 */    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, [/FONT]
[FONT=-webkit-standard]            /* 0008 */    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, [/FONT]
[FONT=-webkit-standard]            /* 0010 */    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, [/FONT]
[FONT=-webkit-standard]            /* 0018 */    0x00, 0x00, 0x00, 0x00[/FONT]
[FONT=-webkit-standard]        }, [/FONT]
[FONT=-webkit-standard]        “@3,EDID", Buffer (0x80) // This is copied from ioreg[/FONT]
[FONT=-webkit-standard]        {[/FONT]
[FONT=-webkit-standard]            0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,[/FONT]
[FONT=-webkit-standard]0x4c, 0x83, 0x4b, 0x43, 0x00, 0x00, 0x00, 0x00,[/FONT]
[FONT=-webkit-standard]0x00, 0x18, 0x01, 0x03, 0x95, 0x22, 0x13, 0x78,[/FONT]
[FONT=-webkit-standard]0xea, 0xce, 0x85, 0x9e, 0x5b, 0x4c, 0x94, 0x26,[/FONT]
[FONT=-webkit-standard]0x17, 0x50, 0x54, 0x00, 0x00, 0x00, 0x01, 0x01,[/FONT]
[FONT=-webkit-standard]0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,[/FONT]
[FONT=-webkit-standard]0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xd3, 0xcd,[/FONT]
[FONT=-webkit-standard]0x00, 0x74, 0xf0, 0x70, 0x3c, 0x80, 0x30, 0x20,[/FONT]
[FONT=-webkit-standard]0x25, 0x00, 0x58, 0xc2, 0x10, 0x00, 0x00, 0x19,[/FONT]
[FONT=-webkit-standard]0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00,[/FONT]
[FONT=-webkit-standard]0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x82, 0x05,[/FONT]
[FONT=-webkit-standard]0x46, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x53,[/FONT]
[FONT=-webkit-standard]0x41, 0x4d, 0x53, 0x55, 0x4e, 0x47, 0x0a, 0x20,[/FONT]
[FONT=-webkit-standard]0x4c, 0x83, 0x46, 0x4c, 0x00, 0x00, 0x00, 0xfe,[/FONT]
[FONT=-webkit-standard]0x00, 0x31, 0x35, 0x36, 0x46, 0x4c, 0x30, 0x32,[/FONT]
[FONT=-webkit-standard]0x2d, 0x31, 0x30, 0x31, 0x0a, 0x20, 0x00, 0x2b[/FONT]
[FONT=-webkit-standard]        }, [/FONT]
[FONT=-webkit-standard]        "@0,compatible", Buffer (0x0B) { "NVDA,NVMac" },[/FONT]
[FONT=-webkit-standard]        "@0,device_type", Buffer (0x08) { "display" },[/FONT]
[FONT=-webkit-standard]        "@0,display-type", Buffer (0x04) { "LCD" },[/FONT]
[FONT=-webkit-standard]        "@0,name", Buffer (0x0F) { "NVDA,Display-A" },[/FONT]
[FONT=-webkit-standard]        "@1,compatible", Buffer (0x0B) { "NVDA,NVMac" },[/FONT]
[FONT=-webkit-standard]        "@1,device_type", Buffer (0x08) { "display" },[/FONT]
[FONT=-webkit-standard]        "@1,name", Buffer (0x0F) { "NVDA,Display-B" },[/FONT]
[FONT=-webkit-standard]        "@2,compatible", Buffer (0x0B) { "NVDA,NVMac" },[/FONT]
[FONT=-webkit-standard]        "@2,device_type", Buffer (0x08) { "display" },[/FONT]
[FONT=-webkit-standard]        "@2,name", Buffer (0x0F) { "NVDA,Display-C" },[/FONT]
[FONT=-webkit-standard]        "@3,compatible", Buffer (0x0B) { "NVDA,NVMac" },[/FONT]
[FONT=-webkit-standard]        "@3,device_type", Buffer (0x08) { "display" },[/FONT]
[FONT=-webkit-standard]        "@3,name", Buffer (0x0F) { "NVDA,Display-D" },[/FONT]
[FONT=-webkit-standard]        “@3,display-type", Buffer (0x04) { "LCD" },[/FONT]
[FONT=-webkit-standard]        "NVCAP", Buffer (0x18)  // this is copied from IORegistryExplorer[/FONT]
[FONT=-webkit-standard]        {[/FONT]
[FONT=-webkit-standard]            /* 0000 */    0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, [/FONT]
[FONT=-webkit-standard]            /* 0008 */    0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, [/FONT]
[FONT=-webkit-standard]            /* 0010 */    0x00, 0x00, 0x00, 0x00[/FONT]
[FONT=-webkit-standard]        }, [/FONT]
[FONT=-webkit-standard]        "VRAM,totalMB", Buffer (0x04) { 0xff, 0x1f, 0x00, 0x10 },[/FONT]
[FONT=-webkit-standard]        "VRAM,totalsize", Buffer (0x04) { 0x00, 0x00, 0x00, 0x10 },[/FONT]
[FONT=-webkit-standard]        "device_type", Buffer (0x0C) { "NVDA,Parent" },[/FONT]
[FONT=-webkit-standard]        "model", Buffer (0x17) { "NVIDIA GeForce GTX 980M" },[/FONT]
[FONT=-webkit-standard]        //"hda-gfx", Buffer (0x0A) { "onboard-2" },[/FONT]
[FONT=-webkit-standard]        "rom-revision", Buffer (0x14) { "VBIOS 84.04.67.00.0e" },[/FONT]
[FONT=-webkit-standard]    })[/FONT]
[FONT=-webkit-standard]} [/FONT]

However this is not right, because when I use this DSM, it boots to a scrambled screen, which I have to use Remote Desktop to restart OSX and check IORegistryExplorer. When booting in this scrambled screen, no display is shown on IORegistryExplorer by searching for the string "display".

As I am a newbie, I'm shooting in the dark here. So having display brightness control of any sort, even through "ioio", my questions are:
  1. Am I going in the correct direction with this _DSM method for \_SB.PCI0.PEG0.PEGP._DSM ?
  2. If so, do you have any idea of what I can change to fix the code above to boot in the same state as I have today to later add the HasPanel? i.e., is there anything obviously wrong with it?
  3. With your experience, would you think that injected attributes in the DSDT would make any change in the attributes needed by those if conditions to make the _BCM method work on PEG0.PEGP?
  4. There is a laptop with working brightness with the following DSDT patch http://rog.asus.com/forum/showthrea...-INSTALL-GUIDE&p=435644&viewfull=1#post435644 , but its nVidia card is at GFX0, do you think it would make any difference to rename my GFX0 to IGPU and PEG0.PEGP to GFX0 ?
  5. Is "AAPL,slot-name" purely cosmetic?
  6. Would you have any idea with a magic EFI string could help me? It has been hard to find info the explains it.
  7. I understand you will unlikely be able to help, but what other forum would you recommend me to search for help given this scenario?

Data for problem reporting

Clover directory [ CLOVER/ACPI/patched_dsl has the source of the patched aml and CLOVER/ACPI/origin_dsl has the original disassembled ] : View attachment CLOVER.zip

ioreg from IORegistryExplorer 2.1: View attachment discipline’s iMac.ioreg.zip

patchmatic -extract files: View attachment patchmatic-extract-output.zip

Output of kextcache:
Code:
sudo touch /System/Library/Extensions && sudo kextcache -u /
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext CodecCommander.kext
kext-dev-mode allowing invalid signature -67054 0xFFFFFFFFFFFEFA12 for kext AppleHDA.kext
kext-dev-mode allowing invalid signature -67030 0xFFFFFFFFFFFEFA2A for kext AppleGraphicsDevicePolicy.kext

Output of kextstat:
Code:
kextstat|grep -y acpiplat
   13    2 0xffffff7f821e1000 0x66000    0x66000    com.apple.driver.AppleACPIPlatform (4.0) 295F7A91-2DF7-3FFE-9550-A0C1A6F9D575 <12 11 7 6 5 4 3 1>
kextstat|grep -y appleintelcpu
kextstat|grep -y applelpc

Thank you very much for you time, wishing you a happy ski season this winter! :thumbup:
 
If your display is AppleDisplay instead of AppleBacklightDisplay, no expectation for brightness controls, regardless of PNLF.

The ig-platform-id only matters for Intel integrated graphics. You state that your laptop doesn't have it.

You probably need to make some injections on your graphics device to enable AppleBacklightDisplay. I don't know the details, but take a look at the backlight related properties in the Nvidia patches in my repo: https://github.com/RehabMan/Laptop-DSDT-Patch
 
Status
Not open for further replies.
Back
Top