V4L/DVB (5097): Convert cx8800 driver to video_ioctl2 handler
[deliverable/linux.git] / drivers / media / video / cx88 / cx88.h
index 89f12e273b7f83a5ac7f47e241028e321f9dd839..97177c0d022f80b85946de107b5b967d5b83a537 100644 (file)
@@ -30,6 +30,7 @@
 #include <media/tveeprom.h>
 #include <media/video-buf.h>
 #include <media/cx2341x.h>
+#include <media/audiochip.h>
 #include <media/video-buf-dvb.h>
 
 #include "btcx-risc.h"
 #include <linux/mutex.h>
 #define CX88_VERSION_CODE KERNEL_VERSION(0,0,6)
 
-#ifndef TRUE
-# define TRUE (1==1)
-#endif
-#ifndef FALSE
-# define FALSE (1==0)
-#endif
 #define UNSET (-1U)
 
 #define CX88_MAXBOARDS 8
@@ -73,23 +68,27 @@ enum cx88_deemph_type {
        FM_DEEMPH_75
 };
 
-/* ----------------------------------------------------------- */
-/* tv norms                                                    */
+enum cx88_board_type {
+       CX88_BOARD_NONE = 0,
+       CX88_MPEG_DVB,
+       CX88_MPEG_BLACKBIRD
+};
 
-struct cx88_tvnorm {
-       char                   *name;
-       v4l2_std_id            id;
-       u32                    cxiformat;
-       u32                    cxoformat;
+enum cx8802_board_access {
+       CX8802_DRVCTL_SHARED    = 1,
+       CX8802_DRVCTL_EXCLUSIVE = 2,
 };
 
-static unsigned int inline norm_maxw(struct cx88_tvnorm *norm)
+/* ----------------------------------------------------------- */
+/* tv norms                                                    */
+
+static unsigned int inline norm_maxw(struct v4l2_tvnorm *norm)
 {
-       return (norm->id & V4L2_STD_625_50) ? 768 : 640;
+       return (norm->id & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 720 : 768;
 }
 
 
-static unsigned int inline norm_maxh(struct cx88_tvnorm *norm)
+static unsigned int inline norm_maxh(struct v4l2_tvnorm *norm)
 {
        return (norm->id & V4L2_STD_625_50) ? 576 : 480;
 }
@@ -219,6 +218,7 @@ struct cx88_input {
        enum cx88_itype type;
        unsigned int    vmux;
        u32             gpio0, gpio1, gpio2, gpio3;
+       unsigned int    extadc:1;
 };
 
 struct cx88_board {
@@ -230,8 +230,8 @@ struct cx88_board {
        int                     tda9887_conf;
        struct cx88_input       input[MAX_CX88_INPUT];
        struct cx88_input       radio;
-       unsigned int            blackbird:1;
-       unsigned int            dvb:1;
+       enum cx88_board_type    mpeg;
+       enum audiochip          audio_chip;
 };
 
 struct cx88_subid {
@@ -312,7 +312,7 @@ struct cx88_core {
 
        /* state info */
        struct task_struct         *kthread;
-       struct cx88_tvnorm         *tvnorm;
+       struct v4l2_tvnorm         *tvnorm;
        u32                        tvaudio;
        u32                        audiomode_manual;
        u32                        audiomode_current;
@@ -329,6 +329,7 @@ struct cx88_core {
 
        /* cx88-video needs to access cx8802 for hybrid tuner pll access. */
        struct cx8802_dev          *dvbdev;
+       enum cx88_board_type       active_type_id;
 };
 
 struct cx8800_dev;
@@ -404,6 +405,31 @@ struct cx8802_suspend_state {
        int                        disabled;
 };
 
+struct cx8802_driver {
+       struct cx88_core *core;
+       struct list_head devlist;
+
+       /* Type of driver and access required */
+       enum cx88_board_type type_id;
+       enum cx8802_board_access hw_access;
+
+       /* MPEG 8802 internal only */
+       int (*suspend)(struct pci_dev *pci_dev, pm_message_t state);
+       int (*resume)(struct pci_dev *pci_dev);
+
+       /* MPEG 8802 -> mini driver - Driver probe and configuration */
+       int (*probe)(struct cx8802_driver *drv);
+       int (*remove)(struct cx8802_driver *drv);
+
+       /* MPEG 8802 -> mini driver - Access for hardware control */
+       int (*advise_acquire)(struct cx8802_driver *drv);
+       int (*advise_release)(struct cx8802_driver *drv);
+
+       /* MPEG 8802 <- mini driver - Access for hardware control */
+       int (*request_acquire)(struct cx8802_driver *drv);
+       int (*request_release)(struct cx8802_driver *drv);
+};
+
 struct cx8802_dev {
        struct cx88_core           *core;
        spinlock_t                 slock;
@@ -438,6 +464,9 @@ struct cx8802_dev {
 
        /* mpeg params */
        struct cx2341x_mpeg_params params;
+
+       /* List of attached drivers */
+       struct cx8802_driver       drvlist;
 };
 
 /* ----------------------------------------------------------- */
@@ -500,7 +529,7 @@ extern void cx88_sram_channel_dump(struct cx88_core *core,
 
 extern int cx88_set_scale(struct cx88_core *core, unsigned int width,
                          unsigned int height, enum v4l2_field field);
-extern int cx88_set_tvnorm(struct cx88_core *core, struct cx88_tvnorm *norm);
+extern int cx88_set_tvnorm(struct cx88_core *core, struct v4l2_tvnorm *norm);
 
 extern struct video_device *cx88_vdev_init(struct cx88_core *core,
                                           struct pci_dev *pci,
@@ -517,7 +546,10 @@ extern int cx88_stop_audio_dma(struct cx88_core *core);
 /* ----------------------------------------------------------- */
 /* cx88-vbi.c                                                  */
 
-void cx8800_vbi_fmt(struct cx8800_dev *dev, struct v4l2_format *f);
+/* Can be used as g_vbi_fmt, try_vbi_fmt and s_vbi_fmt */
+int cx8800_vbi_fmt (struct file *file, void *priv,
+                                       struct v4l2_format *f);
+
 /*
 int cx8800_start_vbi_dma(struct cx8800_dev    *dev,
                         struct cx88_dmaqueue *q,
@@ -570,6 +602,11 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t);
 void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual);
 int cx88_audio_thread(void *data);
 
+int cx8802_register_driver(struct cx8802_driver *drv);
+int cx8802_unregister_driver(struct cx8802_driver *drv);
+struct cx8802_dev * cx8802_get_device(struct inode *inode);
+struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype);
+
 /* ----------------------------------------------------------- */
 /* cx88-input.c                                                */
 
@@ -599,6 +636,13 @@ extern int cx88_do_ioctl(struct inode *inode, struct file *file, int radio,
 extern const u32 cx88_user_ctrls[];
 extern int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl);
 
+/* ----------------------------------------------------------- */
+/* cx88-blackbird.c                                            */
+/* used by cx88-ivtv ioctl emulation layer                     */
+extern int (*cx88_ioctl_hook)(struct inode *inode, struct file *file,
+                             unsigned int cmd, void *arg);
+extern unsigned int (*cx88_ioctl_translator)(unsigned int cmd);
+
 /*
  * Local variables:
  * c-basic-offset: 8
This page took 0.027169 seconds and 5 git commands to generate.