V4L/DVB (5314): Added support for tda827x tuners with preamlifiers
[linux-3.10.git] / drivers / media / video / saa7134 / saa7134-core.c
1 /*
2  *
3  * device driver for philips saa7134 based TV cards
4  * driver core
5  *
6  * (c) 2001-03 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
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., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22
23 #include <linux/init.h>
24 #include <linux/list.h>
25 #include <linux/module.h>
26 #include <linux/moduleparam.h>
27 #include <linux/kernel.h>
28 #include <linux/slab.h>
29 #include <linux/kmod.h>
30 #include <linux/sound.h>
31 #include <linux/interrupt.h>
32 #include <linux/delay.h>
33 #include <linux/mutex.h>
34 #include <linux/dma-mapping.h>
35
36 #include "saa7134-reg.h"
37 #include "saa7134.h"
38
39 MODULE_DESCRIPTION("v4l2 driver module for saa7130/34 based TV cards");
40 MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
41 MODULE_LICENSE("GPL");
42
43 /* ------------------------------------------------------------------ */
44
45 static unsigned int irq_debug = 0;
46 module_param(irq_debug, int, 0644);
47 MODULE_PARM_DESC(irq_debug,"enable debug messages [IRQ handler]");
48
49 static unsigned int core_debug = 0;
50 module_param(core_debug, int, 0644);
51 MODULE_PARM_DESC(core_debug,"enable debug messages [core]");
52
53 static unsigned int gpio_tracking = 0;
54 module_param(gpio_tracking, int, 0644);
55 MODULE_PARM_DESC(gpio_tracking,"enable debug messages [gpio]");
56
57 static unsigned int alsa = 0;
58 module_param(alsa, int, 0644);
59 MODULE_PARM_DESC(alsa,"enable ALSA DMA sound [dmasound]");
60
61 static unsigned int oss = 0;
62 module_param(oss, int, 0644);
63 MODULE_PARM_DESC(oss,"enable OSS DMA sound [dmasound]");
64
65 static unsigned int latency = UNSET;
66 module_param(latency, int, 0444);
67 MODULE_PARM_DESC(latency,"pci latency timer");
68
69 int saa7134_no_overlay=-1;
70 module_param_named(no_overlay, saa7134_no_overlay, int, 0444);
71 MODULE_PARM_DESC(no_overlay,"allow override overlay default (0 disables, 1 enables)"
72                 " [some VIA/SIS chipsets are known to have problem with overlay]");
73
74 static unsigned int video_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
75 static unsigned int vbi_nr[]   = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
76 static unsigned int radio_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
77 static unsigned int tuner[]    = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
78 static unsigned int card[]     = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
79
80
81 module_param_array(video_nr, int, NULL, 0444);
82 module_param_array(vbi_nr,   int, NULL, 0444);
83 module_param_array(radio_nr, int, NULL, 0444);
84 module_param_array(tuner,    int, NULL, 0444);
85 module_param_array(card,     int, NULL, 0444);
86
87 MODULE_PARM_DESC(video_nr, "video device number");
88 MODULE_PARM_DESC(vbi_nr,   "vbi device number");
89 MODULE_PARM_DESC(radio_nr, "radio device number");
90 MODULE_PARM_DESC(tuner,    "tuner type");
91 MODULE_PARM_DESC(card,     "card type");
92
93 static DEFINE_MUTEX(devlist_lock);
94 LIST_HEAD(saa7134_devlist);
95 static LIST_HEAD(mops_list);
96 static unsigned int saa7134_devcount;
97
98 int (*saa7134_dmasound_init)(struct saa7134_dev *dev);
99 int (*saa7134_dmasound_exit)(struct saa7134_dev *dev);
100
101 #define dprintk(fmt, arg...)    if (core_debug) \
102         printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg)
103
104 void saa7134_track_gpio(struct saa7134_dev *dev, char *msg)
105 {
106         unsigned long mode,status;
107
108         if (!gpio_tracking)
109                 return;
110         /* rising SAA7134_GPIO_GPRESCAN reads the status */
111         saa_andorb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN,0);
112         saa_andorb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN,SAA7134_GPIO_GPRESCAN);
113         mode   = saa_readl(SAA7134_GPIO_GPMODE0   >> 2) & 0xfffffff;
114         status = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & 0xfffffff;
115         printk(KERN_DEBUG
116                "%s: gpio: mode=0x%07lx in=0x%07lx out=0x%07lx [%s]\n",
117                dev->name, mode, (~mode) & status, mode & status, msg);
118 }
119
120 void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value)
121 {
122         u32 index, bitval;
123         u8 sync_control;
124
125         index = 1 << bit_no;
126         switch (value) {
127         case 0: /* static value */
128         case 1: dprintk("setting GPIO%d to static %d\n", bit_no, value);
129                 /* turn sync mode off if necessary */
130                 if (index & 0x00c00000)
131                         saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x00);
132                 if (value)
133                         bitval = index;
134                 else
135                         bitval = 0;
136                 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, index);
137                 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, index, bitval);
138                 break;
139         case 3: /* tristate */
140                 dprintk("setting GPIO%d to tristate\n", bit_no);
141                 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, 0);
142                 break;
143         case 4: /* sync output on GPIO 22 for tda8275a, 50Hz*/
144         case 5: /* sync output on GPIO 22 for tda8275a, 60Hz*/
145                 if (bit_no == 22) {
146                         dprintk("setting GPIO22 to vsync %d\n", value - 4);
147                         saa_andorb(SAA7134_VIDEO_PORT_CTRL3, 0x80, 0x80);
148                         saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x03);
149                         if (value == 5)
150                                 sync_control = 11;
151                         else
152                                 sync_control = 17;
153                         saa_writeb(SAA7134_VGATE_START, sync_control);
154                         saa_writeb(SAA7134_VGATE_STOP, sync_control + 1);
155                         saa_andorb(SAA7134_MISC_VGATE_MSB, 0x03, 0x00);
156                 }
157                 break;
158         }
159 }
160
161 /* ------------------------------------------------------------------ */
162
163
164 /* ----------------------------------------------------------- */
165 /* delayed request_module                                      */
166
167 #if defined(CONFIG_MODULES) && defined(MODULE)
168 static int need_empress;
169 static int need_dvb;
170 static int need_alsa;
171 static int need_oss;
172
173 static int pending_call(struct notifier_block *self, unsigned long state,
174                         void *module)
175 {
176         if (module != THIS_MODULE || state != MODULE_STATE_LIVE)
177                 return NOTIFY_DONE;
178
179         if (need_empress)
180                 request_module("saa7134-empress");
181         if (need_dvb)
182                 request_module("saa7134-dvb");
183         if (need_alsa)
184                 request_module("saa7134-alsa");
185         if (need_oss)
186                 request_module("saa7134-oss");
187         return NOTIFY_DONE;
188 }
189
190 static int pending_registered;
191 static struct notifier_block pending_notifier = {
192         .notifier_call = pending_call,
193 };
194
195 static void request_module_depend(char *name, int *flag)
196 {
197         int err;
198         switch (THIS_MODULE->state) {
199         case MODULE_STATE_COMING:
200                 if (!pending_registered) {
201                         err = register_module_notifier(&pending_notifier);
202                         pending_registered = 1;
203                 }
204                 *flag = 1;
205                 break;
206         case MODULE_STATE_LIVE:
207                 request_module(name);
208                 break;
209         default:
210                 /* nothing */;
211                 break;
212         }
213 }
214
215 #else
216 #define request_module_depend(name,flag)
217 #endif /* CONFIG_MODULES */
218
219 /* ------------------------------------------------------------------ */
220
221 /* nr of (saa7134-)pages for the given buffer size */
222 static int saa7134_buffer_pages(int size)
223 {
224         size  = PAGE_ALIGN(size);
225         size += PAGE_SIZE; /* for non-page-aligned buffers */
226         size /= 4096;
227         return size;
228 }
229
230 /* calc max # of buffers from size (must not exceed the 4MB virtual
231  * address space per DMA channel) */
232 int saa7134_buffer_count(unsigned int size, unsigned int count)
233 {
234         unsigned int maxcount;
235
236         maxcount = 1024 / saa7134_buffer_pages(size);
237         if (count > maxcount)
238                 count = maxcount;
239         return count;
240 }
241
242 int saa7134_buffer_startpage(struct saa7134_buf *buf)
243 {
244         return saa7134_buffer_pages(buf->vb.bsize) * buf->vb.i;
245 }
246
247 unsigned long saa7134_buffer_base(struct saa7134_buf *buf)
248 {
249         unsigned long base;
250
251         base  = saa7134_buffer_startpage(buf) * 4096;
252         base += buf->vb.dma.sglist[0].offset;
253         return base;
254 }
255
256 /* ------------------------------------------------------------------ */
257
258 int saa7134_pgtable_alloc(struct pci_dev *pci, struct saa7134_pgtable *pt)
259 {
260         __le32       *cpu;
261         dma_addr_t   dma_addr;
262
263         cpu = pci_alloc_consistent(pci, SAA7134_PGTABLE_SIZE, &dma_addr);
264         if (NULL == cpu)
265                 return -ENOMEM;
266         pt->size = SAA7134_PGTABLE_SIZE;
267         pt->cpu  = cpu;
268         pt->dma  = dma_addr;
269         return 0;
270 }
271
272 int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt,
273                           struct scatterlist *list, unsigned int length,
274                           unsigned int startpage)
275 {
276         __le32        *ptr;
277         unsigned int  i,p;
278
279         BUG_ON(NULL == pt || NULL == pt->cpu);
280
281         ptr = pt->cpu + startpage;
282         for (i = 0; i < length; i++, list++)
283                 for (p = 0; p * 4096 < list->length; p++, ptr++)
284                         *ptr = cpu_to_le32(sg_dma_address(list) - list->offset);
285         return 0;
286 }
287
288 void saa7134_pgtable_free(struct pci_dev *pci, struct saa7134_pgtable *pt)
289 {
290         if (NULL == pt->cpu)
291                 return;
292         pci_free_consistent(pci, pt->size, pt->cpu, pt->dma);
293         pt->cpu = NULL;
294 }
295
296 /* ------------------------------------------------------------------ */
297
298 void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf)
299 {
300         BUG_ON(in_interrupt());
301
302         videobuf_waiton(&buf->vb,0,0);
303         videobuf_dma_unmap(q, &buf->vb.dma);
304         videobuf_dma_free(&buf->vb.dma);
305         buf->vb.state = STATE_NEEDS_INIT;
306 }
307
308 /* ------------------------------------------------------------------ */
309
310 int saa7134_buffer_queue(struct saa7134_dev *dev,
311                          struct saa7134_dmaqueue *q,
312                          struct saa7134_buf *buf)
313 {
314         struct saa7134_buf *next = NULL;
315
316         assert_spin_locked(&dev->slock);
317         dprintk("buffer_queue %p\n",buf);
318         if (NULL == q->curr) {
319                 if (!q->need_two) {
320                         q->curr = buf;
321                         buf->activate(dev,buf,NULL);
322                 } else if (list_empty(&q->queue)) {
323                         list_add_tail(&buf->vb.queue,&q->queue);
324                         buf->vb.state = STATE_QUEUED;
325                 } else {
326                         next = list_entry(q->queue.next,struct saa7134_buf,
327                                           vb.queue);
328                         q->curr = buf;
329                         buf->activate(dev,buf,next);
330                 }
331         } else {
332                 list_add_tail(&buf->vb.queue,&q->queue);
333                 buf->vb.state = STATE_QUEUED;
334         }
335         return 0;
336 }
337
338 void saa7134_buffer_finish(struct saa7134_dev *dev,
339                            struct saa7134_dmaqueue *q,
340                            unsigned int state)
341 {
342         assert_spin_locked(&dev->slock);
343         dprintk("buffer_finish %p\n",q->curr);
344
345         /* finish current buffer */
346         q->curr->vb.state = state;
347         do_gettimeofday(&q->curr->vb.ts);
348         wake_up(&q->curr->vb.done);
349         q->curr = NULL;
350 }
351
352 void saa7134_buffer_next(struct saa7134_dev *dev,
353                          struct saa7134_dmaqueue *q)
354 {
355         struct saa7134_buf *buf,*next = NULL;
356
357         assert_spin_locked(&dev->slock);
358         BUG_ON(NULL != q->curr);
359
360         if (!list_empty(&q->queue)) {
361                 /* activate next one from queue */
362                 buf = list_entry(q->queue.next,struct saa7134_buf,vb.queue);
363                 dprintk("buffer_next %p [prev=%p/next=%p]\n",
364                         buf,q->queue.prev,q->queue.next);
365                 list_del(&buf->vb.queue);
366                 if (!list_empty(&q->queue))
367                         next = list_entry(q->queue.next,struct saa7134_buf,
368                                           vb.queue);
369                 q->curr = buf;
370                 buf->activate(dev,buf,next);
371                 dprintk("buffer_next #2 prev=%p/next=%p\n",
372                         q->queue.prev,q->queue.next);
373         } else {
374                 /* nothing to do -- just stop DMA */
375                 dprintk("buffer_next %p\n",NULL);
376                 saa7134_set_dmabits(dev);
377                 del_timer(&q->timeout);
378         }
379 }
380
381 void saa7134_buffer_timeout(unsigned long data)
382 {
383         struct saa7134_dmaqueue *q = (struct saa7134_dmaqueue*)data;
384         struct saa7134_dev *dev = q->dev;
385         unsigned long flags;
386
387         spin_lock_irqsave(&dev->slock,flags);
388
389         /* try to reset the hardware (SWRST) */
390         saa_writeb(SAA7134_REGION_ENABLE, 0x00);
391         saa_writeb(SAA7134_REGION_ENABLE, 0x80);
392         saa_writeb(SAA7134_REGION_ENABLE, 0x00);
393
394         /* flag current buffer as failed,
395            try to start over with the next one. */
396         if (q->curr) {
397                 dprintk("timeout on %p\n",q->curr);
398                 saa7134_buffer_finish(dev,q,STATE_ERROR);
399         }
400         saa7134_buffer_next(dev,q);
401         spin_unlock_irqrestore(&dev->slock,flags);
402 }
403
404 /* ------------------------------------------------------------------ */
405
406 int saa7134_set_dmabits(struct saa7134_dev *dev)
407 {
408         u32 split, task=0, ctrl=0, irq=0;
409         enum v4l2_field cap = V4L2_FIELD_ANY;
410         enum v4l2_field ov  = V4L2_FIELD_ANY;
411
412         assert_spin_locked(&dev->slock);
413
414         /* video capture -- dma 0 + video task A */
415         if (dev->video_q.curr) {
416                 task |= 0x01;
417                 ctrl |= SAA7134_MAIN_CTRL_TE0;
418                 irq  |= SAA7134_IRQ1_INTE_RA0_1 |
419                         SAA7134_IRQ1_INTE_RA0_0;
420                 cap = dev->video_q.curr->vb.field;
421         }
422
423         /* video capture -- dma 1+2 (planar modes) */
424         if (dev->video_q.curr &&
425             dev->video_q.curr->fmt->planar) {
426                 ctrl |= SAA7134_MAIN_CTRL_TE4 |
427                         SAA7134_MAIN_CTRL_TE5;
428         }
429
430         /* screen overlay -- dma 0 + video task B */
431         if (dev->ovenable) {
432                 task |= 0x10;
433                 ctrl |= SAA7134_MAIN_CTRL_TE1;
434                 ov = dev->ovfield;
435         }
436
437         /* vbi capture -- dma 0 + vbi task A+B */
438         if (dev->vbi_q.curr) {
439                 task |= 0x22;
440                 ctrl |= SAA7134_MAIN_CTRL_TE2 |
441                         SAA7134_MAIN_CTRL_TE3;
442                 irq  |= SAA7134_IRQ1_INTE_RA0_7 |
443                         SAA7134_IRQ1_INTE_RA0_6 |
444                         SAA7134_IRQ1_INTE_RA0_5 |
445                         SAA7134_IRQ1_INTE_RA0_4;
446         }
447
448         /* audio capture -- dma 3 */
449         if (dev->dmasound.dma_running) {
450                 ctrl |= SAA7134_MAIN_CTRL_TE6;
451                 irq  |= SAA7134_IRQ1_INTE_RA3_1 |
452                         SAA7134_IRQ1_INTE_RA3_0;
453         }
454
455         /* TS capture -- dma 5 */
456         if (dev->ts_q.curr) {
457                 ctrl |= SAA7134_MAIN_CTRL_TE5;
458                 irq  |= SAA7134_IRQ1_INTE_RA2_3 |
459                         SAA7134_IRQ1_INTE_RA2_2 |
460                         SAA7134_IRQ1_INTE_RA2_1 |
461                         SAA7134_IRQ1_INTE_RA2_0;
462         }
463
464         /* set task conditions + field handling */
465         if (V4L2_FIELD_HAS_BOTH(cap) || V4L2_FIELD_HAS_BOTH(ov) || cap == ov) {
466                 /* default config -- use full frames */
467                 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_A), 0x0d);
468                 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_B), 0x0d);
469                 saa_writeb(SAA7134_FIELD_HANDLING(TASK_A),  0x02);
470                 saa_writeb(SAA7134_FIELD_HANDLING(TASK_B),  0x02);
471                 split = 0;
472         } else {
473                 /* split fields between tasks */
474                 if (V4L2_FIELD_TOP == cap) {
475                         /* odd A, even B, repeat */
476                         saa_writeb(SAA7134_TASK_CONDITIONS(TASK_A), 0x0d);
477                         saa_writeb(SAA7134_TASK_CONDITIONS(TASK_B), 0x0e);
478                 } else {
479                         /* odd B, even A, repeat */
480                         saa_writeb(SAA7134_TASK_CONDITIONS(TASK_A), 0x0e);
481                         saa_writeb(SAA7134_TASK_CONDITIONS(TASK_B), 0x0d);
482                 }
483                 saa_writeb(SAA7134_FIELD_HANDLING(TASK_A),  0x01);
484                 saa_writeb(SAA7134_FIELD_HANDLING(TASK_B),  0x01);
485                 split = 1;
486         }
487
488         /* irqs */
489         saa_writeb(SAA7134_REGION_ENABLE, task);
490         saa_writel(SAA7134_IRQ1,          irq);
491         saa_andorl(SAA7134_MAIN_CTRL,
492                    SAA7134_MAIN_CTRL_TE0 |
493                    SAA7134_MAIN_CTRL_TE1 |
494                    SAA7134_MAIN_CTRL_TE2 |
495                    SAA7134_MAIN_CTRL_TE3 |
496                    SAA7134_MAIN_CTRL_TE4 |
497                    SAA7134_MAIN_CTRL_TE5 |
498                    SAA7134_MAIN_CTRL_TE6,
499                    ctrl);
500         dprintk("dmabits: task=0x%02x ctrl=0x%02x irq=0x%x split=%s\n",
501                 task, ctrl, irq, split ? "no" : "yes");
502
503         return 0;
504 }
505
506 /* ------------------------------------------------------------------ */
507 /* IRQ handler + helpers                                              */
508
509 static char *irqbits[] = {
510         "DONE_RA0", "DONE_RA1", "DONE_RA2", "DONE_RA3",
511         "AR", "PE", "PWR_ON", "RDCAP", "INTL", "FIDT", "MMC",
512         "TRIG_ERR", "CONF_ERR", "LOAD_ERR",
513         "GPIO16?", "GPIO18", "GPIO22", "GPIO23"
514 };
515 #define IRQBITS ARRAY_SIZE(irqbits)
516
517 static void print_irqstatus(struct saa7134_dev *dev, int loop,
518                             unsigned long report, unsigned long status)
519 {
520         unsigned int i;
521
522         printk(KERN_DEBUG "%s/irq[%d,%ld]: r=0x%lx s=0x%02lx",
523                dev->name,loop,jiffies,report,status);
524         for (i = 0; i < IRQBITS; i++) {
525                 if (!(report & (1 << i)))
526                         continue;
527                 printk(" %s",irqbits[i]);
528         }
529         if (report & SAA7134_IRQ_REPORT_DONE_RA0) {
530                 printk(" | RA0=%s,%s,%s,%ld",
531                        (status & 0x40) ? "vbi"  : "video",
532                        (status & 0x20) ? "b"    : "a",
533                        (status & 0x10) ? "odd"  : "even",
534                        (status & 0x0f));
535         }
536         printk("\n");
537 }
538
539 static irqreturn_t saa7134_irq(int irq, void *dev_id)
540 {
541         struct saa7134_dev *dev = (struct saa7134_dev*) dev_id;
542         unsigned long report,status;
543         int loop, handled = 0;
544
545         for (loop = 0; loop < 10; loop++) {
546                 report = saa_readl(SAA7134_IRQ_REPORT);
547                 status = saa_readl(SAA7134_IRQ_STATUS);
548                 if (0 == report) {
549                         if (irq_debug > 1)
550                                 printk(KERN_DEBUG "%s/irq: no (more) work\n",
551                                        dev->name);
552                         goto out;
553                 }
554
555                 /* If dmasound support is active and we get a sound report, exit
556                    and let the saa7134-alsa/oss module deal with it */
557
558                 if ((report & SAA7134_IRQ_REPORT_DONE_RA3) &&
559                         (dev->dmasound.priv_data != NULL) )
560                 {
561                         if (irq_debug > 1)
562                                 printk(KERN_DEBUG "%s/irq: ignoring interrupt for DMA sound\n",
563                                        dev->name);
564                         goto out;
565                 }
566
567                 handled = 1;
568                 saa_writel(SAA7134_IRQ_REPORT,report);
569                 if (irq_debug)
570                         print_irqstatus(dev,loop,report,status);
571
572
573                 if (report & SAA7134_IRQ_REPORT_RDCAP /* _INTL */)
574                         saa7134_irq_video_intl(dev);
575
576                 if ((report & SAA7134_IRQ_REPORT_DONE_RA0) &&
577                     (status & 0x60) == 0)
578                         saa7134_irq_video_done(dev,status);
579
580                 if ((report & SAA7134_IRQ_REPORT_DONE_RA0) &&
581                     (status & 0x40) == 0x40)
582                         saa7134_irq_vbi_done(dev,status);
583
584                 if ((report & SAA7134_IRQ_REPORT_DONE_RA2) &&
585                     card_has_mpeg(dev))
586                         saa7134_irq_ts_done(dev,status);
587
588                 if (report & SAA7134_IRQ_REPORT_GPIO16) {
589                         switch (dev->has_remote) {
590                                 case SAA7134_REMOTE_GPIO:
591                                         if (!dev->remote)
592                                                 break;
593                                         if  (dev->remote->mask_keydown & 0x10000) {
594                                                 saa7134_input_irq(dev);
595                                         }
596                                         break;
597
598                                 case SAA7134_REMOTE_I2C:
599                                         break;                  /* FIXME: invoke I2C get_key() */
600
601                                 default:                        /* GPIO16 not used by IR remote */
602                                         break;
603                         }
604                 }
605
606                 if (report & SAA7134_IRQ_REPORT_GPIO18) {
607                         switch (dev->has_remote) {
608                                 case SAA7134_REMOTE_GPIO:
609                                         if (!dev->remote)
610                                                 break;
611                                         if ((dev->remote->mask_keydown & 0x40000) ||
612                                             (dev->remote->mask_keyup & 0x40000)) {
613                                                 saa7134_input_irq(dev);
614                                         }
615                                         break;
616
617                                 case SAA7134_REMOTE_I2C:
618                                         break;                  /* FIXME: invoke I2C get_key() */
619
620                                 default:                        /* GPIO18 not used by IR remote */
621                                         break;
622                         }
623                 }
624         }
625
626         if (10 == loop) {
627                 print_irqstatus(dev,loop,report,status);
628                 if (report & SAA7134_IRQ_REPORT_PE) {
629                         /* disable all parity error */
630                         printk(KERN_WARNING "%s/irq: looping -- "
631                                "clearing PE (parity error!) enable bit\n",dev->name);
632                         saa_clearl(SAA7134_IRQ2,SAA7134_IRQ2_INTE_PE);
633                 } else if (report & SAA7134_IRQ_REPORT_GPIO16) {
634                         /* disable gpio16 IRQ */
635                         printk(KERN_WARNING "%s/irq: looping -- "
636                                "clearing GPIO16 enable bit\n",dev->name);
637                         saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO16);
638                 } else if (report & SAA7134_IRQ_REPORT_GPIO18) {
639                         /* disable gpio18 IRQs */
640                         printk(KERN_WARNING "%s/irq: looping -- "
641                                "clearing GPIO18 enable bit\n",dev->name);
642                         saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18);
643                 } else {
644                         /* disable all irqs */
645                         printk(KERN_WARNING "%s/irq: looping -- "
646                                "clearing all enable bits\n",dev->name);
647                         saa_writel(SAA7134_IRQ1,0);
648                         saa_writel(SAA7134_IRQ2,0);
649                 }
650         }
651
652  out:
653         return IRQ_RETVAL(handled);
654 }
655
656 /* ------------------------------------------------------------------ */
657
658 /* early init (no i2c, no irq) */
659 static int saa7134_hwinit1(struct saa7134_dev *dev)
660 {
661         dprintk("hwinit1\n");
662
663         saa_writel(SAA7134_IRQ1, 0);
664         saa_writel(SAA7134_IRQ2, 0);
665         mutex_init(&dev->lock);
666         spin_lock_init(&dev->slock);
667
668         saa7134_track_gpio(dev,"pre-init");
669         saa7134_video_init1(dev);
670         saa7134_vbi_init1(dev);
671         if (card_has_mpeg(dev))
672                 saa7134_ts_init1(dev);
673         saa7134_input_init1(dev);
674
675         /* RAM FIFO config */
676         saa_writel(SAA7134_FIFO_SIZE, 0x08070503);
677         saa_writel(SAA7134_THRESHOULD,0x02020202);
678
679         /* enable audio + video processing */
680         saa_writel(SAA7134_MAIN_CTRL,
681                    SAA7134_MAIN_CTRL_VPLLE |
682                    SAA7134_MAIN_CTRL_APLLE |
683                    SAA7134_MAIN_CTRL_EXOSC |
684                    SAA7134_MAIN_CTRL_EVFE1 |
685                    SAA7134_MAIN_CTRL_EVFE2 |
686                    SAA7134_MAIN_CTRL_ESFE  |
687                    SAA7134_MAIN_CTRL_EBDAC);
688
689         /*
690          * Initialize OSS _after_ enabling audio clock PLL and audio processing.
691          * OSS initialization writes to registers via the audio DSP; these
692          * writes will fail unless the audio clock has been started.  At worst,
693          * audio will not work.
694          */
695
696         /* enable peripheral devices */
697         saa_writeb(SAA7134_SPECIAL_MODE, 0x01);
698
699         /* set vertical line numbering start (vbi needs this) */
700         saa_writeb(SAA7134_SOURCE_TIMING2, 0x20);
701
702         return 0;
703 }
704
705 /* late init (with i2c + irq) */
706 static int saa7134_hwinit2(struct saa7134_dev *dev)
707 {
708         unsigned int irq2_mask;
709         dprintk("hwinit2\n");
710
711         saa7134_video_init2(dev);
712         saa7134_tvaudio_init2(dev);
713
714         /* enable IRQ's */
715         irq2_mask =
716                 SAA7134_IRQ2_INTE_DEC3    |
717                 SAA7134_IRQ2_INTE_DEC2    |
718                 SAA7134_IRQ2_INTE_DEC1    |
719                 SAA7134_IRQ2_INTE_DEC0    |
720                 SAA7134_IRQ2_INTE_PE      |
721                 SAA7134_IRQ2_INTE_AR;
722
723         if (dev->has_remote == SAA7134_REMOTE_GPIO && dev->remote) {
724                 if (dev->remote->mask_keydown & 0x10000)
725                         irq2_mask |= SAA7134_IRQ2_INTE_GPIO16;
726                 else if (dev->remote->mask_keydown & 0x40000)
727                         irq2_mask |= SAA7134_IRQ2_INTE_GPIO18;
728                 else if (dev->remote->mask_keyup & 0x40000)
729                         irq2_mask |= SAA7134_IRQ2_INTE_GPIO18A;
730         }
731
732         saa_writel(SAA7134_IRQ1, 0);
733         saa_writel(SAA7134_IRQ2, irq2_mask);
734
735         return 0;
736 }
737
738 /* shutdown */
739 static int saa7134_hwfini(struct saa7134_dev *dev)
740 {
741         dprintk("hwfini\n");
742
743         if (card_has_mpeg(dev))
744                 saa7134_ts_fini(dev);
745         saa7134_input_fini(dev);
746         saa7134_vbi_fini(dev);
747         saa7134_video_fini(dev);
748         saa7134_tvaudio_fini(dev);
749         return 0;
750 }
751
752 static void __devinit must_configure_manually(void)
753 {
754         unsigned int i,p;
755
756         printk(KERN_WARNING
757                "saa7134: <rant>\n"
758                "saa7134:  Congratulations!  Your TV card vendor saved a few\n"
759                "saa7134:  cents for a eeprom, thus your pci board has no\n"
760                "saa7134:  subsystem ID and I can't identify it automatically\n"
761                "saa7134: </rant>\n"
762                "saa7134: I feel better now.  Ok, here are the good news:\n"
763                "saa7134: You can use the card=<nr> insmod option to specify\n"
764                "saa7134: which board do you have.  The list:\n");
765         for (i = 0; i < saa7134_bcount; i++) {
766                 printk(KERN_WARNING "saa7134:   card=%d -> %-40.40s",
767                        i,saa7134_boards[i].name);
768                 for (p = 0; saa7134_pci_tbl[p].driver_data; p++) {
769                         if (saa7134_pci_tbl[p].driver_data != i)
770                                 continue;
771                         printk(" %04x:%04x",
772                                saa7134_pci_tbl[p].subvendor,
773                                saa7134_pci_tbl[p].subdevice);
774                 }
775                 printk("\n");
776         }
777 }
778
779 static struct video_device *vdev_init(struct saa7134_dev *dev,
780                                       struct video_device *template,
781                                       char *type)
782 {
783         struct video_device *vfd;
784
785         vfd = video_device_alloc();
786         if (NULL == vfd)
787                 return NULL;
788         *vfd = *template;
789         vfd->minor   = -1;
790         vfd->dev     = &dev->pci->dev;
791         vfd->release = video_device_release;
792         snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
793                  dev->name, type, saa7134_boards[dev->board].name);
794         return vfd;
795 }
796
797 static void saa7134_unregister_video(struct saa7134_dev *dev)
798 {
799         if (dev->video_dev) {
800                 if (-1 != dev->video_dev->minor)
801                         video_unregister_device(dev->video_dev);
802                 else
803                         video_device_release(dev->video_dev);
804                 dev->video_dev = NULL;
805         }
806         if (dev->vbi_dev) {
807                 if (-1 != dev->vbi_dev->minor)
808                         video_unregister_device(dev->vbi_dev);
809                 else
810                         video_device_release(dev->vbi_dev);
811                 dev->vbi_dev = NULL;
812         }
813         if (dev->radio_dev) {
814                 if (-1 != dev->radio_dev->minor)
815                         video_unregister_device(dev->radio_dev);
816                 else
817                         video_device_release(dev->radio_dev);
818                 dev->radio_dev = NULL;
819         }
820 }
821
822 static void mpeg_ops_attach(struct saa7134_mpeg_ops *ops,
823                             struct saa7134_dev *dev)
824 {
825         int err;
826
827         if (NULL != dev->mops)
828                 return;
829         if (saa7134_boards[dev->board].mpeg != ops->type)
830                 return;
831         err = ops->init(dev);
832         if (0 != err)
833                 return;
834         dev->mops = ops;
835 }
836
837 static void mpeg_ops_detach(struct saa7134_mpeg_ops *ops,
838                             struct saa7134_dev *dev)
839 {
840         if (NULL == dev->mops)
841                 return;
842         if (dev->mops != ops)
843                 return;
844         dev->mops->fini(dev);
845         dev->mops = NULL;
846 }
847
848 static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
849                                      const struct pci_device_id *pci_id)
850 {
851         struct saa7134_dev *dev;
852         struct list_head *item;
853         struct saa7134_mpeg_ops *mops;
854         int err;
855
856         dev = kzalloc(sizeof(*dev),GFP_KERNEL);
857         if (NULL == dev)
858                 return -ENOMEM;
859
860         /* pci init */
861         dev->pci = pci_dev;
862         if (pci_enable_device(pci_dev)) {
863                 err = -EIO;
864                 goto fail1;
865         }
866
867         dev->nr = saa7134_devcount;
868         sprintf(dev->name,"saa%x[%d]",pci_dev->device,dev->nr);
869
870         /* pci quirks */
871         if (pci_pci_problems) {
872                 if (pci_pci_problems & PCIPCI_TRITON)
873                         printk(KERN_INFO "%s: quirk: PCIPCI_TRITON\n", dev->name);
874                 if (pci_pci_problems & PCIPCI_NATOMA)
875                         printk(KERN_INFO "%s: quirk: PCIPCI_NATOMA\n", dev->name);
876                 if (pci_pci_problems & PCIPCI_VIAETBF)
877                         printk(KERN_INFO "%s: quirk: PCIPCI_VIAETBF\n", dev->name);
878                 if (pci_pci_problems & PCIPCI_VSFX)
879                         printk(KERN_INFO "%s: quirk: PCIPCI_VSFX\n",dev->name);
880 #ifdef PCIPCI_ALIMAGIK
881                 if (pci_pci_problems & PCIPCI_ALIMAGIK) {
882                         printk(KERN_INFO "%s: quirk: PCIPCI_ALIMAGIK -- latency fixup\n",
883                                dev->name);
884                         latency = 0x0A;
885                 }
886 #endif
887                 if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL)) {
888                         printk(KERN_INFO "%s: quirk: this driver and your "
889                                         "chipset may not work together"
890                                         " in overlay mode.\n",dev->name);
891                         if (!saa7134_no_overlay) {
892                                 printk(KERN_INFO "%s: quirk: overlay "
893                                                 "mode will be disabled.\n",
894                                                 dev->name);
895                                 saa7134_no_overlay = 1;
896                         } else {
897                                 printk(KERN_INFO "%s: quirk: overlay "
898                                                 "mode will be forced. Use this"
899                                                 " option at your own risk.\n",
900                                                 dev->name);
901                         }
902                 }
903         }
904         if (UNSET != latency) {
905                 printk(KERN_INFO "%s: setting pci latency timer to %d\n",
906                        dev->name,latency);
907                 pci_write_config_byte(pci_dev, PCI_LATENCY_TIMER, latency);
908         }
909
910         /* print pci info */
911         pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev);
912         pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER,  &dev->pci_lat);
913         printk(KERN_INFO "%s: found at %s, rev: %d, irq: %d, "
914                "latency: %d, mmio: 0x%llx\n", dev->name,
915                pci_name(pci_dev), dev->pci_rev, pci_dev->irq,
916                dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0));
917         pci_set_master(pci_dev);
918         if (!pci_dma_supported(pci_dev, DMA_32BIT_MASK)) {
919                 printk("%s: Oops: no 32bit PCI DMA ???\n",dev->name);
920                 err = -EIO;
921                 goto fail1;
922         }
923
924         /* board config */
925         dev->board = pci_id->driver_data;
926         if (card[dev->nr] >= 0 &&
927             card[dev->nr] < saa7134_bcount)
928                 dev->board = card[dev->nr];
929         if (SAA7134_BOARD_NOAUTO == dev->board) {
930                 must_configure_manually();
931                 dev->board = SAA7134_BOARD_UNKNOWN;
932         }
933         dev->autodetected = card[dev->nr] != dev->board;
934         dev->tuner_type   = saa7134_boards[dev->board].tuner_type;
935         dev->tda9887_conf = saa7134_boards[dev->board].tda9887_conf;
936         if (UNSET != tuner[dev->nr])
937                 dev->tuner_type = tuner[dev->nr];
938                 printk(KERN_INFO "%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n",
939                 dev->name,pci_dev->subsystem_vendor,
940                 pci_dev->subsystem_device,saa7134_boards[dev->board].name,
941                 dev->board, dev->autodetected ?
942                 "autodetected" : "insmod option");
943
944         /* get mmio */
945         if (!request_mem_region(pci_resource_start(pci_dev,0),
946                                 pci_resource_len(pci_dev,0),
947                                 dev->name)) {
948                 err = -EBUSY;
949                 printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx\n",
950                        dev->name,(unsigned long long)pci_resource_start(pci_dev,0));
951                 goto fail1;
952         }
953         dev->lmmio = ioremap(pci_resource_start(pci_dev,0), 0x1000);
954         dev->bmmio = (__u8 __iomem *)dev->lmmio;
955         if (NULL == dev->lmmio) {
956                 err = -EIO;
957                 printk(KERN_ERR "%s: can't ioremap() MMIO memory\n",
958                        dev->name);
959                 goto fail2;
960         }
961
962         /* initialize hardware #1 */
963         saa7134_board_init1(dev);
964         saa7134_hwinit1(dev);
965
966         /* get irq */
967         err = request_irq(pci_dev->irq, saa7134_irq,
968                           IRQF_SHARED | IRQF_DISABLED, dev->name, dev);
969         if (err < 0) {
970                 printk(KERN_ERR "%s: can't get IRQ %d\n",
971                        dev->name,pci_dev->irq);
972                 goto fail3;
973         }
974
975         /* wait a bit, register i2c bus */
976         msleep(100);
977         saa7134_i2c_register(dev);
978
979         /* initialize hardware #2 */
980         saa7134_board_init2(dev);
981         saa7134_hwinit2(dev);
982
983         /* load i2c helpers */
984         if (TUNER_ABSENT != dev->tuner_type)
985                 request_module("tuner");
986         if (card_is_empress(dev)) {
987                 request_module("saa6752hs");
988                 request_module_depend("saa7134-empress",&need_empress);
989         }
990
991         if (card_is_dvb(dev))
992                 request_module_depend("saa7134-dvb",&need_dvb);
993
994
995         if (alsa)
996                 request_module_depend("saa7134-alsa",&need_alsa);
997
998         if (oss)
999                 request_module_depend("saa7134-oss",&need_oss);
1000
1001         v4l2_prio_init(&dev->prio);
1002
1003         /* register v4l devices */
1004         if (saa7134_no_overlay <= 0) {
1005                 saa7134_video_template.type |= VID_TYPE_OVERLAY;
1006         } else {
1007                 printk("%s: Overlay support disabled.\n",dev->name);
1008         }
1009         dev->video_dev = vdev_init(dev,&saa7134_video_template,"video");
1010         err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER,
1011                                     video_nr[dev->nr]);
1012         if (err < 0) {
1013                 printk(KERN_INFO "%s: can't register video device\n",
1014                        dev->name);
1015                 goto fail4;
1016         }
1017         printk(KERN_INFO "%s: registered device video%d [v4l2]\n",
1018                dev->name,dev->video_dev->minor & 0x1f);
1019
1020         dev->vbi_dev = vdev_init(dev,&saa7134_vbi_template,"vbi");
1021         err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI,
1022                                     vbi_nr[dev->nr]);
1023         if (err < 0)
1024                 goto fail4;
1025         printk(KERN_INFO "%s: registered device vbi%d\n",
1026                dev->name,dev->vbi_dev->minor & 0x1f);
1027
1028         if (card_has_radio(dev)) {
1029                 dev->radio_dev = vdev_init(dev,&saa7134_radio_template,"radio");
1030                 err = video_register_device(dev->radio_dev,VFL_TYPE_RADIO,
1031                                             radio_nr[dev->nr]);
1032                 if (err < 0)
1033                         goto fail4;
1034                 printk(KERN_INFO "%s: registered device radio%d\n",
1035                        dev->name,dev->radio_dev->minor & 0x1f);
1036         }
1037
1038         /* everything worked */
1039         pci_set_drvdata(pci_dev,dev);
1040         saa7134_devcount++;
1041
1042         mutex_lock(&devlist_lock);
1043         list_for_each(item,&mops_list) {
1044                 mops = list_entry(item, struct saa7134_mpeg_ops, next);
1045                 mpeg_ops_attach(mops, dev);
1046         }
1047         list_add_tail(&dev->devlist,&saa7134_devlist);
1048         mutex_unlock(&devlist_lock);
1049
1050         /* check for signal */
1051         saa7134_irq_video_intl(dev);
1052
1053         if (saa7134_dmasound_init && !dev->dmasound.priv_data) {
1054                 saa7134_dmasound_init(dev);
1055         }
1056
1057         return 0;
1058
1059  fail4:
1060         saa7134_unregister_video(dev);
1061         saa7134_i2c_unregister(dev);
1062         free_irq(pci_dev->irq, dev);
1063  fail3:
1064         saa7134_hwfini(dev);
1065         iounmap(dev->lmmio);
1066  fail2:
1067         release_mem_region(pci_resource_start(pci_dev,0),
1068                            pci_resource_len(pci_dev,0));
1069  fail1:
1070         kfree(dev);
1071         return err;
1072 }
1073
1074 static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
1075 {
1076         struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
1077         struct list_head *item;
1078         struct saa7134_mpeg_ops *mops;
1079
1080         /* Release DMA sound modules if present */
1081         if (saa7134_dmasound_exit && dev->dmasound.priv_data) {
1082                 saa7134_dmasound_exit(dev);
1083         }
1084
1085         /* debugging ... */
1086         if (irq_debug) {
1087                 u32 report = saa_readl(SAA7134_IRQ_REPORT);
1088                 u32 status = saa_readl(SAA7134_IRQ_STATUS);
1089                 print_irqstatus(dev,42,report,status);
1090         }
1091
1092         /* disable peripheral devices */
1093         saa_writeb(SAA7134_SPECIAL_MODE,0);
1094
1095         /* shutdown hardware */
1096         saa_writel(SAA7134_IRQ1,0);
1097         saa_writel(SAA7134_IRQ2,0);
1098         saa_writel(SAA7134_MAIN_CTRL,0);
1099
1100         /* shutdown subsystems */
1101         saa7134_hwfini(dev);
1102
1103         /* unregister */
1104         mutex_lock(&devlist_lock);
1105         list_del(&dev->devlist);
1106         list_for_each(item,&mops_list) {
1107                 mops = list_entry(item, struct saa7134_mpeg_ops, next);
1108                 mpeg_ops_detach(mops, dev);
1109         }
1110         mutex_unlock(&devlist_lock);
1111         saa7134_devcount--;
1112
1113         saa7134_i2c_unregister(dev);
1114         saa7134_unregister_video(dev);
1115
1116
1117         /* the DMA sound modules should be unloaded before reaching
1118            this, but just in case they are still present... */
1119         if (dev->dmasound.priv_data != NULL) {
1120                 free_irq(pci_dev->irq, &dev->dmasound);
1121                 dev->dmasound.priv_data = NULL;
1122         }
1123
1124
1125         /* release resources */
1126         free_irq(pci_dev->irq, dev);
1127         iounmap(dev->lmmio);
1128         release_mem_region(pci_resource_start(pci_dev,0),
1129                            pci_resource_len(pci_dev,0));
1130
1131         pci_set_drvdata(pci_dev, NULL);
1132
1133         /* free memory */
1134         kfree(dev);
1135 }
1136
1137 /* ----------------------------------------------------------- */
1138
1139 int saa7134_ts_register(struct saa7134_mpeg_ops *ops)
1140 {
1141         struct list_head *item;
1142         struct saa7134_dev *dev;
1143
1144         mutex_lock(&devlist_lock);
1145         list_for_each(item,&saa7134_devlist) {
1146                 dev = list_entry(item, struct saa7134_dev, devlist);
1147                 mpeg_ops_attach(ops, dev);
1148         }
1149         list_add_tail(&ops->next,&mops_list);
1150         mutex_unlock(&devlist_lock);
1151         return 0;
1152 }
1153
1154 void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops)
1155 {
1156         struct list_head *item;
1157         struct saa7134_dev *dev;
1158
1159         mutex_lock(&devlist_lock);
1160         list_del(&ops->next);
1161         list_for_each(item,&saa7134_devlist) {
1162                 dev = list_entry(item, struct saa7134_dev, devlist);
1163                 mpeg_ops_detach(ops, dev);
1164         }
1165         mutex_unlock(&devlist_lock);
1166 }
1167
1168 EXPORT_SYMBOL(saa7134_ts_register);
1169 EXPORT_SYMBOL(saa7134_ts_unregister);
1170
1171 /* ----------------------------------------------------------- */
1172
1173 static struct pci_driver saa7134_pci_driver = {
1174         .name     = "saa7134",
1175         .id_table = saa7134_pci_tbl,
1176         .probe    = saa7134_initdev,
1177         .remove   = __devexit_p(saa7134_finidev),
1178 };
1179
1180 static int saa7134_init(void)
1181 {
1182         INIT_LIST_HEAD(&saa7134_devlist);
1183         printk(KERN_INFO "saa7130/34: v4l2 driver version %d.%d.%d loaded\n",
1184                (SAA7134_VERSION_CODE >> 16) & 0xff,
1185                (SAA7134_VERSION_CODE >>  8) & 0xff,
1186                SAA7134_VERSION_CODE & 0xff);
1187 #ifdef SNAPSHOT
1188         printk(KERN_INFO "saa7130/34: snapshot date %04d-%02d-%02d\n",
1189                SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100);
1190 #endif
1191         return pci_register_driver(&saa7134_pci_driver);
1192 }
1193
1194 static void saa7134_fini(void)
1195 {
1196 #if defined(CONFIG_MODULES) && defined(MODULE)
1197         if (pending_registered)
1198                 unregister_module_notifier(&pending_notifier);
1199 #endif /* CONFIG_MODULES */
1200         pci_unregister_driver(&saa7134_pci_driver);
1201 }
1202
1203 module_init(saa7134_init);
1204 module_exit(saa7134_fini);
1205
1206 /* ----------------------------------------------------------- */
1207
1208 EXPORT_SYMBOL(saa7134_set_gpio);
1209 EXPORT_SYMBOL(saa7134_i2c_call_clients);
1210 EXPORT_SYMBOL(saa7134_devlist);
1211 EXPORT_SYMBOL(saa7134_boards);
1212
1213 /* ----------------- for the DMA sound modules --------------- */
1214
1215 EXPORT_SYMBOL(saa7134_dmasound_init);
1216 EXPORT_SYMBOL(saa7134_dmasound_exit);
1217 EXPORT_SYMBOL(saa7134_pgtable_free);
1218 EXPORT_SYMBOL(saa7134_pgtable_build);
1219 EXPORT_SYMBOL(saa7134_pgtable_alloc);
1220 EXPORT_SYMBOL(saa7134_set_dmabits);
1221
1222 /* ----------------------------------------------------------- */
1223 /*
1224  * Local variables:
1225  * c-basic-offset: 8
1226  * End:
1227  */