Skip to content

Instantly share code, notes, and snippets.

@lazd
Last active January 12, 2020 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazd/cd67ba08801bd38acad484637b2d22be to your computer and use it in GitHub Desktop.
Save lazd/cd67ba08801bd38acad484637b2d22be to your computer and use it in GitHub Desktop.
Goodix DSDT entry
Scope (_SB.PCI0.I2C2)
{
Device (TPL1)
{
Name (HID2, Zero)
Name (SBFH, ResourceTemplate ()
{
I2cSerialBusV2 (0x0014, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.PCI0.I2C2",
0x00, ResourceConsumer, _Y2F, Exclusive,
)
})
Name (SBFG, ResourceTemplate ()
{
GpioInt (Edge, ActiveLow, Exclusive, PullDefault, 0x0000,
"\\_SB.PCI0.GPI0", 0x00, ResourceConsumer, ,
)
{ // Pin list
0x0000
}
})
Name (SBFI, ResourceTemplate ()
{
Interrupt (ResourceConsumer, Edge, ActiveLow, Exclusive, ,, _Y30)
{
0x00000000,
}
})
CreateWordField (SBFH, \_SB.PCI0.I2C2.TPL1._Y2F._ADR, BAD2) // _ADR: Address
CreateDWordField (SBFH, \_SB.PCI0.I2C2.TPL1._Y2F._SPE, SPE2) // _SPE: Speed
CreateDWordField (SBFI, \_SB.PCI0.I2C2.TPL1._Y30._INT, INT2) // _INT: Interrupts
CreateWordField (SBFG, 0x17, INT1)
Method (_INI, 0, NotSerialized) // _INI: Initialize
{
If (LLess (OSYS, 0x07DC))
{
SRXO (GPLI, One)
}
Store (GNUM (0x02050007), INT1)
Store (INUM (0x02050007), INT2)
If (LEqual (SDM1, Zero))
{
SHPO (GPLI, One)
}
Store ("GDIX1001", _HID)
Store (Zero, HID2)
Store (0x00061A80, SPE2)
Return (Zero)
}
Name (_HID, "XXXX0000") // _HID: Hardware ID
Name (_CID, "GDIX1001") // _CID: Compatible ID
Name (_S0W, 0x04) // _S0W: S0 Device Wake State
Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method
{
If (LEqual (Arg0, HIDG))
{
Return (HIDD (Arg0, Arg1, Arg2, Arg3, HID2))
}
If (LEqual (Arg0, TP7G))
{
Return (TP7D (Arg0, Arg1, Arg2, Arg3, SBFH, SBFG))
}
Return (Buffer (One)
{
0x00
})
}
Method (_STA, 0, NotSerialized) // _STA: Status
{
Return (0x0F)
}
Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
{
If (LLess (OSYS, 0x07DC))
{
Return (SBFI)
}
If (LEqual (SDM1, Zero))
{
Return (ConcatenateResTemplate (SBFH, SBFG))
}
Return (ConcatenateResTemplate (SBFH, SBFI))
}
}
}
Scope (_SB.PCI0.I2C2)
{
Name (SSCN, Package (0x03)
{
0x01B0,
0x01FB,
0x1E
})
Name (FMCN, Package (0x03)
{
0x48,
0xA0,
0x1E
})
Device (TPL1)
{
Name (_ADR, Zero) // _ADR: Address
Name (_HID, "GDIX1001") // _HID: Hardware ID
Name (_CID, "GDIX1001") // _CID: Compatible ID
Name (_S0W, 0x03) // _S0W: S0 Device Wake State
Name (_DEP, Package (0x02) // _DEP: Dependencies
{
GPI0,
I2C2
})
Name (SBFB, ResourceTemplate ()
{
I2cSerialBusV2 (0x0014, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.PCI0.I2C2",
0x00, ResourceConsumer, _Y24, Exclusive,
)
})
Name (SBFG, ResourceTemplate ()
{
GpioInt (Edge, ActiveHigh, Exclusive, PullDefault, 0x0000,
"\\_SB.PCI0.GPI0", 0x00, ResourceConsumer, ,
)
{ // Pin list
0x0000
}
})
CreateWordField (SBFB, \_SB.PCI0.I2C2.TPL1._Y24._ADR, BADR) // _ADR: Address
CreateDWordField (SBFB, \_SB.PCI0.I2C2.TPL1._Y24._SPE, SPED) // _SPE: Speed
CreateWordField (SBFG, 0x17, INT1)
Method (_INI, 0, NotSerialized) // _INI: Initialize
{
SRXO (GPLI, One)
Store (GNUM (0x02050007), INT1)
SHPO (GPLI, One)
Store (0x14, BADR)
Store (0x00061A80, SPED)
Return (Zero)
}
Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
{
Return (ConcatenateResTemplate (SBFB, SBFG))
}
Name (_DSD, Package (0x02) // _DSD: Device-Specific Data
{
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */,
Package (0x02)
{
Package (0x02)
{
"irq-gpios",
Package (0x04)
{
TPL1,
Zero,
Zero,
Zero
}
},
Package (0x02)
{
"reset-gpios",
Package (0x04)
{
TPL1,
One,
Zero,
Zero
}
}
}
})
Method (_STA, 0, NotSerialized) // _STA: Status
{
Return (0x0F)
}
Method (_PS0, 0, Serialized) // _PS0: Power State 0
{
}
Method (_PS3, 0, Serialized) // _PS3: Power State 3
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment