Getting Started Guide for DM8168 EVM

From RidgeRun Developer Connection

(Difference between revisions)
Jump to:navigation, search
(Configure RidgeRun SDK to load V4L2 Firmware)
(35 intermediate revisions not shown)
Line 1: Line 1:
-
<span style="color:red ">'''Page Under Construction'''</span> <br>
 
= Introduction =
= Introduction =
-
On this page you are going to find all the necessary information to start from scratch to use the RidgeRun SDK on your DM8168 evaluation module (EVM). In the following sections we assume that you have already downloaded the [http://software-dl.ti.com/dsps/dsps_public_sw/ezsdk/5_02_02_60/index_FDS.html EZSDK] version 5.02.02.60 and that you have installed the toolchain [https://www.ridgerun.com/developer/wiki/index.php/Code_Sourcery_ARM_toolchain_2009q1-203  toolchain 2009q1-203] from [http://www.codesourcery.com/sgpp/lite/arm/portal/package4573/public/arm-none-linux-gnueabi/arm-2009q1-203-arm-none-linux-gnueabi.bin codesourcery] as well as your DM8168 SDK following the steps on [[RidgeRun 2011Q2 SDK User Guide#Installation | The RidgeRun installation guide]].
+
On this page you are going to find all the necessary information to start from scratch to use the RidgeRun SDK on your DM8168 evaluation module (EVM). In the following sections we assume that you have already downloaded the [http://software-dl.ti.com/dsps/dsps_public_sw/ezsdk/5_05_01_04/index_FDS.html EZSDK] version 5.05.04.01 and that you have installed the [https://www.ridgerun.com/developer/wiki/index.php/Code_Sourcery_ARM_toolchain_2009q1-203  toolchain 2009q1-203] from [http://www.codesourcery.com/sgpp/lite/arm/portal/package4573/public/arm-none-linux-gnueabi/arm-2009q1-203-arm-none-linux-gnueabi.bin codesourcery] as well as your DM8168 SDK following the steps on [[RidgeRun 2011Q2 SDK User Guide#Installation | The RidgeRun installation guide]].
-
The first section of this guide shows you how to install the EZSDK for DM8168 on your computer and how to configure a TFTP and NFS server. Subsequently, the second section contains instructions about how to configure the RidgeRun's SDK to create a SD with all software components (uboot, kernel and filesystem) needed to boot to Linux Shell in your EVM. Using this SD in the third and fourth section of this guide, you will be able to install on NAND images created by the SDK for kernel, uboot as well as your filesystem (JFFS2, UBI, NFS are available). Using the SD created on the second section to flash the SDK in your EVM is just an option because you could try to use the installer of the RidgeRun's SDK with the uboot version that is running by default in a new EVM, however, we cannot guaranty that it will work as we expect, hence, we recommend to use the SD instead. Finally, how to run opemax demos to encode and decode 1080p/h264 videos and some pipelines using gstreamer + openMax are shown.
+
The first section of this guide shows you how to install the EZSDK for DM8168 on your computer and how to configure a TFTP and NFS server. Subsequently, the second section contains instructions about how to configure the RidgeRun's SDK to create a SD card with all software components (uboot, kernel and filesystem) needed to boot to Linux Shell in your EVM. Using this SD card in the third and fourth section of this guide, you will be able to install on NAND images created by the SDK for kernel, uboot as well as your filesystem (JFFS2, UBI, NFS are available). Using the SD card created on the second section to flash the SDK in your EVM is just an option because you could try to use the installer of the RidgeRun's SDK with the uboot version that is running by default in a new EVM, however, we cannot guaranty that it will work as we expect, hence, we recommend to use the SD card instead. Finally, how to run opemax demos to encode and decode 1080p/h264 videos and some pipelines using gstreamer + openMax are shown.
On the rest of this document, we refer as $(DEVDIR) to the path where the RidgeRun SDK for DM8168 is installed
On the rest of this document, we refer as $(DEVDIR) to the path where the RidgeRun SDK for DM8168 is installed
Line 11: Line 10:
1. Set the ezsdk binary as executable and set correct permissions  
1. Set the ezsdk binary as executable and set correct permissions  
<pre style="background:#d6e4f1">
<pre style="background:#d6e4f1">
-
  sudo chmod 777 ezsdk_dm816x-evm_5_02_02_60_setuplinux
+
  sudo chmod 777 ezsdk_dm816x-evm_5_05_01_04_setuplinux
</pre>
</pre>
-
2. Install EZSDK. For ubuntu versions different than Ubuntu 10.04 LTS 32-bit you will need to add the --force-host argument to install it:
+
2. Install EZSDK. For ubuntu versions different than Ubuntu 10.04 LTS 32-bit you will need to add the --forcehost argument to install it:
<pre style="background:#d6e4f1">
<pre style="background:#d6e4f1">
-
  ./ezsdk_dm816x-evm_5_02_02_60_setuplinux --force-host
+
  ./ezsdk_dm816x-evm_5_05_01_04_setuplinux --forcehost
</pre>
</pre>
'''note:''' During the EZSDK installation process you will be asked for the toolchain's path, assuming that you installed it on /opt, the path that you need to provide is /opt/codesourcery/arm-2009q1/bin/
'''note:''' During the EZSDK installation process you will be asked for the toolchain's path, assuming that you installed it on /opt, the path that you need to provide is /opt/codesourcery/arm-2009q1/bin/
Line 38: Line 37:
<div style="text-align: center; ">'''Figure 1'''. Dip switch to control boot mode (SD card)</div>
<div style="text-align: center; ">'''Figure 1'''. Dip switch to control boot mode (SD card)</div>
== Configuring SDK to deploy firmware to a SD card==
== Configuring SDK to deploy firmware to a SD card==
-
This section describes how to configure the DM8168's SDK to deploy all basic firmware components (kernel, uboot and MLO) into a bootable SD card. The RidgeRun SDK support several filesystem types (JFFS2, NFS, etc) however in this case we are going to use it on the SD as well.
+
This section describes how to configure the DM8168's SDK to deploy all basic firmware components (kernel, uboot and MLO) into a bootable SD card. The RidgeRun SDK support several filesystem types (JFFS2, NFS, etc) however in this case we are going to use it on the SD card as well.
1. Set your environment variables
1. Set your environment variables
<pre style="background:#d6e4f1">
<pre style="background:#d6e4f1">
 +
  cd $(DEVDIR)
  `make env`
  `make env`
</pre>
</pre>
Line 59: Line 59:
Using the ''Firmware deployment mode'' submenu you can set how to deploy your kernel, uboot and filesystem image into your target board. There are three options in this submenu: ''Attached board on communication port'', ''Deploy all the firmware to an SD card'' and ''Create an SD card installer for flash memory''.
Using the ''Firmware deployment mode'' submenu you can set how to deploy your kernel, uboot and filesystem image into your target board. There are three options in this submenu: ''Attached board on communication port'', ''Deploy all the firmware to an SD card'' and ''Create an SD card installer for flash memory''.
*'''Attached board on communication port''' will allow you to send images to your target board using a serial port or a TFTP server, more details about this option are explained in the next section.  
*'''Attached board on communication port''' will allow you to send images to your target board using a serial port or a TFTP server, more details about this option are explained in the next section.  
-
*'''Deploy all the firmware to an SD card''' tells to the installer that it must create the needed partitions on a SD card located in ''SD device on Linux host'' (please be sure that the option called '' Flash SD card image into loopback file instead of real SD'' is not selected) and that there it have to install the software's images generated by the SDK.  
+
*'''Deploy all the firmware to an SD card''' tells to the installer that it must create the needed partitions on a SD card located in ''SD device on Linux host'' (please be sure that the option called '' Flash SD card image into loopback file instead of real SD'' is not selected) and that it have to install there the software's images generated by the SDK.  
-
*'''Create an SD card installer for flash memory''' is going to create and SD card with all the logic and software's images needed to flash the EVM NAND from the SD card.
+
*'''Create an SD card installer for flash memory''' is going to create and SD card with all the logic and software's images needed to flash the EVM's NAND from the SD card.
-
4. Go to File System Configuration submenu and configure your filesystem as is show in Fig.3  
+
4. Go to File System Configuration submenu and configure your filesystem as is shown in Fig.3  
[[Image:FSC.png|400px|thumb|center|Figure 3. File system configuration to use it on the SD‎]]  
[[Image:FSC.png|400px|thumb|center|Figure 3. File system configuration to use it on the SD‎]]  
Line 74: Line 74:
== Installing SDK's firmware to a SD card ==
== Installing SDK's firmware to a SD card ==
-
Once you have built your SDK, you need to install it on the SD card running make install, but before to issue this command you need to unmount your SD card, otherwise the SDK won't let you install it in order to avoid to erase information in some of your hard disks. Let's suppose that the environment variable called $(SDNAME) contains your mount point name.
+
Once you have built your SDK, you need to install it on the SD card running make install, but before to issue this command you need to unmount your SD card, otherwise the SDK won't let you install it (in order to avoid to erase information in some of your hard disks). Let's suppose that the environment variable called $(SDNAME) contains your mount point's name.
<pre style="background:#d6e4f1">
<pre style="background:#d6e4f1">
  umount /media/$(SDNAME)
  umount /media/$(SDNAME)
 +
cd $(DEVDIR)
  make install
  make install
</pre>
</pre>
-
you will be asked to confirm the device that you are going to partition and format, please enter ''yes''. After this, the SDK will start to create a bootable SD card
+
you will be asked to confirm the device that you are going to partition and format, please enter ''yes'' if it is correct. After this, the SDK will start to create a bootable SD card
-
 
+
-
Now you are ready to test your SDK booting from a SD card. Two partitions were created by the SDK: ''boot partition'' which contains the kernel, uboot and MLO image and the ''rootfs partition'' with your file system. It's important to notice that the environment of uboot is located in a *.txt file in the partition called ''boot'' which allows you to modify it easily.
+
 +
Now you are ready to test your SDK booting from a SD card. Two partitions were created by the SDK: ''boot partition'' which contains the kernel, uboot and MLO image and the ''rootfs partition'' with your file system. It's important to notice that the environment of uboot is located in a *.txt file in the partition called ''boot'', which allows you to modify it easily.
= Booting from NAND =
= Booting from NAND =
Line 93: Line 93:
1. Set your environment variables
1. Set your environment variables
<pre style="background:#d6e4f1">
<pre style="background:#d6e4f1">
 +
cd $(DEVDIR)
  `make env`
  `make env`
</pre>
</pre>
Line 107: Line 108:
-
In this case, you must use the ''Attached board on communication port'' method, this will you allow to install all your firmware directly in nand by means of a serial port or by ethernet using a TFTP server. Here we are going to use a TFTP server and telnet as our communication method with the target board.  
+
In this case, you must use the ''Attached board on communication port'' method, this will allow you to install all your firmware directly in nand by means of a serial port or by ethernet using a TFTP server. Here we are going to use a TFTP server and telnet as our communication method with the target board.  
Line 126: Line 127:
1. Set your environment variables
1. Set your environment variables
<pre style="background:#d6e4f1">
<pre style="background:#d6e4f1">
 +
cd $(DEVDIR)
  `make env`
  `make env`
</pre>
</pre>
Line 145: Line 147:
1.Boot the RidgeRun SDK using the SD card created in the [https://www.ridgerun.com/developer/wiki/index.php/Getting_Started_Guide_for_DM8168#Booting_from_a_SD_card first section] of this guide and stop the uboot countdown. Close your Picocom, minicom or telnet session.
1.Boot the RidgeRun SDK using the SD card created in the [https://www.ridgerun.com/developer/wiki/index.php/Getting_Started_Guide_for_DM8168#Booting_from_a_SD_card first section] of this guide and stop the uboot countdown. Close your Picocom, minicom or telnet session.
<pre style="background:#FFFFC0">
<pre style="background:#FFFFC0">
-
U-Boot 2010.06 (Sep 27 2011 - 11:47:52)
+
U-Boot 2010.06 (Nov 20 2012 - 15:57:54)
DRAM:  2 GiB
DRAM:  2 GiB
Line 158: Line 160:
-
U-Boot 2010.06 (Sep 27 2011 - 11:48:05)
+
U-Boot 2010.06 (Nov 20 2012 - 15:57:54)
TI8168-GP rev 1.1
TI8168-GP rev 1.1
Line 213: Line 215:
</pre>
</pre>
-
Now you have installed all the SDK components in your DM8168 EVM and you should be able to boot to Linux shell and see the logo of RigeRun on the HDMI output.
+
Now you have installed all the SDK components in your DM8168 EVM and you should be able to boot to Linux shell and see the logo of RigeRun on the HDMI output. The RidgeRun SDK for DM8168 EVM loads automatically all the firmware and kernel modules needed to use the video processor subsystem.
== Setting up your EVM to boot from NAND ==
== Setting up your EVM to boot from NAND ==
-
In order to boot from a NAND you need to set it as the first boot device to try in the DM8168 boot sequence, this can be done configuring a correct BTMODE through the switch SW3 in your EVM (see Fig. 4)
+
In order to boot from a NAND you need to set it as the first boot device to try in the DM8168 boot sequence, this can be done configuring a correct BTMODE through the switch SW3 in your EVM (see Fig. 5)
[[Image:SW3DM8168NAND.JPG|400px|thumb|center|Figure 5. Dip switch to control boot mode (NAND)‎]]  
[[Image:SW3DM8168NAND.JPG|400px|thumb|center|Figure 5. Dip switch to control boot mode (NAND)‎]]  
<div style="text-align: center; ">'''Figure 5'''. Dip switch to control boot mode (NAND)</div>
<div style="text-align: center; ">'''Figure 5'''. Dip switch to control boot mode (NAND)</div>
 +
 +
== Introduction to NAND memories ==
 +
 +
If you are more interested on NAND concepts and what is supported on the DM816x please read [https://www.ridgerun.com/developer/wiki/index.php/Introduction_to_Nand_Memories Introduction to NAND memories]
= OpenMax Demos =
= OpenMax Demos =
-
To run the openMax demos that are located by default in your filesystem in a directory called ''omx'' you need to run first the following commands in your EVM
+
To run the openMax's demos that are located by default in your filesystem in a directory called ''omx'' you need to run first the following commands in your EVM
=== Video initialization ===
=== Video initialization ===
<pre style="background:#FFFFC0">
<pre style="background:#FFFFC0">
Line 231: Line 237:
</pre>
</pre>
-
'''note'''run the decode display/encode demo with a 1080p video we recommend to use your filesystem by NFS due to the size of the input and output file.  
+
'''note''': To run the decode display/encode demo with a 1080p video we recommend to use your filesystem by NFS due to the size of the input and output file.  
==Decode display demo==
==Decode display demo==
This demo is the decode-display demo included in the EZSDK. It takes an input file encoded in H264, decodes the stream and sends the output to the HDMI output
This demo is the decode-display demo included in the EZSDK. It takes an input file encoded in H264, decodes the stream and sends the output to the HDMI output
<pre style="background:#FFFFC0">
<pre style="background:#FFFFC0">
-
./omx/decode_display_a8host_debug.xv5T -i sample.h264 -w 1920 -h 1080 -f 60 -g 0
+
./omx/decode_display_a8host_debug.xv5T -i inputFile.h264 -w 1920 -h 1080 -f 60 -g 0
 +
</pre>
 +
 
 +
==Capture encode demo==
 +
This demo is the capture-encode demo included in the EZSDK. It takes an input video streaming from the component input (case 720p) of the daughter card(marked as J5J6J7) and encodes it in H264, the output is displayed through the HDMI output.
 +
<pre style="background:#FFFFC0">
 +
echo 720p-60 >/sys/devices/platform/vpss/display0/mode
 +
./omx/capture_encode_a8host_debug.xv5T -o sample.h264 -m 720p -f 60 -b 1000000 -n 1000
</pre>
</pre>
= Using Gstreamer =
= Using Gstreamer =
-
Some examples of use of GStreamer to implement basic multimedia pipelines can be found at [[DM81xx GStreamer Pipelines - SDK 2011Q2]]
+
Some examples of use of GStreamer to implement basic multimedia pipelines can be found at [[Gstreamer pipelines for DM816x and DM814x]]. Please be aware that in order to display video you need to do the [https://www.ridgerun.com/developer/wiki/index.php/Getting_Started_Guide_for_DM8168#Video_initialization Video initialization]
 +
 
 +
'''note:''' If you are not using the Ridgerun SDK and you are trying to use the TAG 00_06_00_00 provided by TI you will need to apply the following patch to make V4L2src and omxbufferalloc work.
 +
 
 +
<pre>
 +
Index: gst-openmax-dm81xx/src/omx/gstomxbufferalloc.c
 +
===================================================================
 +
--- gst-openmax-dm81xx.orig/src/omx/gstomxbufferalloc.c 2012-11-14 16:15:41.392143697 -0600
 +
+++ gst-openmax-dm81xx/src/omx/gstomxbufferalloc.c 2012-11-14 16:17:40.760145714 -0600
 +
@@ -190,6 +190,7 @@
 +
 +
  gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
 +
  gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
 +
+  filter->out_port.portptr = gst_omxportptr_new(&filter->out_port);
 +
  filter->silent = FALSE;
 +
  filter->out_port.num_buffers = 10;
 +
  filter->out_port.always_copy = FALSE;
 +
</pre>
 +
 
 +
= Dual Capture Support =
 +
 
 +
The DM816x-EVM comes with two Video Input Ports (VIP0 and VIP1) which can be used simultaneously through Video for Linux 2 (V4L2).  However the current capture driver nor the kernel board file have all the code needed to use both video ports at the same time. Here you are going to find a patch to enable both ports (which is also included in the RidgeRun Pro SDK) as well as how to configure the RidgeRun SDK to load the V4L2 firmware instead of the openMax firmware. Some useful documentation and links to understand the changes that were made are included too.
 +
 
 +
== Configure RidgeRun SDK to load V4L2 Firmware ==
 +
 
 +
In order to enable dual capture support in the DM816x-EVM, the V4L2 VPSS firmware has to be loaded.  Specifically, the VPSS media controller needs to be running dm816x_hdvpss_v4l2.xem3 instead of dm816x_hdvpss.xem3.  If you are not using the RidgeRun SDK please verify the following sha1sum
 +
 
 +
<pre>
 +
0647c92f39c9fe0e902fb27c301cd7c69481c41e  dm816x_hdvpss_v4l2.xem3
 +
326e08f10afb8393d674d89694c09fa198ee6eac  dm816x_hdvpss.xem3
 +
</pre>
 +
 
 +
1. If you are using the RidgeRun SDK please run <tt>make config</tt> to display the SDK configuration menu.  Go to the Proprietary software submenu and choose the '''Enable V4L2 capture capability'' option as is shown in Fig. 6.
 +
 
 +
<pre>
 +
cd $DEVDIR
 +
`make env`
 +
make config
 +
</pre>
 +
 
 +
[[Image:V4L2CaptureFW.png|400px|thumb|center|Figure 6. SDK configuration menu to deploy V4L2 firmware in VPSS‎]]
 +
<div style="text-align: center; ">'''Figure 6'''. SDK configuration menu to deploy V4L2 firmware in VPSS</div>
 +
 
 +
2. Enable the V4L2 capture Driver.
 +
 
 +
Go to Kernel configuration -> Device Drivers -> Multimedia support ->  Video capture adapters and select TI81XX V4L2-Capture driver
 +
 
 +
[[Image:V4L2CaptureDriver.png|400px|thumb|center|Figure 7. SDK configuration menu enable the TI V4L2 capture driver]]
 +
<div style="text-align: center; ">'''Figure 7'''. SDK configuration menu enable the TI V4L2 capture driver</div>
 +
 
 +
Then close the menu and save your changes.
 +
 
 +
3. Go to $DEVDIR, compile and install your SDK
 +
 
 +
<pre>
 +
cd $DEVDIR
 +
make
 +
make install.
 +
</pre>
 +
 
 +
4. Verify proper video port mapping on the DM816x-EVM
 +
 
 +
Your system should be ready to capture using V4L2 and you will be able to capture from both video input nodes. If the V4L2 display driver is enabled as well, the video nodes would have the following map:
 +
 
 +
<pre>
 +
/dev/video0 --> Capture VIP 0 Port A
 +
/dev/video1 --> Display 0
 +
/dev/video2 --> Display 1
 +
/dev/video3 --> Display 2
 +
/dev/video4 --> Capture VIP 0 Port B
 +
/dev/video5 --> Capture VIP 1 Port A
 +
/dev/video6 --> Capture VIP 1 Port B
 +
</pre>
 +
 
 +
/dev/video0 and /dev/video5 have been tested with the RidgeRun SDK. If you are not using the V4L2 display driver you need to use the following map:
 +
 
 +
<pre>
 +
/dev/video0 --> Capture VIP 0 Port A
 +
/dev/video1 --> Capture VIP 0 Port B
 +
/dev/video2 --> Capture VIP 1 Port A
 +
/dev/video3 --> Capture VIP 1 Port B
 +
</pre>
 +
 
 +
You can test dual capture using the saLoopBack demo application installed on <tt>/usr/share/ti/ti-psp-examples</tt> or with gstreamer.
 +
 
 +
== Dual V4L2 Capture Patch ==
 +
 
 +
Changes were required to enable the second input port in the V4L2 capture driver. These changes enable the use of the second component input port (VIP1). If you want to use the video coming from the TVP5147 additional changes might be required.
 +
 
 +
The ''add-V4L2-dual-capture-support.patch'' modifies the kernel board file to handle and configure the chips PCF8575 (Remote I2C GPIO I/O expander) labeled as U60 and U201 in the [http://support.spectrumdigital.com/boards/evm816xiodc/revc/files/evm816xiodc_Schematics_RevC.pdf EVM schematics (Rev C)] (page 14), SN74CBTLV (Bus exchange switch) labeled as U33 (page 25), 74CBTLV3253 (Dual multiplexer - SoG disabled) labeled as U66 (page 25) and THS4368 (Video amplifier and filters) labeled as U200 (page 28). Also it does the changes needed in the video capture driver (V4L2).
 +
 
 +
'''Note:''' Please be sure that you are using the patches suggested here as well: http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/p/228258/809457.aspx#809457
 +
 
 +
<pre>
 +
Date: Wed, 30 Jan 2013 08:21:00
 +
Subject: TI81xx capture: Support for dual capture on the DM8168-EVM
 +
 
 +
Description: The kernel board file needs to handle the chips located in the
 +
daughter board to pass data coming from the second video decoder to the
 +
Video Input Port 1 (VIP1). Also in the V4L2 capture driver we need to register
 +
both video decoders as subdevices and keep track of which subdevice the system
 +
will use according to the video node.
 +
 
 +
Signed-off-by: David Soto <david.soto@ridgerun.com>
 +
---
 +
Index: linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/board-ti8168evm.c
 +
===================================================================
 +
--- linux-2.6.37-psp04.04.00.01.orig/arch/arm/mach-omap2/board-ti8168evm.c 2013-02-05 11:13:57.294338082 -0600
 +
+++ linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/board-ti8168evm.c 2013-02-05 11:14:00.166338092 -0600
 +
@@ -3,6 +3,9 @@
 +
  *
 +
  * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
 +
  *
 +
+ * Modified by: David Soto (david.soto@ridgerun.com)
 +
+ *              Added support to feed video in VIP1
 +
+ *
 +
  * This program is free software; you can redistribute it and/or
 +
  * modify it under the terms of the GNU General Public License as
 +
  * published by the Free Software Foundation version 2.
 +
@@ -68,6 +71,8 @@
 +
 +
#define VPS_VC_IO_EXP_RESET_DEV_MASK        (0x0Fu)
 +
#define VPS_VC_IO_EXP_SEL_VIN0_S1_MASK      (0x04u)
 +
+#define VPS_VC_IO_EXP_SEL_VIN1_S1_MASK      (0x08u)
 +
+#define VPS_VC_IO_EXP_DISABLE_SOG_MASK      (0xC0u)
 +
#define VPS_VC_IO_EXP_THS7368_DISABLE_MASK  (0x10u)
 +
#define VPS_VC_IO_EXP_THS7368_BYPASS_MASK  (0x20u)
 +
#define VPS_VC_IO_EXP_THS7368_FILTER1_MASK  (0x40u)
 +
@@ -278,13 +283,19 @@
 +
{
 +
I2C_BOARD_INFO("pcf8575_1", 0x2e),
 +
},
 +
+ {
 +
+ I2C_BOARD_INFO("pcf8575_1", 0x23),
 +
+ },
 +
};
 +
 +
static struct i2c_client *pcf8575_1_client;
 +
static unsigned char pcf8575_1_port[2] = {0, 0};
 +
 +
static struct i2c_client *pcf8575_2_client;
 +
-static unsigned char pcf8575_2_port[2] = {0xFF, 0x2F};
 +
+static unsigned char pcf8575_2_port[2] = {0xFF, 0x1F};
 +
+
 +
+static struct i2c_client *pcf8575_3_client;
 +
+static unsigned char pcf8575_3_port[2] = {0xFF, 0x2F};
 +
 +
static struct i2c_client *ths7353_client;
 +
 +
@@ -297,10 +308,37 @@
 +
.len = 2,
 +
};
 +
msg.buf = pcf8575_2_port;
 +
- if (VPS_SEL_TVP7002_DECODER == vid_decoder_id)
 +
- pcf8575_2_port[1] &= ~VPS_VC_IO_EXP_SEL_VIN0_S1_MASK;
 +
- else
 +
- pcf8575_2_port[1] |= VPS_VC_IO_EXP_SEL_VIN0_S1_MASK;
 +
+ switch (vid_decoder_id) {
 +
+ case VPS_SEL_TVP7002_DECODER_VIP0:
 +
+ {
 +
+ pcf8575_2_port[1] &= ~VPS_VC_IO_EXP_SEL_VIN0_S1_MASK;
 +
+ pcf8575_2_port[1] |=  VPS_VC_IO_EXP_DISABLE_SOG_MASK;
 +
+ break;
 +
+ }
 +
+ case VPS_SEL_SIL9135_DECODER_VIP0:
 +
+ {
 +
+ pcf8575_2_port[1] |= VPS_VC_IO_EXP_SEL_VIN0_S1_MASK;
 +
+ break;
 +
+ }
 +
+ /* Control the second SN74CBTLV16212GGR and 74CBTLV3253
 +
+ * (Bus-exchange switch and Dual multiplexer)
 +
+ */
 +
+ case VPS_SEL_TVP7002_DECODER_VIP1:
 +
+ {
 +
+ pcf8575_2_port[1] &= ~VPS_VC_IO_EXP_SEL_VIN1_S1_MASK;
 +
+ break;
 +
+ }
 +
+ case VPS_SEL_TVP5147_DECODER_VIP1:
 +
+ {
 +
+ pcf8575_2_port[1] |= VPS_VC_IO_EXP_SEL_VIN1_S1_MASK;
 +
+ break;
 +
+ }
 +
+ default:
 +
+ printk(KERN_ERR "Error: %s:%d wrong video decoder ID\n",
 +
+ __func__, __LINE__);
 +
+ return -1;
 +
+ }
 +
+
 +
ret = (i2c_transfer(pcf8575_2_client->adapter, &msg, 1));
 +
 +
if (ret < 0)
 +
@@ -309,18 +347,47 @@
 +
return ret;
 +
}
 +
EXPORT_SYMBOL(vps_ti816x_select_video_decoder);
 +
+
 +
#define I2C_RETRY_COUNT 10u
 +
-int vps_ti816x_set_tvp7002_filter(enum fvid2_standard standard)
 +
+/**
 +
+ * vps_ti816x_set_tvp7002_filter - Configure Video Filter
 +
+ * @standard:     standard to be used
 +
+ * @vid_decoder_id: Video decoder ID: VPS_SEL_TVP7002_DECODER_VIP0
 +
+ *                                        VPS_SEL_TVP7002_DECODER_VIP1
 +
+ * Check video standard and according to it select the correct filter in the
 +
+ * THS7368 Filter and Video Amplifier chip
 +
+ */
 +
+int vps_ti816x_set_tvp7002_filter(enum fvid2_standard standard,
 +
+ int vid_decoder_id)
 +
{
 +
int filter_sel;
 +
int ret;
 +
+
 +
+ struct i2c_client *pcf8575_client;
 +
+ unsigned char *pcf8575_port;
 +
+
 +
+ /* Identify which filter needs to be configured according
 +
+ * to the video decoder ID*/
 +
+ if (VPS_SEL_TVP7002_DECODER_VIP0 == vid_decoder_id) {
 +
+ pcf8575_client = pcf8575_2_client;
 +
+ pcf8575_port = pcf8575_2_port;
 +
+ } else
 +
+ if (VPS_SEL_TVP7002_DECODER_VIP1 == vid_decoder_id) {
 +
+ pcf8575_client = pcf8575_3_client;
 +
+ pcf8575_port = pcf8575_3_port;
 +
+ } else {
 +
+ printk(KERN_ERR "Error: %s:%d wrong video decoder ID\n",
 +
+ __func__, __LINE__);
 +
+ return -1;
 +
+ }
 +
+
 +
struct i2c_msg msg = {
 +
- .addr = pcf8575_2_client->addr,
 +
+ .addr = pcf8575_client->addr,
 +
.flags = 0,
 +
.len = 2,
 +
};
 +
 +
- pcf8575_2_port[0] &= ~(VPS_VC_IO_EXP_THS7368_DISABLE_MASK
 +
+ pcf8575_port[0] &= ~(VPS_VC_IO_EXP_THS7368_DISABLE_MASK
 +
| VPS_VC_IO_EXP_THS7368_BYPASS_MASK
 +
| VPS_VC_IO_EXP_THS7368_FILTER1_MASK
 +
| VPS_VC_IO_EXP_THS7368_FILTER2_MASK);
 +
@@ -373,101 +440,19 @@
 +
filter_sel = 0x01u;  /* Filter2: 0, Filter1: 1 */
 +
break;
 +
}
 +
- pcf8575_2_port[0] |=
 +
+ pcf8575_port[0] |=
 +
(filter_sel << VPS_VC_IO_EXP_THS7368_FILTER_SHIFT);
 +
- msg.buf = pcf8575_2_port;
 +
- ret =  (i2c_transfer(pcf8575_2_client->adapter, &msg, 1));
 +
+ msg.buf = pcf8575_port;
 +
+ ret =  (i2c_transfer(pcf8575_client->adapter, &msg, 1));
 +
if (ret < 0) {
 +
printk(KERN_ERR "I2C: Transfer failed at %s %d with error code: %d\n",
 +
__func__, __LINE__, ret);
 +
return ret;
 +
}
 +
return 0;
 +
-#if 0
 +
- int status = FVID2_SOK;
 +
- u8 regAddr, regValue;
 +
- int retry, error;
 +
-
 +
- switch (standard) {
 +
- case FVID2_STD_1080P_60:
 +
- case FVID2_STD_1080P_50:
 +
- case FVID2_STD_SXGA_60:
 +
- case FVID2_STD_SXGA_75:
 +
- case FVID2_STD_SXGAP_60:
 +
- case FVID2_STD_SXGAP_75:
 +
- case FVID2_STD_UXGA_60:
 +
-     regValue = 0x9Cu;
 +
-     break;
 +
-
 +
- case FVID2_STD_1080I_60:
 +
- case FVID2_STD_1080I_50:
 +
- case FVID2_STD_1080P_24:
 +
- case FVID2_STD_1080P_30:
 +
- case FVID2_STD_720P_60:
 +
- case FVID2_STD_720P_50:
 +
- case FVID2_STD_SVGA_60:
 +
- case FVID2_STD_SVGA_72:
 +
- case FVID2_STD_SVGA_75:
 +
- case FVID2_STD_SVGA_85:
 +
- case FVID2_STD_XGA_60:
 +
- case FVID2_STD_XGA_70:
 +
- case FVID2_STD_XGA_75:
 +
- case FVID2_STD_XGA_85:
 +
- case FVID2_STD_WXGA_60:
 +
- case FVID2_STD_WXGA_75:
 +
- case FVID2_STD_WXGA_85:
 +
-     regValue = 0x94u;
 +
-     break;
 +
-
 +
- case FVID2_STD_480P:
 +
- case FVID2_STD_576P:
 +
- case FVID2_STD_VGA_60:
 +
- case FVID2_STD_VGA_72:
 +
- case FVID2_STD_VGA_75:
 +
- case FVID2_STD_VGA_85:
 +
-     regValue = 0x4Cu;
 +
-     break;
 +
-
 +
- case FVID2_STD_NTSC:
 +
- case FVID2_STD_PAL:
 +
- case FVID2_STD_480I:
 +
- case FVID2_STD_576I:
 +
- case FVID2_STD_D1:
 +
-     regValue = 0x04u;
 +
-     break;
 +
-
 +
- default:
 +
-     regValue = 0x94u;
 +
-     break;
 +
- }
 +
- for (retry = 0; retry < I2C_RETRY_COUNT; retry++) {
 +
- regAddr = 0x01u;
 +
- error = i2c_smbus_write_byte_data(ths7353_client,
 +
- regAddr, regValue);
 +
- if (error < 0) {
 +
- printk(KERN_ERR "I2C write failed at %d\n\n", __LINE__);
 +
- status = -1;
 +
- }
 +
- regAddr = 0x02u;
 +
- error = i2c_smbus_write_byte_data(ths7353_client,
 +
- regAddr, regValue);
 +
- if (error < 0) {
 +
- printk(KERN_ERR "I2C write failed at %d\n\n", __LINE__);
 +
- status = -1;
 +
- }
 +
- regAddr = 0x03u;
 +
- error = i2c_smbus_write_byte_data(ths7353_client,
 +
- regAddr, regValue);
 +
- if (error < 0) {
 +
- printk(KERN_ERR "I2C write failed at %d\n\n", __LINE__);
 +
- status = -1;
 +
- }
 +
- }
 +
-
 +
- return status;
 +
-#endif
 +
}
 +
EXPORT_SYMBOL(vps_ti816x_set_tvp7002_filter);
 +
+
 +
int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl)
 +
{
 +
struct i2c_msg msg = {
 +
@@ -558,6 +543,8 @@
 +
pcf8575_1_client = client;
 +
else if (client->addr == 0x21)
 +
pcf8575_2_client = client;
 +
+ else if (client->addr == 0x23)
 +
+ pcf8575_3_client = client;
 +
else if (client->addr == 0x2e)
 +
ths7353_client = client;
 +
else
 +
@@ -569,6 +556,7 @@
 +
{
 +
pcf8575_1_client = NULL;
 +
pcf8575_2_client = NULL;
 +
+ pcf8575_3_client = NULL;
 +
return 0;
 +
}
 +
 +
@@ -767,6 +755,46 @@
 +
TI816X_MUX(SC0_DATA, OMAP_MUX_MODE1), /* gpmc_a25 */
 +
/* for controlling high address */
 +
TI816X_MUX(GPMC_A27, OMAP_MUX_MODE1), /* gpio-20 */
 +
+
 +
+ /* Pullup/Pulldown disabled */
 +
+ #define DM8168_PULL_DIS (1 << 3)
 +
+
 +
+ /* Capture VIP 1 Port A */
 +
+ /*  VIN[1]A_CLK    */
 +
+ TI816X_MUX(TSO1_DCLK,  OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[0]  */
 +
+ TI816X_MUX(TSO1_DATA,  OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[1]  */
 +
+ TI816X_MUX(TSO1_BYTSTRT, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[2]  */
 +
+ TI816X_MUX(TSO1_PACVAL, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[3]  */
 +
+ TI816X_MUX(TSO1_PACERR, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[4]  */
 +
+ TI816X_MUX(TSI3_DCLK,  OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[5]  */
 +
+ TI816X_MUX(TSI3_DATA,  OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[6]  */
 +
+ TI816X_MUX(TSI3_BYTSTRT, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[7]  */
 +
+ TI816X_MUX(TSI3_PACVAL, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[8]  */
 +
+ TI816X_MUX(TSI3_PACERR, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[9]  */
 +
+ TI816X_MUX(TSI1_DCLK,  OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[10]  */
 +
+ TI816X_MUX(TSI1_DATA,  OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[11]  */
 +
+ TI816X_MUX(TSI1_BYTSTRT, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[12]  */
 +
+ TI816X_MUX(TSI1_PACVAL, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[13]  */
 +
+ TI816X_MUX(TSI1_PACERR, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[14]  */
 +
+ TI816X_MUX(TSI2_DCLK,  OMAP_MUX_MODE1 | DM8168_PULL_DIS),
 +
+ /*  VIN[1]A_D[15]  */
 +
+ TI816X_MUX(TSI4_DCLK,  OMAP_MUX_MODE2 | DM8168_PULL_DIS),
 +
+
 +
{ .reg_offset = OMAP_MUX_TERMINATOR },
 +
};
 +
#else
 +
Index: linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/include/mach/board-ti816x.h
 +
===================================================================
 +
--- linux-2.6.37-psp04.04.00.01.orig/arch/arm/mach-omap2/include/mach/board-ti816x.h 2013-02-05 11:13:57.266338082 -0600
 +
+++ linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/include/mach/board-ti816x.h 2013-02-05 11:14:00.170338093 -0600
 +
@@ -5,6 +5,9 @@
 +
  *
 +
  * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
 +
  *
 +
+ * Modified by: David Soto (david.soto@ridgerun.com)
 +
+ *              Added support to feed video in VIP1
 +
+ *
 +
  * This program is free software; you can redistribute it and/or
 +
  * modify it under the terms of the GNU General Public License as
 +
  * published by the Free Software Foundation version 2.
 +
@@ -19,9 +22,10 @@
 +
#define _BOARD_TI816X_H
 +
#include <plat/ti81xx-vpss.h>
 +
 +
-#define VPS_SEL_TVP7002_DECODER 0
 +
-#define VPS_SEL_SIL9135_DECODER 1
 +
-
 +
+#define VPS_SEL_TVP7002_DECODER_VIP0 0
 +
+#define VPS_SEL_SIL9135_DECODER_VIP0 1
 +
+#define VPS_SEL_TVP7002_DECODER_VIP1 2
 +
+#define VPS_SEL_TVP5147_DECODER_VIP1 3
 +
 +
enum ti816x_ths_filter_ctrl {
 +
TI816X_THSFILTER_ENABLE_MODULE = 0,
 +
@@ -46,7 +50,8 @@
 +
int ti816x_pcf8575_init(void);
 +
int ti816x_pcf8575_exit(void);
 +
int vps_ti816x_select_video_decoder(int vid_decoder_id);
 +
-int vps_ti816x_set_tvp7002_filter(enum fvid2_standard standard);
 +
+int vps_ti816x_set_tvp7002_filter(enum fvid2_standard standard,
 +
+ int vid_decoder_id);
 +
#else
 +
int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl)
 +
{
 +
@@ -72,7 +77,8 @@
 +
{
 +
return 0;
 +
}
 +
-int vps_ti816x_set_tvp7002_filter(enum fvid2_standard standard)
 +
+int vps_ti816x_set_tvp7002_filter(enum fvid2_standard standard,
 +
+ int vid_decoder_id)
 +
{
 +
return 0;
 +
}
 +
Index: linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/ti81xx_vpss.c
 +
===================================================================
 +
--- linux-2.6.37-psp04.04.00.01.orig/arch/arm/mach-omap2/ti81xx_vpss.c 2013-02-05 11:13:57.242338082 -0600
 +
+++ linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/ti81xx_vpss.c 2013-02-05 11:14:00.170338093 -0600
 +
@@ -8,6 +8,9 @@
 +
  * Some code and ideas taken from TI OMAP2 Platforms
 +
  * by Tomi Valkeinen.
 +
  *
 +
+ * Modified by: David Soto (david.soto@ridgerun.com)
 +
+ *              Added support to feed video in VIP1
 +
+ *
 +
  * This program is free software; you can redistribute it and/or modify it
 +
  * under the terms of the GNU General Public License as published by the
 +
  * Free Software Foundation; either version 2 of the License, or (at your
 +
@@ -230,7 +233,7 @@
 +
{
 +
.input = {
 +
.index = 0,
 +
- .name = "Component",
 +
+ .name = "Component0",
 +
.type = V4L2_INPUT_TYPE_CAMERA,
 +
.std = V4L2_STD_UNKNOWN,
 +
.capabilities = V4L2_OUT_CAP_PRESETS,
 +
@@ -245,7 +248,7 @@
 +
{
 +
.input = {
 +
.index = 0,
 +
- .name = "Component",
 +
+ .name = "Component1",
 +
.type = V4L2_INPUT_TYPE_CAMERA,
 +
.std = V4L2_STD_UNKNOWN,
 +
.capabilities = V4L2_OUT_CAP_PRESETS,
 +
@@ -330,12 +333,17 @@
 +
vps_ti816x_select_video_decoder;
 +
hdvpss_capture_sdev_info[0].ti81xxvin_set_mode =
 +
vps_ti816x_set_tvp7002_filter;
 +
- hdvpss_capture_sdev_info[0].decoder_id = 0;
 +
+ hdvpss_capture_sdev_info[0].decoder_id =
 +
+ VPS_SEL_TVP7002_DECODER_VIP0;
 +
+
 +
+ /*Added functions to control the chips on the daughter card
 +
+ *in order to get the data into VIP1*/
 +
hdvpss_capture_sdev_info[1].ti81xxvin_select_decoder =
 +
- NULL;
 +
+ vps_ti816x_select_video_decoder;
 +
hdvpss_capture_sdev_info[1].ti81xxvin_set_mode =
 +
- NULL;
 +
- hdvpss_capture_sdev_info[1].decoder_id = 0;
 +
+ vps_ti816x_set_tvp7002_filter;
 +
+ hdvpss_capture_sdev_info[1].decoder_id =
 +
+ VPS_SEL_TVP7002_DECODER_VIP1;
 +
}
 +
r = platform_device_register(&hdvpss_capture_dev);
 +
if (r)
 +
Index: linux-2.6.37-psp04.04.00.01/drivers/media/video/ti81xx/ti81xxvin_main.c
 +
===================================================================
 +
--- linux-2.6.37-psp04.04.00.01.orig/drivers/media/video/ti81xx/ti81xxvin_main.c 2013-02-05 11:13:57.330338079 -0600
 +
+++ linux-2.6.37-psp04.04.00.01/drivers/media/video/ti81xx/ti81xxvin_main.c 2013-02-05 11:49:05.614346172 -0600
 +
@@ -6,6 +6,9 @@
 +
  * Copyright (C) 2010 Texas Instruments
 +
  * Author: Hardik Shah(hardik.shah@ti.com)
 +
  *
 +
+ * Modified by: David Soto (david.soto@ridgerun.com)
 +
+ *              Added dual capture support
 +
+ *
 +
  * Davinci TI81xx HDVPSS capture driver is used as a reference driver.
 +
  *
 +
  * This program is free software; you can redistribute it and/or modify it
 +
@@ -1325,21 +1328,21 @@
 +
case V4L2_DV_1080P60:
 +
case V4L2_DV_1080P50:
 +
ret = subdev_info[sd_index].ti81xxvin_set_mode(
 +
- FVID2_STD_1080P_60);
 +
+ FVID2_STD_1080P_60, subdev_info[sd_index].decoder_id);
 +
break;
 +
case V4L2_DV_720P60:
 +
case V4L2_DV_720P50:
 +
ret = subdev_info[sd_index].ti81xxvin_set_mode(
 +
- FVID2_STD_720P_60);
 +
+ FVID2_STD_720P_60, subdev_info[sd_index].decoder_id);
 +
break;
 +
case V4L2_DV_1080I60:
 +
case V4L2_DV_1080I50:
 +
ret = subdev_info[sd_index].ti81xxvin_set_mode(
 +
- FVID2_STD_1080I_60);
 +
+ FVID2_STD_1080I_60, subdev_info[sd_index].decoder_id);
 +
break;
 +
default:
 +
ret = subdev_info[sd_index].ti81xxvin_set_mode(
 +
- FVID2_STD_1080P_60);
 +
+ FVID2_STD_1080P_60, subdev_info[sd_index].decoder_id);
 +
}
 +
}
 +
/* Configure the default format information according to the std
 +
@@ -2181,6 +2184,15 @@
 +
ti81xxvin_dbg(2, debug, "ti81xxvin_open\n");
 +
 +
inst = video_get_drvdata(vdev);
 +
+ /* Identify which is the subdevice that will be used to ask about
 +
+ * the presets of the video coming to the input ports VIP
 +
+ */
 +
+ if (TI81XXVIN_INSTANCE0_VIDEO == inst->instance_id ||
 +
+ TI81XXVIN_INSTANCE1_VIDEO == inst->instance_id)
 +
+ inst->curr_sd_index = 0;
 +
+ else
 +
+ inst->curr_sd_index = 1;
 +
+
 +
setup_timer(&inst->overflow_timer, ti81xxvin_overflow_handler,
 +
(unsigned long)inst);
 +
 +
@@ -2193,10 +2205,10 @@
 +
 +
if (NULL == inst->curr_subdev_info) {
 +
/**
 +
- * searinst through the sub device to see a registered
 +
+ * search through the sub devices to see a registered
 +
* sub device and make it as current sub device
 +
*/
 +
- for (i = 0; i < config->subdev_count; i++) {
 +
+ for (i = inst->curr_sd_index; i < config->subdev_count; i++) {
 +
if (ti81xxvin_obj.sd[i]) {
 +
/* the sub device is registered */
 +
inst->curr_subdev_info =
 +
@@ -2430,12 +2442,16 @@
 +
struct resource *hdvpss_resource;
 +
 +
ti81xxvin_dev = &pdev->dev;
 +
+ /*Here we reserve memory for each instance - 4 instances*/
 +
err = ti81xxvin_initialize();
 +
if (err) {
 +
v4l2_err(ti81xxvin_dev->driver, "Error initializing TI81xx\n");
 +
/* TODO Deinitialize HDVPSS */
 +
return err;
 +
}
 +
+ /*We have 2 resources,TVPs. We are getting the address in memory
 +
+ * for each resource.
 +
+ */
 +
for (i = 0; i < pdev->num_resources; i++) {
 +
hdvpss_resource = &pdev->resource[i];
 +
if (hdvpss_resource->flags == IORESOURCE_MEM) {
 +
@@ -2444,6 +2460,12 @@
 +
hdvpss_resource->end - hdvpss_resource->start);
 +
}
 +
}
 +
+ /* For each of the capture devices (4) assign the memory address of its
 +
+ * video decoder, first 2 for TVP0, the second 2 for TVP1.
 +
+ * Create video device and fill out with the correct information:
 +
+ * name, minor, fops, ioctls, etc
 +
+ * Finally to each instance assign a video_device
 +
+ */
 +
for (i = 0; i < TI81XXVIN_CAPTURE_MAX_DEVICES; i++) {
 +
/* Get the pointer to the instance object */
 +
inst = ti81xxvin_obj.dev[i];
 +
@@ -2475,6 +2497,8 @@
 +
/* Set video_dev to the video device */
 +
inst->video_dev = vfd;
 +
}
 +
+
 +
+ /*Capture control, one for each capture device 4*/
 +
t = vps_capt_get_num_cap();
 +
num_capt = 0;
 +
for (i = 0; i < t; i++) {
 +
@@ -2488,6 +2512,10 @@
 +
ti81xxvin_obj.captctrl[ti81xxvin_obj.act_num_capt_ctrl++] =
 +
cctrl;
 +
}
 +
+    /*For each of the 4 capture devices set an instance id, a capture control
 +
+    * buffers and finally register the video device and setting which
 +
+    * node number we want
 +
+    */
 +
for (j = 0; j < TI81XXVIN_CAPTURE_MAX_DEVICES; j++) {
 +
inst = ti81xxvin_obj.dev[j];
 +
inst->instance_id = j;
 +
@@ -2515,7 +2543,10 @@
 +
i2c_adap = i2c_get_adapter(2);
 +
 +
config = pdev->dev.platform_data;
 +
+ /*These are 2, one for each TVP*/
 +
subdev_count = config->subdev_count;
 +
+
 +
+ /*Alloc memory for each subdevice*/
 +
ti81xxvin_obj.sd = kmalloc(sizeof(struct v4l2_subdev *) *subdev_count,
 +
GFP_KERNEL);
 +
if (ti81xxvin_obj.sd == NULL) {
 +
@@ -2531,7 +2562,7 @@
 +
" v4l2 device\n");
 +
goto probe_subdev_out;
 +
}
 +
- for (i = 0; i < 1; i++) {
 +
+ for (i = 0; i < 2; i++) {
 +
subdevdata = &config->subdev_info[i];
 +
ti81xxvin_obj.sd[i] =
 +
v4l2_i2c_new_subdev_board(&ti81xxvin_obj.v4l2_dev,
 +
@@ -2544,6 +2575,9 @@
 +
err = -ENODEV;
 +
goto probe_subdev_out;
 +
}
 +
+ /*Call select decoder such that the data can be feed in the
 +
+ * correct port
 +
+ */
 +
if (subdevdata->ti81xxvin_select_decoder)
 +
err = subdevdata->ti81xxvin_select_decoder(
 +
subdevdata->decoder_id);
 +
@@ -2553,8 +2587,8 @@
 +
goto probe_subdev_out;
 +
}
 +
if (subdevdata->ti81xxvin_set_mode)
 +
- err = subdevdata->ti81xxvin_set_mode(
 +
- FVID2_STD_1080P_60);
 +
+ err = subdevdata->ti81xxvin_set_mode(FVID2_STD_1080P_60,
 +
+ subdevdata->decoder_id);
 +
if (err < 0) {
 +
ti81xxvin_err("Error setting mode on decoder\n");
 +
goto probe_subdev_out;
 +
Index: linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/board-ti8148evm.c
 +
===================================================================
 +
--- linux-2.6.37-psp04.04.00.01.orig/arch/arm/mach-omap2/board-ti8148evm.c 2013-02-05 11:13:57.278338079 -0600
 +
+++ linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/board-ti8148evm.c 2013-02-05 11:14:00.170338093 -0600
 +
@@ -191,7 +191,16 @@
 +
EXPORT_SYMBOL(vps_ti814x_select_video_decoder);
 +
 +
#define I2C_RETRY_COUNT 10u
 +
-int vps_ti814x_set_tvp7002_filter(enum fvid2_standard standard)
 +
+/**
 +
+ * vps_ti814x_set_tvp7002_filter - Configure Video Filter
 +
+ * @standard:     standard to be used
 +
+ * @vid_decoder_id: Video decoder ID: VPS_SEL_TVP7002_DECODER
 +
+ *
 +
+ * Check video standard and according to it select the correct filter in the
 +
+ * THS7368 Filter and Video Amplifier chip
 +
+ */
 +
+int vps_ti814x_set_tvp7002_filter(enum fvid2_standard standard,
 +
+ int vid_decoder_id)
 +
{
 +
int filter_sel;
 +
int ret;
 +
Index: linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/include/mach/board-ti814x.h
 +
===================================================================
 +
--- linux-2.6.37-psp04.04.00.01.orig/arch/arm/mach-omap2/include/mach/board-ti814x.h 2013-02-05 11:13:57.254338078 -0600
 +
+++ linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/include/mach/board-ti814x.h 2013-02-05 11:14:00.170338093 -0600
 +
@@ -27,7 +27,8 @@
 +
int ti814x_pcf8575_init(void);
 +
int ti814x_pcf8575_exit(void);
 +
int vps_ti814x_select_video_decoder(int vid_decoder_id);
 +
-int vps_ti814x_set_tvp7002_filter(enum fvid2_standard standard);
 +
+int vps_ti814x_set_tvp7002_filter(enum fvid2_standard standard,
 +
+ int vid_decoder_id);
 +
#else
 +
int ti814x_pcf8575_init(void)
 +
{
 +
@@ -41,7 +42,8 @@
 +
{
 +
return 0;
 +
}
 +
-int vps_ti814x_set_tvp7002_filter(enum fvid2_standard standard)
 +
+int vps_ti814x_set_tvp7002_filter(enum fvid2_standard standard,
 +
+ int vid_decoder_id)
 +
{
 +
return 0;
 +
}
 +
Index: linux-2.6.37-psp04.04.00.01/include/linux/ti81xx.h
 +
===================================================================
 +
--- linux-2.6.37-psp04.04.00.01.orig/include/linux/ti81xx.h 2013-02-05 11:13:57.310338079 -0600
 +
+++ linux-2.6.37-psp04.04.00.01/include/linux/ti81xx.h 2013-02-05 11:14:00.170338093 -0600
 +
@@ -49,7 +49,8 @@
 +
  decoders are muxed on board to same VIP port. This
 +
  function connects, this decoder to VIP
 +
*/
 +
- int (*ti81xxvin_set_mode) (enum fvid2_standard standard);
 +
+ int (*ti81xxvin_set_mode) (enum fvid2_standard standard,
 +
+ int vid_decoder_id);
 +
/* There are filters on board which needs to be configured
 +
  based on dv_preset. This function allows to configure
 +
  those filter if they are present.
 +
Index: linux-2.6.37-psp04.04.00.01/drivers/media/video/tvp7002.c
 +
===================================================================
 +
--- linux-2.6.37-psp04.04.00.01.orig/drivers/media/video/tvp7002.c 2013-04-02 15:24:57.648480053 -0600
 +
+++ linux-2.6.37-psp04.04.00.01/drivers/media/video/tvp7002.c 2013-04-02 15:54:07.472486771 -0600
 +
@@ -246,7 +246,7 @@
 +
static const struct i2c_reg_value tvp7002_parms_1080P60[] = {
 +
{ TVP7002_HPLL_FDBK_DIV_MSBS, 0x89, TVP7002_WRITE },
 +
{ TVP7002_HPLL_FDBK_DIV_LSBS, 0x80, TVP7002_WRITE },
 +
- { TVP7002_HPLL_CRTL, 0xE0, TVP7002_WRITE },
 +
+ { TVP7002_HPLL_CRTL, 0xa0, TVP7002_WRITE },
 +
{ TVP7002_HPLL_PHASE_SEL, 0xA0, TVP7002_WRITE },
 +
{ TVP7002_AVID_START_PIXEL_LSBS, 0x00, TVP7002_WRITE },
 +
{ TVP7002_AVID_START_PIXEL_MSBS, 0x01, TVP7002_WRITE },
 +
 
 +
</pre>
 +
 
 +
= Articles related to this board =
 +
:[https://www.ridgerun.com/developer/wiki/index.php/RidgeRun_2011Q2_SDK_User_Guide RidgeRun 2011Q2 SDK User Guide]
 +
:[https://www.ridgerun.com/developer/wiki/index.php/RidgeRun_Turrialba_SDK_User_Guide RidgeRun Turrialba SDK User Guide]
 +
:[http://processors.wiki.ti.com/index.php/EZSDK_Memory_Map EZSDK Memory Map]
 +
:[http://processors.wiki.ti.com/index.php/OMX_EZSDK_Examples OMX EZSDK Examples]
 +
:[http://www.ti.com/lit/ds/symlink/tms320dm8168.pdf TMS320DM816x DaVinci Digital Media Processor]
 +
:[http://www.ti.com/lit/ug/sprugx8a/sprugx8a.pdf Technical Reference Manual]
[[Category:DM8168]] [[Category:GSG]]
[[Category:DM8168]] [[Category:GSG]]

Revision as of 18:50, 3 April 2013

Contents

Introduction

On this page you are going to find all the necessary information to start from scratch to use the RidgeRun SDK on your DM8168 evaluation module (EVM). In the following sections we assume that you have already downloaded the EZSDK version 5.05.04.01 and that you have installed the toolchain 2009q1-203 from codesourcery as well as your DM8168 SDK following the steps on The RidgeRun installation guide.

The first section of this guide shows you how to install the EZSDK for DM8168 on your computer and how to configure a TFTP and NFS server. Subsequently, the second section contains instructions about how to configure the RidgeRun's SDK to create a SD card with all software components (uboot, kernel and filesystem) needed to boot to Linux Shell in your EVM. Using this SD card in the third and fourth section of this guide, you will be able to install on NAND images created by the SDK for kernel, uboot as well as your filesystem (JFFS2, UBI, NFS are available). Using the SD card created on the second section to flash the SDK in your EVM is just an option because you could try to use the installer of the RidgeRun's SDK with the uboot version that is running by default in a new EVM, however, we cannot guaranty that it will work as we expect, hence, we recommend to use the SD card instead. Finally, how to run opemax demos to encode and decode 1080p/h264 videos and some pipelines using gstreamer + openMax are shown.

On the rest of this document, we refer as $(DEVDIR) to the path where the RidgeRun SDK for DM8168 is installed

Basic preliminary work

Installing the EZSDK

1. Set the ezsdk binary as executable and set correct permissions

 sudo chmod 777 ezsdk_dm816x-evm_5_05_01_04_setuplinux

2. Install EZSDK. For ubuntu versions different than Ubuntu 10.04 LTS 32-bit you will need to add the --forcehost argument to install it:

 ./ezsdk_dm816x-evm_5_05_01_04_setuplinux --forcehost

note: During the EZSDK installation process you will be asked for the toolchain's path, assuming that you installed it on /opt, the path that you need to provide is /opt/codesourcery/arm-2009q1/bin/

Setting up serial access to the Linux console

You use the serial port to control u-boot and Linux. The picocom terminal emulator work well for this purpose.

Setting up Picocom - Ubuntu

Setting up a TFTP server

If you are planning to use the SDK's installer to install images generated by the SDK in NAND, installing a TFTP server you will speed up downloads to the target hardware by using TFTP.

Setting Up A Tftp Service

Setting up an NFS server

For application development, it is convenient to use root NFS mount file system for the target hardware. This allows you to rebuild your application on the host and immediately run the application on the target hardware with no interveining steps. You host PC needs to be configured as a NFS server for this in order to work properly.

Setting Up A NFS Service

Booting from a SD card

Setting up your EVM to boot from SD card

In order to boot from a SD card you need to set the MMC as the first boot device to try in the DM8168 boot sequence, this can be done configuring a correct BTMODE through the switch SW3 in your EVM (see Fig. 1)

Figure 1. Dip switch to control boot mode (SD card)‎
Figure 1. Dip switch to control boot mode (SD card)

Configuring SDK to deploy firmware to a SD card

This section describes how to configure the DM8168's SDK to deploy all basic firmware components (kernel, uboot and MLO) into a bootable SD card. The RidgeRun SDK support several filesystem types (JFFS2, NFS, etc) however in this case we are going to use it on the SD card as well.

1. Set your environment variables

  cd $(DEVDIR)
 `make env`

2. Open a make config menu

 make config

running make config your SDK is going to download all basic packages needed by the SDK build system.

3. Go to Installer Configuration submenu and configure your installer as is shown in Fig.2

Figure 2. Installer configuration to deploy firmware to an SD card‎
Figure 2. Installer configuration to deploy firmware to an SD card

Using the Firmware deployment mode submenu you can set how to deploy your kernel, uboot and filesystem image into your target board. There are three options in this submenu: Attached board on communication port, Deploy all the firmware to an SD card and Create an SD card installer for flash memory.


4. Go to File System Configuration submenu and configure your filesystem as is shown in Fig.3

Figure 3. File system configuration to use it on the SD‎
Figure 3. File system configuration to use it on the SD‎

5. Compile your SDK

 make

Installing SDK's firmware to a SD card

Once you have built your SDK, you need to install it on the SD card running make install, but before to issue this command you need to unmount your SD card, otherwise the SDK won't let you install it (in order to avoid to erase information in some of your hard disks). Let's suppose that the environment variable called $(SDNAME) contains your mount point's name.

 umount /media/$(SDNAME)
 cd $(DEVDIR)
 make install

you will be asked to confirm the device that you are going to partition and format, please enter yes if it is correct. After this, the SDK will start to create a bootable SD card

Now you are ready to test your SDK booting from a SD card. Two partitions were created by the SDK: boot partition which contains the kernel, uboot and MLO image and the rootfs partition with your file system. It's important to notice that the environment of uboot is located in a *.txt file in the partition called boot, which allows you to modify it easily.

Booting from NAND

This section describes how to configure the DM8168's SDK to install the SDK's firmware in NAND as well as how to set up your EVM to boot from NAND. First, we are going to start flashing uboot in NAND using the SD card created in the above section, once uboot is running properly from NAND, we can start installing the kernel and finally your filesystem.

Configuring SDK to install firmware in NAND

1. Set your environment variables

 cd $(DEVDIR)
 `make env`

2. Open a make config menu

 make config

3. Go to Installer Configuration submenu and configure your installer as is shown in Fig.4

Figure 4. Installer configuration to deploy firmware in NAND‎
Figure 4. Installer configuration to deploy firmware in NAND


In this case, you must use the Attached board on communication port method, this will allow you to install all your firmware directly in nand by means of a serial port or by ethernet using a TFTP server. Here we are going to use a TFTP server and telnet as our communication method with the target board.


3.1 Go to the Communication method with the target board and select Telnet-serial adaptor

3.2 Configure the protocol to transfer images as TFTP

3.3 Set the IP address of your host machine in IP address of telnet-serial adaptor

3.4 Set the port number that you assigned in the telnet configuration file to the serial port where your EVM is connected in Network port of telnet-serial adaptor

4. Close the make config menu and save your changes.

Configuring your Filesystem type

The RidgeRun SDK for DM8168 EVM supports different filesystem types: UBI, JFFS, NFS and also as we mentioned before you can use it in your SD card as well. In this tutorial we are going to use UBI as our default filesystem.

1. Set your environment variables

 cd $(DEVDIR)
 `make env`

2. Open a make config menu

 make config

3. Go to the File System Configuration->File system image target and choose UBIFS volume. Please be sure that UBIFS sub-page size is set to 512.

4. Save your changes and compile your SDK

 make

Flashing uboot, kernel and filesystem in NAND

1.Boot the RidgeRun SDK using the SD card created in the first section of this guide and stop the uboot countdown. Close your Picocom, minicom or telnet session.

U-Boot 2010.06 (Nov 20 2012 - 15:57:54)

DRAM:  2 GiB
Using default environment

Hit any key to stop autoboot:  0 
mmc1 is available
reading u-boot.bin

185432 bytes read
## Starting application at 0x80800000 ...


U-Boot 2010.06 (Nov 20 2012 - 15:57:54)

TI8168-GP rev 1.1

ARM clk: 987MHz
DDR clk: 796MHz

I2C:   ready
DRAM:  2 GiB
NAND:  256 MiB
*** Warning - booting from SD, using default environment

:,;;:;:;;;;;;;;r;;:,;;:;:;;;;;;;;:,;;:;:;;;;;;;;:,;;:;:;;;;;;;;:;;;;;;;;:,;;:;:
;,;:::;;;;r;;;rssiSiS552X5252525259GX2X9hX9X9XX2325S55252i5:,;;:;:;;;;;;;;:,;;:
;:;;;;;;;rrssSsS52S22h52299GGAAMHMM#BBH#B#HMM#HMBA&&XX2255S2S5Si:,;;:;:;;;;;;;;
;:;;r;;rsrrriiXS5S329&A&MH#BMB#A&9XXA252GXiSXX39AAMMMBB&G22S5i2SSiiiisi:,;;:;:;
;;;;;r;rr2iisiih393HB#B#AA99i22irrrX3X52AGsisss2Xii2299HBMA&X2S5S5iSiisSsi:,;;:
r:r;rrsrsihXSi2&##MHB&Ahh3AGHGA9G9h&#H##@@@##MAMMXXX9SSS29&&HGGX2i5iisiiisisi:,
;;rrrrsSiiiA&ABH&A9GAGhAhBAMHA9HM@@@@@@@@@@@@@@@@@@@HHhAh2S2SX9&Gh22SSiisiiisii
r:rrssisiS2XM##&h3AGAX&3GG3Ssr5H@M#HM2; ;2X&&&MHMB###GBB#B&XXSSs529XX55iSsisisi
r;rsrisSi2XHAhX99A3XXG&&XS;:,rH#HGhAS   @@@@3rs2XBM@@A552&&AHA2XiisSS252SSsisSs
r;issi5S22&&3iSSX292&hXsr;;:;h@&G339&S9@@@@2@MA&9&HB##Xris29ABMAAX2ir;rsSi5iss5
rrsSi2XhG&9GXh399&X99i;;;;;;r#H&293H9X#@@@@@@@B&9GhAH@XrrsrsiXABHB&HG2rr;rrSiSi
;:rsisS599&AA9XG&3A35r;:::;,;BMh&&2iX5A@@@@@@@&392X5GB2;;;r;iSX393A##A&Xi:::rsi
;:rss552222X553&XHMhir;;::,:,h#HhGSXhG3#@@@@#AXXS2XAHA;::;;;;ss55XShBA3239r:,;;
r;ii2S5SSi2i53hirsh2srr::,,,,;MMXX359&Ah3h&Si59SX99A#i:,::::;;sri2,.2r;:SGAr;,:
;:;rrrrssiriXGSi::shs;;;,,,:,,rBBA9h5s5h5iS5isi2SAHB5:,,,:::;rrs5&SrisSX5Srrr:,
;,r;;;;rsriSSrrrr;;5Xrr;;,:,,.,;9AA2SsisS5323XXXG9&i:.,,::;;r;;;srrrrrr;;:;::::
:,;r;r;rrissrrr;:;::;s;;;;,:,,..,r293h222hXXAAGGGX;:,,,:,:,::;:;::,:,,,,...,,,,
;,;;;;rrrrrrrrirr;,.,,:::::::,,,,.,;SX&ABAB2hhXir:,,.,,.,,:,,,,..,,,..,..,,,..:
:.:;:;;;:;;;;r;rrs;:.. ,,:::::,:,:,,.::rrsrr;;,,.......,..,....,,,,,,,...,.,,:,
:.:::,::::::;;r;rrr;:.......,.,.,,:::,,...............,,::.,,,,:,::,,:,:,,,:,;:
,.::,:,,,,,;;;;;;;;r;;::,..............................;;;:;::::,:::::::,:,:,,,
: ,,:,,,,,,,,,,,,,:;rrr;;:;,,,,,,,::,.,.:.,.,;s,:;;;;:;:;;;;;::::,:::,:::,:,:,:
,.,,,,,,,...,,.,,....................................:,............:,,,:,:,,,,,

Net:   <ethaddr> not set. Reading from E-fuse
Detected MACID:90:d7:eb:20:62:b4
Ethernet PHY: GENERIC @ 0x01
DaVinci EMAC
Hit any key to stop autoboot:  0 
TI8168_EVM#

2.Run make installbootloader to install uboot in NAND

 make installbootloader

3.Turn off your EVM and configure it to boot from NAND (please see Setting up your EVM to boot from NAND). Turn on your EVM and repeat step 1.

4. Now, to install your kernel and filesytem run make install

 make install

Now you have installed all the SDK components in your DM8168 EVM and you should be able to boot to Linux shell and see the logo of RigeRun on the HDMI output. The RidgeRun SDK for DM8168 EVM loads automatically all the firmware and kernel modules needed to use the video processor subsystem.

Setting up your EVM to boot from NAND

In order to boot from a NAND you need to set it as the first boot device to try in the DM8168 boot sequence, this can be done configuring a correct BTMODE through the switch SW3 in your EVM (see Fig. 5)

Figure 5. Dip switch to control boot mode (NAND)‎
Figure 5. Dip switch to control boot mode (NAND)

Introduction to NAND memories

If you are more interested on NAND concepts and what is supported on the DM816x please read Introduction to NAND memories

OpenMax Demos

To run the openMax's demos that are located by default in your filesystem in a directory called omx you need to run first the following commands in your EVM

Video initialization

echo 0 > /sys/devices/platform/vpss/graphics0/enabled 
echo 0 > /sys/devices/platform/vpss/graphics1/enabled
echo 0 > /sys/devices/platform/vpss/graphics2/enabled

note: To run the decode display/encode demo with a 1080p video we recommend to use your filesystem by NFS due to the size of the input and output file.

Decode display demo

This demo is the decode-display demo included in the EZSDK. It takes an input file encoded in H264, decodes the stream and sends the output to the HDMI output

./omx/decode_display_a8host_debug.xv5T -i inputFile.h264 -w 1920 -h 1080 -f 60 -g 0

Capture encode demo

This demo is the capture-encode demo included in the EZSDK. It takes an input video streaming from the component input (case 720p) of the daughter card(marked as J5J6J7) and encodes it in H264, the output is displayed through the HDMI output.

echo 720p-60 >/sys/devices/platform/vpss/display0/mode
./omx/capture_encode_a8host_debug.xv5T -o sample.h264 -m 720p -f 60 -b 1000000 -n 1000

Using Gstreamer

Some examples of use of GStreamer to implement basic multimedia pipelines can be found at Gstreamer pipelines for DM816x and DM814x. Please be aware that in order to display video you need to do the Video initialization

note: If you are not using the Ridgerun SDK and you are trying to use the TAG 00_06_00_00 provided by TI you will need to apply the following patch to make V4L2src and omxbufferalloc work.

Index: gst-openmax-dm81xx/src/omx/gstomxbufferalloc.c
===================================================================
--- gst-openmax-dm81xx.orig/src/omx/gstomxbufferalloc.c	2012-11-14 16:15:41.392143697 -0600
+++ gst-openmax-dm81xx/src/omx/gstomxbufferalloc.c	2012-11-14 16:17:40.760145714 -0600
@@ -190,6 +190,7 @@
 
   gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
   gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
+  filter->out_port.portptr = gst_omxportptr_new(&filter->out_port);
   filter->silent = FALSE;
   filter->out_port.num_buffers = 10;
   filter->out_port.always_copy = FALSE;

Dual Capture Support

The DM816x-EVM comes with two Video Input Ports (VIP0 and VIP1) which can be used simultaneously through Video for Linux 2 (V4L2). However the current capture driver nor the kernel board file have all the code needed to use both video ports at the same time. Here you are going to find a patch to enable both ports (which is also included in the RidgeRun Pro SDK) as well as how to configure the RidgeRun SDK to load the V4L2 firmware instead of the openMax firmware. Some useful documentation and links to understand the changes that were made are included too.

Configure RidgeRun SDK to load V4L2 Firmware

In order to enable dual capture support in the DM816x-EVM, the V4L2 VPSS firmware has to be loaded. Specifically, the VPSS media controller needs to be running dm816x_hdvpss_v4l2.xem3 instead of dm816x_hdvpss.xem3. If you are not using the RidgeRun SDK please verify the following sha1sum

0647c92f39c9fe0e902fb27c301cd7c69481c41e  dm816x_hdvpss_v4l2.xem3
326e08f10afb8393d674d89694c09fa198ee6eac  dm816x_hdvpss.xem3

1. If you are using the RidgeRun SDK please run make config to display the SDK configuration menu. Go to the Proprietary software submenu and choose the 'Enable V4L2 capture capability option as is shown in Fig. 6.

cd $DEVDIR
`make env`
make config
Figure 6. SDK configuration menu to deploy V4L2 firmware in VPSS‎
Figure 6. SDK configuration menu to deploy V4L2 firmware in VPSS

2. Enable the V4L2 capture Driver.

Go to Kernel configuration -> Device Drivers -> Multimedia support -> Video capture adapters and select TI81XX V4L2-Capture driver

Figure 7. SDK configuration menu enable the TI V4L2 capture driver
Figure 7. SDK configuration menu enable the TI V4L2 capture driver

Then close the menu and save your changes.

3. Go to $DEVDIR, compile and install your SDK

cd $DEVDIR
make
make install.

4. Verify proper video port mapping on the DM816x-EVM

Your system should be ready to capture using V4L2 and you will be able to capture from both video input nodes. If the V4L2 display driver is enabled as well, the video nodes would have the following map:

/dev/video0 --> Capture VIP 0 Port A
/dev/video1 --> Display 0
/dev/video2 --> Display 1
/dev/video3 --> Display 2
/dev/video4 --> Capture VIP 0 Port B
/dev/video5 --> Capture VIP 1 Port A
/dev/video6 --> Capture VIP 1 Port B

/dev/video0 and /dev/video5 have been tested with the RidgeRun SDK. If you are not using the V4L2 display driver you need to use the following map:

/dev/video0 --> Capture VIP 0 Port A
/dev/video1 --> Capture VIP 0 Port B
/dev/video2 --> Capture VIP 1 Port A
/dev/video3 --> Capture VIP 1 Port B

You can test dual capture using the saLoopBack demo application installed on /usr/share/ti/ti-psp-examples or with gstreamer.

Dual V4L2 Capture Patch

Changes were required to enable the second input port in the V4L2 capture driver. These changes enable the use of the second component input port (VIP1). If you want to use the video coming from the TVP5147 additional changes might be required.

The add-V4L2-dual-capture-support.patch modifies the kernel board file to handle and configure the chips PCF8575 (Remote I2C GPIO I/O expander) labeled as U60 and U201 in the EVM schematics (Rev C) (page 14), SN74CBTLV (Bus exchange switch) labeled as U33 (page 25), 74CBTLV3253 (Dual multiplexer - SoG disabled) labeled as U66 (page 25) and THS4368 (Video amplifier and filters) labeled as U200 (page 28). Also it does the changes needed in the video capture driver (V4L2).

Note: Please be sure that you are using the patches suggested here as well: http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/p/228258/809457.aspx#809457

Date: Wed, 30 Jan 2013 08:21:00 
Subject: TI81xx capture: Support for dual capture on the DM8168-EVM

Description: The kernel board file needs to handle the chips located in the
daughter board to pass data coming from the second video decoder to the
Video Input Port 1 (VIP1). Also in the V4L2 capture driver we need to register
both video decoders as subdevices and keep track of which subdevice the system
will use according to the video node.

Signed-off-by: David Soto <david.soto@ridgerun.com>
---
Index: linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/board-ti8168evm.c
===================================================================
--- linux-2.6.37-psp04.04.00.01.orig/arch/arm/mach-omap2/board-ti8168evm.c	2013-02-05 11:13:57.294338082 -0600
+++ linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/board-ti8168evm.c	2013-02-05 11:14:00.166338092 -0600
@@ -3,6 +3,9 @@
  *
  * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
  *
+ * Modified by: David Soto (david.soto@ridgerun.com)
+ *              Added support to feed video in VIP1
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
  * published by the Free Software Foundation version 2.
@@ -68,6 +71,8 @@
 
 #define VPS_VC_IO_EXP_RESET_DEV_MASK        (0x0Fu)
 #define VPS_VC_IO_EXP_SEL_VIN0_S1_MASK      (0x04u)
+#define VPS_VC_IO_EXP_SEL_VIN1_S1_MASK      (0x08u)
+#define VPS_VC_IO_EXP_DISABLE_SOG_MASK      (0xC0u)
 #define VPS_VC_IO_EXP_THS7368_DISABLE_MASK  (0x10u)
 #define VPS_VC_IO_EXP_THS7368_BYPASS_MASK   (0x20u)
 #define VPS_VC_IO_EXP_THS7368_FILTER1_MASK  (0x40u)
@@ -278,13 +283,19 @@
 	{
 		I2C_BOARD_INFO("pcf8575_1", 0x2e),
 	},
+	{
+		I2C_BOARD_INFO("pcf8575_1", 0x23),
+	},
 };
 
 static struct i2c_client *pcf8575_1_client;
 static unsigned char pcf8575_1_port[2] = {0, 0};
 
 static struct i2c_client *pcf8575_2_client;
-static unsigned char pcf8575_2_port[2] = {0xFF, 0x2F};
+static unsigned char pcf8575_2_port[2] = {0xFF, 0x1F};
+
+static struct i2c_client *pcf8575_3_client;
+static unsigned char pcf8575_3_port[2] = {0xFF, 0x2F};
 
 static struct i2c_client *ths7353_client;
 
@@ -297,10 +308,37 @@
 			.len = 2,
 		};
 	msg.buf = pcf8575_2_port;
-	if (VPS_SEL_TVP7002_DECODER == vid_decoder_id)
-		pcf8575_2_port[1] &= ~VPS_VC_IO_EXP_SEL_VIN0_S1_MASK;
-	else
-		pcf8575_2_port[1] |= VPS_VC_IO_EXP_SEL_VIN0_S1_MASK;
+	switch (vid_decoder_id) {
+	case VPS_SEL_TVP7002_DECODER_VIP0:
+		{
+			pcf8575_2_port[1] &= ~VPS_VC_IO_EXP_SEL_VIN0_S1_MASK;
+			pcf8575_2_port[1] |=  VPS_VC_IO_EXP_DISABLE_SOG_MASK;
+			break;
+		}
+	case VPS_SEL_SIL9135_DECODER_VIP0:
+		{
+			pcf8575_2_port[1] |= VPS_VC_IO_EXP_SEL_VIN0_S1_MASK;
+			break;
+		}
+	/* Control the second SN74CBTLV16212GGR and 74CBTLV3253
+	 * (Bus-exchange switch and Dual multiplexer)
+	 */
+	case VPS_SEL_TVP7002_DECODER_VIP1:
+		{
+			pcf8575_2_port[1] &= ~VPS_VC_IO_EXP_SEL_VIN1_S1_MASK;
+			break;
+		}
+	case VPS_SEL_TVP5147_DECODER_VIP1:
+		{
+			pcf8575_2_port[1] |= VPS_VC_IO_EXP_SEL_VIN1_S1_MASK;
+			break;
+		}
+	default:
+		printk(KERN_ERR "Error: %s:%d wrong video decoder ID\n",
+				__func__, __LINE__);
+		return -1;
+	}
+
 	ret = (i2c_transfer(pcf8575_2_client->adapter, &msg, 1));
 
 	if (ret < 0)
@@ -309,18 +347,47 @@
 	return ret;
 }
 EXPORT_SYMBOL(vps_ti816x_select_video_decoder);
+
 #define I2C_RETRY_COUNT 10u
-int vps_ti816x_set_tvp7002_filter(enum fvid2_standard standard)
+/**
+ * vps_ti816x_set_tvp7002_filter - Configure Video Filter
+ * @standard:		    standard to be used
+ * @vid_decoder_id:		Video decoder ID: VPS_SEL_TVP7002_DECODER_VIP0
+ *                                        VPS_SEL_TVP7002_DECODER_VIP1
+ * Check video standard and according to it select the correct filter in the
+ * THS7368 Filter and Video Amplifier chip
+ */
+int vps_ti816x_set_tvp7002_filter(enum fvid2_standard standard,
+				int vid_decoder_id)
 {
 	int filter_sel;
 	int ret;
+
+	struct i2c_client *pcf8575_client;
+	unsigned char *pcf8575_port;
+
+	/* Identify which filter needs to be configured according
+	 * to the video decoder ID*/
+	if (VPS_SEL_TVP7002_DECODER_VIP0 == vid_decoder_id) {
+		pcf8575_client = pcf8575_2_client;
+		pcf8575_port = pcf8575_2_port;
+	} else
+	if (VPS_SEL_TVP7002_DECODER_VIP1 == vid_decoder_id) {
+		pcf8575_client = pcf8575_3_client;
+		pcf8575_port = pcf8575_3_port;
+	} else {
+		printk(KERN_ERR "Error: %s:%d wrong video decoder ID\n",
+			__func__, __LINE__);
+		return -1;
+	}
+
 	struct i2c_msg msg = {
-			.addr = pcf8575_2_client->addr,
+			.addr = pcf8575_client->addr,
 			.flags = 0,
 			.len = 2,
 		};
 
-	pcf8575_2_port[0] &= ~(VPS_VC_IO_EXP_THS7368_DISABLE_MASK
+	pcf8575_port[0] &= ~(VPS_VC_IO_EXP_THS7368_DISABLE_MASK
 			| VPS_VC_IO_EXP_THS7368_BYPASS_MASK
 			| VPS_VC_IO_EXP_THS7368_FILTER1_MASK
 			| VPS_VC_IO_EXP_THS7368_FILTER2_MASK);
@@ -373,101 +440,19 @@
 		filter_sel = 0x01u;  /* Filter2: 0, Filter1: 1 */
 		break;
 	}
-	pcf8575_2_port[0] |=
+	pcf8575_port[0] |=
 		(filter_sel << VPS_VC_IO_EXP_THS7368_FILTER_SHIFT);
-	msg.buf = pcf8575_2_port;
-	ret =  (i2c_transfer(pcf8575_2_client->adapter, &msg, 1));
+	msg.buf = pcf8575_port;
+	ret =  (i2c_transfer(pcf8575_client->adapter, &msg, 1));
 	if (ret < 0) {
 		printk(KERN_ERR "I2C: Transfer failed at %s %d with error code: %d\n",
 			__func__, __LINE__, ret);
 		return ret;
 	}
 	return 0;
-#if 0
-	int	status = FVID2_SOK;
-	u8	regAddr, regValue;
-	int	retry, error;
-
-	switch (standard) {
-	case FVID2_STD_1080P_60:
-	case FVID2_STD_1080P_50:
-	case FVID2_STD_SXGA_60:
-	case FVID2_STD_SXGA_75:
-	case FVID2_STD_SXGAP_60:
-	case FVID2_STD_SXGAP_75:
-	case FVID2_STD_UXGA_60:
-	    regValue = 0x9Cu;
-	    break;
-
-	case FVID2_STD_1080I_60:
-	case FVID2_STD_1080I_50:
-	case FVID2_STD_1080P_24:
-	case FVID2_STD_1080P_30:
-	case FVID2_STD_720P_60:
-	case FVID2_STD_720P_50:
-	case FVID2_STD_SVGA_60:
-	case FVID2_STD_SVGA_72:
-	case FVID2_STD_SVGA_75:
-	case FVID2_STD_SVGA_85:
-	case FVID2_STD_XGA_60:
-	case FVID2_STD_XGA_70:
-	case FVID2_STD_XGA_75:
-	case FVID2_STD_XGA_85:
-	case FVID2_STD_WXGA_60:
-	case FVID2_STD_WXGA_75:
-	case FVID2_STD_WXGA_85:
-	    regValue = 0x94u;
-	    break;
-
-	case FVID2_STD_480P:
-	case FVID2_STD_576P:
-	case FVID2_STD_VGA_60:
-	case FVID2_STD_VGA_72:
-	case FVID2_STD_VGA_75:
-	case FVID2_STD_VGA_85:
-	    regValue = 0x4Cu;
-	    break;
-
-	case FVID2_STD_NTSC:
-	case FVID2_STD_PAL:
-	case FVID2_STD_480I:
-	case FVID2_STD_576I:
-	case FVID2_STD_D1:
-	    regValue = 0x04u;
-	    break;
-
-	default:
-	    regValue = 0x94u;
-	    break;
-	}
-	for (retry = 0; retry < I2C_RETRY_COUNT; retry++) {
-		regAddr = 0x01u;
-		error = i2c_smbus_write_byte_data(ths7353_client,
-				regAddr, regValue);
-		if (error < 0) {
-			printk(KERN_ERR "I2C write failed at %d\n\n", __LINE__);
-			status = -1;
-		}
-		regAddr = 0x02u;
-		error = i2c_smbus_write_byte_data(ths7353_client,
-				regAddr, regValue);
-		if (error < 0) {
-			printk(KERN_ERR "I2C write failed at %d\n\n", __LINE__);
-			status = -1;
-		}
-		regAddr = 0x03u;
-		error = i2c_smbus_write_byte_data(ths7353_client,
-				regAddr, regValue);
-		if (error < 0) {
-			printk(KERN_ERR "I2C write failed at %d\n\n", __LINE__);
-			status = -1;
-		}
-	}
-
-	return status;
-#endif
 }
 EXPORT_SYMBOL(vps_ti816x_set_tvp7002_filter);
+
 int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl)
 {
 	struct i2c_msg msg = {
@@ -558,6 +543,8 @@
 		pcf8575_1_client = client;
 	else if (client->addr == 0x21)
 		pcf8575_2_client = client;
+	else if (client->addr == 0x23)
+		pcf8575_3_client = client;
 	else if (client->addr == 0x2e)
 		ths7353_client = client;
 	 else
@@ -569,6 +556,7 @@
 {
 	pcf8575_1_client = NULL;
 	pcf8575_2_client = NULL;
+	pcf8575_3_client = NULL;
 	return 0;
 }
 
@@ -767,6 +755,46 @@
 	TI816X_MUX(SC0_DATA, OMAP_MUX_MODE1),	/* gpmc_a25 */
 	/* for controlling high address */
 	TI816X_MUX(GPMC_A27, OMAP_MUX_MODE1),	/* gpio-20 */
+
+	/* Pullup/Pulldown disabled */
+	#define DM8168_PULL_DIS			(1 << 3)
+
+	/* Capture VIP 1 Port A */
+	/*  VIN[1]A_CLK    */
+	TI816X_MUX(TSO1_DCLK,   OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[0]   */
+	TI816X_MUX(TSO1_DATA,   OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[1]   */
+	TI816X_MUX(TSO1_BYTSTRT,	OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[2]   */
+	TI816X_MUX(TSO1_PACVAL,	OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[3]   */
+	TI816X_MUX(TSO1_PACERR,	OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[4]   */
+	TI816X_MUX(TSI3_DCLK,   OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[5]   */
+	TI816X_MUX(TSI3_DATA,   OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[6]   */
+	TI816X_MUX(TSI3_BYTSTRT,	OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[7]   */
+	TI816X_MUX(TSI3_PACVAL, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[8]   */
+	TI816X_MUX(TSI3_PACERR, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[9]   */
+	TI816X_MUX(TSI1_DCLK,   OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[10]  */
+	TI816X_MUX(TSI1_DATA,   OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[11]  */
+	TI816X_MUX(TSI1_BYTSTRT, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[12]  */
+	TI816X_MUX(TSI1_PACVAL, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[13]  */
+	TI816X_MUX(TSI1_PACERR, OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[14]  */
+	TI816X_MUX(TSI2_DCLK,   OMAP_MUX_MODE1 | DM8168_PULL_DIS),
+	/*  VIN[1]A_D[15]  */
+	TI816X_MUX(TSI4_DCLK,   OMAP_MUX_MODE2 | DM8168_PULL_DIS),
+
 	{ .reg_offset = OMAP_MUX_TERMINATOR },
 };
 #else
Index: linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/include/mach/board-ti816x.h
===================================================================
--- linux-2.6.37-psp04.04.00.01.orig/arch/arm/mach-omap2/include/mach/board-ti816x.h	2013-02-05 11:13:57.266338082 -0600
+++ linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/include/mach/board-ti816x.h	2013-02-05 11:14:00.170338093 -0600
@@ -5,6 +5,9 @@
  *
  * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
  *
+ * Modified by: David Soto (david.soto@ridgerun.com)
+ *              Added support to feed video in VIP1
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
  * published by the Free Software Foundation version 2.
@@ -19,9 +22,10 @@
 #define _BOARD_TI816X_H
 #include <plat/ti81xx-vpss.h>
 
-#define VPS_SEL_TVP7002_DECODER	0
-#define VPS_SEL_SIL9135_DECODER	1
-
+#define VPS_SEL_TVP7002_DECODER_VIP0	0
+#define VPS_SEL_SIL9135_DECODER_VIP0	1
+#define VPS_SEL_TVP7002_DECODER_VIP1	2
+#define VPS_SEL_TVP5147_DECODER_VIP1	3
 
 enum ti816x_ths_filter_ctrl {
 	TI816X_THSFILTER_ENABLE_MODULE = 0,
@@ -46,7 +50,8 @@
 int ti816x_pcf8575_init(void);
 int ti816x_pcf8575_exit(void);
 int vps_ti816x_select_video_decoder(int vid_decoder_id);
-int vps_ti816x_set_tvp7002_filter(enum fvid2_standard standard);
+int vps_ti816x_set_tvp7002_filter(enum fvid2_standard standard,
+			int vid_decoder_id);
 #else
 int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl)
 {
@@ -72,7 +77,8 @@
 {
 	return 0;
 }
-int vps_ti816x_set_tvp7002_filter(enum fvid2_standard standard)
+int vps_ti816x_set_tvp7002_filter(enum fvid2_standard standard,
+		int vid_decoder_id)
 {
 	return 0;
 }
Index: linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/ti81xx_vpss.c
===================================================================
--- linux-2.6.37-psp04.04.00.01.orig/arch/arm/mach-omap2/ti81xx_vpss.c	2013-02-05 11:13:57.242338082 -0600
+++ linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/ti81xx_vpss.c	2013-02-05 11:14:00.170338093 -0600
@@ -8,6 +8,9 @@
  * Some code and ideas taken from TI OMAP2 Platforms
  * by Tomi Valkeinen.
  *
+ * Modified by: David Soto (david.soto@ridgerun.com)
+ *              Added support to feed video in VIP1
+ *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
  * Free Software Foundation; either version 2 of the License, or (at your
@@ -230,7 +233,7 @@
 	{
 		.input = {
 			.index		= 0,
-			.name		= "Component",
+			.name		= "Component0",
 			.type		= V4L2_INPUT_TYPE_CAMERA,
 			.std		= V4L2_STD_UNKNOWN,
 			.capabilities	= V4L2_OUT_CAP_PRESETS,
@@ -245,7 +248,7 @@
 	{
 		.input = {
 			.index		= 0,
-			.name		= "Component",
+			.name		= "Component1",
 			.type		= V4L2_INPUT_TYPE_CAMERA,
 			.std		= V4L2_STD_UNKNOWN,
 			.capabilities	= V4L2_OUT_CAP_PRESETS,
@@ -330,12 +333,17 @@
 			vps_ti816x_select_video_decoder;
 		hdvpss_capture_sdev_info[0].ti81xxvin_set_mode =
 			vps_ti816x_set_tvp7002_filter;
-		hdvpss_capture_sdev_info[0].decoder_id = 0;
+		hdvpss_capture_sdev_info[0].decoder_id =
+			VPS_SEL_TVP7002_DECODER_VIP0;
+
+		/*Added functions to control the chips on the daughter card
+		 *in order to get the data into VIP1*/
 		hdvpss_capture_sdev_info[1].ti81xxvin_select_decoder =
-			NULL;
+			vps_ti816x_select_video_decoder;
 		hdvpss_capture_sdev_info[1].ti81xxvin_set_mode =
-			NULL;
-		hdvpss_capture_sdev_info[1].decoder_id = 0;
+			vps_ti816x_set_tvp7002_filter;
+		hdvpss_capture_sdev_info[1].decoder_id =
+			VPS_SEL_TVP7002_DECODER_VIP1;
 	}
 	r = platform_device_register(&hdvpss_capture_dev);
 	if (r)
Index: linux-2.6.37-psp04.04.00.01/drivers/media/video/ti81xx/ti81xxvin_main.c
===================================================================
--- linux-2.6.37-psp04.04.00.01.orig/drivers/media/video/ti81xx/ti81xxvin_main.c	2013-02-05 11:13:57.330338079 -0600
+++ linux-2.6.37-psp04.04.00.01/drivers/media/video/ti81xx/ti81xxvin_main.c	2013-02-05 11:49:05.614346172 -0600
@@ -6,6 +6,9 @@
  * Copyright (C) 2010 Texas Instruments
  * Author: Hardik Shah(hardik.shah@ti.com)
  *
+ * Modified by: David Soto (david.soto@ridgerun.com)
+ *              Added dual capture support
+ *
  * Davinci TI81xx HDVPSS capture driver is used as a reference driver.
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -1325,21 +1328,21 @@
 		case V4L2_DV_1080P60:
 		case V4L2_DV_1080P50:
 			ret = subdev_info[sd_index].ti81xxvin_set_mode(
-					FVID2_STD_1080P_60);
+			FVID2_STD_1080P_60, subdev_info[sd_index].decoder_id);
 		break;
 		case V4L2_DV_720P60:
 		case V4L2_DV_720P50:
 			ret = subdev_info[sd_index].ti81xxvin_set_mode(
-					FVID2_STD_720P_60);
+			FVID2_STD_720P_60, subdev_info[sd_index].decoder_id);
 		break;
 		case V4L2_DV_1080I60:
 		case V4L2_DV_1080I50:
 			ret = subdev_info[sd_index].ti81xxvin_set_mode(
-					FVID2_STD_1080I_60);
+			FVID2_STD_1080I_60, subdev_info[sd_index].decoder_id);
 		break;
 		default:
 			ret = subdev_info[sd_index].ti81xxvin_set_mode(
-					FVID2_STD_1080P_60);
+			FVID2_STD_1080P_60, subdev_info[sd_index].decoder_id);
 		}
 	}
 	/* Configure the default format information according to the std
@@ -2181,6 +2184,15 @@
 	ti81xxvin_dbg(2, debug, "ti81xxvin_open\n");
 
 	inst = video_get_drvdata(vdev);
+	/* Identify which is the subdevice that will be used to ask about
+	 * the presets of the video coming to the input ports VIP
+	 */
+	if (TI81XXVIN_INSTANCE0_VIDEO == inst->instance_id ||
+		TI81XXVIN_INSTANCE1_VIDEO == inst->instance_id)
+			inst->curr_sd_index = 0;
+	else
+			inst->curr_sd_index = 1;
+
 	setup_timer(&inst->overflow_timer, ti81xxvin_overflow_handler,
 		(unsigned long)inst);
 
@@ -2193,10 +2205,10 @@
 
 	if (NULL == inst->curr_subdev_info) {
 		/**
-		 * searinst through the sub device to see a registered
+		 * search through the sub devices to see a registered
 		 * sub device and make it as current sub device
 		 */
-		for (i = 0; i < config->subdev_count; i++) {
+		for (i = inst->curr_sd_index; i < config->subdev_count; i++) {
 			if (ti81xxvin_obj.sd[i]) {
 				/* the sub device is registered */
 				inst->curr_subdev_info =
@@ -2430,12 +2442,16 @@
 	struct resource *hdvpss_resource;
 
 	ti81xxvin_dev = &pdev->dev;
+	/*Here we reserve memory for each instance - 4 instances*/
 	err = ti81xxvin_initialize();
 	if (err) {
 		v4l2_err(ti81xxvin_dev->driver, "Error initializing TI81xx\n");
 		/* TODO Deinitialize HDVPSS */
 		return err;
 	}
+	/*We have 2 resources,TVPs. We are getting the address in memory
+	 * for each resource.
+	 */
 	for (i = 0; i < pdev->num_resources; i++) {
 		hdvpss_resource = &pdev->resource[i];
 		if (hdvpss_resource->flags == IORESOURCE_MEM) {
@@ -2444,6 +2460,12 @@
 				hdvpss_resource->end - hdvpss_resource->start);
 		}
 	}
+	/* For each of the capture devices (4) assign the memory address of its
+	 * video decoder, first 2 for TVP0, the second 2 for TVP1.
+	 * Create video device and fill out with the correct information:
+	 * name, minor, fops, ioctls, etc
+	 * Finally to each instance assign a video_device
+	 */
 	for (i = 0; i < TI81XXVIN_CAPTURE_MAX_DEVICES; i++) {
 		/* Get the pointer to the instance object */
 		inst = ti81xxvin_obj.dev[i];
@@ -2475,6 +2497,8 @@
 		/* Set video_dev to the video device */
 		inst->video_dev = vfd;
 	}
+
+	/*Capture control, one for each capture device 4*/
 	t = vps_capt_get_num_cap();
 	num_capt = 0;
 	for (i = 0; i < t; i++) {
@@ -2488,6 +2512,10 @@
 		ti81xxvin_obj.captctrl[ti81xxvin_obj.act_num_capt_ctrl++] =
 			cctrl;
 	}
+    /*For each of the 4 capture devices set an instance id, a capture control
+    * buffers and finally register the video device and setting which
+    * node number we want
+    */
 	for (j = 0; j < TI81XXVIN_CAPTURE_MAX_DEVICES; j++) {
 		inst = ti81xxvin_obj.dev[j];
 		inst->instance_id = j;
@@ -2515,7 +2543,10 @@
 		i2c_adap = i2c_get_adapter(2);
 
 	config = pdev->dev.platform_data;
+	/*These are 2, one for each TVP*/
 	subdev_count = config->subdev_count;
+
+	/*Alloc memory for each subdevice*/
 	ti81xxvin_obj.sd = kmalloc(sizeof(struct v4l2_subdev *) *subdev_count,
 				GFP_KERNEL);
 	if (ti81xxvin_obj.sd == NULL) {
@@ -2531,7 +2562,7 @@
 			" v4l2 device\n");
 		goto probe_subdev_out;
 	}
-	for (i = 0; i < 1; i++) {
+	for (i = 0; i < 2; i++) {
 		subdevdata = &config->subdev_info[i];
 		ti81xxvin_obj.sd[i] =
 			v4l2_i2c_new_subdev_board(&ti81xxvin_obj.v4l2_dev,
@@ -2544,6 +2575,9 @@
 			err = -ENODEV;
 			goto probe_subdev_out;
 		}
+	/*Call select decoder such that the data can be feed in the
+	* correct port
+	*/
 		if (subdevdata->ti81xxvin_select_decoder)
 			err = subdevdata->ti81xxvin_select_decoder(
 				subdevdata->decoder_id);
@@ -2553,8 +2587,8 @@
 			goto probe_subdev_out;
 		}
 		if (subdevdata->ti81xxvin_set_mode)
-			err = subdevdata->ti81xxvin_set_mode(
-					FVID2_STD_1080P_60);
+			err = subdevdata->ti81xxvin_set_mode(FVID2_STD_1080P_60,
+			 subdevdata->decoder_id);
 		if (err < 0) {
 			ti81xxvin_err("Error setting mode on decoder\n");
 			goto probe_subdev_out;
Index: linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/board-ti8148evm.c
===================================================================
--- linux-2.6.37-psp04.04.00.01.orig/arch/arm/mach-omap2/board-ti8148evm.c	2013-02-05 11:13:57.278338079 -0600
+++ linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/board-ti8148evm.c	2013-02-05 11:14:00.170338093 -0600
@@ -191,7 +191,16 @@
 EXPORT_SYMBOL(vps_ti814x_select_video_decoder);
 
 #define I2C_RETRY_COUNT 10u
-int vps_ti814x_set_tvp7002_filter(enum fvid2_standard standard)
+/**
+ * vps_ti814x_set_tvp7002_filter - Configure Video Filter
+ * @standard:		    standard to be used
+ * @vid_decoder_id:		Video decoder ID: VPS_SEL_TVP7002_DECODER
+ *
+ * Check video standard and according to it select the correct filter in the
+ * THS7368 Filter and Video Amplifier chip
+ */
+int vps_ti814x_set_tvp7002_filter(enum fvid2_standard standard,
+			int vid_decoder_id)
 {
 	int filter_sel;
 	int ret;
Index: linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/include/mach/board-ti814x.h
===================================================================
--- linux-2.6.37-psp04.04.00.01.orig/arch/arm/mach-omap2/include/mach/board-ti814x.h	2013-02-05 11:13:57.254338078 -0600
+++ linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/include/mach/board-ti814x.h	2013-02-05 11:14:00.170338093 -0600
@@ -27,7 +27,8 @@
 int ti814x_pcf8575_init(void);
 int ti814x_pcf8575_exit(void);
 int vps_ti814x_select_video_decoder(int vid_decoder_id);
-int vps_ti814x_set_tvp7002_filter(enum fvid2_standard standard);
+int vps_ti814x_set_tvp7002_filter(enum fvid2_standard standard,
+			int vid_decoder_id);
 #else
 int ti814x_pcf8575_init(void)
 {
@@ -41,7 +42,8 @@
 {
 	return 0;
 }
-int vps_ti814x_set_tvp7002_filter(enum fvid2_standard standard)
+int vps_ti814x_set_tvp7002_filter(enum fvid2_standard standard,
+			int vid_decoder_id)
 {
 	return 0;
 }
Index: linux-2.6.37-psp04.04.00.01/include/linux/ti81xx.h
===================================================================
--- linux-2.6.37-psp04.04.00.01.orig/include/linux/ti81xx.h	2013-02-05 11:13:57.310338079 -0600
+++ linux-2.6.37-psp04.04.00.01/include/linux/ti81xx.h	2013-02-05 11:14:00.170338093 -0600
@@ -49,7 +49,8 @@
 	   decoders are muxed on board to same VIP port. This
 	   function connects, this decoder to VIP
 	 */
-	int (*ti81xxvin_set_mode) (enum fvid2_standard standard);
+	int (*ti81xxvin_set_mode) (enum fvid2_standard standard,
+			int vid_decoder_id);
 	/* There are filters on board which needs to be configured
 	   based on dv_preset. This function allows to configure
 	   those filter if they are present.
Index: linux-2.6.37-psp04.04.00.01/drivers/media/video/tvp7002.c
===================================================================
--- linux-2.6.37-psp04.04.00.01.orig/drivers/media/video/tvp7002.c	2013-04-02 15:24:57.648480053 -0600
+++ linux-2.6.37-psp04.04.00.01/drivers/media/video/tvp7002.c	2013-04-02 15:54:07.472486771 -0600
@@ -246,7 +246,7 @@
 static const struct i2c_reg_value tvp7002_parms_1080P60[] = {
 	{ TVP7002_HPLL_FDBK_DIV_MSBS, 0x89, TVP7002_WRITE },
 	{ TVP7002_HPLL_FDBK_DIV_LSBS, 0x80, TVP7002_WRITE },
-	{ TVP7002_HPLL_CRTL, 0xE0, TVP7002_WRITE },
+	{ TVP7002_HPLL_CRTL, 0xa0, TVP7002_WRITE },
 	{ TVP7002_HPLL_PHASE_SEL, 0xA0, TVP7002_WRITE },
 	{ TVP7002_AVID_START_PIXEL_LSBS, 0x00, TVP7002_WRITE },
 	{ TVP7002_AVID_START_PIXEL_MSBS, 0x01, TVP7002_WRITE },

Articles related to this board

RidgeRun 2011Q2 SDK User Guide
RidgeRun Turrialba SDK User Guide
EZSDK Memory Map
OMX EZSDK Examples
TMS320DM816x DaVinci Digital Media Processor
Technical Reference Manual
Navigation
Toolbox