static int vidioc_enum_framesizes(struct file *file, void *fh,struct v4l2_frmsizeenum *fsize)
{
int ret = 0,i=0;
struct ov5640_fmt *fmt = NULL;
struct v4l2_frmsize_discrete *frmsize = NULL;
for (i = 0; i < ARRAY_SIZE(formats); i++) {
if (formats[i].fourcc == fsize->pixel_format){
fmt = &formats[i];
break;
}
}
if (fmt == NULL)
return -EINVAL;
if ((fmt->fourcc == V4L2_PIX_FMT_NV21)
||(fmt->fourcc == V4L2_PIX_FMT_NV12)
||(fmt->fourcc == V4L2_PIX_FMT_YUV420)
||(fmt->fourcc == V4L2_PIX_FMT_YVU420)){
printk("ov5640_prev_resolution[fsize->index]"
" before fsize->index== %d\n",fsize->index);//potti
if (fsize->index >= ARRAY_SIZE(prev_resolution_array))
return -EINVAL;
frmsize = &prev_resolution_array[fsize->index].frmsize;
printk("ov5640_prev_resolution[fsize->index]"
" after fsize->index== %d\n",fsize->index);
fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
fsize->discrete.width = frmsize->width;
fsize->discrete.height = frmsize->height;
} else if (fmt->fourcc == V4L2_PIX_FMT_RGB24){
printk("ov5640_pic_resolution[fsize->index]"
" before fsize->index== %d\n",fsize->index);
if (fsize->index >= ARRAY_SIZE(capture_resolution_array))
return -EINVAL;
frmsize = &capture_resolution_array[fsize->index].frmsize;
printk("ov5640_pic_resolution[fsize->index]"
" after fsize->index== %d\n",fsize->index);
fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
fsize->discrete.width = frmsize->width;
fsize->discrete.height = frmsize->height;
}
return ret;
}
static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
struct ov5640_fmt *fmt;
if (f->index >= ARRAY_SIZE(formats))
return -EINVAL;
fmt = &formats[f->index];
strlcpy(f->description, fmt->name, sizeof(f->description));
f->pixelformat = fmt->fourcc;
return 0;
}