InfiniteMac OSx86

InfiniteMac OSx86 (http://infinitemac.com/forum.php)
-   10.X (http://infinitemac.com/forumdisplay.php?f=36)
-   -   Various DSDT mods. (http://infinitemac.com/showthread.php?t=1960)

Nameci 01-31-2010 11:18 PM

I have repatched the dsdt once again with a fresh one. I delete all dsdt and did the patching once again, i still have sleep on lid close, Fn+F1, on the power button. I can wake thru power button with no problems, I can wake buy plugging or unplugging a usb device. But no wake on lid open or keyboard.

With this dsdt, clamshelldisplay.kext is not necessary anymore, so I have removed this kext.

Btw I have modded my dsdt on LID as almost the same on earlier post by pentiumpc.

Any ideas on how to enabel wake on lid open?

uman 03-04-2010 03:17 PM

What you need to find is the method that is called upon a lid switch event, which means it is under EC0, the embedded controller device. On a MacBook, it's typically _Q20, which looks like this:

Code:

                    Method (_Q20, 0, NotSerialized)
                    {
                        Store (LSTE, LIDS)
                        Notify (\_SB.LID0, 0x80)
                    }

On my Gateway, it's _Q8A:
Code:

                    Method (_Q8A, 0, NotSerialized)
                    {
                        If (LIDE)
                        {
                            Store ("_Q8A : LID Switch Event", Debug)
                            Store (0x01, LIDE)
                            If (IGDS)
                            {
                                Store (0x90, SMIF)
                                Store (0x00, TRP0)
                            }

                            Notify (\_SB.LID0, 0x80)
                        }

on many other notebooks, it's _Q09. So you'll need to find where it is, and add the appropriate Notify call, to inform the OS that the laptop should be woken up. (I've modified my DSDT to use LID0, to better match the MacBook DSDT).

kizwan 03-11-2010 02:28 PM

Enabled bluetooth on Acer Aspire 9420
 
Hi uman,

Do you remember, not a long time a go, I'm pursuing to enable bluetooth in Mac OS X? I'm still unable to get the bluetooth button working but I'm able to make the bluetooth device working via DSDT hacking. I'm still however unable to trigger the bluetooth ON/OFF button. I even trying to re-map the bluetooth ON/OFF button to another button (Fn+..) but unsuccessful. Therefore, I modify System Wake (_WAK) to enable bluetooth. This is for temporary solution. When hot booting the computer, it need to be put to sleep one time only & waking up the computer will turning ON the bluetooth device. To make it working cleanly, I modify both System Wake (_WAK) and Prepare to Sleep (_PTS). In the process, I also fixed the wireless device won't turn ON after waking from sleep.

_WAK code:-
Code:

    Method (_WAK, 1, NotSerialized)
    {
        Store (Arg0, P80H)
        If (LEqual (Arg0, 0x03))
        {
            Store (CIRT, \_SB.PCI0.LPCB.EC0.CIRE)
        }

        If (LOr (LEqual (Arg0, 0x03), LEqual (Arg0, 0x04)))
        {
            Store (EEPM, \_SB.PCI0.LPCB.EC0.WEPM)
            Store (CAST, \_SB.PCI0.LPCB.EC0.CAME)
            Store (WLPW, \_SB.PCI0.LPCB.EC0.WLEN)
            Store (BTPW, \_SB.PCI0.LPCB.EC0.BTEN)
            Store (WLLE, \_SB.PCI0.LPCB.EC0.WLLD)
            Store (BTLE, \_SB.PCI0.LPCB.EC0.BTLD)
        }

        Store (0x00, \_SB.PCI0.LPCB.EC0.MUTE)
        Store (0x00, \_SB.PCI0.LPCB.EC0.KTAF)
        Store (0x01, \_SB.PCI0.LPCB.EC0.KTEE)
        // start
        // Add support for Wireless & Bluetooth devices (power & LED).
        // Turned ON Wireless & Bluetooth devices after resume from Sleep.
        Store (0x01, \_SB.PCI0.LPCB.EC0.WLEN)
        Store (0x01, \_SB.PCI0.LPCB.EC0.WLLD)
        Store (0x01, \_SB.PCI0.LPCB.EC0.BTEN)
        Store (0x01, \_SB.PCI0.LPCB.EC0.BTLD)
        // end
..................

_PTS code:-
- Preventing the wireless device from turn OFF before goes to sleep. Therefore, the wireless device can be turn ON after waking from sleep.
Code:

    Method (_PTS, 1, NotSerialized)
    {
        Store (Arg0, P80H)
        Store (0x01, \_SB.PCI0.LPCB.EC0.MUTE)
        If (LEqual (Arg0, 0x03))
        {
            Store (\_SB.PCI0.LPCB.EC0.CIRE, CIRT)
        }

        If (LEqual (Arg0, 0x04))
        {
            Store (0x01, \_SB.PCI0.LPCB.EC0.BLNK)
            Store (0x00, \_SB.PCI0.LPCB.EC0.CIRE)
        }

        If (LOr (LEqual (Arg0, 0x03), LEqual (Arg0, 0x04)))
        {
            Store (\_SB.PCI0.LPCB.EC0.WEPM, EEPM)
            Store (\_SB.PCI0.LPCB.EC0.CAME, CAST)
            Store (\_SB.PCI0.LPCB.EC0.WLEN, WLPW)
            Store (\_SB.PCI0.LPCB.EC0.BTEN, BTPW)
            Store (\_SB.PCI0.LPCB.EC0.WLLD, WLLE)
            Store (\_SB.PCI0.LPCB.EC0.BTLD, BTLE)
        }

        Store (0x00, \_SB.PCI0.LPCB.EC0.CAME)
        Store (0x00, \_SB.PCI0.LPCB.EC0.CIRE)
        // Preventing Wireless device from turning OFF when system going to Sleep.
        // Store (0x00, \_SB.PCI0.LPCB.EC0.WLEN)
        // start
        // Add support for Wireless (LED) & Bluetooth (power & LED) devices.
        // Turned OFF Wireless (LED) & Bluetooth (power & LED) devices before going to Sleep.
        Store (0x00, \_SB.PCI0.LPCB.EC0.WLLD)
        Store (0x00, \_SB.PCI0.LPCB.EC0.BTEN)
        Store (0x00, \_SB.PCI0.LPCB.EC0.BTLD)
        // end
        If (LEqual (Arg0, 0x05))
        {
            PHSR (0x28, 0x00)
        }
    }

Applying this fix causing the computer unable to sleep anymore because USB4 device (where the bluetooth device attached to) causing the system wake immediately. I remember that according to ACPI Specification revision 4 documentation; in addition to the _PRW control method, _PSW control method can be used to enable or disable the device’s ability to wake a sleeping system.
Quote:

Arguments: (1) Arg0 – An Integer containing a wake capability control
0 – Disable the device’s wake capabilities
1 – Enable the device’s wake capabilities
By looking at USB4 device in DSDT, there is _PSW entry that can be manipulate. This is the entry for USB4 device in DSDT after modifying the argument (set to 0):-
Code:

            Device (USB4)
            {
                Name (_ADR, 0x001D0003)
                OperationRegion (U4CS, PCI_Config, 0xC4, 0x04)
                Field (U4CS, DWordAcc, NoLock, Preserve)
                {
                    U4EN,  2
                }

                Name (_PRW, Package (0x02)
                {
                    0x0E,
                    0x03
                })
                Method (_PSW, 1, NotSerialized)
                {
                    If (Arg0)
                    {
                        // Store (0x03, U4EN)
                        // Disable USB4 capability to wake a sleeping system
                        Store (0x00, U4EN)
                    }
                    Else
                    {
                        Store (0x00, U4EN)
                    }
                }

                Method (_S3D, 0, NotSerialized)
                {
                    Return (0x02)
                }

                Method (_S4D, 0, NotSerialized)
                {
                    Return (0x02)
                }
            }

The last FIX enable the computer to sleep again.

kizwan

uman 03-12-2010 02:11 AM

Nice work! Too bad I don't have bluetooth!

I've come to the conclusion that getting access to keyboard events is impossible in DSDT. I think you have three choices: construct an AMW0 device kext to bind to the AMW0 (which I presume is in your DSDT). This would be a challenge, but might allow you to be straight retail. Two, hack at ApplePS2Keyboard (if PS2) or something else if USB. Or three, do the same with VoodooPS2 (again if PS2).

If you have USB, your job may be easier, since you might be able to do it outside kernel space.

kizwan 03-12-2010 04:51 PM

Battery indicator
 
Hi uman,

I'm successfully compiled AMW0.kext for SL but got kernel panic while initializing some MethodTerm at boot. Since AMW0.kext project is not finished, I think I'm going to try ACPI4ASUS.kext instead. If ACPI4ASUS.kext developed to works with AMW0 v2 interface (AMW0 and WMID), it should works with other laptop model too.

I'm trying to enable battery icon by patching DSDT. It is being done by adjusting ADP1 & BAT0 code according to DSDT from MBP4,1. Not successful yet, but the battery indicator did show up. It said battery is not detected & current power source is power adapter. Do you think it is possible to make it working by just patching the DSDT?

EDIT: I have found the right "query method" to automatically turn ON Bluetooth device during boot-up. I just tried all of the "query method" in the DSDT until I found the right one.
Code:

                    Method (_Q3F, 0, NotSerialized)
                    {
                        // start
                        // auto turn ON Bluetooth device during computer startup
                        Store (0x01, \_SB.PCI0.LPCB.EC0.BTEN)
                        Store (0x01, \_SB.PCI0.LPCB.EC0.BTLD)
                        // end
                        HKEY (0x3F)
                    }

kizwan

breakky 03-13-2010 04:31 AM

Hello to all,

Can you somebody help me to enable my audio on Snow Leopard?My audio chip is Realtek ALC662:
I make a codec dump:You can download and see it.

http://hotfile.com/dl/32500771/8b28f...p.txt.rar.html


I want to fix my audio in DSDT, so I read your tutorial and convert the Default pinconfig on each "[JACK]" device:

Mic (colour:Pink) 01a19830 ---> reversed 3098a101

Mic which is not a jack 99a3093f ---> 3f09a399


HP - 0121401f ---> 1f402101


SPDIF -01441120 ---> 20114401


This is my audio configuration on my laptop.


Thanks in advance!

I don't know how to generate values which I haveto enter in my DSDT.This is my DSDT (HDEF):

Code:

Device (HDEF)
            {
                Name (_ADR, 0x001B0000)
                OperationRegion (HDAR, PCI_Config, 0x4C, 0x10)
                Field (HDAR, WordAcc, NoLock, Preserve)
                {
                    DCKA,  1,
                            Offset (0x01),
                    DCKM,  1,
                        ,  6,
                    DCKS,  1,
                            Offset (0x08),
                        ,  15,
                    PMES,  1
                }

                Name (_PRW, Package (0x02)
                {
                    0x0D,
                    0x03
                })
            }


breakky 03-13-2010 09:40 AM

Quote:

Originally Posted by kizwan (Post 46170)


EDIT: I have found the right "query method" to automatically turn ON Bluetooth device during boot-up. I just tried all of the "query method" in the DSDT until I found the right one.
Code:

                    Method (_Q3F, 0, NotSerialized)
                    {
                        // start
                        // auto turn ON Bluetooth device during computer startup
                        Store (0x01, \_SB.PCI0.LPCB.EC0.BTEN)
                        Store (0x01, \_SB.PCI0.LPCB.EC0.BTLD)
                        // end
                        HKEY (0x3F)
                    }

kizwan


Where you put this code?

I searched in my DSDT for
Code:

Method (_Q3F, 0, NotSerialized)
, But didn't find it.I have a laptop with Bluetooth, where to put this code?

uman 03-13-2010 01:21 PM

Quote:

Originally Posted by kizwan (Post 46170)
Hi uman,

I'm successfully compiled AMW0.kext for SL but got kernel panic while initializing some MethodTerm at boot. Since AMW0.kext project is not finished, I think I'm going to try ACPI4ASUS.kext instead. If ACPI4ASUS.kext developed to works with AMW0 v2 interface (AMW0 and WMID), it should works with other laptop model too.

So does Asus use AMW0, or do you need to add that code from AMW0. A WMID kext would be useful as many PC vendors use that interface. uninc's DSDT was hideously intertwined with WMID.

Quote:

I'm trying to enable battery icon by patching DSDT. It is being done by adjusting ADP1 & BAT0 code according to DSDT from MBP4,1. Not successful yet, but the battery indicator did show up. It said battery is not detected & current power source is power adapter. Do you think it is possible to make it working by just patching the DSDT?
I'm not sure, but given that the ACPI 4.0 spec devotes pages and pages to battery and power issues, I think it is at least possible. I also intend to try to solve this (but it's a lower priority for me because my laptop battery is toast anyway). I tried VoodooBattery, which worked great (it told me my battery was toast, lol), but then it kernel panic'ed HARD and I had to repair my disk, so I won't be using that again.

Quote:

EDIT: I have found the right "query method" to automatically turn ON Bluetooth device during boot-up. I just tried all of the "query method" in the DSDT until I found the right one.
Code:

                    Method (_Q3F, 0, NotSerialized)
                    {
                        // start
                        // auto turn ON Bluetooth device during computer startup
                        Store (0x01, \_SB.PCI0.LPCB.EC0.BTEN)
                        Store (0x01, \_SB.PCI0.LPCB.EC0.BTLD)
                        // end
                        HKEY (0x3F)
                    }

kizwan
I still don't understand how query methods are executed, nor how they are bound to some device. ACPI says:
Quote:

"For an embedded controller event, OSPM will queue the control method of the name _QXX, where XX is the hex format of the query code. Notice that each embedded controller device can have query event control methods. Similarly, for an SMBus driver, if no driver registers for SMBus alarms, the SMBus driver will queue control methods to handle these. Methods must be placed under the SMBus device with the name _QXX where XX is the hex format of the SMBus address of the device sending the alarm."
And then they discuss it more with a completely unhelpful example. Oh wait, the acpi implementers guide is more helpful:

Quote:

What’s the trap? Using decimal instead of hexadecimal numbers in _Lxx, _Exx, and _Qxx names in your ASL code. When the number (xx) in the _Lxx, _Exx, or _Qxx event handler object name in the ASL code does not match the number of the bit in the GPE register block (or match the number of the embedded controller query number in the case of _Qxx), then the OS loses events. For more information about the relationship of event handler object names and bits on the GPE register block, see section 5.6.2.2.

Tip: The xx in the event handler name is a hexadecimal number that corresponds to the GPE register bit or EC query number the event is tied to. For example, the level-triggered event tied to bit 11 of the GPEx register block must be named _L0B, not _L11.
DSDT is fun ;) but time consuming!

uman 03-13-2010 01:26 PM

Quote:

Originally Posted by breakky (Post 46201)
Where you put this code?

I searched in my DSDT for
Code:

Method (_Q3F, 0, NotSerialized)
, But didn't find it.I have a laptop with Bluetooth, where to put this code?

Each laptop model is going to be different. That's why you have to be prepared to do some work to get DSDT going. You will first need to determine what symbols, events, and queries correspond to your bluetooth device. Then kizwan's code can act as a guide.

kizwan 03-13-2010 01:32 PM

Quote:

Originally Posted by breakky (Post 46201)
Where you put this code?

I searched in my DSDT for
Code:

Method (_Q3F, 0, NotSerialized)
, But didn't find it.I have a laptop with Bluetooth, where to put this code?

It is hardware & BIOS specific. You may have different query method. I'm afraid, you need to try & error every query method in your DSDT.

EDIT: You may want to follow uman suggestion (next post) to get your audio working. It is much easier.
As for your sound, you need to do a lot of work to get your sound working. You already have HDEF entry in DSDT, so you just missing legacy/patched kext. You need to put your ConfigData & Pin Config in legacy/patched kext. Use this legacy kext as a template:-
http://www.mediafire.com/?vkzyzmtzozo
If you like to put ConfigData & PinConfigurations in DSDT, this is how HDEF entry will look like (between "// start" & "// end"):-
Code:

            Device (HDEF)
            {
                Name (_ADR, 0x001B0000)
                Name (HDWA, 0x00)
                Name (_PRW, Package (0x02)
                {
                    0x05,
                    0x03
                })
                Method (_PS0, 0, Serialized)
                {
                    If (LEqual (HDWA, 0x00))
                    {
                        Store (0x01, HDWA)
                        HKEY (0x8F)
                    }
                }

                Method (_PS3, 0, Serialized)
                {
                    Store (0x00, HDWA)
                }
                // start - required code
                Method (_DSM, 4, NotSerialized)
                {
                    Store (Package (0x0C)
                    {
                        "built-in",
                        Buffer (One)
                        {
                            0x00
                        },

                        "codec-id",
                        Buffer (0x04)
                        {
                            0x83, 0x08, 0xEC, 0x10
                        },

                        "ConfigData",
                        Buffer (0x40)
                        {
                            /* 0000 */    0x01, 0x47, 0x1C, 0x30, 0x01, 0x47, 0x1D, 0x11,
                            /* 0008 */    0x01, 0x47, 0x1E, 0x0B, 0x01, 0x47, 0x1F, 0x01,
                            /* 0010 */    0x01, 0x87, 0x1C, 0x10, 0x01, 0x87, 0x1D, 0x01,
                            /* 0018 */    0x01, 0x87, 0x1E, 0xA0, 0x01, 0x87, 0x1F, 0x90,
                            /* 0020 */    0x01, 0xA7, 0x1C, 0x20, 0x01, 0xA7, 0x1D, 0x31,
                            /* 0028 */    0x01, 0xA7, 0x1E, 0x81, 0x01, 0xA7, 0x1F, 0x01,
                            /* 0030 */    0x01, 0xE7, 0x1C, 0x40, 0x01, 0xE7, 0x1D, 0xE1,
                            /* 0038 */    0x01, 0xE7, 0x1E, 0x45, 0x01, 0xE7, 0x1F, 0x01
                        },

                        "layout-id",
                        Buffer (0x04)
                        {
                            0x0C, 0x00, 0x00, 0x00
                        },

                        "device-type",
                        Buffer (0x11)
                        {
                            "Mobile ALC883 S/T"
                        },

                        "PinConfigurations",
                        Buffer (0x10)
                        {
                            /* 0000 */    0x30, 0x11, 0x0B, 0x01, 0x10, 0x91, 0xAB, 0x01,
                            /* 0008 */    0x20, 0x31, 0x81, 0x01, 0x40, 0xE1, 0x45, 0x01
                        }
                    }, Local0)
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                    Return (Local0)
                }
                // end - required code
            }

I'll try to construct ConfigData & PinConfigurations for you but I can't promise.

kizwan