Help with Device-tree

I’m trying to add NXP PCA9632 - i2c led controller to the DTB.

I connected the PCA9632 to I2C_A0 (pins 25-26),running “sudo i2cdetect -y 4” shows the PCA9632 on ‘62’ as expected.

My goal is to add the controlled as “/sys/class/leds/XXX_led” using the existing kernel driver:

I already decompiled the DTB into DTS.
From pca963x doc I know i need to add the following to the DTS:

pca9632: pca9632 {
	compatible = "nxp,pca9632";
	#address-cells = <1>;
	#size-cells = <0>;
	reg = <0x62>;

	red@0 {
		label = "red";
		reg = <0>;
		linux,default-trigger = "none";
	};
	green@1 {
		label = "green";
		reg = <1>;
		linux,default-trigger = "none";
	};
	blue@2 {
		label = "blue";
		reg = <2>;
		linux,default-trigger = "none";
	};
	unused@3 {
		label = "unused";
		reg = <3>;
		linux,default-trigger = "none";
	};
};

should i add it somewhere specific or just under the main tree?
should i add anything else regarding the i2c?

I would appreciate any help.

You need to add such devicetree node to i2c_AO node, like this:

diff --git a/arch/arm64/boot/dts/amlogic/kvim3_linux.dts b/arch/arm64/boot/dts/amlogic/kvim3_linux.dts
index f728e92..6160e87a 100644
--- a/arch/arm64/boot/dts/amlogic/kvim3_linux.dts
+++ b/arch/arm64/boot/dts/amlogic/kvim3_linux.dts
@@ -877,6 +877,34 @@
                reg-data-type = <1>;
                link-device = <&phycsi>;
        };
+
+       pca9632: pca9632 {
+               compatible = "nxp,pca9632";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x62>;
+
+               red@0 {
+                       label = "red";
+                       reg = <0>;
+                       linux,default-trigger = "none";
+               };
+               green@1 {
+                       label = "green";
+                       reg = <1>;
+                       linux,default-trigger = "none";
+               };
+               blue@2 {
+                       label = "blue";
+                       reg = <2>;
+                       linux,default-trigger = "none";
+               };
+               unused@3 {
+                       label = "unused";
+                       reg = <3>;
+                       linux,default-trigger = "none";
+               };
+       };
 };
 
 &audiobus {

3 Likes