Devicetree i.MX8MP with PCA9544A

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Devicetree i.MX8MP with PCA9544A

跳至解决方案
699 次查看
Ralf_Rademacher
Contributor III

Can anyone tell me what a devicetree entry must look like if I want to implement the following constellation? 

help.png

 

i hope you understand what i'm trying to describe.

I only found examples without handling the interupt of an child node of pca954x.

 

thx in advance

0 项奖励
1 解答
379 次查看
Ralf_Rademacher
Contributor III

The thread can be closed as there was no other good solution than to implement it in the form of a userspace driver.

在原帖中查看解决方案

0 项奖励
5 回复数
380 次查看
Ralf_Rademacher
Contributor III

The thread can be closed as there was no other good solution than to implement it in the form of a userspace driver.

0 项奖励
583 次查看
Ralf_Rademacher
Contributor III

Is there really nobody who ever has used pca954x in a Linux system, with an child node, which generates an interrupt? who can provide an complete and full working devicetree entry, which contains everything i need to get this circuit work propperly?

0 项奖励
595 次查看
Ralf_Rademacher
Contributor III

Hello, i added much debugoutput to several kernelfunctions and to the drivers...

The problem seems to be, that somehow there is a problem getting the right irqdomain.

 

 

 

 

I2C Bus

[    5.130661] [DBGMSG] request_threaded_irq :action->handler: 0x10DBA3F8
[    5.130664] [DBGMSG] request_threaded_irq :action->thread_fn: 0x0
[    5.137199] [DBGMSG] request_threaded_irq :action->flags: 0x4080
[    5.143311] [DBGMSG] request_threaded_irq :action->name: 30a50000.i2c
[    5.149328] [DBGMSG] request_threaded_irq :action->dev_id: 0x67AB2080
[    5.155803] [DBGMSG] request_threaded_irq :leaving fxn the normal way

PCA9544A

[    5.169785] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq] is returned
[    5.169788] [DBGMSG] irq_find_mapping :hwirq: 0x6
[    5.177110] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq]: 0x63
[    5.181825] [DBGMSG] irq_find_mapping  using domain @00000000d8881a92
[    5.195331] [DBGMSG] pca954x_probe :entering pca954x_probe
[    5.201139] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq] is returned
[    5.201141] [DBGMSG] irq_find_mapping :hwirq: 0x0
[    5.208461] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq]: 0x0
[    5.213171] [DBGMSG] irq_find_mapping  using domain @0000000059dfe323
[    5.226625] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq] is returned
[    5.226629] [DBGMSG] irq_find_mapping :hwirq: 0x1
[    5.233945] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq]: 0x0
[    5.238657] [DBGMSG] irq_find_mapping  using domain @0000000059dfe323
[    5.253205] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq] is returned
[    5.253214] [DBGMSG] irq_find_mapping :hwirq: 0x2
[    5.260621] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq]: 0x0
[    5.265360] [DBGMSG] irq_find_mapping  using domain @0000000059dfe323
[    5.278843] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq] is returned
[    5.278845] [DBGMSG] irq_find_mapping :hwirq: 0x3
[    5.286176] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq]: 0x0
[    5.290904] [DBGMSG] irq_find_mapping  using domain @0000000059dfe323

APDS9960 (Sensor 1)

[    5.308440] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq] is returned
[    5.308442] [DBGMSG] irq_find_mapping :hwirq: 0x0
[    5.315776] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq]: 0x5D
[    5.320510] [DBGMSG] irq_find_mapping  using domain @00000000d8881a92
[    5.334083] [DBGMSG] apds9960_probe :enter apds probe
[    6.096343] [DBGMSG] request_threaded_irq :action->handler: 0x10167F50
[    6.101438] [DBGMSG] request_threaded_irq :action->thread_fn: 0x10F5F404
[    6.107990] [DBGMSG] request_threaded_irq :action->flags: 0x2082
[    6.114708] [DBGMSG] request_threaded_irq :action->name: apds9960_event
[    6.120736] [DBGMSG] request_threaded_irq :action->dev_id: 0x67AB3800
[    6.127397] [DBGMSG] setup_irq_thread :enter fxn
[    6.136793] [DBGMSG] request_threaded_irq :leaving fxn the normal way
[    6.137148] [DBGMSG] irq_thread :enter fxn
[    6.141451] [DBGMSG] apds9960_probe :client->irq: 0x5D / interrupt_handler_fxn: 0x10F5F404

APDS9960 (Sensor 2)

[    6.169614] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq] is returned
[    6.169616] [DBGMSG] irq_find_mapping :hwirq: 0x1
[    6.176983] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq]: 0x5E
[    6.181721] [DBGMSG] irq_find_mapping  using domain @00000000d8881a92
[    6.195365] [DBGMSG] apds9960_probe :enter apds probe
[    6.524923] [DBGMSG] request_threaded_irq :action->handler: 0x10167F50
[    6.530004] [DBGMSG] request_threaded_irq :action->thread_fn: 0x10F5F404
[    6.536558] [DBGMSG] request_threaded_irq :action->flags: 0x2082
[    6.543280] [DBGMSG] request_threaded_irq :action->name: apds9960_event
[    6.549309] [DBGMSG] request_threaded_irq :action->dev_id: 0x67AB4800
[    6.555964] [DBGMSG] setup_irq_thread :enter fxn
[    6.565125] [DBGMSG] request_threaded_irq :leaving fxn the normal way
[    6.565502] [DBGMSG] irq_thread :enter fxn
[    6.569770] [DBGMSG] apds9960_probe :client->irq: 0x5E / interrupt_handler_fxn: 0x10F5F404

APDS9960 (Sensor 3)

[    6.597743] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq] is returned
[    6.597745] [DBGMSG] irq_find_mapping :hwirq: 0x2
[    6.605093] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq]: 0x5F
[    6.609827] [DBGMSG] irq_find_mapping  using domain @00000000d8881a92
[    6.623459] [DBGMSG] apds9960_probe :enter apds probe
[    7.580221] [DBGMSG] request_threaded_irq :action->handler: 0x10167F50
[    7.585311] [DBGMSG] request_threaded_irq :action->thread_fn: 0x10F5F404
[    7.591861] [DBGMSG] request_threaded_irq :action->flags: 0x2082
[    7.598579] [DBGMSG] request_threaded_irq :action->name: apds9960_event
[    7.604609] [DBGMSG] request_threaded_irq :action->dev_id: 0x67AB5800
[    7.611261] [DBGMSG] setup_irq_thread :enter fxn
[    7.620473] [DBGMSG] request_threaded_irq :leaving fxn the normal way
[    7.620833] [DBGMSG] irq_thread :enter fxn
[    7.625131] [DBGMSG] apds9960_probe :client->irq: 0x5F / interrupt_handler_fxn: 0x10F5F404



IRQ was generated at the second sensor

[   68.221782] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq] is returned
[   68.221788] [DBGMSG] irq_find_mapping :hwirq: 0x6					// CORRECT PIN WAS DETERMINED AT IMX8MP
[   68.229103] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq]: 0x63		// CORRECT IRQ DETERMINED (pca954x)
[   68.233809] [DBGMSG] irq_find_mapping  using domain @00000000d8881a92		// SAME POINTER AS pca954x, APDS9960 (sensor 1-3)
[   68.247618] [DBGMSG] irq_thread_fn :enter fxn
[   68.247622] [DBGMSG] irq_thread_fn :action->handler: 0x10167F50
[   68.252005] [DBGMSG] irq_thread_fn :action->thread_fn: 0x10DC0950
[   68.257949] [DBGMSG] irq_thread_fn :action->flags: 0x2082
[   68.264057] [DBGMSG] irq_thread_fn :action->name: pca954x
[   68.269462] [DBGMSG] irq_thread_fn :action->dev_id: 0x67A9D8F8
[   68.274867] [DBGMSG] pca954x_irq_handler :entering pca954x_irq_handler		// ENTERING CORRECT HANDLER (pca954x)
[   68.281554] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq] is returned
[   68.288099] [DBGMSG] irq_find_mapping :hwirq: 0x1					// CORRECT PIN AT pca954x IS DETERMINED, WHERE SECOND SENSORS INT SIGNAL IS ATTACHED TO
[   68.295415] [DBGMSG] irq_find_mapping :domain->linear_revmap[hwirq]: 0xDF		// I DONT UNDERSTAND, WHERE THIS IRQ COME FROM. 0xDE, 0xDF and 0xE0 is not listed under /proc/irq or /proc/interrupts
[   68.300127] [DBGMSG] irq_find_mapping  using domain @0000000059dfe323
[   68.313621] [DBGMSG] handle_nested_irq :entering handle_nested_irq
[   68.313623] [DBGMSG] handle_nested_irq :irq: 0xDF					// NOW HANDLE_NESTED_IRQ HAS DETERMINED A IRQ WHICH IS UNKNOWN TO ME
[   68.319811] [DBGMSG] handle_nested_irq :irq_desc->name: null				// THATS WHY ALL FOLLOWING VARIABLES ARE WRONG AND INVALID
[   68.324527] [DBGMSG] handle_nested_irq :irq_desc->parent_irq: 0x00			// SAME HERE
[   68.330202] [DBGMSG] handle_nested_irq :action: false or null			// SAME HERE
[   68.336380] [DBGMSG] handle_nested_irq :irqd_irq_disabled: true			// CHECK FAILS AS RESULT
[   68.342122] [DBGMSG] handle_nested_irq :result of (unlikely(!action || irqd_irq_disabled(&desc->irq_data))) : true	// FALSE CONDITION IS USED
[   68.348037] [DBGMSG] handle_nested_irq :goto out_unlock				// IRQ IS NOT HANDLED, BECAUSE apds9960_interrupt_handler // WAS NOT TRIGGERED

 

 

 

 

 

0 项奖励
688 次查看
AldoG
NXP TechSupport
NXP TechSupport

Hello,

You may take the i.MX8MM with the 8MIC board device tree as reference, which make use of the PCA9555 as you want to use the PCA954x
https://github.com/nxp-imx/linux-imx/blob/lf-5.15.y/arch/arm64/boot/dts/freescale/imx8mm-evk-8mic-re...

Also, you may refer to the device tree binding documentation:
https://github.com/nxp-imx/linux-imx/blob/fa6c3168595c02bd9d5366fcc28c9e7304947a3d/Documentation/dev...

Best regards,
Aldo.

0 项奖励
661 次查看
Ralf_Rademacher
Contributor III

Thx @AldoG ,

 

but the links were not very useful.

i found a configuration which partially works. but it did not refer back on the child node. so i think in the proximity@39 node i still need a pinctrl. (the driver tells me this during probe) but i have no idea how a pinctrl has to look for pca9544a. i only find examples for imx8..

	i2c4_mux_apds: i2c4-mux-pca9544@70 {
		compatible = "nxp,pca9544";
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <0x70>;
		interrupt-parent = <&gpio2>;
		interrupt-controller;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_pca9544a_70>;
		interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
		interrupt-cells = <2>;

		i2c@0 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <0>;

			proximity@39 {
				compatible = "avago,apds9960";
				reg = <0x39>;
				interrupts = <0 IRQ_TYPE_EDGE_FALLING>;
				interrupt-parent = <&i2c4_mux_apds>;
				};
		};

		i2c@1 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <1>;

			proximity@39 {
				compatible = "avago,apds9960";
				reg = <0x39>;
				interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
				interrupt-parent = <&i2c4_mux_apds>;
				};
		};

 

has anyone an idea how to do?

 

Best Ralf

0 项奖励