Tuesday, 7 September 2010

Asus.N61Jv ACPI DSDT hybrid graphics

Here is a snippet of the hybrid graphics switching ACPI DSDT table for the Asus N61Jv laptop:



    Scope (\_SB.PCI0.PEGR.GFX0)
    {
        OperationRegion (HDAY, SystemMemory, 0xF8100000, 0x0FF0)
        Field (HDAY, ByteAcc, NoLock, Preserve)
        {
                    Offset (0x48B),
                ,   1,
            HDAE,   1
        }

        Name (DGPS, Zero)
        Name (_PSC, Zero)
        Method (_PS0, 0, NotSerialized)
        {
            Store (0xD0, DBG8)
            Store (Zero, _PSC)
            If (LNotEqual (DGPS, Zero))
            {
                Store ("PS0: Need to power on dGPU", Debug)
                \_SB.PCI0.PEGR.GFX0._ON ()
                Store (Zero, DGPS)
                Sleep (0x01F4)
                Store (Zero, HDAE)
                \_SB.PCI0.LPCB.EC0.WRAM (0x0458, 0x43)
                \_SB.PCI0.LPCB.EC0.TSES ()
            }
        }

        Method (DON, 0, NotSerialized)
        {
            _ON ()
        }

[..]

       Method (_PS3, 0, NotSerialized)
        {
            Store (0xD3, DBG8)
            If (LEqual (\OMPR, 0x03))
            {
                Store ("PS3: Driver wants to power off dGPU", Debug)
                If (LEqual (DGPS, Zero))
                {
                    \_SB.PCI0.LPCB.EC0.TSDS ()
                    \_SB.PCI0.PEGR.GFX0._OFF ()
                    Store (One, DGPS)
                    \_SB.PCI0.LPCB.EC0.WRAM (0x0458, 0x4B)
                }

                Store (0x02, \OMPR)
                Store ("PS3: OMPR=2 now", Debug)
            }

            Store (0x03, _PSC)
        }

        Method (CLKS, 1, Serialized)
        {
            Store (\_SB.PCI0.SBUS.RBLK (0xD2, 0x00, 0x0C), CLKD)
            If (Arg0)
            {
                Or (CB08, 0x03, CB08)
            }
            Else
            {
                And (CB08, 0xFC, CB08)
            }

            \_SB.PCI0.SBUS.WBLK (0xD2, 0x00, 0x0C, CLKD)
        }

        Method (DOFF, 0, NotSerialized)
        {
            _OFF ()
        }