Safe video switch using ADV7180 and i.MX6Q Automotive Board

Document created by rogeriopimentel Employee on Nov 17, 2016Last modified by Adrian Puga Candelario on Mar 31, 2020
Version 13Show Document
  • View in full screen mode

i.MX6Q Automotive board has one ADV7180 analog video decoder with 2 video inputs. By default, only input 1 is used (connector J42).


Fast Video Switch using ADV7180 and i.MX6Q Automotive Board


To connect 2 analog video sources and switch the display between them, the following changes are needed:


1 - Create a new IOCTL on V4L2_capture and ADV7180 device drivers to receive the information from user space application on what input will be selected.

2 - In this new IOCTL, use the "Fast Switch Script" for ADV7180 described at Analog Devices site: ADV7180 Fast Switch Script | EngineerZone 

3 - Create a user space application to call the IOCTL mentioned on step 1.


See attached:


1 - - Patch to be applied on NXP kernel 4.1.15_1.0.0_ga

2 - - Source code example of user space application. It changes the video input in each 2 seconds. (See it working on attached video)

3 - - User space application executable file 

4 - - Makefile of user space application to be used as example

5 - adv7180_switch.mp4 - Video showing the application


In the application, VIDIOC_S_CHIP_INPUT IOCTL is called to change the input:


int input = 0;

if (ioctl(fd_capture_v4l, VIDIOC_S_CHIP_INPUT, &input) < 0) {
printf("VIDIOC_S_CHIP_INPUT failed\n");
return TFAIL;


This IOCTL calls the ADV7180 Fast Switch Script, added on ADV7180 driver (see attached patch).


1 person found this helpful