]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (3577): Cleanup audio input handling
authorHans Verkuil <hverkuil@xs4all.nl>
Sun, 19 Mar 2006 00:31:00 +0000 (21:31 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 24 Mar 2006 19:26:56 +0000 (16:26 -0300)
Cleanup audio input handling in bttv and tvaudio:
- inputs were specified that were never used
- mute was handled as a special input which led to confusing code
- confusing naming made it difficult to see if the setting was for
  i2c or gpio.
The old audiochip.h input names moved to tvaudio.h. Currently this
is used both by tvaudio and msp3400 until the msp3400 implements the
new msp3400-specific inputs.
Detect in bttv the tvaudio and msp3400 i2c clients and use these
client pointers to set the inputs directly instead of broadcasting the
command.
Removed AUDC_SET_INPUT. Now replaced by VIDIOC_S_AUDIO. This will be
replaced again later by the new ROUTING commands.
Removed VIDIOC_G_AUDIO implementations in i2c drivers: this command is
a user level command and not to be used internally. It wasn't called at
all anyway.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
24 files changed:
drivers/media/video/bt8xx/bt832.c
drivers/media/video/bt8xx/bttv-cards.c
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/bt8xx/bttv-i2c.c
drivers/media/video/bt8xx/bttv.h
drivers/media/video/bt8xx/bttvp.h
drivers/media/video/cs53l32a.c
drivers/media/video/cx25840/cx25840-audio.c
drivers/media/video/cx25840/cx25840-core.c
drivers/media/video/cx88/cx88.h
drivers/media/video/msp3400-driver.c
drivers/media/video/msp3400-kthreads.c
drivers/media/video/saa7115.c
drivers/media/video/saa7134/saa7134.h
drivers/media/video/tda7432.c
drivers/media/video/tda9875.c
drivers/media/video/tuner-core.c
drivers/media/video/tvaudio.c
drivers/media/video/tveeprom.c
drivers/media/video/v4l2-common.c
drivers/media/video/wm8775.c
include/media/audiochip.h
include/media/tvaudio.h [new file with mode: 0644]
include/media/v4l2-common.h

index f1309d94e96e8b0bf22e6287afdf87589c3d10b8..a51876137880b26babbd24b6ae153aa6d2f9fad1 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-#include <media/audiochip.h>
 #include <media/v4l2-common.h>
 
 #include "bttv.h"
index e869bfbab3789608987cccd8892c8a3460d1e2fb..f209a749205104af0fb8276373d71c7b150bad32 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "bttvp.h"
 #include <media/v4l2-common.h>
+#include <media/tvaudio.h>
 
 /* fwd decl */
 static void boot_msp34xx(struct bttv *btv, int pin);
@@ -336,7 +337,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 15,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 2, 0, 0, 0, 10 },
+               .gpiomux        = { 2, 0, 0, 0 },
+               .gpiomute       = 10,
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -350,7 +352,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 7,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 1, 2, 3, 4 },
+               .gpiomux        = { 0, 1, 2, 3 },
+               .gpiomute       = 4,
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -364,7 +367,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 7,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 4, 0, 2, 3, 1 },
+               .gpiomux        = { 4, 0, 2, 3 },
+               .gpiomute       = 1,
                .no_msp34xx     = 1,
                .needs_tvaudio  = 1,
                .tuner_type     = TUNER_PHILIPS_NTSC,
@@ -383,7 +387,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0 },
+               .gpiomux        = { 0 },
                .needs_tvaudio  = 0,
                .tuner_type     = 4,
                .tuner_addr     = ADDR_UNSET,
@@ -397,7 +401,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 3,
                .muxsel         = { 2, 3, 1, 0 },
-               .audiomux       = { 0, 1, 0, 1, 3 },
+               .gpiomux        = { 0, 1, 0, 1 },
+               .gpiomute       = 3,
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -411,7 +416,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 3,
                .muxsel         = { 2, 3, 1, 1 },
                .gpiomask       = 0x0f,
-               .audiomux       = { 0x0c, 0x04, 0x08, 0x04, 0 },
+               .gpiomux        = { 0x0c, 0x04, 0x08, 0x04 },
                /*                0x04 for some cards ?? */
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
@@ -428,7 +433,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 3,
                .gpiomask       = 0,
                .muxsel         = { 2, 3, 1, 0, 0 },
-               .audiomux       = { 0 },
+               .gpiomux        = { 0 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -444,7 +449,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xc00,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 0xc00, 0x800, 0x400, 0xc00, 0 },
+               .gpiomux        = { 0, 0xc00, 0x800, 0x400 },
+               .gpiomute       = 0xc00,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -459,7 +465,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 3,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 1, 1, 2, 3, 0 },
+               .gpiomux        = { 1, 1, 2, 3 },
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
                .tuner_type     = TUNER_TEMIC_PAL,
@@ -474,7 +480,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x0f, /* old: 7 */
                .muxsel         = { 2, 0, 1, 1 },
-               .audiomux       = { 0, 1, 2, 3, 4 },
+               .gpiomux        = { 0, 1, 2, 3 },
+               .gpiomute       = 4,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -489,7 +496,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x3014f,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0x20001,0x10001, 0, 0,10 },
+               .gpiomux        = { 0x20001,0x10001, 0, 0 },
+               .gpiomute       = 10,
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -505,7 +513,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 15,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 13, 14, 11, 7, 0, 0 },
+               .gpiomux        = { 13, 14, 11, 7 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -519,7 +527,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 15,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 13, 14, 11, 7, 0, 0 },
+               .gpiomux        = { 13, 14, 11, 7 },
                .needs_tvaudio  = 1,
                .msp34xx_alt    = 1,
                .pll            = PLL_28,
@@ -537,7 +545,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 7,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 2, 1, 3, 4 }, /* old: {0, 1, 2, 3, 4} */
+               .gpiomux        = { 0, 2, 1, 3 }, /* old: {0, 1, 2, 3, 4} */
+               .gpiomute       = 4,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -552,7 +561,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 15,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0 , 0, 1 , 0, 10 },
+               .gpiomux        = { 0, 0, 1, 0 },
+               .gpiomute       = 10,
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -570,10 +580,11 @@ struct tvcard bttv_tvcards[] = {
                .muxsel         = { 2, 3, 1, 1 },
        #if 0
                /* old */
-               .audiomux       = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },
+               .gpiomux        = { 0x01c000, 0, 0x018000, 0x014000, 0x002000 },
        #else
                /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */
-               .audiomux       = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
+               .gpiomux        = { 0x001e00, 0, 0x018000, 0x014000 },
+               .gpiomute       = 0x002000,
        #endif
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
@@ -587,7 +598,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x8300f8,
                .muxsel         = { 2, 3, 1, 1,0 },
-               .audiomux       = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007 },
+               .gpiomux        = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 },
+               .gpiomute       = 0xcfa007,
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -603,7 +615,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 1, 0, 0, 0, 0 },
+               .gpiomux        = { 1, 0, 0, 0 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -617,7 +629,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = -1,
                .gpiomask       = 0x8dff00,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0 },
+               .gpiomux        = { 0 },
                .no_msp34xx     = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -644,7 +656,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x1800,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800 },
+               .gpiomux        = { 0, 0x800, 0x1000, 0x1000 },
+               .gpiomute       = 0x1800,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL_I,
                .tuner_addr     = ADDR_UNSET,
@@ -658,7 +671,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xc00,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 1, 0x800, 0x400, 0xc00, 0 },
+               .gpiomux        = { 0, 1, 0x800, 0x400 },
+               .gpiomute       = 0xc00,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -674,7 +688,7 @@ struct tvcard bttv_tvcards[] = {
                .gpiomask       = 7,
                .muxsel         = { 2, 3, -1 },
                .digital_mode   = DIGITAL_MODE_CAMERA,
-               .audiomux       = { 0, 0, 0, 0, 0 },
+               .gpiomux        = { 0, 0, 0, 0 },
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_ALPS_TSBB5_PAL_I,
@@ -691,7 +705,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xe00,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = {0x400, 0x400, 0x400, 0x400, 0xc00 },
+               .gpiomux        = {0x400, 0x400, 0x400, 0x400 },
+               .gpiomute       = 0xc00,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -707,7 +722,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x1f0fff,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0x20000, 0x30000, 0x10000, 0, 0x40000 },
+               .gpiomux        = { 0x20000, 0x30000, 0x10000, 0 },
+               .gpiomute       = 0x40000,
                .needs_tvaudio  = 0,
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -722,7 +738,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 3,
                .gpiomask       = 7,
                .muxsel         = { 2, 0, 1, 1 },
-               .audiomux       = { 0, 1, 2, 3, 4 },
+               .gpiomux        = { 0, 1, 2, 3 },
+               .gpiomute       = 4,
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -736,7 +753,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x1800,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800 },
+               .gpiomux        = { 0, 0x800, 0x1000, 0x1000 },
+               .gpiomute       = 0x1800,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_SECAM,
                .tuner_addr     = ADDR_UNSET,
@@ -752,7 +770,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x1f0fff,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000 },
+               .gpiomux        = { 0x20000, 0x30000, 0x10000, 0x00000 },
+               .gpiomute       = 0x40000,
                .needs_tvaudio  = 0,
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -799,7 +818,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 1, /* was: 4 */
                .gpiomask       = 0,
                .muxsel         = { 2, 3, 1, 0, 0},
-               .audiomux       = { 0 },
+               .gpiomux        = { 0 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -815,7 +834,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x1800,  /* 0x8dfe00 */
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 },
+               .gpiomux        = { 0, 0x0800, 0x1000, 0x1000 },
+               .gpiomute       = 0x1800,
                .pll            = PLL_28,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -829,7 +849,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 3,
                .gpiomask       = 1,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 1, 0, 0, 0, 0 },
+               .gpiomux        = { 1, 0, 0, 0 },
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -845,7 +865,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0 },
+               .gpiomux        = { 0 },
                .needs_tvaudio  = 0,
                .tuner_type     = 4,
                .tuner_addr     = ADDR_UNSET,
@@ -859,7 +879,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xffff00,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0x500, 0, 0x300, 0x900, 0x900 },
+               .gpiomux        = { 0x500, 0, 0x300, 0x900 },
+               .gpiomute       = 0x900,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
@@ -875,11 +896,12 @@ struct tvcard bttv_tvcards[] = {
                .muxsel         = { 2, 3, 1, 1, 0 }, /* TV, CVid, SVid, CVid over SVid connector */
        #if 0
                .gpiomask       = 0xc33000,
-               .audiomux       = { 0x422000,0x1000,0x0000,0x620000,0x800000 },
+               .gpiomux        = { 0x422000,0x1000,0x0000,0x620000,0x800000 },
        #else
                /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
                .gpiomask       = 0xb33000,
-               .audiomux       = { 0x122000,0x1000,0x0000,0x620000,0x800000 },
+               .gpiomux        = { 0x122000,0x1000,0x0000,0x620000 },
+               .gpiomute       = 0x800000,
        #endif
                /* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
                        gpio23 -- hef4052:nEnable (0x800000)
@@ -909,7 +931,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x1800,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800 },
+               .gpiomux        = { 0, 0x800, 0x1000, 0x1000 },
+               .gpiomute       = 0x1800,
                .pll            = PLL_28,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -925,7 +948,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x1800,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
+               .gpiomux        = { 0, 0x800, 0x1000, 0x1000 },
+               .gpiomute       = 0x1800,
                .pll            = PLL_28,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -940,7 +964,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xff,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
+               .gpiomux        = { 0x21, 0x20, 0x24, 0x2c },
+               .gpiomute       = 0x29,
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -955,7 +980,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x551e00,
                .muxsel         = { 2, 3, 1, 0 },
-               .audiomux       = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 },
+               .gpiomux        = { 0x551400, 0x551200, 0, 0 },
+               .gpiomute       = 0x551c00,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = 1,
@@ -971,7 +997,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x03000F,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 2, 0xd0001, 0, 0, 1 },
+               .gpiomux        = { 2, 0xd0001, 0, 0 },
+               .gpiomute       = 1,
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -988,7 +1015,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 7,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 4, 0, 2, 3, 1 },
+               .gpiomux        = { 4, 0, 2, 3 },
+               .gpiomute       = 1,
                .no_msp34xx     = 1,
                .needs_tvaudio  = 1,
                .tuner_type     = TUNER_PHILIPS_NTSC,
@@ -1005,7 +1033,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 15,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 13, 4, 11, 7, 0, 0 },
+               .gpiomux        = { 13, 4, 11, 7 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -1022,7 +1050,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0,
                .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0, 0, 0, 0, 0},
+               .gpiomux        = { 0, 0, 0, 0},
                .needs_tvaudio  = 1,
                .no_msp34xx     = 1,
                .pll            = PLL_28,
@@ -1038,7 +1066,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xe00b,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc },
+               .gpiomux        = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0 },
+               .gpiomute       = 0xff3ffc,
                .no_msp34xx     = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -1054,7 +1083,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = -1,
                .gpiomask       = 3,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 1, 1, 0, 2, 3 },
+               .gpiomux        = { 1, 1, 0, 2 },
+               .gpiomute       = 3,
                .no_msp34xx     = 1,
                .pll            = PLL_NONE,
                .tuner_type     = -1,
@@ -1069,7 +1099,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 3,
                .gpiomask       = 0,
                .muxsel         = { 2, 3, 1, 0, 0 },
-               .audiomux       = { 0 },
+               .gpiomux        = { 0 },
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -1084,7 +1114,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xbcf03f,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f },
+               .gpiomux        = { 0xbc803f, 0xbc903f, 0xbcb03f, 0 },
+               .gpiomute       = 0xbcb03f,
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = 21,
@@ -1099,7 +1130,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x70000,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 },
+               .gpiomux        = { 0x20000, 0x30000, 0x10000, 0 },
+               .gpiomute       = 0x40000,
                .needs_tvaudio  = 1,
                .no_msp34xx     = 1,
                .pll            = PLL_35,
@@ -1118,7 +1150,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 15,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = {2,0,0,0,1 },
+               .gpiomux        = {2,0,0,0 },
+               .gpiomute       = 1,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -1133,7 +1166,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x010f00,
                .muxsel         = {2, 3, 0, 0 },
-               .audiomux       = {0x10000, 0, 0x10000, 0, 0, 0 },
+               .gpiomux        = {0x10000, 0, 0x10000, 0 },
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_ALPS_TSHC6_NTSC,
@@ -1150,7 +1183,8 @@ struct tvcard bttv_tvcards[] = {
                .gpiomask       = 0xAA0000,
                .muxsel         = { 2,3,1,1,-1 },
                .digital_mode   = DIGITAL_MODE_CAMERA,
-               .audiomux       = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000  },
+               .gpiomux        = { 0x20000, 0, 0x80000, 0x80000 },
+               .gpiomute       = 0xa8000,
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL_I,
@@ -1175,7 +1209,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 7,
                .muxsel         = { 2, 0, 1, 1 },
-               .audiomux       = { 0, 1, 2, 3, 4 },
+               .gpiomux        = { 0, 1, 2, 3 },
+               .gpiomute       = 4,
                .pll            = PLL_28,
                .tuner_type     = -1 /* TUNER_ALPS_TMDH2_NTSC */,
                .tuner_addr     = ADDR_UNSET,
@@ -1192,7 +1227,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 3,
                .gpiomask       = 0x03000F,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 1, 0xd0001, 0, 0, 10 },
+               .gpiomux        = { 1, 0xd0001, 0, 0 },
+               .gpiomute       = 10,
                                /* sound path (5 sources):
                                MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable)
                                        0= ext. Audio IN
@@ -1218,7 +1254,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x1c,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 0, 0x10, 8, 4 },
+               .gpiomux        = { 0, 0, 0x10, 8 },
+               .gpiomute       = 4,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
@@ -1230,7 +1267,7 @@ struct tvcard bttv_tvcards[] = {
                /* Tim Röstermundt <rosterm@uni-muenster.de>
                in de.comp.os.unix.linux.hardware:
                        options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
-                       audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
+                       gpiomux =0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
                        options tuner type=5 */
                .name           = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]",
                .video_inputs   = 4,
@@ -1239,7 +1276,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x18e0,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0x0000,0x0800,0x1000,0x1000,0x18e0 },
+               .gpiomux        = { 0x0000,0x0800,0x1000,0x1000 },
+               .gpiomute       = 0x18e0,
                        /* For cards with tda9820/tda9821:
                                0x0000: Tuner normal stereo
                                0x0080: Tuner A2 SAP (second audio program = Zweikanalton)
@@ -1259,7 +1297,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xF,
                .muxsel         = { 2, 3, 1, 0 },
-               .audiomux       = { 2, 0, 0, 0, 10 },
+               .gpiomux        = { 2, 0, 0, 0 },
+               .gpiomute       = 10,
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
                .tuner_type     = TUNER_TEMIC_PAL,
@@ -1277,7 +1316,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x1800,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
+               .gpiomux        = { 0, 0x800, 0x1000, 0x1000 },
+               .gpiomute       = 0x1800,
                .pll            = PLL_28,
                .tuner_type     = 5,
                .tuner_addr     = ADDR_UNSET,
@@ -1294,7 +1334,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 1,
                .gpiomask       = 0,
                .muxsel         = { 3, 1 },
-               .audiomux       = { 0 },
+               .gpiomux        = { 0 },
                .needs_tvaudio  = 0,
                .no_msp34xx     = 1,
                .pll            = PLL_35,
@@ -1311,7 +1351,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xe00,
                .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 },
+               .gpiomux        = { 0x400, 0x400, 0x400, 0x400 },
+               .gpiomute       = 0x800,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_TEMIC_4036FY5_NTSC,
@@ -1327,7 +1368,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x03000F,
                .muxsel         = { 2, 3, 1, 0 },
-               .audiomux       = { 2, 0, 0, 0, 1 },
+               .gpiomux        = { 2, 0, 0, 0 },
+               .gpiomute       = 1,
                .pll            = PLL_28,
                .tuner_type     = 0,
                .tuner_addr     = ADDR_UNSET,
@@ -1344,7 +1386,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = -1,
                .gpiomask       = 11,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 2, 0, 0, 1, 8 },
+               .gpiomux        = { 2, 0, 0, 1 },
+               .gpiomute       = 8,
                .pll            = PLL_35,
                .tuner_type     = TUNER_TEMIC_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -1359,7 +1402,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 1,
                .gpiomask       = 0xF,
                .muxsel         = { 2, 2 },
-               .audiomux       = { },
+               .gpiomux        = { },
                .no_msp34xx     = 1,
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
@@ -1378,7 +1421,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xFF,
                .muxsel         = { 2, 3, 1, 0 },
-               .audiomux       = { 1, 0, 4, 4, 9 },
+               .gpiomux        = { 1, 0, 4, 4 },
+               .gpiomute       = 9,
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
@@ -1394,7 +1438,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xf03f,
                .muxsel         = { 2, 3, 1, 0 },
-               .audiomux       = { 0xbffe, 0, 0xbfff, 0, 0xbffe },
+               .gpiomux        = { 0xbffe, 0, 0xbfff, 0 },
+               .gpiomute       = 0xbffe,
                .pll            = PLL_28,
                .tuner_type     = TUNER_TEMIC_4006FN5_MULTI_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -1411,7 +1456,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = -1,
                .gpiomask       = 1,
                .muxsel         = { 2, 3, 0, 1 },
-               .audiomux       = { 0, 0, 1, 0, 0 },
+               .gpiomux        = { 0, 0, 1, 0 },
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_TEMIC_4006FN5_MULTI_PAL,
@@ -1430,7 +1475,8 @@ struct tvcard bttv_tvcards[] = {
                                /* Radio changed from 1e80 to 0x800 to make
                                FlyVideo2000S in .hu happy (gm)*/
                                /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
-               .audiomux       = { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 },
+               .gpiomux        = { 0x0000,0x0800,0x1000,0x1000 },
+               .gpiomute       = 0x1800,
                .audio_hook     = fv2000s_audio,
                .no_msp34xx     = 1,
                .no_tda9875     = 1,
@@ -1448,7 +1494,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xffff00,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0x500, 0x500, 0x300, 0x900, 0x900 },
+               .gpiomux        = { 0x500, 0x500, 0x300, 0x900 },
+               .gpiomute       = 0x900,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
@@ -1465,7 +1512,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x010f00,
                .muxsel         = {2, 3, 0, 0 },
-               .audiomux       = {0x10000, 0, 0x10000, 0, 0, 0 },
+               .gpiomux        = {0x10000, 0, 0x10000, 0 },
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_SHARP_2U5JF5540_NTSC,
@@ -1486,7 +1533,8 @@ struct tvcard bttv_tvcards[] = {
                .gpiomask       = 0x4f8a00,
                /* 0x100000: 1=MSP enabled (0=disable again)
                * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */
-               .audiomux       = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff},
+               .gpiomux        = {0x947fff, 0x987fff,0x947fff,0x947fff },
+               .gpiomute       = 0x947fff,
                /* tvtuner, radio,   external,internal, mute,  stereo
                * tuner, Composit, SVid, Composit-on-Svid-adapter */
                .muxsel         = { 2, 3 ,0 ,1 },
@@ -1518,7 +1566,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 15,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 0, 11, 7, 13, 0 }, /* TV and Radio with same GPIO ! */
+               .gpiomux        = { 0, 0, 11, 7 }, /* TV and Radio with same GPIO ! */
+               .gpiomute       = 13,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = 25,
@@ -1557,7 +1606,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x3f,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 },
+               .gpiomux        = { 0x01, 0x00, 0x03, 0x03 },
+               .gpiomute       = 0x09,
                .needs_tvaudio  = 1,
                .no_msp34xx     = 1,
                .no_tda9875     = 1,
@@ -1586,7 +1636,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 4,
                .gpiomask       = 0,
                .muxsel         = { 2, 3, 1, 0, 0 },
-               .audiomux       = { 0 },
+               .gpiomux        = { 0 },
                .needs_tvaudio  = 0,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -1618,7 +1668,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x1C800F,  /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */
                .muxsel         = { 2, 1, 1, },
-               .audiomux       = { 0, 1, 2, 2, 4 },
+               .gpiomux        = { 0, 1, 2, 2 },
+               .gpiomute       = 4,
                .needs_tvaudio  = 0,
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -1637,7 +1688,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x140007,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 1, 2, 3, 4, 0 },
+               .gpiomux        = { 0, 1, 2, 3 },
+               .gpiomute       = 4,
                .tuner_type     = TUNER_PHILIPS_NTSC,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
@@ -1651,7 +1703,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = -1,
                .gpiomask       = 0,
                .muxsel         = { 2, 3, 1, 0 },
-               .audiomux       = { 0 },
+               .gpiomux        = { 0 },
                .needs_tvaudio  = 0,
                .no_msp34xx     = 1,
                .pll            = PLL_28,
@@ -1667,13 +1719,14 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 7,
                .muxsel         = { 2, 3, 1, 1 },   /* Tuner, SVid, SVHS, SVid to SVHS connector */
-               .audiomux       = { 0 ,0 ,4, 4,4,4},/* Yes, this tuner uses the same audio output for TV and FM radio!
+               .gpiomux        = { 0, 0, 4, 4 },/* Yes, this tuner uses the same audio output for TV and FM radio!
                                                * This card lacks external Audio In, so we mute it on Ext. & Int.
                                                * The PCB can take a sbx1637/sbx1673, wiring unknown.
                                                * This card lacks PCI subsystem ID, sigh.
-                                               * audiomux=1: lower volume, 2+3: mute
+                                               * gpiomux =1: lower volume, 2+3: mute
                                                * btwincap uses 0x80000/0x80003
                                                */
+               .gpiomute       = 4,
                .needs_tvaudio  = 0,
                .no_msp34xx     = 1,
                .pll            = PLL_28,
@@ -1720,7 +1773,7 @@ struct tvcard bttv_tvcards[] = {
                .radio_addr     = ADDR_UNSET,
 
                .gpiomask       = 7,
-               .audiomux       = {7},
+               .gpiomux        = {7},
        },
        [BTTV_BOARD_GVBCTV5PCI] = {
                .name           = "IODATA GV-BCTV5/PCI",
@@ -1730,7 +1783,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x0f0f80,
                .muxsel         = {2, 3, 1, 0 },
-               .audiomux       = {0x030000, 0x010000, 0, 0, 0x020000, 0},
+               .gpiomux        = {0x030000, 0x010000, 0, 0 },
+               .gpiomute       = 0x020000,
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_NTSC_M,
@@ -1960,7 +2014,7 @@ struct tvcard bttv_tvcards[] = {
                .gpiomask       = 2,
                /* TV, Comp1, Composite over SVID con, SVID */
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 2, 2, 0, 0, 0 },
+               .gpiomux        = { 2, 2, 0, 0 },
                .pll            = PLL_28,
                .has_radio      = 1,
                .tuner_type     = TUNER_PHILIPS_PAL,
@@ -1984,7 +2038,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = -1,
                .gpiomask       = 7,
                .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0, 1, 2, 3, 4},
+               .gpiomux        = { 0, 1, 2, 3},
+               .gpiomute       = 4,
                .needs_tvaudio  = 1,
                .tuner_type     = 5,
                .tuner_addr     = ADDR_UNSET,
@@ -2016,7 +2071,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = -1,
                .gpiomask       = 0,
                .muxsel         = { 2, 3 },
-               .audiomux       = { 0 },
+               .gpiomux        = { 0 },
                .needs_tvaudio  = 0,
                .no_msp34xx     = 1,
                .pll            = PLL_28,
@@ -2035,7 +2090,8 @@ struct tvcard bttv_tvcards[] = {
                .gpiomask       = 0x001e8007,
                .muxsel         = { 2, 3, 1, 0 },
                /*                  Tuner, Radio, external, internal, off,  on */
-               .audiomux       = { 0x08,  0x0f,  0x0a,     0x08,     0x0f, 0x08 },
+               .gpiomux        = { 0x08,  0x0f,  0x0a,     0x08 },
+               .gpiomute       = 0x0f,
                .needs_tvaudio  = 0,
                .no_msp34xx     = 1,
                .pll            = PLL_28,
@@ -2152,7 +2208,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = -1,
                .gpiomask       = 0,
                .muxsel         = { 2, 3, 1, 0 },
-               .audiomux       = { 0 },
+               .gpiomux        = { 0 },
                .needs_tvaudio  = 0,
                .no_msp34xx     = 1,
                .pll            = PLL_28,
@@ -2169,7 +2225,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 3,
                .gpiomask       = 0x00,
                .muxsel         = { 2, 3, 1, 0 },
-               .audiomux       = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
+               .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -2184,7 +2240,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 3,
                .gpiomask       = 0x00,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
+               .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -2204,7 +2260,7 @@ struct tvcard bttv_tvcards[] = {
                                        via the upper nibble of muxsel. here: used for
                                        xternal video-mux */
                .muxsel         = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 },
-               .audiomux       = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
+               .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -2222,7 +2278,7 @@ struct tvcard bttv_tvcards[] = {
                                        via the upper nibble of muxsel. here: used for
                                        xternal video-mux */
                .muxsel         = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 },
-               .audiomux       = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
+               .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -2310,7 +2366,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 3,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 1, 1, 1, 1, 0 },
+               .gpiomux        = { 1, 1, 1, 1 },
                .needs_tvaudio  = 1,
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -2341,7 +2397,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x008007,
                .muxsel         = { 2, 3, 0, 0 },
-               .audiomux       = { 0, 0, 0, 0, 0x000003, 0 },
+               .gpiomux        = { 0, 0, 0, 0 },
+               .gpiomute       = 0x000003,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -2377,7 +2434,7 @@ struct tvcard bttv_tvcards[] = {
                .needs_tvaudio  = 0,
                .gpiomask       = 0x68,
                .muxsel         = { 2, 3, 1 },
-               .audiomux       = { 0x68, 0x68, 0x61, 0x61, 0x00 },
+               .gpiomux        = { 0x68, 0x68, 0x61, 0x61 },
                .pll            = PLL_28,
        },
 
@@ -2392,7 +2449,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x008007,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 1, 2, 2, 3 },
+               .gpiomux        = { 0, 1, 2, 2 },
+               .gpiomute       = 3,
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
@@ -2417,7 +2475,7 @@ struct tvcard bttv_tvcards[] = {
                .no_tda9875     = 1,
                .no_tda7432     = 1,
                .muxsel         = {2,2,2,2},/*878A input is always MUX0, see above.*/
-               .audiomux       = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
+               .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
                .pll            = PLL_28,
                .needs_tvaudio  = 0,
                .muxsel_hook    = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/
@@ -2435,7 +2493,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x0000000f,
                .muxsel         = { 2, 1, 1 },
-               .audiomux       = { 0x02, 0x00, 0x00, 0x00, 0x00 },
+               .gpiomux        = { 0x02, 0x00, 0x00, 0x00 },
                .tuner_type     = TUNER_TEMIC_PAL,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
@@ -2491,7 +2549,7 @@ struct tvcard bttv_tvcards[] = {
                .muxsel           = { 2, 2, 2, 2, 2, 2, 2, 2,
                                3, 3, 3, 3, 3, 3, 3, 3 },
                .muxsel_hook      = sigmaSQ_muxsel,
-               .audiomux         = { 0 },
+               .gpiomux          = { 0 },
                .no_msp34xx       = 1,
                .pll              = PLL_28,
                .tuner_type       = -1,
@@ -2508,7 +2566,7 @@ struct tvcard bttv_tvcards[] = {
                .gpiomask         = 0x0,
                .muxsel           = { 2, 2, 2, 2 },
                .muxsel_hook      = sigmaSLC_muxsel,
-               .audiomux         = { 0 },
+               .gpiomux          = { 0 },
                .no_msp34xx       = 1,
                .pll              = PLL_28,
                .tuner_type       = -1,
@@ -2526,7 +2584,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = -1,
                .gpiomask       = 0xFF,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 2, 0, 0, 0, 10 },
+               .gpiomux        = { 2, 0, 0, 0 },
+               .gpiomute       = 10,
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
@@ -2560,7 +2619,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x3f,
                .muxsel         = {2, 3, 1, 0 },
-               .audiomux       = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31 },
+               .gpiomux        = {0x31, 0x31, 0x31, 0x31 },
+               .gpiomute       = 0x31,
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_NTSC_M,
@@ -2583,7 +2643,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
                .gpiomask       = 0x008007,
-               .audiomux       = { 0, 0x000001,0,0, 0 },
+               .gpiomux        = { 0, 0x000001,0,0 },
                .needs_tvaudio  = 1,
                .has_radio      = 1,
        },
@@ -2693,7 +2753,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .muxsel         = { 2, 3, 1 },
                .gpiomask       = 0x00e00007,
-               .audiomux       = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 },
+               .gpiomux        = { 0x00400005, 0, 0x00000001, 0 },
+               .gpiomute       = 0x00c00007,
                .no_msp34xx     = 1,
                .no_tda9875     = 1,
                .no_tda7432     = 1,
@@ -2709,7 +2770,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x01fe00,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
+               .gpiomux        = { 0x001e00, 0, 0x018000, 0x014000 },
+               .gpiomute       = 0x002000,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_YMEC_TVF66T5_B_DFF,
@@ -2726,7 +2788,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x001c0007,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 1, 2, 2, 3 },
+               .gpiomux        = { 0, 1, 2, 2 },
+               .gpiomute       = 3,
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
                .tuner_type     = TUNER_TENA_9533_DI,
@@ -2745,7 +2808,8 @@ struct tvcard bttv_tvcards[] = {
                .gpiomask      = 0x01fe00,
                .muxsel        = { 2,3,1,1,-1 },
                .digital_mode  = DIGITAL_MODE_CAMERA,
-               .audiomux      = { 0x00400, 0x10400, 0x04400, 0x80000, 0x12400, 0x46000  },
+               .gpiomux       = { 0x00400, 0x10400, 0x04400, 0x80000 },
+               .gpiomute      = 0x12400,
                .no_msp34xx    = 1,
                .pll           = PLL_28,
                .tuner_type    = TUNER_LG_PAL_FM,
@@ -2763,7 +2827,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x3f,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
+               .gpiomux        = { 0x21, 0x20, 0x24, 0x2c },
+               .gpiomute       = 0x29,
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_YMEC_TVF_5533MF,
@@ -2797,7 +2862,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 15,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 2, 0, 0, 0, 1 },
+               .gpiomux        = { 2, 0, 0, 0 },
+               .gpiomute       = 1,
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = 2,
@@ -2813,7 +2879,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x108007,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 100000, 100002, 100002, 100000 },
+               .gpiomux        = { 100000, 100002, 100002, 100000 },
                .no_msp34xx     = 1,
                .no_tda9875     = 1,
                .no_tda7432     = 1,
@@ -2853,7 +2919,8 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 7,
                .muxsel         = { 2, 3, 1, 1 },
-               .audiomux       = { 0, 1, 2, 3, 4 },
+               .gpiomux        = { 0, 1, 2, 3 },
+               .gpiomute       = 4,
                .tuner_type     = TUNER_TEMIC_4009FR5_PAL,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
@@ -2925,20 +2992,20 @@ void __devinit bttv_idcard(struct bttv *btv)
        if (UNSET != audiomux[0]) {
                gpiobits = 0;
                for (i = 0; i < 5; i++) {
-                       bttv_tvcards[btv->c.type].audiomux[i] = audiomux[i];
+                       bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i];
                        gpiobits |= audiomux[i];
                }
        } else {
                gpiobits = audioall;
                for (i = 0; i < 5; i++) {
-                       bttv_tvcards[btv->c.type].audiomux[i] = audioall;
+                       bttv_tvcards[btv->c.type].gpiomux[i] = audioall;
                }
        }
        bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
        printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
               btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
        for (i = 0; i < 5; i++) {
-               printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].audiomux[i]);
+               printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].gpiomux[i]);
        }
        printk("\n");
 }
@@ -3796,18 +3863,18 @@ void bttv_tda9880_setnorm(struct bttv *btv, int norm)
 {
        /* fix up our card entry */
        if(norm==VIDEO_MODE_NTSC) {
-               bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x957fff;
-               bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x957fff;
+               bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff;
+               bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x957fff;
                dprintk("bttv_tda9880_setnorm to NTSC\n");
        }
        else {
-               bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x947fff;
-               bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x947fff;
+               bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x947fff;
+               bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x947fff;
                dprintk("bttv_tda9880_setnorm to PAL\n");
        }
        /* set GPIO according */
        gpio_bits(bttv_tvcards[btv->c.type].gpiomask,
-                 bttv_tvcards[btv->c.type].audiomux[btv->audio]);
+                 bttv_tvcards[btv->c.type].gpiomux[btv->audio]);
 }
 
 
index 71535775f2e86d96dda811230be613932289c581..be567ec9e1450fb20a42d1254872a0ed2c7a57a8 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/kdev_t.h>
 #include "bttvp.h"
 #include <media/v4l2-common.h>
+#include <media/tvaudio.h>
 
 #include <linux/dma-mapping.h>
 
@@ -926,45 +927,65 @@ video_mux(struct bttv *btv, unsigned int input)
 
 static char *audio_modes[] = {
        "audio: tuner", "audio: radio", "audio: extern",
-       "audio: intern", "audio: off"
+       "audio: intern", "audio: mute"
 };
 
 static int
-audio_mux(struct bttv *btv, int mode)
+audio_mux(struct bttv *btv, int input, int mute)
 {
-       int val,mux,i2c_mux,signal;
+       int gpio_val, signal;
+       struct v4l2_audio aud_input;
+       struct v4l2_control ctrl;
+       struct i2c_client *c;
 
+       memset(&aud_input, 0, sizeof(aud_input));
        gpio_inout(bttv_tvcards[btv->c.type].gpiomask,
                   bttv_tvcards[btv->c.type].gpiomask);
        signal = btread(BT848_DSTATUS) & BT848_DSTATUS_HLOC;
 
-       switch (mode) {
-       case AUDIO_MUTE:
-               btv->audio |= AUDIO_MUTE;
-               break;
-       case AUDIO_UNMUTE:
-               btv->audio &= ~AUDIO_MUTE;
-               break;
-       case AUDIO_TUNER:
-       case AUDIO_RADIO:
-       case AUDIO_EXTERN:
-       case AUDIO_INTERN:
-               btv->audio &= AUDIO_MUTE;
-               btv->audio |= mode;
-       }
-       i2c_mux = mux = (btv->audio & AUDIO_MUTE) ? AUDIO_OFF : btv->audio;
-       if (btv->opt_automute && !signal && !btv->radio_user)
-               mux = AUDIO_OFF;
-
-       val = bttv_tvcards[btv->c.type].audiomux[mux];
-       gpio_bits(bttv_tvcards[btv->c.type].gpiomask,val);
+       btv->mute = mute;
+       btv->audio = input;
+
+       /* automute */
+       mute = mute || (btv->opt_automute && !signal && !btv->radio_user);
+
+       if (mute)
+               gpio_val = bttv_tvcards[btv->c.type].gpiomute;
+       else
+               gpio_val = bttv_tvcards[btv->c.type].gpiomux[input];
+       aud_input.index = btv->audio;
+
+       gpio_bits(bttv_tvcards[btv->c.type].gpiomask, gpio_val);
        if (bttv_gpio)
-               bttv_gpio_tracking(btv,audio_modes[mux]);
-       if (!in_interrupt())
-               bttv_call_i2c_clients(btv,AUDC_SET_INPUT,&(i2c_mux));
+               bttv_gpio_tracking(btv, audio_modes[mute ? 4 : input]);
+       if (in_interrupt())
+               return 0;
+
+       ctrl.id = V4L2_CID_AUDIO_MUTE;
+       /* take automute into account, just btv->mute is not enough */
+       ctrl.value = mute;
+       bttv_call_i2c_clients(btv, VIDIOC_S_CTRL, &ctrl);
+       c = btv->i2c_msp34xx_client;
+       if (c)
+               c->driver->command(c, VIDIOC_S_AUDIO, &aud_input);
+       c = btv->i2c_tvaudio_client;
+       if (c)
+               c->driver->command(c, VIDIOC_S_AUDIO, &aud_input);
        return 0;
 }
 
+static inline int
+audio_mute(struct bttv *btv, int mute)
+{
+       return audio_mux(btv, btv->audio, mute);
+}
+
+static inline int
+audio_input(struct bttv *btv, int input)
+{
+       return audio_mux(btv, input, btv->mute);
+}
+
 static void
 i2c_vidiocschan(struct bttv *btv)
 {
@@ -1023,8 +1044,8 @@ set_input(struct bttv *btv, unsigned int input)
        } else {
                video_mux(btv,input);
        }
-       audio_mux(btv,(input == bttv_tvcards[btv->c.type].tuner ?
-                      AUDIO_TUNER : AUDIO_EXTERN));
+       audio_input(btv,(input == bttv_tvcards[btv->c.type].tuner ?
+                      TVAUDIO_INPUT_TUNER : TVAUDIO_INPUT_EXTERN));
        set_tvnorm(btv,btv->tvnorm);
        i2c_vidiocschan(btv);
 }
@@ -1236,10 +1257,10 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
        case V4L2_CID_AUDIO_MUTE:
                if (c->value) {
                        va.flags |= VIDEO_AUDIO_MUTE;
-                       audio_mux(btv, AUDIO_MUTE);
+                       audio_mute(btv, 1);
                } else {
                        va.flags &= ~VIDEO_AUDIO_MUTE;
-                       audio_mux(btv, AUDIO_UNMUTE);
+                       audio_mute(btv, 0);
                }
                break;
 
@@ -1654,7 +1675,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
                        return -EINVAL;
 
                mutex_lock(&btv->lock);
-               audio_mux(btv, (v->flags&VIDEO_AUDIO_MUTE) ? AUDIO_MUTE : AUDIO_UNMUTE);
+               audio_mute(btv, (v->flags&VIDEO_AUDIO_MUTE) ? 1 : 0);
                bttv_call_i2c_clients(btv,cmd,v);
 
                /* card specific hooks */
@@ -3163,8 +3184,8 @@ static int radio_open(struct inode *inode, struct file *file)
 
        file->private_data = btv;
 
-       bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type);
-       audio_mux(btv,AUDIO_RADIO);
+       bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL);
+       audio_input(btv,TVAUDIO_INPUT_RADIO);
 
        mutex_unlock(&btv->lock);
        return 0;
@@ -3750,7 +3771,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
                        bttv_irq_switch_video(btv);
 
                if ((astat & BT848_INT_HLOCK)  &&  btv->opt_automute)
-                       audio_mux(btv, -1);
+                       audio_mute(btv, btv->mute);  /* trigger automute */
 
                if (astat & (BT848_INT_SCERR|BT848_INT_OCERR)) {
                        printk(KERN_INFO "bttv%d: %s%s @ %08x,",btv->c.nr,
@@ -4051,7 +4072,7 @@ static int __devinit bttv_probe(struct pci_dev *dev,
                bt848_contrast(btv,32768);
                bt848_hue(btv,32768);
                bt848_sat(btv,32768);
-               audio_mux(btv,AUDIO_MUTE);
+               audio_mute(btv, 1);
                set_input(btv,0);
        }
 
index 614c12018557a0e75d813c66afe1816201d00b33..4b562b386fcf6d044882077359763bb2e84ac241 100644 (file)
@@ -302,6 +302,10 @@ static int attach_inform(struct i2c_client *client)
        if (!client->driver->command)
                return 0;
 
+       if (client->driver->id == I2C_DRIVERID_MSP3400)
+               btv->i2c_msp34xx_client = client;
+       if (client->driver->id == I2C_DRIVERID_TVAUDIO)
+               btv->i2c_tvaudio_client = client;
        if (btv->tuner_type != UNSET) {
                struct tuner_setup tun_setup;
 
index ebde3e8219cf08c412a30501cee0ba739bb2a7d0..3a23265c153860a1efe06176576f4aa2e02ed32e 100644 (file)
@@ -234,7 +234,8 @@ struct tvcard
        unsigned int digital_mode; // DIGITAL_MODE_CAMERA or DIGITAL_MODE_VIDEO
        u32 gpiomask;
        u32 muxsel[16];
-       u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */
+       u32 gpiomux[4];  /* Tuner, Radio, external, internal */
+       u32 gpiomute;    /* GPIO mute setting */
        u32 gpiomask2;   /* GPIO MUX mask */
 
        /* i2c audio flags */
index 12223a2039606d223a9e0c0e791d908ceec8383b..ee989d2e15d9ede516d1ff51113f7c6a64a29809 100644 (file)
@@ -41,7 +41,6 @@
 
 #include <linux/device.h>
 #include <media/video-buf.h>
-#include <media/audiochip.h>
 #include <media/tuner.h>
 #include <media/tveeprom.h>
 #include <media/ir-common.h>
@@ -299,6 +298,8 @@ struct bttv {
        int                        i2c_state, i2c_rc;
        int                        i2c_done;
        wait_queue_head_t          i2c_queue;
+       struct i2c_client         *i2c_msp34xx_client;
+       struct i2c_client         *i2c_tvaudio_client;
 
        /* video4linux (1) */
        struct video_device *video_dev;
@@ -321,6 +322,7 @@ struct bttv {
        /* video state */
        unsigned int input;
        unsigned int audio;
+       unsigned int mute;
        unsigned long freq;
        int tvnorm,hue,contrast,bright,saturation;
        struct v4l2_framebuffer fbuf;
index 8739c64785ef4a2c73092c9b4c12d64d3fc84305..bc3331870240fb7ee2ca5478e13afa2a42d2f107 100644 (file)
@@ -75,11 +75,6 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
                cs53l32a_write(client, 0x01, 0x01 + (input->index << 4));
                break;
 
-       case VIDIOC_G_AUDIO:
-               memset(input, 0, sizeof(*input));
-               input->index = (cs53l32a_read(client, 0x01) >> 4) & 3;
-               break;
-
        case VIDIOC_G_CTRL:
                if (ctrl->id == V4L2_CID_AUDIO_MUTE) {
                        ctrl->value = (cs53l32a_read(client, 0x03) & 0xc0) != 0;
index cb9a7981e4081bc9ac284b2ff26c47b6f84fdd23..a4540e858f213883fa5cfe8d40b3fdbc46e4611b 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <linux/videodev2.h>
 #include <linux/i2c.h>
-#include <media/audiochip.h>
 #include <media/v4l2-common.h>
 
 #include "cx25840.h"
index bcb7ef85eb23d6e19352f44eeb925f0152ada2f5..7aee37645d63973adaca029627d5aa21444ef1ee 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/slab.h>
 #include <linux/videodev2.h>
 #include <linux/i2c.h>
-#include <media/audiochip.h>
 #include <media/v4l2-common.h>
 
 #include "cx25840.h"
@@ -764,16 +763,6 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
                return set_input(client, state->vid_input, input->index);
        }
 
-       case VIDIOC_G_AUDIO:
-       {
-               struct v4l2_audio *input = arg;
-
-               memset(input, 0, sizeof(*input));
-               input->index = state->aud_input;
-               input->capability = V4L2_AUDCAP_STEREO;
-               break;
-       }
-
        case VIDIOC_S_FREQUENCY:
                input_change(client);
                break;
index 5b2e499eab22e4f08168c2fc7858b25430bc8bea..326a25f147f67c4e96ee16cd81d92b107829c0cd 100644 (file)
@@ -27,7 +27,6 @@
 
 #include <media/tuner.h>
 #include <media/tveeprom.h>
-#include <media/audiochip.h>
 #include <media/video-buf.h>
 #include <media/video-buf-dvb.h>
 
index 11ea9765769c7df12e8181040502d4339e295fc8..bd0b036c5cab25cf912745bda11450a9594a0062 100644 (file)
@@ -53,7 +53,7 @@
 #include <linux/videodev.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-common.h>
-#include <media/audiochip.h>
+#include <media/tvaudio.h>
 #include <linux/kthread.h>
 #include <linux/suspend.h>
 #include "msp3400.h"
@@ -585,51 +585,12 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl)
 static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
 {
        struct msp_state *state = i2c_get_clientdata(client);
-       u16 *sarg = arg;
        int scart = 0;
 
        if (msp_debug >= 2)
                v4l_i2c_print_ioctl(client, cmd);
 
        switch (cmd) {
-       case AUDC_SET_INPUT:
-               if (*sarg == state->input)
-                       break;
-               state->input = *sarg;
-               switch (*sarg) {
-               case AUDIO_RADIO:
-                       /* Hauppauge uses IN2 for the radio */
-                       state->mode = MSP_MODE_FM_RADIO;
-                       scart       = SCART_IN2;
-                       break;
-               case AUDIO_EXTERN_1:
-                       /* IN1 is often used for external input ... */
-                       state->mode = MSP_MODE_EXTERN;
-                       scart       = SCART_IN1;
-                       break;
-               case AUDIO_EXTERN_2:
-                       /* ... sometimes it is IN2 through ;) */
-                       state->mode = MSP_MODE_EXTERN;
-                       scart       = SCART_IN2;
-                       break;
-               case AUDIO_TUNER:
-                       state->mode = -1;
-                       break;
-               default:
-                       if (*sarg & AUDIO_MUTE)
-                               msp_set_scart(client, SCART_MUTE, 0);
-                       break;
-               }
-               if (scart) {
-                       state->rxsubchans = V4L2_TUNER_SUB_STEREO;
-                       msp_set_scart(client, scart, 0);
-                       msp_write_dsp(client, 0x000d, 0x1900);
-                       if (state->opmode != OPMODE_AUTOSELECT)
-                               msp_set_audmode(client);
-               }
-               msp_wake_thread(client);
-               break;
-
        case AUDC_SET_RADIO:
                if (state->radio)
                        return 0;
@@ -750,82 +711,27 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
                return 0;
        }
 
-       case VIDIOC_ENUMINPUT:
-       {
-               struct v4l2_input *i = arg;
-
-               if (i->index != 0)
-                       return -EINVAL;
-
-               i->type = V4L2_INPUT_TYPE_TUNER;
-               switch (i->index) {
-               case AUDIO_RADIO:
-                       strcpy(i->name, "Radio");
-                       break;
-               case AUDIO_EXTERN_1:
-                       strcpy(i->name, "Extern 1");
-                       break;
-               case AUDIO_EXTERN_2:
-                       strcpy(i->name, "Extern 2");
-                       break;
-               case AUDIO_TUNER:
-                       strcpy(i->name, "Television");
-                       break;
-               default:
-                       return -EINVAL;
-               }
-               return 0;
-       }
-
-       case VIDIOC_G_AUDIO:
-       {
-               struct v4l2_audio *a = arg;
-
-               memset(a, 0, sizeof(*a));
-
-               switch (a->index) {
-               case AUDIO_RADIO:
-                       strcpy(a->name, "Radio");
-                       break;
-               case AUDIO_EXTERN_1:
-                       strcpy(a->name, "Extern 1");
-                       break;
-               case AUDIO_EXTERN_2:
-                       strcpy(a->name, "Extern 2");
-                       break;
-               case AUDIO_TUNER:
-                       strcpy(a->name, "Television");
-                       break;
-               default:
-                       return -EINVAL;
-               }
-
-               a->capability = V4L2_AUDCAP_STEREO;
-               a->mode = 0;  /* TODO: add support for AVL */
-               break;
-       }
-
        case VIDIOC_S_AUDIO:
        {
                struct v4l2_audio *sarg = arg;
 
                switch (sarg->index) {
-               case AUDIO_RADIO:
+               case TVAUDIO_INPUT_RADIO:
                        /* Hauppauge uses IN2 for the radio */
                        state->mode = MSP_MODE_FM_RADIO;
                        scart       = SCART_IN2;
                        break;
-               case AUDIO_EXTERN_1:
+               case TVAUDIO_INPUT_EXTERN:
                        /* IN1 is often used for external input ... */
                        state->mode = MSP_MODE_EXTERN;
                        scart       = SCART_IN1;
                        break;
-               case AUDIO_EXTERN_2:
+               case TVAUDIO_INPUT_INTERN:
                        /* ... sometimes it is IN2 through ;) */
                        state->mode = MSP_MODE_EXTERN;
                        scart       = SCART_IN2;
                        break;
-               case AUDIO_TUNER:
+               case TVAUDIO_INPUT_TUNER:
                        state->mode = -1;
                        break;
                }
index 852ab6a115faf1eb365ec6297497194aee8e709a..71a944b447e21716826b7cd3af063d8753fcd294 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/videodev.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-common.h>
-#include <media/audiochip.h>
 #include <linux/kthread.h>
 #include <linux/suspend.h>
 #include "msp3400.h"
index b184fd00b4e779270f41f0625fe331fa68b5466d..b05015282601d37dbd7243332f26d8b8fcdc008e 100644 (file)
@@ -40,7 +40,6 @@
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-common.h>
-#include <media/audiochip.h>
 #include <asm/div64.h>
 
 MODULE_DESCRIPTION("Philips SAA7113/SAA7114/SAA7115 video decoder driver");
index 104bd2e054e5ade39081272f65c8347f66c4323e..31ba293854c1951912dd81543e3ab72bd2d587ee 100644 (file)
@@ -34,7 +34,6 @@
 #include <asm/io.h>
 
 #include <media/tuner.h>
-#include <media/audiochip.h>
 #include <media/ir-common.h>
 #include <media/ir-kbd-i2c.h>
 #include <media/video-buf.h>
index 12b8981efd1344047e3637c6d2d208b80ec61be1..78e043ac9ea0e39fa2195d0b9ddba060db56361b 100644 (file)
@@ -48,7 +48,6 @@
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
 
-#include <media/audiochip.h>
 #include <media/v4l2-common.h>
 #include <media/i2c-addr.h>
 
index ccfd3b90ea9f1654d18bd353536445cae508a01b..103ccb91929260353df41e36a2e0be86ae882dc2 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/i2c-algo-bit.h>
 #include <linux/init.h>
 
-#include <media/audiochip.h>
 
 #include <media/i2c-addr.h>
 
@@ -47,7 +46,6 @@ I2C_CLIENT_INSMOD;
 
 /* This is a superset of the TDA9875 */
 struct tda9875 {
-       int mode;
        int rvol, lvol;
        int bass, treble;
        struct i2c_client c;
@@ -197,7 +195,6 @@ static void do_tda9875_init(struct i2c_client *client)
 
        tda9875_write(client, TDA9875_MUT, 0xcc );   /* General mute  */
 
-       t->mode=AUDIO_UNMUTE;
        t->lvol=t->rvol =0;     /* 0dB */
        t->bass=0;                      /* 0dB */
        t->treble=0;            /* 0dB */
index 32e1849441fb45947bd5b2be561bed1e6950d048..df195c905366c774d16bdfff47987d2523cff297 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <media/tuner.h>
 #include <media/v4l2-common.h>
-#include <media/audiochip.h>
 
 #define UNSET (-1U)
 
index 4cc0497dcbde6aa65b548336186b5d14bf5cb729..15fd55ff69ca93cbedba3219523b4d29688026af 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/init.h>
 #include <linux/smp_lock.h>
 
-#include <media/audiochip.h>
+#include <media/tvaudio.h>
 #include <media/v4l2-common.h>
 
 #include <media/i2c-addr.h>
@@ -102,7 +102,7 @@ struct CHIPDESC {
 
        /* input switch register + values for v4l inputs */
        int  inputreg;
-       int  inputmap[8];
+       int  inputmap[4];
        int  inputmute;
        int  inputmask;
 };
@@ -119,9 +119,10 @@ struct CHIPSTATE {
        audiocmd   shadow;
 
        /* current settings */
-       __u16 left,right,treble,bass,mode;
+       __u16 left,right,treble,bass,muted,mode;
        int prevmode;
        int radio;
+       int input;
 
        /* thread */
        pid_t                tpid;
@@ -1101,9 +1102,8 @@ static int tda8425_shift12(int val) { return (val >> 12) | 0xf0; }
 static int tda8425_initialize(struct CHIPSTATE *chip)
 {
        struct CHIPDESC *desc = chiplist + chip->type;
-       int inputmap[8] = { /* tuner    */ TDA8425_S1_CH2, /* radio  */ TDA8425_S1_CH1,
-                           /* extern   */ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF,
-                           /* off      */ TDA8425_S1_OFF, /* on     */ TDA8425_S1_CH2};
+       int inputmap[4] = { /* tuner    */ TDA8425_S1_CH2, /* radio  */ TDA8425_S1_CH1,
+                           /* extern   */ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF};
 
        if (chip->c.adapter->id == I2C_HW_B_RIVA) {
                memcpy (desc->inputmap, inputmap, sizeof (inputmap));
@@ -1298,7 +1298,7 @@ static struct CHIPDESC chiplist[] = {
                .init       = { 4, { TDA9873_SW, 0xa4, 0x06, 0x03 } },
                .inputreg   = TDA9873_SW,
                .inputmute  = TDA9873_MUTE | TDA9873_AUTOMUTE,
-               .inputmap   = {0xa0, 0xa2, 0xa0, 0xa0, 0xc0},
+               .inputmap   = {0xa0, 0xa2, 0xa0, 0xa0},
                .inputmask  = TDA9873_INP_MASK|TDA9873_MUTE|TDA9873_AUTOMUTE,
 
        },
@@ -1446,8 +1446,7 @@ static struct CHIPDESC chiplist[] = {
                .inputmap   = {PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_TUNER,
                             PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_LINE,
                             PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_LINE,
-                            PIC16C54_MISC_SND_MUTE,PIC16C54_MISC_SND_MUTE,
-                            PIC16C54_MISC_SND_NOTMUTE},
+                            PIC16C54_MISC_SND_MUTE},
                .inputmute  = PIC16C54_MISC_SND_MUTE,
        },
        {
@@ -1583,28 +1582,40 @@ static int chip_detach(struct i2c_client *client)
        return 0;
 }
 
+static int tvaudio_set_ctrl(struct CHIPSTATE *chip, struct v4l2_control *ctrl)
+{
+       struct CHIPDESC *desc = chiplist + chip->type;
+
+       switch (ctrl->id) {
+       case V4L2_CID_AUDIO_MUTE:
+               if (ctrl->value < 0 || ctrl->value >= 2)
+                       return -ERANGE;
+               chip->muted = ctrl->value;
+               if (chip->muted)
+                       chip_write_masked(chip,desc->inputreg,desc->inputmute,desc->inputmask);
+               else
+                       chip_write_masked(chip,desc->inputreg,
+                                       desc->inputmap[chip->input],desc->inputmask);
+               break;
+       default:
+               return -EINVAL;
+       }
+       return 0;
+}
+
+
 /* ---------------------------------------------------------------------- */
 /* video4linux interface                                                  */
 
 static int chip_command(struct i2c_client *client,
                        unsigned int cmd, void *arg)
 {
-       __u16 *sarg = arg;
        struct CHIPSTATE *chip = i2c_get_clientdata(client);
        struct CHIPDESC  *desc = chiplist + chip->type;
 
        v4l_dbg(1, debug, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd);
 
        switch (cmd) {
-       case AUDC_SET_INPUT:
-               if (desc->flags & CHIP_HAS_INPUTSEL) {
-                       if (*sarg & 0x80)
-                               chip_write_masked(chip,desc->inputreg,desc->inputmute,desc->inputmask);
-                       else
-                               chip_write_masked(chip,desc->inputreg,desc->inputmap[*sarg],desc->inputmask);
-               }
-               break;
-
        case AUDC_SET_RADIO:
                chip->radio = 1;
                chip->watch_stereo = 0;
@@ -1668,6 +1679,24 @@ static int chip_command(struct i2c_client *client,
                break;
        }
 
+       case VIDIOC_S_CTRL:
+               return tvaudio_set_ctrl(chip, arg);
+
+       case VIDIOC_S_AUDIO:
+       {
+               struct v4l2_audio *sarg = arg;
+
+               if (!(desc->flags & CHIP_HAS_INPUTSEL) || sarg->index >= 4)
+                               return -EINVAL;
+               /* There are four inputs: tuner, radio, extern and intern. */
+               chip->input = sarg->index;
+               if (chip->muted)
+                       break;
+               chip_write_masked(chip, desc->inputreg,
+                               desc->inputmap[chip->input], desc->inputmask);
+               break;
+       }
+
        case VIDIOC_S_TUNER:
        {
                struct v4l2_tuner *vt = arg;
index 582551b0969b69f678d775b0ba84b72b800924d4..e0d2ff83fc917e8583a67bf5d8b45f783e027386 100644 (file)
@@ -248,32 +248,32 @@ audioIC[] =
        {AUDIO_CHIP_MSP34XX,  "MSP3410D"},
        {AUDIO_CHIP_MSP34XX,  "MSP3415"},
        {AUDIO_CHIP_MSP34XX,  "MSP3430"},
-       {AUDIO_CHIP_UNKNOWN,  "MSP3438"},
+       {AUDIO_CHIP_MSP34XX,  "MSP3438"},
        {AUDIO_CHIP_UNKNOWN,  "CS5331"},
        /* 10-14 */
        {AUDIO_CHIP_MSP34XX,  "MSP3435"},
        {AUDIO_CHIP_MSP34XX,  "MSP3440"},
        {AUDIO_CHIP_MSP34XX,  "MSP3445"},
-       {AUDIO_CHIP_UNKNOWN,  "MSP3411"},
-       {AUDIO_CHIP_UNKNOWN,  "MSP3416"},
+       {AUDIO_CHIP_MSP34XX,  "MSP3411"},
+       {AUDIO_CHIP_MSP34XX,  "MSP3416"},
        /* 15-19 */
        {AUDIO_CHIP_MSP34XX,  "MSP3425"},
-       {AUDIO_CHIP_UNKNOWN,  "MSP3451"},
-       {AUDIO_CHIP_UNKNOWN,  "MSP3418"},
+       {AUDIO_CHIP_MSP34XX,  "MSP3451"},
+       {AUDIO_CHIP_MSP34XX,  "MSP3418"},
        {AUDIO_CHIP_UNKNOWN,  "Type 0x12"},
        {AUDIO_CHIP_UNKNOWN,  "OKI7716"},
        /* 20-24 */
-       {AUDIO_CHIP_UNKNOWN,  "MSP4410"},
-       {AUDIO_CHIP_UNKNOWN,  "MSP4420"},
-       {AUDIO_CHIP_UNKNOWN,  "MSP4440"},
-       {AUDIO_CHIP_UNKNOWN,  "MSP4450"},
-       {AUDIO_CHIP_UNKNOWN,  "MSP4408"},
+       {AUDIO_CHIP_MSP34XX,  "MSP4410"},
+       {AUDIO_CHIP_MSP34XX,  "MSP4420"},
+       {AUDIO_CHIP_MSP34XX,  "MSP4440"},
+       {AUDIO_CHIP_MSP34XX,  "MSP4450"},
+       {AUDIO_CHIP_MSP34XX,  "MSP4408"},
        /* 25-29 */
-       {AUDIO_CHIP_UNKNOWN,  "MSP4418"},
-       {AUDIO_CHIP_UNKNOWN,  "MSP4428"},
-       {AUDIO_CHIP_UNKNOWN,  "MSP4448"},
-       {AUDIO_CHIP_UNKNOWN,  "MSP4458"},
-       {AUDIO_CHIP_UNKNOWN,  "Type 0x1d"},
+       {AUDIO_CHIP_MSP34XX,  "MSP4418"},
+       {AUDIO_CHIP_MSP34XX,  "MSP4428"},
+       {AUDIO_CHIP_MSP34XX,  "MSP4448"},
+       {AUDIO_CHIP_MSP34XX,  "MSP4458"},
+       {AUDIO_CHIP_MSP34XX,  "Type 0x1d"},
        /* 30-34 */
        {AUDIO_CHIP_INTERNAL, "CX880"},
        {AUDIO_CHIP_INTERNAL, "CX881"},
index 1717663d3e51b378636e46a95b6bf4479386f723..d1234d781e166c2665e95e7babf2e02949c32ded 100644 (file)
@@ -312,7 +312,6 @@ static const char *v4l2_int_ioctls[] = {
        [_IOC_NR(DECODER_DUMP)]                = "DECODER_DUMP",
 #endif
        [_IOC_NR(AUDC_SET_RADIO)]              = "AUDC_SET_RADIO",
-       [_IOC_NR(AUDC_SET_INPUT)]              = "AUDC_SET_INPUT",
        [_IOC_NR(MSP_SET_MATRIX)]              = "MSP_SET_MATRIX",
 
        [_IOC_NR(TUNER_SET_TYPE_ADDR)]         = "TUNER_SET_TYPE_ADDR",
@@ -419,7 +418,6 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
        case TUNER_SET_TYPE_ADDR:
        case TUNER_SET_STANDBY:
        case TDA9887_SET_CONFIG:
-       case AUDC_SET_INPUT:
        case VIDIOC_OVERLAY_OLD:
        case VIDIOC_STREAMOFF:
        case VIDIOC_G_OUTPUT:
index 8cb64f8a8a9182b8e5f9a146c8d4f3fba8d9381d..9b90225226e625d0630167b894322f0ef3820271 100644 (file)
@@ -102,11 +102,6 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd,
                wm8775_write(client, R21, 0x100 + state->input);
                break;
 
-       case VIDIOC_G_AUDIO:
-               memset(input, 0, sizeof(*input));
-               input->index = state->input;
-               break;
-
        case VIDIOC_G_CTRL:
                if (ctrl->id != V4L2_CID_AUDIO_MUTE)
                        return -EINVAL;
index 295d256ee811c63f5b533906851926d63a2ab1e8..1fd4a2207574670846c9a85fbd43e99564d4e543 100644 (file)
@@ -21,18 +21,4 @@ enum audiochip {
        AUDIO_CHIP_MSP34XX
 };
 
-/* ---------------------------------------------------------------------- */
-
-/* audio inputs */
-#define AUDIO_TUNER        0x00
-#define AUDIO_RADIO        0x01
-#define AUDIO_EXTERN       0x02
-#define AUDIO_INTERN       0x03
-#define AUDIO_OFF          0x04
-#define AUDIO_ON           0x05
-#define AUDIO_EXTERN_1     AUDIO_EXTERN
-#define AUDIO_EXTERN_2     0x06
-#define AUDIO_MUTE         0x80
-#define AUDIO_UNMUTE       0x81
-
 #endif /* AUDIOCHIP_H */
diff --git a/include/media/tvaudio.h b/include/media/tvaudio.h
new file mode 100644 (file)
index 0000000..6915aaf
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+    tvaudio.h - definition for tvaudio inputs
+
+    Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef _TVAUDIO_H
+#define _TVAUDIO_H
+
+/* The tvaudio module accepts the following inputs: */
+#define TVAUDIO_INPUT_TUNER  0
+#define TVAUDIO_INPUT_RADIO  1
+#define TVAUDIO_INPUT_EXTERN 2
+#define TVAUDIO_INPUT_INTERN 3
+
+#endif
index 2360453e7496546b4c82cd885e2005e362096517..07130474a0df640ea7c383464027fb2fd7576f63 100644 (file)
@@ -123,9 +123,6 @@ enum v4l2_chip_ident {
 /* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */
 #define AUDC_SET_RADIO        _IO('d',88)
 
-/* select from TV,radio,extern,MUTE, to be replaced with VIDIOC_INT_S_AUDIO_ROUTING */
-#define AUDC_SET_INPUT        _IOW('d',89,int)
-
 /* msp3400 ioctl: will be removed in the near future, to be replaced by
    VIDIOC_INT_S_AUDIO_ROUTING. */
 struct msp_matrix {
@@ -209,10 +206,10 @@ struct v4l2_routing {
 };
 
 /* These internal commands should be used to define the inputs and outputs
-   of an audio/video chip. They will replace AUDC_SET_INPUT.
-   The v4l2 API commands VIDIOC_S/G_INPUT, VIDIOC_S/G_OUTPUT,
-   VIDIOC_S/G_AUDIO and VIDIOC_S/G_AUDOUT are meant to be used by the
-   user. Internally these commands should be used to switch inputs/outputs
+   of an audio/video chip. They will replace the v4l2 API commands
+   VIDIOC_S/G_INPUT, VIDIOC_S/G_OUTPUT, VIDIOC_S/G_AUDIO and VIDIOC_S/G_AUDOUT
+   that are meant to be used by the user.
+   The internal commands should be used to switch inputs/outputs
    because only the driver knows how to map a 'Television' input to the precise
    input/output routing of an A/D converter, or a DSP, or a video digitizer.
    These four commands should only be sent directly to an i2c device, they