V4L/DVB (9648): em28xx: get audio config from em28xx register
[safe/jmp/linux-2.6] / drivers / media / video / em28xx / em28xx.h
index d992280..f47c8d3 100644 (file)
 #define EM2882_BOARD_PINNACLE_HYBRID_PRO         56
 #define EM2883_BOARD_KWORLD_HYBRID_A316                  57
 #define EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU     58
+#define EM2874_BOARD_PINNACLE_PCTV_80E           59
 
 /* Limits minimum and default number of buffers */
 #define EM28XX_MIN_BUF 4
 #define EM28XX_DEF_BUF 8
 
+/*Limits the max URB message size */
+#define URB_MAX_CTRL_SIZE 80
+
 /* Params for validated field */
 #define EM28XX_BOARD_NOT_VALIDATED 1
 #define EM28XX_BOARD_VALIDATED    0
@@ -252,6 +256,13 @@ enum enum28xx_itype {
        EM28XX_RADIO,
 };
 
+enum em28xx_audio_mode {
+       EM28XX_NO_AUDIO,
+       EM28XX_I2S_3_SAMPLE_RATES,
+       EM28XX_I2S_5_SAMPLE_RATES,
+       EM28XX_AC97,
+};
+
 enum em28xx_amux {
        EM28XX_AMUX_VIDEO,
        EM28XX_AMUX_LINE_IN,
@@ -268,6 +279,7 @@ struct em28xx_input {
 #define INPUT(nr) (&em28xx_boards[dev->model].input[nr])
 
 enum em28xx_decoder {
+       EM28XX_NODECODER,
        EM28XX_TVP5150,
        EM28XX_SAA7113,
        EM28XX_SAA7114
@@ -283,6 +295,7 @@ struct em28xx_board {
        char *name;
        int vchannels;
        int tuner_type;
+       int tuner_addr;
 
        /* i2c flags */
        unsigned int tda9887_conf;
@@ -300,6 +313,7 @@ struct em28xx_board {
 
        struct em28xx_input       input[MAX_EM28XX_INPUT];
        struct em28xx_input       radio;
+       IR_KEYTAB_TYPE            *ir_codes;
 };
 
 struct em28xx_eeprom {
@@ -366,17 +380,21 @@ struct em28xx {
        char name[30];          /* name (including minor) of the device */
        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;
        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;
+
        /* Some older em28xx chips needs a waiting time after writing */
        unsigned int wait_after_write;
 
@@ -392,6 +410,7 @@ struct em28xx {
        u32 i2s_speed;          /* I2S speed for audio digital stream */
 
        enum em28xx_decoder decoder;
+       enum em28xx_audio_mode audio_mode;
 
        int tuner_type;         /* type of the tuner */
        int tuner_addr;         /* tuner address */
@@ -430,6 +449,7 @@ struct em28xx {
 
        /* locks */
        struct mutex lock;
+       struct mutex ctrl_urb_lock;     /* protects urb_buf */
        /* spinlock_t queue_lock; */
        struct list_head inqueue, outqueue;
        wait_queue_head_t open, wait_frame, wait_stream;
@@ -451,6 +471,8 @@ struct em28xx {
        unsigned int *alt_max_pkt_size; /* array of wMaxPacketSize */
        struct urb *urb[EM28XX_NUM_BUFS];       /* urb for isoc transfers */
        char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc transfer */
+       char urb_buf[URB_MAX_CTRL_SIZE];        /* urb control msg buffer */
+
        /* helper funcs that call usb_control_msg */
        int (*em28xx_write_regs) (struct em28xx *dev, u16 reg,
                                        char *buf, int len);
@@ -463,9 +485,15 @@ struct em28xx {
 
        enum em28xx_mode mode;
 
+       /* register numbers for GPO/GPIO registers */
+       u16 reg_gpo_num, reg_gpio_num;
+
        /* 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;
@@ -528,10 +556,9 @@ extern struct em28xx_board em28xx_boards[];
 extern struct usb_device_id em28xx_id_table[];
 extern const unsigned int em28xx_bcount;
 void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir);
-int em28xx_tuner_callback(void *ptr, int command, int arg);
+int em28xx_tuner_callback(void *ptr, int component, int command, int arg);
 
 /* Provided by em28xx-input.c */
-/* TODO: Check if the standard get_key handlers on ir-common can be used */
 int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
 int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
 int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
@@ -539,6 +566,9 @@ int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
 void em28xx_register_snapshot_button(struct em28xx *dev);
 void em28xx_deregister_snapshot_button(struct em28xx *dev);
 
+int em28xx_ir_init(struct em28xx *dev);
+int em28xx_ir_fini(struct em28xx *dev);
+
 /* printk macros */
 
 #define em28xx_err(fmt, arg...) do {\