aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/au0828/au0828.h
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@linuxtv.org>2009-03-11 02:00:40 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:25 -0400
commit8b2f079523450fa2d65cbb3f8453820bf1e17533 (patch)
tree8cb0df3d17674cbe1cc012010b3d322e1235a53f /drivers/media/video/au0828/au0828.h
parent968cf78285ef03672ae514e9ad7a60919eb97551 (diff)
V4L/DVB (11066): au0828: add support for analog functionality in bridge
Add support for the analog functionality found in the au0828 bridge Thanks to Michael Krufky <mkrufky@linuxtv.org> and Steven Toth <stoth@linuxtv.org> for providing sample hardware, engineering level support, and testing. Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> [mchehab@redhat.com: fix compilation by adding linux/version.h] Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/au0828/au0828.h')
-rw-r--r--drivers/media/video/au0828/au0828.h174
1 files changed, 167 insertions, 7 deletions
diff --git a/drivers/media/video/au0828/au0828.h b/drivers/media/video/au0828/au0828.h
index 9d6a1161dc98..3b8e3e913475 100644
--- a/drivers/media/video/au0828/au0828.h
+++ b/drivers/media/video/au0828/au0828.h
@@ -24,6 +24,10 @@
24#include <linux/i2c-algo-bit.h> 24#include <linux/i2c-algo-bit.h>
25#include <media/tveeprom.h> 25#include <media/tveeprom.h>
26 26
27/* Analog */
28#include <linux/videodev2.h>
29#include <media/videobuf-vmalloc.h>
30
27/* DVB */ 31/* DVB */
28#include "demux.h" 32#include "demux.h"
29#include "dmxdev.h" 33#include "dmxdev.h"
@@ -39,8 +43,48 @@
39#define URB_COUNT 16 43#define URB_COUNT 16
40#define URB_BUFSIZE (0xe522) 44#define URB_BUFSIZE (0xe522)
41 45
46/* Analog constants */
47#define NTSC_STD_W 720
48#define NTSC_STD_H 480
49
50#define AU0828_INTERLACED_DEFAULT 1
51#define V4L2_CID_PRIVATE_SHARPNESS (V4L2_CID_PRIVATE_BASE + 0)
52
53/* Defination for AU0828 USB transfer */
54#define AU0828_MAX_ISO_BUFS 12 /* maybe resize this value in the future */
55#define AU0828_ISO_PACKETS_PER_URB 10
56#define AU0828_ISO_MAX_FRAME_SIZE (3 * 1024)
57#define AU0828_ISO_BUFFER_SIZE (AU0828_ISO_PACKETS_PER_URB * AU0828_ISO_MAX_FRAME_SIZE)
58
59#define AU0828_MIN_BUF 4
60#define AU0828_DEF_BUF 8
61
62#define AU0828_MAX_IMAGES 10
63#define AU0828_FRAME_SIZE (1028 * 1024 * 4)
64#define AU0828_URB_TIMEOUT msecs_to_jiffies(AU0828_MAX_ISO_BUFS * AU0828_ISO_PACKETS_PER_URB)
65
66#define AU0828_MAX_INPUT 4
67
68enum au0828_itype {
69 AU0828_VMUX_COMPOSITE = 1,
70 AU0828_VMUX_SVIDEO,
71 AU0828_VMUX_CABLE,
72 AU0828_VMUX_TELEVISION,
73 AU0828_VMUX_DVB,
74 AU0828_VMUX_DEBUG
75};
76
77struct au0828_input {
78 enum au0828_itype type;
79 unsigned int vmux;
80 unsigned int amux;
81 void (*audio_setup) (void *priv, int enable);
82};
83
42struct au0828_board { 84struct au0828_board {
43 char *name; 85 char *name;
86 struct au0828_input input[AU0828_MAX_INPUT];
87
44}; 88};
45 89
46struct au0828_dvb { 90struct au0828_dvb {
@@ -55,6 +99,83 @@ struct au0828_dvb {
55 int feeding; 99 int feeding;
56}; 100};
57 101
102enum au0828_stream_state {
103 STREAM_OFF,
104 STREAM_INTERRUPT,
105 STREAM_ON
106};
107
108#define AUVI_INPUT(nr) (&au0828_boards[dev->board].input[nr])
109
110/* device state */
111enum au0828_dev_state {
112 DEV_INITIALIZED = 0x01,
113 DEV_DISCONNECTED = 0x02,
114 DEV_MISCONFIGURED = 0x04
115};
116
117struct au0828_fh {
118 struct au0828_dev *dev;
119 unsigned int stream_on:1; /* Locks streams */
120 struct videobuf_queue vb_vidq;
121 enum v4l2_buf_type type;
122};
123
124struct au0828_usb_isoc_ctl {
125 /* max packet size of isoc transaction */
126 int max_pkt_size;
127
128 /* number of allocated urbs */
129 int num_bufs;
130
131 /* urb for isoc transfers */
132 struct urb **urb;
133
134 /* transfer buffers for isoc transfer */
135 char **transfer_buffer;
136
137 /* Last buffer command and region */
138 u8 cmd;
139 int pos, size, pktsize;
140
141 /* Last field: ODD or EVEN? */
142 int field;
143
144 /* Stores incomplete commands */
145 u32 tmp_buf;
146 int tmp_buf_len;
147
148 /* Stores already requested buffers */
149 struct au0828_buffer *buf;
150
151 /* Stores the number of received fields */
152 int nfields;
153
154 /* isoc urb callback */
155 int (*isoc_copy) (struct au0828_dev *dev, struct urb *urb);
156
157};
158
159/* buffer for one video frame */
160struct au0828_buffer {
161 /* common v4l buffer stuff -- must be first */
162 struct videobuf_buffer vb;
163
164 struct list_head frame;
165 int top_field;
166 int receiving;
167};
168
169struct au0828_dmaqueue {
170 struct list_head active;
171 struct list_head queued;
172
173 wait_queue_head_t wq;
174
175 /* Counters to control buffer fill */
176 int pos;
177};
178
58struct au0828_dev { 179struct au0828_dev {
59 struct mutex mutex; 180 struct mutex mutex;
60 struct usb_device *usbdev; 181 struct usb_device *usbdev;
@@ -70,16 +191,49 @@ struct au0828_dev {
70 /* Digital */ 191 /* Digital */
71 struct au0828_dvb dvb; 192 struct au0828_dvb dvb;
72 193
194 /* Analog */
195 struct list_head au0828list;
196 int users;
197 unsigned int stream_on:1; /* Locks streams */
198 struct video_device *vdev;
199 struct video_device *vbi_dev;
200 int width;
201 int height;
202 u32 field_size;
203 u32 frame_size;
204 u32 bytesperline;
205 int type;
206 u8 ctrl_ainput;
207 __u8 isoc_in_endpointaddr;
208 u8 isoc_init_ok;
209 int greenscreen_detected;
210 unsigned int frame_count;
211 int ctrl_freq;
212 int input_type;
213 unsigned int ctrl_input;
214 enum au0828_dev_state dev_state;
215 enum au0828_stream_state stream_state;
216 wait_queue_head_t open;
217
218 struct mutex lock;
219
220 /* Isoc control struct */
221 struct au0828_dmaqueue vidq;
222 struct au0828_usb_isoc_ctl isoc_ctl;
223 spinlock_t slock;
224
225 /* usb transfer */
226 int alt; /* alternate */
227 int max_pkt_size; /* max packet size of isoc transaction */
228 int num_alt; /* Number of alternative settings */
229 unsigned int *alt_max_pkt_size; /* array of wMaxPacketSize */
230 struct urb *urb[AU0828_MAX_ISO_BUFS]; /* urb for isoc transfers */
231 char *transfer_buffer[AU0828_MAX_ISO_BUFS];/* transfer buffers for isoc
232 transfer */
233
73 /* USB / URB Related */ 234 /* USB / URB Related */
74 int urb_streaming; 235 int urb_streaming;
75 struct urb *urbs[URB_COUNT]; 236 struct urb *urbs[URB_COUNT];
76
77};
78
79struct au0828_buff {
80 struct au0828_dev *dev;
81 struct urb *purb;
82 struct list_head buff_list;
83}; 237};
84 238
85/* ----------------------------------------------------------- */ 239/* ----------------------------------------------------------- */
@@ -115,6 +269,12 @@ extern void au0828_call_i2c_clients(struct au0828_dev *dev,
115 unsigned int cmd, void *arg); 269 unsigned int cmd, void *arg);
116 270
117/* ----------------------------------------------------------- */ 271/* ----------------------------------------------------------- */
272/* au0828-video.c */
273int au0828_analog_register(struct au0828_dev *dev);
274int au0828_analog_stream_disable(struct au0828_dev *d);
275void au0828_analog_unregister(struct au0828_dev *dev);
276
277/* ----------------------------------------------------------- */
118/* au0828-dvb.c */ 278/* au0828-dvb.c */
119extern int au0828_dvb_register(struct au0828_dev *dev); 279extern int au0828_dvb_register(struct au0828_dev *dev);
120extern void au0828_dvb_unregister(struct au0828_dev *dev); 280extern void au0828_dvb_unregister(struct au0828_dev *dev);