I have a GPIO expander (TI TCA9539) on board connected to a Raspberry Pi. I've written a device tree overlay as follows:
// Raspberry Pi device tree overlay for TCA9539 GPIO Expander
/dts-v1/;
/plugin/;
/{
compatible = "brcm,bcm2835";
fragment@0 {
target = <&i2cbus>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
exp1: gpio-extender@74 {
#address-cells = <1>;
compatible = "ti,tca9539";
reg = <0x74>;
interrupt-parent = <&gpio>; /* Use Pi GPIO as interrupt parent */
interrupts = <25 2>; /* Use GPIO25 as interrupt pin, 2=IRQ_TYPE_EDGE_FALLING */
interrupt-names = "gpio-expander";
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
};
};
};
frag100: fragment@100 {
target = <&i2c_arm>;
i2cbus: __overlay__ {
status = "okay";
};
};
};
When I add this overlay to /boot/firmware/config.txt, everything works as expected, and I can monitor edges using gpiomon. I also see that in /proc/interrupts I have the following line:
40: 0 0 0 0 pinctrl-bcm2835 25 Edge 1-0074
However, if I remove the overlay from /boot/firmware/config.txt and instead try to load the overlay dynamically using sudo dtoverlay tca9539, the interrupts no longer work. I still see all 16 new GPIO lines appear under "gpiochip2" in gpioinfo, but when I run gpiomon, I receive the following error:
gpiomon: error waiting for events: No such device
I also see that the line is missing from /proc/interrupts.
Is there anyway to retain the interrupt functionality when using a dynamic overlay?
gpio-extender@77should match the first address specified in the reg property of thar node,reg = <0x74>;gpio-extender@74, but I have the same behavior. Again, this works totally fine when addingdtoverlay=tca9539to /boot/firmware/config.txt, but the interrupts do not work if I callsudo dtoverlay tca9539at runtime (with the overlay removed from config.txt).dmesgshows nothing different. I've tried 25 and 27 already with the same behavior.gpioinfoshows both as unused.