How to configure device tree for external interrupt as input on imx8qp?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to configure device tree for external interrupt as input on imx8qp?

Jump to solution
879 Views
Anton_K
Contributor III

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(6) with the following inputs:

 

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

0 Kudos
Reply
1 Solution
840 Views
Anton_K
Contributor III

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.

View solution in original post

0 Kudos
Reply
3 Replies
846 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @Anton_K,

I hope you are doing well
 
Kindly share your full device tree file and the driver code to further debug the issue.
 
Thanks & Regards,
Dhruvit Vasavada
841 Views
Anton_K
Contributor III

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.

0 Kudos
Reply
862 Views
Anton_K
Contributor III

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?

Tags (1)
0 Kudos
Reply