ADV7182 not detected

Hi, i’m trying to configure on custom board adv7182 for analog cameras. I’ve added it’s config to i2c3 node in dts

adv7180: adv7180@21 {
		compatible = "adv,adv7182";
		reg = <0x21>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_ipu1_csi0 &pinctrl_cam_mclk>;
		clocks = <&clks IMX6QDL_CLK_CKO2>;
		clock-names = "csi_mclk";
		DOVDD-supply = <&reg_3p3v>; /* 3.3v */
		AVDD-supply = <&reg_3p3v>;  /* 1.8v */
		DVDD-supply = <&reg_3p3v>;  /* 1.8v */
		PVDD-supply = <&reg_3p3v>;  /* 1.8v */
		csi_id = <1>;
		mclk = <24000000>;
		mclk_source = <0>;
		cvbs = <1>;
		status = "okay";
	};

Here is the full patch.

But it’s not loaded, dmesg | grep adv shows nothing.
if i try to use gstreamer i’ve got error

root@colibri-imx6:~# gst-launch-1.0 imxv4l2videosrc device=/dev/video0 ! imxipuvideosink use-vsync=true
[INFO]  Product Info: i.MX6Q/D/S
display(/dev/fb0) resolution is (1920x720).
[   71.844019] ERROR: v4l2 capture: slave not found! V4L2_CID_HUE
Can't get caps from capture device, use the default setting.
Perhaps haven't capture device.
[   71.897510] ERROR: v4l2 capture: slave not found! V4L2_CID_HUE
Setting pipeline to PAUSED ...
[   73.010791] ERROR: v4l2 capture: slave not found! V4L2_CID_HUE
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstImxV4l2VideoSrc:imxv4l2videosrc0: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
Additional debug info:
../git/libs/gst/base/gstbasesrc.c(3468): gst_base_src_start (): /GstPipeline:pipeline0/GstImxV4l2VideoSrc:imxv4l2videosrc0:
Failed to start
Setting pipeline to NULL ...
Freeing pipeline ...

Here is the full dmesg

Could you provide me some ideas how to fix it?

Best regards, Dmitry

Have you added CONFIG_VIDEO_ADV7180 to your kernel config? It’s not included by default.

Hi @alex.tx, i’ve added CONFIG_VIDEO_ADV7180, but nothing changed.
Here is the full kernel conf

P.S. If i run zcat /proc/config.gz | grep “CONFIG_VIDEO_ADV7180” it returns nothing

Have you recompiled your kernel and replace an old one on a module? If so - could you provide details?

Hi @alex.tx, i’ve updated to last commit of toradex-manifest. I use tdxref/default.
I create a defconfig file and add it to SRC_URI. I’ve set CONFIG_VIDEO_ADV7180 to Y and after configure stage i can see it in build/.config file. But it’s was skipped at compiling stage (here compile log).
and now If i run in console

zcat /proc/config.gz | grep "CONFIG_VIDEO_ADV7180"

it returns nothing.
I also have tried to set CONFIG_MXC_TVIN_ADV7180 and CONFIG_VIDEO_MXC_CAPTURE to Y, but nothing changed

If you wish to build a custom version of OS image based on Toradex reference image you should create a custom layer. Please see details here.

However if changes related to kernel or Device Tree only - during initial development/debugging it’s simpler to build just a kernel as descried here. And then manually replace a ZImage on /boot partition of your device.

Hi @alex.tx, I found the problem why CONFIG_VIDEO_ADV7180 was missed. I had to also enable CONFIG_VIDEO_V4L2_SUBDEV_API. Now after compiling i can see adv7180 driver loaded.

root@colibri-imx6:~# dmesg | grep adv
[    0.516489] adv7180 1-0021: chip found @ 0x21 (21a8000.i2c)
root@colibri-imx6:~# dmesg | grep i2c
[    0.090360] stmpe-i2c 0-0041: stmpe811 detected, chip id: 0x811
[    0.180500] i2c i2c-0: IMX I2C adapter registered
[    0.181325] i2c i2c-1: IMX I2C adapter registered
[    0.515538] i2c /dev entries driver
[    0.516489] adv7180 1-0021: chip found @ 0x21 (21a8000.i2c)

But i don’t have /dev/video0 device

root@colibri-imx6:~# dmesg | grep video
[    0.181553] videodev: Linux video capture interface: v2.00
[    0.525030] mxc_v4l2_output v4l2_out: V4L2 device registered as video16
[    0.525168] mxc_v4l2_output v4l2_out: V4L2 device registered as video17

What can be the problem?
Here is my patch for dts.

Hi @shkipper12 ,

would it be possible for you to share your full kernel configuration? So that we can have a look at it.

And since you now successfully loaded the driver a new dmesg log would also help.

Regards
Kevin

Hi @kevin.tx, thanks for reply.
Here is the kernel config file and the dmesg output

Hi @shkipper12,

I had a first look at your issue and I noticed a conflict in the pin control group.

Some pins you want to use with the controller, are being defined in one of the device tree include files as GPIOs. Could you try to apply the patch and let me know about the effect?

Regards
Kevin

Hi @kevin.tx, sorry for late responce
I have tried your patch. but result is the same. I’ve also tried to remove pinctrl_csi_gpio2 from iomuxc, but nothing changed either. Here is the new dmesg.txt (14.4 KB)
log

hi @shkipper

Sorry for the delayed response. It looks like as the I2C communication is working but not the data interface. Did you have a look here?

Could you share a connection diagram between the SoM and camera chip?

Thanks and best regards,
Jaski

Hi @jaski.tx, thanks for reply.
Here is our connection between SoM and ADV7182


I’ve found that EIM_DATA26 and SD2_DATA0 are not in pinctrl_ipu1_csi0, so added them to dts

pinctrl_ipu1_csi0: ipu1csi0grp { /* Parallel Camera */
		fsl,pins = <
			MX6QDL_PAD_EIM_A17__IPU1_CSI1_DATA12	0xb0b1
			MX6QDL_PAD_EIM_A18__IPU1_CSI1_DATA13	0xb0b1
			MX6QDL_PAD_EIM_A19__IPU1_CSI1_DATA14	0xb0b1
			MX6QDL_PAD_EIM_A20__IPU1_CSI1_DATA15	0xb0b1
			MX6QDL_PAD_EIM_A21__IPU1_CSI1_DATA16	0xb0b1
			MX6QDL_PAD_EIM_A22__IPU1_CSI1_DATA17	0xb0b1
			MX6QDL_PAD_EIM_A23__IPU1_CSI1_DATA18	0xb0b1
			MX6QDL_PAD_EIM_A24__IPU1_CSI1_DATA19	0xb0b1
			MX6QDL_PAD_EIM_D17__IPU1_CSI1_PIXCLK	0xb0b1
			MX6QDL_PAD_SD2_DAT0__GPIO1_IO15         0xb0b1
			MX6QDL_PAD_EIM_D26__GPIO3_IO26		0xb0b1
			MX6QDL_PAD_EIM_EB3__IPU1_CSI1_HSYNC	0xb0b1
			MX6QDL_PAD_EIM_D29__IPU1_CSI1_VSYNC	0xb0b1
			/* Disable PWM pins on camera interface */
			MX6QDL_PAD_SD4_DAT1__GPIO2_IO09		0x40
			MX6QDL_PAD_GPIO_1__GPIO1_IO01		0x40
		>;
	};

But it doesn’t solve the problem.

Greetings @shkipper!

I think your issue here is that you’re using the “regular” ADV7180 driver defined by CONFIG_VIDEO_ADV7180 (Analog Devices ADV7180 decoder found in drivers/media/i2c/Kconfig)

This driver would only provide you I2C communication with the peripheral. For this to work with the iMX6 - and this seems to be true for other iMX processors, you need to use a driver that interfaces with the mxc platform which is specific to the iMXs. These would be the drivers in question:

./drivers/media/platform/mxc/capture/adv7180.c
./drivers/media/platform/mxc/capture/adv7280.c

Now it would be a matter of testing your ADV7182 with these drivers and check if it works.

Hi @gustavo.tx, thanks for suggestion.
I have set next in kernel defconfig

CONFIG_VIDEO_MXC_CAPTURE=y
CONFIG_MXC_TVIN_ADV7180=y (found under ./drivers/media/platform/mxc/capture/)
# CONFIG_VIDEO_ADV7180 is not set

I’ve recompile kernel and no adv7180 chip was found by i2c, only V4L2 error

root@imx6dl-mzkt-pv12:~# dmesg | grep adv
root@imx6dl-mzkt-pv12:~# dmesg | grep v4l2
[    1.337683] mxc_v4l2_output v4l2_out: V4L2 device registered as video16
[    1.347827] mxc_v4l2_output v4l2_out: V4L2 device registered as video17
[    2.845607] ERROR: v4l2 capture: slave not found! V4L2_CID_HUE
root@imx6dl-mzkt-pv12:~# dmesg | grep i2c
[    0.090371] stmpe-i2c 0-0041: stmpe811 detected, chip id: 0x811
[    0.180512] i2c i2c-0: IMX I2C adapter registered
[    0.181364] i2c i2c-1: IMX I2C adapter registered
[    1.329535] i2c /dev entries driver

Then i’ve tried to set (compatible = “adv,adv7180”) instead of (compatible = “adv,adv7182”) in the DTS node and have got errors (10.3 KB)

After i’ve tried same with CONFIG_MXC_TVIN_ADV7280=y
Chip was found cy i2c, but not probed

root@imx6dl-mzkt-pv12:~# dmesg | grep adv
[    1.337832] adv7280 1-0021: chip found @ 0x42 (21a8000.i2c)
[    1.346784] adv7280 1-0021: no sensor pwdn pin available
[    1.383391] adv7280 1-0021: adv7280_probe:Analog Device adv7280 not detected -6!

here is full dmesg log (23.7 KB)

looks like this drivers doesn’t support adv7182 chip ?

@shkipper,

That seems to be the case. The driver doesn’t seem to support the ADV7182. I’ve seen something similar with a customer that wanted to use ADV7280A-M and we figured that the chip ID was kind of hardcoded on the ADV7280 driver.
The way out of this is to either create a new device driver or modify the existing one by consulting the ADV7182 datasheet.