linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / media / video / bttvp.h
index bf6ac44..9cb72f1 100644 (file)
@@ -1,5 +1,4 @@
 /*
-    $Id: bttvp.h,v 1.12 2004/10/25 11:26:36 kraxel Exp $
 
     bttv - Bt848 frame grabber driver
 
@@ -27,7 +26,7 @@
 #define _BTTVP_H_
 
 #include <linux/version.h>
-#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,15)
+#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,16)
 
 #include <linux/types.h>
 #include <linux/wait.h>
@@ -36,6 +35,7 @@
 #include <linux/videodev.h>
 #include <linux/pci.h>
 #include <linux/input.h>
+#include <linux/mutex.h>
 #include <asm/scatterlist.h>
 #include <asm/io.h>
 
 #include <media/video-buf.h>
 #include <media/audiochip.h>
 #include <media/tuner.h>
+#include <media/tveeprom.h>
 #include <media/ir-common.h>
 
+
 #include "bt848.h"
 #include "bttv.h"
 #include "btcx-risc.h"
 
 #define UNSET (-1U)
 
+#define clamp(x, low, high) min (max (low, x), high)
+
 /* ---------------------------------------------------------- */
 
 struct bttv_tvnorm {
        int   v4l2_id;
        char  *name;
-        u32   Fsc;
-        u16   swidth, sheight; /* scaled standard width, height */
+       u32   Fsc;
+       u16   swidth, sheight; /* scaled standard width, height */
        u16   totalwidth;
        u8    adelay, bdelay, iform;
        u32   scaledtwidth;
        u16   hdelayx1, hactivex1;
        u16   vdelay;
-        u8    vbipack;
+       u8    vbipack;
        u16   vtotal;
        int   sram;
+       /* ITU-R frame line number of the first VBI line we can
+          capture, of the first and second field. */
+       u16   vbistart[2];
 };
 extern const struct bttv_tvnorm bttv_tvnorms[];
-extern const unsigned int BTTV_TVNORMS;
 
 struct bttv_format {
        char *name;
@@ -101,8 +107,6 @@ struct bttv_format {
        int  flags;
        int  hshift,vshift;   /* for planar modes   */
 };
-extern const struct bttv_format bttv_formats[];
-extern const unsigned int BTTV_FORMATS;
 
 /* ---------------------------------------------------------- */
 
@@ -173,22 +177,6 @@ int bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
                     struct scatterlist *sglist,
                     unsigned int offset, unsigned int bpl,
                     unsigned int pitch, unsigned int lines);
-int bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
-                    struct scatterlist *sglist,
-                    unsigned int yoffset,  unsigned int ybpl,
-                    unsigned int ypadding, unsigned int ylines,
-                    unsigned int uoffset,  unsigned int voffset,
-                    unsigned int hshift,   unsigned int vshift,
-                    unsigned int cpadding);
-int bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
-                     const struct bttv_format *fmt,
-                     struct bttv_overlay *ov,
-                     int skip_top, int skip_bottom);
-
-/* calculate / apply geometry settings */
-void bttv_calc_geo(struct bttv *btv, struct bttv_geometry *geo,
-                  int width, int height, int interleaved, int norm);
-void bttv_apply_geo(struct bttv *btv, struct bttv_geometry *geo, int top);
 
 /* control dma register + risc main loop */
 void bttv_set_dma(struct bttv *btv, int override);
@@ -227,7 +215,6 @@ extern struct bus_type bttv_sub_bus_type;
 int bttv_sub_add_device(struct bttv_core *core, char *name);
 int bttv_sub_del_devices(struct bttv_core *core);
 void bttv_gpio_irq(struct bttv_core *core);
-void bttv_i2c_info(struct bttv_core *core, struct i2c_client *client, int attach);
 
 
 /* ---------------------------------------------------------- */
@@ -240,21 +227,11 @@ extern unsigned int bttv_gpio;
 extern void bttv_gpio_tracking(struct bttv *btv, char *comment);
 extern int init_bttv_i2c(struct bttv *btv);
 extern int fini_bttv_i2c(struct bttv *btv);
-extern int pvr_boot(struct bttv *btv);
 
-extern int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg);
-extern void bttv_reinit_bt848(struct bttv *btv);
-extern void bttv_field_count(struct bttv *btv);
-
-#define vprintk  if (bttv_verbose) printk
+#define bttv_printk if (bttv_verbose) printk
 #define dprintk  if (bttv_debug >= 1) printk
 #define d2printk if (bttv_debug >= 2) printk
 
-/* our devices */
-#define BTTV_MAX 16
-extern unsigned int bttv_num;
-extern struct bttv bttvs[BTTV_MAX];
-
 #define BTTV_MAX_FBUF   0x208000
 #define VBIBUF_SIZE     (2048*VBI_MAXLINES*2)
 #define BTTV_TIMEOUT    (HZ/2) /* 0.5 seconds */
@@ -270,7 +247,7 @@ struct bttv_pll_info {
 
 /* for gpio-connected remote control */
 struct bttv_input {
-       struct input_dev      dev;
+       struct input_dev      *dev;
        struct ir_input_state ir;
        char                  name[32];
        char                  phys[32];
@@ -297,12 +274,14 @@ struct bttv {
 
        /* card configuration info */
        unsigned int cardid;   /* pci subsystem id (bt878 based ones) */
-        unsigned int tuner_type;  /* tuner chip type */
-        unsigned int pinnacle_id;
+       unsigned int tuner_type;  /* tuner chip type */
+       unsigned int tda9887_conf;
        unsigned int svhs;
        struct bttv_pll_info pll;
        int triton1;
        int gpioirq;
+       int (*custom_irq)(struct bttv *btv);
+
        int use_i2c_hw;
 
        /* old gpio interface */
@@ -327,13 +306,13 @@ struct bttv {
 
        /* infrared remote */
        int has_remote;
-       struct bttv_input *remote;
+       struct bttv_ir *remote;
 
        /* locking */
        spinlock_t s_lock;
-        struct semaphore lock;
+       struct mutex lock;
        int resources;
-        struct semaphore reslock;
+       struct mutex reslock;
 #ifdef VIDIOC_G_PRIORITY
        struct v4l2_prio_state prio;
 #endif
@@ -355,6 +334,9 @@ struct bttv {
        int opt_vcr_hack;
        int opt_whitecrush_upper;
        int opt_whitecrush_lower;
+       int opt_uv_ratio;
+       int opt_full_luma_range;
+       int opt_coring;
 
        /* radio data/state */
        int has_radio;
@@ -401,6 +383,11 @@ struct bttv {
        struct bttv_fh init;
 };
 
+/* our devices */
+#define BTTV_MAX 16
+extern unsigned int bttv_num;
+extern struct bttv bttvs[BTTV_MAX];
+
 /* private ioctls */
 #define BTTV_VERSION            _IOR('v' , BASE_VIDIOCPRIVATE+6, int)
 #define BTTV_VBISIZE            _IOR('v' , BASE_VIDIOCPRIVATE+8, int)