IRQ Register error while interfacing bmi270 on i2c0 of rzg2n-Kernel-5.10.158

Hi Team ,

We are interfacing bmi27 into Renesas-rzg2n-yocto-sdk3.0.3-kernel-5.10.158, ported the bmi270 driver into.

 driver/hwmon/bmi270  which  is hocked onto i2c0 and my dts dts entries is as follows:

&i2c0 {
        clock-frequency = <400000>;
        status = "okay";
        bmi2xy@69 {
                label = "GPIO2_04 Interrupt";
                compatible = "bosch,bmi2xy";
                reg = <0x69>;
                gpio = <&gpio2 4 GPIO_ACTIVE_LOW>;
       //       gpio = <&gpio2 4 GPIO_ACTIVE_HIGH>;
                interrupt-parent = <&gpio2>;
                interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
       //       interrupts = <4 IRQ_TYPE_LEVEL_HIGH>;
        };
};.

The pins used for Interrupts are: GPIO2_04 and GPIO2_03.

When I do the insmod I am getting the following error

root@hihope-rzg2n:~# insmod bmi270_i2c_driver.ko
[   32.801305]
[   32.801305] [I]6<BS_LOG><bmi2xy_probe><3298>bmi2xy sensor probe
[   32.808990] input: bmi2xy as /devices/virtual/input/input0
[   32.827154]
[   32.827154] [D]7<BS_LOG><bmi2xy_request_irq><3232>Interrupt mapped to GPIO Pin: 333
[   32.836434] gpio gpiochip2: (e6052000.gpio): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
[   32.846403] gpio gpiochip2: (e6052000.gpio): unable to lock HW IRQ 4 for IRQ
[   32.853492] genirq: Failed to request resources for bmi2xy (irq 333) on irqchip gpio-rcar
[   32.861753]
[   32.861753] [E]3<BS_LOG><check_error><60>bmi2xy_request_irq: request IRQ failed with return code: -5
[   32.872477]
[   32.872477] [E]3<BS_LOG><check_error><60>bmi2xy_probe: sensor probe failed with return code: -5
[   32.882781] bmi2xy: probe of 0-0069 failed with error -5
root@hihope-rzg2n:~# poweroff.

Please guide me what am I missing here and why interrupt is not getting register here.

Thanks and Regards,

Nagaraja

Parents Reply Children
  • Hi,

    Thanks for the reply,

    Acutally My  dts entries line below,

    &i2c0 {
            clock-frequency = <400000>;
            status = "okay";
            bmi2xy@69 {
                    label = "GPIO2_04 Interrupt";
                    compatible = "bosch,bmi2xy";
                    reg = <0x69>;
                    interrupt-parent = <&intc_ex>; // I can use  iinterrupt-parent = <&gpio2>;
                    interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
                    bmi270,gpio_irq = <&gpio2 4 0>;
            };
    };

    And schematic is :

    When I do insert the modules it is saying probe is sucess but not getting any intestrrupt:

    GPIO2_04 INT_ACC

    GPIO2_03 INT_GYRO.

    root@hihope-rzg2n:~/old# insmod bmi270_i2c_driver.ko                                                                                                                  
    [  145.241222]
    [  145.241222] [I]6<BS_LOG><bmi2xy_probe><3298>bmi2xy sensor probe
    [  145.248896] input: bmi2xy as /devices/virtual/input/input1
    [  145.267183]
    [  145.267183] [D]7<BS_LOG><bmi2xy_request_irq><3232>Interrupt mapped to GPIO Pin: 333
    [  145.276514]
    [  145.276514] [I]6<BS_LOG><bmi2xy_probe><3328>sensor bmi2xy probed successfully
    root@hihope-rzg2n:~/old# [  316.384200] EXT4-fs (mmcblk1p2): error count since last fsck:

    only problem I have is  not able to get interrupts for the device.

    311:          0          0  gpio-rcar   3 Edge      ee140000.mmc cd
    313:          0          0     GIC-0 403 Level     ec500000.sound
    323:          0          0     GIC-0 385 Level     ec500000.sound
    332:          0          0  gpio-rcar  12 Edge      ee100000.mmc cd
    333:          0          0      irqc   4 Edge      bmi2xy
    IPI0:      8440      22158       Rescheduling interrupts
    IPI1:       315        260       Function call interrupts
    IPI2:         0          0       CPU stop interrupts
    IPI3:         0          0       CPU stop (for crash dump) interrupts
    IPI4:         0      25343       Timer broadcast interrupts
    IPI5:         1          9       IRQ work interrupts
    IPI6:         0          0       CPU wake-up interrupts
    Err:          0
    root@hihope-rzg2n:~/old#

    Please guide is it correct to configure the GPIO2_04 as interrupt like above or something need to be changed

    Thanks and Regards,

    Nagaraja

  • Hi,
    Please take a look here.
    Have you tried to probe with a scope to make sure the interrupt is generated?
    Kind Regards.

  • Hi Tried as given in the document,

         gpio_keys {
           compatible = "gpio-keys";
            pinctrl-names = "default";
       //   pinctrl-0 = <&pinctrl_gpio_keys>;
            key1 {
                label = "GPIO2_04 Interrupt";
                gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;  // GPIO2_04
       //         linux,code = <KEY_ENTER>;           // Example keycode
                interrupt-parent = <&gpio2>;
                interrupts = <4 IRQ_TYPE_EDGE_FALLING>; // Edge type can be rising, falling, or both
            };
        };
    };
    /*&pinctrl_gpio_keys: gpio_keys_pins {
        pins = "GPIO2_04";
        function = "gpio2";
        bias-pull-up;
    };*/

    &i2c0 {
            clock-frequency = <400000>;
            status = "okay";
            bmi2xy@69 {
                    label = "GPIO2_04 Interrupt";
                    compatible = "bosch,bmi2xy";
                    reg = <0x69>;
                    gpio = <&gpio2 4 GPIO_ACTIVE_LOW>;
                    interrupt-parent = <&intc_ex>;
                    interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
            //      bmi270,gpio_irq = <&gpio2 68 IRQ_TYPE_LEVEL_LOW>;
            };
    };

    We are not getting any interrupts. And getting below error:

    =============================================

    root@hihope-rzg2n:~# insmod bmi270_i2c_driver.ko
    [   27.604790]
    [   27.604790] [I]6<BS_LOG><bmi2xy_probe><3317>bmi2xy sensor probe
    [   27.612464] input: bmi2xy as /devices/virtual/input/input0
    [   27.630623]
    [   27.630623] [I]6<BS_LOG><bmi2xy_request_irq><3234>client_data->gpio_pin 254
    [   27.639186]
    [   27.639186] [I]6<BS_LOG><bmi2xy_request_irq><3242>gpio_request_one -517
    [   27.647390]
    [   27.647390] [I]6<BS_LOG><bmi2xy_request_irq><3244>gpio_direction_input -517
    [   27.655936]
    [   27.655936] [I]6<BS_LOG><bmi2xy_request_irq><3246>client_data->gpio_irq_2 -22
    [   27.664649]
    [   27.664649] [E]3<BS_LOG><check_error><60>bmi2xy_request_irq: request IRQ failed with return code: -539
    [   27.675529]
    [   27.675529] [E]3<BS_LOG><check_error><60>bmi2xy_probe: sensor probe failed with return code: -539
    [   27.685997] bmi2xy: probe of 0-0069 failed with error -5
    root@hihope-rzg2n:~# [  316.383941] EXT4-fs (mmcblk1p2): error count since last fsck: 3

    =========================================================

    Is the any ways to set GPIO2_04 as input to make it interrupt pin.

    Thanks and regards,

    Nagaraja