Jump to content

UPDATED 20.12. GenericBrightness.kext


  • Please log in to reply
671 replies to this topic

#21
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts

Nope, but I took Spark for that.


Do your brightness keys emit scancodes? You could then map them to NX_KEYTYPE_BRIGHTNESS_UP/DOWN in VoodooPS2 and use native onscreen.

@Ivik
Thank for this stuff, My graphic card is intel x3100 ,I can use Fn key with up &down to adjust the brightness ,but no "sun" appears.Here is the logs :

Nov 12 22:24:00 Zproods-MacBook kernel[0]: IG: Invalid firmware max backlight setting
Nov 12 22:24:00 Zproods-MacBook kernel[0]: Acpi brightness levels:16, lowest brightness:20, highest brightness:100 
Nov 12 22:24:01 Zproods-MacBook kernel[0]: We still don't have brightness entry in ioreg... waiting...
And I manually add PNLF device in the dsdt file ,also add those code you mentioned above .
Here is my dsdt file :

Thanks.

regards.


Do you have min/max brightness in ioreg? Slider works? On-screen appears if u have your brightness keys mapped in VoodooPS2. For me it also works with SCR LK (FN+12) for down and pause for up.

#22
JBraddock

JBraddock

    Ph.D (Can) in Human Rights

  • Members
  • PipPipPipPipPipPipPip
  • 549 posts
  • Location:UK
Where do we exactly put this PNLF code in DSDT. I don't have this code in my DSDT by default.

#23
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
I have it bettween SLPB and PWRB.

#24
BlackCH

BlackCH

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,611 posts
  • Gender:Male
  • Location:BCN
Hi, thanks for this!

The normal behavior in my machine is: I can change the brightness up an down with F12 and scroll lock keys, I have the on-screen icon/bar, and the slider in the screen prefpane. I also have the AppleBacklightDisplay loaded under GFX0 in the IOReg. The problem is the brightness does not change smoothly (seems the values OSX sets for the display are not correct).
This is the section of the original DSDT that is in charge of brightness (I think) under (LCD) device:
Name (C1AF, Package (0x0D) /*backlight control of supported brightness levels*/                    {                        0x64,                         0x33,                         0x1E,                         0x25,                         0x2C,                         0x33,                         0x3A,                         0x41,                         0x48,                         0x4F,                         0x56,                         0x5D,                         0x64 /*set in AAPL01,BacklightIntensity for testing*/                    })                    Name (C1B0, 0x00)                    Method (_BCL, 0, Serialized)                    {                        If (LAnd (LEqual (C1B0, 0x00), And (C06C, 0x10)))                        {                            Store (C06E, Local0)                            Store (0x00, 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 (C1AF, Add (Local1, 0x02)))                                Increment (Local1)                            }                            Store (DerefOf (Index (C1AF, 0x05)), Index (C1AF, 0x01))                            Store (Local2, Index (C1AF, 0x00))                            Store (0x01, C1B0)                        }                        Return (C1AF)                    }                    Name (C1B1, 0x64)                    Method (_BCM, 1, Serialized)                    {                        Store (0x00, Local0)                        If (LGreater (\OSDW (), 0x05))                        {                            Or (C05B, 0x40, C05B)                            Store (0x01, Local0)                        }                        Store (Arg0, C1B1)                        Store (Match (C1AF, MGE, Arg0, MTR, 0x00, 0x02), Local1)                        If (LEqual (Local1, Ones))                        {                            Subtract (SizeOf (C1AF), 0x01, Local1)                        }                        Subtract (Local1, 0x02, Local1)                        If (Local0)                        {                            Store (Local1, C072)                            If (LEqual (C169 (), 0x00))                            {                                \_SB.C1B2 (0xEA74, 0x04, Local1, 0x00, 0x00)                            }                            Signal (\_SB.C1AC)                        }                    }                    Method (_BQC, 0, Serialized)                    {                        Store (C1B1, Local0)                        Return (Local0)                    }

I think (correct me if Im wrong) the register to write the brightness value is C1AF (within the EC device)
I've tried the kext and added the code under the PNLF device:

Device (PNLF)        {            Name (_HID, EisaId ("APP0002"))            Name (_CID, "backlight")            Name (_UID, 0x0A)            Name (_STA, 0x0B)            Method (BRGE, 1, Serialized)            {                Store (Arg0, ^^PCI0.LPCB.EC.C1AF)                Return (^^PCI0.LPCB.EC.C1AF)            }                    Method(_BCL, 0x0, NotSerialized)                    {                        Return(Package(0x12)                        {                            0x64,                            0x14,                            0x14,                            0x19,                            0x1e,                            0x23,                            0x28,                            0x2d,                            0x32,                            0x37,                            0x3c,                            0x41,                            0x46,                            0x4b,                            0x50,                            0x55,                            0x5a,                            0x64                        })                    }                    Name(BCLP, Package(0x10)                    {                        0x14,                        0x19,                        0x1e,                        0x23,                        0x28,                        0x2d,                        0x32,                        0x37,                        0x3c,                        0x41,                        0x46,                        0x4b,                        0x50,                        0x55,                        0x5a,                        0x64                    })                    Name(BCLL, Package(0x10)                    {                        0x0,                        0x1,                        0x2,                        0x3,                        0x4,                        0x5,                        0x6,                        0x7,                        0x8,                        0x9,                        0xa,                        0xb,                        0xc,                        0xd,                        0xe,                        0xf                    })                    Method(_BCM, 0x1, NotSerialized)                    {                        Store(Match(BCLP, MEQ, Arg0, MTR, 0x0, 0x0), Local0)                        If(LNot(LEqual(Local0, Ones)))                        {                            Store(DerefOf(Index(BCLL, Local0, )), \_SB_.PCI0.LPCB.EC_.C1AF)                        }                    }                    Method(_BQC, 0x0, NotSerialized)                    {                        Store(\_SB_.PCI0.LPCB.EC_.C1AF, Local0)                        If(LNot(LGreater(Local0, 0xf)))                        {                            Return(DerefOf(Index(BCLP, Local0, )))                        }                        Else                        {                            Return(Zero)                        }                    }        }

As you see I've replaced 'EC0.BRTS' with 'EC.C1AF' but I still get the same buggy brightness change.
I get this on boot:
11/12/10 4:04:46 PM	kernel	Acpi brightness levels:16, lowest brightness:20, highest brightness:100 
11/12/10 4:04:46 PM	kernel	We still don't have brightness entry in ioreg... waiting...

And the io reg:
Attached File  Screen_shot_2010_11_12_at_4.47.24_PM.png   87.77KB   319 downloads

#25
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
It looks like this is right register in EC.

I see that you used my methods. The best way to find out which values are writed to this register is to use RW-everything under windows and watch it how it changes when u change brightness.

For me it is 0x0 for min and 0xF for max brightness.

What do you mean under buggy brightness change?
Brightnes from ioreg is readed once per sec, and if it changed ACPI methods are then called.

#26
quinielascom

quinielascom

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 749 posts
  • Location:M�xico

For me it is 0x0 for min and 0xF for max brightness.

What do you mean under buggy brightness change?


Same problem here, and same values (ioreg) that BlackCH in my Aspire 4320 with X3100 graphics; for example if I press bright "UP" (mapped as Pause) one time the brightness is up but if I press pause again then the screen light is "almost" off and same behavior for Fn+F12 (down).

#27
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
Does it work ok with slider?

#28
quinielascom

quinielascom

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 749 posts
  • Location:M�xico

Does it work ok with slider?


yes, but with same estrange behavior

#29
BlackCH

BlackCH

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,611 posts
  • Gender:Male
  • Location:BCN

What do you mean under buggy brightness change?
Brightnes from ioreg is readed once per sec, and if it changed ACPI methods are then called.


Yes, I tryed your code, but it didnt make a difference yet.

I mean the brightness doesnt change gradually (it jumps up and down until the screen is competely dark) and this happens when pressing keys or moving the slider; moreover, the brightness isnt homogenic along the screen (one half is darker than the other)... I get that with or without your kext/dsdt code. Theres only a small segment of the slider (the upper 5%) in which the brightness control works and the screen looks OK.

I used to patch the X3100 driver (thats what I have on board) in order to bypass the brightness control routine (This method). In this way I could use purely ACPI calls with the keys asigned for brightness up-down (f7 and f8; same as for windows) and it would work fine, but of course I wouldnt get the on-screen icon nor the slider or any brightness-related functions

I will try to read the windows values, but how do you go to make AppleBacklightDisplay to use these values?

#30
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
Could you post your dsdt?

Try moving slider and read brightness from ioreg. Move it slowly and read changes. You must relaunch ioreg after changing brightness
Maybe is some weird offset in ioreg.

Yes, I tryed your code, but it didnt make a difference yet.

I mean the brightness doesnt change gradually (it jumps up and down until the screen is competely dark) and this happens when pressing keys or moving the slider; moreover, the brightness isnt homogenic along the screen (one half is darker than the other)... I get that with or without your kext/dsdt code. Theres only a small segment of the slider (the upper 5%) in which the brightness control works and the screen looks OK.

I used to patch the X3100 driver (thats what I have on board) in order to bypass the brightness control routine (This method). In this way I could use purely ACPI calls with the keys asigned for brightness up-down (f7 and f8; same as for windows) and it would work fine, but of course I wouldnt get the on-screen icon nor the slider or any brightness-related functions

I will try to read the windows values, but how do you go to make AppleBacklightDisplay to use these values?


Post your dsdt. And watch ioreg when changing brightness slider. Values should go linear up/down.

#31
BlackCH

BlackCH

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,611 posts
  • Gender:Male
  • Location:BCN

Post your dsdt. And watch ioreg when changing brightness slider. Values should go linear up/down.


Sure; this is the last Im using

#32
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
OMG... what did you do with your dsdt... :/

It would be better if you posted vanilla one, so many methods modified, deleted...

try this one, maybe could work..

Attached Files



#33
BlackCH

BlackCH

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,611 posts
  • Gender:Male
  • Location:BCN

OMG... what did you do with your dsdt... :/

It would be better if you posted vanilla one, so many methods modified, deleted...

try this one, maybe could work..


I didnt, Im actually testing it by request (seems to work OK though). Sorry, I shouldnt have posted that one
Here is one with minimum modifications if you like to see:
Attached File  dsdt_v0.01.dsl.zip   60.28KB   21 downloads


EDIT:
I tryed the one you uploaded. no changes
The values I can see in the ioreg as I change the brightness by a key stroke are:
1ee, 1cf, 1b0, 191, 173, 154, 135, 116, f7, d8, b9, 9a, 7c, 5d, 3e, 1f, 0

Something I didnt mention before is that I get the message:
11/12/10 3:53:50 PM	kernel	IG: Invalid firmware max backlight setting

Thanks

#34
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
What does with that one kernel log says abou max/min brightness and levels?


Try this one:

Attached Files



#35
BlackCH

BlackCH

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,611 posts
  • Gender:Male
  • Location:BCN

What does with that one kernel log says abou max/min brightness and levels?

Try this one:


No changes on the brightness control.
Kernel log says:

11/12/10 9:15:10 PM	kernel	Acpi brightness levels:11, lowest brightness:30, highest brightness:100

before it was 16 - 20 - 100

#36
quinielascom

quinielascom

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 749 posts
  • Location:M�xico
I tried with the BlackCH posted values and inserted in my dsdt:

Device (PNLF)
		 {
			 Name (_HID, EisaId ("APP0002"))
			 Name (_CID, "backlight")
			 Name (_UID, 0x0A)
			 Name (_STA, 0x0B)
			 Method (_BCL, 0, NotSerialized)
			 {
				 Return (Package (0x12)
				 {
					 0x01EE, 
					 0x001F, 
					 0x001F, 
					 0x003E, 
					 0x005D, 
					 0x007C, 
					 0x009A, 
					 0x00B9, 
					 0x00D8, 
					 0x00F7, 
					 0x0116, 
					 0x0135, 
					 0x0154, 
					 0x0173, 
					 0x0191, 
					 0x01B0, 
					 0x01CF, 
					 0x01EE, 
				 })
			 }
 
			 Name (BCLP, Package (0x10)
			 {
					 0x001F, 
					 0x003E, 
					 0x005D, 
					 0x007C, 
					 0x009A, 
					 0x00B9, 
					 0x00D8, 
					 0x00F7, 
					 0x0116, 
					 0x0135, 
					 0x0154, 
					 0x0173, 
					 0x0191, 
					 0x01B0, 
					 0x01CF, 
					 0x01EE, 
			 })
			 Name (BCLL, Package (0x10)
			 {
				 Zero, 
				 One, 
				 0x02, 
				 0x03, 
				 0x04, 
				 0x05, 
				 0x06, 
				 0x07, 
				 0x08, 
				 0x09, 
				 0x0A, 
				 0x0B, 
				 0x0C, 
				 0x0D, 
				 0x0E, 
				 0x0F, 
			 })
			 Method (_BCM, 1, NotSerialized)
			 {
				 Store (Match (BCLP, MEQ, Arg0, MTR, Zero, Zero), Local0)
				 If (LNotEqual (Local0, Ones))
				 {
					 Store (DerefOf (Index (BCLL, Local0)), ^^PCI0.LPCB.EC0.BLVL)
				 }
			 }
		 Method (_BQC, 0, NotSerialized)
		 {
		 Store(\_SB_.PCI0.LPCB.EC0.BLVL, Local0)
		 If(LNot(LGreater(Local0, 0xf)))
		 {
			 Return(DerefOf(Index(BCLP, Local0, )))
		 }
		 Else
		 {
			 Return(Zero)
		 }
		 }
		 }

And works partially; only the first 8 steps (counted in "sun" icon). I unknow if the step number by default ( in the mine are 9 steps in bios or windows) is related to 16 steps in brightness control (sun).

#37
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts

No changes on the brightness control.
Kernel log says:

11/12/10 9:15:10 PM	kernel	Acpi brightness levels:11, lowest brightness:30, highest brightness:100

before it was 16 - 20 - 100


Hi again... try this dsdt


@quinielascom
Could you post your dsdt? Clean as posiblle please.

Attached Files



#38
quinielascom

quinielascom

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 749 posts
  • Location:M�xico

Hi again... try this dsdt


@quinielascom
Could you post your dsdt? Clean as posiblle please.


Here is:

Attached File  dsdt_4320.dsl.zip   24.9KB   28 downloads

With the attached dsdt the brightness control works fine but for say the max bright (100%) is set after 8 steps, then the remains steps remain the same max bright.

#39
BlackCH

BlackCH

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,611 posts
  • Gender:Male
  • Location:BCN

Hi again... try this dsdt


Could you upload the dsl file? Thanks!

#40
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
2 posts up. Just decompile it. iasl -d dsdt.aml





0 user(s) are reading this topic

0 members, 0 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