Hi, All,
I am working on sabresd board with imx7. I want to make user button 1 as interruptible gpio. I have followed the following steps:
as in schematics, user button 1 is connected to SD2_WP pad. From trm, we see that alt 5 functionality for the same pad is gpio 5(ALT5_GPIO5_IO10).
In imx7d-sdb.dts file doing the pad control changes:
pinctrl_gpio: gpiogrp {
fsl,pins = <
MX7D_PAD_SD2_WP__GPIO5_IO10 0x14
>;
};
Now, have written a small module which does the following:
(1)set 10th bit of 0x3024000C(setting 10th bit of GPIO5_EDGE_SEL). I also tried setting 20-21st bit of GPIO5_ICR1 to 10 or 11, but didnot work
(2)set 10th bit of GPIO5_IMR
(3)reset 10th bit of GPIO5_GDIR
(4)set request_irq to 172 as returned value from, gpio_to_irq(138)=172
Q1)I am not seeing any interrupt generated on pressing of user button 1 key. Wonder where I am going wrong.
Q2)I saw somewhere in datasheet the irq for gpio5 is 72, why gpio_to_irq returns 172?
Q3) Is there any better way to do? maybe just by changes in dts file? I am not sure if /proc/interrupts entry can get generated by just change in dts file.
Thanks for the help.
Solved! Go to Solution.
Hi sudip
please check documentation in Linux/Documentation/arm/Interrupts and
attached Linux Manual sect.3.2 Interrupts (Operation),
http://developer.toradex.com/device-tree-customization
There is i.MX7SDB gpio interrupt example (from SiI9022A INT) in imx7d-sdb.dts
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/arch/arm/boot/dts/imx7d-sdb.dts?id=...
tsc2046 {
interrupts = <13 0>;
pendown-gpio = <&gpio2 13 0>;
};
sii902x: sii902x@39 {
interrupt-parent = <&gpio2>;
interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
interrupt drivers examples can be found in linux/arch/arm/plat-mxc/epit.c
linux-2.6-imx.git - Freescale i.MX Linux Tree
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi sudip
please check documentation in Linux/Documentation/arm/Interrupts and
attached Linux Manual sect.3.2 Interrupts (Operation),
http://developer.toradex.com/device-tree-customization
There is i.MX7SDB gpio interrupt example (from SiI9022A INT) in imx7d-sdb.dts
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/arch/arm/boot/dts/imx7d-sdb.dts?id=...
tsc2046 {
interrupts = <13 0>;
pendown-gpio = <&gpio2 13 0>;
};
sii902x: sii902x@39 {
interrupt-parent = <&gpio2>;
interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
interrupt drivers examples can be found in linux/arch/arm/plat-mxc/epit.c
linux-2.6-imx.git - Freescale i.MX Linux Tree
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I just changed the value of MX7D_PAD_SD2_WP__GPIO5_IO10 from 0x14 to 12, ie Hystersis enabled and slew rate field = slow slew rate, now am getting interrupt, but not sure what happens exactly by these settings, i think i am seeing flurry of interrupts now. What settings should i select to configure for interrupt? I am testing this by sysfs, have set the edge to "rising". Can somebody please explain?