blob: cad352aeb837ad308a7578a71728f4ce29b3594a [file] [log] [blame]
Hans Verkuil1c1e45d2008-04-28 20:24:33 -03001/*
2 * cx18 driver internal defines and structures
3 *
4 * Derived from ivtv-driver.h
5 *
6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 * 02111-1307 USA
22 */
23
24#ifndef CX18_DRIVER_H
25#define CX18_DRIVER_H
26
27#include <linux/version.h>
28#include <linux/module.h>
29#include <linux/moduleparam.h>
30#include <linux/init.h>
31#include <linux/delay.h>
32#include <linux/sched.h>
33#include <linux/fs.h>
34#include <linux/pci.h>
35#include <linux/interrupt.h>
36#include <linux/spinlock.h>
37#include <linux/i2c.h>
38#include <linux/i2c-algo-bit.h>
39#include <linux/list.h>
40#include <linux/unistd.h>
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030041#include <linux/pagemap.h>
42#include <linux/workqueue.h>
43#include <linux/mutex.h>
Harvey Harrison1a651a02008-10-18 20:28:37 -070044#include <asm/byteorder.h>
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030045
46#include <linux/dvb/video.h>
47#include <linux/dvb/audio.h>
48#include <media/v4l2-common.h>
Hans Verkuil35ea11f2008-07-20 08:12:02 -030049#include <media/v4l2-ioctl.h>
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030050#include <media/tuner.h>
51#include "cx18-mailbox.h"
52#include "cx18-av-core.h"
53#include "cx23418.h"
54
55/* DVB */
56#include "demux.h"
57#include "dmxdev.h"
58#include "dvb_demux.h"
59#include "dvb_frontend.h"
60#include "dvb_net.h"
61#include "dvbdev.h"
62
63#ifndef CONFIG_PCI
64# error "This driver requires kernel PCI support."
65#endif
66
67#define CX18_MEM_OFFSET 0x00000000
68#define CX18_MEM_SIZE 0x04000000
69#define CX18_REG_OFFSET 0x02000000
70
71/* Maximum cx18 driver instances. */
72#define CX18_MAX_CARDS 32
73
74/* Supported cards */
75#define CX18_CARD_HVR_1600_ESMT 0 /* Hauppauge HVR 1600 (ESMT memory) */
76#define CX18_CARD_HVR_1600_SAMSUNG 1 /* Hauppauge HVR 1600 (Samsung memory) */
77#define CX18_CARD_COMPRO_H900 2 /* Compro VideoMate H900 */
78#define CX18_CARD_YUAN_MPC718 3 /* Yuan MPC718 */
Sri Deevi03c28082008-06-21 11:06:44 -030079#define CX18_CARD_CNXT_RAPTOR_PAL 4 /* Conexant Raptor PAL */
Andy Walls9eee4fb2008-10-04 20:28:40 -030080#define CX18_CARD_TOSHIBA_QOSMIO_DVBT 5 /* Toshiba Qosmio Interal DVB-T/Analog*/
81#define CX18_CARD_LEADTEK_PVR2100 6 /* Leadtek WinFast PVR2100 */
82#define CX18_CARD_LAST 6
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030083
84#define CX18_ENC_STREAM_TYPE_MPG 0
85#define CX18_ENC_STREAM_TYPE_TS 1
86#define CX18_ENC_STREAM_TYPE_YUV 2
87#define CX18_ENC_STREAM_TYPE_VBI 3
88#define CX18_ENC_STREAM_TYPE_PCM 4
89#define CX18_ENC_STREAM_TYPE_IDX 5
90#define CX18_ENC_STREAM_TYPE_RAD 6
91#define CX18_MAX_STREAMS 7
92
93/* system vendor and device IDs */
94#define PCI_VENDOR_ID_CX 0x14f1
95#define PCI_DEVICE_ID_CX23418 0x5b7a
96
97/* subsystem vendor ID */
98#define CX18_PCI_ID_HAUPPAUGE 0x0070
99#define CX18_PCI_ID_COMPRO 0x185b
100#define CX18_PCI_ID_YUAN 0x12ab
Sri Deevi03c28082008-06-21 11:06:44 -0300101#define CX18_PCI_ID_CONEXANT 0x14f1
Andy Walls9eee4fb2008-10-04 20:28:40 -0300102#define CX18_PCI_ID_TOSHIBA 0x1179
103#define CX18_PCI_ID_LEADTEK 0x107D
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300104
105/* ======================================================================== */
106/* ========================== START USER SETTABLE DMA VARIABLES =========== */
107/* ======================================================================== */
108
109/* DMA Buffers, Default size in MB allocated */
110#define CX18_DEFAULT_ENC_TS_BUFFERS 1
111#define CX18_DEFAULT_ENC_MPG_BUFFERS 2
112#define CX18_DEFAULT_ENC_IDX_BUFFERS 1
113#define CX18_DEFAULT_ENC_YUV_BUFFERS 2
114#define CX18_DEFAULT_ENC_VBI_BUFFERS 1
115#define CX18_DEFAULT_ENC_PCM_BUFFERS 1
116
117/* i2c stuff */
118#define I2C_CLIENTS_MAX 16
119
120/* debugging */
121
122/* Flag to turn on high volume debugging */
123#define CX18_DBGFLG_WARN (1 << 0)
124#define CX18_DBGFLG_INFO (1 << 1)
125#define CX18_DBGFLG_API (1 << 2)
126#define CX18_DBGFLG_DMA (1 << 3)
127#define CX18_DBGFLG_IOCTL (1 << 4)
128#define CX18_DBGFLG_FILE (1 << 5)
129#define CX18_DBGFLG_I2C (1 << 6)
130#define CX18_DBGFLG_IRQ (1 << 7)
131/* Flag to turn on high volume debugging */
132#define CX18_DBGFLG_HIGHVOL (1 << 8)
133
134/* NOTE: extra space before comma in 'cx->num , ## args' is required for
135 gcc-2.95, otherwise it won't compile. */
136#define CX18_DEBUG(x, type, fmt, args...) \
137 do { \
138 if ((x) & cx18_debug) \
139 printk(KERN_INFO "cx18-%d " type ": " fmt, cx->num , ## args); \
140 } while (0)
141#define CX18_DEBUG_WARN(fmt, args...) CX18_DEBUG(CX18_DBGFLG_WARN, "warning", fmt , ## args)
142#define CX18_DEBUG_INFO(fmt, args...) CX18_DEBUG(CX18_DBGFLG_INFO, "info", fmt , ## args)
143#define CX18_DEBUG_API(fmt, args...) CX18_DEBUG(CX18_DBGFLG_API, "api", fmt , ## args)
144#define CX18_DEBUG_DMA(fmt, args...) CX18_DEBUG(CX18_DBGFLG_DMA, "dma", fmt , ## args)
145#define CX18_DEBUG_IOCTL(fmt, args...) CX18_DEBUG(CX18_DBGFLG_IOCTL, "ioctl", fmt , ## args)
146#define CX18_DEBUG_FILE(fmt, args...) CX18_DEBUG(CX18_DBGFLG_FILE, "file", fmt , ## args)
147#define CX18_DEBUG_I2C(fmt, args...) CX18_DEBUG(CX18_DBGFLG_I2C, "i2c", fmt , ## args)
148#define CX18_DEBUG_IRQ(fmt, args...) CX18_DEBUG(CX18_DBGFLG_IRQ, "irq", fmt , ## args)
149
150#define CX18_DEBUG_HIGH_VOL(x, type, fmt, args...) \
151 do { \
152 if (((x) & cx18_debug) && (cx18_debug & CX18_DBGFLG_HIGHVOL)) \
153 printk(KERN_INFO "cx18%d " type ": " fmt, cx->num , ## args); \
154 } while (0)
155#define CX18_DEBUG_HI_WARN(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_WARN, "warning", fmt , ## args)
156#define CX18_DEBUG_HI_INFO(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_INFO, "info", fmt , ## args)
157#define CX18_DEBUG_HI_API(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_API, "api", fmt , ## args)
158#define CX18_DEBUG_HI_DMA(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_DMA, "dma", fmt , ## args)
159#define CX18_DEBUG_HI_IOCTL(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_IOCTL, "ioctl", fmt , ## args)
160#define CX18_DEBUG_HI_FILE(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_FILE, "file", fmt , ## args)
161#define CX18_DEBUG_HI_I2C(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_I2C, "i2c", fmt , ## args)
162#define CX18_DEBUG_HI_IRQ(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_IRQ, "irq", fmt , ## args)
163
164/* Standard kernel messages */
165#define CX18_ERR(fmt, args...) printk(KERN_ERR "cx18-%d: " fmt, cx->num , ## args)
166#define CX18_WARN(fmt, args...) printk(KERN_WARNING "cx18-%d: " fmt, cx->num , ## args)
167#define CX18_INFO(fmt, args...) printk(KERN_INFO "cx18-%d: " fmt, cx->num , ## args)
168
169/* Values for CX18_API_DEC_PLAYBACK_SPEED mpeg_frame_type_mask parameter: */
170#define MPEG_FRAME_TYPE_IFRAME 1
171#define MPEG_FRAME_TYPE_IFRAME_PFRAME 3
172#define MPEG_FRAME_TYPE_ALL 7
173
174#define CX18_MAX_PGM_INDEX (400)
175
176extern int cx18_debug;
177
178
179struct cx18_options {
180 int megabytes[CX18_MAX_STREAMS]; /* Size in megabytes of each stream */
181 int cardtype; /* force card type on load */
182 int tuner; /* set tuner on load */
183 int radio; /* enable/disable radio */
184};
185
186/* per-buffer bit flags */
187#define CX18_F_B_NEED_BUF_SWAP 0 /* this buffer should be byte swapped */
188
189/* per-stream, s_flags */
190#define CX18_F_S_CLAIMED 3 /* this stream is claimed */
191#define CX18_F_S_STREAMING 4 /* the fw is decoding/encoding this stream */
192#define CX18_F_S_INTERNAL_USE 5 /* this stream is used internally (sliced VBI processing) */
193#define CX18_F_S_STREAMOFF 7 /* signal end of stream EOS */
194#define CX18_F_S_APPL_IO 8 /* this stream is used read/written by an application */
195
196/* per-cx18, i_flags */
Andy Walls1d6782b2008-11-05 00:49:14 -0300197#define CX18_F_I_LOADED_FW 0 /* Loaded firmware 1st time */
198#define CX18_F_I_EOS 4 /* End of encoder stream */
199#define CX18_F_I_RADIO_USER 5 /* radio tuner is selected */
200#define CX18_F_I_ENC_PAUSED 13 /* the encoder is paused */
Andy Walls1d6782b2008-11-05 00:49:14 -0300201#define CX18_F_I_INITED 21 /* set after first open */
202#define CX18_F_I_FAILED 22 /* set if first open failed */
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300203
204/* These are the VBI types as they appear in the embedded VBI private packets. */
205#define CX18_SLICED_TYPE_TELETEXT_B (1)
206#define CX18_SLICED_TYPE_CAPTION_525 (4)
207#define CX18_SLICED_TYPE_WSS_625 (5)
208#define CX18_SLICED_TYPE_VPS (7)
209
210struct cx18_buffer {
211 struct list_head list;
212 dma_addr_t dma_handle;
213 u32 id;
214 unsigned long b_flags;
215 char *buf;
216
217 u32 bytesused;
218 u32 readpos;
219};
220
221struct cx18_queue {
222 struct list_head list;
Andy Wallsb04bce42008-08-22 21:03:11 -0300223 atomic_t buffers;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300224 u32 bytesused;
225};
226
227struct cx18_dvb {
228 struct dmx_frontend hw_frontend;
229 struct dmx_frontend mem_frontend;
230 struct dmxdev dmxdev;
231 struct dvb_adapter dvb_adapter;
232 struct dvb_demux demux;
233 struct dvb_frontend *fe;
234 struct dvb_net dvbnet;
235 int enabled;
236 int feeding;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300237 struct mutex feedlock;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300238};
239
240struct cx18; /* forward reference */
241struct cx18_scb; /* forward reference */
242
Andy Walls72a4f802008-11-16 21:18:00 -0300243
Andy Wallsee2d64f2008-11-16 01:38:19 -0300244#define CX18_MAX_MDL_ACKS 2
245#define CX18_MAX_EPU_WORK_ORDERS 70 /* CPU_DE_RELEASE_MDL bursts 63 commands */
246
Andy Walls72a4f802008-11-16 21:18:00 -0300247#define CX18_F_EWO_MB_STALE_UPON_RECEIPT 0x1
248#define CX18_F_EWO_MB_STALE_WHILE_PROC 0x2
249#define CX18_F_EWO_MB_STALE \
250 (CX18_F_EWO_MB_STALE_UPON_RECEIPT | CX18_F_EWO_MB_STALE_WHILE_PROC)
251
Andy Wallsee2d64f2008-11-16 01:38:19 -0300252struct cx18_epu_work_order {
253 struct work_struct work;
254 atomic_t pending;
255 struct cx18 *cx;
Andy Walls72a4f802008-11-16 21:18:00 -0300256 unsigned long flags;
Andy Wallsee2d64f2008-11-16 01:38:19 -0300257 int rpu;
258 struct cx18_mailbox mb;
259 struct cx18_mdl_ack mdl_ack[CX18_MAX_MDL_ACKS];
260 char *str;
261};
262
Andy Wallsd3c5e702008-08-23 16:42:29 -0300263#define CX18_INVALID_TASK_HANDLE 0xffffffff
264
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300265struct cx18_stream {
266 /* These first four fields are always set, even if the stream
267 is not actually created. */
268 struct video_device *v4l2dev; /* NULL when stream not created */
269 struct cx18 *cx; /* for ease of use */
270 const char *name; /* name of the stream */
271 int type; /* stream type */
272 u32 handle; /* task handle */
273 unsigned mdl_offset;
274
275 u32 id;
Andy Wallsf576cee2008-11-16 20:18:05 -0300276 struct mutex qlock; /* locks access to the queues */
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300277 unsigned long s_flags; /* status flags, see above */
278 int dma; /* can be PCI_DMA_TODEVICE,
279 PCI_DMA_FROMDEVICE or
280 PCI_DMA_NONE */
281 u64 dma_pts;
282 wait_queue_head_t waitq;
283
284 /* Buffer Stats */
285 u32 buffers;
286 u32 buf_size;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300287
288 /* Buffer Queues */
289 struct cx18_queue q_free; /* free buffers */
290 struct cx18_queue q_full; /* full buffers */
291 struct cx18_queue q_io; /* waiting for I/O */
292
293 /* DVB / Digital Transport */
294 struct cx18_dvb dvb;
295};
296
297struct cx18_open_id {
298 u32 open_id;
299 int type;
300 enum v4l2_priority prio;
301 struct cx18 *cx;
302};
303
304/* forward declaration of struct defined in cx18-cards.h */
305struct cx18_card;
306
307
308#define CX18_VBI_FRAMES 32
309
310/* VBI data */
311struct vbi_info {
312 u32 enc_size;
313 u32 frame;
314 u8 cc_data_odd[256];
315 u8 cc_data_even[256];
316 int cc_pos;
317 u8 cc_no_update;
318 u8 vps[5];
319 u8 vps_found;
320 int wss;
321 u8 wss_found;
322 u8 wss_no_update;
323 u32 raw_decoder_line_size;
324 u8 raw_decoder_sav_odd_field;
325 u8 raw_decoder_sav_even_field;
326 u32 sliced_decoder_line_size;
327 u8 sliced_decoder_sav_odd_field;
328 u8 sliced_decoder_sav_even_field;
329 struct v4l2_format in;
330 /* convenience pointer to sliced struct in vbi_in union */
331 struct v4l2_sliced_vbi_format *sliced_in;
332 u32 service_set_in;
333 int insert_mpeg;
334
335 /* Buffer for the maximum of 2 * 18 * packet_size sliced VBI lines.
336 One for /dev/vbi0 and one for /dev/vbi8 */
337 struct v4l2_sliced_vbi_data sliced_data[36];
338
339 /* Buffer for VBI data inserted into MPEG stream.
340 The first byte is a dummy byte that's never used.
341 The next 16 bytes contain the MPEG header for the VBI data,
342 the remainder is the actual VBI data.
343 The max size accepted by the MPEG VBI reinsertion turns out
344 to be 1552 bytes, which happens to be 4 + (1 + 42) * (2 * 18) bytes,
345 where 4 is a four byte header, 42 is the max sliced VBI payload, 1 is
346 a single line header byte and 2 * 18 is the number of VBI lines per frame.
347
348 However, it seems that the data must be 1K aligned, so we have to
349 pad the data until the 1 or 2 K boundary.
350
351 This pointer array will allocate 2049 bytes to store each VBI frame. */
352 u8 *sliced_mpeg_data[CX18_VBI_FRAMES];
353 u32 sliced_mpeg_size[CX18_VBI_FRAMES];
354 struct cx18_buffer sliced_mpeg_buf;
355 u32 inserted_frame;
356
357 u32 start[2], count;
358 u32 raw_size;
359 u32 sliced_size;
360};
361
362/* Per cx23418, per I2C bus private algo callback data */
363struct cx18_i2c_algo_callback_data {
364 struct cx18 *cx;
365 int bus_index; /* 0 or 1 for the cx23418's 1st or 2nd I2C bus */
366};
367
Andy Wallsf7823f82008-11-02 18:15:28 -0300368#define CX18_MAX_MMIO_WR_RETRIES 10
Andy Walls330c6ec2008-11-08 14:19:37 -0300369#define CX18_MAX_MB_ACK_DELAY 100
370
371struct cx18_mbox_stats {
372 atomic_t mb_ack_delay[CX18_MAX_MB_ACK_DELAY+1];
373};
374
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300375/* Struct to hold info about cx18 cards */
376struct cx18 {
377 int num; /* board number, -1 during init! */
378 char name[8]; /* board name for printk and interrupts (e.g. 'cx180') */
379 struct pci_dev *dev; /* PCI device */
380 const struct cx18_card *card; /* card information */
381 const char *card_name; /* full name of the card */
382 const struct cx18_card_tuner_i2c *card_i2c; /* i2c addresses to probe for tuner */
383 u8 is_50hz;
384 u8 is_60hz;
385 u8 is_out_50hz;
386 u8 is_out_60hz;
387 u8 nof_inputs; /* number of video inputs */
388 u8 nof_audio_inputs; /* number of audio inputs */
389 u16 buffer_id; /* buffer ID counter */
390 u32 v4l2_cap; /* V4L2 capabilities of card */
391 u32 hw_flags; /* Hardware description of the board */
392 unsigned mdl_offset;
Andy Walls72c2d6d2008-11-06 01:15:41 -0300393 struct cx18_scb __iomem *scb; /* pointer to SCB */
394 struct mutex epu2apu_mb_lock; /* protect driver to chip mailbox in SCB*/
395 struct mutex epu2cpu_mb_lock; /* protect driver to chip mailbox in SCB*/
396
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300397 struct cx18_av_state av_state;
398
399 /* codec settings */
400 struct cx2341x_mpeg_params params;
401 u32 filter_mode;
402 u32 temporal_strength;
403 u32 spatial_strength;
404
405 /* dualwatch */
406 unsigned long dualwatch_jiffies;
407 u16 dualwatch_stereo_mode;
408
409 /* Digitizer type */
410 int digitizer; /* 0x00EF = saa7114 0x00FO = saa7115 0x0106 = mic */
411
412 struct mutex serialize_lock; /* mutex used to serialize open/close/start/stop/ioctl operations */
413 struct cx18_options options; /* User options */
414 int stream_buf_size[CX18_MAX_STREAMS]; /* Stream buffer size */
415 struct cx18_stream streams[CX18_MAX_STREAMS]; /* Stream data */
416 unsigned long i_flags; /* global cx18 flags */
Hans Verkuil31554ae2008-05-25 11:21:27 -0300417 atomic_t ana_capturing; /* count number of active analog capture streams */
418 atomic_t tot_capturing; /* total count number of active capture streams */
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300419 spinlock_t lock; /* lock access to this struct */
420 int search_pack_header;
421
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300422 int open_id; /* incremented each time an open occurs, used as
423 unique ID. Starts at 1, so 0 can be used as
424 uninitialized value in the stream->id. */
425
426 u32 base_addr;
427 struct v4l2_prio_state prio;
428
429 u8 card_rev;
430 void __iomem *enc_mem, *reg_mem;
431
432 struct vbi_info vbi;
433
434 u32 pgm_info_offset;
435 u32 pgm_info_num;
436 u32 pgm_info_write_idx;
437 u32 pgm_info_read_idx;
438 struct v4l2_enc_idx_entry pgm_info[CX18_MAX_PGM_INDEX];
439
440 u64 mpg_data_received;
441 u64 vbi_data_inserted;
442
443 wait_queue_head_t mb_apu_waitq;
444 wait_queue_head_t mb_cpu_waitq;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300445 wait_queue_head_t cap_w;
446 /* when the current DMA is finished this queue is woken up */
447 wait_queue_head_t dma_waitq;
448
Andy Wallsd6c7e5f2008-11-17 22:48:46 -0300449 u32 sw1_irq_mask;
450 u32 sw2_irq_mask;
451 u32 hw2_irq_mask;
452
Andy Wallsee2d64f2008-11-16 01:38:19 -0300453 struct cx18_epu_work_order epu_work_order[CX18_MAX_EPU_WORK_ORDERS];
454 char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */
Andy Walls1d6782b2008-11-05 00:49:14 -0300455
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300456 /* i2c */
457 struct i2c_adapter i2c_adap[2];
458 struct i2c_algo_bit_data i2c_algo[2];
459 struct cx18_i2c_algo_callback_data i2c_algo_cb_data[2];
460 struct i2c_client i2c_client[2];
461 struct mutex i2c_bus_lock[2];
462 struct i2c_client *i2c_clients[I2C_CLIENTS_MAX];
463
Hans Verkuilba60bc62008-05-25 14:34:36 -0300464 /* gpio */
465 u32 gpio_dir;
466 u32 gpio_val;
Andy Walls8abdd002008-07-13 19:05:25 -0300467 struct mutex gpio_lock;
Hans Verkuilba60bc62008-05-25 14:34:36 -0300468
Andy Wallsd267d852008-09-28 21:46:02 -0300469 /* Statistics */
Andy Walls330c6ec2008-11-08 14:19:37 -0300470 struct cx18_mbox_stats mbox_stats;
Andy Wallsd267d852008-09-28 21:46:02 -0300471
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300472 /* v4l2 and User settings */
473
474 /* codec settings */
475 u32 audio_input;
476 u32 active_input;
477 u32 active_output;
478 v4l2_std_id std;
479 v4l2_std_id tuner_std; /* The norm of the tuner (fixed) */
480};
481
482/* Globals */
483extern struct cx18 *cx18_cards[];
484extern int cx18_cards_active;
485extern int cx18_first_minor;
486extern spinlock_t cx18_cards_lock;
Andy Walls18b5dc22008-11-16 17:15:01 -0300487extern struct workqueue_struct *cx18_work_queue;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300488
489/*==============Prototypes==================*/
490
491/* Return non-zero if a signal is pending */
492int cx18_msleep_timeout(unsigned int msecs, int intr);
493
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300494/* Read Hauppauge eeprom */
495struct tveeprom; /* forward reference */
496void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv);
497
498/* First-open initialization: load firmware, etc. */
499int cx18_init_on_first_open(struct cx18 *cx);
500
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300501#endif /* CX18_DRIVER_H */