Jump to content

Brightness after sleep fix - Toshiba Portege R835

sleep brightness dsdt

Best Answer LioChan, 18 October 2013 - 07:23 AM

Hi,glcnacy, actually i have the black screen issue, sleep works fine both power button and LID, but when i wake up it, just black screen, i can hear the fan spin.

so, i don't know the problem is the same like you have. Also, you said add this code to wake up screen,

\_SB.PCI0.GFX0.DD02._DSS (0x04C4B401)

my question is where is "(0x04C4B401)" comes from ?

THX in advance. 

 

The number is 80000001 in decimal. You need to set specific bits.It is from ACPI 4 definition

 
Table B-6  Device State for _DSS
 
Bits          Definition
 
0               0 – Set output device to inactive state
1 – Set output device to active state
 
30             0 – Do whatever Bit 31 requires
1 – Don’t do actual switching, but need to change _DGS to next state
 
31             0 – Don’t do actual switching, just cache the change
1 – If Bit 30 = 0, commit actual switching, including any _DSS with MSB=0 called before
If Bit 30 = 1, don’t do actual switching, change _DGS to next state
 
1-29          Reserved (must be zero)
 
PS: I think the number should be 0x80000001, as I checked now the bits and bit 31 is set only in that case
 
PS2: It turned out that under 10.9 another value should be used: 0xC0000001 is reported working.
Go to the full post


  • Please log in to reply
17 replies to this topic

#1
LioChan

LioChan

    InsanelyMac Protégé

  • Members
  • Pip
  • 27 posts
  • Gender:Male
  • Interests:chess, software and bikes

After many weeks of trying I finally managed to figure out how to make the display wake correctly.
 
After adding a PNLF device I didn't have problems with the brightness, but after sleep it would stay black when not using additional kexts.
The problem with these kexts was that after sleep I got maximum brightness and no way to modify it.
 

The fix was adding 3 lines to the beginning of my _WAK method: 

    Method (_WAK, 1, Serialized)
    {  
       \_SB.PCI0.GFX0.DD02._DSS (0x04C4B401) //wake device
       Notify (\_SB.PCI0.GFX0.DD02, 0x86) //increase brightness
       \_SB.PCI0.GFX0.DD02._BCM (0x37)  //set brightness to 55% 

My PNLF

 Device (PNLF)
    {
        Name (_HID, EisaId ("APP0002"))
        Name (_CID, "backlight")
        Name (_UID, 0x0A)
        Name (_STA, 0x0B)
        Method (_BCL, 0, NotSerialized)
        {
            Return (^^_SB.PCI0.GFX0.DD02._BCL ())
        }

        Method (_BCM, 1, NotSerialized)
        {
            ^^_SB.PCI0.GFX0.DD02._BCM (Arg0)
        }

        Method (_BQC, 0, NotSerialized)
        {
            Return (^^_SB.PCI0.GFX0.DD02._BQC ())
        }
    }

Also I modified the DD02 device (LCD) to have a _DOS method and corrected the _BCL  method.

                    Method (_DOS, 1, NotSerialized)
                    {
                        VDOS (Arg0)
                    }

                    Method (_BCL, 0, Serialized)
                    {
                        Name (BUFF, Package (0x12)
                        {
                            0x64, 
                            0x37, 
                            0x0A, 
                            0x0F, 
                            0x1E, 
                            0x28, 
                            0x37, 
                            0x41, 
                            0x50, 
                            0x64, 
                            0x64, 
                            0x64, 
                            0x64, 
                            0x64, 
                            0x64, 
                            0x64, 
                            0x64, 
                            0x64
                        })
                        Store (BRTD, Index (BUFF, Zero))
                        Store (BRTB, Index (BUFF, One))
                        Store (BRT0, Index (BUFF, 0x02))
                        Store (BRT1, Index (BUFF, 0x03))
                        Store (BRT2, Index (BUFF, 0x04))
                        Store (BRT3, Index (BUFF, 0x05))
                        Store (BRT4, Index (BUFF, 0x06))
                        Store (BRT5, Index (BUFF, 0x07))
                        Store (BRT6, Index (BUFF, 0x08))
                        Store (BRT7, Index (BUFF, 0x09))
                        If (LAnd (LLess (OSYS, 0x07D6), HPSU))
                        {
                            Store (BCLA, Index (BUFF, Zero))
                            Store (BCLD, Index (BUFF, One))
                        }

                        Return (BUFF)
                    }

No additional kext are now needed to make brightness work.

 

I hope this helps others as well.

 

For me now there is only the sound after wake issue which I currently solve buy just reloading the AppleHDA kext.

 

Attached File  DSDT.zip   43.27KB   30 downloads

 

All my kexts in one file:

https://docs.google....dit?usp=sharing



#2
LioChan

LioChan

    InsanelyMac Protégé

  • Members
  • Pip
  • 27 posts
  • Gender:Male
  • Interests:chess, software and bikes

I made some small modifications to the code above to be able to store brightness value after sleep.

For this you need to create a new variable in the OperationRegion where BRT1-7 are declared (it should be last). I named it BRTX.

In DD02 method BCM, enter the following:

Method (_BCM, 1, NotSerialized)
{
     Store(Arg0, BRTX) 

This will store the brightness level after each brightness change.

In method _WAK replace the fixed 55% correction to the BRTX stored value.

Method (_WAK, 1, Serialized)
{  
   \_SB.PCI0.GFX0.DD02._DSS (0xC0000001) //wake device, originally it was 0x04C4B401m but for 10.9 not working
    Notify (\_SB.PCI0.GFX0.DD02, 0x86) //increase brightness
    \_SB.PCI0.GFX0.DD02._BCM (BRTX)  //set brightness to The stored value

Please leave some feedback if it is working for others

 

Also there is a way to store brightness after sleep. FileNVRAM thread here: http://www.insanelym...m-113-released/



#3
Zprood

Zprood

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 251 posts
  • Gender:Male
  • Location:CHN

Hi,glcnacy, actually i have the black screen issue, sleep works fine both power button and LID, but when i wake up it, just black screen, i can hear the fan spin.

so, i don't know the problem is the same like you have. Also, you said add this code to wake up screen,

\_SB.PCI0.GFX0.DD02._DSS (0x04C4B401)

my question is where is "(0x04C4B401)" comes from ?

THX in advance. 



#4
LioChan

LioChan

    InsanelyMac Protégé

  • Members
  • Pip
  • 27 posts
  • Gender:Male
  • Interests:chess, software and bikes

Best Answer

Hi,glcnacy, actually i have the black screen issue, sleep works fine both power button and LID, but when i wake up it, just black screen, i can hear the fan spin.

so, i don't know the problem is the same like you have. Also, you said add this code to wake up screen,

\_SB.PCI0.GFX0.DD02._DSS (0x04C4B401)

my question is where is "(0x04C4B401)" comes from ?

THX in advance. 

 

The number is 80000001 in decimal. You need to set specific bits.It is from ACPI 4 definition

 
Table B-6  Device State for _DSS
 
Bits          Definition
 
0               0 – Set output device to inactive state
1 – Set output device to active state
 
30             0 – Do whatever Bit 31 requires
1 – Don’t do actual switching, but need to change _DGS to next state
 
31             0 – Don’t do actual switching, just cache the change
1 – If Bit 30 = 0, commit actual switching, including any _DSS with MSB=0 called before
If Bit 30 = 1, don’t do actual switching, change _DGS to next state
 
1-29          Reserved (must be zero)
 
PS: I think the number should be 0x80000001, as I checked now the bits and bit 31 is set only in that case
 
PS2: It turned out that under 10.9 another value should be used: 0xC0000001 is reported working.


#5
Zprood

Zprood

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 251 posts
  • Gender:Male
  • Location:CHN

 

The number is 80000001 in decimal. You need to set specific bits.It is from ACPI 4 definition

 
Table B-6  Device State for _DSS
 
Bits          Definition
 
0               0 – Set output device to inactive state
1 – Set output device to active state
 
30             0 – Do whatever Bit 31 requires
1 – Don’t do actual switching, but need to change _DGS to next state
 
31             0 – Don’t do actual switching, just cache the change
1 – If Bit 30 = 0, commit actual switching, including any _DSS with MSB=0 called before
If Bit 30 = 1, don’t do actual switching, change _DGS to next state
 
1-29          Reserved (must be zero)
 
PS: I think the number should be 0x80000001, as I checked now the bits and bit 31 is set only in that case

 

Yeah, you're right, i just review acpi spec 4. It's works on me by testing. Thanks a lot.



#6
redracer68

redracer68

    InsanelyMac Protégé

  • Members
  • Pip
  • 12 posts

Would you be able to help me out with my DSDT?  I have a Lenovo X201 with Everything working EXCEPT for this backlight problem.

However, things in my DSDT are set up a little differently and I can't quite make sense of it as I don't have too much DSDT practice.

Attaching my DSDT just in case.   I have a standing offer of 20 dollars paypal donation for whomever can help me get it working in another thread. 

 

I've looked around and it seems like my backlight isn't getting the wake signal sent to is by the DSDT though. 

 

Here's one of my threads.  http://forum.osxlati...sy-please-help/



#7
LioChan

LioChan

    InsanelyMac Protégé

  • Members
  • Pip
  • 27 posts
  • Gender:Male
  • Interests:chess, software and bikes

Would you be able to help me out with my DSDT?  I have a Lenovo X201 with Everything working EXCEPT for this backlight problem.

However, things in my DSDT are set up a little differently and I can't quite make sense of it as I don't have too much DSDT practice.

Attaching my DSDT just in case.   I have a standing offer of 20 dollars paypal donation for whomever can help me get it working in another thread. 

 

I've looked around and it seems like my backlight isn't getting the wake signal sent to is by the DSDT though. 

 

Here's one of my threads.  http://forum.osxlati...sy-please-help/

 

Hi!

 

I skipped over your DSDT and tried to identify the devices.

If I understood it correctly, your GFX0 is called VID. Now, we can make a test. Inside the _WAK method enter the following:

    Method (_WAK, 1, NotSerialized)
    {
        \_SB.PCI0.VID.LCD0._DSS (0xC0000001)
        Notify (\_SB.PCI0.VID.LCD0, 0x88)
        \_SB.PCI0.VID.LCD0._BCM(0x32) 

This should get your brightness working after sleep. If it does, I will spend some time to figure out how to store your current brightness.

Currently I cannot do it for you, as I cannot compile your AML. I keep getting error inside the WMI device. If you cannot do it, I will take a look in the weekend.



#8
redracer68

redracer68

    InsanelyMac Protégé

  • Members
  • Pip
  • 12 posts

I found what the compile error was.  Part of windows management instrumentation and it's unneeded.  I removed those and now it recompiles without error. 

 

I was able to enter the above into _WAK and it did not act as expected. 

    But I did notice there is more than one WAK, there is SWAK, BWAK, GWAK and so on.  Is that normal? 

 

I've attached a newer version of my DSDT without any compile errors or warnings if you want to take a look. 

    Also if it helps I can get some more information for you from it.  Anything at all. 

 

Thanks so much for your help so far!

 

**Edited because I forgot the attachment.   :P

Attached Files



#9
LioChan

LioChan

    InsanelyMac Protégé

  • Members
  • Pip
  • 27 posts
  • Gender:Male
  • Interests:chess, software and bikes

I found what the compile error was.  Part of windows management instrumentation and it's unneeded.  I removed those and now it recompiles without error. 

 

I was able to enter the above into _WAK and it did not act as expected. 

    But I did notice there is more than one WAK, there is SWAK, BWAK, GWAK and so on.  Is that normal? 

 

 

Thank you for correcting the DSDT. 

 

Regarding the WAK, it is normal to have more, but you must have one "_WAK".

 

Could you please send to me a copy of ioreg output. I need to see from PCI0 to the first display0 and its backlight kext. I hope the problem is just that you need to use PCI0.PEG.VID... 

| +-o PCI0  <class IOACPIPlatformDevice, id 0x100000136, registered, matche$
    | | +-o AppleACPIPCI  <class AppleACPIPCI, id 0x1000001d6, registered, matc$
    | |   +-o DMIC@0  <class IOPCIDevice, id 0x100000196, registered, matched, $
    | |   | +-o AppleSMCPDRC  <class AppleSMCPDRC, id 0x1000002d3, registered, $
    | |   +-o GFX0@2  <class IOPCIDevice, id 0x10000019a, registered, matched, $
    | |   | +-o AppleIntelSNBGraphicsFB  <class AppleIntelSNBGraphicsFB, id 0x1$
    | |   | | +-o ApplePolicyControl  <class ApplePolicyControl, id 0x1000002fc$
    | |   | | | +-o AppleGraphicsPolicyClient  <class AppleGraphicsPolicyClient$
    | |   | | | +-o AppleGraphicsPolicyClient  <class AppleGraphicsPolicyClient$
    | |   | | +-o AppleMEClientController  <class AppleMEClientController, id 0$
    | |   | +-o AppleIntelFramebuffer@0  <class AppleIntelFramebuffer, id 0x100$
    | |   | | +-o AGPM  <class AGPM, id 0x1000002ec, registered, matched, activ$
    | |   | | | +-o gpu-control  <class IOService, id 0x1000002ed, registered, $
    | |   | | |   +-o IOHWControl  <class IOHWControl, id 0x10000034b, register$
    | |   | | +-o AppleMCCSControlModule  <class AppleMCCSControlModule, id 0x1$
    | |   | | | +-o AppleMCCSParameterHandler  <class AppleMCCSParameterHandler$
    | |   | | +-o AppleUpstreamUserClientDriver  <class AppleUpstreamUserClient$
    | |   | | +-o IOFramebufferI2CInterface  <class IOFramebufferI2CInterface, $
    | |   | | +-o display0  <class IODisplayConnect, id 0x100000331, registered$
    | |   | | | +-o AppleBacklightDisplay  <class AppleBacklightDisplay, id 0x1$


#10
redracer68

redracer68

    InsanelyMac Protégé

  • Members
  • Pip
  • 12 posts

OK,  I'm attaching the IOREG before and after sleep.  (Was weird to do with a flashlight at the screen lol)

 

I'll see if I can narrow down if it's the other device that needs to be used as well. 

 

 

Thank you so much for helping me. 

Attached Files



#11
redracer68

redracer68

    InsanelyMac Protégé

  • Members
  • Pip
  • 12 posts

I tried using the following, sadly no different. 

Just noticed you wanted a different IOreg than what I gave.  Working on it now. 

\_SB.PCI0.PEG.VID.LCD0._DSS (0xC0000001)
Notify (\_SB.PCI0.PEG.VID.LCD0, 0x88)
\_SB.PCI0.PEG.VID.LCD0._BCM (0x32)


#12
LioChan

LioChan

    InsanelyMac Protégé

  • Members
  • Pip
  • 27 posts
  • Gender:Male
  • Interests:chess, software and bikes

OK,  I'm attaching the IOREG before and after sleep.  (Was weird to do with a flashlight at the screen lol)

 

I'll see if I can narrow down if it's the other device that needs to be used as well. 

 

 

Thank you so much for helping me. 

could you please type ioreg > dump.txt into terminal and give me the file.

Most of the day I must use Windows, and can't do much with the files you sent.

 

Thank you!



#13
redracer68

redracer68

    InsanelyMac Protégé

  • Members
  • Pip
  • 12 posts

Edited to add the file too. 

| +-o PCI0@0  <class IOACPIPlatformDevice, id 0x100000142, registered, matc$
    | | +-o AppleACPIPCI  <class AppleACPIPCI, id 0x1000001cd, registered, matc$
    | |   +-o pci8086,44@0  <class IOPCIDevice, id 0x1000001e6, registered, mat$
    | |   | +-o AppleSMCPDRC  <class AppleSMCPDRC, id 0x10000026e, registered, $
    | |   +-o VID@2  <class IOPCIDevice, id 0x10000018a, registered, matched, a$
    | |   | +-o AppleIntelHDGraphicsFB  <class AppleIntelHDGraphicsFB, id 0x100$
    | |   | +-o AppleIntelFramebuffer  <class AppleIntelFramebuffer, id 0x10000$
    | |   | | +-o AppleMCCSControlModule  <class AppleMCCSControlModule, id 0x1$
    | |   | | | +-o AppleMCCSParameterHandler  <class AppleMCCSParameterHandler$
    | |   | | +-o AGPM  <class AGPM, id 0x1000002a7, registered, matched, activ$
    | |   | | | +-o gpu-control  <class IOService, id 0x1000002a8, registered, $
    | |   | | |   +-o IOHWControl  <class IOHWControl, id 0x1000002ce, register$
    | |   | | +-o IOFramebufferI2CInterface  <class IOFramebufferI2CInterface, $
    | |   | | +-o display0  <class IODisplayConnect, id 0x1000002c5, registered$
    | |   | | | +-o AppleBacklightDisplay  <class AppleBacklightDisplay, id 0x1$

Attached Files

  • Attached File  dump.txt   50.47KB   1 downloads


#14
LioChan

LioChan

    InsanelyMac Protégé

  • Members
  • Pip
  • 27 posts
  • Gender:Male
  • Interests:chess, software and bikes

Thank you! Based on this you are using the second device in VID. I think that means you need something like this:

    Method (_WAK, 1, NotSerialized)
    {
       \_SB.PCI0.VID.CRT0._DSS (0xC0000001)
       Notify (\_SB.PCI0.VID.CRT0, 0x88)

       \_SB.PCI0.VID.LCD0._DSS (0xC0000001)
       Notify (\_SB.PCI0.VID.LCD0, 0x88)
       \_SB.PCI0.VID.LCD0._BCM(0x32) 

But there is a problem here, as only LCD0 has brightness control methods. Could you please try to add the lines above and tell me if they are working.

Maybe we have to modify the PNLF device as well, but first let's try this.

 

 

 



#15
redracer68

redracer68

    InsanelyMac Protégé

  • Members
  • Pip
  • 12 posts

Unfortunately still the same. 

I still have an ACPIbacklight.kext in the system from another thread.. Going to try without that guy in there real quick as well. 


Confirmed.  Only thing that changed removing that kext was that I lost the slider in system preferences.



#16
redracer68

redracer68

    InsanelyMac Protégé

  • Members
  • Pip
  • 12 posts

I tried something different this time.  I completely removed the CRT device from the DSDT.  No problems  But still the same issue.


Could we look at the part dealing with display sleep?  That works just fine,  I set it to put the display to sleep at 1 minute and it does.  I click the mouse and it wakes the display instantly.



#17
redracer68

redracer68

    InsanelyMac Protégé

  • Members
  • Pip
  • 12 posts

I spent a few hours last night trying to clear some things up to make the path a little easier for us to make some progress...

 

First, I completely removed all devices under _SB.PCI0.VID so that there is ONLY LCD0.

Then I added the following into _SB.PCI0.VID and it shows in about my mac as GMA4500 now.  So I'm positive the used one is the SB.PCI0.VID.LCD0!

Method (_DSM, 4, NotSerialized)
                {
                    Store (Package (0x08)
                        {
                            "device_type", 
                            Buffer (0x08)
                            {
                                "display"
                            }, 

                            "model", 
                            Buffer (0x0E)
                            {
                                "Intel GMA4500"
                            }, 

                            "AAPL,HasPanel", 
                            Buffer (0x04)
                            {
                                0x01, 0x00, 0x00, 0x00
                            }, 

                            "AAPL,backlight-control", 
                            Buffer (0x04)
                            {
                                0x01, 0x00, 0x00, 0x00
                            }
                        }, Local0)
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                    Return (Local0)
                }

And looking into things a little deeper. I don't think it was saying the second device in VID...  When it says VID@2, looking in my DSDT the address for VID is saying this. Name (_ADR, 0x00020000)! :)

 

I think I'm learning this pretty well thanks to your help!

Attaching my latest version of DSDT if you want to have a look.  Still no backlight after wake though :(


And I just may have noticed something important to this!

According to this.  Some of the posts reference the BCL method of the LCD.  It's supposed to have a lot more than I have.

 

http://www.insanelym...t-driver/page-2

Attached Files



#18
redracer68

redracer68

    InsanelyMac Protégé

  • Members
  • Pip
  • 12 posts

SUCCESS!

 

After using ALL of my free time for the past two weeks and going nearly insane,  I discovered my _WAK method was full of useless stuff.

Following Felix Chan and MNorthern's work HERE,  I cleared out my _WAK method and entered the following.

Method (_WAK, 1, NotSerialized)
{
	 Store (0x80000000, LEVW)
	 Store (0x061A061A, LEVX) // This value should vary based on the RW Everything inspect results
	 Store (0x80000000, LEV2)
	 Store (0x12FF, LEVL)
	 Return (Package (0x02)
	 {
		 Zero,
		 Zero
	 })
}

And also added the following operation regions just before Scope _SB

OperationRegion (BRIT, SystemMemory, 0xF2048254, 0x04)
    Field (BRIT, AnyAcc, Lock, Preserve)
    {
        LEVL,   32
    }

    OperationRegion (BRI2, SystemMemory, 0xF2048250, 0x04)
    Field (BRI2, AnyAcc, Lock, Preserve)
    {
        LEV2,   32
    }

    OperationRegion (BRI3, SystemMemory, 0xF20C8250, 0x04)
    Field (BRI3, AnyAcc, Lock, Preserve)
    {
        LEVW,   32
    }

    OperationRegion (BRI4, SystemMemory, 0xF20C8254, 0x04)
    Field (BRI4, AnyAcc, Lock, Preserve)
    {
        LEVX,   32
    }

After that it wakes from sleep with the previous brightness as it should!!!!  :)

And all of that without additional kexts.

 

Now I just need the slider in system prefs and the sun bezel when changing the brightness with fn+Home (Brightness up) and fn+end (Brightness down)

 

Thank you for all of the help! :thumbsup_anim:







Also tagged with one or more of these keywords: sleep, brightness, dsdt


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy