diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-10-23 02:52:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-10-23 02:52:36 -0400 |
commit | f4e5e14f53691871c25ec3925010ab4edbf73391 (patch) | |
tree | 9e94c3c2eadc812c4b65dfe62d09ba127d134ef8 | |
parent | 0d645a8b823b4de4b4644312df4deb2e61213091 (diff) | |
parent | 9c9cff55bf4f13dc2fffb5abe466f13e4ac155f9 (diff) |
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
-rw-r--r-- | drivers/media/dvb-frontends/tda10071.c | 9 | ||||
-rw-r--r-- | drivers/media/i2c/ad9389b.c | 15 | ||||
-rw-r--r-- | drivers/media/i2c/adv7511.c | 18 | ||||
-rw-r--r-- | drivers/media/i2c/adv7842.c | 30 | ||||
-rw-r--r-- | drivers/media/i2c/ths8200.c | 12 | ||||
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-video.c | 1 | ||||
-rw-r--r-- | drivers/media/platform/s5p-jpeg/jpeg-core.c | 1 | ||||
-rw-r--r-- | drivers/media/platform/sh_vou.c | 2 | ||||
-rw-r--r-- | drivers/media/platform/soc_camera/mx3_camera.c | 5 | ||||
-rw-r--r-- | drivers/media/tuners/e4000.c | 3 | ||||
-rw-r--r-- | drivers/media/usb/stkwebcam/stk-webcam.c | 7 | ||||
-rw-r--r-- | drivers/media/usb/uvc/uvc_driver.c | 18 | ||||
-rw-r--r-- | drivers/media/v4l2-core/videobuf2-core.c | 4 | ||||
-rw-r--r-- | drivers/media/v4l2-core/videobuf2-dma-contig.c | 87 | ||||
-rw-r--r-- | drivers/staging/media/msi3101/Kconfig | 1 | ||||
-rw-r--r-- | drivers/staging/media/msi3101/sdr-msi3101.c | 10 |
16 files changed, 158 insertions, 65 deletions
diff --git a/drivers/media/dvb-frontends/tda10071.c b/drivers/media/dvb-frontends/tda10071.c index 2521f7e23018..e79749cfec81 100644 --- a/drivers/media/dvb-frontends/tda10071.c +++ b/drivers/media/dvb-frontends/tda10071.c | |||
@@ -912,14 +912,8 @@ static int tda10071_init(struct dvb_frontend *fe) | |||
912 | { 0xd5, 0x03, 0x03 }, | 912 | { 0xd5, 0x03, 0x03 }, |
913 | }; | 913 | }; |
914 | 914 | ||
915 | /* firmware status */ | 915 | if (priv->warm) { |
916 | ret = tda10071_rd_reg(priv, 0x51, &tmp); | ||
917 | if (ret) | ||
918 | goto error; | ||
919 | |||
920 | if (!tmp) { | ||
921 | /* warm state - wake up device from sleep */ | 916 | /* warm state - wake up device from sleep */ |
922 | priv->warm = 1; | ||
923 | 917 | ||
924 | for (i = 0; i < ARRAY_SIZE(tab); i++) { | 918 | for (i = 0; i < ARRAY_SIZE(tab); i++) { |
925 | ret = tda10071_wr_reg_mask(priv, tab[i].reg, | 919 | ret = tda10071_wr_reg_mask(priv, tab[i].reg, |
@@ -937,7 +931,6 @@ static int tda10071_init(struct dvb_frontend *fe) | |||
937 | goto error; | 931 | goto error; |
938 | } else { | 932 | } else { |
939 | /* cold state - try to download firmware */ | 933 | /* cold state - try to download firmware */ |
940 | priv->warm = 0; | ||
941 | 934 | ||
942 | /* request the firmware, this will block and timeout */ | 935 | /* request the firmware, this will block and timeout */ |
943 | ret = request_firmware(&fw, fw_file, priv->i2c->dev.parent); | 936 | ret = request_firmware(&fw, fw_file, priv->i2c->dev.parent); |
diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c index bb0c99d7a4f1..b06a7e54ee0d 100644 --- a/drivers/media/i2c/ad9389b.c +++ b/drivers/media/i2c/ad9389b.c | |||
@@ -628,16 +628,13 @@ static int ad9389b_s_stream(struct v4l2_subdev *sd, int enable) | |||
628 | 628 | ||
629 | static const struct v4l2_dv_timings_cap ad9389b_timings_cap = { | 629 | static const struct v4l2_dv_timings_cap ad9389b_timings_cap = { |
630 | .type = V4L2_DV_BT_656_1120, | 630 | .type = V4L2_DV_BT_656_1120, |
631 | .bt = { | 631 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
632 | .max_width = 1920, | 632 | .reserved = { 0 }, |
633 | .max_height = 1200, | 633 | V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 170000000, |
634 | .min_pixelclock = 25000000, | 634 | V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | |
635 | .max_pixelclock = 170000000, | ||
636 | .standards = V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | | ||
637 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, | 635 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, |
638 | .capabilities = V4L2_DV_BT_CAP_PROGRESSIVE | | 636 | V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | |
639 | V4L2_DV_BT_CAP_REDUCED_BLANKING | V4L2_DV_BT_CAP_CUSTOM, | 637 | V4L2_DV_BT_CAP_CUSTOM) |
640 | }, | ||
641 | }; | 638 | }; |
642 | 639 | ||
643 | static int ad9389b_s_dv_timings(struct v4l2_subdev *sd, | 640 | static int ad9389b_s_dv_timings(struct v4l2_subdev *sd, |
diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c index 7a576097471f..7c8d971f1f61 100644 --- a/drivers/media/i2c/adv7511.c +++ b/drivers/media/i2c/adv7511.c | |||
@@ -119,16 +119,14 @@ static int adv7511_s_clock_freq(struct v4l2_subdev *sd, u32 freq); | |||
119 | 119 | ||
120 | static const struct v4l2_dv_timings_cap adv7511_timings_cap = { | 120 | static const struct v4l2_dv_timings_cap adv7511_timings_cap = { |
121 | .type = V4L2_DV_BT_656_1120, | 121 | .type = V4L2_DV_BT_656_1120, |
122 | .bt = { | 122 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
123 | .max_width = ADV7511_MAX_WIDTH, | 123 | .reserved = { 0 }, |
124 | .max_height = ADV7511_MAX_HEIGHT, | 124 | V4L2_INIT_BT_TIMINGS(0, ADV7511_MAX_WIDTH, 0, ADV7511_MAX_HEIGHT, |
125 | .min_pixelclock = ADV7511_MIN_PIXELCLOCK, | 125 | ADV7511_MIN_PIXELCLOCK, ADV7511_MAX_PIXELCLOCK, |
126 | .max_pixelclock = ADV7511_MAX_PIXELCLOCK, | 126 | V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | |
127 | .standards = V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | | ||
128 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, | 127 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, |
129 | .capabilities = V4L2_DV_BT_CAP_PROGRESSIVE | | 128 | V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | |
130 | V4L2_DV_BT_CAP_REDUCED_BLANKING | V4L2_DV_BT_CAP_CUSTOM, | 129 | V4L2_DV_BT_CAP_CUSTOM) |
131 | }, | ||
132 | }; | 130 | }; |
133 | 131 | ||
134 | static inline struct adv7511_state *get_adv7511_state(struct v4l2_subdev *sd) | 132 | static inline struct adv7511_state *get_adv7511_state(struct v4l2_subdev *sd) |
@@ -1126,6 +1124,7 @@ static int adv7511_probe(struct i2c_client *client, const struct i2c_device_id * | |||
1126 | state->i2c_edid = i2c_new_dummy(client->adapter, state->i2c_edid_addr >> 1); | 1124 | state->i2c_edid = i2c_new_dummy(client->adapter, state->i2c_edid_addr >> 1); |
1127 | if (state->i2c_edid == NULL) { | 1125 | if (state->i2c_edid == NULL) { |
1128 | v4l2_err(sd, "failed to register edid i2c client\n"); | 1126 | v4l2_err(sd, "failed to register edid i2c client\n"); |
1127 | err = -ENOMEM; | ||
1129 | goto err_entity; | 1128 | goto err_entity; |
1130 | } | 1129 | } |
1131 | 1130 | ||
@@ -1133,6 +1132,7 @@ static int adv7511_probe(struct i2c_client *client, const struct i2c_device_id * | |||
1133 | state->work_queue = create_singlethread_workqueue(sd->name); | 1132 | state->work_queue = create_singlethread_workqueue(sd->name); |
1134 | if (state->work_queue == NULL) { | 1133 | if (state->work_queue == NULL) { |
1135 | v4l2_err(sd, "could not create workqueue\n"); | 1134 | v4l2_err(sd, "could not create workqueue\n"); |
1135 | err = -ENOMEM; | ||
1136 | goto err_unreg_cec; | 1136 | goto err_unreg_cec; |
1137 | } | 1137 | } |
1138 | 1138 | ||
diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c index d1748901337c..22f729d66a96 100644 --- a/drivers/media/i2c/adv7842.c +++ b/drivers/media/i2c/adv7842.c | |||
@@ -546,30 +546,24 @@ static inline bool is_digital_input(struct v4l2_subdev *sd) | |||
546 | 546 | ||
547 | static const struct v4l2_dv_timings_cap adv7842_timings_cap_analog = { | 547 | static const struct v4l2_dv_timings_cap adv7842_timings_cap_analog = { |
548 | .type = V4L2_DV_BT_656_1120, | 548 | .type = V4L2_DV_BT_656_1120, |
549 | .bt = { | 549 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
550 | .max_width = 1920, | 550 | .reserved = { 0 }, |
551 | .max_height = 1200, | 551 | V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 170000000, |
552 | .min_pixelclock = 25000000, | 552 | V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | |
553 | .max_pixelclock = 170000000, | ||
554 | .standards = V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | | ||
555 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, | 553 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, |
556 | .capabilities = V4L2_DV_BT_CAP_PROGRESSIVE | | 554 | V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | |
557 | V4L2_DV_BT_CAP_REDUCED_BLANKING | V4L2_DV_BT_CAP_CUSTOM, | 555 | V4L2_DV_BT_CAP_CUSTOM) |
558 | }, | ||
559 | }; | 556 | }; |
560 | 557 | ||
561 | static const struct v4l2_dv_timings_cap adv7842_timings_cap_digital = { | 558 | static const struct v4l2_dv_timings_cap adv7842_timings_cap_digital = { |
562 | .type = V4L2_DV_BT_656_1120, | 559 | .type = V4L2_DV_BT_656_1120, |
563 | .bt = { | 560 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
564 | .max_width = 1920, | 561 | .reserved = { 0 }, |
565 | .max_height = 1200, | 562 | V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 225000000, |
566 | .min_pixelclock = 25000000, | 563 | V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | |
567 | .max_pixelclock = 225000000, | ||
568 | .standards = V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | | ||
569 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, | 564 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, |
570 | .capabilities = V4L2_DV_BT_CAP_PROGRESSIVE | | 565 | V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | |
571 | V4L2_DV_BT_CAP_REDUCED_BLANKING | V4L2_DV_BT_CAP_CUSTOM, | 566 | V4L2_DV_BT_CAP_CUSTOM) |
572 | }, | ||
573 | }; | 567 | }; |
574 | 568 | ||
575 | static inline const struct v4l2_dv_timings_cap * | 569 | static inline const struct v4l2_dv_timings_cap * |
diff --git a/drivers/media/i2c/ths8200.c b/drivers/media/i2c/ths8200.c index a58a8f663ffb..d9f65d7e3e58 100644 --- a/drivers/media/i2c/ths8200.c +++ b/drivers/media/i2c/ths8200.c | |||
@@ -46,14 +46,10 @@ struct ths8200_state { | |||
46 | 46 | ||
47 | static const struct v4l2_dv_timings_cap ths8200_timings_cap = { | 47 | static const struct v4l2_dv_timings_cap ths8200_timings_cap = { |
48 | .type = V4L2_DV_BT_656_1120, | 48 | .type = V4L2_DV_BT_656_1120, |
49 | .bt = { | 49 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
50 | .max_width = 1920, | 50 | .reserved = { 0 }, |
51 | .max_height = 1080, | 51 | V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1080, 25000000, 148500000, |
52 | .min_pixelclock = 25000000, | 52 | V4L2_DV_BT_STD_CEA861, V4L2_DV_BT_CAP_PROGRESSIVE) |
53 | .max_pixelclock = 148500000, | ||
54 | .standards = V4L2_DV_BT_STD_CEA861, | ||
55 | .capabilities = V4L2_DV_BT_CAP_PROGRESSIVE, | ||
56 | }, | ||
57 | }; | 53 | }; |
58 | 54 | ||
59 | static inline struct ths8200_state *to_state(struct v4l2_subdev *sd) | 55 | static inline struct ths8200_state *to_state(struct v4l2_subdev *sd) |
diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index e12bbd8c3f0b..fb60da85bc2c 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c | |||
@@ -1455,6 +1455,7 @@ static int video_release(struct file *file) | |||
1455 | 1455 | ||
1456 | /* stop video capture */ | 1456 | /* stop video capture */ |
1457 | if (res_check(fh, RESOURCE_VIDEO)) { | 1457 | if (res_check(fh, RESOURCE_VIDEO)) { |
1458 | pm_qos_remove_request(&dev->qos_request); | ||
1458 | videobuf_streamoff(&fh->cap); | 1459 | videobuf_streamoff(&fh->cap); |
1459 | res_free(dev,fh,RESOURCE_VIDEO); | 1460 | res_free(dev,fh,RESOURCE_VIDEO); |
1460 | } | 1461 | } |
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 15d23968d1de..9b88a4601007 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c | |||
@@ -1423,6 +1423,7 @@ static int s5p_jpeg_probe(struct platform_device *pdev) | |||
1423 | jpeg->vfd_decoder->release = video_device_release; | 1423 | jpeg->vfd_decoder->release = video_device_release; |
1424 | jpeg->vfd_decoder->lock = &jpeg->lock; | 1424 | jpeg->vfd_decoder->lock = &jpeg->lock; |
1425 | jpeg->vfd_decoder->v4l2_dev = &jpeg->v4l2_dev; | 1425 | jpeg->vfd_decoder->v4l2_dev = &jpeg->v4l2_dev; |
1426 | jpeg->vfd_decoder->vfl_dir = VFL_DIR_M2M; | ||
1426 | 1427 | ||
1427 | ret = video_register_device(jpeg->vfd_decoder, VFL_TYPE_GRABBER, -1); | 1428 | ret = video_register_device(jpeg->vfd_decoder, VFL_TYPE_GRABBER, -1); |
1428 | if (ret) { | 1429 | if (ret) { |
diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c index 7a9c5e9329f2..4f30341dc2ab 100644 --- a/drivers/media/platform/sh_vou.c +++ b/drivers/media/platform/sh_vou.c | |||
@@ -776,7 +776,7 @@ static int sh_vou_try_fmt_vid_out(struct file *file, void *priv, | |||
776 | v4l_bound_align_image(&pix->width, 0, VOU_MAX_IMAGE_WIDTH, 1, | 776 | v4l_bound_align_image(&pix->width, 0, VOU_MAX_IMAGE_WIDTH, 1, |
777 | &pix->height, 0, VOU_MAX_IMAGE_HEIGHT, 1, 0); | 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 | if (vou_fmt[i].pfmt == pix->pixelformat) | 780 | if (vou_fmt[i].pfmt == pix->pixelformat) |
781 | return 0; | 781 | return 0; |
782 | 782 | ||
diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c index 8f9f6211c52e..f975b7008692 100644 --- a/drivers/media/platform/soc_camera/mx3_camera.c +++ b/drivers/media/platform/soc_camera/mx3_camera.c | |||
@@ -266,7 +266,6 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb) | |||
266 | struct idmac_channel *ichan = mx3_cam->idmac_channel[0]; | 266 | struct idmac_channel *ichan = mx3_cam->idmac_channel[0]; |
267 | struct idmac_video_param *video = &ichan->params.video; | 267 | struct idmac_video_param *video = &ichan->params.video; |
268 | const struct soc_mbus_pixelfmt *host_fmt = icd->current_fmt->host_fmt; | 268 | const struct soc_mbus_pixelfmt *host_fmt = icd->current_fmt->host_fmt; |
269 | unsigned long flags; | ||
270 | dma_cookie_t cookie; | 269 | dma_cookie_t cookie; |
271 | size_t new_size; | 270 | size_t new_size; |
272 | 271 | ||
@@ -328,7 +327,7 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb) | |||
328 | memset(vb2_plane_vaddr(vb, 0), 0xaa, vb2_get_plane_payload(vb, 0)); | 327 | memset(vb2_plane_vaddr(vb, 0), 0xaa, vb2_get_plane_payload(vb, 0)); |
329 | #endif | 328 | #endif |
330 | 329 | ||
331 | spin_lock_irqsave(&mx3_cam->lock, flags); | 330 | spin_lock_irq(&mx3_cam->lock); |
332 | list_add_tail(&buf->queue, &mx3_cam->capture); | 331 | list_add_tail(&buf->queue, &mx3_cam->capture); |
333 | 332 | ||
334 | if (!mx3_cam->active) | 333 | if (!mx3_cam->active) |
@@ -351,7 +350,7 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb) | |||
351 | if (mx3_cam->active == buf) | 350 | if (mx3_cam->active == buf) |
352 | mx3_cam->active = NULL; | 351 | mx3_cam->active = NULL; |
353 | 352 | ||
354 | spin_unlock_irqrestore(&mx3_cam->lock, flags); | 353 | spin_unlock_irq(&mx3_cam->lock); |
355 | error: | 354 | error: |
356 | vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); | 355 | vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); |
357 | } | 356 | } |
diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c index ad9309da4a91..6c96e4898777 100644 --- a/drivers/media/tuners/e4000.c +++ b/drivers/media/tuners/e4000.c | |||
@@ -19,6 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "e4000_priv.h" | 21 | #include "e4000_priv.h" |
22 | #include <linux/math64.h> | ||
22 | 23 | ||
23 | /* write multiple registers */ | 24 | /* write multiple registers */ |
24 | static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) | 25 | static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) |
@@ -233,7 +234,7 @@ static int e4000_set_params(struct dvb_frontend *fe) | |||
233 | * or more. | 234 | * or more. |
234 | */ | 235 | */ |
235 | f_vco = c->frequency * e4000_pll_lut[i].mul; | 236 | f_vco = c->frequency * e4000_pll_lut[i].mul; |
236 | sigma_delta = 0x10000UL * (f_vco % priv->cfg->clock) / priv->cfg->clock; | 237 | sigma_delta = div_u64(0x10000ULL * (f_vco % priv->cfg->clock), priv->cfg->clock); |
237 | buf[0] = f_vco / priv->cfg->clock; | 238 | buf[0] = f_vco / priv->cfg->clock; |
238 | buf[1] = (sigma_delta >> 0) & 0xff; | 239 | buf[1] = (sigma_delta >> 0) & 0xff; |
239 | buf[2] = (sigma_delta >> 8) & 0xff; | 240 | buf[2] = (sigma_delta >> 8) & 0xff; |
diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c index c43c8d32be40..be77482c3070 100644 --- a/drivers/media/usb/stkwebcam/stk-webcam.c +++ b/drivers/media/usb/stkwebcam/stk-webcam.c | |||
@@ -111,6 +111,13 @@ static const struct dmi_system_id stk_upside_down_dmi_table[] = { | |||
111 | DMI_MATCH(DMI_PRODUCT_NAME, "F3JC") | 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 | ||
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 81695d48c13e..c3bb2502225b 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c | |||
@@ -2090,6 +2090,15 @@ static struct usb_device_id uvc_ids[] = { | |||
2090 | .bInterfaceSubClass = 1, | 2090 | .bInterfaceSubClass = 1, |
2091 | .bInterfaceProtocol = 0, | 2091 | .bInterfaceProtocol = 0, |
2092 | .driver_info = UVC_QUIRK_PROBE_MINMAX }, | 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 | /* Microsoft Lifecam VX-7000 */ | 2102 | /* Microsoft Lifecam VX-7000 */ |
2094 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2103 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
2095 | | USB_DEVICE_ID_MATCH_INT_INFO, | 2104 | | USB_DEVICE_ID_MATCH_INT_INFO, |
@@ -2174,6 +2183,15 @@ static struct usb_device_id uvc_ids[] = { | |||
2174 | .bInterfaceSubClass = 1, | 2183 | .bInterfaceSubClass = 1, |
2175 | .bInterfaceProtocol = 0, | 2184 | .bInterfaceProtocol = 0, |
2176 | .driver_info = UVC_QUIRK_PROBE_DEF }, | 2185 | .driver_info = UVC_QUIRK_PROBE_DEF }, |
2186 | /* Dell SP2008WFP Monitor */ | ||
2187 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | ||
2188 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
2189 | .idVendor = 0x05a9, | ||
2190 | .idProduct = 0x2641, | ||
2191 | .bInterfaceClass = USB_CLASS_VIDEO, | ||
2192 | .bInterfaceSubClass = 1, | ||
2193 | .bInterfaceProtocol = 0, | ||
2194 | .driver_info = UVC_QUIRK_PROBE_DEF }, | ||
2177 | /* Dell Alienware X51 */ | 2195 | /* Dell Alienware X51 */ |
2178 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2196 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
2179 | | USB_DEVICE_ID_MATCH_INT_INFO, | 2197 | | USB_DEVICE_ID_MATCH_INT_INFO, |
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 594c75eab5a5..de0e87f0b2c3 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
@@ -353,7 +353,9 @@ static int __verify_length(struct vb2_buffer *vb, const struct v4l2_buffer *b) | |||
353 | 353 | ||
354 | if (b->m.planes[plane].bytesused > length) | 354 | if (b->m.planes[plane].bytesused > length) |
355 | return -EINVAL; | 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 | b->m.planes[plane].bytesused) | 359 | b->m.planes[plane].bytesused) |
358 | return -EINVAL; | 360 | return -EINVAL; |
359 | } | 361 | } |
diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index fd56f2563201..646f08f4f504 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c | |||
@@ -423,6 +423,39 @@ static inline int vma_is_io(struct vm_area_struct *vma) | |||
423 | return !!(vma->vm_flags & (VM_IO | VM_PFNMAP)); | 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 | static int vb2_dc_get_user_pages(unsigned long start, struct page **pages, | 459 | static int vb2_dc_get_user_pages(unsigned long start, struct page **pages, |
427 | int n_pages, struct vm_area_struct *vma, int write) | 460 | int n_pages, struct vm_area_struct *vma, int write) |
428 | { | 461 | { |
@@ -433,6 +466,9 @@ static int vb2_dc_get_user_pages(unsigned long start, struct page **pages, | |||
433 | unsigned long pfn; | 466 | unsigned long pfn; |
434 | int ret = follow_pfn(vma, start, &pfn); | 467 | int ret = follow_pfn(vma, start, &pfn); |
435 | 468 | ||
469 | if (!pfn_valid(pfn)) | ||
470 | return -EINVAL; | ||
471 | |||
436 | if (ret) { | 472 | if (ret) { |
437 | pr_err("no page for address %lu\n", start); | 473 | pr_err("no page for address %lu\n", start); |
438 | return ret; | 474 | return ret; |
@@ -468,16 +504,49 @@ static void vb2_dc_put_userptr(void *buf_priv) | |||
468 | struct vb2_dc_buf *buf = buf_priv; | 504 | struct vb2_dc_buf *buf = buf_priv; |
469 | struct sg_table *sgt = buf->dma_sgt; | 505 | struct sg_table *sgt = buf->dma_sgt; |
470 | 506 | ||
471 | dma_unmap_sg(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); | 507 | if (sgt) { |
472 | if (!vma_is_io(buf->vma)) | 508 | dma_unmap_sg(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); |
473 | vb2_dc_sgt_foreach_page(sgt, vb2_dc_put_dirty_page); | 509 | if (!vma_is_io(buf->vma)) |
510 | vb2_dc_sgt_foreach_page(sgt, vb2_dc_put_dirty_page); | ||
474 | 511 | ||
475 | sg_free_table(sgt); | 512 | sg_free_table(sgt); |
476 | kfree(sgt); | 513 | kfree(sgt); |
514 | } | ||
477 | vb2_put_vma(buf->vma); | 515 | vb2_put_vma(buf->vma); |
478 | kfree(buf); | 516 | kfree(buf); |
479 | } | 517 | } |
480 | 518 | ||
519 | /* | ||
520 | * For some kind of reserved memory there might be no struct page available, | ||
521 | * so all that can be done to support such 'pages' is to try to convert | ||
522 | * pfn to dma address or at the last resort just assume that | ||
523 | * dma address == physical address (like it has been assumed in earlier version | ||
524 | * of videobuf2-dma-contig | ||
525 | */ | ||
526 | |||
527 | #ifdef __arch_pfn_to_dma | ||
528 | static inline dma_addr_t vb2_dc_pfn_to_dma(struct device *dev, unsigned long pfn) | ||
529 | { | ||
530 | return (dma_addr_t)__arch_pfn_to_dma(dev, pfn); | ||
531 | } | ||
532 | #elif defined(__pfn_to_bus) | ||
533 | static inline dma_addr_t vb2_dc_pfn_to_dma(struct device *dev, unsigned long pfn) | ||
534 | { | ||
535 | return (dma_addr_t)__pfn_to_bus(pfn); | ||
536 | } | ||
537 | #elif defined(__pfn_to_phys) | ||
538 | static inline dma_addr_t vb2_dc_pfn_to_dma(struct device *dev, unsigned long pfn) | ||
539 | { | ||
540 | return (dma_addr_t)__pfn_to_phys(pfn); | ||
541 | } | ||
542 | #else | ||
543 | static inline dma_addr_t vb2_dc_pfn_to_dma(struct device *dev, unsigned long pfn) | ||
544 | { | ||
545 | /* really, we cannot do anything better at this point */ | ||
546 | return (dma_addr_t)(pfn) << PAGE_SHIFT; | ||
547 | } | ||
548 | #endif | ||
549 | |||
481 | static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, | 550 | static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, |
482 | unsigned long size, int write) | 551 | unsigned long size, int write) |
483 | { | 552 | { |
@@ -548,6 +617,14 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, | |||
548 | /* extract page list from userspace mapping */ | 617 | /* extract page list from userspace mapping */ |
549 | ret = vb2_dc_get_user_pages(start, pages, n_pages, vma, write); | 618 | ret = vb2_dc_get_user_pages(start, pages, n_pages, vma, write); |
550 | if (ret) { | 619 | if (ret) { |
620 | unsigned long pfn; | ||
621 | if (vb2_dc_get_user_pfn(start, n_pages, vma, &pfn) == 0) { | ||
622 | buf->dma_addr = vb2_dc_pfn_to_dma(buf->dev, pfn); | ||
623 | buf->size = size; | ||
624 | kfree(pages); | ||
625 | return buf; | ||
626 | } | ||
627 | |||
551 | pr_err("failed to get user pages\n"); | 628 | pr_err("failed to get user pages\n"); |
552 | goto fail_vma; | 629 | goto fail_vma; |
553 | } | 630 | } |
diff --git a/drivers/staging/media/msi3101/Kconfig b/drivers/staging/media/msi3101/Kconfig index b94a95a597d6..76d5bbd4d93c 100644 --- a/drivers/staging/media/msi3101/Kconfig +++ b/drivers/staging/media/msi3101/Kconfig | |||
@@ -1,3 +1,4 @@ | |||
1 | config USB_MSI3101 | 1 | config USB_MSI3101 |
2 | tristate "Mirics MSi3101 SDR Dongle" | 2 | tristate "Mirics MSi3101 SDR Dongle" |
3 | depends on USB && VIDEO_DEV && VIDEO_V4L2 | 3 | depends on USB && VIDEO_DEV && VIDEO_V4L2 |
4 | select VIDEOBUF2_VMALLOC | ||
diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 24c7b70a6cbf..4c3bf776bb20 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c | |||
@@ -1131,7 +1131,13 @@ static int msi3101_queue_setup(struct vb2_queue *vq, | |||
1131 | /* Absolute min and max number of buffers available for mmap() */ | 1131 | /* Absolute min and max number of buffers available for mmap() */ |
1132 | *nbuffers = 32; | 1132 | *nbuffers = 32; |
1133 | *nplanes = 1; | 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 | dev_dbg(&s->udev->dev, "%s: nbuffers=%d sizes[0]=%d\n", | 1141 | dev_dbg(&s->udev->dev, "%s: nbuffers=%d sizes[0]=%d\n", |
1136 | __func__, *nbuffers, sizes[0]); | 1142 | __func__, *nbuffers, sizes[0]); |
1137 | return 0; | 1143 | return 0; |
@@ -1657,7 +1663,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, | |||
1657 | f->frequency * 625UL / 10UL); | 1663 | f->frequency * 625UL / 10UL); |
1658 | } | 1664 | } |
1659 | 1665 | ||
1660 | const struct v4l2_ioctl_ops msi3101_ioctl_ops = { | 1666 | static const struct v4l2_ioctl_ops msi3101_ioctl_ops = { |
1661 | .vidioc_querycap = msi3101_querycap, | 1667 | .vidioc_querycap = msi3101_querycap, |
1662 | 1668 | ||
1663 | .vidioc_enum_input = msi3101_enum_input, | 1669 | .vidioc_enum_input = msi3101_enum_input, |