Hi, I have some progress.
So U-Boot shows no problems on headset insertion. Of course there are no multiple users of the I2C bus in this test (no LEDs blinking, no tca6424 interrupt processing).
Therefore it appears as if the ts3a227 chip is running fine from hardware side. But somehow the kernel stumbles over it.
This has been identified as a missing component on my prototype board. This did have the effect that the GND line of the ts3a chip was floating.
It appears that as long as no headset is inserted there is enough leakage current to make the I2C interface work, but as soon as I insert the headset, I2C stops working (and the "GND" voltage goes up).
Next I will try to disable the ts3a227 interrupt in kernel. Maybe it is indeed a bug in the kernel interrupt handlers. Maybe the i2c bus is not properly unlocked while processing interrupts.
We have to remember that probably nobody else is using the ts3a227 interrupt behind a tca6424 gpio expander and has both connected to the same i2c bus. So nobody has tested that combination before...
All this did not work due to the hardware issue mentioned above.
But now as it is solved, I can't get the ts3a plug detection interrupt working.
So again I have to ask for your kernel specialists help.
I could trace it to that the ts3a chip driver is registering an interrupt but the pca935x driver is never called to change its masks. Hence it does not know what to do if an interrupt arrives at one of the inputs.
Here is a short trace (by adding some printk in an attempt to understand how interrupt registration works):
[ 5.280900] pca953x_setup_gpio [ 5.308539] pca953x_irq_setup 1 [ 5.312458] pca953x_irq_setup 2 [ 5.315975] pca953x_irq_bus_lock [ 5.319527] pca953x_irq_bus_sync_unlock [ 5.323704] pca953x_irq_bus_lock [ 5.327117] pca953x_irq_bus_sync_unlock [ 5.331279] pca953x_irq_bus_lock [ 5.334667] pca953x_irq_bus_sync_unlock [ 5.338852] pca953x_irq_bus_lock [ 5.342238] pca953x_irq_bus_sync_unlock [ 5.346386] pca953x_irq_bus_lock [ 5.349795] pca953x_irq_bus_sync_unlock [ 5.353949] pca953x_irq_bus_lock [ 5.357360] pca953x_irq_bus_sync_unlock [ 5.361518] pca953x_irq_bus_lock [ 5.364902] pca953x_irq_bus_sync_unlock [ 5.369078] pca953x_irq_bus_lock [ 5.372460] pca953x_irq_bus_sync_unlock [ 5.376634] pca953x_irq_bus_lock [ 5.380015] pca953x_irq_bus_sync_unlock [ 5.384169] pca953x_irq_bus_lock [ 5.387574] pca953x_irq_bus_sync_unlock [ 5.391722] pca953x_irq_bus_lock [ 5.395112] pca953x_irq_bus_sync_unlock [ 5.399283] pca953x_irq_bus_lock [ 5.402672] pca953x_irq_bus_sync_unlock [ 5.406849] pca953x_irq_bus_lock [ 5.410239] pca953x_irq_bus_sync_unlock [ 5.414386] pca953x_irq_bus_lock [ 5.417791] pca953x_irq_bus_sync_unlock [ 5.421947] pca953x_irq_bus_lock [ 5.425334] pca953x_irq_bus_sync_unlock [ 5.429512] pca953x_irq_bus_lock [ 5.432897] pca953x_irq_bus_sync_unlock [ 5.437072] pca953x_irq_bus_lock [ 5.440463] pca953x_irq_bus_sync_unlock [ 5.444612] pca953x_irq_bus_lock [ 5.448014] pca953x_irq_bus_sync_unlock [ 5.452370] pca953x_irq_bus_lock [ 5.455767] pca953x_irq_bus_sync_unlock [ 5.459995] pca953x_irq_bus_lock [ 5.463378] pca953x_irq_bus_sync_unlock [ 5.467554] pca953x_irq_bus_lock [ 5.470941] pca953x_irq_bus_sync_unlock [ 5.475094] pca953x_irq_bus_lock [ 5.478499] pca953x_irq_bus_sync_unlock [ 5.482657] pca953x_irq_bus_lock [ 5.486042] pca953x_irq_bus_sync_unlock [ 5.490212] pca953x_irq_bus_lock [ 5.493598] pca953x_irq_bus_sync_unlock
[ 9.009952] driver_register 'ts3a227e' [ 9.013202] request_threaded_irq(210, 2008, TS3A227E) [ 9.013208] chip_bus_lock() [ 9.013213] __setup_irq() [ 9.013216] __setup_irq() 1 [ 9.013219] __setup_irq() 2 [ 9.013222] __setup_irq() 3 [ 9.023889] __setup_irq() 4 [ 9.023893] __setup_irq() 5 [ 9.023916] __setup_irq() 6 [ 9.024023] __setup_irq() 8 [ 9.024026] __setup_irq() -> 0 [ 9.024029] request_threaded_irq() -> 0
So this means that request_threaded_irq() returns 0 and a all steps of __setup_irq() are done.
Somewhere the gpiochip should be called to enable the bit mask as defined by the DT. I guess through some combination of:
pca953x_irq_set_type() static void pca953x_irq_mask() pca953x_irq_bus_sync_unlock()
But none of these functions is called.
So I ask: a) is there a bug in interrupt (gpiochip_irqchip_add/gpiochip_set_chained_irqchip) registration b) is there somehing needed in DT c) is there an enable irq missing in the ts3a227 driver? d) should chip_bus_lock() be forwarded to pca953x_irq_bus_lock? If yes, why isn't it?
So if someone else could please dig into this (at least from code inspection) it would probably save me a lot of time to give an ok for the ts3a227 hardware design.
BR and thanks, Nikolaus