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