ADV7282A Linux driver for IMX6

From RidgeRun Developer Connection
Jump to: navigation, search

Error something wrong.jpg Problems running the pipelines shown on this page?
Please see our GStreamer Debugging guide for help.

RR Contact Us.png

Description

The ADV7282A is a versatile one-chip, multiformat video decoder that automatically detects standard analog baseband video signals and converts them into YCrCb 4:2:2 component video data streams.

The front end includes a four-channel input mux that enables multiple composite video signals to be applied to the ADV7282. The video standards supported by the video processor include PAL B/D/I/G/H, PAL60, PAL M, PAL N, PAL Nc, NTSC M/J, NTSC4.43, and SECAM B/D/G/K/L. The ADV7282 can automatically detect the video standard and process it accordingly.

Testing driver

Verify device tree entry

Execute the command:

ls /proc/device-tree/./soc/aips-bus@02100000/i2c@021a8000/adv7282@21

The output returned is the following:

AVDD-supply    DVDD-supply    clock-names    compatible     mclk           name           pinctrl-names  status
DOVDD-supply   PVDD-supply    clocks         csi_id         mclk_source    pinctrl-0      reg

Verify if the driver is loaded

Execute the command:

lsmod

The output returned is the following:

Module                  Size  Used by
usb_f_hid               8735  2
usb_f_mass_storage     26774  2
usb_f_acm               4085  2
u_serial                8435  1 usb_f_acm
bluetooth             312564  2
compat                 76710  1 bluetooth
ov5640_camera_mipi_int    21592  0
mxc_v4l2_capture       25620  2 ov5640_camera_mipi_int
ipu_bg_overlay_sdc      5297  1 mxc_v4l2_capture
adv7282_tvin            9118  0
ipu_still               1763  1 mxc_v4l2_capture
ipu_prp_enc             5763  1 mxc_v4l2_capture
ipu_csi_enc             3417  1 mxc_v4l2_capture
ipu_fg_overlay_sdc      5936  1 mxc_v4l2_capture
max9526_tvin            5870  0
v4l2_int_device         1883  4 adv7282_tvin,ov5640_camera_mipi_int,max9526_tvin,mxc_v4l2_capture
libcomposite           34265  12 usb_f_acm,usb_f_mass_storage,usb_f_hid
configfs               23790  5 usb_f_acm,usb_f_mass_storage,libcomposite,usb_f_hid
galcore               366496  0

Video Capture

Normal capture

Execute the command:

GST_DEBUG=3 gst-launch-1.0 imxv4l2videosrc ! imxipuvideotransform ! queue ! imxg2dvideosink async=false sync=false

The output returned is the following:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:05.677681000
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
[16330.053914] imx-ipuv3 2400000.ipu: IPU Warning - IPU_INT_STAT_5 = 0x00000001

Take a picture:

gst-launch-1.0 imxv4l2videosrc num-buffers=1 ! jpegenc ! filesink location=test.jpg

The output returned is the following:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[ 7367.541600] imx-ipuv3 2400000.ipu: IPU Warning - IPU_INT_STAT_5 = 0x00000001
Got EOS from element "pipeline0".
Execution ended after 0:00:00.073631000
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

Driver input selection control

This is the pipeline used to capture from the Video 1

gst-launch-1.0 imxv4l2videosrc input=1 ! imxipuvideotransform ! queue ! imxg2dvideosink async=false sync=false

This is the pipeline used to capture from the Video 2

gst-launch-1.0 imxv4l2videosrc input=2 ! imxipuvideotransform ! queue ! imxg2dvideosink async=false sync=false

Also you can use v4l2-ctl to select the video input, these are the commands:

v4l2-ctl --set-input 1
v4l2-ctl --set-input 2

This is the expected output:

[ 1795.624535] adv7282 3-0021: Input Ain1
Video input set to 1 (CSI MEM: Camera, no power)

Note: If you use the previous command and after that you run the Gstreamer pipeline, the video input selected is will be overwritten by the imxv4l2videosrc element.

The driver is using VIDIOC_S_INPUT to select the video input. I have created the code below to show the steps required to perform the channel switching.

#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <linux/videodev2.h>
#include <unistd.h>

int main(int argc, char **argv)
{
    int fd;
    int input;
    const char *device = "/dev/video0";
    int ret;
    /* Open video device */
    fd = open(device, O_RDWR);
    if (fd < 0) {
        fprintf(stderr, "Failed to open %s: %s\n", device,
            strerror(errno));
        exit(1);
    }
    /* Select Input */
    input = 1; /* This number can be a 1 or 2 */
    ret = ioctl(fd, VIDIOC_S_INPUT, &input);
    if (ret == 0) {
        printf("Video input set to %d", input);
    }
    /* Close video device */
    close(fd);
    if (fd < 0) {
        fprintf(stderr, "Failed to close %s: %s\n", device,
            strerror(errno));
        exit(1);
    }
    return 0;
}


RidgeRun Resources

Quick Start Client Engagement Process RidgeRun Blog Homepage
Technical and Sales Support RidgeRun Online Store RidgeRun Videos Contact Us

OOjs UI icon message-progressive.svg Contact Us

Visit our Main Website for the RidgeRun Products and Online Store. RidgeRun Engineering informations are available in RidgeRun Professional Services, RidgeRun Subscription Model and Client Engagement Process wiki pages. Please email to support@ridgerun.com for technical questions and contactus@ridgerun.com for other queries. Contact details for sponsoring the RidgeRun GStreamer projects are available in Sponsor Projects page. Ridgerun-logo.svg
RR Contact Us.png