abunickabhi
abunickabhi

Reputation: 578

I2C driver changes to recognize multiple buses

We have defined the analog videoIn adv7180 metadata hardware definition in the i2c2 node in one iMX device tree file. The ultimate aim is to recognize adv7180 driver from the i2c2 bus.

During the boot process of the processor using the linux image made with defconfig changes for I2C, the second I2C bus is not getting recognized.

Given below are the serial console print statements:

U-Boot 2015.10+fslc+g1b6aee7 (Jan 16 2018 - 14:57:01 +0530)

CPU: Freescale i.MX6Q rev1.2 996 MHz (running at 792 MHz)
CPU: Automotive temperature grade (-40C to 125C) at 26C
Reset cause: POR
Board: MX6-SabreSD
I2C: ready

Line 129: i2c i2c-1: IMX I2C adapter registered   //i2c-2 not registered??

Line 272 onwards: i2c /dev entries driver 
IR NEC protocol handler initialized 
IR RC5(x) protocol handler initialized 
IR RC6 protocol handler initialized 
IR JVC protocol handler initialized 
IR Sony protocol handler initialized 
IR RC5 (streamzap) protocol handler initialized 
IR SANYO protocol handler initialized 
IR MCE Keyboard/mouse protocol handler initialized 
mxc_v4l2_output v4l2_out.28: V4L2 device registered as video16 
mxc_v4l2_output v4l2_out.28: V4L2 device registered as video17 
i2c-core: driver [mag3110] using legacy suspend method 
i2c-core: driver [mag3110] using legacy resume method  

I have written these extra lines in defconfig files in the source directory of my Yocto Built.

CONFIG_IMX_HAVE_PLATFORM_IMX_I2C=y
# CONFIG_I2C_COMPAT is not set
CONFIG_I2C_CHARDEV=y
# CONFIG_I2C_HELPER_AUTO is not set
CONFIG_I2C_ALGOPCF=m
CONFIG_I2C_ALGOPCA=m
CONFIG_I2C_ALGOBIT=y
CONFIG_I2C_IMX=y
CONFIG_I2C_MUX=y
CONFIG_I2C_MUX=y

I have also check Kconfig files and seen that i2c driver is passed from the kernel-source directory in the built.

Do I have to make modifications to the C-files (driver files) made in the path /home/fsl-community-bsp-myproject/build/tmp/work-shared/imx6qonlinepdd/kernel-source/drivers/i2c of my yocto built?

There is even a C file for adv7180 in the sub-directory /drivers/media , can it be modified?

Upvotes: 0

Views: 1227

Answers (1)

YCN-
YCN-

Reputation: 221

you should look in the device tree you're using if i2c bus 2 is enabled.

You need to add the folowing line in your dts :

&i2c2 { // Change the name as needed 
    status = "okay"; 

    pinctrl-names = "default";
}

You've probably status = "disabled"; in the i2c node you're seeking.

EDIT: At first glance provided dts (https://pastebin.com/Y0esXmaX) seems ok. In order to debug further, one shall look into /dev/ directory in order to find the i2c bus.

As an example :

root@pico-imx8mq:~# ls /dev/*i2c*
/dev/i2c-0  /dev/i2c-1  /dev/i2c-2

This means I have 3 i2c bus and I can find them all on my dts. If you don't have the bus there you probably do have a dts problem.

dmesg | grep i2c might also give some hints.

You can also use i2cdetect from i2ctools package :

root@pico-imx8mq:~# i2cdetect -y 0 ## that will detect devices on first i2c bus
root@pico-imx8mq:~# i2cdetect -y 1 ## that will detect devices on second i2c bus
root@pico-imx8mq:~# i2cdetect -y 2 ## that will detect devices on third i2c bus

Upvotes: 2

Related Questions