V4L/DVB (4757): Cx88: determine whether or not to use external adc
Michael Krufky [Mon, 16 Oct 2006 19:51:11 +0000 (16:51 -0300)]
Some cx88-blackbird boards use an external adc, but not necessarily
for all inputs.  Thus, this needs to be configurable on the card level
for each input.
This patch allows for the usage of the external adc to be determined
by a bit setting in the cx88_input struct for cards based on the cx88
blackbird design.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>

drivers/media/video/cx88/cx88-cards.c
drivers/media/video/cx88/cx88-tvaudio.c
drivers/media/video/cx88/cx88-video.c
drivers/media/video/cx88/cx88.h

index 3597993..d7cf54b 100644 (file)
@@ -281,18 +281,22 @@ struct cx88_board cx88_boards[] = {
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 0,
                        .gpio0  = 0x0000bde2,
+                       .extadc = 1,
                },{
                        .type   = CX88_VMUX_COMPOSITE1,
                        .vmux   = 1,
                        .gpio0  = 0x0000bde6,
+                       .extadc = 1,
                },{
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 2,
                        .gpio0  = 0x0000bde6,
+                       .extadc = 1,
                }},
                .radio = {
                        .type   = CX88_RADIO,
                        .gpio0  = 0x0000bd62,
+                       .extadc = 1,
                },
                .mpeg           = CX88_MPEG_BLACKBIRD,
        },
@@ -523,6 +527,7 @@ struct cx88_board cx88_boards[] = {
                .input          = {{
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 0,
+                       .extadc = 1,
                }},
                .mpeg           = CX88_MPEG_BLACKBIRD,
        },
@@ -646,18 +651,22 @@ struct cx88_board cx88_boards[] = {
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 0,
                        .gpio0  = 0x00009d80,
+                       .extadc = 1,
                },{
                        .type   = CX88_VMUX_COMPOSITE1,
                        .vmux   = 1,
                        .gpio0  = 0x00009d76,
+                       .extadc = 1,
                },{
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 2,
                        .gpio0  = 0x00009d76,
+                       .extadc = 1,
                }},
                .radio = {
                        .type   = CX88_RADIO,
                        .gpio0  = 0x00009d00,
+                       .extadc = 1,
                },
                .mpeg           = CX88_MPEG_BLACKBIRD,
        },
@@ -790,19 +799,23 @@ struct cx88_board cx88_boards[] = {
                        .type   = CX88_VMUX_COMPOSITE1,
                        .vmux   = 0,
                        .gpio0  = 0x0000cd73,
+                       .extadc = 1,
                },{
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 1,
                        .gpio0  = 0x0000cd73,
+                       .extadc = 1,
                },{
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 3,
                        .gpio0  = 0x0000cdb3,
+                       .extadc = 1,
                }},
                .radio = {
                        .type   = CX88_RADIO,
                        .vmux   = 2,
                        .gpio0  = 0x0000cdf3,
+                       .extadc = 1,
                },
                .mpeg           = CX88_MPEG_BLACKBIRD,
        },
@@ -1293,14 +1306,17 @@ struct cx88_board cx88_boards[] = {
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 0,
                        .gpio0  = 0xe780,
+                       .extadc = 1,
                },{
                        .type   = CX88_VMUX_COMPOSITE1,
                        .vmux   = 1,
                        .gpio0  = 0xe780,
+                       .extadc = 1,
                },{
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 2,
                        .gpio0  = 0xe780,
+                       .extadc = 1,
                }},
                /* fixme: Add radio support */
                .mpeg           = CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD,
index 58ba9f7..3482e01 100644 (file)
@@ -143,19 +143,6 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
        cx88_start_audio_dma(core);
 
        if (cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD) {
-               /* sets sound input from external adc */
-               switch (core->board) {
-               case CX88_BOARD_HAUPPAUGE_ROSLYN:
-               case CX88_BOARD_KWORLD_MCE200_DELUXE:
-               case CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT:
-               case CX88_BOARD_PIXELVIEW_PLAYTV_P7000:
-               case CX88_BOARD_ASUS_PVR_416:
-                       cx_clear(AUD_CTL, EN_I2SIN_ENABLE);
-                       break;
-               default:
-                       cx_set(AUD_CTL, EN_I2SIN_ENABLE);
-               }
-
                cx_write(AUD_I2SINPUTCNTL, 4);
                cx_write(AUD_BAUDRATE, 1);
                /* 'pass-thru mode': this enables the i2s output to the mpeg encoder */
index f273121..8613378 100644 (file)
@@ -454,6 +454,14 @@ static int video_mux(struct cx88_core *core, unsigned int input)
                cx_clear(MO_FILTER_ODD,   0x00002020);
                break;
        }
+
+       if (cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD) {
+               /* sets sound input from external adc */
+               if (INPUT(input)->extadc)
+                       cx_set(AUD_CTL, EN_I2SIN_ENABLE);
+               else
+                       cx_clear(AUD_CTL, EN_I2SIN_ENABLE);
+       }
        return 0;
 }
 
index 5980e47..7054e94 100644 (file)
@@ -225,6 +225,7 @@ struct cx88_input {
        enum cx88_itype type;
        unsigned int    vmux;
        u32             gpio0, gpio1, gpio2, gpio3;
+       unsigned int    extadc:1;
 };
 
 struct cx88_board {