diff options
author | Devin Heitmueller <dheitmueller@kernellabs.com> | 2011-07-14 11:44:46 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:56:00 -0400 |
commit | 243bf1a24d991f57398aa9d24e408ca83abc6135 (patch) | |
tree | bb2b4dd31635df5bf1afb5d55056748dee895ed7 /drivers/media | |
parent | af935746781088f28904601469671d244d2f653b (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')
-rw-r--r-- | drivers/media/video/cx88/cx88-mpeg.c | 24 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88.h | 1 |
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) | |||
614 | core->active_type_id != drv->type_id) | 614 | core->active_type_id != drv->type_id) |
615 | return -EBUSY; | 615 | return -EBUSY; |
616 | 616 | ||
617 | core->input = 0; | 617 | if (drv->type_id == CX88_MPEG_DVB) { |
618 | for (i = 0; | 618 | /* When switching to DVB, always set the input to the tuner */ |
619 | i < (sizeof(core->board.input) / sizeof(struct cx88_input)); | 619 | core->last_analog_input = core->input; |
620 | i++) { | 620 | core->input = 0; |
621 | if (core->board.input[i].type == CX88_VMUX_DVB) { | 621 | for (i = 0; |
622 | core->input = i; | 622 | i < (sizeof(core->board.input) / sizeof(struct cx88_input)); |
623 | break; | 623 | i++) { |
624 | if (core->board.input[i].type == CX88_VMUX_DVB) { | ||
625 | core->input = i; | ||
626 | break; | ||
627 | } | ||
624 | } | 628 | } |
625 | } | 629 | } |
626 | 630 | ||
@@ -645,6 +649,12 @@ static int cx8802_request_release(struct cx8802_driver *drv) | |||
645 | 649 | ||
646 | if (drv->advise_release && --core->active_ref == 0) | 650 | if (drv->advise_release && --core->active_ref == 0) |
647 | { | 651 | { |
652 | if (drv->type_id == CX88_MPEG_DVB) { | ||
653 | /* If the DVB driver is releasing, reset the input | ||
654 | state to the last configured analog input */ | ||
655 | core->input = core->last_analog_input; | ||
656 | } | ||
657 | |||
648 | drv->advise_release(drv); | 658 | drv->advise_release(drv); |
649 | core->active_type_id = CX88_BOARD_NONE; | 659 | core->active_type_id = CX88_BOARD_NONE; |
650 | mpeg_dbg(1,"%s() Post release GPIO=%x\n", __func__, cx_read(MO_GP0_IO)); | 660 | 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 { | |||
377 | u32 audiomode_manual; | 377 | u32 audiomode_manual; |
378 | u32 audiomode_current; | 378 | u32 audiomode_current; |
379 | u32 input; | 379 | u32 input; |
380 | u32 last_analog_input; | ||
380 | u32 astat; | 381 | u32 astat; |
381 | u32 use_nicam; | 382 | u32 use_nicam; |
382 | unsigned long last_change; | 383 | unsigned long last_change; |