Hi All,
I was able to fix the issue (not a generic fix) of the driver not loading with the IRQ issue.
The reason for the issue is in gpio-pca953x.c
during the probe function of pca953x driver (pca953x_probe), the irq setup function (pca953x_irq_setup) is called.
In the irq setup fucntion, the devm_request_threaded_irq() is called with hard coded value of IRQ trigger for LOW level (IRQF_TRIGGER_LOW)
when the call reaches the driver for the FRWYLS1012A gpio chip i.e gpio-mpc8xxx.c, the IRQ setup function mpc8xxx_irq_set_type() is invoked. The mpc8xxx_irq_set_type() handles only IRQ triggering based on edge (IRQ_TYPE_EDGE_FALLING,IRQ_TYPE_EDGE_BOTH).
The IRQ setup call from pca953x comes with IRQF_TRIGGER_LOW, which causes the driver loading to fail.
The fix is to pass "IRQF_TYPE_EDGE_FALLING" instead of "IRQF_TRIGGER_LOW" from pca953x_irq_setup as parameter for devm_request_threaded_irq().
Original code -
ret = devm_request_threaded_irq(&client->dev,
client->irq,
NULL,
pca953x_irq_handler,
IRQF_TRIGGER_LOW | IRQF_ONESHOT |
IRQF_SHARED,
dev_name(&client->dev), chip);
Modified code -
ret = devm_request_threaded_irq(&client->dev,
client->irq,
NULL,
pca953x_irq_handler,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
IRQF_SHARED,
dev_name(&client->dev), chip);
This is not a generic fix, but this can help to load the driver for the TCA9539 gpio expander.
# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- 08 -- 0a -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- UU
# cd /sys/class/gpio/
# ls
export gpiochip432 gpiochip448 gpiochip480 unexport
# echo 432 > export
# ls
export gpio432 gpiochip432 gpiochip448 gpiochip480 unexport
# cd gpio432
# ls
active_low direction power uevent
device edge subsystem value