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