]> Pileus Git - ~andy/linux/blobdiff - drivers/media/video/em28xx/em28xx.h
V4L/DVB (9758): em28xx: replace some magic by register descriptions where known
[~andy/linux] / drivers / media / video / em28xx / em28xx.h
index d965caba63e31407c9cc5c659c1767aa09fe8b14..e41015d2e72202aa9ad3a5a918222c382c282adc 100644 (file)
@@ -259,6 +259,7 @@ enum enum28xx_itype {
 enum em28xx_ac97_mode {
        EM28XX_NO_AC97 = 0,
        EM28XX_AC97_EM202,
+       EM28XX_AC97_SIGMATEL,
        EM28XX_AC97_OTHER,
 };
 
@@ -274,15 +275,40 @@ struct em28xx_audio_mode {
        unsigned int i2s_5rates:1;
 };
 
+/* em28xx has two audio inputs: tuner and line in.
+   However, on most devices, an auxiliary AC97 codec device is used.
+   The AC97 device may have several different inputs and outputs,
+   depending on their model. So, it is possible to use AC97 mixer to
+   address more than two different entries.
+ */
 enum em28xx_amux {
-       EM28XX_AMUX_VIDEO,
-       EM28XX_AMUX_LINE_IN,
+       /* This is the only entry for em28xx tuner input */
+       EM28XX_AMUX_VIDEO,      /* em28xx tuner, AC97 mixer Video */
+
+       EM28XX_AMUX_LINE_IN,    /* AC97 mixer Line In */
+
+       /* Some less-common mixer setups */
+       EM28XX_AMUX_VIDEO2,     /* em28xx Line in, AC97 mixer Video */
+       EM28XX_AMUX_PHONE,
+       EM28XX_AMUX_MIC,
+       EM28XX_AMUX_CD,
+       EM28XX_AMUX_AUX,
+       EM28XX_AMUX_PCM_OUT,
+};
+
+enum em28xx_aout {
+       EM28XX_AOUT_MASTER = 1 << 0,
+       EM28XX_AOUT_LINE   = 1 << 1,
+       EM28XX_AOUT_MONO   = 1 << 2,
+       EM28XX_AOUT_LFE    = 1 << 3,
+       EM28XX_AOUT_SURR   = 1 << 4,
 };
 
 struct em28xx_input {
        enum enum28xx_itype type;
        unsigned int vmux;
        enum em28xx_amux amux;
+       enum em28xx_aout aout;
 };
 
 #define INPUT(nr) (&em28xx_boards[dev->model].input[nr])
@@ -290,8 +316,7 @@ struct em28xx_input {
 enum em28xx_decoder {
        EM28XX_NODECODER,
        EM28XX_TVP5150,
-       EM28XX_SAA7113,
-       EM28XX_SAA7114
+       EM28XX_SAA711X,
 };
 
 struct em28xx_reg_seq {
@@ -312,12 +337,13 @@ struct em28xx_board {
        unsigned int is_em2800:1;
        unsigned int has_msp34xx:1;
        unsigned int mts_firmware:1;
-       unsigned int has_12mhz_i2s:1;
        unsigned int max_range_640_480:1;
        unsigned int has_dvb:1;
        unsigned int has_snapshot_button:1;
        unsigned int valid:1;
 
+       unsigned char xclk, i2c_speed;
+
        enum em28xx_decoder decoder;
 
        struct em28xx_input       input[MAX_EM28XX_INPUT];
@@ -390,17 +416,12 @@ struct em28xx {
        int model;              /* index in the device_data struct */
        int devno;              /* marks the number of this device */
        enum em28xx_chip_id chip_id;
-       unsigned int is_em2800:1;
-       unsigned int has_msp34xx:1;
-       unsigned int has_tda9887:1;
+
+       struct em28xx_board board;
+
        unsigned int stream_on:1;       /* Locks streams */
        unsigned int has_audio_class:1;
        unsigned int has_alsa_audio:1;
-       unsigned int has_12mhz_i2s:1;
-       unsigned int max_range_640_480:1;
-       unsigned int has_dvb:1;
-       unsigned int has_snapshot_button:1;
-       unsigned int valid:1;           /* report for validated boards */
 
        struct em28xx_IR *ir;
 
@@ -411,14 +432,12 @@ struct em28xx {
        struct em28xx_reg_seq *analog_gpio, *digital_gpio;
 
        /* GPIO sequences for tuner callbacks */
-       struct em28xx_reg_seq *tun_analog_gpio, *tun_digital_gpio;
+       struct em28xx_reg_seq *tuner_gpio;
 
-       int video_inputs;       /* number of video inputs */
        struct list_head        devlist;
 
        u32 i2s_speed;          /* I2S speed for audio digital stream */
 
-       enum em28xx_decoder decoder;
        struct em28xx_audio_mode audio_mode;
 
        int tuner_type;         /* type of the tuner */
@@ -434,6 +453,7 @@ struct em28xx {
        int ctl_freq;           /* selected frequency */
        unsigned int ctl_input; /* selected input */
        unsigned int ctl_ainput;/* selected audio input */
+       unsigned int ctl_aoutput;/* selected audio output */
        int mute;
        int volume;
        /* frame properties */
@@ -500,9 +520,6 @@ struct em28xx {
        /* Caches GPO and GPIO registers */
        unsigned char   reg_gpo, reg_gpio;
 
-       /* Infrared remote control support */
-       IR_KEYTAB_TYPE *ir_codes;
-
        /* Snapshot button */
        char snapshot_button_path[30];  /* path of the input dev */
        struct input_dev *sbutton_input_dev;
@@ -539,6 +556,8 @@ int em28xx_read_reg(struct em28xx *dev, u16 reg);
 int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
                          int len);
 int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len);
+int em28xx_write_reg(struct em28xx *dev, u16 reg, u8 val);
+
 int em28xx_audio_analog_set(struct em28xx *dev);
 int em28xx_audio_setup(struct em28xx *dev);
 
@@ -598,7 +617,7 @@ int em28xx_ir_fini(struct em28xx *dev);
 static inline int em28xx_compression_disable(struct em28xx *dev)
 {
        /* side effect of disabling scaler and mixer */
-       return em28xx_write_regs(dev, EM28XX_R26_COMPR, "\x00", 1);
+       return em28xx_write_reg(dev, EM28XX_R26_COMPR, 0x00);
 }
 
 static inline int em28xx_contrast_get(struct em28xx *dev)
@@ -670,7 +689,7 @@ static inline int em28xx_gamma_set(struct em28xx *dev, s32 val)
 /*FIXME: maxw should be dependent of alt mode */
 static inline unsigned int norm_maxw(struct em28xx *dev)
 {
-       if (dev->max_range_640_480)
+       if (dev->board.max_range_640_480)
                return 640;
        else
                return 720;
@@ -678,7 +697,7 @@ static inline unsigned int norm_maxw(struct em28xx *dev)
 
 static inline unsigned int norm_maxh(struct em28xx *dev)
 {
-       if (dev->max_range_640_480)
+       if (dev->board.max_range_640_480)
                return 480;
        else
                return (dev->norm & V4L2_STD_625_50) ? 576 : 480;