Skip to content

Commit 39f86a6

Browse files
committed
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
2 parents 1b6150f + ed0ee0c commit 39f86a6

File tree

5 files changed

+87
-37
lines changed

5 files changed

+87
-37
lines changed

drivers/media/dvb/dvb-core/dvb_frontend.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,12 @@ struct dvb_frontend_private {
143143
static void dvb_frontend_wakeup(struct dvb_frontend *fe);
144144
static int dtv_get_frontend(struct dvb_frontend *fe,
145145
struct dvb_frontend_parameters *p_out);
146+
static int dtv_property_legacy_params_sync(struct dvb_frontend *fe,
147+
struct dvb_frontend_parameters *p);
146148

147149
static bool has_get_frontend(struct dvb_frontend *fe)
148150
{
149-
return fe->ops.get_frontend;
151+
return fe->ops.get_frontend != NULL;
150152
}
151153

152154
/*
@@ -697,6 +699,7 @@ static int dvb_frontend_thread(void *data)
697699
fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN;
698700
fepriv->delay = HZ / 2;
699701
}
702+
dtv_property_legacy_params_sync(fe, &fepriv->parameters_out);
700703
fe->ops.read_status(fe, &s);
701704
if (s != fepriv->status) {
702705
dvb_frontend_add_event(fe, s); /* update event list */
@@ -1832,6 +1835,13 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
18321835
if (dvb_frontend_check_parameters(fe) < 0)
18331836
return -EINVAL;
18341837

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+
18351845
/*
18361846
* Be sure that the bandwidth will be filled for all
18371847
* non-satellite systems, as tuners need to know what

drivers/media/dvb/dvb-usb/it913x.c

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,27 @@ static int it913x_read_reg(struct usb_device *udev, u32 reg)
238238

239239
static u32 it913x_query(struct usb_device *udev, u8 pro)
240240
{
241-
int ret;
241+
int ret, i;
242242
u8 data[4];
243-
ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ,
244-
0x1222, 0, &data[0], 3);
243+
u8 ver;
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+
}
245253

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;
247262
it913x_config.chip_type = (u16)(data[2] << 8) + data[1];
248263

249264
info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver,
@@ -660,30 +675,41 @@ static int it913x_download_firmware(struct usb_device *udev,
660675
if ((packet_size > min_pkt) || (i == fw->size)) {
661676
fw_data = (u8 *)(fw->data + pos);
662677
pos += packet_size;
663-
if (packet_size > 0)
664-
ret |= it913x_io(udev, WRITE_DATA,
678+
if (packet_size > 0) {
679+
ret = it913x_io(udev, WRITE_DATA,
665680
DEV_0, CMD_SCATTER_WRITE, 0,
666681
0, fw_data, packet_size);
682+
if (ret < 0)
683+
break;
684+
}
667685
udelay(1000);
668686
}
669687
}
670688
i++;
671689
}
672690

673-
ret |= it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0);
674-
675-
msleep(100);
676-
677691
if (ret < 0)
678-
info("FRM Firmware Download Failed (%04x)" , ret);
692+
info("FRM Firmware Download Failed (%d)" , ret);
679693
else
680694
info("FRM Firmware Download Completed - Resetting Device");
681695

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+
}
683707

684708
msleep(30);
685709

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);
687713

688714
/* Tuner function */
689715
if (it913x_config.dual_mode)
@@ -901,5 +927,5 @@ module_usb_driver(it913x_driver);
901927

902928
MODULE_AUTHOR("Malcolm Priestley <[email protected]>");
903929
MODULE_DESCRIPTION("it913x USB 2 Driver");
904-
MODULE_VERSION("1.27");
930+
MODULE_VERSION("1.28");
905931
MODULE_LICENSE("GPL");

drivers/media/video/ivtv/ivtv-ioctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,13 +1763,13 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg)
17631763
IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n");
17641764
if (iarg > AUDIO_STEREO_SWAPPED)
17651765
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);
17671767

17681768
case AUDIO_BILINGUAL_CHANNEL_SELECT:
17691769
IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n");
17701770
if (iarg > AUDIO_STEREO_SWAPPED)
17711771
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);
17731773

17741774
default:
17751775
return -EINVAL;

drivers/media/video/uvc/uvc_video.c

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -468,22 +468,30 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf,
468468
spin_unlock_irqrestore(&stream->clock.lock, flags);
469469
}
470470

471-
static int uvc_video_clock_init(struct uvc_streaming *stream)
471+
static void uvc_video_clock_reset(struct uvc_streaming *stream)
472472
{
473473
struct uvc_clock *clock = &stream->clock;
474474

475-
spin_lock_init(&clock->lock);
476475
clock->head = 0;
477476
clock->count = 0;
478-
clock->size = 32;
479477
clock->last_sof = -1;
480478
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;
481487

482488
clock->samples = kmalloc(clock->size * sizeof(*clock->samples),
483489
GFP_KERNEL);
484490
if (clock->samples == NULL)
485491
return -ENOMEM;
486492

493+
uvc_video_clock_reset(stream);
494+
487495
return 0;
488496
}
489497

@@ -1424,8 +1432,6 @@ static void uvc_uninit_video(struct uvc_streaming *stream, int free_buffers)
14241432

14251433
if (free_buffers)
14261434
uvc_free_urb_buffers(stream);
1427-
1428-
uvc_video_clock_cleanup(stream);
14291435
}
14301436

14311437
/*
@@ -1555,10 +1561,6 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags)
15551561

15561562
uvc_video_stats_start(stream);
15571563

1558-
ret = uvc_video_clock_init(stream);
1559-
if (ret < 0)
1560-
return ret;
1561-
15621564
if (intf->num_altsetting > 1) {
15631565
struct usb_host_endpoint *best_ep = NULL;
15641566
unsigned int best_psize = 3 * 1024;
@@ -1683,6 +1685,8 @@ int uvc_video_resume(struct uvc_streaming *stream, int reset)
16831685

16841686
stream->frozen = 0;
16851687

1688+
uvc_video_clock_reset(stream);
1689+
16861690
ret = uvc_commit_video(stream, &stream->ctrl);
16871691
if (ret < 0) {
16881692
uvc_queue_enable(&stream->queue, 0);
@@ -1819,25 +1823,35 @@ int uvc_video_enable(struct uvc_streaming *stream, int enable)
18191823
uvc_uninit_video(stream, 1);
18201824
usb_set_interface(stream->dev->udev, stream->intfnum, 0);
18211825
uvc_queue_enable(&stream->queue, 0);
1826+
uvc_video_clock_cleanup(stream);
18221827
return 0;
18231828
}
18241829

1825-
ret = uvc_queue_enable(&stream->queue, 1);
1830+
ret = uvc_video_clock_init(stream);
18261831
if (ret < 0)
18271832
return ret;
18281833

1834+
ret = uvc_queue_enable(&stream->queue, 1);
1835+
if (ret < 0)
1836+
goto error_queue;
1837+
18291838
/* Commit the streaming parameters. */
18301839
ret = uvc_commit_video(stream, &stream->ctrl);
1831-
if (ret < 0) {
1832-
uvc_queue_enable(&stream->queue, 0);
1833-
return ret;
1834-
}
1840+
if (ret < 0)
1841+
goto error_commit;
18351842

18361843
ret = uvc_init_video(stream, GFP_KERNEL);
1837-
if (ret < 0) {
1838-
usb_set_interface(stream->dev->udev, stream->intfnum, 0);
1839-
uvc_queue_enable(&stream->queue, 0);
1840-
}
1844+
if (ret < 0)
1845+
goto error_video;
1846+
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);
18411855

18421856
return ret;
18431857
}

sound/pci/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
config SND_TEA575X
44
tristate
5-
depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2
6-
default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2
5+
depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 || RADIO_MAXIRADIO
6+
default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 || RADIO_MAXIRADIO
77

88
menuconfig SND_PCI
99
bool "PCI sound devices"

0 commit comments

Comments
 (0)