Blame view

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