summaryrefslogtreecommitdiff
path: root/drivers/media/video/cx88
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2011-07-14 12:44:46 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 17:56:00 -0300
commit243bf1a24d991f57398aa9d24e408ca83abc6135 (patch)
treebb2b4dd31635df5bf1afb5d55056748dee895ed7 /drivers/media/video/cx88
parentaf935746781088f28904601469671d244d2f653b (diff)
[media] cx88: properly maintain decoder config when using MPEG encoder
The cx88 driver would force core->input to always be zero when doing the the request_acquire(). While it wasn't actually changing the input register in the hardware, the driver makes decision based on the current input. In particular, it decides whether to do things like enabling the comb filter when on a composite input but disabling it on s-video. So for example, on the HVR-1300, using the s-video input with the MPEG encoder would end up with the video decoder core configured as though the input type were composite. In short, the driver state did not match the hardware state. This patch does two things: 1. It forces the input to zero only if actually switching to DVB mode. This prevents the input from changing when the blackbird driver opens the device. 2. Keep track of what the input was set to when switching to DVB, and reset it back when done. This eliminates a condition where for example the user had the analog side of the board set to capture on the s-video input, then he used DVB for a bit, then the analog input would unexpectedly be set to the tuner input. This work was sponsored by Anevia S.A. Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Cc: Florent Audebert <florent.audebert@anevia.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c24
-rw-r--r--drivers/media/video/cx88/cx88.h1
2 files changed, 18 insertions, 7 deletions
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index ccd8797ffc83..cd5386ee210c 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -614,13 +614,17 @@ static int cx8802_request_acquire(struct cx8802_driver *drv)
core->active_type_id != drv->type_id)
return -EBUSY;
- core->input = 0;
- for (i = 0;
- i < (sizeof(core->board.input) / sizeof(struct cx88_input));
- i++) {
- if (core->board.input[i].type == CX88_VMUX_DVB) {
- core->input = i;
- break;
+ if (drv->type_id == CX88_MPEG_DVB) {
+ /* When switching to DVB, always set the input to the tuner */
+ core->last_analog_input = core->input;
+ core->input = 0;
+ for (i = 0;
+ i < (sizeof(core->board.input) / sizeof(struct cx88_input));
+ i++) {
+ if (core->board.input[i].type == CX88_VMUX_DVB) {
+ core->input = i;
+ break;
+ }
}
}
@@ -645,6 +649,12 @@ static int cx8802_request_release(struct cx8802_driver *drv)
if (drv->advise_release && --core->active_ref == 0)
{
+ if (drv->type_id == CX88_MPEG_DVB) {
+ /* If the DVB driver is releasing, reset the input
+ state to the last configured analog input */
+ core->input = core->last_analog_input;
+ }
+
drv->advise_release(drv);
core->active_type_id = CX88_BOARD_NONE;
mpeg_dbg(1,"%s() Post release GPIO=%x\n", __func__, cx_read(MO_GP0_IO));
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 425c9fbcc750..fa8d307e1a3d 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -377,6 +377,7 @@ struct cx88_core {
u32 audiomode_manual;
u32 audiomode_current;
u32 input;
+ u32 last_analog_input;
u32 astat;
u32 use_nicam;
unsigned long last_change;