media.ctl configuration error "Unable to start streaming: Broken pipe (32)"

Hi, All.
To grab an image with ov7675/ov7670 sensor, I use media-ctl to configure isp pipeline.
my pipeline configuration: ov7670 → CCDC → preview → preview output,following “a ov7690 configuration”.
my configuration shell script:

#!/bin/sh
media-ctl -v -r
media-ctl -v -f '"ov7670 2-0021":0 [SBGGR8 320x240], "OMAP3 ISP CCDC":1 [SBGGR8 320x240],"OMAP3 ISP preview":1 [UYVY 320x240]'
media-ctl -v -l '"ov7670 2-0021":0 -> "OMAP3 ISP CCDC":0 [1]'
media-ctl -v -l '"OMAP3 ISP CCDC":2 -> "OMAP3 ISP preview":0 [1]'
media-ctl -v -l '"OMAP3 ISP preview":1 -> "OMAP3 ISP preview output":0 [1]'

command “media-ctl -p“‘s outputing seems ok.

Opening media device /dev/media0
Enumerating entities
Found 16 entities
Enumerating pads and links
Media controller API version 0.0.0

Media device information

added dmesg output in omap3isp,and found the error position:
In preview_get_crop() of /drivers/media/video/omap3isp/isppreview.c, the input parameter “pad” is PREV_PAD_SOURCE, cause this error…

static int preview_get_crop(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
                struct v4l2_subdev_crop *crop)
{
    struct isp_prev_device *prev = v4l2_get_subdevdata(sd);

    /* By dmesg , crop->pad = PREV_PAD_SOURCE.It causes error exit.*/
    if (crop->pad != PREV_PAD_SINK)         
    {
        pr_err("preview_get_crop(),crop->pad(%d)!=PREV_PAD_SINK\n",crop->pad);
        return -EINVAL;
    }

    crop->rect = *__preview_get_crop(prev, fh, crop->which);
    return 0;
}

dmesg output:

[   23.329053] omap3isp omap3isp: isp_set_xclk(): cam_xclkb set to 21600000 Hz
[   31.368248] preview_get_crop(),crop->pad(1)!=PREV_PAD_SINK
[   31.388851] omap3isp omap3isp: isp_set_xclk(): cam_xclkb set to 21600000 Hz

I try capture using mplayer:

mplayer tv:// -tv driver=v4l2:device=/dev/video4 -vo omapfb

To trace omap3isp error, I adding pr_err() in omap3isp source code. The followning two pr_err() is trigged.

static int isp_video_get_param(struct file *file, void *fh, struct v4l2_streamparm *a)
{
    struct isp_video_fh *vfh = to_isp_video_fh(fh);
    struct isp_video *video = video_drvdata(file);

    if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT ||
        video->type != a->type)
    {
        pr_err("isp_video_get_param(),video_type error\n");
        return -EINVAL;
    }
static int
isp_video_enum_input(struct file *file, void *fh, struct v4l2_input *input)
{
    if (input->index > 0)
    {
        pr_err("isp_video_enum_input(),input->index>0\n");
        return -EINVAL;
    }

dmesg’s output:

[ 3067.673217] ov7670_set_power=1
[ 3067.677334] omap3isp omap3isp: isp_set_xclk(): cam_xclkb set to 21600000 Hz
[ 3067.834946] isp_video_get_param(),video_type error
[ 3067.840750] isp_video_enum_input(),input->index>0
[ 3067.848996] ------------[ cut here ]------------
[ 3067.854973] WARNING: at drivers/media/video/omap3isp/ispvideo.c:219 isp_video_set_format+0x50/0x98()
[ 3067.866660] Modules linked in:
[ 3067.871510] [<c001a944>] (unwind_backtrace+0x0/0xf0) from [<c0052b04>] (warn_slowpath_common+0x4c/0x64)
[ 3067.884215] [<c0052b04>] (warn_slowpath_common+0x4c/0x64) from [<c0052b38>] (warn_slowpath_null+0x1c/0x24)
[ 3067.895721] [<c0052b38>] (warn_slowpath_null+0x1c/0x24) from [<c039ebd4>] (isp_video_set_format+0x50/0x98)
[ 3067.906774] [<c039ebd4>] (isp_video_set_format+0x50/0x98) from [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0)
[ 3067.918601] [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0) from [<c038997c>] (video_usercopy+0x124/0x52c)
[ 3067.930414] [<c038997c>] (video_usercopy+0x124/0x52c) from [<c0388c7c>] (v4l2_ioctl+0x98/0x13c)
[ 3067.940636] [<c0388c7c>] (v4l2_ioctl+0x98/0x13c) from [<c0109068>] (do_vfs_ioctl+0x7c/0x548)
[ 3067.951144] [<c0109068>] (do_vfs_ioctl+0x7c/0x548) from [<c01095a0>] (sys_ioctl+0x6c/0x7c)
[ 3067.961586] [<c01095a0>] (sys_ioctl+0x6c/0x7c) from [<c00133c0>] (ret_fast_syscall+0x0/0x3c)
[ 3067.971152] ---[ end trace bf03e4e418d1b9dc ]---
[ 3067.976970] ------------[ cut here ]------------
[ 3067.981882] WARNING: at drivers/media/video/omap3isp/ispvideo.c:179 isp_video_mbus_to_pix+0x6c/0x140()
[ 3067.993330] Modules linked in:
[ 3067.996638] [<c001a944>] (unwind_backtrace+0x0/0xf0) from [<c0052b04>] (warn_slowpath_common+0x4c/0x64)
[ 3068.008082] [<c0052b04>] (warn_slowpath_common+0x4c/0x64) from [<c0052b38>] (warn_slowpath_null+0x1c/0x24)
[ 3068.019031] [<c0052b38>] (warn_slowpath_null+0x1c/0x24) from [<c039e790>] (isp_video_mbus_to_pix+0x6c/0x140)
[ 3068.030621] [<c039e790>] (isp_video_mbus_to_pix+0x6c/0x140) from [<c039ebe4>] (isp_video_set_format+0x60/0x98)
[ 3068.042438] [<c039ebe4>] (isp_video_set_format+0x60/0x98) from [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0)
[ 3068.053543] [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0) from [<c038997c>] (video_usercopy+0x124/0x52c)
[ 3068.064653] [<c038997c>] (video_usercopy+0x124/0x52c) from [<c0388c7c>] (v4l2_ioctl+0x98/0x13c)
[ 3068.074949] [<c0388c7c>] (v4l2_ioctl+0x98/0x13c) from [<c0109068>] (do_vfs_ioctl+0x7c/0x548)
[ 3068.084578] [<c0109068>] (do_vfs_ioctl+0x7c/0x548) from [<c01095a0>] (sys_ioctl+0x6c/0x7c)
[ 3068.094423] [<c01095a0>] (sys_ioctl+0x6c/0x7c) from [<c00133c0>] (ret_fast_syscall+0x0/0x3c)
[ 3068.103975] ---[ end trace bf03e4e418d1b9dd ]---
[ 3068.108992] ------------[ cut here ]------------
[ 3068.115210] WARNING: at drivers/media/video/omap3isp/ispvideo.c:219 isp_video_set_format+0x50/0x98()
[ 3068.125913] Modules linked in:
[ 3068.129224] [<c001a944>] (unwind_backtrace+0x0/0xf0) from [<c0052b04>] (warn_slowpath_common+0x4c/0x64)
[ 3068.140073] [<c0052b04>] (warn_slowpath_common+0x4c/0x64) from [<c0052b38>] (warn_slowpath_null+0x1c/0x24)
[ 3068.151077] [<c0052b38>] (warn_slowpath_null+0x1c/0x24) from [<c039ebd4>] (isp_video_set_format+0x50/0x98)
[ 3068.162548] [<c039ebd4>] (isp_video_set_format+0x50/0x98) from [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0)
[ 3068.173617] [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0) from [<c038997c>] (video_usercopy+0x124/0x52c)
[ 3068.184338] [<c038997c>] (video_usercopy+0x124/0x52c) from [<c0388c7c>] (v4l2_ioctl+0x98/0x13c)
[ 3068.194578] [<c0388c7c>] (v4l2_ioctl+0x98/0x13c) from [<c0109068>] (do_vfs_ioctl+0x7c/0x548)
[ 3068.204163] [<c0109068>] (do_vfs_ioctl+0x7c/0x548) from [<c01095a0>] (sys_ioctl+0x6c/0x7c)
[ 3068.213931] [<c01095a0>] (sys_ioctl+0x6c/0x7c) from [<c00133c0>] (ret_fast_syscall+0x0/0x3c)
[ 3068.223491] ---[ end trace bf03e4e418d1b9de ]---
[ 3068.228410] ------------[ cut here ]------------
[ 3068.234177] WARNING: at drivers/media/video/omap3isp/ispvideo.c:179 isp_video_mbus_to_pix+0x6c/0x140()
[ 3068.245094] Modules linked in:
[ 3068.248399] [<c001a944>] (unwind_backtrace+0x0/0xf0) from [<c0052b04>] (warn_slowpath_common+0x4c/0x64)
[ 3068.259811] [<c0052b04>] (warn_slowpath_common+0x4c/0x64) from [<c0052b38>] (warn_slowpath_null+0x1c/0x24)
[ 3068.270711] [<c0052b38>] (warn_slowpath_null+0x1c/0x24) from [<c039e790>] (isp_video_mbus_to_pix+0x6c/0x140)
[ 3068.282268] [<c039e790>] (isp_video_mbus_to_pix+0x6c/0x140) from [<c039ebe4>] (isp_video_set_format+0x60/0x98)
[ 3068.293957] [<c039ebe4>] (isp_video_set_format+0x60/0x98) from [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0)
[ 3068.305005] [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0) from [<c038997c>] (video_usercopy+0x124/0x52c)
[ 3068.316831] [<c038997c>] (video_usercopy+0x124/0x52c) from [<c0388c7c>] (v4l2_ioctl+0x98/0x13c)
[ 3068.327239] [<c0388c7c>] (v4l2_ioctl+0x98/0x13c) from [<c0109068>] (do_vfs_ioctl+0x7c/0x548)
[ 3068.337217] [<c0109068>] (do_vfs_ioctl+0x7c/0x548) from [<c01095a0>] (sys_ioctl+0x6c/0x7c)
[ 3068.353811] [<c01095a0>] (sys_ioctl+0x6c/0x7c) from [<c00133c0>] (ret_fast_syscall+0x0/0x3c)
[ 3068.370209] ---[ end trace bf03e4e418d1b9df ]---
[ 3068.383626] omap3isp_video_queue_reqbufs(),size=0
[ 3068.394135] ov7670_set_power=0
[ 3068.400903] omap3isp omap3isp: isp_set_xclk(): cam_xclkb set to 0 Hz

mplayer’s output:

MPlayer UNKNOWN-4.5.3 (C) 2000-2010 MPlayer Team                                                                                       [47/1866]

Playing tv://.
TV file format d[ 3067.673217] ov7670_set_power=1
etected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
[ 3067.834946] isp_video_get_param(),video_type error
v4l2: ioctl get [ 3067.840750] isp_video_enum_input(),input->index>0
standard failed: Invalid argumen[ 3067.848996] ------------[ cut here ]------------
t
Selected devi[ 3067.854973] WARNING: at drivers/media/video/omap3isp/ispvideo.c:219 isp_video_set_format+0x50/0x98()
ce: OMAP3 ISP pr[ 3067.866660] Modules linked in:eview output
 C
apabilities:  vi[ 3067.871510] [<c001a944>] (unwind_backtrace+0x0/0xf0) from [<c0052b04>] (warn_slowpath_common+0x4c/0x64)
deo capture  str[ 3067.884215] [<c0052b04>] (warn_slowpath_common+0x4c/0x64) from [<c0052b38>] (warn_slowpath_null+0x1c/0x24)
eaming
 support[ 3067.895721] [<c0052b38>] (warn_slowpath_null+0x1c/0x24) from [<c039ebd4>] (isp_video_set_format+0x50/0x98)
ed norms:
 inpu[ 3067.906774] [<c039ebd4>] (isp_video_set_format+0x50/0x98) from [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0)
[ 3067.918601] [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0) from [<c038997c>] (video_usercopy+0x124/0x52c)

 Current input:[ 3067.930414] [<c038997c>] (video_usercopy+0x124/0x52c) from [<c0388c7c>] (v4l2_ioctl+0x98/0x13c)
 0
 Current for[ 3067.940636] [<c0388c7c>] (v4l2_ioctl+0x98/0x13c) from [<c0109068>] (do_vfs_ioctl+0x7c/0x548)
mat: unknown (0x[ 3067.951144] [<c0109068>] (do_vfs_ioctl+0x7c/0x548) from [<c01095a0>] (sys_ioctl+0x6c/0x7c)
0)
[ 3067.961586] [<c01095a0>] (sys_ioctl+0x6c/0x7c) from [<c00133c0>] (ret_fast_syscall+0x0/0x3c)
[ 3067.971152] ---[ end trace bf03e4e418d1b9dc ]---
[ 3067.976970] ------------[ cut here ]------------
[ 3067.981882] WARNING: at drivers/media/video/omap3isp/ispvideo.c:179 isp_video_mbus_to_pix+0x6c/0x140()
[ 3067.993330] Modules linked in:
[ 3067.996638] [<c001a944>] (unwind_backtrace+0x0/0xf0) from [<c0052b04>] (warn_slowpath_common+0x4c/0x64)
[ 3068.008082] [<c0052b04>] (warn_slowpath_common+0x4c/0x64) from [<c0052b38>] (warn_slowpath_null+0x1c/0x24)
[ 3068.019031] [<c0052b38>] (warn_slowpath_null+0x1c/0x24) from [<c039e790>] (isp_video_mbus_to_pix+0x6c/0x140)
[ 3068.030621] [<c039e790>] (isp_video_mbus_to_pix+0x6c/0x140) from [<c039ebe4>] (isp_video_set_format+0x60/0x98)
[ 3068.042438] [<c039ebe4>] (isp_video_set_format+0x60/0x98) from [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0)
[ 3068.053543] [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0) from [<c038997c>] (video_usercopy+0x124/0x52c)
[ 3068.064653] [<c038997c>] (video_usercopy+0x124/0x52c) from [<c0388c7c>] (v4l2_ioctl+0x98/0x13c)
[ 3068.074949] [<c0388c7c>] (v4l2_ioctl+0x98/0x13c) from [<c0109068>] (do_vfs_ioctl+0x7c/0x548)
[ 3068.084578] [<c0109068>] (do_vfs_ioctl+0x7c/0x548) from [<c01095a0>] (sys_ioctl+0x6c/0x7c)
[ 3068.094423] [<c01095a0>] (sys_ioctl+0x6c/0x7c) from [<c00133c0>] (ret_fast_syscall+0x0/0x3c)
[ 3068.103975] ---[ end trace bf03e4e418d1b9dd ]---
[ 3068.108992] ------------[ cut here ]------------
[ 3068.115210] WARNING: at drivers/media/video/omap3isp/ispvideo.c:219 isp_video_set_format+0x50/0x98()
[ 3068.125913] Modules linked in:
[ 3068.129224] [<c001a944>] (unwind_backtrace+0x0/0xf0) from [<c0052b04>] (warn_slowpath_common+0x4c/0x64)
[ 3068.140073] [<c0052b04>] (warn_slowpath_common+0x4c/0x64) from [<c0052b38>] (warn_slowpath_null+0x1c/0x24)
[ 3068.151077] [<c0052b38>] (warn_slowpath_null+0x1c/0x24) from [<c039ebd4>] (isp_video_set_format+0x50/0x98)
[ 3068.162548] [<c039ebd4>] (isp_video_set_format+0x50/0x98) from [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0)
[ 3068.173617] [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0) from [<c038997c>] (video_usercopy+0x124/0x52c)
[ 3068.184338] [<c038997c>] (video_usercopy+0x124/0x52c) from [<c0388c7c>] (v4l2_ioctl+0x98/0x13c)
[ 3068.194578] [<c0388c7c>] (v4l2_ioctl+0x98/0x13c) from [<c0109068>] (do_vfs_ioctl+0x7c/0x548)
[ 3068.204163] [<c0109068>] (do_vfs_ioctl+0x7c/0x548) from [<c01095a0>] (sys_ioctl+0x6c/0x7c)
[ 3068.213931] [<c01095a0>] (sys_ioctl+0x6c/0x7c) from [<c00133c0>] (ret_fast_syscall+0x0/0x3c)
[ 3068.223491] ---[ end trace bf03e4e418d1b9de ]---
[ 3068.228410] ------------[ cut here ]------------
[ 3068.234177] WARNING: at drivers/media/video/omap3isp/ispvideo.c:179 isp_video_mbus_to_pix+0x6c/0x140()
[ 3068.245094] Modules linked in:
[ 3068.248399] [<c001a944>] (unwind_backtrace+0x0/0xf0) from [<c0052b04>] (warn_slowpath_common+0x4c/0x64)
[ 3068.259811] [<c0052b04>] (warn_slowpath_common+0x4c/0x64) from [<c0052b38>] (warn_slowpath_null+0x1c/0x24)
[ 3068.270711] [<c0052b38>] (warn_slowpath_null+0x1c/0x24) from [<c039e790>] (isp_video_mbus_to_pix+0x6c/0x140)
[ 3068.282268] [<c039e790>] (isp_video_mbus_to_pix+0x6c/0x140) from [<c039ebe4>] (isp_video_set_format+0x60/0x98)
[ 3068.293957] [<c039ebe4>] (isp_video_set_format+0x60/0x98) from [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0)
[ 3068.305005] [<c038d3cc>] (__video_do_ioctl+0x35d0/0x4ab0) from [<c038997c>] (video_usercopy+0x124/0x52c)
[ 3068.316831] [<c038997c>] (video_usercopy+0x124/0x52c) from [<c0388c7c>] (v4l2_ioctl+0x98/0x13c)
[ 3068.327239] [<c0388c7c>] (v4l2_ioctl+0x98/0x13c) from [<c0109068>] (do_vfs_ioctl+0x7c/0x548)
[ 3068.337217] [<c0109068>] (do_vfs_ioctl+0x7c/0x548) from [<c01095a0>] (sys_ioctl+0x6c/0x7c)
[ 3068.353811] [<c01095a0>] (sys_ioctl+0x6c/0x7c) from [<c00133c0>] (ret_fast_syscall+0x0/0x3c)
[ 3068.370209] ---[ end trace bf03e4e418d1b9df ]---
tv.c: norm_from_[ 3068.383626] omap3isp_video_queue_reqbufs(),size=0
string(pal): Bogus norm parameter, setting default.
v4l2: ioctl[ 3068.394135] ov7670_set_power=0
 enum norm failed: Inappropriate ioctl for device
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: Cannot get fps
v4l2: ioctl request buffers failed: Invalid argument
v4l2: ioctl set mute failed: Inappropriate ioctl for device
v4l2: 0 frames successfully processed, 0 frames dropped.