V4L/DVB (6831): Audio routes fix for blackbird boards with the wm8775 ADC
authorRicardo Cerqueira <v4l@cerqueira.org>
Sun, 30 Sep 2007 16:02:49 +0000 (13:02 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 25 Jan 2008 21:03:48 +0000 (19:03 -0200)
Fix lack of audio on the MPEG-2 stream of wm8775 based blackbirds.

The wm8775 module initializes the audio input at "route 2", which doesn't
hold true for all boards. The HVR-1300, for example, uses route 1 for
tuner audio, and route 2 for baseband. So we must route the audio to the
proper input depending on what video input is being used.

Signed-off-by: Ricardo Cerqueira <v4l@cerqueira.org>
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-video.c
drivers/media/video/cx88/cx88.h

index f8a786a..d484e5c 100644 (file)
@@ -302,22 +302,22 @@ static const struct cx88_board cx88_boards[] = {
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 0,
                        .gpio0  = 0x0000bde2,
-                       .extadc = 1,
+                       .audioroute = 1,
                },{
                        .type   = CX88_VMUX_COMPOSITE1,
                        .vmux   = 1,
                        .gpio0  = 0x0000bde6,
-                       .extadc = 1,
+                       .audioroute = 1,
                },{
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 2,
                        .gpio0  = 0x0000bde6,
-                       .extadc = 1,
+                       .audioroute = 1,
                }},
                .radio = {
                        .type   = CX88_RADIO,
                        .gpio0  = 0x0000bd62,
-                       .extadc = 1,
+                       .audioroute = 1,
                },
                .mpeg           = CX88_MPEG_BLACKBIRD,
        },
@@ -378,7 +378,7 @@ static const struct cx88_board cx88_boards[] = {
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 2,
                        .gpio0  = 0x0000fde6, // 0x0000fda6 L,R RCA audio in?
-                       .extadc = 1,
+                       .audioroute = 1,
                }},
                .radio = {
                        .type   = CX88_RADIO,
@@ -549,7 +549,7 @@ static const struct cx88_board cx88_boards[] = {
                .input          = {{
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 0,
-                       .extadc = 1,
+                       .audioroute = 1,
                }},
                .mpeg           = CX88_MPEG_BLACKBIRD,
        },
@@ -672,22 +672,22 @@ static const struct cx88_board cx88_boards[] = {
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 0,
                        .gpio0  = 0x00009d80,
-                       .extadc = 1,
+                       .audioroute = 1,
                },{
                        .type   = CX88_VMUX_COMPOSITE1,
                        .vmux   = 1,
                        .gpio0  = 0x00009d76,
-                       .extadc = 1,
+                       .audioroute = 1,
                },{
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 2,
                        .gpio0  = 0x00009d76,
-                       .extadc = 1,
+                       .audioroute = 1,
                }},
                .radio = {
                        .type   = CX88_RADIO,
                        .gpio0  = 0x00009d00,
-                       .extadc = 1,
+                       .audioroute = 1,
                },
                .mpeg           = CX88_MPEG_BLACKBIRD,
        },
@@ -826,23 +826,23 @@ static const struct cx88_board cx88_boards[] = {
                        .type   = CX88_VMUX_COMPOSITE1,
                        .vmux   = 0,
                        .gpio0  = 0x0000cd73,
-                       .extadc = 1,
+                       .audioroute = 1,
                },{
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 1,
                        .gpio0  = 0x0000cd73,
-                       .extadc = 1,
+                       .audioroute = 1,
                },{
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 3,
                        .gpio0  = 0x0000cdb3,
-                       .extadc = 1,
+                       .audioroute = 1,
                }},
                .radio = {
                        .type   = CX88_RADIO,
                        .vmux   = 2,
                        .gpio0  = 0x0000cdf3,
-                       .extadc = 1,
+                       .audioroute = 1,
                },
                .mpeg           = CX88_MPEG_BLACKBIRD,
        },
@@ -1110,12 +1110,12 @@ static const struct cx88_board cx88_boards[] = {
                        .type   = CX88_VMUX_COMPOSITE1,
                        .vmux   = 1,
                        .gpio0  = 0x3de6,
-                       .extadc = 1,
+                       .audioroute = 1,
                },{
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 2,
                        .gpio0  = 0x3de6,
-                       .extadc = 1,
+                       .audioroute = 1,
                }},
                .radio = {
                        .type   = CX88_RADIO,
@@ -1340,17 +1340,17 @@ static const struct cx88_board cx88_boards[] = {
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 0,
                        .gpio0  = 0xe780,
-                       .extadc = 1,
+                       .audioroute = 1,
                },{
                        .type   = CX88_VMUX_COMPOSITE1,
                        .vmux   = 1,
                        .gpio0  = 0xe780,
-                       .extadc = 1,
+                       .audioroute = 2,
                },{
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 2,
                        .gpio0  = 0xe780,
-                       .extadc = 1,
+                       .audioroute = 2,
                }},
                /* fixme: Add radio support */
                .mpeg           = CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD,
index 6d5ea8c..1b80f0f 100644 (file)
@@ -394,9 +394,21 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
 
        if (core->board.mpeg & CX88_MPEG_BLACKBIRD) {
                /* sets sound input from external adc */
-               if (INPUT(input).extadc)
+               if (INPUT(input).audioroute) {
+                       /* The wm8775 module has the "2" route hardwired into
+                          the initialization. Some boards may use different
+                          routes for different inputs. HVR-1300 surely does */
+                       if (core->board.audio_chip &&
+                           core->board.audio_chip == AUDIO_CHIP_WM8775) {
+                               struct v4l2_routing route;
+
+                               route.input = INPUT(input).audioroute;
+                               cx88_call_i2c_clients(core,
+                                       VIDIOC_INT_S_AUDIO_ROUTING,&route);
+                       }
+
                        cx_set(AUD_CTL, EN_I2SIN_ENABLE);
-               else
+               else
                        cx_clear(AUD_CTL, EN_I2SIN_ENABLE);
        }
        return 0;
index f10d432..a10f94d 100644 (file)
@@ -228,7 +228,7 @@ struct cx88_input {
        enum cx88_itype type;
        u32             gpio0, gpio1, gpio2, gpio3;
        unsigned int    vmux:2;
-       unsigned int    extadc:1;
+       unsigned int    audioroute;
 };
 
 struct cx88_board {