ADV7282A Linux driver for IMX6: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 28: | Line 28: | ||
Execute the command: | Execute the command: | ||
< | <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 | ||
</ | </syntaxhighlight> | ||
The output returned is the following: | The output returned is the following: | ||
< | <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 | ||
</ | </syntaxhighlight> | ||
===Verify if the driver is loaded=== | ===Verify if the driver is loaded=== | ||
Execute the command: | Execute the command: | ||
< | <syntaxhighlight lang=bash> | ||
lsmod | lsmod | ||
</ | </syntaxhighlight> | ||
The output returned is the following: | The output returned is the following: | ||
< | <syntaxhighlight lang=bash> | ||
Module Size Used by | Module Size Used by | ||
usb_f_hid 8735 2 | usb_f_hid 8735 2 | ||
Line 69: | 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 | ||
</ | </syntaxhighlight> | ||
==Video Capture== | ==Video Capture== | ||
Line 76: | Line 76: | ||
Execute the command: | Execute the command: | ||
< | <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 | ||
</ | </syntaxhighlight> | ||
The output returned is the following: | The output returned is the following: | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 93: | 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 | ||
</ | </syntaxhighlight> | ||
Take a picture: | Take a picture: | ||
< | <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 | ||
</ | </syntaxhighlight> | ||
The output returned is the following: | The output returned is the following: | ||
< | <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 113: | Line 113: | ||
Setting pipeline to NULL ... | Setting pipeline to NULL ... | ||
Freeing pipeline ... | Freeing pipeline ... | ||
</ | </syntaxhighlight> | ||
=== Driver input selection control=== | === Driver input selection control=== | ||
Line 119: | Line 119: | ||
This is the pipeline used to capture from the Video 1 | This is the pipeline used to capture from the Video 1 | ||
< | <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 | ||
</ | </syntaxhighlight> | ||
This is the pipeline used to capture from the Video 2 | This is the pipeline used to capture from the Video 2 | ||
< | <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 | ||
</ | </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: | ||
< | <syntaxhighlight lang=bash> | ||
v4l2-ctl --set-input 1 | v4l2-ctl --set-input 1 | ||
v4l2-ctl --set-input 2 | v4l2-ctl --set-input 2 | ||
</ | </syntaxhighlight> | ||
This is the expected output: | This is the expected output: | ||
< | <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) | ||
</ | </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. | 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. | ||
< | |||
<syntaxhighlight lang="c"> | |||
#include <fcntl.h> | #include <fcntl.h> | ||
#include <sys/ioctl.h> | #include <sys/ioctl.h> | ||
Line 177: | Line 178: | ||
return 0; | return 0; | ||
} | } | ||
</ | </syntaxhighlight> | ||
{{ContactUs}} | {{ContactUs}} | ||
[[Category: iMX6]][[Category: AnalogDevices]] | [[Category: iMX6]][[Category: AnalogDevices]] |
Revision as of 15:36, 7 May 2024
|
|
|
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 | |||||
Contact Us
|