Commit 4c548d4b authored by Trent Piepho's avatar Trent Piepho Committed by Mauro Carvalho Chehab

V4L/DVB (10561): bttv: store card database more efficiently

The bttv card database is quite large and the data structure used to store
it wasn't very efficient.  Most of the field are only used at card
initialization time so it doesn't matter if they aren't efficient to
access.

Overall the changes reduce code size by 60 bytes in ia32.  The data size is
decreased by 5024 byes.  It is probably even more for 64-bit kernels.

Move the fields in the struct around to be sorted from largest to smallest.
This saves on padding space used for alignment.

Get rid of the unused digital_mode field.  Leave the setting as a comment
in the few cards entries that set it, in case someone ever writes the code.

Get rid of the unused audio_inputs field.  Leave the values in the card
entries in case someone ever writes code that might use it.

Get ride of the unused radio_addr field.  No card entries even set it to
anything interesting so it's not left as comments.  All the code that used
it was removed in commit v2.6.14-3466-g291d1d73 from Nov 8th 2005.

Reduce video_inputs to u8 as no card has more than 255 inputs (the most is
16).

Change tuner_addr to u8.  I2C addresses are only seven bits and 255 means
ADDR_UNSET, so everything fits.

Make has_radio a one bit flag.

Make the pll setting a two bit field.

Reduce svhs to four bits as no card has an s-video input above 9.  Change
the value for no s-video input from UNSET (which is -1U and out of range of
four bits) to NO_SVHS (which is now 15).
Signed-off-by: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent abb0362f
This diff is collapsed.
......@@ -192,10 +192,6 @@
#define WINVIEW_PT2254_DATA 0x20
#define WINVIEW_PT2254_STROBE 0x80
/* digital_mode */
#define DIGITAL_MODE_VIDEO 1
#define DIGITAL_MODE_CAMERA 2
struct bttv_core {
/* device structs */
struct pci_dev *pci;
......@@ -211,19 +207,24 @@ struct bttv_core {
struct bttv;
struct tvcard
{
struct tvcard {
char *name;
unsigned int video_inputs;
unsigned int audio_inputs;
unsigned int svhs;
unsigned int digital_mode; // DIGITAL_MODE_CAMERA or DIGITAL_MODE_VIDEO
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);
u32 gpiomask;
u32 muxsel[16];
u32 gpiomux[4]; /* Tuner, Radio, external, internal */
u32 gpiomute; /* GPIO mute setting */
u32 gpiomask2; /* GPIO MUX mask */
unsigned int tuner_type;
u8 tuner_addr;
u8 video_inputs; /* Number of inputs */
unsigned int svhs:4; /* Which input is s-video */
#define NO_SVHS 15
/* i2c audio flags */
unsigned int no_msp34xx:1;
unsigned int no_tda9875:1;
......@@ -231,28 +232,15 @@ struct tvcard
unsigned int needs_tvaudio:1;
unsigned int msp34xx_alt:1;
/* flag: video pci function is unused */
unsigned int no_video:1;
unsigned int no_video:1; /* video pci function is unused */
unsigned int has_dvb:1;
unsigned int has_remote:1;
unsigned int has_radio:1;
unsigned int no_gpioirq:1;
/* other settings */
unsigned int pll;
unsigned int pll:2;
#define PLL_NONE 0
#define PLL_28 1
#define PLL_35 2
unsigned int tuner_type;
unsigned int tuner_addr;
unsigned int radio_addr;
unsigned int has_radio;
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);
};
extern struct tvcard bttv_tvcards[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment