Quantcast
Channel: Forum - Recent Threads
Viewing all articles
Browse latest Browse all 1583

How to add I2C device in device tree (DTS)?

$
0
0

Hello,

I am implementing an I2C device driver for RZ/G2H, built as an external module.

Declare the I2C devices via devicetree
(https://www.kernel.org/doc/Documentation/i2c/instantiating-devices)

I modified r8a774e1-hihope-rzg2h.dts and added the declaration for the slave devices in Controller #2.


&i2c2 {
    pinctrl-0 = <&i2c2_pins>;
    pinctrl-names = "default";
    status = "okay";

+   tca9554_led@22 {
+       status = "okay";
+       compatible = "tca9554_led";
+       reg = <0x22>;
+   };

+   tca9554_led@23 {
+       status = "okay";
+       compatible = "tca9554_led";
+       reg = <0x23>;
+   };
};


Registration of the driver using insmod command was successful.
The driver's probe() function was also executed.

Listing of /sys/bus/i2c/devices directory.

root@hihope-rzg2h:~# ls -l /sys/bus/i2c/devices
total 0
lrwxrwxrwx 1 root root 0 Apr 13 12:07 2-0022 -> ../../../devices/platform/soc/e6510000.i2c/i2c-2/2-0022
lrwxrwxrwx 1 root root 0 Apr 13 12:07 2-0023 -> ../../../devices/platform/soc/e6510000.i2c/i2c-2/2-0023
lrwxrwxrwx 1 root root 0 Apr 13 12:07 i2c-0 -> ../../../devices/platform/soc/e6500000.i2c/i2c-0
lrwxrwxrwx 1 root root 0 Apr 13 12:07 i2c-1 -> ../../../devices/platform/soc/e6508000.i2c/i2c-1
lrwxrwxrwx 1 root root 0 Apr 13 12:07 i2c-2 -> ../../../devices/platform/soc/e6510000.i2c/i2c-2
lrwxrwxrwx 1 root root 0 Apr 13 12:07 i2c-4 -> ../../../devices/platform/soc/e66d8000.i2c/i2c-4
lrwxrwxrwx 1 root root 0 Apr 13 12:07 i2c-8 -> ../../../devices/platform/soc/fead0000.hdmi/i2c-8

However, the slave devices were not mounted when I confirmed with i2cdetect.

root@hihope-rzg2h:~# i2cdetect -r -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- 32 -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Is there anything else that I need to set?

Thank you.


Viewing all articles
Browse latest Browse all 1583

Trending Articles