Janka
Posts: 11
Joined: Mon Apr 21, 2014 9:12 pm

[SOLVED] Updated kernel from 3.10.28 to 4.4.16, hdmi i2c half-fails

Fri Aug 12, 2016 7:11 pm

EDIT: A recent update to Kernel 4.9 and newer boot files solved this problem for me.


I finally have updated my own Linux distribution to a device-tree enabled kernel, 4.4.16. Smoothed out a lot of bumps on the way, however, this one remains.

I have a FT5316 and PCA9530 connected to the HDMI I2C. No EDID eeprom there, it's a homebrewn display.

With linux-3.10.28 and the necessary patches to enable the HDMI I2C access for the i2c subsystem, all runs fine. "I2cdetect 2" shows up the FT5316 at adress 0x38 and the PCA9530 at 0x60. My touchscreen driver works, all fine. (And yes, I've double-checked the hardware, it still worked with another SD card with the old setup.)

With linux-4.4.16 and device trees, I see /dev/i2c-2. But "I2cdetect 2" doesn't show up any devices. And the touchscreen driver also sees nothing. Also checked whether the buses had been jumbled, no.

My whole config.txt is

Code: Select all

## Default device tree to use
device_tree=bcm2708-rpi-b-plus.dtb


## Device tree overlays


## Device options
dtparam=i2c2_iknowwhatimdoing
dtparam=i2c_arm=on
dtparam=i2c_vc=on


## Display setup
hdmi_ignore_edid=0xa5000080
hdmi_group=2
hdmi_mode=87
hdmi_timings=800 0 16 42 8 480 0 9 5 18 0 0 0 60 0 29590000 6
config_hdmi_boost=6
dtb and dtbo files are from the kernel build. What I am missing to make the i2c2 really work with linux-4.4.16?

Thanks for any pointers.
Last edited by Janka on Thu Aug 10, 2017 7:27 pm, edited 1 time in total.

Janka
Posts: 11
Joined: Mon Apr 21, 2014 9:12 pm

Re: Updated kernel from 3.10.28 to 4.4.16, hdmi i2c half-fai

Tue Aug 16, 2016 8:05 pm

Okay, some more information on this. I use this code

Code: Select all

#include <stdio.h> 
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "i2c-dev.h"

#define PCA9530_ADDR 0x60


int main(int argc, char* argv[]) {
	int count;
	int fd;
	fd = open("/dev/i2c-2", O_RDWR);

	if (ioctl(fd, I2C_SLAVE, PCA9530_ADDR) < 0) {
		perror("Failed to set slave address");
		return 2;
	}


	if ((count=i2c_smbus_write_byte_data(fd,0x01,0xff)) < 0) {
		perror("Failed to write PWM0 prescaler");
		return 2;
	};

	if ((count=i2c_smbus_write_byte_data(fd,0x02,0x80)) < 0) {
		perror("Failed to write PWM0 data");
		return 2;
	};

	if ((count=i2c_smbus_write_byte_data(fd,0x05,0xf2)) < 0) {
		perror("Failed to write LED selector");
		return 2;
	};

	close(fd);

	fprintf(stderr, "ok\n");
	return 0;
}
to make the PCA9530 blink the backlight of the display it's connected to. I have disconnected the FT5316 for these tests.

Please see the output from tfla-01 (two separate runs). The upper two lines are from when the system runs linux-3.10.28, the lower two when it runs linux-4.4.16. Root is from NFS, so all other things are identical.
hmdi_i2c_fail.png
hmdi_i2c_fail.png (22.59 KiB) Viewed 812 times
It seems to me, with linux-4.4.16, the HDMI I2C is able to produce output but the PCA9530 cannot ACK (9th bit of the i2c address is high though it should be low). I then messed with the I2C and connected a 220Ω pulldown resistor to SDA. With this resistor, whenever the bit 9 timeslot is floating to let the slave ACK, it should be pulled down regardless whether the PCA9530 does that or not.

Nope. It does this:
pulldown.png
pulldown.png (5.36 KiB) Viewed 812 times
It seems to me SDA is held high by the host during the ACK timeslot. No chance for the PCA9530 nor the 220Ω resistor to pull it down.

Please, anyone with insight, comment.

Return to “Troubleshooting”