Commit 243bf1a2 authored by Devin Heitmueller's avatar Devin Heitmueller Committed by Mauro Carvalho Chehab

[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: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
Cc: Florent Audebert <florent.audebert@anevia.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent af935746
...@@ -614,13 +614,17 @@ static int cx8802_request_acquire(struct cx8802_driver *drv) ...@@ -614,13 +614,17 @@ static int cx8802_request_acquire(struct cx8802_driver *drv)
core->active_type_id != drv->type_id) core->active_type_id != drv->type_id)
return -EBUSY; return -EBUSY;
core->input = 0; if (drv->type_id == CX88_MPEG_DVB) {
for (i = 0; /* When switching to DVB, always set the input to the tuner */
i < (sizeof(core->board.input) / sizeof(struct cx88_input)); core->last_analog_input = core->input;
i++) { core->input = 0;
if (core->board.input[i].type == CX88_VMUX_DVB) { for (i = 0;
core->input = i; i < (sizeof(core->board.input) / sizeof(struct cx88_input));
break; 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) ...@@ -645,6 +649,12 @@ static int cx8802_request_release(struct cx8802_driver *drv)
if (drv->advise_release && --core->active_ref == 0) 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); drv->advise_release(drv);
core->active_type_id = CX88_BOARD_NONE; core->active_type_id = CX88_BOARD_NONE;
mpeg_dbg(1,"%s() Post release GPIO=%x\n", __func__, cx_read(MO_GP0_IO)); mpeg_dbg(1,"%s() Post release GPIO=%x\n", __func__, cx_read(MO_GP0_IO));
......
...@@ -377,6 +377,7 @@ struct cx88_core { ...@@ -377,6 +377,7 @@ struct cx88_core {
u32 audiomode_manual; u32 audiomode_manual;
u32 audiomode_current; u32 audiomode_current;
u32 input; u32 input;
u32 last_analog_input;
u32 astat; u32 astat;
u32 use_nicam; u32 use_nicam;
unsigned long last_change; unsigned long last_change;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment