tw68.h (5740f4e75f713015067e2667a52bd3b35ef91e07) tw68.h (e15d1c12c5878b3a80d6573af1721e17264e0286)
1/*
2 * tw68 driver common header file
3 *
4 * Much of this code is derived from the cx88 and sa7134 drivers, which
5 * were in turn derived from the bt87x driver. The original work was by
6 * Gerd Knorr; more recently the code was enhanced by Mauro Carvalho Chehab,
7 * Hans Verkuil, Andy Walls and many others. Their work is gratefully
8 * acknowledged. Full credit goes to them - any problems within this code
9 * are mine.
10 *
1/*
2 * tw68 driver common header file
3 *
4 * Much of this code is derived from the cx88 and sa7134 drivers, which
5 * were in turn derived from the bt87x driver. The original work was by
6 * Gerd Knorr; more recently the code was enhanced by Mauro Carvalho Chehab,
7 * Hans Verkuil, Andy Walls and many others. Their work is gratefully
8 * acknowledged. Full credit goes to them - any problems within this code
9 * are mine.
10 *
11 * Copyright (C) 2009 William M. Brack <wbrack@mmm.com.hk>
11 * Copyright (C) 2009 William M. Brack
12 *
12 *
13 * Refactored and updated to the latest v4l core frameworks:
14 *
15 * Copyright (C) 2014 Hans Verkuil <hverkuil@xs4all.nl>
16 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 * 02111-1307 USA
27 */
28
29#include <linux/version.h>
26 */
27
28#include <linux/version.h>
30#define TW68_VERSION_CODE KERNEL_VERSION(0, 0, 8)
31
32#include <linux/pci.h>
29#include <linux/pci.h>
33#include <linux/i2c.h>
34#include <linux/i2c-algo-bit.h>
35#include <linux/videodev2.h>
30#include <linux/videodev2.h>
36#include <linux/kdev_t.h>
37#include <linux/input.h>
38#include <linux/notifier.h>
39#include <linux/delay.h>
40#include <linux/mutex.h>
31#include <linux/notifier.h>
32#include <linux/delay.h>
33#include <linux/mutex.h>
34#include <linux/io.h>
41
35
42#include <asm/io.h>
43
44#include <media/v4l2-common.h>
45#include <media/v4l2-ioctl.h>
36#include <media/v4l2-common.h>
37#include <media/v4l2-ioctl.h>
38#include <media/v4l2-ctrls.h>
46#include <media/v4l2-device.h>
39#include <media/v4l2-device.h>
40#include <media/videobuf2-dma-sg.h>
47
41
48#include <media/tuner.h>
49#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
50# include <media/ir-common.h>
51#endif
52#include <media/ir-kbd-i2c.h>
53#include <media/videobuf-dma-sg.h>
54
55#include "btcx-risc.h"
56#include "tw68-reg.h"
57
58#define UNSET (-1U)
59
42#include "tw68-reg.h"
43
44#define UNSET (-1U)
45
60/*
61 * dprintk statement within the code use a 'level' argument. For
62 * our purposes, we use the following levels:
63 */
64#define DBG_UNEXPECTED (1 << 0)
65#define DBG_UNUSUAL (1 << 1)
66#define DBG_TESTING (1 << 2)
67#define DBG_BUFF (1 << 3)
68#define DBG_FLOW (1 << 15)
69
70/* system vendor and device ID's */
71#define PCI_VENDOR_ID_TECHWELL 0x1797
72#define PCI_DEVICE_ID_6800 0x6800
73#define PCI_DEVICE_ID_6801 0x6801
74#define PCI_DEVICE_ID_AUDIO2 0x6802
75#define PCI_DEVICE_ID_TS3 0x6803
76#define PCI_DEVICE_ID_6804 0x6804
77#define PCI_DEVICE_ID_AUDIO5 0x6805
78#define PCI_DEVICE_ID_TS6 0x6806
79
80/* tw6816 based cards */
81#define PCI_DEVICE_ID_6816_1 0x6810
82#define PCI_DEVICE_ID_6816_2 0x6811
83#define PCI_DEVICE_ID_6816_3 0x6812
84#define PCI_DEVICE_ID_6816_4 0x6813
85
46/* system vendor and device ID's */
47#define PCI_VENDOR_ID_TECHWELL 0x1797
48#define PCI_DEVICE_ID_6800 0x6800
49#define PCI_DEVICE_ID_6801 0x6801
50#define PCI_DEVICE_ID_AUDIO2 0x6802
51#define PCI_DEVICE_ID_TS3 0x6803
52#define PCI_DEVICE_ID_6804 0x6804
53#define PCI_DEVICE_ID_AUDIO5 0x6805
54#define PCI_DEVICE_ID_TS6 0x6806
55
56/* tw6816 based cards */
57#define PCI_DEVICE_ID_6816_1 0x6810
58#define PCI_DEVICE_ID_6816_2 0x6811
59#define PCI_DEVICE_ID_6816_3 0x6812
60#define PCI_DEVICE_ID_6816_4 0x6813
61
86/* subsystem vendor ID's */
87#define TW68_PCI_ID_TECHWELL 0x1797
62#define TW68_NORMS ( \
63 V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM | \
64 V4L2_STD_PAL_M | V4L2_STD_PAL_Nc | V4L2_STD_PAL_60)
88
65
89#define TW68_NORMS (\
90 V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM | \
91 V4L2_STD_PAL_BG | V4L2_STD_PAL_DK | V4L2_STD_PAL_I | \
92 V4L2_STD_PAL_M | V4L2_STD_PAL_Nc | V4L2_STD_PAL_60 | \
93 V4L2_STD_525_60 | V4L2_STD_625_50 | \
94 V4L2_STD_SECAM_L| V4L2_STD_SECAM_LC | V4L2_STD_SECAM_DK)
95
96#define TW68_VID_INTS (TW68_FFERR | TW68_PABORT | TW68_DMAPERR | \
97 TW68_FFOF | TW68_DMAPI)
98/* TW6800 chips have trouble with these, so we don't set them for that chip */
99#define TW68_VID_INTSX (TW68_FDMIS | TW68_HLOCK | TW68_VLOCK)
100
101#define TW68_I2C_INTS (TW68_SBERR | TW68_SBDONE | TW68_SBERR2 | \
102 TW68_SBDONE2)
103
66#define TW68_VID_INTS (TW68_FFERR | TW68_PABORT | TW68_DMAPERR | \
67 TW68_FFOF | TW68_DMAPI)
68/* TW6800 chips have trouble with these, so we don't set them for that chip */
69#define TW68_VID_INTSX (TW68_FDMIS | TW68_HLOCK | TW68_VLOCK)
70
71#define TW68_I2C_INTS (TW68_SBERR | TW68_SBDONE | TW68_SBERR2 | \
72 TW68_SBDONE2)
73
104typedef enum {
74enum tw68_decoder_type {
105 TW6800,
106 TW6801,
107 TW6804,
108 TWXXXX,
75 TW6800,
76 TW6801,
77 TW6804,
78 TWXXXX,
109} TW68_DECODER_TYPE;
79};
80
110/* ----------------------------------------------------------- */
111/* static data */
112
113struct tw68_tvnorm {
114 char *name;
115 v4l2_std_id id;
116
117 /* video decoder */

--- 30 unchanged lines hidden (view full) ---

148/* ----------------------------------------------------------- */
149/* card configuration */
150
151#define TW68_BOARD_NOAUTO UNSET
152#define TW68_BOARD_UNKNOWN 0
153#define TW68_BOARD_GENERIC_6802 1
154
155#define TW68_MAXBOARDS 16
81/* ----------------------------------------------------------- */
82/* static data */
83
84struct tw68_tvnorm {
85 char *name;
86 v4l2_std_id id;
87
88 /* video decoder */

--- 30 unchanged lines hidden (view full) ---

119/* ----------------------------------------------------------- */
120/* card configuration */
121
122#define TW68_BOARD_NOAUTO UNSET
123#define TW68_BOARD_UNKNOWN 0
124#define TW68_BOARD_GENERIC_6802 1
125
126#define TW68_MAXBOARDS 16
156#define TW68_INPUT_MAX 8
127#define TW68_INPUT_MAX 4
157
158/* ----------------------------------------------------------- */
128
129/* ----------------------------------------------------------- */
159/* enums */
160
161enum tw68_mpeg_type {
162 TW68_MPEG_UNUSED,
163 TW68_MPEG_EMPRESS,
164 TW68_MPEG_DVB,
165};
166
167enum tw68_audio_in {
168 TV = 1,
169 LINE1 = 2,
170 LINE2 = 3,
171 LINE2_LEFT,
172};
173
174enum tw68_video_out {
175 CCIR656 = 1,
176};
177
178/* Structs for card definition */
179struct tw68_input {
180 char *name; /* text description */
181 unsigned int vmux; /* mux value */
182 enum tw68_audio_in mux;
183 unsigned int gpio;
184 unsigned int tv:1;
185};
186
187struct tw68_board {
188 char *name;
189 unsigned int audio_clock;
190
191 /* input switching */
192 unsigned int gpiomask;
193 struct tw68_input inputs[TW68_INPUT_MAX];
194 struct tw68_input radio;
195 struct tw68_input mute;
196
197 /* i2c chip info */
198 unsigned int tuner_type;
199 unsigned int radio_type;
200 unsigned char tuner_addr;
201 unsigned char radio_addr;
202
203 unsigned int tda9887_conf;
204 unsigned int tuner_config;
205
206 enum tw68_video_out video_out;
207 enum tw68_mpeg_type mpeg;
208 unsigned int vid_port_opts;
209};
210
211#define card_has_radio(dev) (NULL != tw68_boards[dev->board].radio.name)
212#define card_has_mpeg(dev) (TW68_MPEG_UNUSED != \
213 tw68_boards[dev->board].mpeg)
214#define card_in(dev, n) (tw68_boards[dev->board].inputs[n])
215#define card(dev) (tw68_boards[dev->board])
216
217/* ----------------------------------------------------------- */
218/* device / file handle status */
219
130/* device / file handle status */
131
220#define RESOURCE_VIDEO 1
221#define RESOURCE_VBI 2
222
223#define INTERLACE_AUTO 0
224#define INTERLACE_ON 1
225#define INTERLACE_OFF 2
226
227#define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */
228
229struct tw68_dev; /* forward delclaration */
230
132#define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */
133
134struct tw68_dev; /* forward delclaration */
135
231/* tvaudio thread status */
232struct tw68_thread {
233 struct task_struct *thread;
234 unsigned int scan1;
235 unsigned int scan2;
236 unsigned int mode;
237 unsigned int stopped;
238};
239
240/* buffer for one video/vbi/ts frame */
241struct tw68_buf {
136/* buffer for one video/vbi/ts frame */
137struct tw68_buf {
242 /* common v4l buffer stuff -- must be first */
243 struct videobuf_buffer vb;
138 struct vb2_buffer vb;
139 struct list_head list;
244
140
245 /* tw68 specific */
246 struct tw68_format *fmt;
247 struct tw68_input *input;
248 unsigned int top_seen;
249 int (*activate)(struct tw68_dev *dev,
250 struct tw68_buf *buf,
251 struct tw68_buf *next);
252 struct btcx_riscmem risc;
253 unsigned int bpl;
141 unsigned int size;
142 __le32 *cpu;
143 __le32 *jmp;
144 dma_addr_t dma;
254};
255
145};
146
256struct tw68_dmaqueue {
257 struct tw68_dev *dev;
258 struct list_head active;
259 struct list_head queued;
260 struct timer_list timeout;
261 struct btcx_riscmem stopper;
262 int (*buf_compat)(struct tw68_buf *prev,
263 struct tw68_buf *buf);
264 int (*start_dma)(struct tw68_dev *dev,
265 struct tw68_dmaqueue *q,
266 struct tw68_buf *buf);
267};
268
269/* video filehandle status */
270struct tw68_fh {
271 struct tw68_dev *dev;
272 unsigned int radio;
273 enum v4l2_buf_type type;
274 unsigned int resources;
275 enum v4l2_priority prio;
276
277 /* video capture */
278 struct tw68_format *fmt;
279 unsigned int width, height;
280 struct videobuf_queue cap; /* also used for overlay */
281
282 /* vbi capture */
283 struct videobuf_queue vbi;
284};
285
286/* dmasound dsp status */
287struct tw68_dmasound {
288 struct mutex lock;
289 int minor_mixer;
290 int minor_dsp;
291 unsigned int users_dsp;
292
293 /* mixer */
294 enum tw68_audio_in input;
295 unsigned int count;
296 unsigned int line1;
297 unsigned int line2;
298
299 /* dsp */
300 unsigned int afmt;
301 unsigned int rate;
302 unsigned int channels;
303 unsigned int recording_on;
304 unsigned int dma_running;
305 unsigned int blocks;
306 unsigned int blksize;
307 unsigned int bufsize;
308 struct videobuf_dmabuf dma;
309 unsigned int dma_blk;
310 unsigned int read_offset;
311 unsigned int read_count;
312 void *priv_data;
313 struct snd_pcm_substream *substream;
314};
315
316struct tw68_fmt {
317 char *name;
318 u32 fourcc; /* v4l2 format id */
319 int depth;
320 int flags;
321 u32 twformat;
322};
323
147struct tw68_fmt {
148 char *name;
149 u32 fourcc; /* v4l2 format id */
150 int depth;
151 int flags;
152 u32 twformat;
153};
154
324/* ts/mpeg status */
325struct tw68_ts {
326 /* TS capture */
327 int nr_packets;
328 int nr_bufs;
329};
330
331/* ts/mpeg ops */
332struct tw68_mpeg_ops {
333 enum tw68_mpeg_type type;
334 struct list_head next;
335 int (*init)(struct tw68_dev *dev);
336 int (*fini)(struct tw68_dev *dev);
337 void (*signal_change)(struct tw68_dev *dev);
338};
339
340enum tw68_ts_status {
341 TW68_TS_STOPPED,
342 TW68_TS_BUFF_DONE,
343 TW68_TS_STARTED,
344};
345
346/* global device status */
347struct tw68_dev {
155/* global device status */
156struct tw68_dev {
348 struct list_head devlist;
349 struct mutex lock;
350 spinlock_t slock;
157 struct mutex lock;
158 spinlock_t slock;
351 struct v4l2_prio_state prio;
159 u16 instance;
352 struct v4l2_device v4l2_dev;
160 struct v4l2_device v4l2_dev;
353 /* workstruct for loading modules */
354 struct work_struct request_module_wk;
355
161
356 /* insmod option/autodetected */
357 int autodetected;
358
359 /* various device info */
162 /* various device info */
360 TW68_DECODER_TYPE vdecoder;
361 unsigned int resources;
362 struct video_device *video_dev;
363 struct video_device *radio_dev;
364 struct video_device *vbi_dev;
365 struct tw68_dmasound dmasound;
163 enum tw68_decoder_type vdecoder;
164 struct video_device vdev;
165 struct v4l2_ctrl_handler hdl;
366
166
367#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
368 /* infrared remote */
369 int has_remote;
370 struct card_ir *remote;
371#endif
372
373 /* pci i/o */
167 /* pci i/o */
374 char name[32];
375 int nr;
168 char *name;
376 struct pci_dev *pci;
377 unsigned char pci_rev, pci_lat;
378 u32 __iomem *lmmio;
379 u8 __iomem *bmmio;
380 u32 pci_irqmask;
381 /* The irq mask to be used will depend upon the chip type */
382 u32 board_virqmask;
383
169 struct pci_dev *pci;
170 unsigned char pci_rev, pci_lat;
171 u32 __iomem *lmmio;
172 u8 __iomem *bmmio;
173 u32 pci_irqmask;
174 /* The irq mask to be used will depend upon the chip type */
175 u32 board_virqmask;
176
384 /* config info */
385 unsigned int board;
386 unsigned int tuner_type;
387 unsigned int radio_type;
388 unsigned char tuner_addr;
389 unsigned char radio_addr;
177 /* video capture */
178 const struct tw68_format *fmt;
179 unsigned width, height;
180 unsigned seqnr;
181 unsigned field;
182 struct vb2_queue vidq;
183 struct list_head active;
390
184
391 unsigned int tda9887_conf;
392 unsigned int gpio_value;
393
394 /* i2c i/o */
395 struct i2c_algo_bit_data i2c_algo;
396 struct i2c_adapter i2c_adap;
397 struct i2c_client i2c_client;
398 u32 i2c_state;
399 u32 i2c_done;
400 wait_queue_head_t i2c_queue;
401 int i2c_rc;
402 unsigned char eedata[256];
403
404 /* video+ts+vbi capture */
405 struct tw68_dmaqueue video_q;
406 struct tw68_dmaqueue vbi_q;
407 unsigned int video_fieldcount;
408 unsigned int vbi_fieldcount;
409
410 /* various v4l controls */
185 /* various v4l controls */
411 struct tw68_tvnorm *tvnorm; /* video */
412 struct tw68_tvaudio *tvaudio;
413#if 0
414 unsigned int ctl_input;
415 int ctl_bright;
416 int ctl_contrast;
417 int ctl_hue;
418 int ctl_saturation;
419 int ctl_freq;
420 int ctl_mute; /* audio */
421 int ctl_volume;
422 int ctl_invert; /* private */
423 int ctl_mirror;
424 int ctl_y_odd;
425 int ctl_y_even;
426 int ctl_automute;
427#endif
186 const struct tw68_tvnorm *tvnorm; /* video */
428
187
429 /* crop */
430 struct v4l2_rect crop_bounds;
431 struct v4l2_rect crop_defrect;
432 struct v4l2_rect crop_current;
433
434 /* other global state info */
435 unsigned int automute;
436 struct tw68_thread thread;
437 /* input is latest requested by app, hw_input is current hw setting */
438 struct tw68_input *input;
439 struct tw68_input *hw_input;
440 unsigned int hw_mute;
441 int last_carrier;
442 int nosignal;
443 unsigned int insuspend;
444
445 /* TW68_MPEG_* */
446 struct tw68_ts ts;
447 struct tw68_dmaqueue ts_q;
448 enum tw68_ts_status ts_state;
449 unsigned int buff_cnt;
450 struct tw68_mpeg_ops *mops;
451
452 void (*gate_ctrl)(struct tw68_dev *dev, int open);
188 int input;
453};
454
455/* ----------------------------------------------------------- */
456
457#define tw_readl(reg) readl(dev->lmmio + ((reg) >> 2))
458#define tw_readb(reg) readb(dev->bmmio + (reg))
459#define tw_writel(reg, value) writel((value), dev->lmmio + ((reg) >> 2))
460#define tw_writeb(reg, value) writeb((value), dev->bmmio + (reg))

--- 7 unchanged lines hidden (view full) ---

468#define tw_setl(reg, bit) tw_andorl((reg), (bit), (bit))
469#define tw_setb(reg, bit) tw_andorb((reg), (bit), (bit))
470#define tw_clearl(reg, bit) \
471 writel((readl(dev->lmmio + ((reg) >> 2)) & ~(bit)), \
472 dev->lmmio + ((reg) >> 2))
473#define tw_clearb(reg, bit) \
474 writeb((readb(dev->bmmio+(reg)) & ~(bit)), \
475 dev->bmmio + (reg))
189};
190
191/* ----------------------------------------------------------- */
192
193#define tw_readl(reg) readl(dev->lmmio + ((reg) >> 2))
194#define tw_readb(reg) readb(dev->bmmio + (reg))
195#define tw_writel(reg, value) writel((value), dev->lmmio + ((reg) >> 2))
196#define tw_writeb(reg, value) writeb((value), dev->bmmio + (reg))

--- 7 unchanged lines hidden (view full) ---

204#define tw_setl(reg, bit) tw_andorl((reg), (bit), (bit))
205#define tw_setb(reg, bit) tw_andorb((reg), (bit), (bit))
206#define tw_clearl(reg, bit) \
207 writel((readl(dev->lmmio + ((reg) >> 2)) & ~(bit)), \
208 dev->lmmio + ((reg) >> 2))
209#define tw_clearb(reg, bit) \
210 writeb((readb(dev->bmmio+(reg)) & ~(bit)), \
211 dev->bmmio + (reg))
476#define tw_call_all(dev, o, f, args...) do { \
477 if (dev->gate_ctrl) \
478 dev->gate_ctrl(dev, 1); \
479 v4l2_device_call_all(&(dev)->v4l2_dev, 0, o, f , ##args); \
480 if (dev->gate_ctrl) \
481 dev->gate_ctrl(dev, 0); \
482} while (0)
483
484#define tw_wait(us) { udelay(us); }
485
212
213#define tw_wait(us) { udelay(us); }
214
486static inline struct tw68_dev *to_tw68_dev(struct v4l2_device *v4l2_dev)
487{
488 return container_of(v4l2_dev, struct tw68_dev, v4l2_dev);
489}
490
491/* ----------------------------------------------------------- */
215/* ----------------------------------------------------------- */
492/* tw68-core.c */
493
494extern struct list_head tw68_devlist;
495extern struct mutex tw68_devlist_lock;
496extern unsigned int irq_debug;
497
498int tw68_buffer_count(unsigned int size, unsigned int count);
499void tw68_buffer_queue(struct tw68_dev *dev, struct tw68_dmaqueue *q,
500 struct tw68_buf *buf);
501void tw68_buffer_timeout(unsigned long data);
502int tw68_set_dmabits(struct tw68_dev *dev);
503void tw68_dma_free(struct videobuf_queue *q, struct tw68_buf *buf);
504void tw68_wakeup(struct tw68_dmaqueue *q, unsigned int *field_count);
505int tw68_buffer_requeue(struct tw68_dev *dev, struct tw68_dmaqueue *q);
506
507/* ----------------------------------------------------------- */
508/* tw68-cards.c */
509
510extern struct tw68_board tw68_boards[];
511extern const unsigned int tw68_bcount;
512extern struct pci_device_id __devinitdata tw68_pci_tbl[];
513
514int tw68_board_init1(struct tw68_dev *dev);
515int tw68_board_init2(struct tw68_dev *dev);
516int tw68_tuner_callback(void *priv, int component, int command, int arg);
517
518/* ----------------------------------------------------------- */
519/* tw68-i2c.c */
520
521int tw68_i2c_register(struct tw68_dev *dev);
522int tw68_i2c_unregister(struct tw68_dev *dev);
523void tw68_irq_i2c(struct tw68_dev *dev, int status);
524
525/* ----------------------------------------------------------- */
526/* tw68-video.c */
527
216/* tw68-video.c */
217
528extern unsigned int video_debug;
529extern struct video_device tw68_video_template;
530extern struct video_device tw68_radio_template;
531
532int tw68_videoport_init(struct tw68_dev *dev);
533void tw68_set_tvnorm_hw(struct tw68_dev *dev);
534
535int tw68_video_init1(struct tw68_dev *dev);
218void tw68_set_tvnorm_hw(struct tw68_dev *dev);
219
220int tw68_video_init1(struct tw68_dev *dev);
536int tw68_video_init2(struct tw68_dev *dev);
537void tw68_irq_video_signalchange(struct tw68_dev *dev);
221int tw68_video_init2(struct tw68_dev *dev, int video_nr);
538void tw68_irq_video_done(struct tw68_dev *dev, unsigned long status);
222void tw68_irq_video_done(struct tw68_dev *dev, unsigned long status);
223int tw68_video_start_dma(struct tw68_dev *dev, struct tw68_buf *buf);
539
540/* ----------------------------------------------------------- */
224
225/* ----------------------------------------------------------- */
541/* tw68-ts.c */
542
543int tw68_ts_init1(struct tw68_dev *dev);
544int tw68_ts_fini(struct tw68_dev *dev);
545void tw68_irq_ts_done(struct tw68_dev *dev, unsigned long status);
546
547int tw68_ts_register(struct tw68_mpeg_ops *ops);
548void tw68_ts_unregister(struct tw68_mpeg_ops *ops);
549
550int tw68_ts_init_hw(struct tw68_dev *dev);
551
552/* ----------------------------------------------------------- */
553/* tw68-vbi.c */
554
555extern struct videobuf_queue_ops tw68_vbi_qops;
556extern struct video_device tw68_vbi_template;
557
558int tw68_vbi_init1(struct tw68_dev *dev);
559int tw68_vbi_fini(struct tw68_dev *dev);
560void tw68_irq_vbi_done(struct tw68_dev *dev, unsigned long status);
561
562/* ----------------------------------------------------------- */
563/* tw68-tvaudio.c */
564
565int tw68_tvaudio_rx2mode(u32 rx);
566
567void tw68_tvaudio_setmute(struct tw68_dev *dev);
568void tw68_tvaudio_setinput(struct tw68_dev *dev,
569 struct tw68_input *in);
570void tw68_tvaudio_setvolume(struct tw68_dev *dev, int level);
571int tw68_tvaudio_getstereo(struct tw68_dev *dev);
572void tw68_tvaudio_init(struct tw68_dev *dev);
573int tw68_tvaudio_init2(struct tw68_dev *dev);
574int tw68_tvaudio_fini(struct tw68_dev *dev);
575int tw68_tvaudio_do_scan(struct tw68_dev *dev);
576int tw_dsp_writel(struct tw68_dev *dev, int reg, u32 value);
577void tw68_enable_i2s(struct tw68_dev *dev);
578
579/* ----------------------------------------------------------- */
580/* tw68-risc.c */
581
226/* tw68-risc.c */
227
582int tw68_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
228int tw68_risc_buffer(struct pci_dev *pci, struct tw68_buf *buf,
583 struct scatterlist *sglist, unsigned int top_offset,
584 unsigned int bottom_offset, unsigned int bpl,
585 unsigned int padding, unsigned int lines);
229 struct scatterlist *sglist, unsigned int top_offset,
230 unsigned int bottom_offset, unsigned int bpl,
231 unsigned int padding, unsigned int lines);
586int tw68_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc);
587int tw68_risc_overlay(struct tw68_fh *fh, struct btcx_riscmem *risc,
588 int field_type);