]> err.no Git - linux-2.6/blob - drivers/media/video/au0828/au0828.h
V4L/DVB (7625): au0828: Cleanup
[linux-2.6] / drivers / media / video / au0828 / au0828.h
1 /*
2  *  Driver for the Auvitek AU0828 USB bridge
3  *
4  *  Copyright (c) 2008 Steven Toth <stoth@hauppauge.com>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21
22 #include <linux/usb.h>
23 #include <linux/i2c.h>
24 #include <linux/i2c-algo-bit.h>
25 #include <media/tveeprom.h>
26
27 /* DVB */
28 #include "demux.h"
29 #include "dmxdev.h"
30 #include "dvb_demux.h"
31 #include "dvb_frontend.h"
32 #include "dvb_net.h"
33 #include "dvbdev.h"
34
35 #include "au0828-reg.h"
36 #include "au0828-cards.h"
37
38 #define DRIVER_NAME "au0828"
39 #define URB_COUNT   16
40 //#define URB_BUFSIZE (312 * 188)
41 #define URB_BUFSIZE (0xe522)
42
43 struct au0828_board {
44         char *name;
45 };
46
47 struct au0828_dvb {
48         struct mutex lock;
49         struct dvb_adapter adapter;
50         struct dvb_frontend *frontend;
51         struct dvb_demux demux;
52         struct dmxdev dmxdev;
53         struct dmx_frontend fe_hw;
54         struct dmx_frontend fe_mem;
55         struct dvb_net net;
56         int feeding;
57 };
58
59 struct au0828_dev {
60         struct mutex mutex;
61         struct usb_device       *usbdev;
62         int                     board;
63         u8                      ctrlmsg[64];
64
65         /* I2C */
66         struct i2c_adapter              i2c_adap;
67         struct i2c_algo_bit_data        i2c_algo;
68         struct i2c_client               i2c_client;
69         u32                             i2c_rc;
70
71         /* Digital */
72         struct au0828_dvb               dvb;
73
74         /* USB / URB Related */
75         int             urb_streaming;
76         struct urb      *urbs[URB_COUNT];
77
78 };
79
80 struct au0828_buff {
81         struct au0828_dev       *dev;
82         struct urb              *purb;
83         struct list_head        buff_list;
84 };
85
86 /* ----------------------------------------------------------- */
87 #define au0828_read(dev,reg) au0828_readreg(dev,reg)
88 #define au0828_write(dev,reg,value) au0828_writereg(dev,reg,value)
89 #define au0828_andor(dev,reg,mask,value) \
90  au0828_writereg(dev,reg,(au0828_readreg(dev,reg)&~(mask))|((value)&(mask)))
91
92 #define au0828_set(dev,reg,bit) au0828_andor(dev,(reg),(bit),(bit))
93 #define au0828_clear(dev,reg,bit) au0828_andor(dev,(reg),(bit),0)
94
95 /* ----------------------------------------------------------- */
96 /* au0828-core.c */
97 extern u32 au0828_read(struct au0828_dev *dev, u16 reg);
98 extern u32 au0828_write(struct au0828_dev *dev, u16 reg, u32 val);
99 extern unsigned int debug;
100 extern unsigned int usb_debug;
101 extern unsigned int bridge_debug;
102
103 /* ----------------------------------------------------------- */
104 /* au0828-cards.c */
105 extern struct au0828_board au0828_boards[];
106 extern struct usb_device_id au0828_usb_id_table[];
107 extern const unsigned int au0828_bcount;
108 extern void au0828_gpio_setup(struct au0828_dev *dev);
109 extern int au0828_tuner_callback(void *priv, int command, int arg);
110 extern void au0828_card_setup(struct au0828_dev *dev);
111
112 /* ----------------------------------------------------------- */
113 /* au0828-i2c.c */
114 extern int au0828_i2c_register(struct au0828_dev *dev);
115 extern int au0828_i2c_unregister(struct au0828_dev *dev);
116 extern void au0828_call_i2c_clients(struct au0828_dev *dev,
117         unsigned int cmd, void *arg);
118 extern unsigned int i2c_debug;
119
120 /* ----------------------------------------------------------- */
121 /* au0828-dvb.c */
122 extern int au0828_dvb_register(struct au0828_dev *dev);
123 extern void au0828_dvb_unregister(struct au0828_dev *dev);
124
125 #define dprintk(level, fmt, arg...)\
126         do { if (debug & level)\
127                 printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\
128         } while (0)