summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx18/cx18-dvb.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-06-21 20:04:21 -0400
committerAndy Walls <awalls@radix.net>2008-06-21 20:04:21 -0400
commit5a55e327df413ef74d0e96632acc04ca47944641 (patch)
treeb8481d249f1ab1aed1a8bce643d29aa5df0243ba /linux/drivers/media/video/cx18/cx18-dvb.c
parent1318794fcd1d00640e6328cb3a3af220b48dacf4 (diff)
downloadmediapointer-dvb-s2-5a55e327df413ef74d0e96632acc04ca47944641.tar.gz
mediapointer-dvb-s2-5a55e327df413ef74d0e96632acc04ca47944641.tar.bz2
cx18: Fix firmware load for case when digital capture happens first
From: Andy Walls <awalls@radix.net> This is a fix for the case when a digital capture from dvr0 happens first after modprobe, before access to any cx18 v4l2 device nodes. The initial dvb feed start has been changed to load the firmware if not already loaded. Also fixed a use counter to correct dvb feed accounting if starting the transport DMA fails. Signed-off-by: Andy Walls <awalls@radix.net>
Diffstat (limited to 'linux/drivers/media/video/cx18/cx18-dvb.c')
-rw-r--r--linux/drivers/media/video/cx18/cx18-dvb.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/linux/drivers/media/video/cx18/cx18-dvb.c b/linux/drivers/media/video/cx18/cx18-dvb.c
index c9744173f..cae38985b 100644
--- a/linux/drivers/media/video/cx18/cx18-dvb.c
+++ b/linux/drivers/media/video/cx18/cx18-dvb.c
@@ -69,11 +69,21 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed)
struct dvb_demux *demux = feed->demux;
struct cx18_stream *stream = (struct cx18_stream *) demux->priv;
struct cx18 *cx = stream->cx;
- int ret = -EINVAL;
+ int ret;
u32 v;
CX18_DEBUG_INFO("Start feed: pid = 0x%x index = %d\n",
feed->pid, feed->index);
+
+ mutex_lock(&cx->serialize_lock);
+ ret = cx18_init_on_first_open(cx);
+ mutex_unlock(&cx->serialize_lock);
+ if (ret) {
+ CX18_ERR("Failed to initialize firmware starting DVB feed\n");
+ return ret;
+ }
+ ret = -EINVAL;
+
switch (cx->card->type) {
case CX18_CARD_HVR_1600_ESMT:
case CX18_CARD_HVR_1600_SAMSUNG:
@@ -101,6 +111,11 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed)
if (stream->dvb.feeding++ == 0) {
CX18_DEBUG_INFO("Starting Transport DMA\n");
ret = cx18_start_v4l2_encode_stream(stream);
+ if (ret < 0) {
+ CX18_DEBUG_INFO(
+ "Failed to start Transport DMA\n");
+ stream->dvb.feeding--;
+ }
} else
ret = 0;
mutex_unlock(&stream->dvb.feedlock);