Hi,
I'm working with IMX8M Mini EVK.
Do I need to add properties of "interrupt-" to use interrupt feature for EXP_GPIOs?
Thank you,
Qian
已解决! 转到解答。
Hi,
PCA6416's driver is gpio-pca953x.c
static const struct of_device_id pca953x_dt_ids[] = {
......
{ .compatible = "ti,tca6416", .data = OF_953X(16, PCA_INT), },
......
}
On i.MX8M mini EVK board, those GPIO's from PCA6416 are all output, so INT pin is not configured.
The following steps are for you reference:
--------------
1. IOMUX in device tree
pinctrl_i2c2_dev: mydev_iogrp {
fsl,pins = <
MX8MM_IOMUXC_GPIO1_IO012_GPIO1_IO12 0x19 /* expend gpio int */
>;
};
2. add these lines to pca6146 node in dts:
pinctrl-0 = <&pinctrl_i2c2_dev:>;
interrupt-parent = <&gpio1>;
interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
3. In driver's probe function
......
int irq = client->irq;
int ret = devm_request_irq(&client->dev, irq, (irq_handler_t) my_device_handler, IRQF_TRIGGER_LOW, "my i2c device", NULL);
if(ret)
enable_irq(irq);
......
[Comment]
In the driver, It seems that there is function called "pca953x_irq_setup()" , probably you can directly use it. I didn't test it.
Hope a bove information is helpful for you.
Have a nice day!
B.R,
Weidong
Hi,
PCA6416's driver is gpio-pca953x.c
static const struct of_device_id pca953x_dt_ids[] = {
......
{ .compatible = "ti,tca6416", .data = OF_953X(16, PCA_INT), },
......
}
On i.MX8M mini EVK board, those GPIO's from PCA6416 are all output, so INT pin is not configured.
The following steps are for you reference:
--------------
1. IOMUX in device tree
pinctrl_i2c2_dev: mydev_iogrp {
fsl,pins = <
MX8MM_IOMUXC_GPIO1_IO012_GPIO1_IO12 0x19 /* expend gpio int */
>;
};
2. add these lines to pca6146 node in dts:
pinctrl-0 = <&pinctrl_i2c2_dev:>;
interrupt-parent = <&gpio1>;
interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
3. In driver's probe function
......
int irq = client->irq;
int ret = devm_request_irq(&client->dev, irq, (irq_handler_t) my_device_handler, IRQF_TRIGGER_LOW, "my i2c device", NULL);
if(ret)
enable_irq(irq);
......
[Comment]
In the driver, It seems that there is function called "pca953x_irq_setup()" , probably you can directly use it. I didn't test it.
Hope a bove information is helpful for you.
Have a nice day!
B.R,
Weidong
Hi Werdong,
Thank you for your thorough answer.
Actually, I've made a conclusion similar to your suggestion.
So, I think I should request interrupt to the INT pin of PCA6146 (which is connected to GPIO1_IO12 on imx8mm) rather than to the EXP_GPIO on PCA6146 directly, as expander's driver only monitors it's INT pin for interrupts.
With your answer, I can be sure to my conclusion before.
After all, thank you very much.
Appreciate your a lot.
Qian
Dear @Hao Qian,
Thanks for your confirmation. I will be appreciated if you can tell how to configure the DTS so that interrupt signal could be propagated from one of the GPIOs of PCA6416 to INT that is connected to the GPIO1_IO12 of iMX8M SoC, please ?
Thank you very much in advance,
Khang
Dear All,
I'd like to bother you again. I understood that PCA6416 would monitor any change of one of its EXP_GPIOs to propagate the change and to trigger the INT signal. My question is that should I modify the pca953x driver to configure one of these EXP_GPIOs as input as well since they are all outputs by default?
Best regards,
Khang
Hi Khang,
I understood that PCA6416 would monitor any change of one of its EXP_GPIOs to propagate the change and to trigger the INT signal
Have you managed to do this by any chance ? I'm trying to.
I have configured inotify on /sys/class/gpio/gpio<N>/value to monitor changes on the pca9505 gpio expander inputs. But it is not updated without polling.
Regards,