]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
V4L/DVB (10833): em28xx: enable Compro VideoMate ForYou sound
authorVitaly Wool <vital@embeddedalley.com>
Wed, 4 Mar 2009 11:27:52 +0000 (08:27 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:43:07 +0000 (12:43 -0300)
Compro VideoMate uses an external audio DSP chip, controlled via tvaudio
module (tda9874a). This patch improves em28xx infrastructure to support
an external audio processor and fixes the Compro VideoMate entry to work
with it.

Signed-off-by: Vitaly Wool <vital@embeddedalley.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/em28xx/em28xx-cards.c
drivers/media/video/em28xx/em28xx-core.c
drivers/media/video/em28xx/em28xx-i2c.c
drivers/media/video/em28xx/em28xx-video.c
drivers/media/video/em28xx/em28xx.h

index f7c8177657526551c383735b5cf50d895b2e3447..650ccfda14288dbb1a81c84bfa20a9fb5c63ca6d 100644 (file)
@@ -122,6 +122,22 @@ static struct em28xx_reg_seq default_tuner_gpio[] = {
        {  -1,                  -1,             -1,             -1},
 };
 
+/* Mute/unmute */
+static struct em28xx_reg_seq compro_unmute_tv_gpio[] = {
+       {EM28XX_R08_GPIO,       5,              7,              10},
+       {  -1,                  -1,             -1,             -1},
+};
+
+static struct em28xx_reg_seq compro_unmute_svid_gpio[] = {
+       {EM28XX_R08_GPIO,       4,              7,              10},
+       {  -1,                  -1,             -1,             -1},
+};
+
+static struct em28xx_reg_seq compro_mute_gpio[] = {
+       {EM28XX_R08_GPIO,       6,              7,              10},
+       {  -1,                  -1,             -1,             -1},
+};
+
 /*
  *  Board definitions
  */
@@ -1225,14 +1241,17 @@ struct em28xx_board em28xx_boards[] = {
                .tda9887_conf = TDA9887_PRESENT,
                .decoder      = EM28XX_TVP5150,
                .adecoder     = EM28XX_TVAUDIO,
+               .mute_gpio    = compro_mute_gpio,
                .input        = { {
                        .type     = EM28XX_VMUX_TELEVISION,
                        .vmux     = TVP5150_COMPOSITE0,
-                       .amux     = EM28XX_AMUX_LINE_IN,
+                       .amux     = EM28XX_AMUX_VIDEO,
+                       .gpio     = compro_unmute_tv_gpio,
                }, {
                        .type     = EM28XX_VMUX_SVIDEO,
                        .vmux     = TVP5150_SVIDEO,
                        .amux     = EM28XX_AMUX_LINE_IN,
+                       .gpio     = compro_unmute_svid_gpio,
                } },
        },
        [EM2860_BOARD_KAIOMY_TVNPC_U2] = {
index eee8d015b249c50470c602a5d9e92e117040dfad..c896d24032f581ea7bd453edb875b2f01099065f 100644 (file)
@@ -378,6 +378,11 @@ static int em28xx_set_audio_source(struct em28xx *dev)
                }
        }
 
+       if (dev->board.mute_gpio && dev->mute)
+               em28xx_gpio_set(dev, dev->board.mute_gpio);
+       else
+               em28xx_gpio_set(dev, INPUT(dev->ctl_input)->gpio);
+
        ret = em28xx_write_reg_bits(dev, EM28XX_R0E_AUDIOSRC, input, 0xc0);
        if (ret < 0)
                return ret;
index 2dab43d22da2d69615b20865290488dbfe07929d..02c12fe6361be60834745e8e76c1b87e1f42873e 100644 (file)
@@ -510,12 +510,17 @@ static int attach_inform(struct i2c_client *client)
                dprintk1(1, "attach_inform: tvp5150 detected.\n");
                break;
 
+       case 0xb0:
+               dprintk1(1, "attach_inform: tda9874 detected\n");
+               break;
+
        default:
                if (!dev->tuner_addr)
                        dev->tuner_addr = client->addr;
 
                dprintk1(1, "attach inform: detected I2C address %x\n",
                                client->addr << 1);
+               dprintk1(1, "driver id %d\n", client->driver->id);
 
        }
 
@@ -554,6 +559,7 @@ static char *i2c_devs[128] = {
        [0x80 >> 1] = "msp34xx",
        [0x88 >> 1] = "msp34xx",
        [0xa0 >> 1] = "eeprom",
+       [0xb0 >> 1] = "tda9874",
        [0xb8 >> 1] = "tvp5150a",
        [0xba >> 1] = "tvp5150a",
        [0xc0 >> 1] = "tuner (analog)",
index efd641587e04d6809633f138da2ab5344716335a..575472f1e7029ffcce9797354d8fb1c8ae797e63 100644 (file)
@@ -540,6 +540,13 @@ static void video_mux(struct em28xx *dev, int index)
                        &route);
        }
 
+       if (dev->board.adecoder != EM28XX_NOADECODER) {
+               route.input = dev->ctl_ainput;
+               route.output = dev->ctl_aoutput;
+               em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING,
+                       &route);
+       }
+
        em28xx_audio_analog_set(dev);
 }
 
index 57a4084f9b5e297721c0d3d9908e8d88d847d41b..a33a58da016e708feb5adb9f9912a048452ed46d 100644 (file)
@@ -374,6 +374,7 @@ struct em28xx_board {
        struct em28xx_reg_seq *dvb_gpio;
        struct em28xx_reg_seq *suspend_gpio;
        struct em28xx_reg_seq *tuner_gpio;
+       struct em28xx_reg_seq *mute_gpio;
 
        unsigned int is_em2800:1;
        unsigned int has_msp34xx:1;