Hello, I need to configure device tree correctly. I have I2C sensor driver which also has interrupt on output. On the source code it uses
request_threaded_irq(client->irq, NULL, bh1770_irq, IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_TRIGGER_LOW, "bh1770", chip);
I got access to I2C buss correctly by device tree, but can't configure external interrupt...
I've assumed the following configuration:
&i2c3 {
#address-cells = <1>;
#size-cells = <0>;
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpi2c3>;
status = "okay";
/* Light sensor */
bh1770: bh1770@38 {
compatible = "osram,bh1770";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_bh1770>;
reg = <0x38>;
interrupt-parent = <&lsio_gpio3>;
interrupts = <24 IRQ_TYPE_EDGE_FALLING>;
status = "okay";
};
};
&iomuxc {
...
pinctrl_bh1770: bh1770grp {
fsl,pins = <
IMX8QXP_QSPI0B_SS1_B_LSIO_GPIO3_IO24 0x21
>;
};
...
};
Actually I got error -22 (looks like EINVAL) just on runtime by request_threaded_irq().
Can someone help me, what do I wrong?
Thanks in advance, Anton
Solved! Go to Solution.
Hi @Dhruvit , thanks for your reply. I've just found issue. I have copied device tree and there was configured the same pin for another device. I've removed this pin configuration but left gpio_hog for this pin number. So I've applied the changes and it works fine on runtime:
&lsio_gpio3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_mipi_csi0>;
-
- cam_buf_hog {
- gpio-hog;
- gpios = <24 0>;
- output-high;
- line-name = "cam_buf_en";
- };
};
Best regards, Anton.
Hi @Anton_K,
Hi @Dhruvit , thanks for your reply. I've just found issue. I have copied device tree and there was configured the same pin for another device. I've removed this pin configuration but left gpio_hog for this pin number. So I've applied the changes and it works fine on runtime:
&lsio_gpio3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_mipi_csi0>;
-
- cam_buf_hog {
- gpio-hog;
- gpios = <24 0>;
- output-high;
- line-name = "cam_buf_en";
- };
};
Best regards, Anton.
UPD: I've changed pin mux configuration in dtsi file according reference manual as the LSIO_GPIO3_IO24 to:
IMX8QXP_QSPI0B_SS1_B_LSIO_GPIO3_IO24 0x26000021
But it doesn't help. Also I got extra log in dmesg:
genirq: Failed to request resources for bh1770 (irq 295) on irqchip gpio-mxc
I have no idea why irq got number 295, may be there is the reason? Hot to understand where that number setup and what should be?