This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Regarding V4L2 drivers

Other Parts Discussed in Thread: TVP7002

Greetings,

I have read some documents about v4l2 driver, however I am still not clear about how to deal with our following application scenario.

We have a custom design with dm814x/dm816x with a HDMI Rx on the board.

The I2C of HDMI Rx will be taken care of by a microcontroller, so I do not need actually write the sub-driver for the hdmi chip.

My HDMI Rx will give me hsync, vsync, DE signals.

There is a TI wiki shows us how to add external decoders, however after reading it carefully I am still confused about what I should do.

Here are my questions:

1. if I donot need write the registers of our hdmi rx via I2C, what should I change in ti81xx_fb.c to let Davinci Soc can recognize video and sync data ?

Hardik once told me in the other thread that the place where master driver and subdriver hooked up is in ti81xx_fb.c.

And the bold places should be modified if using a different decoder. As far as I undersood, there only give the master driver the I2C address of tvp7002.

    This  " .platform_data = &tvp7002_pdata"  just define the polarities of hsync, vsync, de etc.

struct ti81xxvin_interface tvp7002_pdata = {
    .clk_polarity = 0,
    .hs_polarity = 0,
    .vs_polarity = 1,
    .fid_polarity = 0,
    .sog_polarity = 0,

};
static struct ti81xxvin_subdev_info hdvpss_capture_sdev_info[] = {
    {
        .name    = TVP7002_INST0,
        .board_info = {
            /* TODO Find the correct address
                of the TVP7002 connected */
            I2C_BOARD_INFO("tvp7002", 0x5d),
            .platform_data = &tvp7002_pdata,
        },

Let's say if i want to support RGB24 bit- discrete sync mode of my hdmi rx, the following codes should be change. Please correct me or remind me if any other changes is required.

ti81xx_fb.c:

 hdvpss_capture_sdev_info[ 0 ].vip_port_cfg.ctrlChanSel=VPS_VIP_CTRL_CHAN_DONT_CARE.

hdvpss_capture_sdev_info[ 0].vip_port_cfg.video_capture_mode=VPS_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_DISCRETE_SYNC_HSYNC_VSYNC. hdvpss_capture_sdev_info[ 0 ].vip_port_cfg.video_if_mode=VSP_CAPT_VIDEO_IF_MODE_24BIT.

hdvpss_capture_sdev_info[ 0 ].vip_port_cfg.input_data_format= FVID2_DF_RGB24_888.

2. Where exactly is the place tvp7002.ko used?

To keep the changes of driver minimum, I am going to just empty tvp7002.c to let it serve as a dummy driver. The reason for that is our hdmi rx will be wrote by an external microcontroller. Am I right about this? Any problem with this approach?

I was also wondering which  file in the linux kernel used tvp7002.ko? This is the file after recompiling tvp7002.c and should be copied to /targetfs/lib/modules/2.6.37/kernel/drivers/media/video

If later I do need use Davinici to write our HDMI rx registers via I2C, I will have to create v4l2 sub-driver.

Thanks in advance,

Jun


  • Hi

    Any update on next EZSDK release.

    Meanwhile I have tried to capture on VIP1 port A with discrete sync. I am able to capture video and overflow errors are also less compared to embedded sync config.

    But I am facing another problem whereby my display screen seems to be shifted from left side, and video gets cropped on right side.

    Please find the attached image of the captured video.

    What can be the reason for this?

    Regards,

    Prashant.

  • Hi,

    Which decoder are you using to do this? What is the captured format. Can you please dump image from capture instead of displaying it and see if you have this problem in captured image as well.

    Regards,

    Hardik Shah

  • Thanks for the reply

    The decoder is adv7611 from analog devices.

    The captured format is 72op60 RGB, 24bpp.

    Regards,

    Prashant.

  • Hi,

    Can you please send me the modified ti81xx_fb.c file. I want to see how are you interfacing your decoder. Check your decoder parameters also once and try dumping captured data in file and see if you see same issue.

    Regards,

    Hardik Shah

  • Hi

    Thanks for the reply.

    please find the attached file.

    Regards,

    prashant.

  • Hi

    I am able to get the full screen video now by tweaking configuration settings of decoder.

    The problem was Capture port used to capture horizontal blanking interval also.

    This is because my line capture style is VPS_VIP_LINE_CAPTURE_STYLE_HSYNC.

    I have tried using VPS_VIP_LINE_CAPTURE_STYLE_ACTVID but with that I am not able to capture. May be you can suggest right parameter setting for VPS_VIP_LINE_CAPTURE_STYLE_ACTVID.

    Meanwhile Other problem is,

    I am capturing 24 bit RGB data and I have set pixelformat both in capture and in display(framebuffer) as 24 bit RGB, But still I am not able to see video clearly.

    In short, there is lot of color distortion that is happening particularly if captured video has color gradient. What can be the issue?

    It seems that there is colorspace conversion that is happening.  How can we disable colorspace conversion.

    Regards,

    Prashant.

     

  • Hi,

    As I told please try dumping data from capture and view it using some viewer instead of viewing it on TV. Try sending the dump file we will also see it here and try to find something.

    Regards,

    Hardik Shah

  • Hi Hardik,

    I just got my custon dm814x board and now I am back on this v4l2 driver.

    I have applied the two patches and make modules and updated all the related modules like vpss.ko in the filesystem.

    Now when i run root@dm814x-evm:~# /etc/init.d/load-hd-v4l2-firmware.sh start

    Then I got following messages, please see the red part.

    =======================================================
    Loading HDVICP2 Firmware
    DM814X prcm_config_app version: 2.0.0.1
    Doing PRCM settings...
            PRCM for IVHD0 is in Progress, Please wait.....  
                            BW Phy Addr : 0x48180600 Data : 0x00000001
                            AW Phy Addr : 0x48180600 Data : 0x00000002
                            Phy Addr : 0x48180c04 Data : 0x00000037
                            BW Phy Addr : 0x48180620 Data : 0x00070000
                            AW Phy Addr : 0x48180620 Data : 0x00050002
                            BW Phy Addr : 0x48180624 Data : 0x00030000
                            AW Phy Addr : 0x48180624 Data : 0x00010002
                            Phy Addr : 0x48180600 Data : 0x00000102
                            BW Phy Addr : 0x48180c10 Data : 0x00000007
                            AW Phy Addr : 0x48180c10 Data : 0x00000003
                            Phy Addr : 0x48180c14 Data : 0x00000004
                            BW Phy Addr : 0x58088000 Data : 0xf730c5b2
                            AW Phy Addr : 0x58088000 Data : 0xeafffffe
                            BW Phy Addr : 0x58098000 Data : 0x4c1caa30
                            AW Phy Addr : 0x58098000 Data : 0xeafffffe
                            BW Phy Addr : 0x48180c10 Data : 0x00000003
                            AW Phy Addr : 0x48180c10 Data : 0x00000000
                            Phy Addr : 0x48180c14 Data : 0x00000007
            PRCM for IVHD0 is Done Successfully  
    PRCM Initialization completed
    SysLink version : 2.00.05.85
    SysLink module created on Date:Dec  9 2011 Time:17:34:15
    FIRMWARE: Memory map bin file not passed
    Usage : firmware_loader <Processor Id> <Location of Firmware> <start|stop> [Location of Mem map bin file]
    FIRMWARE: Default memory configuration is used
    MemCfg: DCMM (Dynamically Configurable Memory Map) Version :  2.1.1.1
    FIRMWARE: Memory Configuration status : In Progress
    FIRMWARE: 1 start Successful
    Loading HDVPSS (V4L2) Firmware
    FIRMWARE: Memory map bin file not passed
    Usage : firmware_loader <Processor Id> <Location of Firmware> <start|stop> [Location of Mem map bin file]
    FIRMWARE: Default memory configuration is used
    MemCfg: DCMM (Dynamically Configurable Memory Map) Version :  2.1.1.1
    FIRMWARE: Memory Configuration status : In Progress
    FIRMWARE: 2 start Successful
    I2C: Transfer failed at vps_ti814x_select_video_decoder 183 with error code: -121
    Configuring fb0 to LCD
    tvp7002 3-005d: tvp7002 found @ 0x5d (OMAP I2C adapter)
    tvp7002 3-005d: TVP7002 read error -121
    tvp7002: probe of 3-005d failed with error -121
    ti81xxvin ti81xxvin: Error registering v4l2 subdevice

    ========================================================

    After applying sub_devices_calls_removed.patch, the v4l2 is not supposed to load the tvp7002.ko right?

    Then why it still give me this error message?

    Thanks,

    Jun



  • Hi,

    It seems like you have stil sub-devices call getting called. You have load ti81xxvin.ko after updating the capture driver for removal of sub-devices calls.

    Regards,

    Hardik Shah

  • Hi Hardik,

    Thanks for your reply.

    What I did is:

    1. Apply the two patches

    2. Make modules under linux

    3. overwrite all the old firmwares in the filesystem: vpss ti81xxfb ti81xxvo ti81xxvin ti81xxhdmi

    4.   load dm814x_hdvicp.xem3  and dm814x_hdvpss_v4l2.xem3

    5.

    a)modprobe vpss sbufaddr=0xBFB00000                            
    I2C: Transfer failed at vps_ti814x_select_video_decoder 183 with error code: -11 (this one from ti8148_evm.h I checked should be not relevant

    b) modprobe ti81xxfb vram=0:40M,1:1M,2:1M                       
    c)modprobe ti81xxvo                                            
    d)modprobe ti81xxvin       
         tvp7002 3-005d: tvp7002 found @ 0x5d (OMAP I2C adapter)                         
         tvp7002 3-005d: TVP7002 read error -121                                         
        tvp7002: probe of 3-005d failed with error -121                                 
        ti81xxvin ti81xxvin: Error registering v4l2 subdevice

    What I am missing here? Why ti81xxin.ko still call tvp7002 subdevice?

    In this thread, I saw another guy also has this problem

    I attched the diff file of my patched ti81xxvin_main.c here

    7633.ti81xxvin_main_diff.txt
    --- /Angelica/V4L2/ti81xxvin_main.c	2011-11-29 04:33:46.000000000 -0500
    +++ /Angelica/V4L2/ti81xxvin_main_patched.c	2012-04-02 10:06:48.099602753 -0400
    @@ -934,9 +934,10 @@
     		ti81xxvin_dbg(1, debug, "videobuf streamoff failed\n");
     
     	ti81xxvin_vps_delete(inst);
    +#if 0
     	ret = v4l2_subdev_call(ti81xxvin_obj.sd[inst->curr_sd_index], video,
     			s_stream, 0);
    -
    +#endif 
     	if (ret && (ret != -ENOIOCTLCMD))
     		ti81xxvin_dbg(1, debug, "stream off failed in subdev\n");
     	return ret;
    @@ -1278,6 +1279,7 @@
     		return -ERESTARTSYS;
     
     	/* Call querystd function of decoder device */
    +#if 0
     	ret = v4l2_subdev_call(ti81xxvin_obj.sd[inst->curr_sd_index], video,
     			query_dv_preset, qpreset);
     	if (ret < 0) {
    @@ -1285,6 +1287,7 @@
     		" for sub devices\n");
     		goto vidioc_query_dv_preset_exit;
     	}
    +
     	inst->video.cur_dv_preset.preset = V4L2_DV_INVALID;
     	inst->video.cur_std_id = V4L2_STD_UNKNOWN;
     	inst->video.cur_dv_preset = *qpreset;
    @@ -1292,6 +1295,18 @@
     	ret = v4l2_subdev_call(ti81xxvin_obj.sd[inst->curr_sd_index], video,
     			g_mbus_fmt, &mbus_framefmt);
     	/* Get the information about the standard */
    +#endif 
    +	mbus_framefmt.width = 800;
    +	mbus_framefmt.height = 600;
    +	mbus_framefmt.code = V4L2_MBUS_FMT_YUYV8_2X8;
    +	mbus_framefmt.field = V4L2_FIELD_NONE;
    +	mbus_framefmt.field = V4L2_COLORSPACE_REC709;
    +
    +	qpreset->preset = V4L2_DV_INVALID;
    +	inst->video.cur_dv_preset.preset = V4L2_DV_INVALID;
    +	inst->video.cur_std_id = V4L2_STD_UNKNOWN;
    +	inst->video.cur_dv_preset = *qpreset;
    +
     	if (ti81xxvin_update_std_info(inst, &mbus_framefmt)) {
     		ret = -EINVAL;
     		ti81xxvin_err("Error getting the standard info\n");
    @@ -1330,6 +1345,7 @@
     		return -ERESTARTSYS;
     
     	/* Call querystd function of decoder device */
    +#if 0
     	ret = v4l2_subdev_call(ti81xxvin_obj.sd[inst->curr_sd_index], video,
     			querystd, norm);
     	if (ret < 0) {
    @@ -1349,6 +1365,7 @@
     		ti81xxvin_err("Error getting the standard info\n");
     		goto querystd_exit;
     	}
    +#endif 
     	/* Configure the default format information according to the std
     	 * selected
     	 */
    @@ -1391,6 +1408,7 @@
     	/* Call encoder subdevice function to set the standard */
     	if (mutex_lock_interruptible(&buf_obj->buf_lock))
     		return -ERESTARTSYS;
    +#if 0
     	/* Call the V4l2 subdev to set the preset */
     	ret = v4l2_subdev_call(ti81xxvin_obj.sd[inst->curr_sd_index], video,
     			s_dv_preset, dv_preset);
    @@ -1402,6 +1420,18 @@
     
     	ret = v4l2_subdev_call(ti81xxvin_obj.sd[inst->curr_sd_index], video,
     			g_mbus_fmt, &mbus_framefmt);
    +#endif 
    +	mbus_framefmt.width = 800;
    +	mbus_framefmt.height = 600;
    +	mbus_framefmt.code = V4L2_MBUS_FMT_YUYV8_2X8;
    +	mbus_framefmt.field = V4L2_FIELD_NONE;
    +	mbus_framefmt.field = V4L2_COLORSPACE_REC709;
    +
    +	dv_preset->preset = V4L2_DV_INVALID;
    +	inst->video.cur_dv_preset.preset = V4L2_DV_INVALID;
    + 	inst->video.cur_std_id = V4L2_STD_UNKNOWN;
    +	inst->video.cur_dv_preset = *dv_preset;
    +
     	/* Get the information about the standard */
     	if (ti81xxvin_update_std_info(inst, &mbus_framefmt)) {
     		ret = -EINVAL;
    @@ -1453,6 +1483,7 @@
     	/* Call encoder subdevice function to set the standard */
     	if (mutex_lock_interruptible(&buf_obj->buf_lock))
     		return -ERESTARTSYS;
    +#if 0
     	/* Call the V4l2 subdev to set the preset */
     	ret = v4l2_subdev_call(ti81xxvin_obj.sd[inst->curr_sd_index], core,
     			s_std, *norm);
    @@ -1470,7 +1501,7 @@
     		ti81xxvin_err("Error getting the standard info\n");
     		goto s_std_exit;
     	}
    -
    +#endif 
     	/* Configure the default format information according to the std
     	 * selected
     	 */
    @@ -1537,11 +1568,13 @@
     	ti81xxvin_dbg(2, debug, "vidioc_enum_dv_presets\n");
     	if (mutex_lock_interruptible(&buf_obj->buf_lock))
     		return -ERESTARTSYS;
    +
     	/* Call the V4l2 subdev to set the preset */
     	ret = v4l2_subdev_call(ti81xxvin_obj.sd[inst->curr_sd_index], video,
     			enum_dv_presets, preset);
     	if (ret)
     		goto enum_dv_presets_exit;
    +
     	mutex_unlock(&buf_obj->buf_lock);
     
     	return 0;
    @@ -1727,6 +1760,7 @@
     	ret = ti81xxvin_check_format(inst, &buf_obj->fmt.fmt.pix, 0);
     	if (ret)
     		return ret;
    +#if 0
     	/* After checking the buffer format. Call the FVID2 Create and
     	 * Set format for starting the driver
     	 */
    @@ -1738,6 +1772,7 @@
     		ti81xxvin_dbg(1, debug, "stream on failed in subdev\n");
     		return ret;
     	}
    +#endif 
     	ret = ti81xxvin_vps_create(inst);
     	if (ret) {
     		ti81xxvin_err("Vps create failed\n");
    @@ -1790,9 +1825,10 @@
     	vps_capture_unregister_isr(ti81xxvin_instance_isr,
     			(void *)inst->instance_id, inst->instance_id);
     ti81xxvin_vps_create_failed:
    +#if 0
     	ret = v4l2_subdev_call(ti81xxvin_obj.sd[inst->curr_sd_index], video,
     			s_stream, 0);
    -
    +#endif 
     	return ret;
     }
     
    @@ -2415,12 +2451,18 @@
     		goto probe_out;
     	}
     
    +
     	err = v4l2_device_register(ti81xxvin_dev, &ti81xxvin_obj.v4l2_dev);
     	if (err) {
     		v4l2_err(ti81xxvin_dev->driver, "Error registering"
     			" v4l2 device\n");
     		goto probe_subdev_out;
     	}
    +
    +
    +
    +
    +
     	for (i = 0; i < 1; i++) {
     		subdevdata = &config->subdev_info[i];
     		ti81xxvin_obj.sd[i] =
    @@ -2454,6 +2496,8 @@
     		if (ti81xxvin_obj.sd[i])
     			ti81xxvin_obj.sd[i]->grp_id = 1 << i;
     	}
    +
    +
     	v4l2_info(&ti81xxvin_obj.v4l2_dev, "TI81xx HDVPSS Capture driver"
     		  " initialized\n");
    
     
    

    Thanks,

    Jun

  • Hi,

    Let me see your file and get back to you.

    Regards,

    Hardik Shah

  • Hi,

    You will have to comments following lines as well where V4L2 capture driver is getting initialized.

    for (i = 0; i < 1; i++) {
    2499                 subdevdata = &config->subdev_info[i];
    2500                 ti81xxvin_obj.sd[i] =
    2501                         v4l2_i2c_new_subdev_board(&ti81xxvin_obj.v4l2_dev,
    2502                                                   i2c_adap,
    2503                                                   &subdevdata->board_info,
    2504                                                   NULL, 0);
    2505
    2506                 if (!ti81xxvin_obj.sd[i]) {
    2507                         ti81xxvin_err("Error registering v4l2 subdevice\n");
    2508                         goto probe_subdev_out;
    2509                 }
    2510                 if (subdevdata->ti81xxvin_select_decoder)
    2511                         err = subdevdata->ti81xxvin_select_decoder(
    2512                                 subdevdata->decoder_id);
    2513                 if (err < 0) {
    2514                         ti81xxvin_err("Error selecting decoder\n");
    2515                         goto probe_subdev_out;
    2516                 }
    2517                 if (subdevdata->ti81xxvin_set_mode)
    2518                         err = subdevdata->ti81xxvin_set_mode(
    2519                                         FVID2_STD_1080P_60);
    2520                 if (err < 0) {
    2521                         ti81xxvin_err("Error setting mode on decoder\n");
    2522                         goto probe_subdev_out;
    2523                 }
    2524
    2525                 v4l2_info(&ti81xxvin_obj.v4l2_dev, "registered sub device %s\n",
    2526                           subdevdata->name);
    2527
    2528                 if (ti81xxvin_obj.sd[i])
    2529                         ti81xxvin_obj.sd[i]->grp_id = 1 << i;
    2530         }

    Regards,

    Hardik Shah

  • Hi Hardik,

    Thanks for your help very much.

    Now when I insert vpss and ti81xxvin, the board can return the right value.

    I am gong to run the test to verify it.

    Regards,

    Jun

  • Hi,

    Good to know it worked. Can you please mark this as "Answered" Please mute this thread and start new thread for any new queries.  This thread has become huge and its difficult to track.

    Regards,

    Hardik Shah

  • Hi Ben,

    I am also in the situation of trying to capture on both video inputs of the DM8168.

    I created a dummy driver like you and commented out all the i2c stuff. I changed the loop as you did so it loops twice, and I haven't commented out any subdev calls.

    When I run the saLoopBackFbdev application I _am_ capturing frames, but they are all blank (i.e. nearly all zeroes). I am using VIP1 (embedded sync, no mux, YUV, 16 bit) to do the secondary capture which is is shared with DVO1 so I am concerned that I should be disabling DVO1 in order to allow video however no mention is made of how to disable DVO1 in the VPSS user guide.

    Is there anything else you did to get the second capture port working?

    Thanks,

    Ralph

  • That was all i did. If you are actually dequeueing frames then that means the syncs are triggering properly. If your data is zero then perhaps your pinmux is messed up on the capture port. Not sure what else to try.

  • Hi Ben, thanks for the reply. There was a bug in TI's V4L2 input driver which I had to fix otherwise the same settings for VIN0 would be used for VIN1.

    Ralph

  • Hi,

    Pinmux settings are done such that both capture can work. You need not to tweak pin mux settings. If you are getting frames from V4L2 capture driver for VIP1 (DQBUF comig out periodically) that means HDVPSS VIP is capturing frames. You better need to check for decoder. If DQBUF is not coming out that means frames are not getting capture.

    Regards,

    Hardik Shah

  • Hi Ralph,

        I'm also trying to get the dual capture working, I did the following:

    1. I configured the board file to set the correct pin mux configuration and also I added the code needed to configure the chips on the daughter board properly so I would be able to get the data coming from the second TVP in the SoC. 

    2. I did the modifications that you recommended for the V4L2 capture driver

    However, when I try to capture from the second port it is still trying to get the information from the first port. I already changed the video node to /dev/video5 and I am using the saLoopBack application. I was wondering if there is some extra modification that is needed to get this working.

    Did you get some similar error when you were working on this? Am I missing something?

    -David

  • Forget my questions, I got the dual capture working on the DM8168-EVM, the V4L2 capture driver needed more modifications 

    -David

  • Hi,

    Could you please share the changes you did?

    Regards,

    Brijesh Jadav

  • Thanks for sharing this.

  • Hi

    Prashant Dhumal

    how did you solve the problem which hanging at DQbuf?

  • Hello escofield Zhu ,

    This forum thread is too long and is hard to trace all the issues here. It would be better if you open a new forum thread with your issue.

    Best Regards,

    Margarita