iwlwifi: introduce host commands callbacks
[linux/fpc-iii.git] / drivers / media / video / saa7134 / saa7134-core.c
blob58ab163fdbd74e628e60655ea05c5d3bea611599
1 /*
3 * device driver for philips saa7134 based TV cards
4 * driver core
6 * (c) 2001-03 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
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.
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.
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.
23 #include <linux/init.h>
24 #include <linux/list.h>
25 #include <linux/module.h>
26 #include <linux/kernel.h>
27 #include <linux/slab.h>
28 #include <linux/kmod.h>
29 #include <linux/sound.h>
30 #include <linux/interrupt.h>
31 #include <linux/delay.h>
32 #include <linux/mutex.h>
33 #include <linux/dma-mapping.h>
34 #include <linux/pm.h>
36 #include "saa7134-reg.h"
37 #include "saa7134.h"
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");
43 /* ------------------------------------------------------------------ */
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]");
49 static unsigned int core_debug = 0;
50 module_param(core_debug, int, 0644);
51 MODULE_PARM_DESC(core_debug,"enable debug messages [core]");
53 static unsigned int gpio_tracking = 0;
54 module_param(gpio_tracking, int, 0644);
55 MODULE_PARM_DESC(gpio_tracking,"enable debug messages [gpio]");
57 static unsigned int alsa = 0;
58 module_param(alsa, int, 0644);
59 MODULE_PARM_DESC(alsa,"enable ALSA DMA sound [dmasound]");
61 static unsigned int oss = 0;
62 module_param(oss, int, 0644);
63 MODULE_PARM_DESC(oss,"enable OSS DMA sound [dmasound]");
65 static unsigned int latency = UNSET;
66 module_param(latency, int, 0444);
67 MODULE_PARM_DESC(latency,"pci latency timer");
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]");
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 };
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);
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");
93 static DEFINE_MUTEX(devlist_lock);
94 LIST_HEAD(saa7134_devlist);
95 static LIST_HEAD(mops_list);
96 static unsigned int saa7134_devcount;
98 int (*saa7134_dmasound_init)(struct saa7134_dev *dev);
99 int (*saa7134_dmasound_exit)(struct saa7134_dev *dev);
101 #define dprintk(fmt, arg...) if (core_debug) \
102 printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg)
104 void saa7134_track_gpio(struct saa7134_dev *dev, char *msg)
106 unsigned long mode,status;
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);
120 void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value)
122 u32 index, bitval;
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;
145 int saa7134_tuner_callback(void *ptr, int command, int arg)
147 u8 sync_control;
148 struct saa7134_dev *dev = ptr;
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;
171 break;
172 default:
173 return -ENODEV;
175 return 0;
178 /* ------------------------------------------------------------------ */
181 /* ----------------------------------------------------------- */
182 /* delayed request_module */
184 #if defined(CONFIG_MODULES) && defined(MODULE)
187 static void request_module_async(struct work_struct *work){
188 struct saa7134_dev* dev = container_of(work, struct saa7134_dev, request_module_wk);
189 if (card_is_empress(dev))
190 request_module("saa7134-empress");
191 if (card_is_dvb(dev))
192 request_module("saa7134-dvb");
193 if (alsa)
194 request_module("saa7134-alsa");
195 if (oss)
196 request_module("saa7134-oss");
199 static void request_submodules(struct saa7134_dev *dev)
201 INIT_WORK(&dev->request_module_wk, request_module_async);
202 schedule_work(&dev->request_module_wk);
205 #else
206 #define request_submodules(dev)
207 #endif /* CONFIG_MODULES */
209 /* ------------------------------------------------------------------ */
211 /* nr of (saa7134-)pages for the given buffer size */
212 static int saa7134_buffer_pages(int size)
214 size = PAGE_ALIGN(size);
215 size += PAGE_SIZE; /* for non-page-aligned buffers */
216 size /= 4096;
217 return size;
220 /* calc max # of buffers from size (must not exceed the 4MB virtual
221 * address space per DMA channel) */
222 int saa7134_buffer_count(unsigned int size, unsigned int count)
224 unsigned int maxcount;
226 maxcount = 1024 / saa7134_buffer_pages(size);
227 if (count > maxcount)
228 count = maxcount;
229 return count;
232 int saa7134_buffer_startpage(struct saa7134_buf *buf)
234 return saa7134_buffer_pages(buf->vb.bsize) * buf->vb.i;
237 unsigned long saa7134_buffer_base(struct saa7134_buf *buf)
239 unsigned long base;
240 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
242 base = saa7134_buffer_startpage(buf) * 4096;
243 base += dma->sglist[0].offset;
244 return base;
247 /* ------------------------------------------------------------------ */
249 int saa7134_pgtable_alloc(struct pci_dev *pci, struct saa7134_pgtable *pt)
251 __le32 *cpu;
252 dma_addr_t dma_addr;
254 cpu = pci_alloc_consistent(pci, SAA7134_PGTABLE_SIZE, &dma_addr);
255 if (NULL == cpu)
256 return -ENOMEM;
257 pt->size = SAA7134_PGTABLE_SIZE;
258 pt->cpu = cpu;
259 pt->dma = dma_addr;
260 return 0;
263 int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt,
264 struct scatterlist *list, unsigned int length,
265 unsigned int startpage)
267 __le32 *ptr;
268 unsigned int i,p;
270 BUG_ON(NULL == pt || NULL == pt->cpu);
272 ptr = pt->cpu + startpage;
273 for (i = 0; i < length; i++, list++)
274 for (p = 0; p * 4096 < list->length; p++, ptr++)
275 *ptr = cpu_to_le32(sg_dma_address(list) - list->offset);
276 return 0;
279 void saa7134_pgtable_free(struct pci_dev *pci, struct saa7134_pgtable *pt)
281 if (NULL == pt->cpu)
282 return;
283 pci_free_consistent(pci, pt->size, pt->cpu, pt->dma);
284 pt->cpu = NULL;
287 /* ------------------------------------------------------------------ */
289 void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf)
291 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
292 BUG_ON(in_interrupt());
294 videobuf_waiton(&buf->vb,0,0);
295 videobuf_dma_unmap(q, dma);
296 videobuf_dma_free(dma);
297 buf->vb.state = VIDEOBUF_NEEDS_INIT;
300 /* ------------------------------------------------------------------ */
302 int saa7134_buffer_queue(struct saa7134_dev *dev,
303 struct saa7134_dmaqueue *q,
304 struct saa7134_buf *buf)
306 struct saa7134_buf *next = NULL;
308 assert_spin_locked(&dev->slock);
309 dprintk("buffer_queue %p\n",buf);
310 if (NULL == q->curr) {
311 if (!q->need_two) {
312 q->curr = buf;
313 buf->activate(dev,buf,NULL);
314 } else if (list_empty(&q->queue)) {
315 list_add_tail(&buf->vb.queue,&q->queue);
316 buf->vb.state = VIDEOBUF_QUEUED;
317 } else {
318 next = list_entry(q->queue.next,struct saa7134_buf,
319 vb.queue);
320 q->curr = buf;
321 buf->activate(dev,buf,next);
323 } else {
324 list_add_tail(&buf->vb.queue,&q->queue);
325 buf->vb.state = VIDEOBUF_QUEUED;
327 return 0;
330 void saa7134_buffer_finish(struct saa7134_dev *dev,
331 struct saa7134_dmaqueue *q,
332 unsigned int state)
334 assert_spin_locked(&dev->slock);
335 dprintk("buffer_finish %p\n",q->curr);
337 /* finish current buffer */
338 q->curr->vb.state = state;
339 do_gettimeofday(&q->curr->vb.ts);
340 wake_up(&q->curr->vb.done);
341 q->curr = NULL;
344 void saa7134_buffer_next(struct saa7134_dev *dev,
345 struct saa7134_dmaqueue *q)
347 struct saa7134_buf *buf,*next = NULL;
349 assert_spin_locked(&dev->slock);
350 BUG_ON(NULL != q->curr);
352 if (!list_empty(&q->queue)) {
353 /* activate next one from queue */
354 buf = list_entry(q->queue.next,struct saa7134_buf,vb.queue);
355 dprintk("buffer_next %p [prev=%p/next=%p]\n",
356 buf,q->queue.prev,q->queue.next);
357 list_del(&buf->vb.queue);
358 if (!list_empty(&q->queue))
359 next = list_entry(q->queue.next,struct saa7134_buf,
360 vb.queue);
361 q->curr = buf;
362 buf->activate(dev,buf,next);
363 dprintk("buffer_next #2 prev=%p/next=%p\n",
364 q->queue.prev,q->queue.next);
365 } else {
366 /* nothing to do -- just stop DMA */
367 dprintk("buffer_next %p\n",NULL);
368 saa7134_set_dmabits(dev);
369 del_timer(&q->timeout);
373 void saa7134_buffer_timeout(unsigned long data)
375 struct saa7134_dmaqueue *q = (struct saa7134_dmaqueue*)data;
376 struct saa7134_dev *dev = q->dev;
377 unsigned long flags;
379 spin_lock_irqsave(&dev->slock,flags);
381 /* try to reset the hardware (SWRST) */
382 saa_writeb(SAA7134_REGION_ENABLE, 0x00);
383 saa_writeb(SAA7134_REGION_ENABLE, 0x80);
384 saa_writeb(SAA7134_REGION_ENABLE, 0x00);
386 /* flag current buffer as failed,
387 try to start over with the next one. */
388 if (q->curr) {
389 dprintk("timeout on %p\n",q->curr);
390 saa7134_buffer_finish(dev,q,VIDEOBUF_ERROR);
392 saa7134_buffer_next(dev,q);
393 spin_unlock_irqrestore(&dev->slock,flags);
396 /* resends a current buffer in queue after resume */
398 static int saa7134_buffer_requeue(struct saa7134_dev *dev,
399 struct saa7134_dmaqueue *q)
401 struct saa7134_buf *buf, *next;
403 assert_spin_locked(&dev->slock);
405 buf = q->curr;
406 next = buf;
407 dprintk("buffer_requeue\n");
409 if (!buf)
410 return 0;
412 dprintk("buffer_requeue : resending active buffers \n");
414 if (!list_empty(&q->queue))
415 next = list_entry(q->queue.next, struct saa7134_buf,
416 vb.queue);
417 buf->activate(dev, buf, next);
419 return 0;
422 /* ------------------------------------------------------------------ */
424 int saa7134_set_dmabits(struct saa7134_dev *dev)
426 u32 split, task=0, ctrl=0, irq=0;
427 enum v4l2_field cap = V4L2_FIELD_ANY;
428 enum v4l2_field ov = V4L2_FIELD_ANY;
430 assert_spin_locked(&dev->slock);
432 if (dev->insuspend)
433 return 0;
435 /* video capture -- dma 0 + video task A */
436 if (dev->video_q.curr) {
437 task |= 0x01;
438 ctrl |= SAA7134_MAIN_CTRL_TE0;
439 irq |= SAA7134_IRQ1_INTE_RA0_1 |
440 SAA7134_IRQ1_INTE_RA0_0;
441 cap = dev->video_q.curr->vb.field;
444 /* video capture -- dma 1+2 (planar modes) */
445 if (dev->video_q.curr &&
446 dev->video_q.curr->fmt->planar) {
447 ctrl |= SAA7134_MAIN_CTRL_TE4 |
448 SAA7134_MAIN_CTRL_TE5;
451 /* screen overlay -- dma 0 + video task B */
452 if (dev->ovenable) {
453 task |= 0x10;
454 ctrl |= SAA7134_MAIN_CTRL_TE1;
455 ov = dev->ovfield;
458 /* vbi capture -- dma 0 + vbi task A+B */
459 if (dev->vbi_q.curr) {
460 task |= 0x22;
461 ctrl |= SAA7134_MAIN_CTRL_TE2 |
462 SAA7134_MAIN_CTRL_TE3;
463 irq |= SAA7134_IRQ1_INTE_RA0_7 |
464 SAA7134_IRQ1_INTE_RA0_6 |
465 SAA7134_IRQ1_INTE_RA0_5 |
466 SAA7134_IRQ1_INTE_RA0_4;
469 /* audio capture -- dma 3 */
470 if (dev->dmasound.dma_running) {
471 ctrl |= SAA7134_MAIN_CTRL_TE6;
472 irq |= SAA7134_IRQ1_INTE_RA3_1 |
473 SAA7134_IRQ1_INTE_RA3_0;
476 /* TS capture -- dma 5 */
477 if (dev->ts_q.curr) {
478 ctrl |= SAA7134_MAIN_CTRL_TE5;
479 irq |= SAA7134_IRQ1_INTE_RA2_3 |
480 SAA7134_IRQ1_INTE_RA2_2 |
481 SAA7134_IRQ1_INTE_RA2_1 |
482 SAA7134_IRQ1_INTE_RA2_0;
485 /* set task conditions + field handling */
486 if (V4L2_FIELD_HAS_BOTH(cap) || V4L2_FIELD_HAS_BOTH(ov) || cap == ov) {
487 /* default config -- use full frames */
488 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_A), 0x0d);
489 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_B), 0x0d);
490 saa_writeb(SAA7134_FIELD_HANDLING(TASK_A), 0x02);
491 saa_writeb(SAA7134_FIELD_HANDLING(TASK_B), 0x02);
492 split = 0;
493 } else {
494 /* split fields between tasks */
495 if (V4L2_FIELD_TOP == cap) {
496 /* odd A, even B, repeat */
497 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_A), 0x0d);
498 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_B), 0x0e);
499 } else {
500 /* odd B, even A, repeat */
501 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_A), 0x0e);
502 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_B), 0x0d);
504 saa_writeb(SAA7134_FIELD_HANDLING(TASK_A), 0x01);
505 saa_writeb(SAA7134_FIELD_HANDLING(TASK_B), 0x01);
506 split = 1;
509 /* irqs */
510 saa_writeb(SAA7134_REGION_ENABLE, task);
511 saa_writel(SAA7134_IRQ1, irq);
512 saa_andorl(SAA7134_MAIN_CTRL,
513 SAA7134_MAIN_CTRL_TE0 |
514 SAA7134_MAIN_CTRL_TE1 |
515 SAA7134_MAIN_CTRL_TE2 |
516 SAA7134_MAIN_CTRL_TE3 |
517 SAA7134_MAIN_CTRL_TE4 |
518 SAA7134_MAIN_CTRL_TE5 |
519 SAA7134_MAIN_CTRL_TE6,
520 ctrl);
521 dprintk("dmabits: task=0x%02x ctrl=0x%02x irq=0x%x split=%s\n",
522 task, ctrl, irq, split ? "no" : "yes");
524 return 0;
527 /* ------------------------------------------------------------------ */
528 /* IRQ handler + helpers */
530 static char *irqbits[] = {
531 "DONE_RA0", "DONE_RA1", "DONE_RA2", "DONE_RA3",
532 "AR", "PE", "PWR_ON", "RDCAP", "INTL", "FIDT", "MMC",
533 "TRIG_ERR", "CONF_ERR", "LOAD_ERR",
534 "GPIO16?", "GPIO18", "GPIO22", "GPIO23"
536 #define IRQBITS ARRAY_SIZE(irqbits)
538 static void print_irqstatus(struct saa7134_dev *dev, int loop,
539 unsigned long report, unsigned long status)
541 unsigned int i;
543 printk(KERN_DEBUG "%s/irq[%d,%ld]: r=0x%lx s=0x%02lx",
544 dev->name,loop,jiffies,report,status);
545 for (i = 0; i < IRQBITS; i++) {
546 if (!(report & (1 << i)))
547 continue;
548 printk(" %s",irqbits[i]);
550 if (report & SAA7134_IRQ_REPORT_DONE_RA0) {
551 printk(" | RA0=%s,%s,%s,%ld",
552 (status & 0x40) ? "vbi" : "video",
553 (status & 0x20) ? "b" : "a",
554 (status & 0x10) ? "odd" : "even",
555 (status & 0x0f));
557 printk("\n");
560 static irqreturn_t saa7134_irq(int irq, void *dev_id)
562 struct saa7134_dev *dev = (struct saa7134_dev*) dev_id;
563 unsigned long report,status;
564 int loop, handled = 0;
566 if (dev->insuspend)
567 goto out;
569 for (loop = 0; loop < 10; loop++) {
570 report = saa_readl(SAA7134_IRQ_REPORT);
571 status = saa_readl(SAA7134_IRQ_STATUS);
573 /* If dmasound support is active and we get a sound report,
574 * mask out the report and let the saa7134-alsa module deal
575 * with it */
576 if ((report & SAA7134_IRQ_REPORT_DONE_RA3) &&
577 (dev->dmasound.priv_data != NULL) )
579 if (irq_debug > 1)
580 printk(KERN_DEBUG "%s/irq: preserving DMA sound interrupt\n",
581 dev->name);
582 report &= ~SAA7134_IRQ_REPORT_DONE_RA3;
585 if (0 == report) {
586 if (irq_debug > 1)
587 printk(KERN_DEBUG "%s/irq: no (more) work\n",
588 dev->name);
589 goto out;
592 handled = 1;
593 saa_writel(SAA7134_IRQ_REPORT,report);
594 if (irq_debug)
595 print_irqstatus(dev,loop,report,status);
598 if ((report & SAA7134_IRQ_REPORT_RDCAP) ||
599 (report & SAA7134_IRQ_REPORT_INTL))
600 saa7134_irq_video_signalchange(dev);
603 if ((report & SAA7134_IRQ_REPORT_DONE_RA0) &&
604 (status & 0x60) == 0)
605 saa7134_irq_video_done(dev,status);
607 if ((report & SAA7134_IRQ_REPORT_DONE_RA0) &&
608 (status & 0x40) == 0x40)
609 saa7134_irq_vbi_done(dev,status);
611 if ((report & SAA7134_IRQ_REPORT_DONE_RA2) &&
612 card_has_mpeg(dev))
613 saa7134_irq_ts_done(dev,status);
615 if (report & SAA7134_IRQ_REPORT_GPIO16) {
616 switch (dev->has_remote) {
617 case SAA7134_REMOTE_GPIO:
618 if (!dev->remote)
619 break;
620 if (dev->remote->mask_keydown & 0x10000) {
621 saa7134_input_irq(dev);
623 break;
625 case SAA7134_REMOTE_I2C:
626 break; /* FIXME: invoke I2C get_key() */
628 default: /* GPIO16 not used by IR remote */
629 break;
633 if (report & SAA7134_IRQ_REPORT_GPIO18) {
634 switch (dev->has_remote) {
635 case SAA7134_REMOTE_GPIO:
636 if (!dev->remote)
637 break;
638 if ((dev->remote->mask_keydown & 0x40000) ||
639 (dev->remote->mask_keyup & 0x40000)) {
640 saa7134_input_irq(dev);
642 break;
644 case SAA7134_REMOTE_I2C:
645 break; /* FIXME: invoke I2C get_key() */
647 default: /* GPIO18 not used by IR remote */
648 break;
653 if (10 == loop) {
654 print_irqstatus(dev,loop,report,status);
655 if (report & SAA7134_IRQ_REPORT_PE) {
656 /* disable all parity error */
657 printk(KERN_WARNING "%s/irq: looping -- "
658 "clearing PE (parity error!) enable bit\n",dev->name);
659 saa_clearl(SAA7134_IRQ2,SAA7134_IRQ2_INTE_PE);
660 } else if (report & SAA7134_IRQ_REPORT_GPIO16) {
661 /* disable gpio16 IRQ */
662 printk(KERN_WARNING "%s/irq: looping -- "
663 "clearing GPIO16 enable bit\n",dev->name);
664 saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO16);
665 } else if (report & SAA7134_IRQ_REPORT_GPIO18) {
666 /* disable gpio18 IRQs */
667 printk(KERN_WARNING "%s/irq: looping -- "
668 "clearing GPIO18 enable bit\n",dev->name);
669 saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18);
670 } else {
671 /* disable all irqs */
672 printk(KERN_WARNING "%s/irq: looping -- "
673 "clearing all enable bits\n",dev->name);
674 saa_writel(SAA7134_IRQ1,0);
675 saa_writel(SAA7134_IRQ2,0);
679 out:
680 return IRQ_RETVAL(handled);
683 /* ------------------------------------------------------------------ */
685 /* early init (no i2c, no irq) */
687 static int saa7134_hw_enable1(struct saa7134_dev *dev)
689 /* RAM FIFO config */
690 saa_writel(SAA7134_FIFO_SIZE, 0x08070503);
691 saa_writel(SAA7134_THRESHOULD, 0x02020202);
693 /* enable audio + video processing */
694 saa_writel(SAA7134_MAIN_CTRL,
695 SAA7134_MAIN_CTRL_VPLLE |
696 SAA7134_MAIN_CTRL_APLLE |
697 SAA7134_MAIN_CTRL_EXOSC |
698 SAA7134_MAIN_CTRL_EVFE1 |
699 SAA7134_MAIN_CTRL_EVFE2 |
700 SAA7134_MAIN_CTRL_ESFE |
701 SAA7134_MAIN_CTRL_EBDAC);
704 * Initialize OSS _after_ enabling audio clock PLL and audio processing.
705 * OSS initialization writes to registers via the audio DSP; these
706 * writes will fail unless the audio clock has been started. At worst,
707 * audio will not work.
710 /* enable peripheral devices */
711 saa_writeb(SAA7134_SPECIAL_MODE, 0x01);
713 /* set vertical line numbering start (vbi needs this) */
714 saa_writeb(SAA7134_SOURCE_TIMING2, 0x20);
716 return 0;
719 static int saa7134_hwinit1(struct saa7134_dev *dev)
721 dprintk("hwinit1\n");
723 saa_writel(SAA7134_IRQ1, 0);
724 saa_writel(SAA7134_IRQ2, 0);
725 mutex_init(&dev->lock);
726 spin_lock_init(&dev->slock);
728 saa7134_track_gpio(dev,"pre-init");
729 saa7134_video_init1(dev);
730 saa7134_vbi_init1(dev);
731 if (card_has_mpeg(dev))
732 saa7134_ts_init1(dev);
733 saa7134_input_init1(dev);
735 saa7134_hw_enable1(dev);
737 return 0;
740 /* late init (with i2c + irq) */
741 static int saa7134_hw_enable2(struct saa7134_dev *dev)
744 unsigned int irq2_mask;
746 /* enable IRQ's */
747 irq2_mask =
748 SAA7134_IRQ2_INTE_DEC3 |
749 SAA7134_IRQ2_INTE_DEC2 |
750 SAA7134_IRQ2_INTE_DEC1 |
751 SAA7134_IRQ2_INTE_DEC0 |
752 SAA7134_IRQ2_INTE_PE |
753 SAA7134_IRQ2_INTE_AR;
755 if (dev->has_remote == SAA7134_REMOTE_GPIO && dev->remote) {
756 if (dev->remote->mask_keydown & 0x10000)
757 irq2_mask |= SAA7134_IRQ2_INTE_GPIO16;
758 else if (dev->remote->mask_keydown & 0x40000)
759 irq2_mask |= SAA7134_IRQ2_INTE_GPIO18;
760 else if (dev->remote->mask_keyup & 0x40000)
761 irq2_mask |= SAA7134_IRQ2_INTE_GPIO18A;
764 saa_writel(SAA7134_IRQ1, 0);
765 saa_writel(SAA7134_IRQ2, irq2_mask);
767 return 0;
770 static int saa7134_hwinit2(struct saa7134_dev *dev)
773 dprintk("hwinit2\n");
775 saa7134_video_init2(dev);
776 saa7134_tvaudio_init2(dev);
778 saa7134_hw_enable2(dev);
780 return 0;
784 /* shutdown */
785 static int saa7134_hwfini(struct saa7134_dev *dev)
787 dprintk("hwfini\n");
789 if (card_has_mpeg(dev))
790 saa7134_ts_fini(dev);
791 saa7134_input_fini(dev);
792 saa7134_vbi_fini(dev);
793 saa7134_tvaudio_fini(dev);
794 return 0;
797 static void __devinit must_configure_manually(void)
799 unsigned int i,p;
801 printk(KERN_WARNING
802 "saa7134: <rant>\n"
803 "saa7134: Congratulations! Your TV card vendor saved a few\n"
804 "saa7134: cents for a eeprom, thus your pci board has no\n"
805 "saa7134: subsystem ID and I can't identify it automatically\n"
806 "saa7134: </rant>\n"
807 "saa7134: I feel better now. Ok, here are the good news:\n"
808 "saa7134: You can use the card=<nr> insmod option to specify\n"
809 "saa7134: which board do you have. The list:\n");
810 for (i = 0; i < saa7134_bcount; i++) {
811 printk(KERN_WARNING "saa7134: card=%d -> %-40.40s",
812 i,saa7134_boards[i].name);
813 for (p = 0; saa7134_pci_tbl[p].driver_data; p++) {
814 if (saa7134_pci_tbl[p].driver_data != i)
815 continue;
816 printk(" %04x:%04x",
817 saa7134_pci_tbl[p].subvendor,
818 saa7134_pci_tbl[p].subdevice);
820 printk("\n");
824 static struct video_device *vdev_init(struct saa7134_dev *dev,
825 struct video_device *template,
826 char *type)
828 struct video_device *vfd;
830 vfd = video_device_alloc();
831 if (NULL == vfd)
832 return NULL;
833 *vfd = *template;
834 vfd->minor = -1;
835 vfd->dev = &dev->pci->dev;
836 vfd->release = video_device_release;
837 vfd->debug = video_debug;
838 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
839 dev->name, type, saa7134_boards[dev->board].name);
840 return vfd;
843 static void saa7134_unregister_video(struct saa7134_dev *dev)
845 if (dev->video_dev) {
846 if (-1 != dev->video_dev->minor)
847 video_unregister_device(dev->video_dev);
848 else
849 video_device_release(dev->video_dev);
850 dev->video_dev = NULL;
852 if (dev->vbi_dev) {
853 if (-1 != dev->vbi_dev->minor)
854 video_unregister_device(dev->vbi_dev);
855 else
856 video_device_release(dev->vbi_dev);
857 dev->vbi_dev = NULL;
859 if (dev->radio_dev) {
860 if (-1 != dev->radio_dev->minor)
861 video_unregister_device(dev->radio_dev);
862 else
863 video_device_release(dev->radio_dev);
864 dev->radio_dev = NULL;
868 static void mpeg_ops_attach(struct saa7134_mpeg_ops *ops,
869 struct saa7134_dev *dev)
871 int err;
873 if (NULL != dev->mops)
874 return;
875 if (saa7134_boards[dev->board].mpeg != ops->type)
876 return;
877 err = ops->init(dev);
878 if (0 != err)
879 return;
880 dev->mops = ops;
883 static void mpeg_ops_detach(struct saa7134_mpeg_ops *ops,
884 struct saa7134_dev *dev)
886 if (NULL == dev->mops)
887 return;
888 if (dev->mops != ops)
889 return;
890 dev->mops->fini(dev);
891 dev->mops = NULL;
894 static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
895 const struct pci_device_id *pci_id)
897 struct saa7134_dev *dev;
898 struct saa7134_mpeg_ops *mops;
899 int err;
901 dev = kzalloc(sizeof(*dev),GFP_KERNEL);
902 if (NULL == dev)
903 return -ENOMEM;
905 /* pci init */
906 dev->pci = pci_dev;
907 if (pci_enable_device(pci_dev)) {
908 err = -EIO;
909 goto fail1;
912 dev->nr = saa7134_devcount;
913 sprintf(dev->name,"saa%x[%d]",pci_dev->device,dev->nr);
915 /* pci quirks */
916 if (pci_pci_problems) {
917 if (pci_pci_problems & PCIPCI_TRITON)
918 printk(KERN_INFO "%s: quirk: PCIPCI_TRITON\n", dev->name);
919 if (pci_pci_problems & PCIPCI_NATOMA)
920 printk(KERN_INFO "%s: quirk: PCIPCI_NATOMA\n", dev->name);
921 if (pci_pci_problems & PCIPCI_VIAETBF)
922 printk(KERN_INFO "%s: quirk: PCIPCI_VIAETBF\n", dev->name);
923 if (pci_pci_problems & PCIPCI_VSFX)
924 printk(KERN_INFO "%s: quirk: PCIPCI_VSFX\n",dev->name);
925 #ifdef PCIPCI_ALIMAGIK
926 if (pci_pci_problems & PCIPCI_ALIMAGIK) {
927 printk(KERN_INFO "%s: quirk: PCIPCI_ALIMAGIK -- latency fixup\n",
928 dev->name);
929 latency = 0x0A;
931 #endif
932 if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL)) {
933 printk(KERN_INFO "%s: quirk: this driver and your "
934 "chipset may not work together"
935 " in overlay mode.\n",dev->name);
936 if (!saa7134_no_overlay) {
937 printk(KERN_INFO "%s: quirk: overlay "
938 "mode will be disabled.\n",
939 dev->name);
940 saa7134_no_overlay = 1;
941 } else {
942 printk(KERN_INFO "%s: quirk: overlay "
943 "mode will be forced. Use this"
944 " option at your own risk.\n",
945 dev->name);
949 if (UNSET != latency) {
950 printk(KERN_INFO "%s: setting pci latency timer to %d\n",
951 dev->name,latency);
952 pci_write_config_byte(pci_dev, PCI_LATENCY_TIMER, latency);
955 /* print pci info */
956 pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev);
957 pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat);
958 printk(KERN_INFO "%s: found at %s, rev: %d, irq: %d, "
959 "latency: %d, mmio: 0x%llx\n", dev->name,
960 pci_name(pci_dev), dev->pci_rev, pci_dev->irq,
961 dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0));
962 pci_set_master(pci_dev);
963 if (!pci_dma_supported(pci_dev, DMA_32BIT_MASK)) {
964 printk("%s: Oops: no 32bit PCI DMA ???\n",dev->name);
965 err = -EIO;
966 goto fail1;
969 /* board config */
970 dev->board = pci_id->driver_data;
971 if (card[dev->nr] >= 0 &&
972 card[dev->nr] < saa7134_bcount)
973 dev->board = card[dev->nr];
974 if (SAA7134_BOARD_NOAUTO == dev->board) {
975 must_configure_manually();
976 dev->board = SAA7134_BOARD_UNKNOWN;
978 dev->autodetected = card[dev->nr] != dev->board;
979 dev->tuner_type = saa7134_boards[dev->board].tuner_type;
980 dev->tda9887_conf = saa7134_boards[dev->board].tda9887_conf;
981 if (UNSET != tuner[dev->nr])
982 dev->tuner_type = tuner[dev->nr];
983 printk(KERN_INFO "%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n",
984 dev->name,pci_dev->subsystem_vendor,
985 pci_dev->subsystem_device,saa7134_boards[dev->board].name,
986 dev->board, dev->autodetected ?
987 "autodetected" : "insmod option");
989 /* get mmio */
990 if (!request_mem_region(pci_resource_start(pci_dev,0),
991 pci_resource_len(pci_dev,0),
992 dev->name)) {
993 err = -EBUSY;
994 printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx\n",
995 dev->name,(unsigned long long)pci_resource_start(pci_dev,0));
996 goto fail1;
998 dev->lmmio = ioremap(pci_resource_start(pci_dev,0), 0x1000);
999 dev->bmmio = (__u8 __iomem *)dev->lmmio;
1000 if (NULL == dev->lmmio) {
1001 err = -EIO;
1002 printk(KERN_ERR "%s: can't ioremap() MMIO memory\n",
1003 dev->name);
1004 goto fail2;
1007 /* initialize hardware #1 */
1008 saa7134_board_init1(dev);
1009 saa7134_hwinit1(dev);
1011 /* get irq */
1012 err = request_irq(pci_dev->irq, saa7134_irq,
1013 IRQF_SHARED | IRQF_DISABLED, dev->name, dev);
1014 if (err < 0) {
1015 printk(KERN_ERR "%s: can't get IRQ %d\n",
1016 dev->name,pci_dev->irq);
1017 goto fail3;
1020 /* wait a bit, register i2c bus */
1021 msleep(100);
1022 saa7134_i2c_register(dev);
1024 /* initialize hardware #2 */
1025 if (TUNER_ABSENT != dev->tuner_type)
1026 request_module("tuner");
1027 saa7134_board_init2(dev);
1029 saa7134_hwinit2(dev);
1031 /* load i2c helpers */
1032 if (card_is_empress(dev)) {
1033 request_module("saa6752hs");
1036 request_submodules(dev);
1038 v4l2_prio_init(&dev->prio);
1040 /* register v4l devices */
1041 if (saa7134_no_overlay <= 0) {
1042 saa7134_video_template.type |= VID_TYPE_OVERLAY;
1043 } else {
1044 printk("%s: Overlay support disabled.\n",dev->name);
1046 dev->video_dev = vdev_init(dev,&saa7134_video_template,"video");
1047 err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER,
1048 video_nr[dev->nr]);
1049 if (err < 0) {
1050 printk(KERN_INFO "%s: can't register video device\n",
1051 dev->name);
1052 goto fail4;
1054 printk(KERN_INFO "%s: registered device video%d [v4l2]\n",
1055 dev->name,dev->video_dev->minor & 0x1f);
1057 dev->vbi_dev = vdev_init(dev, &saa7134_video_template, "vbi");
1058 dev->vbi_dev->type = VID_TYPE_TUNER | VID_TYPE_TELETEXT;
1060 err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI,
1061 vbi_nr[dev->nr]);
1062 if (err < 0)
1063 goto fail4;
1064 printk(KERN_INFO "%s: registered device vbi%d\n",
1065 dev->name,dev->vbi_dev->minor & 0x1f);
1067 if (card_has_radio(dev)) {
1068 dev->radio_dev = vdev_init(dev,&saa7134_radio_template,"radio");
1069 err = video_register_device(dev->radio_dev,VFL_TYPE_RADIO,
1070 radio_nr[dev->nr]);
1071 if (err < 0)
1072 goto fail4;
1073 printk(KERN_INFO "%s: registered device radio%d\n",
1074 dev->name,dev->radio_dev->minor & 0x1f);
1077 /* everything worked */
1078 pci_set_drvdata(pci_dev,dev);
1079 saa7134_devcount++;
1081 mutex_lock(&devlist_lock);
1082 list_for_each_entry(mops, &mops_list, next)
1083 mpeg_ops_attach(mops, dev);
1084 list_add_tail(&dev->devlist,&saa7134_devlist);
1085 mutex_unlock(&devlist_lock);
1087 /* check for signal */
1088 saa7134_irq_video_signalchange(dev);
1090 if (saa7134_dmasound_init && !dev->dmasound.priv_data) {
1091 saa7134_dmasound_init(dev);
1094 if (TUNER_ABSENT != dev->tuner_type)
1095 saa7134_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL);
1097 return 0;
1099 fail4:
1100 saa7134_unregister_video(dev);
1101 saa7134_i2c_unregister(dev);
1102 free_irq(pci_dev->irq, dev);
1103 fail3:
1104 saa7134_hwfini(dev);
1105 iounmap(dev->lmmio);
1106 fail2:
1107 release_mem_region(pci_resource_start(pci_dev,0),
1108 pci_resource_len(pci_dev,0));
1109 fail1:
1110 kfree(dev);
1111 return err;
1114 static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
1116 struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
1117 struct saa7134_mpeg_ops *mops;
1119 /* Release DMA sound modules if present */
1120 if (saa7134_dmasound_exit && dev->dmasound.priv_data) {
1121 saa7134_dmasound_exit(dev);
1124 /* debugging ... */
1125 if (irq_debug) {
1126 u32 report = saa_readl(SAA7134_IRQ_REPORT);
1127 u32 status = saa_readl(SAA7134_IRQ_STATUS);
1128 print_irqstatus(dev,42,report,status);
1131 /* disable peripheral devices */
1132 saa_writeb(SAA7134_SPECIAL_MODE,0);
1134 /* shutdown hardware */
1135 saa_writel(SAA7134_IRQ1,0);
1136 saa_writel(SAA7134_IRQ2,0);
1137 saa_writel(SAA7134_MAIN_CTRL,0);
1139 /* shutdown subsystems */
1140 saa7134_hwfini(dev);
1142 /* unregister */
1143 mutex_lock(&devlist_lock);
1144 list_del(&dev->devlist);
1145 list_for_each_entry(mops, &mops_list, next)
1146 mpeg_ops_detach(mops, dev);
1147 mutex_unlock(&devlist_lock);
1148 saa7134_devcount--;
1150 saa7134_i2c_unregister(dev);
1151 saa7134_unregister_video(dev);
1154 /* the DMA sound modules should be unloaded before reaching
1155 this, but just in case they are still present... */
1156 if (dev->dmasound.priv_data != NULL) {
1157 free_irq(pci_dev->irq, &dev->dmasound);
1158 dev->dmasound.priv_data = NULL;
1162 /* release resources */
1163 free_irq(pci_dev->irq, dev);
1164 iounmap(dev->lmmio);
1165 release_mem_region(pci_resource_start(pci_dev,0),
1166 pci_resource_len(pci_dev,0));
1168 pci_set_drvdata(pci_dev, NULL);
1170 /* free memory */
1171 kfree(dev);
1174 #ifdef CONFIG_PM
1175 static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state)
1178 struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
1180 /* disable overlay - apps should enable it explicitly on resume*/
1181 dev->ovenable = 0;
1183 /* Disable interrupts, DMA, and rest of the chip*/
1184 saa_writel(SAA7134_IRQ1, 0);
1185 saa_writel(SAA7134_IRQ2, 0);
1186 saa_writel(SAA7134_MAIN_CTRL, 0);
1188 dev->insuspend = 1;
1189 synchronize_irq(pci_dev->irq);
1191 /* ACK interrupts once more, just in case,
1192 since the IRQ handler won't ack them anymore*/
1194 saa_writel(SAA7134_IRQ_REPORT, saa_readl(SAA7134_IRQ_REPORT));
1196 /* Disable timeout timers - if we have active buffers, we will
1197 fill them on resume*/
1199 del_timer(&dev->video_q.timeout);
1200 del_timer(&dev->vbi_q.timeout);
1201 del_timer(&dev->ts_q.timeout);
1203 if (dev->remote)
1204 saa7134_ir_stop(dev);
1206 pci_save_state(pci_dev);
1207 pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state));
1209 return 0;
1212 static int saa7134_resume(struct pci_dev *pci_dev)
1214 struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
1215 unsigned long flags;
1217 pci_set_power_state(pci_dev, PCI_D0);
1218 pci_restore_state(pci_dev);
1220 /* Do things that are done in saa7134_initdev ,
1221 except of initializing memory structures.*/
1223 saa7134_board_init1(dev);
1225 /* saa7134_hwinit1 */
1226 if (saa7134_boards[dev->board].video_out)
1227 saa7134_videoport_init(dev);
1228 if (card_has_mpeg(dev))
1229 saa7134_ts_init_hw(dev);
1230 if (dev->remote)
1231 saa7134_ir_start(dev, dev->remote);
1232 saa7134_hw_enable1(dev);
1234 msleep(100);
1236 saa7134_board_init2(dev);
1238 /*saa7134_hwinit2*/
1239 saa7134_set_tvnorm_hw(dev);
1240 saa7134_tvaudio_setmute(dev);
1241 saa7134_tvaudio_setvolume(dev, dev->ctl_volume);
1242 saa7134_tvaudio_init(dev);
1243 saa7134_tvaudio_do_scan(dev);
1244 saa7134_enable_i2s(dev);
1245 saa7134_hw_enable2(dev);
1247 saa7134_irq_video_signalchange(dev);
1249 /*resume unfinished buffer(s)*/
1250 spin_lock_irqsave(&dev->slock, flags);
1251 saa7134_buffer_requeue(dev, &dev->video_q);
1252 saa7134_buffer_requeue(dev, &dev->vbi_q);
1253 saa7134_buffer_requeue(dev, &dev->ts_q);
1255 /* FIXME: Disable DMA audio sound - temporary till proper support
1256 is implemented*/
1258 dev->dmasound.dma_running = 0;
1260 /* start DMA now*/
1261 dev->insuspend = 0;
1262 smp_wmb();
1263 saa7134_set_dmabits(dev);
1264 spin_unlock_irqrestore(&dev->slock, flags);
1266 return 0;
1268 #endif
1270 /* ----------------------------------------------------------- */
1272 int saa7134_ts_register(struct saa7134_mpeg_ops *ops)
1274 struct saa7134_dev *dev;
1276 mutex_lock(&devlist_lock);
1277 list_for_each_entry(dev, &saa7134_devlist, devlist)
1278 mpeg_ops_attach(ops, dev);
1279 list_add_tail(&ops->next,&mops_list);
1280 mutex_unlock(&devlist_lock);
1281 return 0;
1284 void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops)
1286 struct saa7134_dev *dev;
1288 mutex_lock(&devlist_lock);
1289 list_del(&ops->next);
1290 list_for_each_entry(dev, &saa7134_devlist, devlist)
1291 mpeg_ops_detach(ops, dev);
1292 mutex_unlock(&devlist_lock);
1295 EXPORT_SYMBOL(saa7134_ts_register);
1296 EXPORT_SYMBOL(saa7134_ts_unregister);
1298 /* ----------------------------------------------------------- */
1300 static struct pci_driver saa7134_pci_driver = {
1301 .name = "saa7134",
1302 .id_table = saa7134_pci_tbl,
1303 .probe = saa7134_initdev,
1304 .remove = __devexit_p(saa7134_finidev),
1305 #ifdef CONFIG_PM
1306 .suspend = saa7134_suspend,
1307 .resume = saa7134_resume
1308 #endif
1311 static int saa7134_init(void)
1313 INIT_LIST_HEAD(&saa7134_devlist);
1314 printk(KERN_INFO "saa7130/34: v4l2 driver version %d.%d.%d loaded\n",
1315 (SAA7134_VERSION_CODE >> 16) & 0xff,
1316 (SAA7134_VERSION_CODE >> 8) & 0xff,
1317 SAA7134_VERSION_CODE & 0xff);
1318 #ifdef SNAPSHOT
1319 printk(KERN_INFO "saa7130/34: snapshot date %04d-%02d-%02d\n",
1320 SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100);
1321 #endif
1322 return pci_register_driver(&saa7134_pci_driver);
1325 static void saa7134_fini(void)
1327 pci_unregister_driver(&saa7134_pci_driver);
1330 module_init(saa7134_init);
1331 module_exit(saa7134_fini);
1333 /* ----------------------------------------------------------- */
1335 EXPORT_SYMBOL(saa7134_set_gpio);
1336 EXPORT_SYMBOL(saa7134_i2c_call_clients);
1337 EXPORT_SYMBOL(saa7134_devlist);
1338 EXPORT_SYMBOL(saa7134_boards);
1340 /* ----------------- for the DMA sound modules --------------- */
1342 EXPORT_SYMBOL(saa7134_dmasound_init);
1343 EXPORT_SYMBOL(saa7134_dmasound_exit);
1344 EXPORT_SYMBOL(saa7134_pgtable_free);
1345 EXPORT_SYMBOL(saa7134_pgtable_build);
1346 EXPORT_SYMBOL(saa7134_pgtable_alloc);
1347 EXPORT_SYMBOL(saa7134_set_dmabits);
1349 /* ----------------------------------------------------------- */
1351 * Local variables:
1352 * c-basic-offset: 8
1353 * End: