AnsweredAssumed Answered

PCA6416 Interruption - irq 79: nobody cared

Question asked by Khang Le Truong on May 26, 2020
Latest reply on May 27, 2020 by igorpadykov

Dear All,

 

I would like to relaunch my previous question with more implementation detail. The purpose is configuring the IO expander PCA6416 on the iMX8M-EVK so that it propagates the interrupt signal from the one of Invensens IMUs  (actually I'm using MPU9250). For that, I modified the fsl-imx8mm-evk.dts as below :

 

...

&iomuxc {
        pinctrl-names = "default";

 

        imx8mm-evk {

               ...

                pinctrl_ioexp_int: ioexpint_iogrp {
                        fsl,pins = <
                                MX8MM_IOMUXC_GPIO1_IO12_GPIO1_IO12              0x19
                        >;
                };
        };
};

...

 

...

&i2c3 {
        clock-frequency = <100000>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c3>;
        status = "okay";

 

        pca6416: gpio@20 {
                compatible = "ti,tca6416";
                reg = <0x20>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-controller;
                #interrupt-cells = <2>;
                interrupt-parent = <&gpio1>;
                interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
                status = "okay";
                ngpios = <16>;

 

                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_ioexp_int>;

       ...

        inv-mpu6050@68 {
                compatible = "invensense,mpu6050";
                reg = <0x68>;
                interrupt-parent = <&pca6416>;
                interrupts = <8 IRQ_TYPE_EDGE_RISING>; /* MPU6050's INT will be connected to EXP_IO8 */
                mount-matrix =  "-0.984807753012208",  /* x0 */
                                "0",                   /* y0 */
                                "-0.173648177666930",  /* z0 */
                                "0",                   /* x1 */
                                "-1",                  /* y1 */
                                "0",                   /* z1 */
                                "-0.173648177666930",  /* x2 */
                                "0",                   /* y2 */
                                "0.984807753012208";   /* z2 */
        };
};

 

With above modification, I got following error during system boot :

[    3.251910] inv-mpu6050-i2c 2-0068: whoami mismatch got 0x71 (MPU9250)expected 0x68 (MPU6050)
[    3.402310] inv-mpu6050-i2c 2-0068: trigger probe fail -22
[    3.407900] inv-mpu6050-i2c: probe of 2-0068 failed with error -22

 

After a while, I got following trace of "irq 79: nobody cared" :

[ 74.038666] irq 79: nobody cared (try booting with the "irqpoll" option)

[ 74.045380] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.98 #1

[ 74.051386] Hardware name: FSL i.MX8MM EVK board (DT)

[ 74.056438] Call trace:

[ 74.058897] [<ffff000008089b50>] dump_backtrace+0x0/0x3b0

[ 74.064299] [<ffff000008089f14>] show_stack+0x14/0x20

[ 74.069354] [<ffff000008d97510>] dump_stack+0x9c/0xbc

[ 74.074411] [<ffff00000811cc58>] __report_bad_irq+0x48/0xe0

[ 74.079986] [<ffff00000811cb80>] note_interrupt+0x280/0x2e4

[ 74.085562] [<ffff000008119d34>] handle_irq_event_percpu+0x54/0x70

[ 74.091742] [<ffff000008119d98>] handle_irq_event+0x48/0x80

[ 74.097318] [<ffff00000811d7d0>] handle_level_irq+0xb0/0x140

[ 74.102980] [<ffff000008118d24>] generic_handle_irq+0x24/0x40

[ 74.108731] [<ffff0000084ad91c>] mxc_gpio_irq_handler+0x4c/0x130

[ 74.114739] [<ffff0000084add44>] mx3_gpio_irq_handler+0x64/0xd0

[ 74.120660] [<ffff000008118d24>] generic_handle_irq+0x24/0x40

[ 74.126408] [<ffff0000081193c0>] __handle_domain_irq+0x60/0xc0

[ 74.132243] [<ffff00000808193c>] gic_handle_irq+0x7c/0x178

[ 74.137730] Exception stack(0xffff000009503d80 to 0xffff000009503ec0)

[ 74.140210] pca953x 2-0020: failed reading register

[ 74.144173] 3d80: 0000000000000000 ffff80007ff63d80 0000800076a6b000 0000000001d78191

[ 74.144179] 3da0: 0000000000000016 00ffffffffffffff 0000000002e71ca8 cccccccccccccccd

[ 74.144184] 3dc0: ffff80007ff62ea4 ffff80007ff62e84 0000000000000075 071c71c71c71c71c

[ 74.172533] 3de0: 000000000000a239 0000000000000000 0000000000000024 000000000000004d

[ 74.180362] 3e00: 0000000000000000 0000000000000000 0000000000000000 000000113d0c27fb

[ 74.188192] 3e20: ffff80007ada6800 0000000000000000 ffff80007aff2000 0000000000000000

[ 74.196021] 3e40: 000000113d0beeda ffff000009512580 ffff80007aff2000 0000000000000000

[ 74.203851] 3e60: 00000000417c0018 ffff000009503ec0 ffff000008a16a3c ffff000009503ec0

[ 74.211681] 3e80: ffff000008a16a40 0000000060000145 ffff80007aff2018 ffff80007ada6800

[ 74.219511] 3ea0: ffffffffffffffff ffff80007aff2000 ffff000009503ec0 ffff000008a16a40

[ 74.227343] [<ffff000008083230>] el1_irq+0xb0/0x124

[ 74.232226] [<ffff000008a16a40>] cpuidle_enter_state+0x80/0x230

[ 74.238147] [<ffff000008a16c28>] cpuidle_enter+0x18/0x20

[ 74.243461] [<ffff00000810ad3c>] call_cpuidle+0x1c/0x40

[ 74.248686] [<ffff00000810afa8>] do_idle+0x198/0x1e0

[ 74.253652] [<ffff00000810b194>] cpu_startup_entry+0x24/0x30

[ 74.259315] [<ffff000008da9a58>] rest_init+0xd0/0xdc

[ 74.264283] [<ffff0000093c0b3c>] start_kernel+0x390/0x3a4

[ 74.269681] handlers:

[ 74.271957] [<ffff000008119e30>] irq_default_primary_handler threaded [<ffff0000084ae440>] pca953x_irq_handler

[ 74.281963] Disabling IRQ #79

 

I then applied the following patch as recommendation from Raspberry forum :

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
index 540070f..5d11893 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
@@ -13,6 +13,11 @@

 

 #include "inv_mpu_iio.h"

 

+static irqreturn_t inv_mpu6050_event_handler(int irq, void *private)
+{
+       return IRQ_HANDLED;
+}
+
 static void inv_scan_query(struct iio_dev *indio_dev)
 {
        struct inv_mpu6050_state  *st = iio_priv(indio_dev);
@@ -130,8 +135,9 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev)
        if (!st->trig)
                return -ENOMEM;

 

-       ret = devm_request_irq(&indio_dev->dev, st->irq,
+       ret = devm_request_threaded_irq(&indio_dev->dev, st->irq,
                               &iio_trigger_generic_data_rdy_poll,
+                               &inv_mpu6050_event_handler,
                               IRQF_TRIGGER_RISING,
                               "inv_mpu",
                               st->trig);

 

The above patch for could help to bypass "probe of 2-0068 failed with error -22" :

[    3.254558] inv-mpu6050-i2c 2-0068: whoami mismatch got 0x71 (MPU9250)expected 0x68 (MPU6050)
[    3.403921] i2c i2c-2: Added multiplexed i2c bus 4

But the trace of "irq 79: nobody cared" still persisted.

 

It would be really appreciated if anybody can help to confirm that my expectation to propagate external interrupt signal via PCA6416 is feasible and possibly to point out the problem in my implementation, please ?

 Thank you in advance,

Khang

Outcomes