summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885/cx23885-417.c
diff options
context:
space:
mode:
authorSteven Toth <stoth@kernellabs.com>2012-01-04 10:56:14 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-04 20:51:18 -0200
commit9c9c3d078b0dd81a74e5f531aa1efa30add5b419 (patch)
tree17062059ca8380a79dbb69cbb1dd448eaa091573 /drivers/media/video/cx23885/cx23885-417.c
parent38e3d7ce41cff58bacebb2bcecf7d386c60b954b (diff)
downloadop-kernel-dev-9c9c3d078b0dd81a74e5f531aa1efa30add5b419.zip
op-kernel-dev-9c9c3d078b0dd81a74e5f531aa1efa30add5b419.tar.gz
[media] cx23885: Configure the MPEG encoder early to avoid jerky video
Found an odd bug while implementing support for the HVR1850 that lead to jerky video during the first capture, if the encoder was not initialized early. I've modied the driver to configure the encoder early, and this avoids the issue - a reasonable workaround. Regression tested against the HVR1800 and soon to be added HVR1850 [mchehab@redhat.com: Fix this compilation issue: drivers/media/video/cx23885/cx23885-417.c:1351:2: error: too few arguments to function ‘cx23885_initialize_codec’] Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx23885/cx23885-417.c')
-rw-r--r--drivers/media/video/cx23885/cx23885-417.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c
index f65e38c..b5afa33 100644
--- a/drivers/media/video/cx23885/cx23885-417.c
+++ b/drivers/media/video/cx23885/cx23885-417.c
@@ -1044,7 +1044,7 @@ static void cx23885_codec_settings(struct cx23885_dev *dev)
cx23885_api_cmd(dev, CX2341X_ENC_MISC, 2, 0, 4, 1);
}
-static int cx23885_initialize_codec(struct cx23885_dev *dev)
+static int cx23885_initialize_codec(struct cx23885_dev *dev, int startencoder)
{
int version;
int retval;
@@ -1126,9 +1126,11 @@ static int cx23885_initialize_codec(struct cx23885_dev *dev)
mc417_memory_write(dev, 2120, 0x00000080);
/* start capturing to the host interface */
- cx23885_api_cmd(dev, CX2341X_ENC_START_CAPTURE, 2, 0,
- CX23885_MPEG_CAPTURE, CX23885_RAW_BITS_NONE);
- msleep(10);
+ if (startencoder) {
+ cx23885_api_cmd(dev, CX2341X_ENC_START_CAPTURE, 2, 0,
+ CX23885_MPEG_CAPTURE, CX23885_RAW_BITS_NONE);
+ msleep(10);
+ }
return 0;
}
@@ -1346,7 +1348,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
call_all(dev, tuner, s_frequency, f);
- cx23885_initialize_codec(dev);
+ cx23885_initialize_codec(dev, 0);
return 0;
}
@@ -1650,7 +1652,7 @@ static ssize_t mpeg_read(struct file *file, char __user *data,
/* Start mpeg encoder on first read. */
if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) {
if (atomic_inc_return(&dev->v4l_reader_count) == 1) {
- if (cx23885_initialize_codec(dev) < 0)
+ if (cx23885_initialize_codec(dev, 1) < 0)
return -EINVAL;
}
}
@@ -1805,5 +1807,11 @@ int cx23885_417_register(struct cx23885_dev *dev)
printk(KERN_INFO "%s: registered device %s [mpeg]\n",
dev->name, video_device_node_name(dev->v4l_device));
+ /* ST: Configure the encoder paramaters, but don't begin
+ * encoding, this resolves an issue where the first time the
+ * encoder is started video can be choppy.
+ */
+ cx23885_initialize_codec(dev, 0);
+
return 0;
}
OpenPOWER on IntegriCloud