Contribute
Register

Lenovo U310 - Mavericks Upgrade [WIP]

Status
Not open for further replies.
right acpibacklight... :D
Are you talking about your brightness keys? Yes

I didn't use acpibacklight prior to today. brightness slider never worked. do not see brightness sun

OK. Your "brightness keys" (that do work) are BIOS controlled. I'm going to ignore those for a while since they are much as if there was hardware slider on the display itself (OS is not involved). Interested only in OS X controls here.

install acpibacklight kext using 2.08 pnlf brightness patch - sysprefs/display brightness slider worked.

This is interesting and potentially useful for further improvements. If you could:
- install debug ACPIBacklight.kext
- apply 2.08 PNLF "Brightness Fix" from the repo
- reboot and capture ioreg: http://www.tonymacx86.com/audio/58368-guide-how-make-copy-ioreg.html

Because this configuration of ACPIBacklight.kext works, it means your original DSDT backlight methods work (if PNLF does not provide _BCL/_BQC/_BCM, ACPIBacklight attempts to use ones found elsewhere in DSDT)

If I can figure out what those methods do, what hardware registers they manipulate I can write a better PNLF patch for your machine and perhaps come to a better understanding how it works...
applied 2.09 hd3000/hd4000 patch. install acpibacklight kext. sysprefs/display brightness slider does not work, but restoring previous light level does. is it the hd3k/4k patch disabling the sysprefs/display slider somehow?

It means that the hardware registers (IGPU PWM backlight controls) are not used on your machine or need to be setup a different way.

the function keys with the brightness sun slider (Fn/Home(Pause) and FN/PgUp(Scrlk)) have no affect on brightness.

These keys should work in the above scenario (2.08 PNLF+ ACPIBacklight) where SysPrefs->Displays is working. Feel free to test it a bit...
 
OK. Your "brightness keys" (that do work) are BIOS controlled. I'm going to ignore those for a while since they are much as if there was hardware slider on the display itself (OS is not involved). Interested only in OS X controls here.



This is interesting and potentially useful for further improvements. If you could:
- install debug ACPIBacklight.kext
- apply 2.08 PNLF "Brightness Fix" from the repo
- reboot and capture ioreg: http://www.tonymacx86.com/audio/58368-guide-how-make-copy-ioreg.html

Because this configuration of ACPIBacklight.kext works, it means your original DSDT backlight methods work (if PNLF does not provide _BCL/_BQC/_BCM, ACPIBacklight attempts to use ones found elsewhere in DSDT)

If I can figure out what those methods do, what hardware registers they manipulate I can write a better PNLF patch for your machine and perhaps come to a better understanding how it works...


It means that the hardware registers (IGPU PWM backlight controls) are not used on your machine or need to be setup a different way.



These keys should work in the above scenario (2.08 PNLF+ ACPIBacklight) where SysPrefs->Displays is working. Feel free to test it a bit...

still awake.... you the man.

went back to old DSDT (=2.08) and installed debug acpibacklight, repaired permissions and rebooted
attached is ioreg and console log since reboot.

brightness sun works with keys and sysprefs/display brightness slider works as well.
 

Attachments

  • Archive.zip
    394.1 KB · Views: 93
still awake.... you the man.

went back to old DSDT (=2.08) and installed debug acpibacklight, repaired permissions and rebooted
attached is ioreg and console log since reboot.

brightness sun works with keys and sysprefs/display brightness slider works as well.

Got some ideas for you... but question first. When using ACPIBacklight now does the screen turn completely off when you drag the slider completely to the left? Alternatively when you use OS X brightness "sun" keys to go to "zero blocks?"
 
Got some ideas for you... but question first. When using ACPIBacklight now does the screen turn completely off when you drag the slider completely to the left? Alternatively when you use OS X brightness "sun" keys to go to "zero blocks?"


no, neither method turns the screen completely off. I'd call it very dim. I can still see and navigate if needed.

also using the regular fcn keys (hard coded - not the sun keys) does not turn it completely off (all black)
 
no, neither method turns the screen completely off. I'd call it very dim. I can still see and navigate if needed.

also using the regular fcn keys (hard coded - not the sun keys) does not turn it completely off (all black)

That's what I figured. Here's what I find looking at your DSDT brightness methods:

- The backlight is controlled by the EC at ECLV in EmbeddedControl
- The values stored there range 0-15, for 16 different levels

Here is the code which does it:
Code:
        Method (IBCM, 1, NotSerialized)
        {
            Store (Arg0, EBRL)
            If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x02)), One
                )))
            {
                Store (Zero, BRNS)
            }
            Else
            {
                If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x03)), One
                    )))
                {
                    Store (One, BRNS)
                }
                Else
                {
                    If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x04)), One
                        )))
                    {
                        Store (0x02, BRNS)
                    }
                    Else
                    {
                        If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x05)), One
                            )))
                        {
                            Store (0x03, BRNS)
                        }
                        Else
                        {
                            If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x06)), One
                                )))
                            {
                                Store (0x04, BRNS)
                            }
                            Else
                            {
                                If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x07)), One
                                    )))
                                {
                                    Store (0x05, BRNS)
                                }
                                Else
                                {
                                    If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x08)), One
                                        )))
                                    {
                                        Store (0x06, BRNS)
                                    }
                                    Else
                                    {
                                        If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x09)), One
                                            )))
                                        {
                                            Store (0x07, BRNS)
                                        }
                                        Else
                                        {
                                            If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x0A)), One
                                                )))
                                            {
                                                Store (0x08, BRNS)
                                            }
                                            Else
                                            {
                                                If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x0B)), One
                                                    )))
                                                {
                                                    Store (0x09, BRNS)
                                                }
                                                Else
                                                {
                                                    If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x0C)), One
                                                        )))
                                                    {
                                                        Store (0x0A, BRNS)
                                                    }
                                                    Else
                                                    {
                                                        If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x0D)), One
                                                            )))
                                                        {
                                                            Store (0x0B, BRNS)
                                                        }
                                                        Else
                                                        {
                                                            If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x0E)), One
                                                                )))
                                                            {
                                                                Store (0x0C, BRNS)
                                                            }
                                                            Else
                                                            {
                                                                If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x0F)), One
                                                                    )))
                                                                {
                                                                    Store (0x0D, BRNS)
                                                                }
                                                                Else
                                                                {
                                                                    If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x10)), One
                                                                        )))
                                                                    {
                                                                        Store (0x0E, BRNS)
                                                                    }
                                                                    Else
                                                                    {
                                                                        If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x11)), One
                                                                            )))
                                                                        {
                                                                            Store (0x0F, BRNS)
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            Store (BRNS, ^LPCB.EC0.ECLV)
            UCMS (0x14)

Basically it is an unrolled loop looking at the IBCL table, mapping the Arg0 value to an entry in the table and eventually storing in ECLV. I guess we should not let hardware guys write code. The code above could have been written:
Code:
        Method (IBCM, 1, NotSerialized)
        {
            Store (Match (IBCL, MGE, Arg0, MTR, Zero, 2), Local0)
            If (LEqual(Local0, Ones)) { Subtract(SizeOf(IBCL), 1, Local0) }\n
            Store (Local0, BRNS)
            Store (BRNS, ^LPCB.EC0.ECLV)
            UCMS (0x14)
        }

Given that code and the fact that there are only 16 hardware levels (and no completely black level), there isn't much improvement to be made. I believe because OS X wants 17 levels (black included) and the DSDT is only providing 16, you'll end up with the 2nd to top and 3rd to top levels being the same level.

But here a couple of patches... feel free to experiment. If you discovered a way to get more than 16 levels, there would be more possibilities.

patch1 (directly manipulate ECLV; top two levels are same):
Code:
into device label IGPU code_regex (OperationRegion\s\(IGD2,\sPCI_Config[^\}]*\}) remove_matched;
into device label IGPU code_regex (OperationRegion\s\(IGDP,\sPCI_Config[^\}]*\}) replace_matched
begin
%1\n
OperationRegion (IGD2, PCI_Config, 0x10, 4)\n
Field (IGD2, AnyAcc, NoLock, Preserve)\n
{\n
	BAR1,32,\n
}\n
end;

into device label PNLF remove_entry;
into definitionblock code_regex . insert
begin
Scope (\_SB)\n
{\n
    Device (PNLF)\n
    {\n
        // normal PNLF declares (note some of this probably not necessary)\n
        Name (_HID, EisaId ("APP0002"))\n
        Name (_CID, "backlight")\n
        Name (_UID, 10)\n
        Name (_STA, 0x0B)\n
        //define hardware register access for brightness\n
        // you can see BAR1 value in RW-Everything under Bus00,02 Intel VGA controler PCI\n
        OperationRegion (BRIT, SystemMemory, \_SB.PCI0.IGPU.BAR1, 0xc8254)\n
        Field (BRIT, AnyAcc, Lock, Preserve)\n
        {\n
            Offset(0x4824c),\n
            LEV2, 32,\n
            LEVL, 32,\n
            Offset(0x7003C),\n
            P0BL, 32,\n
            Offset(0xc824c),\n
            LEVW, 32,\n
            LEVX, 32,\n
        }\n
        // DEB1 special for setting KLVX at runtime...\n
        //Method (DEB1, 1, NotSerialized)\n
        //{\n
        //    Store(Arg0, KLVX)\n
        //}\n
        // _INI deals with differences between native setting and desired\n
        Name (BRTL, 15)\n
        Method (_INI, 0, NotSerialized)\n
        {\n
            /*\n
            Store(ShiftRight(KLVX,16), Local0)\n
            Store(ShiftRight(LEVX,16), Local1)\n
            if (LNotEqual(Local0, Local1))\n
            {\n
                Divide(Multiply(LEVL, Local0), Local1,, Local0)\n
                //Store(P0BL, Local1)\n
                //While(LEqual (P0BL, Local1)) {}\n
                Store(Local0, LEVL)\n
                Store(KLVX, LEVX)\n
            }\n
            */\n
            // Note: Not sure if ECLV is read/write (may be write only)\n
            // comment this line out if reading is unreliable\n
            Store(\_SB.PCI0.LPCB.EC0.ECLV, BRTL)\n
        }\n
        // _BCM/_BQC: set/get for brightness level\n
        Method (_BCM, 1, NotSerialized)\n
        {\n
            /*\n
            // initialize for consistent backlight level before/after sleep\n
            If (LNotEqual(LEVW, 0x80000000)) { Store (0x80000000, LEVW) }\n
            If (LNotEqual(LEVX, KLVX)) { Store (KLVX, LEVX) }\n
            */\n
            // Update backlight via EC\n
            Store(Match(_BCL, MGE, Arg0, MTR, 0, 2), Local0)\n
            If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }\n
            Store(Local0, \_SB.PCI0.LPCB.EC0.ECLV)\n
            UCMS(0x14)\n
            Store(Local0, BRTL)\n
        }\n
        Method (_BQC, 0, NotSerialized)\n
        {\n
            /*\n
            Store(Match(_BCL, MGE, \_SB.PCI0.LPCB.EC0.ECLV, MTR, 0, 2), Local0)\n
            If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }\n
            Return(DerefOf(Index(_BCL, Local0)))\n
            */\n
            Return(BRTL)\n
        }\n
        Method (_DOS, 1, NotSerialized)\n
        {\n
            ^^PCI0.IGPU._DOS(Arg0)\n
        }\n
    }\n
}\n
end;

into device label PNLF code_regex Name\s\(_BCL,\sPackage[^\}]*\}\) remove_matched;
into device label PNLF code_regex Name\s\(XOPT,.*\)\n removeall_matched;
into device label PNLF code_regex Name\s\(XRGL,.*\)\n removeall_matched;
into device label PNLF code_regex Name\s\(XRGH,.*\)\n removeall_matched;
into device label PNLF code_regex Name\s\(KLVX,.*\)\n removeall_matched;
into device label PNLF code_regex . insert
begin
    // Use XOPT=1 to disable smooth transitions\n
    Name (XOPT, Zero)\n
    // XRGL/XRGH: defines the valid range\n
    Name (XRGL, 1)\n
    Name (XRGH, 15)\n
    // KLVX is initialization value for LEVX\n
    Name (KLVX, 0x7100000)\n
    // _BCL: returns list of valid brightness levels\n
    // first two entries describe ac/battery power levels\n
    Name (_BCL, Package()\n
    {\n
        15,\n
        4,\n
        0,\n
        1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,15\n
    })\n
end;

patch2 (call into existing _BQC/_BCM, but use custom _BCL; top two levels are same)
Code:
into device label IGPU code_regex (OperationRegion\s\(IGD2,\sPCI_Config[^\}]*\}) remove_matched;
into device label IGPU code_regex (OperationRegion\s\(IGDP,\sPCI_Config[^\}]*\}) replace_matched
begin
%1\n
OperationRegion (IGD2, PCI_Config, 0x10, 4)\n
Field (IGD2, AnyAcc, NoLock, Preserve)\n
{\n
	BAR1,32,\n
}\n
end;

into device label PNLF remove_entry;
into definitionblock code_regex . insert
begin
Scope (\_SB)\n
{\n
    Device (PNLF)\n
    {\n
        // normal PNLF declares (note some of this probably not necessary)\n
        Name (_HID, EisaId ("APP0002"))\n
        Name (_CID, "backlight")\n
        Name (_UID, 10)\n
        Name (_STA, 0x0B)\n
        //define hardware register access for brightness\n
        // you can see BAR1 value in RW-Everything under Bus00,02 Intel VGA controler PCI\n
        OperationRegion (BRIT, SystemMemory, \_SB.PCI0.IGPU.BAR1, 0xc8254)\n
        Field (BRIT, AnyAcc, Lock, Preserve)\n
        {\n
            Offset(0x4824c),\n
            LEV2, 32,\n
            LEVL, 32,\n
            Offset(0x7003C),\n
            P0BL, 32,\n
            Offset(0xc824c),\n
            LEVW, 32,\n
            LEVX, 32,\n
        }\n
        // DEB1 special for setting KLVX at runtime...\n
        //Method (DEB1, 1, NotSerialized)\n
        //{\n
        //    Store(Arg0, KLVX)\n
        //}\n
        // _INI deals with differences between native setting and desired\n
        Method (_INI, 0, NotSerialized)\n
        {\n
            /*\n
            Store(ShiftRight(KLVX,16), Local0)\n
            Store(ShiftRight(LEVX,16), Local1)\n
            if (LNotEqual(Local0, Local1))\n
            {\n
                Divide(Multiply(LEVL, Local0), Local1,, Local0)\n
                //Store(P0BL, Local1)\n
                //While(LEqual (P0BL, Local1)) {}\n
                Store(Local0, LEVL)\n
                Store(KLVX, LEVX)\n
            }\n
            */\n
        }\n
        // _BCM/_BQC: set/get for brightness level\n
        Method (_BCM, 1, NotSerialized)\n
        {\n
            /*\n
            // initialize for consistent backlight level before/after sleep\n
            If (LNotEqual(LEVW, 0x80000000)) { Store (0x80000000, LEVW) }\n
            If (LNotEqual(LEVX, KLVX)) { Store (KLVX, LEVX) }\n
            */\n
            // Update backlight via existing DSDT methods\n
            ^^PCI0.IGPU.DD02._BCM(Arg0)\n
        }\n
        Method (_BQC, 0, NotSerialized)\n
        {\n
            Return(^^PCI0.IGPU.DD02._BQC())\n
        }\n
        Method (_DOS, 1, NotSerialized)\n
        {\n
            ^^PCI0.IGPU._DOS(Arg0)\n
        }\n
    }\n
}\n
end;

into device label PNLF code_regex Name\s\(_BCL,\sPackage[^\}]*\}\) remove_matched;
into device label PNLF code_regex Name\s\(XOPT,.*\)\n removeall_matched;
into device label PNLF code_regex Name\s\(XRGL,.*\)\n removeall_matched;
into device label PNLF code_regex Name\s\(XRGH,.*\)\n removeall_matched;
into device label PNLF code_regex Name\s\(KLVX,.*\)\n removeall_matched;
into device label PNLF code_regex . insert
begin
    // Use XOPT=1 to disable smooth transitions\n
    Name (XOPT, Zero)\n
    // XRGL/XRGH: defines the valid range\n
    Name (XRGL, 1)\n
    Name (XRGH, 0x64)\n
    // KLVX is initialization value for LEVX\n
    Name (KLVX, 0x7100000)\n
    // _BCL: returns list of valid brightness levels\n
    // first two entries describe ac/battery power levels\n
    Name (_BCL, Package()\n
    {\n
        //Note: data from IBCL + zero + duplicated max\n
        0x64,\n
        0x23,\n
            0x14,// equivalent to 0\n
            0x19,\n
            0x1E,\n
            0x23,\n
            0x28,\n
            0x2D,\n
            0x32,\n
            0x37,\n
            0x3C,\n
            0x41,\n
            0x46,\n
            0x4B,\n
            0x50,\n
            0x55,\n
            0x5A,\n
            0x64,\n
            0x64,\n
    })\n
end;
 
Could you please post the fix? thx
To get rid of the boot spamming regarding network delay. First, find your SMboardproduct in /Extra/smbios.plist
81024-key1.png


Add a key, specifying the network delay, to the corresponding platform .plist found in /S/L/E/IOPlatformPluginFamily.kext/Contents/PlugIns/X86PlatformPlugin.kext/Contents/Resources
81027-key3.png


81026-key2.png

If you're not using a gui plist editor, here's the code:
Code:
<key>NetworkTimerDelay</key>
<integer>900</integer>
And, of course, make sure you repair permissions.
 
Last edited by a moderator:
That's what I figured. Here's what I find looking at your DSDT brightness methods:


- The backlight is controlled by the EC at ECLV in EmbeddedControl
- The values stored there range 0-15, for 16 different levels


What is the progress on backlight/brightness control? I haven't been around much lately. Just curious about recent developments that may be of interest for my machine and/or for the guide? About to post updated AppleHDA and Capri for 10.9.1 on the combined thread.
 
What is the progress on backlight/brightness control? I haven't been around much lately. Just curious about recent developments that may be of interest for my machine and/or for the guide? About to post updated AppleHDA and Capri for 10.9.1 on the combined thread.

Progress made with laptops which use the IGPU PWM backlight hardware...

See:
http://www.tonymacx86.com/hp-probook-mavericks/118805-full-range-brightness-using-acpibacklight.html
http://www.tonymacx86.com/hp-proboo...screen-using-patched-applebacklight-kext.html

If you read the last couple of pages here, ikkoku tried the same technique on his U310 and it appears Lenovo does not use the IGPU hardware to control the backlight. Instead it is controlled by the EC...

Since you were already using ACPIBacklight, there is some benefit to using my updated fork of the code:
- I fixed some bugs (hopefully didn't create new ones)
- backlight level should be restored on reboot, provided nvram is working
- additional flexibility with DSDT patches TBD...
 
That's what I figured. Here's what I find looking at your DSDT brightness methods:

- The backlight is controlled by the EC at ECLV in EmbeddedControl
- The values stored there range 0-15, for 16 different levels

Here is the code which does it:
Code:
        Method (IBCM, 1, NotSerialized)
        {
            Store (Arg0, EBRL)
            If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x02)), One
                )))
            {
                Store (Zero, BRNS)
            }
            Else
            {
                If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x03)), One
                    )))
                {
                    Store (One, BRNS)
                }
                Else
                {
                    If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x04)), One
                        )))
                    {
                        Store (0x02, BRNS)
                    }
                    Else
                    {
                        If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x05)), One
                            )))
                        {
                            Store (0x03, BRNS)
                        }
                        Else
                        {
                            If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x06)), One
                                )))
                            {
                                Store (0x04, BRNS)
                            }
                            Else
                            {
                                If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x07)), One
                                    )))
                                {
                                    Store (0x05, BRNS)
                                }
                                Else
                                {
                                    If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x08)), One
                                        )))
                                    {
                                        Store (0x06, BRNS)
                                    }
                                    Else
                                    {
                                        If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x09)), One
                                            )))
                                        {
                                            Store (0x07, BRNS)
                                        }
                                        Else
                                        {
                                            If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x0A)), One
                                                )))
                                            {
                                                Store (0x08, BRNS)
                                            }
                                            Else
                                            {
                                                If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x0B)), One
                                                    )))
                                                {
                                                    Store (0x09, BRNS)
                                                }
                                                Else
                                                {
                                                    If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x0C)), One
                                                        )))
                                                    {
                                                        Store (0x0A, BRNS)
                                                    }
                                                    Else
                                                    {
                                                        If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x0D)), One
                                                            )))
                                                        {
                                                            Store (0x0B, BRNS)
                                                        }
                                                        Else
                                                        {
                                                            If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x0E)), One
                                                                )))
                                                            {
                                                                Store (0x0C, BRNS)
                                                            }
                                                            Else
                                                            {
                                                                If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x0F)), One
                                                                    )))
                                                                {
                                                                    Store (0x0D, BRNS)
                                                                }
                                                                Else
                                                                {
                                                                    If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x10)), One
                                                                        )))
                                                                    {
                                                                        Store (0x0E, BRNS)
                                                                    }
                                                                    Else
                                                                    {
                                                                        If (LLess (EBRL, Add (DerefOf (Index (IBCL, 0x11)), One
                                                                            )))
                                                                        {
                                                                            Store (0x0F, BRNS)
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            Store (BRNS, ^LPCB.EC0.ECLV)
            UCMS (0x14)

Basically it is an unrolled loop looking at the IBCL table, mapping the Arg0 value to an entry in the table and eventually storing in ECLV. I guess we should not let hardware guys write code. The code above could have been written:
Code:
        Method (IBCM, 1, NotSerialized)
        {
            Store (Match (IBCL, MGE, Arg0, MTR, Zero, 2), Local0)
            If (LEqual(Local0, Ones)) { Subtract(SizeOf(IBCL), 1, Local0) }\n
            Store (Local0, BRNS)
            Store (BRNS, ^LPCB.EC0.ECLV)
            UCMS (0x14)
        }

Given that code and the fact that there are only 16 hardware levels (and no completely black level), there isn't much improvement to be made. I believe because OS X wants 17 levels (black included) and the DSDT is only providing 16, you'll end up with the 2nd to top and 3rd to top levels being the same level.

But here a couple of patches... feel free to experiment. If you discovered a way to get more than 16 levels, there would be more possibilities.

patch1 (directly manipulate ECLV; top two levels are same):
Code:
into device label IGPU code_regex (OperationRegion\s\(IGD2,\sPCI_Config[^\}]*\}) remove_matched;
into device label IGPU code_regex (OperationRegion\s\(IGDP,\sPCI_Config[^\}]*\}) replace_matched
begin
%1\n
OperationRegion (IGD2, PCI_Config, 0x10, 4)\n
Field (IGD2, AnyAcc, NoLock, Preserve)\n
{\n
    BAR1,32,\n
}\n
end;

into device label PNLF remove_entry;
into definitionblock code_regex . insert
begin
Scope (\_SB)\n
{\n
    Device (PNLF)\n
    {\n
        // normal PNLF declares (note some of this probably not necessary)\n
        Name (_HID, EisaId ("APP0002"))\n
        Name (_CID, "backlight")\n
        Name (_UID, 10)\n
        Name (_STA, 0x0B)\n
        //define hardware register access for brightness\n
        // you can see BAR1 value in RW-Everything under Bus00,02 Intel VGA controler PCI\n
        OperationRegion (BRIT, SystemMemory, \_SB.PCI0.IGPU.BAR1, 0xc8254)\n
        Field (BRIT, AnyAcc, Lock, Preserve)\n
        {\n
            Offset(0x4824c),\n
            LEV2, 32,\n
            LEVL, 32,\n
            Offset(0x7003C),\n
            P0BL, 32,\n
            Offset(0xc824c),\n
            LEVW, 32,\n
            LEVX, 32,\n
        }\n
        // DEB1 special for setting KLVX at runtime...\n
        //Method (DEB1, 1, NotSerialized)\n
        //{\n
        //    Store(Arg0, KLVX)\n
        //}\n
        // _INI deals with differences between native setting and desired\n
        Name (BRTL, 15)\n
        Method (_INI, 0, NotSerialized)\n
        {\n
            /*\n
            Store(ShiftRight(KLVX,16), Local0)\n
            Store(ShiftRight(LEVX,16), Local1)\n
            if (LNotEqual(Local0, Local1))\n
            {\n
                Divide(Multiply(LEVL, Local0), Local1,, Local0)\n
                //Store(P0BL, Local1)\n
                //While(LEqual (P0BL, Local1)) {}\n
                Store(Local0, LEVL)\n
                Store(KLVX, LEVX)\n
            }\n
            */\n
            // Note: Not sure if ECLV is read/write (may be write only)\n
            // comment this line out if reading is unreliable\n
            Store(\_SB.PCI0.LPCB.EC0.ECLV, BRTL)\n
        }\n
        // _BCM/_BQC: set/get for brightness level\n
        Method (_BCM, 1, NotSerialized)\n
        {\n
            /*\n
            // initialize for consistent backlight level before/after sleep\n
            If (LNotEqual(LEVW, 0x80000000)) { Store (0x80000000, LEVW) }\n
            If (LNotEqual(LEVX, KLVX)) { Store (KLVX, LEVX) }\n
            */\n
            // Update backlight via EC\n
            Store(Match(_BCL, MGE, Arg0, MTR, 0, 2), Local0)\n
            If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }\n
            Store(Local0, \_SB.PCI0.LPCB.EC0.ECLV)\n
            UCMS(0x14)\n
            Store(Local0, BRTL)\n
        }\n
        Method (_BQC, 0, NotSerialized)\n
        {\n
            /*\n
            Store(Match(_BCL, MGE, \_SB.PCI0.LPCB.EC0.ECLV, MTR, 0, 2), Local0)\n
            If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }\n
            Return(DerefOf(Index(_BCL, Local0)))\n
            */\n
            Return(BRTL)\n
        }\n
        Method (_DOS, 1, NotSerialized)\n
        {\n
            ^^PCI0.IGPU._DOS(Arg0)\n
        }\n
    }\n
}\n
end;

into device label PNLF code_regex Name\s\(_BCL,\sPackage[^\}]*\}\) remove_matched;
into device label PNLF code_regex Name\s\(XOPT,.*\)\n removeall_matched;
into device label PNLF code_regex Name\s\(XRGL,.*\)\n removeall_matched;
into device label PNLF code_regex Name\s\(XRGH,.*\)\n removeall_matched;
into device label PNLF code_regex Name\s\(KLVX,.*\)\n removeall_matched;
into device label PNLF code_regex . insert
begin
    // Use XOPT=1 to disable smooth transitions\n
    Name (XOPT, Zero)\n
    // XRGL/XRGH: defines the valid range\n
    Name (XRGL, 1)\n
    Name (XRGH, 15)\n
    // KLVX is initialization value for LEVX\n
    Name (KLVX, 0x7100000)\n
    // _BCL: returns list of valid brightness levels\n
    // first two entries describe ac/battery power levels\n
    Name (_BCL, Package()\n
    {\n
        15,\n
        4,\n
        0,\n
        1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,15\n
    })\n
end;

patch2 (call into existing _BQC/_BCM, but use custom _BCL; top two levels are same)
Code:
into device label IGPU code_regex (OperationRegion\s\(IGD2,\sPCI_Config[^\}]*\}) remove_matched;
into device label IGPU code_regex (OperationRegion\s\(IGDP,\sPCI_Config[^\}]*\}) replace_matched
begin
%1\n
OperationRegion (IGD2, PCI_Config, 0x10, 4)\n
Field (IGD2, AnyAcc, NoLock, Preserve)\n
{\n
    BAR1,32,\n
}\n
end;

into device label PNLF remove_entry;
into definitionblock code_regex . insert
begin
Scope (\_SB)\n
{\n
    Device (PNLF)\n
    {\n
        // normal PNLF declares (note some of this probably not necessary)\n
        Name (_HID, EisaId ("APP0002"))\n
        Name (_CID, "backlight")\n
        Name (_UID, 10)\n
        Name (_STA, 0x0B)\n
        //define hardware register access for brightness\n
        // you can see BAR1 value in RW-Everything under Bus00,02 Intel VGA controler PCI\n
        OperationRegion (BRIT, SystemMemory, \_SB.PCI0.IGPU.BAR1, 0xc8254)\n
        Field (BRIT, AnyAcc, Lock, Preserve)\n
        {\n
            Offset(0x4824c),\n
            LEV2, 32,\n
            LEVL, 32,\n
            Offset(0x7003C),\n
            P0BL, 32,\n
            Offset(0xc824c),\n
            LEVW, 32,\n
            LEVX, 32,\n
        }\n
        // DEB1 special for setting KLVX at runtime...\n
        //Method (DEB1, 1, NotSerialized)\n
        //{\n
        //    Store(Arg0, KLVX)\n
        //}\n
        // _INI deals with differences between native setting and desired\n
        Method (_INI, 0, NotSerialized)\n
        {\n
            /*\n
            Store(ShiftRight(KLVX,16), Local0)\n
            Store(ShiftRight(LEVX,16), Local1)\n
            if (LNotEqual(Local0, Local1))\n
            {\n
                Divide(Multiply(LEVL, Local0), Local1,, Local0)\n
                //Store(P0BL, Local1)\n
                //While(LEqual (P0BL, Local1)) {}\n
                Store(Local0, LEVL)\n
                Store(KLVX, LEVX)\n
            }\n
            */\n
        }\n
        // _BCM/_BQC: set/get for brightness level\n
        Method (_BCM, 1, NotSerialized)\n
        {\n
            /*\n
            // initialize for consistent backlight level before/after sleep\n
            If (LNotEqual(LEVW, 0x80000000)) { Store (0x80000000, LEVW) }\n
            If (LNotEqual(LEVX, KLVX)) { Store (KLVX, LEVX) }\n
            */\n
            // Update backlight via existing DSDT methods\n
            ^^PCI0.IGPU.DD02._BCM(Arg0)\n
        }\n
        Method (_BQC, 0, NotSerialized)\n
        {\n
            Return(^^PCI0.IGPU.DD02._BQC())\n
        }\n
        Method (_DOS, 1, NotSerialized)\n
        {\n
            ^^PCI0.IGPU._DOS(Arg0)\n
        }\n
    }\n
}\n
end;

into device label PNLF code_regex Name\s\(_BCL,\sPackage[^\}]*\}\) remove_matched;
into device label PNLF code_regex Name\s\(XOPT,.*\)\n removeall_matched;
into device label PNLF code_regex Name\s\(XRGL,.*\)\n removeall_matched;
into device label PNLF code_regex Name\s\(XRGH,.*\)\n removeall_matched;
into device label PNLF code_regex Name\s\(KLVX,.*\)\n removeall_matched;
into device label PNLF code_regex . insert
begin
    // Use XOPT=1 to disable smooth transitions\n
    Name (XOPT, Zero)\n
    // XRGL/XRGH: defines the valid range\n
    Name (XRGL, 1)\n
    Name (XRGH, 0x64)\n
    // KLVX is initialization value for LEVX\n
    Name (KLVX, 0x7100000)\n
    // _BCL: returns list of valid brightness levels\n
    // first two entries describe ac/battery power levels\n
    Name (_BCL, Package()\n
    {\n
        //Note: data from IBCL + zero + duplicated max\n
        0x64,\n
        0x23,\n
            0x14,// equivalent to 0\n
            0x19,\n
            0x1E,\n
            0x23,\n
            0x28,\n
            0x2D,\n
            0x32,\n
            0x37,\n
            0x3C,\n
            0x41,\n
            0x46,\n
            0x4B,\n
            0x50,\n
            0x55,\n
            0x5A,\n
            0x64,\n
            0x64,\n
    })\n
end;

way over my head now. So if I apply patch1 or 2, what does it get me?
 
Status
Not open for further replies.
Back
Top