V4L/DVB (7230): saa7134: add support for the MSI TV@nywhere A/D v1.1 card
[safe/jmp/linux-2.6] / drivers / media / video / saa7134 / saa7134.h
index 4a20d25..d7e0781 100644 (file)
 #include <media/tuner.h>
 #include <media/ir-common.h>
 #include <media/ir-kbd-i2c.h>
-#include <media/video-buf.h>
-#include <sound/driver.h>
+#include <media/videobuf-dma-sg.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
-#include <media/video-buf-dvb.h>
-
-#ifndef TRUE
-# define TRUE (1==1)
-#endif
-#ifndef FALSE
-# define FALSE (1==0)
+#if defined(CONFIG_VIDEO_SAA7134_DVB) || defined(CONFIG_VIDEO_SAA7134_DVB_MODULE)
+#include <media/videobuf-dvb.h>
 #endif
+
 #define UNSET (-1U)
 
 /* ----------------------------------------------------------- */
@@ -226,6 +221,42 @@ struct saa7134_format {
 #define SAA7134_BOARD_FLYDVBS_LR300 97
 #define SAA7134_BOARD_PROTEUS_2309 98
 #define SAA7134_BOARD_AVERMEDIA_A16AR   99
+#define SAA7134_BOARD_ASUS_EUROPA2_HYBRID 100
+#define SAA7134_BOARD_PINNACLE_PCTV_310i  101
+#define SAA7134_BOARD_AVERMEDIA_STUDIO_507 102
+#define SAA7134_BOARD_VIDEOMATE_DVBT_200A  103
+#define SAA7134_BOARD_HAUPPAUGE_HVR1110    104
+#define SAA7134_BOARD_CINERGY_HT_PCMCIA    105
+#define SAA7134_BOARD_ENCORE_ENLTV         106
+#define SAA7134_BOARD_ENCORE_ENLTV_FM      107
+#define SAA7134_BOARD_CINERGY_HT_PCI       108
+#define SAA7134_BOARD_PHILIPS_TIGER_S      109
+#define SAA7134_BOARD_AVERMEDIA_M102      110
+#define SAA7134_BOARD_ASUS_P7131_4871     111
+#define SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA 112
+#define SAA7134_BOARD_ECS_TVP3XP_4CB6  113
+#define SAA7134_BOARD_KWORLD_DVBT_210 114
+#define SAA7134_BOARD_SABRENT_TV_PCB05     115
+#define SAA7134_BOARD_10MOONSTVMASTER3     116
+#define SAA7134_BOARD_AVERMEDIA_SUPER_007  117
+#define SAA7134_BOARD_BEHOLD_401       118
+#define SAA7134_BOARD_BEHOLD_403       119
+#define SAA7134_BOARD_BEHOLD_403FM     120
+#define SAA7134_BOARD_BEHOLD_405       121
+#define SAA7134_BOARD_BEHOLD_405FM     122
+#define SAA7134_BOARD_BEHOLD_407       123
+#define SAA7134_BOARD_BEHOLD_407FM     124
+#define SAA7134_BOARD_BEHOLD_409       125
+#define SAA7134_BOARD_BEHOLD_505FM     126
+#define SAA7134_BOARD_BEHOLD_507_9FM   127
+#define SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM 128
+#define SAA7134_BOARD_BEHOLD_607_9FM   129
+#define SAA7134_BOARD_BEHOLD_M6                130
+#define SAA7134_BOARD_TWINHAN_DTV_DVB_3056 131
+#define SAA7134_BOARD_GENIUS_TVGO_A11MCE   132
+#define SAA7134_BOARD_PHILIPS_SNAKE        133
+#define SAA7134_BOARD_CREATIX_CTX953       134
+#define SAA7134_BOARD_MSI_TVANYWHERE_AD11  135
 
 #define SAA7134_MAXBOARDS 8
 #define SAA7134_INPUT_MAX 8
@@ -275,6 +306,7 @@ struct saa7134_board {
        unsigned char           radio_addr;
 
        unsigned int            tda9887_conf;
+       unsigned int            tuner_config;
 
        /* peripheral I/O */
        enum saa7134_video_out  video_out;
@@ -300,7 +332,7 @@ struct saa7134_board {
 #define INTERLACE_ON           1
 #define INTERLACE_OFF          2
 
-#define BUFFER_TIMEOUT     (HZ/2)  /* 0.5 seconds */
+#define BUFFER_TIMEOUT     msecs_to_jiffies(500)  /* 0.5 seconds */
 
 struct saa7134_dev;
 struct saa7134_dma;
@@ -314,13 +346,11 @@ struct saa7134_pgtable {
 
 /* tvaudio thread status */
 struct saa7134_thread {
-       pid_t                      pid;
-       struct completion          exit;
-       wait_queue_head_t          wq;
-       unsigned int               shutdown;
+       struct task_struct         *thread;
        unsigned int               scan1;
        unsigned int               scan2;
        unsigned int               mode;
+       unsigned int               stopped;
 };
 
 /* buffer for one video/vbi/ts frame */
@@ -405,20 +435,6 @@ struct saa7134_dmasound {
        struct snd_pcm_substream   *substream;
 };
 
-/* IR input */
-struct saa7134_ir {
-       struct input_dev           *dev;
-       struct ir_input_state      ir;
-       char                       name[32];
-       char                       phys[32];
-       u32                        mask_keycode;
-       u32                        mask_keydown;
-       u32                        mask_keyup;
-       int                        polling;
-       u32                        last_gpio;
-       struct timer_list          timer;
-};
-
 /* ts/mpeg status */
 struct saa7134_ts {
        /* TS capture */
@@ -444,6 +460,11 @@ struct saa7134_dev {
 #ifdef VIDIOC_G_PRIORITY
        struct v4l2_prio_state     prio;
 #endif
+       /* workstruct for loading modules */
+       struct work_struct request_module_wk;
+
+       /* insmod option/autodetected */
+       int                        autodetected;
 
        /* various device info */
        unsigned int               resources;
@@ -454,7 +475,7 @@ struct saa7134_dev {
 
        /* infrared remote */
        int                        has_remote;
-       struct saa7134_ir          *remote;
+       struct card_ir             *remote;
 
        /* pci i/o */
        char                       name[32];
@@ -477,7 +498,7 @@ struct saa7134_dev {
        /* i2c i/o */
        struct i2c_adapter         i2c_adap;
        struct i2c_client          i2c_client;
-       unsigned char              eedata[128];
+       unsigned char              eedata[256];
 
        /* video overlay */
        struct v4l2_framebuffer    ovbuf;
@@ -521,6 +542,7 @@ struct saa7134_dev {
        unsigned int               hw_mute;
        int                        last_carrier;
        int                        nosignal;
+       unsigned int               insuspend;
 
        /* SAA7134_MPEG_* */
        struct saa7134_ts          ts;
@@ -534,9 +556,13 @@ struct saa7134_dev {
        struct work_struct         empress_workqueue;
        int                        empress_started;
 
+#if defined(CONFIG_VIDEO_SAA7134_DVB) || defined(CONFIG_VIDEO_SAA7134_DVB_MODULE)
        /* SAA7134_MPEG_DVB only */
        struct videobuf_dvb        dvb;
-       int (*original_demod_sleep)(struct dvb_frontend* fe);
+       int (*original_demod_sleep)(struct dvb_frontend *fe);
+       int (*original_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
+       int (*original_set_high_voltage)(struct dvb_frontend *fe, long arg);
+#endif
 };
 
 /* ----------------------------------------------------------- */
@@ -559,6 +585,12 @@ struct saa7134_dev {
 
 #define saa_wait(us) { udelay(us); }
 
+#define SAA7134_NORMS  (\
+               V4L2_STD_PAL    | V4L2_STD_PAL_N | \
+               V4L2_STD_PAL_Nc | V4L2_STD_SECAM | \
+               V4L2_STD_NTSC   | V4L2_STD_PAL_M | \
+               V4L2_STD_PAL_60)
+
 /* ----------------------------------------------------------- */
 /* saa7134-core.c                                              */
 
@@ -566,6 +598,8 @@ extern struct list_head  saa7134_devlist;
 extern int saa7134_no_overlay;
 
 void saa7134_track_gpio(struct saa7134_dev *dev, char *msg);
+void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value);
+int saa7134_tuner_callback(void *ptr, int command, int arg);
 
 #define SAA7134_PGTABLE_SIZE 4096
 
@@ -616,16 +650,20 @@ void saa7134_i2c_call_clients(struct saa7134_dev *dev,
 /* ----------------------------------------------------------- */
 /* saa7134-video.c                                             */
 
+extern unsigned int video_debug;
 extern struct video_device saa7134_video_template;
 extern struct video_device saa7134_radio_template;
 
-int saa7134_common_ioctl(struct saa7134_dev *dev,
-                        unsigned int cmd, void *arg);
+int saa7134_g_ctrl(struct file *file, void *priv, struct v4l2_control *c);
+int saa7134_s_ctrl(struct file *file, void *f, struct v4l2_control *c);
+int saa7134_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *c);
+
+int saa7134_videoport_init(struct saa7134_dev *dev);
+void saa7134_set_tvnorm_hw(struct saa7134_dev *dev);
 
 int saa7134_video_init1(struct saa7134_dev *dev);
 int saa7134_video_init2(struct saa7134_dev *dev);
-int saa7134_video_fini(struct saa7134_dev *dev);
-void saa7134_irq_video_intl(struct saa7134_dev *dev);
+void saa7134_irq_video_signalchange(struct saa7134_dev *dev);
 void saa7134_irq_video_done(struct saa7134_dev *dev, unsigned long status);
 
 
@@ -643,6 +681,8 @@ void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status);
 int saa7134_ts_register(struct saa7134_mpeg_ops *ops);
 void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops);
 
+int saa7134_ts_init_hw(struct saa7134_dev *dev);
+
 /* ----------------------------------------------------------- */
 /* saa7134-vbi.c                                               */
 
@@ -665,17 +705,20 @@ void saa7134_tvaudio_setinput(struct saa7134_dev *dev,
 void saa7134_tvaudio_setvolume(struct saa7134_dev *dev, int level);
 int saa7134_tvaudio_getstereo(struct saa7134_dev *dev);
 
+void saa7134_tvaudio_init(struct saa7134_dev *dev);
 int saa7134_tvaudio_init2(struct saa7134_dev *dev);
 int saa7134_tvaudio_fini(struct saa7134_dev *dev);
 int saa7134_tvaudio_do_scan(struct saa7134_dev *dev);
 
 int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value);
 
+void saa7134_enable_i2s(struct saa7134_dev *dev);
+
 /* ----------------------------------------------------------- */
 /* saa7134-oss.c                                               */
 
-extern struct file_operations saa7134_dsp_fops;
-extern struct file_operations saa7134_mixer_fops;
+extern const struct file_operations saa7134_dsp_fops;
+extern const struct file_operations saa7134_mixer_fops;
 
 int saa7134_oss_init1(struct saa7134_dev *dev);
 int saa7134_oss_fini(struct saa7134_dev *dev);
@@ -688,6 +731,9 @@ int  saa7134_input_init1(struct saa7134_dev *dev);
 void saa7134_input_fini(struct saa7134_dev *dev);
 void saa7134_input_irq(struct saa7134_dev *dev);
 void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir);
+void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir);
+void saa7134_ir_stop(struct saa7134_dev *dev);
+
 
 /*
  * Local variables: