Hi, On 1/8/22 10:59, Hans de Goede wrote: > Hi, > > On 1/8/22 01:04, Andy Shevchenko wrote: >> >> >> On Saturday, January 8, 2022, Hans de Goede <hdegoede@xxxxxxxxxx <mailto:hdegoede@xxxxxxxxxx>> wrote: >> >> Some boards set the direct_irq_en flag in the conf0 register without >> setting any of the trigger bits. The direct_irq_en flag just means that >> the GPIO will send IRQs directly to the APIC instead of going through >> the shared interrupt for the GPIO controller, in order for the pin to >> be able to actually generate IRQs the trigger flags must still be set. >> >> So having the direct_irq_en flag set without any trigger flags is >> non-sense, log a FW_BUG warning when encountering this and clear the flag >> so that a driver can actually use the pin as IRQ through gpiod_to_irq(). >> >> Specifically this allows the edt-ft5x06 touchscreen driver to use >> INT33FC:02 pin 3 as touchscreen IRQ on the Nextbook Ares 8 tablet, >> accompanied by the following new log message: >> >> byt_gpio INT33FC:02: [Firmware Bug]: pin 3: direct_irq_en set without trigger, clearing >> >> The new byt_direct_irq_sanity_check() function also checks that the >> pin is actually appointed to one of the 16 direct-IRQs which the GPIO >> controller supports and on success prints debug messages like these: >> >> byt_gpio INT33FC:02: Pin 0: uses direct IRQ 0 (APIC 67) >> byt_gpio INT33FC:02: Pin 15: uses direct IRQ 2 (APIC 69) >> >> >> Should be these updated? > > Yes the " (APIC 6x)" part is gone now. I will fix this for v4. > >> This is useful to figure out the GPIO pin belonging to ACPI >> resources like this one: "Interrupt () { 0x00000043 }" or >> the other way around. >> >> Suggested-by: Andy Shevchenko <andy@xxxxxxxxxx <mailto:andy@xxxxxxxxxx>> >> Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx <mailto:hdegoede@xxxxxxxxxx>> >> --- >> Changes in v3: >> - Rework code to check if the pin is assigned one of the 16 direct IRQs >> (new code suggested-by Andy) >> - Drop dev_dbg of the (likely?) APIC IRQ, only log the direct IRQ index >> >> >> Thinking about direct IRQ mappings I will look into the Datasheet next week. > > Ok, I will wait for you to get back to me then before posting a v4. Note I've found the direct IRQ to IO-APIC pin mappings now, they are described in: atom-e3800-family-datasheet.pdf, so I've re-added the APIC IRQ to the printed log msg for v4. Regards, Hans