Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:
"Some driver fixes (em28xx, coda, usbtv, s5p, hdpvr and ml86v7667) and
a fix for media DocBook"

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
[media] em28xx: fix assignment of the eeprom data
[media] hdpvr: fix iteration over uninitialized lists in hdpvr_probe()
[media] usbtv: fix dependency
[media] usbtv: Throw corrupted frames away
[media] usbtv: Fix deinterlacing
[media] v4l2: added missing mutex.h include to v4l2-ctrls.h
[media] DocBook: upgrade media_api DocBook version to 4.2
[media] ml86v7667: fix compile warning: 'ret' set but not used
[media] s5p-g2d: Fix registration failure
[media] media: coda: Fix DT driver data pointer for i.MX27
[media] s5p-mfc: Fix input/output format reporting

+103 -104
+2 -2
Documentation/DocBook/media_api.tmpl
··· 1 1 <?xml version="1.0"?> 2 - <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 3 - "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ 2 + <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 3 + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ 4 4 <!ENTITY % media-entities SYSTEM "./media-entities.tmpl"> %media-entities; 5 5 <!ENTITY media-indices SYSTEM "./media-indices.tmpl"> 6 6
+2 -2
drivers/media/i2c/ml86v7667.c
··· 117 117 { 118 118 struct v4l2_subdev *sd = to_sd(ctrl); 119 119 struct i2c_client *client = v4l2_get_subdevdata(sd); 120 - int ret; 120 + int ret = -EINVAL; 121 121 122 122 switch (ctrl->id) { 123 123 case V4L2_CID_BRIGHTNESS: ··· 157 157 break; 158 158 } 159 159 160 - return 0; 160 + return ret; 161 161 } 162 162 163 163 static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
+1 -1
drivers/media/platform/coda.c
··· 1987 1987 1988 1988 #ifdef CONFIG_OF 1989 1989 static const struct of_device_id coda_dt_ids[] = { 1990 - { .compatible = "fsl,imx27-vpu", .data = &coda_platform_ids[CODA_IMX27] }, 1990 + { .compatible = "fsl,imx27-vpu", .data = &coda_devdata[CODA_IMX27] }, 1991 1991 { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] }, 1992 1992 { /* sentinel */ } 1993 1993 };
+1
drivers/media/platform/s5p-g2d/g2d.c
··· 784 784 } 785 785 *vfd = g2d_videodev; 786 786 vfd->lock = &dev->mutex; 787 + vfd->v4l2_dev = &dev->v4l2_dev; 787 788 ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); 788 789 if (ret) { 789 790 v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
+33 -50
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
··· 344 344 pix_mp->num_planes = 2; 345 345 /* Set pixelformat to the format in which MFC 346 346 outputs the decoded frame */ 347 - pix_mp->pixelformat = V4L2_PIX_FMT_NV12MT; 347 + pix_mp->pixelformat = ctx->dst_fmt->fourcc; 348 348 pix_mp->plane_fmt[0].bytesperline = ctx->buf_width; 349 349 pix_mp->plane_fmt[0].sizeimage = ctx->luma_size; 350 350 pix_mp->plane_fmt[1].bytesperline = ctx->buf_width; ··· 382 382 mfc_err("Unsupported format for source.\n"); 383 383 return -EINVAL; 384 384 } 385 - if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { 386 - mfc_err("Not supported format.\n"); 385 + if (fmt->codec_mode == S5P_FIMV_CODEC_NONE) { 386 + mfc_err("Unknown codec\n"); 387 387 return -EINVAL; 388 + } 389 + if (!IS_MFCV6(dev)) { 390 + if (fmt->fourcc == V4L2_PIX_FMT_VP8) { 391 + mfc_err("Not supported format.\n"); 392 + return -EINVAL; 393 + } 388 394 } 389 395 } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { 390 396 fmt = find_format(f, MFC_FMT_RAW); ··· 417 411 struct s5p_mfc_dev *dev = video_drvdata(file); 418 412 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); 419 413 int ret = 0; 420 - struct s5p_mfc_fmt *fmt; 421 414 struct v4l2_pix_format_mplane *pix_mp; 422 415 423 416 mfc_debug_enter(); ··· 430 425 goto out; 431 426 } 432 427 if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { 433 - fmt = find_format(f, MFC_FMT_RAW); 434 - if (!fmt) { 435 - mfc_err("Unsupported format for source.\n"); 436 - return -EINVAL; 437 - } 438 - if (!IS_MFCV6(dev) && (fmt->fourcc != V4L2_PIX_FMT_NV12MT)) { 439 - mfc_err("Not supported format.\n"); 440 - return -EINVAL; 441 - } else if (IS_MFCV6(dev) && 442 - (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { 443 - mfc_err("Not supported format.\n"); 444 - return -EINVAL; 445 - } 446 - ctx->dst_fmt = fmt; 447 - mfc_debug_leave(); 448 - return ret; 449 - } else if (f->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 450 - mfc_err("Wrong type error for S_FMT : %d", f->type); 451 - return -EINVAL; 452 - } 453 - fmt = find_format(f, MFC_FMT_DEC); 454 - if (!fmt || fmt->codec_mode == S5P_MFC_CODEC_NONE) { 455 - mfc_err("Unknown codec\n"); 456 - ret = -EINVAL; 428 + /* dst_fmt is validated by call to vidioc_try_fmt */ 429 + ctx->dst_fmt = find_format(f, MFC_FMT_RAW); 430 + ret = 0; 457 431 goto out; 458 - } 459 - if (fmt->type != MFC_FMT_DEC) { 460 - mfc_err("Wrong format selected, you should choose " 461 - "format for decoding\n"); 462 - ret = -EINVAL; 463 - goto out; 464 - } 465 - if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { 466 - mfc_err("Not supported format.\n"); 467 - return -EINVAL; 468 - } 469 - ctx->src_fmt = fmt; 470 - ctx->codec_mode = fmt->codec_mode; 471 - mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); 472 - pix_mp->height = 0; 473 - pix_mp->width = 0; 474 - if (pix_mp->plane_fmt[0].sizeimage) 475 - ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; 476 - else 477 - pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = 432 + } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 433 + /* src_fmt is validated by call to vidioc_try_fmt */ 434 + ctx->src_fmt = find_format(f, MFC_FMT_DEC); 435 + ctx->codec_mode = ctx->src_fmt->codec_mode; 436 + mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); 437 + pix_mp->height = 0; 438 + pix_mp->width = 0; 439 + if (pix_mp->plane_fmt[0].sizeimage) 440 + ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; 441 + else 442 + pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = 478 443 DEF_CPB_SIZE; 479 - pix_mp->plane_fmt[0].bytesperline = 0; 480 - ctx->state = MFCINST_INIT; 444 + pix_mp->plane_fmt[0].bytesperline = 0; 445 + ctx->state = MFCINST_INIT; 446 + ret = 0; 447 + goto out; 448 + } else { 449 + mfc_err("Wrong type error for S_FMT : %d", f->type); 450 + ret = -EINVAL; 451 + goto out; 452 + } 453 + 481 454 out: 482 455 mfc_debug_leave(); 483 456 return ret;
+17 -29
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
··· 906 906 907 907 static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) 908 908 { 909 + struct s5p_mfc_dev *dev = video_drvdata(file); 909 910 struct s5p_mfc_fmt *fmt; 910 911 struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; 911 912 ··· 931 930 return -EINVAL; 932 931 } 933 932 933 + if (!IS_MFCV6(dev)) { 934 + if (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16) { 935 + mfc_err("Not supported format.\n"); 936 + return -EINVAL; 937 + } 938 + } else if (IS_MFCV6(dev)) { 939 + if (fmt->fourcc == V4L2_PIX_FMT_NV12MT) { 940 + mfc_err("Not supported format.\n"); 941 + return -EINVAL; 942 + } 943 + } 944 + 934 945 if (fmt->num_planes != pix_fmt_mp->num_planes) { 935 946 mfc_err("failed to try output format\n"); 936 947 return -EINVAL; ··· 960 947 { 961 948 struct s5p_mfc_dev *dev = video_drvdata(file); 962 949 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); 963 - struct s5p_mfc_fmt *fmt; 964 950 struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; 965 951 int ret = 0; 966 952 ··· 972 960 goto out; 973 961 } 974 962 if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { 975 - fmt = find_format(f, MFC_FMT_ENC); 976 - if (!fmt) { 977 - mfc_err("failed to set capture format\n"); 978 - return -EINVAL; 979 - } 963 + /* dst_fmt is validated by call to vidioc_try_fmt */ 964 + ctx->dst_fmt = find_format(f, MFC_FMT_ENC); 980 965 ctx->state = MFCINST_INIT; 981 - ctx->dst_fmt = fmt; 982 966 ctx->codec_mode = ctx->dst_fmt->codec_mode; 983 967 ctx->enc_dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage; 984 968 pix_fmt_mp->plane_fmt[0].bytesperline = 0; ··· 995 987 } 996 988 mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); 997 989 } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 998 - fmt = find_format(f, MFC_FMT_RAW); 999 - if (!fmt) { 1000 - mfc_err("failed to set output format\n"); 1001 - return -EINVAL; 1002 - } 1003 - 1004 - if (!IS_MFCV6(dev) && 1005 - (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16)) { 1006 - mfc_err("Not supported format.\n"); 1007 - return -EINVAL; 1008 - } else if (IS_MFCV6(dev) && 1009 - (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { 1010 - mfc_err("Not supported format.\n"); 1011 - return -EINVAL; 1012 - } 1013 - 1014 - if (fmt->num_planes != pix_fmt_mp->num_planes) { 1015 - mfc_err("failed to set output format\n"); 1016 - ret = -EINVAL; 1017 - goto out; 1018 - } 1019 - ctx->src_fmt = fmt; 990 + /* src_fmt is validated by call to vidioc_try_fmt */ 991 + ctx->src_fmt = find_format(f, MFC_FMT_RAW); 1020 992 ctx->img_width = pix_fmt_mp->width; 1021 993 ctx->img_height = pix_fmt_mp->height; 1022 994 mfc_debug(2, "codec number: %d\n", ctx->src_fmt->codec_mode);
+1 -1
drivers/media/usb/em28xx/em28xx-i2c.c
··· 726 726 727 727 *eedata = data; 728 728 *eedata_len = len; 729 - dev_config = (void *)eedata; 729 + dev_config = (void *)*eedata; 730 730 731 731 switch (le16_to_cpu(dev_config->chip_conf) >> 4 & 0x3) { 732 732 case 0:
+6 -5
drivers/media/usb/hdpvr/hdpvr-core.c
··· 303 303 304 304 dev->workqueue = 0; 305 305 306 + /* init video transfer queues first of all */ 307 + /* to prevent oops in hdpvr_delete() on error paths */ 308 + INIT_LIST_HEAD(&dev->free_buff_list); 309 + INIT_LIST_HEAD(&dev->rec_buff_list); 310 + 306 311 /* register v4l2_device early so it can be used for printks */ 307 312 if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) { 308 313 dev_err(&interface->dev, "v4l2_device_register failed\n"); ··· 329 324 dev->workqueue = create_singlethread_workqueue("hdpvr_buffer"); 330 325 if (!dev->workqueue) 331 326 goto error; 332 - 333 - /* init video transfer queues */ 334 - INIT_LIST_HEAD(&dev->free_buff_list); 335 - INIT_LIST_HEAD(&dev->rec_buff_list); 336 327 337 328 dev->options = hdpvr_default_options; 338 329 ··· 406 405 video_nr[atomic_inc_return(&dev_nr)]); 407 406 if (retval < 0) { 408 407 v4l2_err(&dev->v4l2_dev, "registering videodev failed\n"); 409 - goto error; 408 + goto reg_fail; 410 409 } 411 410 412 411 /* let the user know what node this device is now attached to */
+1 -1
drivers/media/usb/usbtv/Kconfig
··· 1 1 config VIDEO_USBTV 2 2 tristate "USBTV007 video capture support" 3 - depends on VIDEO_DEV 3 + depends on VIDEO_V4L2 4 4 select VIDEOBUF2_VMALLOC 5 5 6 6 ---help---
+38 -13
drivers/media/usb/usbtv/usbtv.c
··· 57 57 #define USBTV_CHUNK_SIZE 256 58 58 #define USBTV_CHUNK 240 59 59 #define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \ 60 - / 2 / USBTV_CHUNK) 60 + / 4 / USBTV_CHUNK) 61 61 62 62 /* Chunk header. */ 63 63 #define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ ··· 89 89 /* Number of currently processed frame, useful find 90 90 * out when a new one begins. */ 91 91 u32 frame_id; 92 + int chunks_done; 92 93 93 94 int iso_size; 94 95 unsigned int sequence; ··· 203 202 return 0; 204 203 } 205 204 205 + /* Copy data from chunk into a frame buffer, deinterlacing the data 206 + * into every second line. Unfortunately, they don't align nicely into 207 + * 720 pixel lines, as the chunk is 240 words long, which is 480 pixels. 208 + * Therefore, we break down the chunk into two halves before copyting, 209 + * so that we can interleave a line if needed. */ 210 + static void usbtv_chunk_to_vbuf(u32 *frame, u32 *src, int chunk_no, int odd) 211 + { 212 + int half; 213 + 214 + for (half = 0; half < 2; half++) { 215 + int part_no = chunk_no * 2 + half; 216 + int line = part_no / 3; 217 + int part_index = (line * 2 + !odd) * 3 + (part_no % 3); 218 + 219 + u32 *dst = &frame[part_index * USBTV_CHUNK/2]; 220 + memcpy(dst, src, USBTV_CHUNK/2 * sizeof(*src)); 221 + src += USBTV_CHUNK/2; 222 + } 223 + } 224 + 206 225 /* Called for each 256-byte image chunk. 207 226 * First word identifies the chunk, followed by 240 words of image 208 227 * data and padding. */ ··· 239 218 frame_id = USBTV_FRAME_ID(chunk); 240 219 odd = USBTV_ODD(chunk); 241 220 chunk_no = USBTV_CHUNK_NO(chunk); 242 - 243 - /* Deinterlace. TODO: Use interlaced frame format. */ 244 - chunk_no = (chunk_no - chunk_no % 3) * 2 + chunk_no % 3; 245 - chunk_no += !odd * 3; 246 - 247 221 if (chunk_no >= USBTV_CHUNKS) 248 222 return; 249 223 250 224 /* Beginning of a frame. */ 251 - if (chunk_no == 0) 225 + if (chunk_no == 0) { 252 226 usbtv->frame_id = frame_id; 227 + usbtv->chunks_done = 0; 228 + } 229 + 230 + if (usbtv->frame_id != frame_id) 231 + return; 253 232 254 233 spin_lock_irqsave(&usbtv->buflock, flags); 255 234 if (list_empty(&usbtv->bufs)) { ··· 262 241 buf = list_first_entry(&usbtv->bufs, struct usbtv_buf, list); 263 242 frame = vb2_plane_vaddr(&buf->vb, 0); 264 243 265 - /* Copy the chunk. */ 266 - memcpy(&frame[chunk_no * USBTV_CHUNK], &chunk[1], 267 - USBTV_CHUNK * sizeof(chunk[1])); 244 + /* Copy the chunk data. */ 245 + usbtv_chunk_to_vbuf(frame, &chunk[1], chunk_no, odd); 246 + usbtv->chunks_done++; 268 247 269 248 /* Last chunk in a frame, signalling an end */ 270 - if (usbtv->frame_id && chunk_no == USBTV_CHUNKS-1) { 249 + if (odd && chunk_no == USBTV_CHUNKS-1) { 271 250 int size = vb2_plane_size(&buf->vb, 0); 251 + enum vb2_buffer_state state = usbtv->chunks_done == 252 + USBTV_CHUNKS ? 253 + VB2_BUF_STATE_DONE : 254 + VB2_BUF_STATE_ERROR; 272 255 273 256 buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; 274 257 buf->vb.v4l2_buf.sequence = usbtv->sequence++; 275 258 v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); 276 259 vb2_set_plane_payload(&buf->vb, 0, size); 277 - vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE); 260 + vb2_buffer_done(&buf->vb, state); 278 261 list_del(&buf->list); 279 262 } 280 263 ··· 543 518 if (*nbuffers < 2) 544 519 *nbuffers = 2; 545 520 *nplanes = 1; 546 - sizes[0] = USBTV_CHUNK * USBTV_CHUNKS * sizeof(u32); 521 + sizes[0] = USBTV_WIDTH * USBTV_HEIGHT / 2 * sizeof(u32); 547 522 548 523 return 0; 549 524 }
+1
include/media/v4l2-ctrls.h
··· 22 22 #define _V4L2_CTRLS_H 23 23 24 24 #include <linux/list.h> 25 + #include <linux/mutex.h> 25 26 #include <linux/videodev2.h> 26 27 27 28 /* forward references */