summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx88/cx88.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/cx88/cx88.h')
-rw-r--r--linux/drivers/media/video/cx88/cx88.h144
1 files changed, 101 insertions, 43 deletions
diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h
index 715cdf520..a4b508ffa 100644
--- a/linux/drivers/media/video/cx88/cx88.h
+++ b/linux/drivers/media/video/cx88/cx88.h
@@ -1,4 +1,6 @@
/*
+ * $Id: cx88.h,v 1.21 2004/07/29 21:35:48 kraxel Exp $
+ *
* v4l2 device driver for cx2388x based TV cards
*
* (c) 2003,04 Gerd Knorr <kraxel@bytesex.org> [SUSE Labs]
@@ -111,6 +113,7 @@ struct cx88_ctrl {
#define SRAM_CH24 3 /* vbi */
#define SRAM_CH25 4 /* audio */
#define SRAM_CH26 5
+#define SRAM_CH28 6 /* mpeg */
/* more */
struct sram_channel {
@@ -171,6 +174,7 @@ struct cx88_board {
int tda9887_conf;
struct cx88_input input[8];
struct cx88_input radio;
+ int blackbird:1;
};
struct cx88_subid {
@@ -179,7 +183,7 @@ struct cx88_subid {
u32 card;
};
-#define INPUT(nr) (&cx88_boards[dev->board].input[nr])
+#define INPUT(nr) (&cx88_boards[dev->core->board].input[nr])
/* ----------------------------------------------------------- */
/* device / file handle status */
@@ -191,8 +195,6 @@ struct cx88_subid {
//#define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */
#define BUFFER_TIMEOUT (HZ*2)
-struct cx8800_dev;
-
/* buffer for one video frame */
struct cx88_buffer {
/* common v4l buffer stuff -- must be first */
@@ -213,7 +215,40 @@ struct cx88_dmaqueue {
u32 count;
};
-/* video filehandle status */
+struct cx88_core {
+ struct list_head devlist;
+ atomic_t refcount;
+
+ /* board name */
+ int nr;
+ char name[32];
+
+ /* pci stuff */
+ int pci_bus;
+ int pci_slot;
+ u32 *lmmio;
+ u8 *bmmio;
+ u32 shadow[SHADOW_MAX];
+
+ /* i2c i/o */
+ struct i2c_adapter i2c_adap;
+ struct i2c_algo_bit_data i2c_algo;
+ struct i2c_client i2c_client;
+ u32 i2c_state, i2c_rc;
+
+ /* config info */
+ unsigned int board;
+ unsigned int tuner_type;
+ unsigned int tda9887_conf;
+ unsigned int has_radio;
+};
+
+struct cx8800_dev;
+struct cx8802_dev;
+
+/* ----------------------------------------------------------- */
+/* function 0: video stuff */
+
struct cx8800_fh {
struct cx8800_dev *dev;
enum v4l2_buf_type type;
@@ -239,8 +274,8 @@ struct cx8800_suspend_state {
int disabled;
};
-/* global device status */
struct cx8800_dev {
+ struct cx88_core *core;
struct list_head devlist;
struct semaphore lock;
spinlock_t slock;
@@ -252,23 +287,8 @@ struct cx8800_dev {
struct video_device *radio_dev;
/* pci i/o */
- char name[32];
struct pci_dev *pci;
unsigned char pci_rev,pci_lat;
- u32 *lmmio;
- u8 *bmmio;
-
- /* config info */
- unsigned int board;
- unsigned int tuner_type;
- unsigned int tda9887_conf;
- unsigned int has_radio;
-
- /* i2c i/o */
- struct i2c_adapter i2c_adap;
- struct i2c_algo_bit_data i2c_algo;
- struct i2c_client i2c_client;
- u32 i2c_state, i2c_rc;
/* video overlay */
struct v4l2_framebuffer fbuf;
@@ -285,7 +305,6 @@ struct cx8800_dev {
u32 freq;
/* other global state info */
- u32 shadow[SHADOW_MAX];
int shutdown;
pid_t tpid;
struct completion texit;
@@ -294,27 +313,63 @@ struct cx8800_dev {
};
/* ----------------------------------------------------------- */
+/* function 1: audio/alsa stuff */
+
+struct cx8801_dev {
+ struct cx88_core *core;
-#define cx_read(reg) readl(dev->lmmio + ((reg)>>2))
-#define cx_write(reg,value) writel((value), dev->lmmio + ((reg)>>2));
-#define cx_writeb(reg,value) writeb((value), dev->bmmio + (reg));
+ /* pci i/o */
+ struct pci_dev *pci;
+ unsigned char pci_rev,pci_lat;
+};
+
+/* ----------------------------------------------------------- */
+/* function 2: mpeg stuff */
+
+struct cx8802_fh {
+ struct cx8802_dev *dev;
+ struct videobuf_queue mpegq;
+};
+
+struct cx8802_dev {
+ struct cx88_core *core;
+ struct list_head devlist;
+ struct semaphore lock;
+ spinlock_t slock;
+
+ /* misc */
+ struct video_device *mpeg_dev;
+
+ /* pci i/o */
+ struct pci_dev *pci;
+ unsigned char pci_rev,pci_lat;
+
+ /* dma queues */
+ struct cx88_dmaqueue mpegq;
+};
+
+/* ----------------------------------------------------------- */
+
+#define cx_read(reg) readl(core->lmmio + ((reg)>>2))
+#define cx_write(reg,value) writel((value), core->lmmio + ((reg)>>2));
+#define cx_writeb(reg,value) writeb((value), core->bmmio + (reg));
#define cx_andor(reg,mask,value) \
- writel((readl(dev->lmmio+((reg)>>2)) & ~(mask)) |\
- ((value) & (mask)), dev->lmmio+((reg)>>2))
+ writel((readl(core->lmmio+((reg)>>2)) & ~(mask)) |\
+ ((value) & (mask)), core->lmmio+((reg)>>2))
#define cx_set(reg,bit) cx_andor((reg),(bit),(bit))
#define cx_clear(reg,bit) cx_andor((reg),(bit),0)
#define cx_wait(d) { if (need_resched()) schedule(); else udelay(d); }
/* shadow registers */
-#define cx_sread(sreg) (dev->shadow[sreg])
+#define cx_sread(sreg) (core->shadow[sreg])
#define cx_swrite(sreg,reg,value) \
- (dev->shadow[sreg] = value, \
- writel(dev->shadow[sreg], dev->lmmio + ((reg)>>2)))
+ (core->shadow[sreg] = value, \
+ writel(core->shadow[sreg], core->lmmio + ((reg)>>2)))
#define cx_sandor(sreg,reg,mask,value) \
- (dev->shadow[sreg] = (dev->shadow[sreg] & ~(mask)) | ((value) & (mask)), \
- writel(dev->shadow[sreg], dev->lmmio + ((reg)>>2)))
+ (core->shadow[sreg] = (core->shadow[sreg] & ~(mask)) | ((value) & (mask)), \
+ writel(core->shadow[sreg], core->lmmio + ((reg)>>2)))
/* ----------------------------------------------------------- */
/* cx88-core.c */
@@ -336,17 +391,20 @@ cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
extern void
cx88_free_buffer(struct pci_dev *pci, struct cx88_buffer *buf);
-extern void cx88_risc_disasm(struct cx8800_dev *dev,
+extern void cx88_risc_disasm(struct cx88_core *core,
struct btcx_riscmem *risc);
-
-extern int cx88_sram_channel_setup(struct cx8800_dev *dev,
+extern int cx88_sram_channel_setup(struct cx88_core *core,
struct sram_channel *ch,
unsigned int bpl, u32 risc);
-extern void cx88_sram_channel_dump(struct cx8800_dev *dev,
+extern void cx88_sram_channel_dump(struct cx88_core *core,
struct sram_channel *ch);
-
-extern int cx88_pci_quirks(char *name, struct pci_dev *pci,
- unsigned int *latency);
+extern struct video_device *cx88_vdev_init(struct cx88_core *core,
+ struct pci_dev *pci,
+ struct video_device *template,
+ char *type);
+extern struct cx88_core* cx88_core_get(struct pci_dev *pci);
+extern void cx88_core_put(struct cx88_core *core,
+ struct pci_dev *pci);
/* ----------------------------------------------------------- */
/* cx88-vbi.c */
@@ -364,9 +422,9 @@ extern struct videobuf_queue_ops cx8800_vbi_qops;
/* ----------------------------------------------------------- */
/* cx88-i2c.c */
-extern int cx8800_i2c_init(struct cx8800_dev *dev);
-extern void cx8800_call_i2c_clients(struct cx8800_dev *dev,
- unsigned int cmd, void *arg);
+extern int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci);
+extern void cx88_call_i2c_clients(struct cx88_core *core,
+ unsigned int cmd, void *arg);
/* ----------------------------------------------------------- */
@@ -378,8 +436,8 @@ extern const unsigned int cx88_bcount;
extern struct cx88_subid cx88_subids[];
extern const unsigned int cx88_idcount;
-extern void cx88_card_list(struct cx8800_dev *dev);
-extern void cx88_card_setup(struct cx8800_dev *dev);
+extern void cx88_card_list(struct cx88_core *core, struct pci_dev *pci);
+extern void cx88_card_setup(struct cx88_core *core);
/* ----------------------------------------------------------- */
/* cx88-tvaudio.c */