Re: [PATCH v8 3/3] HID: cp2112: Fwnode Support
From: Benjamin Tissoires <hidden>
Date: 2023-03-08 15:27:11
Also in:
linux-input
On Mar 07 2023, Andy Shevchenko wrote:
On Tue, Mar 07, 2023 at 03:48:52PM +0100, Benjamin Tissoires wrote:quoted
On Mar 07 2023, Daniel Kaehn wrote:...quoted
So I can see that the device gets probed, and that all ACPI resources are tried to get the IRQ. Right now, I see that it's attempting to bind to the acpi resource in acpi_dev_resource_interrupt() (in file drivers/acpi/resources.c), but instead of having a ACPI_RESOURCE_TYPE_EXTENDED_IRQ I only get a ACPI_RESOURCE_TYPE_GPIO for the GpioInt() definition in the _CRS method. So I am missing the proper transition from GpioInt to IRQ in the acpi.I'm not sure I understand what this means. The Linux kernel takes either Interrupt() resource (which is IOxAPIC / GIC / etc) or GpioInt() (which is GPIO based). In both cases I²C framework submits this into client's IRQ field.
I finally managed to get past the retrieval of the GpioInt.
Turns out that the function acpi_get_gpiod() matches on the parent of
the gpio_chip (gc->parent), which means that, with the current code and
my SSDT, it matches on the HID CP2112 ACPI node, not the GPIO one.
For reference (with lots of boiler plate removed):
Device (CP21) { // the USB-hid & CP2112 shared node
Device (GPIO) {
Name (_ADR, One)
Name (_STA, 0x0F)
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () { "gpio-line-names", Package () {
"",
"",
"irq-rmi4",
"",
"power", // set to 1 with gpio-hog above
"",
"",
"",
""}},
}
})
}
Scope (\_SB_.PCI0.USB0.RHUB.CP21.I2C)
{
Device (TPD0)
{
Name (_HID, "RMI40001")
Name (_CID, "PNP0C50")
Name (_STA, 0x0F)
Name (SBFB, ResourceTemplate ()
{
I2cSerialBusV2 (0x00c, ControllerInitiated, 100000,
AddressingMode7Bit, "\\_SB_.PCI0.USB0.RHUB.CP21.I2C",
0x00, ResourceConsumer,, Exclusive,
)
})
Name (SBFG, ResourceTemplate ()
{
GpioInt (Level, ActiveLow, Exclusive, PullDefault, 0x0000,
"\\_SB_.PCI0.USB0.RHUB.CP21", 0x00, ResourceConsumer, ,
)
{ // Pin list
0x0002
}
})
---
But if I refer "\\_SB_.PCI0.USB0.RHUB.CP21.GPIO", the IRQ is never assigned.
With the parent (CP21), it works.
So I wonder if the cp2112 driver is correctly assigning the gc->parent
field.
Cheers,
Benjamin