diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2009-01-28 21:32:59 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 12:42:47 -0300 |
commit | 6f98700a5bb8d218162b04db1b8a3921a0dcc7ce (patch) | |
tree | d1782240b51f6e0f1400187da9af020cd7a25f99 /drivers/media | |
parent | 430390e67b39ccf56d98286f5e5a72d903c9cf87 (diff) | |
download | talos-op-linux-6f98700a5bb8d218162b04db1b8a3921a0dcc7ce.tar.gz talos-op-linux-6f98700a5bb8d218162b04db1b8a3921a0dcc7ce.zip |
V4L/DVB (10567): bttv: shrink muxsel data in card database
Over half of the card database was used to store muxsel data. 64 bytes
were used to store one 32 bit word for each of up to 16 inputs.
The Bt8x8 only has two bits to control its mux, so muxsel data for 16
inputs will fit into a single 32 bit word. There were a couple cards that
had special muxsel data that didn't fit in two bits, but I cleaned them up
in earlier patches.
Unfortunately, C doesn't allow us to have an array of bit fields. This
makes initializing the structure more of a pain. But with some cpp magic,
we can do it by changing:
.muxsel = { 2, 3, 0, 1 },
.muxsel = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 1 },
Into:
.muxsel = MUXSEL(2, 3, 0, 1),
.muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 1),
That's not so bad. MUXSEL is a fancy macro that packs the arguments (of
which there can be one to sixteen!) into a single word two bits at a time.
It's a compile time constant (a variadic function wouldn't be) so we can
use it to initialize the structure. It's important the the arguments to
the macro only be plain decimal integers. Stuff like "0x01", "(2)", or
"MUX3" won't work properly.
I also created an accessor function, bttv_muxsel(btv, input), that gets the
mux bits for the selected input. It makes it cleaner to change the way the
muxsel data is stored.
This patch doesn't change the code size and decreases the datasegment by
9440 bytes.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-cards.c | 316 | ||||
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 2 | ||||
-rw-r--r-- | drivers/media/video/bt8xx/bttv.h | 30 | ||||
-rw-r--r-- | drivers/media/video/bt8xx/bttvp.h | 6 |
4 files changed, 195 insertions, 159 deletions
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index fc2b796b25fc..fd1ab7a15cd4 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c @@ -323,7 +323,7 @@ struct tvcard bttv_tvcards[] = { .name = " *** UNKNOWN/GENERIC *** ", .video_inputs = 4, .svhs = 2, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, }, @@ -333,7 +333,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 15, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 2, 0, 0, 0 }, .gpiomute = 10, .needs_tvaudio = 1, @@ -346,7 +346,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 7, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 1, 2, 3 }, .gpiomute = 4, .needs_tvaudio = 1, @@ -359,7 +359,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 7, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 4, 0, 2, 3 }, .gpiomute = 1, .no_msp34xx = 1, @@ -377,7 +377,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = 2, .gpiomask = 0, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0 }, .needs_tvaudio = 0, .tuner_type = TUNER_ABSENT, @@ -389,7 +389,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 3, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .gpiomux = { 0, 1, 0, 1 }, .gpiomute = 3, .needs_tvaudio = 1, @@ -401,7 +401,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 3, /* .audio_inputs= 1, */ .svhs = 3, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomask = 0x0f, .gpiomux = { 0x0c, 0x04, 0x08, 0x04 }, /* 0x04 for some cards ?? */ @@ -417,7 +417,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 3, .gpiomask = 0, - .muxsel = { 2, 3, 1, 0, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0, 0), .gpiomux = { 0 }, .needs_tvaudio = 1, .tuner_type = TUNER_ABSENT, @@ -431,7 +431,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0xc00, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 0xc00, 0x800, 0x400 }, .gpiomute = 0xc00, .needs_tvaudio = 1, @@ -445,7 +445,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 3, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 1, 1, 2, 3 }, .needs_tvaudio = 0, .pll = PLL_28, @@ -458,7 +458,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x0f, /* old: 7 */ - .muxsel = { 2, 0, 1, 1 }, + .muxsel = MUXSEL(2, 0, 1, 1), .gpiomux = { 0, 1, 2, 3 }, .gpiomute = 4, .needs_tvaudio = 1, @@ -472,7 +472,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x3014f, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x20001,0x10001, 0, 0 }, .gpiomute = 10, .needs_tvaudio = 1, @@ -487,7 +487,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 15, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 13, 14, 11, 7 }, .needs_tvaudio = 1, .tuner_type = UNSET, @@ -499,7 +499,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 4, */ .svhs = 2, .gpiomask = 15, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 13, 14, 11, 7 }, .needs_tvaudio = 1, .msp34xx_alt = 1, @@ -515,7 +515,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 7, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 2, 1, 3 }, /* old: {0, 1, 2, 3, 4} */ .gpiomute = 4, .needs_tvaudio = 1, @@ -529,7 +529,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 15, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 0, 1, 0 }, .gpiomute = 10, .needs_tvaudio = 1, @@ -544,7 +544,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x01fe00, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */ .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, .gpiomute = 0x002000, @@ -559,7 +559,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x8300f8, - .muxsel = { 2, 3, 1, 1,0 }, + .muxsel = MUXSEL(2, 3, 1, 1, 0), .gpiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 }, .gpiomute = 0xcfa007, .needs_tvaudio = 1, @@ -574,7 +574,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 2, */ .svhs = 2, .gpiomask = 0, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 1, 0, 0, 0 }, .needs_tvaudio = 1, .tuner_type = UNSET, @@ -586,7 +586,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = NO_SVHS, .gpiomask = 0x8dff00, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0 }, .no_msp34xx = 1, .tuner_type = TUNER_ABSENT, @@ -599,7 +599,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 3, /* .audio_inputs= 3, */ .svhs = 2, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, }, @@ -609,7 +609,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 2, tuner, line in */ .svhs = 2, .gpiomask = 0x1800, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, .gpiomute = 0x1800, .pll = PLL_28, @@ -622,7 +622,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0xc00, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 1, 0x800, 0x400 }, .gpiomute = 0xc00, .needs_tvaudio = 1, @@ -637,7 +637,7 @@ struct tvcard bttv_tvcards[] = { .svhs = NO_SVHS, .has_dig_in = 1, .gpiomask = 7, - .muxsel = { 2, 3, 0 }, /* input 2 is digital */ + .muxsel = MUXSEL(2, 3, 0), /* input 2 is digital */ /* .digital_mode= DIGITAL_MODE_CAMERA, */ .gpiomux = { 0, 0, 0, 0 }, .no_msp34xx = 1, @@ -653,7 +653,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0xe00, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = {0x400, 0x400, 0x400, 0x400 }, .gpiomute = 0xc00, .needs_tvaudio = 1, @@ -668,7 +668,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x1f0fff, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, .gpiomute = 0x40000, .needs_tvaudio = 0, @@ -682,7 +682,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 3, .gpiomask = 7, - .muxsel = { 2, 0, 1, 1 }, + .muxsel = MUXSEL(2, 0, 1, 1), .gpiomux = { 0, 1, 2, 3 }, .gpiomute = 4, .needs_tvaudio = 1, @@ -695,7 +695,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 2, */ .svhs = 2, .gpiomask = 0x1800, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, .gpiomute = 0x1800, .pll = PLL_28, @@ -710,7 +710,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x1f0fff, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x20000, 0x30000, 0x10000, 0x00000 }, .gpiomute = 0x40000, .needs_tvaudio = 0, @@ -756,7 +756,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 1, /* was: 4 */ .gpiomask = 0, - .muxsel = { 2, 3, 1, 0, 0}, + .muxsel = MUXSEL(2, 3, 1, 0, 0), .gpiomux = { 0 }, .needs_tvaudio = 1, .tuner_type = TUNER_ABSENT, @@ -770,7 +770,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x1800, /* 0x8dfe00 */ - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 0x0800, 0x1000, 0x1000 }, .gpiomute = 0x1800, .pll = PLL_28, @@ -783,7 +783,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 3, .gpiomask = 1, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 1, 0, 0, 0 }, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, @@ -797,7 +797,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = 2, .gpiomask = 0, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0 }, .needs_tvaudio = 0, .tuner_type = TUNER_ABSENT, @@ -809,7 +809,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0xffff00, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x500, 0, 0x300, 0x900 }, .gpiomute = 0x900, .needs_tvaudio = 1, @@ -822,7 +822,8 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 4, /* .audio_inputs= 1, */ .svhs = 2, - .muxsel = { 2, 3, 1, 1, 0 }, /* TV, CVid, SVid, CVid over SVid connector */ + /* TV, CVid, SVid, CVid over SVid connector */ + .muxsel = MUXSEL(2, 3, 1, 1, 0), /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ .gpiomask = 0xb33000, .gpiomux = { 0x122000,0x1000,0x0000,0x620000 }, @@ -852,7 +853,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 3, */ .svhs = 2, .gpiomask = 0x1800, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, .gpiomute = 0x1800, .pll = PLL_28, @@ -867,7 +868,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 3, */ .svhs = 2, .gpiomask = 0x1800, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, .gpiomute = 0x1800, .pll = PLL_28, @@ -881,7 +882,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0xff, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x21, 0x20, 0x24, 0x2c }, .gpiomute = 0x29, .no_msp34xx = 1, @@ -895,7 +896,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x551e00, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .gpiomux = { 0x551400, 0x551200, 0, 0 }, .gpiomute = 0x551c00, .needs_tvaudio = 1, @@ -910,7 +911,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x03000F, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 2, 0xd0001, 0, 0 }, .gpiomute = 1, .needs_tvaudio = 0, @@ -926,7 +927,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 7, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 4, 0, 2, 3 }, .gpiomute = 1, .no_msp34xx = 1, @@ -942,7 +943,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 4, */ .svhs = 2, .gpiomask = 15, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 13, 4, 11, 7 }, .needs_tvaudio = 1, .pll = PLL_28, @@ -957,7 +958,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0, - .muxsel = { 2, 3, 1, 1}, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 0, 0, 0}, .needs_tvaudio = 1, .no_msp34xx = 1, @@ -971,7 +972,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0xe00b, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0 }, .gpiomute = 0xff3ffc, .no_msp34xx = 1, @@ -986,7 +987,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = NO_SVHS, .gpiomask = 3, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 1, 1, 0, 2 }, .gpiomute = 3, .no_msp34xx = 1, @@ -1000,7 +1001,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 3, .gpiomask = 0, - .muxsel = { 2, 3, 1, 0, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0, 0), .gpiomux = { 0 }, .no_msp34xx = 1, .pll = PLL_28, @@ -1013,7 +1014,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0xbcf03f, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0 }, .gpiomute = 0xbcb03f, .no_msp34xx = 1, @@ -1027,7 +1028,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x70000, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, .gpiomute = 0x40000, .needs_tvaudio = 1, @@ -1045,7 +1046,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 15, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = {2,0,0,0 }, .gpiomute = 1, .needs_tvaudio = 1, @@ -1059,7 +1060,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x010f00, - .muxsel = {2, 3, 0, 0 }, + .muxsel = MUXSEL(2, 3, 0, 0), .gpiomux = {0x10000, 0, 0x10000, 0 }, .no_msp34xx = 1, .pll = PLL_28, @@ -1074,7 +1075,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 3, .has_dig_in = 1, .gpiomask = 0xAA0000, - .muxsel = { 2, 3, 1, 1, 0 }, /* input 4 is digital */ + .muxsel = MUXSEL(2, 3, 1, 1, 0), /* in 4 is digital */ /* .digital_mode= DIGITAL_MODE_CAMERA, */ .gpiomux = { 0x20000, 0, 0x80000, 0x80000 }, .gpiomute = 0xa8000, @@ -1099,7 +1100,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 7, - .muxsel = { 2, 0, 1, 1 }, + .muxsel = MUXSEL(2, 0, 1, 1), .gpiomux = { 0, 1, 2, 3 }, .gpiomute = 4, .pll = PLL_28, @@ -1115,7 +1116,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 3, .gpiomask = 0x03000F, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 1, 0xd0001, 0, 0 }, .gpiomute = 10, /* sound path (5 sources): @@ -1140,7 +1141,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 3, */ .svhs = 2, .gpiomask = 0x1c, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 0, 0x10, 8 }, .gpiomute = 4, .needs_tvaudio = 1, @@ -1160,7 +1161,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x18e0, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x0000,0x0800,0x1000,0x1000 }, .gpiomute = 0x18e0, /* For cards with tda9820/tda9821: @@ -1179,7 +1180,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0xF, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .gpiomux = { 2, 0, 0, 0 }, .gpiomute = 10, .needs_tvaudio = 0, @@ -1196,7 +1197,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 3, */ .svhs = 2, .gpiomask = 0x1800, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, .gpiomute = 0x1800, .pll = PLL_28, @@ -1212,7 +1213,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = 1, .gpiomask = 0, - .muxsel = { 3, 1 }, + .muxsel = MUXSEL(3, 1), .gpiomux = { 0 }, .needs_tvaudio = 0, .no_msp34xx = 1, @@ -1227,7 +1228,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0xe00, - .muxsel = { 2, 3, 1, 1}, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x400, 0x400, 0x400, 0x400 }, .gpiomute = 0x800, .needs_tvaudio = 1, @@ -1242,7 +1243,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x03000F, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .gpiomux = { 2, 0, 0, 0 }, .gpiomute = 1, .pll = PLL_28, @@ -1258,7 +1259,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 2, */ .svhs = NO_SVHS, .gpiomask = 11, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 2, 0, 0, 1 }, .gpiomute = 8, .pll = PLL_35, @@ -1272,7 +1273,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = 1, .gpiomask = 0xF, - .muxsel = { 2, 2 }, + .muxsel = MUXSEL(2, 2), .gpiomux = { }, .no_msp34xx = 1, .needs_tvaudio = 0, @@ -1289,7 +1290,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 2, */ .svhs = 2, .gpiomask = 0xFF, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .gpiomux = { 1, 0, 4, 4 }, .gpiomute = 9, .needs_tvaudio = 0, @@ -1304,7 +1305,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0xf03f, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .gpiomux = { 0xbffe, 0, 0xbfff, 0 }, .gpiomute = 0xbffe, .pll = PLL_28, @@ -1320,7 +1321,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = NO_SVHS, .gpiomask = 1, - .muxsel = { 2, 3, 0, 1 }, + .muxsel = MUXSEL(2, 3, 0, 1), .gpiomux = { 0, 0, 1, 0 }, .no_msp34xx = 1, .pll = PLL_28, @@ -1334,7 +1335,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 3, */ .svhs = 2, .gpiomask = 0x18e0, - .muxsel = { 2, 3, 0, 1 }, + .muxsel = MUXSEL(2, 3, 0, 1), /* Radio changed from 1e80 to 0x800 to make FlyVideo2000S in .hu happy (gm)*/ /* -dk-???: set mute=0x1800 for tda9874h daughterboard */ @@ -1354,7 +1355,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0xffff00, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x500, 0x500, 0x300, 0x900 }, .gpiomute = 0x900, .needs_tvaudio = 1, @@ -1370,7 +1371,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x010f00, - .muxsel = {2, 3, 0, 0 }, + .muxsel = MUXSEL(2, 3, 0, 0), .gpiomux = {0x10000, 0, 0x10000, 0 }, .no_msp34xx = 1, .pll = PLL_28, @@ -1394,7 +1395,7 @@ struct tvcard bttv_tvcards[] = { .gpiomute = 0x947fff, /* tvtuner, radio, external,internal, mute, stereo * tuner, Composit, SVid, Composit-on-Svid-adapter */ - .muxsel = { 2, 3 ,0 ,1 }, + .muxsel = MUXSEL(2, 3, 0, 1), .tuner_type = TUNER_MT2032, .tuner_addr = ADDR_UNSET, .pll = PLL_28, @@ -1414,7 +1415,7 @@ struct tvcard bttv_tvcards[] = { .gpiomute = 0x947fff, /* tvtuner, radio, external,internal, mute, stereo * tuner, Composit, SVid, Composit-on-Svid-adapter */ - .muxsel = { 2, 3 ,0 ,1 }, + .muxsel = MUXSEL(2, 3, 0, 1), .tuner_type = TUNER_MT2032, .tuner_addr = ADDR_UNSET, .pll = PLL_28, @@ -1428,7 +1429,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, .pll = PLL_28, - .muxsel = { 2 }, + .muxsel = MUXSEL(2), .gpiomask = 0 }, [BTTV_BOARD_PV_BT878P_PLUS] = { @@ -1438,7 +1439,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 4, */ .svhs = 2, .gpiomask = 15, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 0, 11, 7 }, /* TV and Radio with same GPIO ! */ .gpiomute = 13, .needs_tvaudio = 1, @@ -1459,7 +1460,8 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 4, /* .audio_inputs= 0, */ .svhs = 2, - .muxsel = { 2, 3, 1, 1 }, /* AV1, AV2, SVHS, CVid adapter on SVHS */ + /* AV1, AV2, SVHS, CVid adapter on SVHS */ + .muxsel = MUXSEL(2, 3, 1, 1), .pll = PLL_28, .no_msp34xx = 1, .tuner_type = TUNER_ABSENT, @@ -1474,7 +1476,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x3f, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x01, 0x00, 0x03, 0x03 }, .gpiomute = 0x09, .needs_tvaudio = 1, @@ -1502,7 +1504,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = 4, .gpiomask = 0, - .muxsel = { 2, 3, 1, 0, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0, 0), .gpiomux = { 0 }, .needs_tvaudio = 0, .tuner_type = TUNER_ABSENT, @@ -1516,7 +1518,7 @@ struct tvcard bttv_tvcards[] = { .svhs = NO_SVHS, .gpiomask = 0x00, .gpiomask2 = 0x07ff, - .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + .muxsel = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), .no_msp34xx = 1, .no_tda9875 = 1, .tuner_type = TUNER_ABSENT, @@ -1529,7 +1531,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 2, */ .svhs = 2, .gpiomask = 0x1C800F, /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */ - .muxsel = { 2, 1, 1, }, + .muxsel = MUXSEL(2, 1, 1), .gpiomux = { 0, 1, 2, 2 }, .gpiomute = 4, .needs_tvaudio = 0, @@ -1547,7 +1549,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x140007, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 1, 2, 3 }, .gpiomute = 4, .tuner_type = TUNER_PHILIPS_NTSC, @@ -1560,7 +1562,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = NO_SVHS, .gpiomask = 0, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .gpiomux = { 0 }, .needs_tvaudio = 0, .no_msp34xx = 1, @@ -1574,7 +1576,8 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 3, */ .svhs = 2, .gpiomask = 7, - .muxsel = { 2, 3, 1, 1 }, /* Tuner, SVid, SVHS, SVid to SVHS connector */ + /* Tuner, SVid, SVHS, SVid to SVHS connector */ + .muxsel = MUXSEL(2, 3, 1, 1), .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. @@ -1606,7 +1609,7 @@ struct tvcard bttv_tvcards[] = { .name = "DSP Design TCVIDEO", .video_inputs = 4, .svhs = NO_SVHS, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .pll = PLL_28, .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, @@ -1618,7 +1621,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 4, /* .audio_inputs= 1, */ .svhs = 2, - .muxsel = { 2, 0, 1, 1 }, + .muxsel = MUXSEL(2, 0, 1, 1), .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = UNSET, @@ -1633,7 +1636,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x0f0f80, - .muxsel = {2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .gpiomux = {0x030000, 0x010000, 0, 0 }, .gpiomute = 0x020000, .no_msp34xx = 1, @@ -1648,7 +1651,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 4, /* id-inputs-clock */ /* .audio_inputs= 0, */ .svhs = 3, - .muxsel = { 3, 2, 0, 1 }, + .muxsel = MUXSEL(3, 2, 0, 1), .pll = PLL_28, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, @@ -1661,7 +1664,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 3, /* .audio_inputs= 0, */ .svhs = 2, - .muxsel = { 2, 3, 1 }, + .muxsel = MUXSEL(2, 3, 1), .pll = PLL_28, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, @@ -1676,7 +1679,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 2, /* .audio_inputs= 0, */ .svhs = 1, - .muxsel = { 3, 1 }, + .muxsel = MUXSEL(3, 1), .pll = PLL_28, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, @@ -1689,7 +1692,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 1, /* .audio_inputs= 0, */ .svhs = NO_SVHS, - .muxsel = { 0 }, + .muxsel = MUXSEL(0), .pll = PLL_28, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, @@ -1702,7 +1705,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 2, /* .audio_inputs= 0, */ .svhs = 1, - .muxsel = { 0, 1 }, + .muxsel = MUXSEL(0, 1), .pll = PLL_28, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, @@ -1715,7 +1718,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 1, /* .audio_inputs= 1, */ .svhs = NO_SVHS, - .muxsel = { 0 }, + .muxsel = MUXSEL(0), .pll = PLL_28, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, @@ -1730,7 +1733,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 2, /* .audio_inputs= 1, */ .svhs = 1, - .muxsel = { 0, 1 }, + .muxsel = MUXSEL(0, 1), .pll = PLL_28, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, @@ -1743,7 +1746,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 2, /* .audio_inputs= 1, */ .svhs = 1, - .muxsel = { 2, 3 }, + .muxsel = MUXSEL(2, 3), .pll = PLL_28, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, @@ -1756,7 +1759,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 2, /* .audio_inputs= 1, */ .svhs = 1, - .muxsel = { 2, 3 }, + .muxsel = MUXSEL(2, 3), .pll = PLL_28, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, @@ -1782,7 +1785,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 2, /* .audio_inputs= 1, */ .svhs = 1, - .muxsel = { 2, 3 }, + .muxsel = MUXSEL(2, 3), .pll = PLL_28, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, @@ -1799,7 +1802,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .svhs = NO_SVHS, .gpiomask = 0, - .muxsel = { 2, 2, 2, 2 }, + .muxsel = MUXSEL(2, 2, 2, 2), .muxsel_hook = eagle_muxsel, .no_msp34xx = 1, .no_tda9875 = 1, @@ -1815,7 +1818,7 @@ struct tvcard bttv_tvcards[] = { .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, - .muxsel = { 3, 1 }, + .muxsel = MUXSEL(3, 1), .pll = PLL_28, .no_gpioirq = 1, .has_dvb = 1, @@ -1827,7 +1830,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 3, .gpiomask = 2, /* TV, Comp1, Composite over SVID con, SVID */ - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 2, 2, 0, 0 }, .pll = PLL_28, .has_radio = 1, @@ -1849,7 +1852,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = NO_SVHS, .gpiomask = 7, - .muxsel = { 2, 3, 1, 1}, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 1, 2, 3}, .gpiomute = 4, .needs_tvaudio = 1, @@ -1866,7 +1869,7 @@ struct tvcard bttv_tvcards[] = { .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, - .muxsel = { 2, 0, 1}, + .muxsel = MUXSEL(2, 0, 1), .pll = PLL_28, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, @@ -1878,7 +1881,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = NO_SVHS, .gpiomask = 0, - .muxsel = { 2, 3 }, + .muxsel = MUXSEL(2, 3), .gpiomux = { 0 }, .needs_tvaudio = 0, .no_msp34xx = 1, @@ -1894,7 +1897,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x001e8007, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), /* Tuner, Radio, external, internal, off, on */ .gpiomux = { 0x08, 0x0f, 0x0a, 0x08 }, .gpiomute = 0x0f, @@ -1913,7 +1916,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x00, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .needs_tvaudio = 1, .no_msp34xx = 1, .pll = PLL_28, @@ -1934,7 +1937,8 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 4, /* .audio_inputs= 1, */ .svhs = 2, - .muxsel = { 2, 3, 1, 1 }, /* Tuner, CVid, SVid, CVid over SVid connector */ + /* Tuner, CVid, SVid, CVid over SVid connector */ + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomask = 0, .no_tda9875 = 1, .no_tda7432 = 1, @@ -1958,7 +1962,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .svhs = NO_SVHS, .gpiomask = 0xdf, - .muxsel = { 2 }, + .muxsel = MUXSEL(2), .pll = PLL_28, }, [BTTV_BOARD_IVCE8784] = { @@ -1969,7 +1973,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .svhs = NO_SVHS, .gpiomask = 0xdf, - .muxsel = { 2 }, + .muxsel = MUXSEL(2), .pll = PLL_28, }, [BTTV_BOARD_XGUARD] = { @@ -1980,7 +1984,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, .gpiomask2 = 0xff, - .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 }, + .muxsel = MUXSEL(2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0), .muxsel_hook = xguard_muxsel, .no_msp34xx = 1, .no_tda9875 = 1, @@ -1993,7 +1997,7 @@ struct tvcard bttv_tvcards[] = { .name = "Nebula Electronics DigiTV", .video_inputs = 1, .svhs = NO_SVHS, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -2012,7 +2016,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = NO_SVHS, .gpiomask = 0, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .gpiomux = { 0 }, .needs_tvaudio = 0, .no_msp34xx = 1, @@ -2027,7 +2031,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = 3, .gpiomask = 0x00, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .needs_tvaudio = 0, .pll = PLL_28, @@ -2040,7 +2044,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = 3, .gpiomask = 0x00, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .needs_tvaudio = 0, .pll = PLL_28, @@ -2056,7 +2060,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 9, .gpiomask = 0x00, .gpiomask2 = 0x03, /* used for external vodeo mux */ - .muxsel = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 0 }, + .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 0), .muxsel_hook = phytec_muxsel, .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .needs_tvaudio = 1, @@ -2071,7 +2075,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 9, .gpiomask = 0x00, .gpiomask2 = 0x03, /* used for external vodeo mux */ - .muxsel = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 1 }, + .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 1), .muxsel_hook = phytec_muxsel, .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .needs_tvaudio = 1, @@ -2087,7 +2091,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .svhs = NO_SVHS, .gpiomask = 0xdf, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .pll = PLL_28, }, [BTTV_BOARD_IVC120] = { @@ -2103,7 +2107,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .no_tda7432 = 1, .gpiomask = 0x00, - .muxsel = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + .muxsel = MUXSEL(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), .muxsel_hook = ivc120_muxsel, .pll = PLL_28, }, @@ -2114,7 +2118,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 4, /* .audio_inputs= 1, */ .svhs = 2, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .tuner_type = TUNER_PHILIPS_FCV1236D, .tuner_addr = ADDR_UNSET, .has_dvb = 1, @@ -2134,7 +2138,8 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 3, /* .audio_inputs= 0, */ .svhs = 1, - .muxsel = { 3, 1, 1, 3 }, /* Vid In, SVid In, Vid over SVid in connector */ + /* Vid In, SVid In, Vid over SVid in connector */ + .muxsel = MUXSEL(3, 1, 1, 3), .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -2148,7 +2153,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 3, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 1, 1, 1, 1 }, .needs_tvaudio = 1, .tuner_type = TUNER_PHILIPS_PAL, @@ -2165,7 +2170,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, .pll = PLL_28, - .muxsel = { 2, 2, 2, 2 }, + .muxsel = MUXSEL(2, 2, 2, 2), .gpiomask = 0x3F, .muxsel_hook = gvc1100_muxsel, }, @@ -2175,7 +2180,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 3, .svhs = 2, .gpiomask = 0x008007, - .muxsel = { 2, 3, 0, 0 }, + .muxsel = MUXSEL(2, 3, 0, 0), .gpiomux = { 0, 0, 0, 0 }, .gpiomute = 0x000003, .pll = PLL_28, @@ -2189,7 +2194,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 4, /* IN1,IN2,IN3,IN4 */ /* .audio_inputs= 0, */ .svhs = NO_SVHS, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -2207,7 +2212,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .needs_tvaudio = 0, .gpiomask = 0x68, - .muxsel = { 2, 3, 1 }, + .muxsel = MUXSEL(2, 3, 1), .gpiomux = { 0x68, 0x68, 0x61, 0x61 }, .pll = PLL_28, }, @@ -2221,7 +2226,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x008007, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 1, 2, 2 }, .gpiomute = 3, .needs_tvaudio = 0, @@ -2245,7 +2250,8 @@ struct tvcard bttv_tvcards[] = { .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, - .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/ + /*878A input is always MUX0, see above.*/ + .muxsel = MUXSEL(2, 2, 2, 2), .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .pll = PLL_28, .needs_tvaudio = 0, @@ -2261,7 +2267,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x0000000f, - .muxsel = { 2, 1, 1 }, + .muxsel = MUXSEL(2, 1, 1), .gpiomux = { 0x02, 0x00, 0x00, 0x00 }, .tuner_type = TUNER_TEMIC_PAL, .tuner_addr = ADDR_UNSET, @@ -2275,7 +2281,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 1, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, - .muxsel = { 3 , 3 }, + .muxsel = MUXSEL(3, 3), .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -2291,7 +2297,7 @@ struct tvcard bttv_tvcards[] = { .name = "AverMedia AverTV DVB-T 761", .video_inputs = 2, .svhs = 1, - .muxsel = { 3, 1, 2, 0 }, /* Comp0, S-Video, ?, ? */ + .muxsel = MUXSEL(3, 1, 2, 0), /* Comp0, S-Video, ?, ? */ .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -2309,8 +2315,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = NO_SVHS, .gpiomask = 0x0, - .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 3, 3 }, + .muxsel = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3), .muxsel_hook = sigmaSQ_muxsel, .gpiomux = { 0 }, .no_msp34xx = 1, @@ -2325,7 +2330,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = NO_SVHS, .gpiomask = 0x0, - .muxsel = { 2, 2, 2, 2 }, + .muxsel = MUXSEL(2, 2, 2, 2), .muxsel_hook = sigmaSLC_muxsel, .gpiomux = { 0 }, .no_msp34xx = 1, @@ -2342,7 +2347,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = NO_SVHS, .gpiomask = 0xFF, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 2, 0, 0, 0 }, .gpiomute = 10, .needs_tvaudio = 0, @@ -2373,7 +2378,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x3f, - .muxsel = {2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .gpiomux = {0x31, 0x31, 0x31, 0x31 }, .gpiomute = 0x31, .no_msp34xx = 1, @@ -2388,7 +2393,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 4, /* .audio_inputs= 1, */ .svhs = 2, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .tuner_type = TUNER_PHILIPS_NTSC, .tuner_addr = ADDR_UNSET, .gpiomask = 0x008007, @@ -2402,7 +2407,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 16, /* .audio_inputs= 0, */ .svhs = NO_SVHS, - .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, + .muxsel = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), .pll = PLL_28, .no_msp34xx = 1, .no_tda9875 = 1, @@ -2439,7 +2444,7 @@ struct tvcard bttv_tvcards[] = { */ .gpiomask = 0x0003ff, .no_gpioirq = 1, - .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + .muxsel = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), .pll = PLL_28, .no_msp34xx = 1, .no_tda7432 = 1, @@ -2461,7 +2466,7 @@ struct tvcard bttv_tvcards[] = { .svhs = NO_SVHS, .gpiomask = 0x010000, .no_gpioirq = 1, - .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + .muxsel = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), .pll = PLL_28, .no_msp34xx = 1, .no_tda7432 = 1, @@ -2476,7 +2481,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 4, /* .audio_inputs= 1, */ .svhs = 2, - .muxsel = { 2, 3, 1, 0 }, + .muxsel = MUXSEL(2, 3, 1, 0), .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, .pll = PLL_28, @@ -2490,7 +2495,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 3, /* .audio_inputs= 1, */ .svhs = 2, - .muxsel = { 2, 3, 1 }, + .muxsel = MUXSEL(2, 3, 1), .gpiomask = 0x00e00007, .gpiomux = { 0x00400005, 0, 0x00000001, 0 }, .gpiomute = 0x00c00007, @@ -2507,7 +2512,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x01fe00, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, .gpiomute = 0x002000, .needs_tvaudio = 1, @@ -2523,7 +2528,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x001c0007, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 1, 2, 2 }, .gpiomute = 3, .needs_tvaudio = 0, @@ -2541,7 +2546,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 3, .has_dig_in = 1, .gpiomask = 0x01fe00, - .muxsel = { 2, 3, 1, 1, 0 }, /* in 4 is digital */ + .muxsel = MUXSEL(2, 3, 1, 1, 0), /* in 4 is digital */ /* .digital_mode= DIGITAL_MODE_CAMERA, */ .gpiomux = { 0x00400, 0x10400, 0x04400, 0x80000 }, .gpiomute = 0x12400, @@ -2559,7 +2564,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x3f, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x21, 0x20, 0x24, 0x2c }, .gpiomute = 0x29, .no_msp34xx = 1, @@ -2587,7 +2592,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 4, /* .audio_inputs= 2, */ .svhs = NO_SVHS, - .muxsel = { 2, 3, 0, 1 }, /* 3,0,1 are guesses */ + .muxsel = MUXSEL(2, 3, 0, 1), /* 3,0,1 are guesses */ .gpiomask = 0x303, .gpiomute = 0x000, /* int + 32kHz */ .gpiomux = { 0, 0, 0x000, 0x100}, @@ -2605,7 +2610,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 15, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 2, 0, 0, 0 }, .gpiomute = 1, .needs_tvaudio = 1, @@ -2620,7 +2625,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x108007, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 100000, 100002, 100002, 100000 }, .no_msp34xx = 1, .no_tda9875 = 1, @@ -2637,7 +2642,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = NO_SVHS, .gpiomask = 0x0f, /* old: 7 */ - .muxsel = { 0, 1, 3, 2 }, /* Composite 0-3 */ + .muxsel = MUXSEL(0, 1, 3, 2), /* Composite 0-3 */ .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -2657,7 +2662,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 7, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 1, 2, 3 }, .gpiomute = 4, .tuner_type = TUNER_TEMIC_4009FR5_PAL, @@ -2671,7 +2676,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 4, /* .audio_inputs= 0, */ .svhs = NO_SVHS, - .muxsel = { 0, 1, 2, 3 }, + .muxsel = MUXSEL(0, 1, 2, 3), .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, }, @@ -2680,7 +2685,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 2, /* .audio_inputs= 0, */ .svhs = 1, - .muxsel = { 2, 0, 1, 3 }, + .muxsel = MUXSEL(2, 0, 1, 3), .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, }, @@ -2692,7 +2697,7 @@ struct tvcard bttv_tvcards[] = { .video_inputs = 3, /* .audio_inputs= 1, */ .svhs = 2, - .muxsel = { 2, 3, 1 }, + .muxsel = MUXSEL(2, 3, 1), .gpiomask = 0x00e00007, .gpiomux = { 0x00400005, 0, 0x00000001, 0 }, .gpiomute = 0x00c00007, @@ -2707,7 +2712,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x3014f, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0x20001,0x10001, 0, 0 }, .gpiomute = 10, .needs_tvaudio = 1, @@ -2722,8 +2727,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = NO_SVHS, .gpiomask = 0x0, - .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2 }, + .muxsel = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), .muxsel_hook = geovision_muxsel, .gpiomux = { 0 }, .no_msp34xx = 1, @@ -2740,7 +2744,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 1, */ .svhs = 2, .gpiomask = 0x008007, - .muxsel = { 2, 3, 1, 1 }, + .muxsel = MUXSEL(2, 3, 1, 1), .gpiomux = { 0, 1, 2, 2 }, /* CONTVFMi */ .gpiomute = 3, /* CONTVFMi */ .needs_tvaudio = 0, @@ -2764,7 +2768,7 @@ struct tvcard bttv_tvcards[] = { 11 -> internal audio input */ .gpiomask = 0x060040, - .muxsel = { 2, 3, 3 }, + .muxsel = MUXSEL(2, 3, 3), .gpiomux = { 0x60000, 0x60000, 0x20000, 0x20000 }, .gpiomute = 0, .tuner_type = TUNER_TCL_MF02GIP_5N, @@ -2780,7 +2784,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = NO_SVHS, .gpiomask = 0x00, - .muxsel = { 0, 2, 3, 1 }, + .muxsel = MUXSEL(0, 2, 3, 1), .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .needs_tvaudio = 0, .pll = PLL_28, @@ -2794,7 +2798,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = 3, .gpiomask = 0x00, - .muxsel = { 2, 3, 1 }, + .muxsel = MUXSEL(2, 3, 1), .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .needs_tvaudio = 0, .pll = PLL_28, @@ -2808,7 +2812,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = 3, .gpiomask = 0x00, - .muxsel = { 3, 2, 1 }, + .muxsel = MUXSEL(3, 2, 1), .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .needs_tvaudio = 0, .pll = PLL_28, diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 8d9756b9587e..ccf6aa6a975b 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -1142,7 +1142,7 @@ video_mux(struct bttv *btv, unsigned int input) btand(~BT848_CONTROL_COMP, BT848_E_CONTROL); btand(~BT848_CONTROL_COMP, BT848_O_CONTROL); } - mux = bttv_tvcards[btv->c.type].muxsel[input] & 3; + mux = bttv_muxsel(btv, input); btaor(mux<<5, ~(3<<5), BT848_IFORM); dprintk(KERN_DEBUG "bttv%d: video mux: input=%d mux=%d\n", btv->c.nr,input,mux); diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h index e377e2887a53..ead6e749372a 100644 --- a/drivers/media/video/bt8xx/bttv.h +++ b/drivers/media/video/bt8xx/bttv.h @@ -206,15 +206,16 @@ struct bttv_core { struct bttv; - struct tvcard { char *name; void (*volume_gpio)(struct bttv *btv, __u16 volume); void (*audio_mode_gpio)(struct bttv *btv, struct v4l2_tuner *tuner, int set); void (*muxsel_hook)(struct bttv *btv, unsigned int input); + /* MUX bits for each input, two bits per input starting with the LSB */ + u32 muxsel; /* Use MUXSEL() to set */ + u32 gpiomask; - u32 muxsel[16]; u32 gpiomux[4]; /* Tuner, Radio, external, internal */ u32 gpiomute; /* GPIO mute setting */ u32 gpiomask2; /* GPIO MUX mask */ @@ -246,6 +247,31 @@ struct tvcard { extern struct tvcard bttv_tvcards[]; +/* + * This bit of cpp voodoo is used to create a macro with a variable number of + * arguments (1 to 16). It will pack each argument into a word two bits at a + * time. It can't be a function because it needs to be compile time constant to + * initialize structures. Since each argument must fit in two bits, it's ok + * that they are changed to octal. One should not use hex number, macros, or + * anything else with this macro. Just use plain integers from 0 to 3. + */ +#define _MUXSELf(a) 0##a << 30 +#define _MUXSELe(a, b...) 0##a << 28 | _MUXSELf(b) +#define _MUXSELd(a, b...) 0##a << 26 | _MUXSELe(b) +#define _MUXSELc(a, b...) 0##a << 24 | _MUXSELd(b) +#define _MUXSELb(a, b...) 0##a << 22 | _MUXSELc(b) +#define _MUXSELa(a, b...) 0##a << 20 | _MUXSELb(b) +#define _MUXSEL9(a, b...) 0##a << 18 | _MUXSELa(b) +#define _MUXSEL8(a, b...) 0##a << 16 | _MUXSEL9(b) +#define _MUXSEL7(a, b...) 0##a << 14 | _MUXSEL8(b) +#define _MUXSEL6(a, b...) 0##a << 12 | _MUXSEL7(b) +#define _MUXSEL5(a, b...) 0##a << 10 | _MUXSEL6(b) +#define _MUXSEL4(a, b...) 0##a << 8 | _MUXSEL5(b) +#define _MUXSEL3(a, b...) 0##a << 6 | _MUXSEL4(b) +#define _MUXSEL2(a, b...) 0##a << 4 | _MUXSEL3(b) +#define _MUXSEL1(a, b...) 0##a << 2 | _MUXSEL2(b) +#define MUXSEL(a, b...) (a | _MUXSEL1(b)) + /* identification / initialization of the card */ extern void bttv_idcard(struct bttv *btv); extern void bttv_init_card1(struct bttv *btv); diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 23ab1c9527e4..497c8dcb4ae8 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h @@ -464,6 +464,12 @@ struct bttv { extern unsigned int bttv_num; extern struct bttv bttvs[BTTV_MAX]; +static inline unsigned int bttv_muxsel(const struct bttv *btv, + unsigned int input) +{ + return (bttv_tvcards[btv->c.type].muxsel >> (input * 2)) & 3; +} + #endif #define btwrite(dat,adr) writel((dat), btv->bt848_mmio+(adr)) |