raynam
Posts: 11
Joined: Fri Jan 22, 2021 1:25 am

Using HDMI I2C for DTS

Fri May 14, 2021 2:16 am

Hi.
I'm trying to use HDMI i2c on CM4.
I modified /boot/config.txt , and I can check hdmi i2c.

Code: Select all

pi@ray-cm4:~ $ ls /dev/*i2c*
/dev/i2c-11  /dev/i2c-12
And, I tried to use this I2c for Touch Controller GT911 (Goodix)
I can search the i2c device

Code: Select all

pi@ray-cm4:~ $ i2cdetect -r -y 12
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- 5d -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --   

I had run the device successfully on i2c0 i2c1 by
dtoverlay=GT911
and I can see device is working by following command.

Code: Select all

pi@ray-cm4:~ $ lsmod|grep goodix
goodix                 24576  0

Code: Select all

// Device tree overlay for I2C connected Goodix gt9271 multiple touch controller
/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&gpio>;
		__overlay__ {
			goodix_pins: goodix_pins {
				brcm,pins = <4 5>; // interrupt and reset
				brcm,function = <0 0>; // in
				brcm,pull = <2 2>; // pull-up
			};
		};
	};

	fragment@1 {
		target = <&i2c0>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			gt9271: gt9271@14 {
				compatible = "goodix,gt9271";
				reg = <0x5d>;
				pinctrl-names = "default";
				pinctrl-0 = <&goodix_pins>;
				interrupt-parent = <&gpio>;
				interrupts = <4 2>; // high-to-low edge triggered
				irq-gpios = <&gpio 4 0>; 
				reset-gpios = <&gpio 5 0>;
			};
		};
	};

	__overrides__ {
		interrupt = <&goodix_pins>,"brcm,pins:0",
			<&gt9271>,"interrupts:0",
			<&gt9271>,"irq-gpios:4";
		reset = <&goodix_pins>,"brcm,pins:4",
			<&gt9271>,"reset-gpios:4";
	};
};

but when I modified this dts for HDMI i2c(i2c11, i2c 12)

Code: Select all

// Device tree overlay for I2C connected Goodix gt9271 multiple touch controller
/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&gpio>;
		__overlay__ {
			goodix_pins: goodix_pins {
				brcm,pins = <4 5>; // interrupt and reset
				brcm,function = <0 0>; // in
				brcm,pull = <2 2>; // pull-up
			};
		};
	};

	fragment@1 {
		target = <&i2c11>; 
		#target=<&i2c12>
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			gt9271: gt9271@14 {
				compatible = "goodix,gt9271";
				reg = <0x5d>;
				pinctrl-names = "default";
				pinctrl-0 = <&goodix_pins>;
				interrupt-parent = <&gpio>;
				interrupts = <4 2>; // high-to-low edge triggered
				irq-gpios = <&gpio 4 0>; 
				reset-gpios = <&gpio 5 0>;
			};
		};
	};

	__overrides__ {
		interrupt = <&goodix_pins>,"brcm,pins:0",
			<&gt9271>,"interrupts:0",
			<&gt9271>,"irq-gpios:4";
		reset = <&goodix_pins>,"brcm,pins:4",
			<&gt9271>,"reset-gpios:4";
	};
};
In this case, I can'y see anything when I typing command

Code: Select all

lsmod|grep goodix
How can I fix it?

aBUGSworstnightmare
Posts: 2935
Joined: Tue Jun 30, 2015 1:35 pm

Re: Using HDMI I2C for DTS

Fri May 14, 2021 5:35 am

Code: Select all

 gt9271: gt9271@14 {
				compatible = "goodix,gt9271";
				reg = <0x5d 
your overlay is wrong as I2C addresses are inconsistent. There is no 0x14 address or why have you added it?

raynam
Posts: 11
Joined: Fri Jan 22, 2021 1:25 am

e

Fri May 14, 2021 5:44 am

wrong post
Last edited by raynam on Fri May 14, 2021 5:50 am, edited 1 time in total.

raynam
Posts: 11
Joined: Fri Jan 22, 2021 1:25 am

Re: Re: Using HDMI I2C for DTS

Fri May 14, 2021 5:48 am

aBUGSworstnightmare wrote:
Fri May 14, 2021 5:35 am

Code: Select all

 gt9271: gt9271@14 {
				compatible = "goodix,gt9271";
				reg = <0x5d 
your overlay is wrong as I2C addresses are inconsistent. There is no 0x14 address or why have you added it?

Thanks to your reply
reg address is 0x5D. I can see that by command i2cdetect -r -y 12.
and It works well adress 0x5D on i2c0, i2c1.

Code: Select all

pi@ray-cm4:~ $ i2cdetect -r -y 12
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- 5d -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --   

I guess I2C channel can be cause. It is right i2c12?
fragment@1 {
target = <&i2c0>;

aBUGSworstnightmare
Posts: 2935
Joined: Tue Jun 30, 2015 1:35 pm

Re: Using HDMI I2C for DTS

Fri May 14, 2021 5:54 am

Why do you write 0x14 in rhis line

Code: Select all

  gt9271: gt9271@14   
when yoir I2C device is at address 0x5d?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11246
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Using HDMI I2C for DTS

Fri May 14, 2021 6:31 am

The HDMI I2C buses are not i2c11 and i2c12 in device tree, they are ddc0 and ddc1. Your overlay will therefore fail to apply.

Also note that as they do not have aliases defined, the i2c node number is not fixed. If you add "dtparam=i2c_vc=on", then that creates fixed nodes for i2c0 and i2c10, a floating node at i2c11, so the HDMI I2C generally comes in as i2c12 and i2c13. If it's not present then they'll be i2c11 and i2c12.

The i2c-brcmstb driver also doesn't like the quick check mode that i2cdetect uses. Use i2cdetect -r for reliable results.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Interfacing (DSI, CSI, I2C, etc.)”