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:
- Compilation fixes for GCC < 4.4.6
- one Kbuild dependency select fix (selecting videobuf on msi3101)
- driver fixes on tda10071, e4000, msi3101, soc_camera, s5p-jpeg,
saa7134 and adv7511
- some device quirks needed to make them work properly
- some videobuf2 core regression fixes for some features used only on
embedded drivers

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
[media] saa7134: Fix crash when device is closed before streamoff
[media] adv7511: fix error return code in adv7511_probe()
[media] ths8200: fix compilation with GCC < 4.4.6
[media] ad9389b: fix compilation with GCC < 4.4.6
[media] adv7511: fix compilation with GCC < 4.4.6
[media] adv7842: fix compilation with GCC < 4.4.6
[media] s5p-jpeg: Initialize vfd_decoder->vfl_dir field
[media] videobuf2-dc: Fix support for mappings without struct page in userptr mode
[media] vb2: Allow queuing OUTPUT buffers with zeroed 'bytesused'
[media] mx3-camera: locking cleanup in mx3_videobuf_queue()
[media] sh_vou: almost forever loop in sh_vou_try_fmt_vid_out()
[media] tda10071: change firmware download condition
[media] msi3101: correct max videobuf2 alloc
[media] Add HCL T12Rg-H to STK webcam upside-down table
[media] msi3101: Kconfig select VIDEOBUF2_VMALLOC
[media] msi3101: msi3101_ioctl_ops can be static
[media] e4000: fix PLL calc bug on 32-bit arch
[media] uvcvideo: quirk PROBE_DEF for Microsoft Lifecam NX-3000
[media] uvcvideo: quirk PROBE_DEF for Dell SP2008WFP monitor

+158 -65
+1 -8
drivers/media/dvb-frontends/tda10071.c
··· 912 912 { 0xd5, 0x03, 0x03 }, 913 913 }; 914 914 915 - /* firmware status */ 916 - ret = tda10071_rd_reg(priv, 0x51, &tmp); 917 - if (ret) 918 - goto error; 919 - 920 - if (!tmp) { 915 + if (priv->warm) { 921 916 /* warm state - wake up device from sleep */ 922 - priv->warm = 1; 923 917 924 918 for (i = 0; i < ARRAY_SIZE(tab); i++) { 925 919 ret = tda10071_wr_reg_mask(priv, tab[i].reg, ··· 931 937 goto error; 932 938 } else { 933 939 /* cold state - try to download firmware */ 934 - priv->warm = 0; 935 940 936 941 /* request the firmware, this will block and timeout */ 937 942 ret = request_firmware(&fw, fw_file, priv->i2c->dev.parent);
+6 -9
drivers/media/i2c/ad9389b.c
··· 628 628 629 629 static const struct v4l2_dv_timings_cap ad9389b_timings_cap = { 630 630 .type = V4L2_DV_BT_656_1120, 631 - .bt = { 632 - .max_width = 1920, 633 - .max_height = 1200, 634 - .min_pixelclock = 25000000, 635 - .max_pixelclock = 170000000, 636 - .standards = V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | 631 + /* keep this initialization for compatibility with GCC < 4.4.6 */ 632 + .reserved = { 0 }, 633 + V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 170000000, 634 + V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | 637 635 V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, 638 - .capabilities = V4L2_DV_BT_CAP_PROGRESSIVE | 639 - V4L2_DV_BT_CAP_REDUCED_BLANKING | V4L2_DV_BT_CAP_CUSTOM, 640 - }, 636 + V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | 637 + V4L2_DV_BT_CAP_CUSTOM) 641 638 }; 642 639 643 640 static int ad9389b_s_dv_timings(struct v4l2_subdev *sd,
+9 -9
drivers/media/i2c/adv7511.c
··· 119 119 120 120 static const struct v4l2_dv_timings_cap adv7511_timings_cap = { 121 121 .type = V4L2_DV_BT_656_1120, 122 - .bt = { 123 - .max_width = ADV7511_MAX_WIDTH, 124 - .max_height = ADV7511_MAX_HEIGHT, 125 - .min_pixelclock = ADV7511_MIN_PIXELCLOCK, 126 - .max_pixelclock = ADV7511_MAX_PIXELCLOCK, 127 - .standards = V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | 122 + /* keep this initialization for compatibility with GCC < 4.4.6 */ 123 + .reserved = { 0 }, 124 + V4L2_INIT_BT_TIMINGS(0, ADV7511_MAX_WIDTH, 0, ADV7511_MAX_HEIGHT, 125 + ADV7511_MIN_PIXELCLOCK, ADV7511_MAX_PIXELCLOCK, 126 + V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | 128 127 V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, 129 - .capabilities = V4L2_DV_BT_CAP_PROGRESSIVE | 130 - V4L2_DV_BT_CAP_REDUCED_BLANKING | V4L2_DV_BT_CAP_CUSTOM, 131 - }, 128 + V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | 129 + V4L2_DV_BT_CAP_CUSTOM) 132 130 }; 133 131 134 132 static inline struct adv7511_state *get_adv7511_state(struct v4l2_subdev *sd) ··· 1124 1126 state->i2c_edid = i2c_new_dummy(client->adapter, state->i2c_edid_addr >> 1); 1125 1127 if (state->i2c_edid == NULL) { 1126 1128 v4l2_err(sd, "failed to register edid i2c client\n"); 1129 + err = -ENOMEM; 1127 1130 goto err_entity; 1128 1131 } 1129 1132 ··· 1132 1133 state->work_queue = create_singlethread_workqueue(sd->name); 1133 1134 if (state->work_queue == NULL) { 1134 1135 v4l2_err(sd, "could not create workqueue\n"); 1136 + err = -ENOMEM; 1135 1137 goto err_unreg_cec; 1136 1138 } 1137 1139
+12 -18
drivers/media/i2c/adv7842.c
··· 546 546 547 547 static const struct v4l2_dv_timings_cap adv7842_timings_cap_analog = { 548 548 .type = V4L2_DV_BT_656_1120, 549 - .bt = { 550 - .max_width = 1920, 551 - .max_height = 1200, 552 - .min_pixelclock = 25000000, 553 - .max_pixelclock = 170000000, 554 - .standards = V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | 549 + /* keep this initialization for compatibility with GCC < 4.4.6 */ 550 + .reserved = { 0 }, 551 + V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 170000000, 552 + V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | 555 553 V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, 556 - .capabilities = V4L2_DV_BT_CAP_PROGRESSIVE | 557 - V4L2_DV_BT_CAP_REDUCED_BLANKING | V4L2_DV_BT_CAP_CUSTOM, 558 - }, 554 + V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | 555 + V4L2_DV_BT_CAP_CUSTOM) 559 556 }; 560 557 561 558 static const struct v4l2_dv_timings_cap adv7842_timings_cap_digital = { 562 559 .type = V4L2_DV_BT_656_1120, 563 - .bt = { 564 - .max_width = 1920, 565 - .max_height = 1200, 566 - .min_pixelclock = 25000000, 567 - .max_pixelclock = 225000000, 568 - .standards = V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | 560 + /* keep this initialization for compatibility with GCC < 4.4.6 */ 561 + .reserved = { 0 }, 562 + V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 225000000, 563 + V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | 569 564 V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, 570 - .capabilities = V4L2_DV_BT_CAP_PROGRESSIVE | 571 - V4L2_DV_BT_CAP_REDUCED_BLANKING | V4L2_DV_BT_CAP_CUSTOM, 572 - }, 565 + V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | 566 + V4L2_DV_BT_CAP_CUSTOM) 573 567 }; 574 568 575 569 static inline const struct v4l2_dv_timings_cap *
+4 -8
drivers/media/i2c/ths8200.c
··· 46 46 47 47 static const struct v4l2_dv_timings_cap ths8200_timings_cap = { 48 48 .type = V4L2_DV_BT_656_1120, 49 - .bt = { 50 - .max_width = 1920, 51 - .max_height = 1080, 52 - .min_pixelclock = 25000000, 53 - .max_pixelclock = 148500000, 54 - .standards = V4L2_DV_BT_STD_CEA861, 55 - .capabilities = V4L2_DV_BT_CAP_PROGRESSIVE, 56 - }, 49 + /* keep this initialization for compatibility with GCC < 4.4.6 */ 50 + .reserved = { 0 }, 51 + V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1080, 25000000, 148500000, 52 + V4L2_DV_BT_STD_CEA861, V4L2_DV_BT_CAP_PROGRESSIVE) 57 53 }; 58 54 59 55 static inline struct ths8200_state *to_state(struct v4l2_subdev *sd)
+1
drivers/media/pci/saa7134/saa7134-video.c
··· 1455 1455 1456 1456 /* stop video capture */ 1457 1457 if (res_check(fh, RESOURCE_VIDEO)) { 1458 + pm_qos_remove_request(&dev->qos_request); 1458 1459 videobuf_streamoff(&fh->cap); 1459 1460 res_free(dev,fh,RESOURCE_VIDEO); 1460 1461 }
+1
drivers/media/platform/s5p-jpeg/jpeg-core.c
··· 1423 1423 jpeg->vfd_decoder->release = video_device_release; 1424 1424 jpeg->vfd_decoder->lock = &jpeg->lock; 1425 1425 jpeg->vfd_decoder->v4l2_dev = &jpeg->v4l2_dev; 1426 + jpeg->vfd_decoder->vfl_dir = VFL_DIR_M2M; 1426 1427 1427 1428 ret = video_register_device(jpeg->vfd_decoder, VFL_TYPE_GRABBER, -1); 1428 1429 if (ret) {
+1 -1
drivers/media/platform/sh_vou.c
··· 776 776 v4l_bound_align_image(&pix->width, 0, VOU_MAX_IMAGE_WIDTH, 1, 777 777 &pix->height, 0, VOU_MAX_IMAGE_HEIGHT, 1, 0); 778 778 779 - for (i = 0; ARRAY_SIZE(vou_fmt); i++) 779 + for (i = 0; i < ARRAY_SIZE(vou_fmt); i++) 780 780 if (vou_fmt[i].pfmt == pix->pixelformat) 781 781 return 0; 782 782
+2 -3
drivers/media/platform/soc_camera/mx3_camera.c
··· 266 266 struct idmac_channel *ichan = mx3_cam->idmac_channel[0]; 267 267 struct idmac_video_param *video = &ichan->params.video; 268 268 const struct soc_mbus_pixelfmt *host_fmt = icd->current_fmt->host_fmt; 269 - unsigned long flags; 270 269 dma_cookie_t cookie; 271 270 size_t new_size; 272 271 ··· 327 328 memset(vb2_plane_vaddr(vb, 0), 0xaa, vb2_get_plane_payload(vb, 0)); 328 329 #endif 329 330 330 - spin_lock_irqsave(&mx3_cam->lock, flags); 331 + spin_lock_irq(&mx3_cam->lock); 331 332 list_add_tail(&buf->queue, &mx3_cam->capture); 332 333 333 334 if (!mx3_cam->active) ··· 350 351 if (mx3_cam->active == buf) 351 352 mx3_cam->active = NULL; 352 353 353 - spin_unlock_irqrestore(&mx3_cam->lock, flags); 354 + spin_unlock_irq(&mx3_cam->lock); 354 355 error: 355 356 vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); 356 357 }
+2 -1
drivers/media/tuners/e4000.c
··· 19 19 */ 20 20 21 21 #include "e4000_priv.h" 22 + #include <linux/math64.h> 22 23 23 24 /* write multiple registers */ 24 25 static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) ··· 234 233 * or more. 235 234 */ 236 235 f_vco = c->frequency * e4000_pll_lut[i].mul; 237 - sigma_delta = 0x10000UL * (f_vco % priv->cfg->clock) / priv->cfg->clock; 236 + sigma_delta = div_u64(0x10000ULL * (f_vco % priv->cfg->clock), priv->cfg->clock); 238 237 buf[0] = f_vco / priv->cfg->clock; 239 238 buf[1] = (sigma_delta >> 0) & 0xff; 240 239 buf[2] = (sigma_delta >> 8) & 0xff;
+7
drivers/media/usb/stkwebcam/stk-webcam.c
··· 111 111 DMI_MATCH(DMI_PRODUCT_NAME, "F3JC") 112 112 } 113 113 }, 114 + { 115 + .ident = "T12Rg-H", 116 + .matches = { 117 + DMI_MATCH(DMI_SYS_VENDOR, "HCL Infosystems Limited"), 118 + DMI_MATCH(DMI_PRODUCT_NAME, "T12Rg-H") 119 + } 120 + }, 114 121 {} 115 122 }; 116 123
+18
drivers/media/usb/uvc/uvc_driver.c
··· 2090 2090 .bInterfaceSubClass = 1, 2091 2091 .bInterfaceProtocol = 0, 2092 2092 .driver_info = UVC_QUIRK_PROBE_MINMAX }, 2093 + /* Microsoft Lifecam NX-3000 */ 2094 + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE 2095 + | USB_DEVICE_ID_MATCH_INT_INFO, 2096 + .idVendor = 0x045e, 2097 + .idProduct = 0x0721, 2098 + .bInterfaceClass = USB_CLASS_VIDEO, 2099 + .bInterfaceSubClass = 1, 2100 + .bInterfaceProtocol = 0, 2101 + .driver_info = UVC_QUIRK_PROBE_DEF }, 2093 2102 /* Microsoft Lifecam VX-7000 */ 2094 2103 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE 2095 2104 | USB_DEVICE_ID_MATCH_INT_INFO, ··· 2179 2170 | USB_DEVICE_ID_MATCH_INT_INFO, 2180 2171 .idVendor = 0x05a9, 2181 2172 .idProduct = 0x2640, 2173 + .bInterfaceClass = USB_CLASS_VIDEO, 2174 + .bInterfaceSubClass = 1, 2175 + .bInterfaceProtocol = 0, 2176 + .driver_info = UVC_QUIRK_PROBE_DEF }, 2177 + /* Dell SP2008WFP Monitor */ 2178 + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE 2179 + | USB_DEVICE_ID_MATCH_INT_INFO, 2180 + .idVendor = 0x05a9, 2181 + .idProduct = 0x2641, 2182 2182 .bInterfaceClass = USB_CLASS_VIDEO, 2183 2183 .bInterfaceSubClass = 1, 2184 2184 .bInterfaceProtocol = 0,
+3 -1
drivers/media/v4l2-core/videobuf2-core.c
··· 353 353 354 354 if (b->m.planes[plane].bytesused > length) 355 355 return -EINVAL; 356 - if (b->m.planes[plane].data_offset >= 356 + 357 + if (b->m.planes[plane].data_offset > 0 && 358 + b->m.planes[plane].data_offset >= 357 359 b->m.planes[plane].bytesused) 358 360 return -EINVAL; 359 361 }
+82 -5
drivers/media/v4l2-core/videobuf2-dma-contig.c
··· 423 423 return !!(vma->vm_flags & (VM_IO | VM_PFNMAP)); 424 424 } 425 425 426 + static int vb2_dc_get_user_pfn(unsigned long start, int n_pages, 427 + struct vm_area_struct *vma, unsigned long *res) 428 + { 429 + unsigned long pfn, start_pfn, prev_pfn; 430 + unsigned int i; 431 + int ret; 432 + 433 + if (!vma_is_io(vma)) 434 + return -EFAULT; 435 + 436 + ret = follow_pfn(vma, start, &pfn); 437 + if (ret) 438 + return ret; 439 + 440 + start_pfn = pfn; 441 + start += PAGE_SIZE; 442 + 443 + for (i = 1; i < n_pages; ++i, start += PAGE_SIZE) { 444 + prev_pfn = pfn; 445 + ret = follow_pfn(vma, start, &pfn); 446 + 447 + if (ret) { 448 + pr_err("no page for address %lu\n", start); 449 + return ret; 450 + } 451 + if (pfn != prev_pfn + 1) 452 + return -EINVAL; 453 + } 454 + 455 + *res = start_pfn; 456 + return 0; 457 + } 458 + 426 459 static int vb2_dc_get_user_pages(unsigned long start, struct page **pages, 427 460 int n_pages, struct vm_area_struct *vma, int write) 428 461 { ··· 465 432 for (i = 0; i < n_pages; ++i, start += PAGE_SIZE) { 466 433 unsigned long pfn; 467 434 int ret = follow_pfn(vma, start, &pfn); 435 + 436 + if (!pfn_valid(pfn)) 437 + return -EINVAL; 468 438 469 439 if (ret) { 470 440 pr_err("no page for address %lu\n", start); ··· 504 468 struct vb2_dc_buf *buf = buf_priv; 505 469 struct sg_table *sgt = buf->dma_sgt; 506 470 507 - dma_unmap_sg(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); 508 - if (!vma_is_io(buf->vma)) 509 - vb2_dc_sgt_foreach_page(sgt, vb2_dc_put_dirty_page); 471 + if (sgt) { 472 + dma_unmap_sg(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); 473 + if (!vma_is_io(buf->vma)) 474 + vb2_dc_sgt_foreach_page(sgt, vb2_dc_put_dirty_page); 510 475 511 - sg_free_table(sgt); 512 - kfree(sgt); 476 + sg_free_table(sgt); 477 + kfree(sgt); 478 + } 513 479 vb2_put_vma(buf->vma); 514 480 kfree(buf); 515 481 } 482 + 483 + /* 484 + * For some kind of reserved memory there might be no struct page available, 485 + * so all that can be done to support such 'pages' is to try to convert 486 + * pfn to dma address or at the last resort just assume that 487 + * dma address == physical address (like it has been assumed in earlier version 488 + * of videobuf2-dma-contig 489 + */ 490 + 491 + #ifdef __arch_pfn_to_dma 492 + static inline dma_addr_t vb2_dc_pfn_to_dma(struct device *dev, unsigned long pfn) 493 + { 494 + return (dma_addr_t)__arch_pfn_to_dma(dev, pfn); 495 + } 496 + #elif defined(__pfn_to_bus) 497 + static inline dma_addr_t vb2_dc_pfn_to_dma(struct device *dev, unsigned long pfn) 498 + { 499 + return (dma_addr_t)__pfn_to_bus(pfn); 500 + } 501 + #elif defined(__pfn_to_phys) 502 + static inline dma_addr_t vb2_dc_pfn_to_dma(struct device *dev, unsigned long pfn) 503 + { 504 + return (dma_addr_t)__pfn_to_phys(pfn); 505 + } 506 + #else 507 + static inline dma_addr_t vb2_dc_pfn_to_dma(struct device *dev, unsigned long pfn) 508 + { 509 + /* really, we cannot do anything better at this point */ 510 + return (dma_addr_t)(pfn) << PAGE_SHIFT; 511 + } 512 + #endif 516 513 517 514 static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, 518 515 unsigned long size, int write) ··· 617 548 /* extract page list from userspace mapping */ 618 549 ret = vb2_dc_get_user_pages(start, pages, n_pages, vma, write); 619 550 if (ret) { 551 + unsigned long pfn; 552 + if (vb2_dc_get_user_pfn(start, n_pages, vma, &pfn) == 0) { 553 + buf->dma_addr = vb2_dc_pfn_to_dma(buf->dev, pfn); 554 + buf->size = size; 555 + kfree(pages); 556 + return buf; 557 + } 558 + 620 559 pr_err("failed to get user pages\n"); 621 560 goto fail_vma; 622 561 }
+1
drivers/staging/media/msi3101/Kconfig
··· 1 1 config USB_MSI3101 2 2 tristate "Mirics MSi3101 SDR Dongle" 3 3 depends on USB && VIDEO_DEV && VIDEO_V4L2 4 + select VIDEOBUF2_VMALLOC
+8 -2
drivers/staging/media/msi3101/sdr-msi3101.c
··· 1131 1131 /* Absolute min and max number of buffers available for mmap() */ 1132 1132 *nbuffers = 32; 1133 1133 *nplanes = 1; 1134 - sizes[0] = PAGE_ALIGN(3 * 3072); /* 3 * 768 * 4 */ 1134 + /* 1135 + * 3, wMaxPacketSize 3x 1024 bytes 1136 + * 504, max IQ sample pairs per 1024 frame 1137 + * 2, two samples, I and Q 1138 + * 4, 32-bit float 1139 + */ 1140 + sizes[0] = PAGE_ALIGN(3 * 504 * 2 * 4); /* = 12096 */ 1135 1141 dev_dbg(&s->udev->dev, "%s: nbuffers=%d sizes[0]=%d\n", 1136 1142 __func__, *nbuffers, sizes[0]); 1137 1143 return 0; ··· 1663 1657 f->frequency * 625UL / 10UL); 1664 1658 } 1665 1659 1666 - const struct v4l2_ioctl_ops msi3101_ioctl_ops = { 1660 + static const struct v4l2_ioctl_ops msi3101_ioctl_ops = { 1667 1661 .vidioc_querycap = msi3101_querycap, 1668 1662 1669 1663 .vidioc_enum_input = msi3101_enum_input,