Need TX2 I2C control example

Hi,

Please let me know where to start to handle I2C device.

I’d like to handle a chip (TI TCA93539 GPIO extender) using Jetson I2C_GP1_CLK/DAT.
I need sample code for handling Tegra I2C.

Thanks,

You just need add the TCA9539 to the right i2c bus like below and the tca9539’s kernel driver will probe and working for it.

…/common/kernel-dts/t18x-common-modules/tegra186-camera-e3333-a00.dtsi

can u please elaborate more about device tree nodes that i need to add at i2c@31600000 so that my gpio’s can work

Have a reference to tegra186-camera-e3333-a00.dtsi
It looks like below.

i2c@3180000 {
 		tca9548@77 {
 			i2c@0 {
 				ov5693_a@36 {
 					compatible = "nvidia,ov5693";
 					reg = <0x36>;
 					devnode = "video0";
 
 					/* Physical dimensions of sensor */
 					physical_w = "3.674";
 					physical_h = "2.738";

this node is present in i2c@31600000, is this not sufficient?

gpio@74 {
compatible = “ti,tca9539”;
reg = <0x74>;
gpio-controller;
#gpio-cells = <0x2>;
vcc-supply = <0x1a>;
linux,phandle = <0x106>;
phandle = <0x106>;

		touch-rails {
			gpio-hog;
			gpios = <0x1 0x0 0x2 0x0>;
			output-high;
			label = "touch-rail-1", "touch-rail-2";
		};
	};

Sorry for my previous comment that is for the i2c mux not GPIO mux.
Your finding is correct.

You may need to enhance the gpios for all pins.