Connecting the sensor to the i2c bus

Which system do you use? Android, Ubuntu, OOWOW or others?

Android 12

I want to connect a sensor to the i2c bus, and now I need to add it to the device tree. I look at the example of how the KXTJ3-1057 accelerometer sensor was added to the device tree.

&i2c3 {
    status = "okay";

    gs_kxtj3: gs_kxtj3@e {
        compatible = "gs_kxtj3";
        reg = <0x0e>;
        irq-gpio = <&gpio1 RK_PB0 IRQ_TYPE_EDGE_RISING>;
        irq_enable = <0>;
        poll_delay_ms = <30>;
        type = <SENSOR_TYPE_ACCEL>;
        layout = <0>;
        status = "okay";

But I don’t understand what the following properties mean:

irq_enable = <0>;
poll_delay_ms = <30>;
layout = <0>;

Tell me the values of these properties

Hello @denbon

Those are configuration parameters are for the kernel module, it’s configured to do polling at 30ms with no IRQ.

Depending on your i2c device you might need to check the kernel driver for your device.


Ok, then tell me what exactly the property means:
layout = <0>

If polling of the sensor is configured without interruption, then why is the irq-gpio property indicated in the device tree and the electrical diagram shows that this accelerometer is connected to the RK_PB0 interrupt pin

@denbon IRQ is normal mode.

Layout is for physical orientation of the Accelerometer itself.
0 - 0 degrees.
1 - 90 degrees,
2 - 180 degrees,
3 - 270 degrees.