diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-11 14:05:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-11 14:05:34 -0400 |
commit | 39f86a608a3e0f0164bd1540acf87696cfdfb5bb (patch) | |
tree | a8a88fd3dda891fd89aa9058ec798aa12d04bc16 /drivers/media | |
parent | 1b6150fe82de8a555b0200d20bb5e3752fbe4160 (diff) | |
parent | ed0ee0ce0a3224dab5caa088a5f8b6df25924276 (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:
- dvb core: there is a regression found when used with xine. For
whatever unknown reason, xine (and xine-lib clients) wants that the
frontend to tell what frequency he is using even before the PLL lock
(or at least, it expects a non-zero frequency).
On DVB, the frequency is only actually known after a frequency
zig-zag seek, done by the DVB core. Anyway, the fix was trivial.
That solves Fedora BZ#808871.
- ivtv: fix a regression when selecting the language channel
- uvc: fix a race-related crash
- it913x: fixes firmware loading
- two trivial patches (a dependency issue at a radio driver at sound
Kconfig, and a warning fix on dvb).
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
[media] uvcvideo: Fix race-related crash in uvc_video_clock_update()
[media] Drivers/media/radio: Fix build error
[media] dvb_frontend: fix compiler warning
[media] it913x: fix firmware loading errors
[media] ivtv: Fix AUDIO_(BILINGUAL_)CHANNEL_SELECT regression
[media] dvb_frontend: regression fix: userspace ABI broken for xine
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.c | 12 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/it913x.c | 54 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 4 | ||||
-rw-r--r-- | drivers/media/video/uvc/uvc_video.c | 50 |
4 files changed, 85 insertions, 35 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 4555baa383b2..39696c6a4ed7 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -143,10 +143,12 @@ struct dvb_frontend_private { | |||
143 | static void dvb_frontend_wakeup(struct dvb_frontend *fe); | 143 | static void dvb_frontend_wakeup(struct dvb_frontend *fe); |
144 | static int dtv_get_frontend(struct dvb_frontend *fe, | 144 | static int dtv_get_frontend(struct dvb_frontend *fe, |
145 | struct dvb_frontend_parameters *p_out); | 145 | struct dvb_frontend_parameters *p_out); |
146 | static int dtv_property_legacy_params_sync(struct dvb_frontend *fe, | ||
147 | struct dvb_frontend_parameters *p); | ||
146 | 148 | ||
147 | static bool has_get_frontend(struct dvb_frontend *fe) | 149 | static bool has_get_frontend(struct dvb_frontend *fe) |
148 | { | 150 | { |
149 | return fe->ops.get_frontend; | 151 | return fe->ops.get_frontend != NULL; |
150 | } | 152 | } |
151 | 153 | ||
152 | /* | 154 | /* |
@@ -697,6 +699,7 @@ restart: | |||
697 | fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; | 699 | fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; |
698 | fepriv->delay = HZ / 2; | 700 | fepriv->delay = HZ / 2; |
699 | } | 701 | } |
702 | dtv_property_legacy_params_sync(fe, &fepriv->parameters_out); | ||
700 | fe->ops.read_status(fe, &s); | 703 | fe->ops.read_status(fe, &s); |
701 | if (s != fepriv->status) { | 704 | if (s != fepriv->status) { |
702 | dvb_frontend_add_event(fe, s); /* update event list */ | 705 | dvb_frontend_add_event(fe, s); /* update event list */ |
@@ -1833,6 +1836,13 @@ static int dtv_set_frontend(struct dvb_frontend *fe) | |||
1833 | return -EINVAL; | 1836 | return -EINVAL; |
1834 | 1837 | ||
1835 | /* | 1838 | /* |
1839 | * Initialize output parameters to match the values given by | ||
1840 | * the user. FE_SET_FRONTEND triggers an initial frontend event | ||
1841 | * with status = 0, which copies output parameters to userspace. | ||
1842 | */ | ||
1843 | dtv_property_legacy_params_sync(fe, &fepriv->parameters_out); | ||
1844 | |||
1845 | /* | ||
1836 | * Be sure that the bandwidth will be filled for all | 1846 | * Be sure that the bandwidth will be filled for all |
1837 | * non-satellite systems, as tuners need to know what | 1847 | * non-satellite systems, as tuners need to know what |
1838 | * low pass/Nyquist half filter should be applied, in | 1848 | * low pass/Nyquist half filter should be applied, in |
diff --git a/drivers/media/dvb/dvb-usb/it913x.c b/drivers/media/dvb/dvb-usb/it913x.c index 3b7b102f20ae..482d249ca7f3 100644 --- a/drivers/media/dvb/dvb-usb/it913x.c +++ b/drivers/media/dvb/dvb-usb/it913x.c | |||
@@ -238,12 +238,27 @@ static int it913x_read_reg(struct usb_device *udev, u32 reg) | |||
238 | 238 | ||
239 | static u32 it913x_query(struct usb_device *udev, u8 pro) | 239 | static u32 it913x_query(struct usb_device *udev, u8 pro) |
240 | { | 240 | { |
241 | int ret; | 241 | int ret, i; |
242 | u8 data[4]; | 242 | u8 data[4]; |
243 | ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ, | 243 | u8 ver; |
244 | 0x1222, 0, &data[0], 3); | 244 | |
245 | for (i = 0; i < 5; i++) { | ||
246 | ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ, | ||
247 | 0x1222, 0, &data[0], 3); | ||
248 | ver = data[0]; | ||
249 | if (ver > 0 && ver < 3) | ||
250 | break; | ||
251 | msleep(100); | ||
252 | } | ||
245 | 253 | ||
246 | it913x_config.chip_ver = data[0]; | 254 | if (ver < 1 || ver > 2) { |
255 | info("Failed to identify chip version applying 1"); | ||
256 | it913x_config.chip_ver = 0x1; | ||
257 | it913x_config.chip_type = 0x9135; | ||
258 | return 0; | ||
259 | } | ||
260 | |||
261 | it913x_config.chip_ver = ver; | ||
247 | it913x_config.chip_type = (u16)(data[2] << 8) + data[1]; | 262 | it913x_config.chip_type = (u16)(data[2] << 8) + data[1]; |
248 | 263 | ||
249 | info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver, | 264 | info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver, |
@@ -660,30 +675,41 @@ static int it913x_download_firmware(struct usb_device *udev, | |||
660 | if ((packet_size > min_pkt) || (i == fw->size)) { | 675 | if ((packet_size > min_pkt) || (i == fw->size)) { |
661 | fw_data = (u8 *)(fw->data + pos); | 676 | fw_data = (u8 *)(fw->data + pos); |
662 | pos += packet_size; | 677 | pos += packet_size; |
663 | if (packet_size > 0) | 678 | if (packet_size > 0) { |
664 | ret |= it913x_io(udev, WRITE_DATA, | 679 | ret = it913x_io(udev, WRITE_DATA, |
665 | DEV_0, CMD_SCATTER_WRITE, 0, | 680 | DEV_0, CMD_SCATTER_WRITE, 0, |
666 | 0, fw_data, packet_size); | 681 | 0, fw_data, packet_size); |
682 | if (ret < 0) | ||
683 | break; | ||
684 | } | ||
667 | udelay(1000); | 685 | udelay(1000); |
668 | } | 686 | } |
669 | } | 687 | } |
670 | i++; | 688 | i++; |
671 | } | 689 | } |
672 | 690 | ||
673 | ret |= it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0); | ||
674 | |||
675 | msleep(100); | ||
676 | |||
677 | if (ret < 0) | 691 | if (ret < 0) |
678 | info("FRM Firmware Download Failed (%04x)" , ret); | 692 | info("FRM Firmware Download Failed (%d)" , ret); |
679 | else | 693 | else |
680 | info("FRM Firmware Download Completed - Resetting Device"); | 694 | info("FRM Firmware Download Completed - Resetting Device"); |
681 | 695 | ||
682 | ret |= it913x_return_status(udev); | 696 | msleep(30); |
697 | |||
698 | ret = it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0); | ||
699 | if (ret < 0) | ||
700 | info("FRM Device not responding to reboot"); | ||
701 | |||
702 | ret = it913x_return_status(udev); | ||
703 | if (ret == 0) { | ||
704 | info("FRM Failed to reboot device"); | ||
705 | return -ENODEV; | ||
706 | } | ||
683 | 707 | ||
684 | msleep(30); | 708 | msleep(30); |
685 | 709 | ||
686 | ret |= it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400); | 710 | ret = it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400); |
711 | |||
712 | msleep(30); | ||
687 | 713 | ||
688 | /* Tuner function */ | 714 | /* Tuner function */ |
689 | if (it913x_config.dual_mode) | 715 | if (it913x_config.dual_mode) |
@@ -901,5 +927,5 @@ module_usb_driver(it913x_driver); | |||
901 | 927 | ||
902 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); | 928 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); |
903 | MODULE_DESCRIPTION("it913x USB 2 Driver"); | 929 | MODULE_DESCRIPTION("it913x USB 2 Driver"); |
904 | MODULE_VERSION("1.27"); | 930 | MODULE_VERSION("1.28"); |
905 | MODULE_LICENSE("GPL"); | 931 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 5452beef8e11..989e556913ed 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -1763,13 +1763,13 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
1763 | IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n"); | 1763 | IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n"); |
1764 | if (iarg > AUDIO_STEREO_SWAPPED) | 1764 | if (iarg > AUDIO_STEREO_SWAPPED) |
1765 | return -EINVAL; | 1765 | return -EINVAL; |
1766 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_playback, iarg); | 1766 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_playback, iarg + 1); |
1767 | 1767 | ||
1768 | case AUDIO_BILINGUAL_CHANNEL_SELECT: | 1768 | case AUDIO_BILINGUAL_CHANNEL_SELECT: |
1769 | IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n"); | 1769 | IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n"); |
1770 | if (iarg > AUDIO_STEREO_SWAPPED) | 1770 | if (iarg > AUDIO_STEREO_SWAPPED) |
1771 | return -EINVAL; | 1771 | return -EINVAL; |
1772 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_multilingual_playback, iarg); | 1772 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_multilingual_playback, iarg + 1); |
1773 | 1773 | ||
1774 | default: | 1774 | default: |
1775 | return -EINVAL; | 1775 | return -EINVAL; |
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index 4a44f9a1bae0..b76b0ac0958f 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c | |||
@@ -468,22 +468,30 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf, | |||
468 | spin_unlock_irqrestore(&stream->clock.lock, flags); | 468 | spin_unlock_irqrestore(&stream->clock.lock, flags); |
469 | } | 469 | } |
470 | 470 | ||
471 | static int uvc_video_clock_init(struct uvc_streaming *stream) | 471 | static void uvc_video_clock_reset(struct uvc_streaming *stream) |
472 | { | 472 | { |
473 | struct uvc_clock *clock = &stream->clock; | 473 | struct uvc_clock *clock = &stream->clock; |
474 | 474 | ||
475 | spin_lock_init(&clock->lock); | ||
476 | clock->head = 0; | 475 | clock->head = 0; |
477 | clock->count = 0; | 476 | clock->count = 0; |
478 | clock->size = 32; | ||
479 | clock->last_sof = -1; | 477 | clock->last_sof = -1; |
480 | clock->sof_offset = -1; | 478 | clock->sof_offset = -1; |
479 | } | ||
480 | |||
481 | static int uvc_video_clock_init(struct uvc_streaming *stream) | ||
482 | { | ||
483 | struct uvc_clock *clock = &stream->clock; | ||
484 | |||
485 | spin_lock_init(&clock->lock); | ||
486 | clock->size = 32; | ||
481 | 487 | ||
482 | clock->samples = kmalloc(clock->size * sizeof(*clock->samples), | 488 | clock->samples = kmalloc(clock->size * sizeof(*clock->samples), |
483 | GFP_KERNEL); | 489 | GFP_KERNEL); |
484 | if (clock->samples == NULL) | 490 | if (clock->samples == NULL) |
485 | return -ENOMEM; | 491 | return -ENOMEM; |
486 | 492 | ||
493 | uvc_video_clock_reset(stream); | ||
494 | |||
487 | return 0; | 495 | return 0; |
488 | } | 496 | } |
489 | 497 | ||
@@ -1424,8 +1432,6 @@ static void uvc_uninit_video(struct uvc_streaming *stream, int free_buffers) | |||
1424 | 1432 | ||
1425 | if (free_buffers) | 1433 | if (free_buffers) |
1426 | uvc_free_urb_buffers(stream); | 1434 | uvc_free_urb_buffers(stream); |
1427 | |||
1428 | uvc_video_clock_cleanup(stream); | ||
1429 | } | 1435 | } |
1430 | 1436 | ||
1431 | /* | 1437 | /* |
@@ -1555,10 +1561,6 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags) | |||
1555 | 1561 | ||
1556 | uvc_video_stats_start(stream); | 1562 | uvc_video_stats_start(stream); |
1557 | 1563 | ||
1558 | ret = uvc_video_clock_init(stream); | ||
1559 | if (ret < 0) | ||
1560 | return ret; | ||
1561 | |||
1562 | if (intf->num_altsetting > 1) { | 1564 | if (intf->num_altsetting > 1) { |
1563 | struct usb_host_endpoint *best_ep = NULL; | 1565 | struct usb_host_endpoint *best_ep = NULL; |
1564 | unsigned int best_psize = 3 * 1024; | 1566 | unsigned int best_psize = 3 * 1024; |
@@ -1683,6 +1685,8 @@ int uvc_video_resume(struct uvc_streaming *stream, int reset) | |||
1683 | 1685 | ||
1684 | stream->frozen = 0; | 1686 | stream->frozen = 0; |
1685 | 1687 | ||
1688 | uvc_video_clock_reset(stream); | ||
1689 | |||
1686 | ret = uvc_commit_video(stream, &stream->ctrl); | 1690 | ret = uvc_commit_video(stream, &stream->ctrl); |
1687 | if (ret < 0) { | 1691 | if (ret < 0) { |
1688 | uvc_queue_enable(&stream->queue, 0); | 1692 | uvc_queue_enable(&stream->queue, 0); |
@@ -1819,25 +1823,35 @@ int uvc_video_enable(struct uvc_streaming *stream, int enable) | |||
1819 | uvc_uninit_video(stream, 1); | 1823 | uvc_uninit_video(stream, 1); |
1820 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); | 1824 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); |
1821 | uvc_queue_enable(&stream->queue, 0); | 1825 | uvc_queue_enable(&stream->queue, 0); |
1826 | uvc_video_clock_cleanup(stream); | ||
1822 | return 0; | 1827 | return 0; |
1823 | } | 1828 | } |
1824 | 1829 | ||
1825 | ret = uvc_queue_enable(&stream->queue, 1); | 1830 | ret = uvc_video_clock_init(stream); |
1826 | if (ret < 0) | 1831 | if (ret < 0) |
1827 | return ret; | 1832 | return ret; |
1828 | 1833 | ||
1834 | ret = uvc_queue_enable(&stream->queue, 1); | ||
1835 | if (ret < 0) | ||
1836 | goto error_queue; | ||
1837 | |||
1829 | /* Commit the streaming parameters. */ | 1838 | /* Commit the streaming parameters. */ |
1830 | ret = uvc_commit_video(stream, &stream->ctrl); | 1839 | ret = uvc_commit_video(stream, &stream->ctrl); |
1831 | if (ret < 0) { | 1840 | if (ret < 0) |
1832 | uvc_queue_enable(&stream->queue, 0); | 1841 | goto error_commit; |
1833 | return ret; | ||
1834 | } | ||
1835 | 1842 | ||
1836 | ret = uvc_init_video(stream, GFP_KERNEL); | 1843 | ret = uvc_init_video(stream, GFP_KERNEL); |
1837 | if (ret < 0) { | 1844 | if (ret < 0) |
1838 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); | 1845 | goto error_video; |
1839 | uvc_queue_enable(&stream->queue, 0); | 1846 | |
1840 | } | 1847 | return 0; |
1848 | |||
1849 | error_video: | ||
1850 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); | ||
1851 | error_commit: | ||
1852 | uvc_queue_enable(&stream->queue, 0); | ||
1853 | error_queue: | ||
1854 | uvc_video_clock_cleanup(stream); | ||
1841 | 1855 | ||
1842 | return ret; | 1856 | return ret; |
1843 | } | 1857 | } |