ADV7282A Linux driver for IMX6: Difference between revisions

From RidgeRun Developer Wiki
mNo edit summary
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<seo title="ADV7282A Linux driver for IMX6 | Analog Devices ADV7282A | RidgeRun" titlemode="replace" keywords="GStreamer, Linux SDK, Linux BSP,  Embedded Linux, Device Drivers, Nvidia, Xilinx, TI, NXP, Freescale, Embedded Linux driver development, Linux Software development, Embedded Linux SDK, Embedded Linux Application development, GStreamer Multimedia Framework, ADV7282A, Analog Devices ADV7282A,ADV7282A Linux driver, ADV7282A Linux driver for IMX6"  description="Read about the ADV7282A Linux driver for IMX6 and how to build and test the driver from RidgeRun."></seo>
<seo title="ADV7282A Linux driver for IMX6 | Analog Devices ADV7282A | RidgeRun" titlemode="replace" keywords="GStreamer, Linux SDK, Linux BSP,  Embedded Linux, Device Drivers, Nvidia, Xilinx, TI, NXP, Freescale, Embedded Linux driver development, Linux Software development, Embedded Linux SDK, Embedded Linux Application development, GStreamer Multimedia Framework, ADV7282A, Analog Devices ADV7282A, ADV7282A Linux driver, ADV7282A Linux driver for IMX6"  description="Read about the ADV7282A Linux driver for IMX6 and how to build and test the driver from RidgeRun."></seo>
 


<table>
<table>
Line 5: Line 6:
<td><div class="clear; float:right">__TOC__</div></td>
<td><div class="clear; float:right">__TOC__</div></td>
<td>
<td>
<html>
{{Shopping cart mpo for V4L2 camera drivers}}
<div id='product-component-1594671854188'></div>
<script type="text/javascript">
/*<![CDATA[*/
(function () {
  var scriptURL = 'https://sdks.shopifycdn.com/buy-button/latest/buy-button-storefront.min.js';
  if (window.ShopifyBuy) {
    if (window.ShopifyBuy.UI) {
      ShopifyBuyInit();
    } else {
      loadScript();
    }
  } else {
    loadScript();
  }
  function loadScript() {
    var script = document.createElement('script');
    script.async = true;
    script.src = scriptURL;
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(script);
    script.onload = ShopifyBuyInit;
  }
  function ShopifyBuyInit() {
    var client = ShopifyBuy.buildClient({
      domain: 'ridgerun1.myshopify.com',
      storefrontAccessToken: 'b0ca98633a82de5d2f63cd51f5af30ac',
    });
    ShopifyBuy.UI.onReady(client).then(function (ui) {
      ui.createComponent('product', {
        id: '1684420821063',
        node: document.getElementById('product-component-1594671854188'),
        moneyFormat: '%24%7B%7Bamount%7D%7D',
        options: {
  "product": {
    "styles": {
      "product": {
        "@media (min-width: 601px)": {
          "max-width": "calc(25% - 20px)",
          "margin-left": "20px",
          "margin-bottom": "50px"
        }
      },
      "button": {
        "font-family": "Open Sans, sans-serif",
        "font-weight": "bold",
        "font-size": "18px",
        "padding-top": "17px",
        "padding-bottom": "17px",
        ":hover": {
          "background-color": "#0187a7"
        },
        "background-color": "#0196ba",
        ":focus": {
          "background-color": "#0187a7"
        },
        "border-radius": "5px",
        "padding-left": "50px",
        "padding-right": "50px"
      },
      "quantityInput": {
        "font-size": "18px",
        "padding-top": "17px",
        "padding-bottom": "17px"
      }
    },
    "text": {
      "button": "Add to cart"
    },
    "googleFonts": [
      "Open Sans"
    ]
  },
  "productSet": {
    "styles": {
      "products": {
        "@media (min-width: 601px)": {
          "margin-left": "-20px"
        }
      }
    }
  },
  "modalProduct": {
    "contents": {
      "img": false,
      "imgWithCarousel": true,
      "button": false,
      "buttonWithQuantity": true
    },
    "styles": {
      "product": {
        "@media (min-width: 601px)": {
          "max-width": "100%",
          "margin-left": "0px",
          "margin-bottom": "0px"
        }
      },
      "button": {
        "font-family": "Open Sans, sans-serif",
        "font-weight": "bold",
        "font-size": "18px",
        "padding-top": "17px",
        "padding-bottom": "17px",
        ":hover": {
          "background-color": "#0187a7"
        },
        "background-color": "#0196ba",
        ":focus": {
          "background-color": "#0187a7"
        },
        "border-radius": "5px",
        "padding-left": "50px",
        "padding-right": "50px"
      },
      "quantityInput": {
        "font-size": "18px",
        "padding-top": "17px",
        "padding-bottom": "17px"
      }
    },
    "googleFonts": [
      "Open Sans"
    ]
  },
  "cart": {
    "styles": {
      "button": {
        "font-family": "Open Sans, sans-serif",
        "font-weight": "bold",
        "font-size": "18px",
        "padding-top": "17px",
        "padding-bottom": "17px",
        ":hover": {
          "background-color": "#0187a7"
        },
        "background-color": "#0196ba",
        ":focus": {
          "background-color": "#0187a7"
        },
        "border-radius": "5px"
      },
      "title": {
        "color": "#4c4c4c"
      },
      "header": {
        "color": "#4c4c4c"
      },
      "lineItems": {
        "color": "#4c4c4c"
      },
      "subtotalText": {
        "color": "#4c4c4c"
      },
      "subtotal": {
        "color": "#4c4c4c"
      },
      "notice": {
        "color": "#4c4c4c"
      },
      "currency": {
        "color": "#4c4c4c"
      },
      "close": {
        "color": "#4c4c4c",
        ":hover": {
          "color": "#4c4c4c"
        }
      },
      "empty": {
        "color": "#4c4c4c"
      },
      "noteDescription": {
        "color": "#4c4c4c"
      },
      "discountText": {
        "color": "#4c4c4c"
      },
      "discountIcon": {
        "fill": "#4c4c4c"
      },
      "discountAmount": {
        "color": "#4c4c4c"
      }
    },
    "googleFonts": [
      "Open Sans"
    ]
  },
  "toggle": {
    "styles": {
      "toggle": {
        "font-family": "Open Sans, sans-serif",
        "font-weight": "bold",
        "background-color": "#0196ba",
        ":hover": {
          "background-color": "#0187a7"
        },
        ":focus": {
          "background-color": "#0187a7"
        }
      },
      "count": {
        "font-size": "18px"
      }
    },
    "googleFonts": [
      "Open Sans"
    ]
  },
  "lineItem": {
    "styles": {
      "variantTitle": {
        "color": "#4c4c4c"
      },
      "title": {
        "color": "#4c4c4c"
      },
      "price": {
        "color": "#4c4c4c"
      },
      "fullPrice": {
        "color": "#4c4c4c"
      },
      "discount": {
        "color": "#4c4c4c"
      },
      "discountIcon": {
        "fill": "#4c4c4c"
      },
      "quantity": {
        "color": "#4c4c4c"
      },
      "quantityIncrement": {
        "color": "#4c4c4c",
        "border-color": "#4c4c4c"
      },
      "quantityDecrement": {
        "color": "#4c4c4c",
        "border-color": "#4c4c4c"
      },
      "quantityInput": {
        "color": "#4c4c4c",
        "border-color": "#4c4c4c"
      }
    }
  }
},
      });
    });
  }
})();
/*]]>*/
</script>
</html>
<td>
<td>
{{GStreamer debug}}
{{GStreamer debug}}
Line 266: Line 15:
</tr>
</tr>
</table>
</table>
<br>


== Description ==
== Description ==
Line 278: Line 28:


Execute the command:
Execute the command:
<source lang="bash">
<syntaxhighlight lang=bash>
ls /proc/device-tree/./soc/aips-bus@02100000/i2c@021a8000/adv7282@21
ls /proc/device-tree/./soc/aips-bus@02100000/i2c@021a8000/adv7282@21
</source>
</syntaxhighlight>


The output returned is the following:
The output returned is the following:


<source lang="bash">
<syntaxhighlight lang=bash>
AVDD-supply    DVDD-supply    clock-names    compatible    mclk          name          pinctrl-names  status
AVDD-supply    DVDD-supply    clock-names    compatible    mclk          name          pinctrl-names  status
DOVDD-supply  PVDD-supply    clocks        csi_id        mclk_source    pinctrl-0      reg
DOVDD-supply  PVDD-supply    clocks        csi_id        mclk_source    pinctrl-0      reg
</source>
</syntaxhighlight>


===Verify if the driver is loaded===
===Verify if the driver is loaded===


Execute the command:
Execute the command:
<source lang="bash">
<syntaxhighlight lang=bash>
lsmod
lsmod
</source>
</syntaxhighlight>


The output returned is the following:
The output returned is the following:


<source lang="bash">
<syntaxhighlight lang=bash>
Module                  Size  Used by
Module                  Size  Used by
usb_f_hid              8735  2
usb_f_hid              8735  2
Line 319: Line 69:
configfs              23790  5 usb_f_acm,usb_f_mass_storage,libcomposite,usb_f_hid
configfs              23790  5 usb_f_acm,usb_f_mass_storage,libcomposite,usb_f_hid
galcore              366496  0
galcore              366496  0
</source>
</syntaxhighlight>


==Video Capture==
==Video Capture==
Line 326: Line 76:


Execute the command:
Execute the command:
<source lang="bash">
<syntaxhighlight lang=bash>
GST_DEBUG=3 gst-launch-1.0 imxv4l2videosrc ! imxipuvideotransform ! queue ! imxg2dvideosink async=false sync=false
GST_DEBUG=3 gst-launch-1.0 imxv4l2videosrc ! imxipuvideotransform ! queue ! imxg2dvideosink async=false sync=false
</source>
</syntaxhighlight>
The output returned is the following:
The output returned is the following:
<source lang="bash">
<source lang="bash">
Line 343: Line 93:
Freeing pipeline ...
Freeing pipeline ...
[16330.053914] imx-ipuv3 2400000.ipu: IPU Warning - IPU_INT_STAT_5 = 0x00000001
[16330.053914] imx-ipuv3 2400000.ipu: IPU Warning - IPU_INT_STAT_5 = 0x00000001
</source>
</syntaxhighlight>


Take a picture:
Take a picture:
<source lang="bash">
<syntaxhighlight lang=bash>
gst-launch-1.0 imxv4l2videosrc num-buffers=1 ! jpegenc ! filesink location=test.jpg
gst-launch-1.0 imxv4l2videosrc num-buffers=1 ! jpegenc ! filesink location=test.jpg
</source>
</syntaxhighlight>


The output returned is the following:
The output returned is the following:
<source lang="bash">
<syntaxhighlight lang=bash>
Setting pipeline to PAUSED ...
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is live and does not need PREROLL ...
Line 363: Line 113:
Setting pipeline to NULL ...
Setting pipeline to NULL ...
Freeing pipeline ...
Freeing pipeline ...
</source>
</syntaxhighlight>


=== Driver input selection control===
=== Driver input selection control===
Line 369: Line 119:


This is the pipeline used to capture from the Video 1
This is the pipeline used to capture from the Video 1
<source lang="bash">
<syntaxhighlight lang=bash>
gst-launch-1.0 imxv4l2videosrc input=1 ! imxipuvideotransform ! queue ! imxg2dvideosink async=false sync=false
gst-launch-1.0 imxv4l2videosrc input=1 ! imxipuvideotransform ! queue ! imxg2dvideosink async=false sync=false
</source>
</syntaxhighlight>
This is the pipeline used to capture from the Video 2
This is the pipeline used to capture from the Video 2
<source lang="bash">
<syntaxhighlight lang=bash>
gst-launch-1.0 imxv4l2videosrc input=2 ! imxipuvideotransform ! queue ! imxg2dvideosink async=false sync=false
gst-launch-1.0 imxv4l2videosrc input=2 ! imxipuvideotransform ! queue ! imxg2dvideosink async=false sync=false
</source>
</syntaxhighlight>
Also you can use v4l2-ctl to select the video input, these are the commands:
Also you can use v4l2-ctl to select the video input, these are the commands:
<source lang="bash">
<syntaxhighlight lang=bash>
v4l2-ctl --set-input 1
v4l2-ctl --set-input 1
v4l2-ctl --set-input 2
v4l2-ctl --set-input 2
</source>
</syntaxhighlight>
This is the expected output:
This is the expected output:
<source lang="bash">
<syntaxhighlight lang=bash>
[ 1795.624535] adv7282 3-0021: Input Ain1
[ 1795.624535] adv7282 3-0021: Input Ain1
Video input set to 1 (CSI MEM: Camera, no power)
Video input set to 1 (CSI MEM: Camera, no power)
</source>
</syntaxhighlight>
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.
<br>
'''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.
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.
<source lang="c">
 
<syntaxhighlight lang="c">
#include <fcntl.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
Line 427: Line 179:
     return 0;
     return 0;
}
}
</source>
</syntaxhighlight>


{{ContactUs}}
{{ContactUs}}


[[Category: iMX6]]
[[Category: iMX6]][[Category: AnalogDevices]]

Latest revision as of 15:37, 7 May 2024


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


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: <source lang="bash"> 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 </syntaxhighlight>

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
RidgeRun.ai: Artificial Intelligence | Generative AI | Machine Learning

Contact Us

Visit our Main Website for the RidgeRun Products and Online Store. RidgeRun Engineering information is available at RidgeRun Engineering Services, 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.