3 * device driver for philips saa7134 based TV cards
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.
24 #include "saa7134-reg.h"
26 #include <linux/init.h>
27 #include <linux/list.h>
28 #include <linux/module.h>
29 #include <linux/kernel.h>
30 #include <linux/slab.h>
31 #include <linux/kmod.h>
32 #include <linux/sound.h>
33 #include <linux/interrupt.h>
34 #include <linux/delay.h>
35 #include <linux/mutex.h>
36 #include <linux/dma-mapping.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");
42 MODULE_VERSION(SAA7134_VERSION
);
45 /* ------------------------------------------------------------------ */
47 static unsigned int irq_debug
;
48 module_param(irq_debug
, int, 0644);
49 MODULE_PARM_DESC(irq_debug
,"enable debug messages [IRQ handler]");
51 static unsigned int core_debug
;
52 module_param(core_debug
, int, 0644);
53 MODULE_PARM_DESC(core_debug
,"enable debug messages [core]");
55 static unsigned int gpio_tracking
;
56 module_param(gpio_tracking
, int, 0644);
57 MODULE_PARM_DESC(gpio_tracking
,"enable debug messages [gpio]");
59 static unsigned int alsa
= 1;
60 module_param(alsa
, int, 0644);
61 MODULE_PARM_DESC(alsa
,"enable/disable ALSA DMA sound [dmasound]");
63 static unsigned int latency
= UNSET
;
64 module_param(latency
, int, 0444);
65 MODULE_PARM_DESC(latency
,"pci latency timer");
67 int saa7134_no_overlay
=-1;
68 module_param_named(no_overlay
, saa7134_no_overlay
, int, 0444);
69 MODULE_PARM_DESC(no_overlay
,"allow override overlay default (0 disables, 1 enables)"
70 " [some VIA/SIS chipsets are known to have problem with overlay]");
73 module_param(saa7134_userptr
, bool, 0644);
74 MODULE_PARM_DESC(saa7134_userptr
, "enable page-aligned userptr support");
76 static unsigned int video_nr
[] = {[0 ... (SAA7134_MAXBOARDS
- 1)] = UNSET
};
77 static unsigned int vbi_nr
[] = {[0 ... (SAA7134_MAXBOARDS
- 1)] = UNSET
};
78 static unsigned int radio_nr
[] = {[0 ... (SAA7134_MAXBOARDS
- 1)] = UNSET
};
79 static unsigned int tuner
[] = {[0 ... (SAA7134_MAXBOARDS
- 1)] = UNSET
};
80 static unsigned int card
[] = {[0 ... (SAA7134_MAXBOARDS
- 1)] = UNSET
};
83 module_param_array(video_nr
, int, NULL
, 0444);
84 module_param_array(vbi_nr
, int, NULL
, 0444);
85 module_param_array(radio_nr
, int, NULL
, 0444);
86 module_param_array(tuner
, int, NULL
, 0444);
87 module_param_array(card
, int, NULL
, 0444);
89 MODULE_PARM_DESC(video_nr
, "video device number");
90 MODULE_PARM_DESC(vbi_nr
, "vbi device number");
91 MODULE_PARM_DESC(radio_nr
, "radio device number");
92 MODULE_PARM_DESC(tuner
, "tuner type");
93 MODULE_PARM_DESC(card
, "card type");
95 DEFINE_MUTEX(saa7134_devlist_lock
);
96 EXPORT_SYMBOL(saa7134_devlist_lock
);
97 LIST_HEAD(saa7134_devlist
);
98 EXPORT_SYMBOL(saa7134_devlist
);
99 static LIST_HEAD(mops_list
);
100 static unsigned int saa7134_devcount
;
102 int (*saa7134_dmasound_init
)(struct saa7134_dev
*dev
);
103 int (*saa7134_dmasound_exit
)(struct saa7134_dev
*dev
);
105 #define core_dbg(fmt, arg...) do { \
107 printk(KERN_DEBUG pr_fmt("core: " fmt), ## arg); \
110 #define irq_dbg(level, fmt, arg...) do {\
111 if (irq_debug > level) \
112 printk(KERN_DEBUG pr_fmt("irq: " fmt), ## arg); \
115 void saa7134_track_gpio(struct saa7134_dev
*dev
, char *msg
)
117 unsigned long mode
,status
;
121 /* rising SAA7134_GPIO_GPRESCAN reads the status */
122 saa_andorb(SAA7134_GPIO_GPMODE3
,SAA7134_GPIO_GPRESCAN
,0);
123 saa_andorb(SAA7134_GPIO_GPMODE3
,SAA7134_GPIO_GPRESCAN
,SAA7134_GPIO_GPRESCAN
);
124 mode
= saa_readl(SAA7134_GPIO_GPMODE0
>> 2) & 0xfffffff;
125 status
= saa_readl(SAA7134_GPIO_GPSTATUS0
>> 2) & 0xfffffff;
126 core_dbg("%s: gpio: mode=0x%07lx in=0x%07lx out=0x%07lx [%s]\n",
127 dev
->name
, mode
, (~mode
) & status
, mode
& status
, msg
);
130 void saa7134_set_gpio(struct saa7134_dev
*dev
, int bit_no
, int value
)
136 case 0: /* static value */
138 core_dbg("setting GPIO%d to static %d\n", bit_no
, value
);
139 /* turn sync mode off if necessary */
140 if (index
& 0x00c00000)
141 saa_andorb(SAA7134_VIDEO_PORT_CTRL6
, 0x0f, 0x00);
146 saa_andorl(SAA7134_GPIO_GPMODE0
>> 2, index
, index
);
147 saa_andorl(SAA7134_GPIO_GPSTATUS0
>> 2, index
, bitval
);
149 case 3: /* tristate */
150 core_dbg("setting GPIO%d to tristate\n", bit_no
);
151 saa_andorl(SAA7134_GPIO_GPMODE0
>> 2, index
, 0);
156 /* ------------------------------------------------------------------ */
159 /* ----------------------------------------------------------- */
160 /* delayed request_module */
162 #if defined(CONFIG_MODULES) && defined(MODULE)
164 static void request_module_async(struct work_struct
*work
){
165 struct saa7134_dev
* dev
= container_of(work
, struct saa7134_dev
, request_module_wk
);
166 if (card_is_empress(dev
))
167 request_module("saa7134-empress");
168 if (card_is_dvb(dev
))
169 request_module("saa7134-dvb");
170 if (card_is_go7007(dev
))
171 request_module("saa7134-go7007");
173 if (dev
->pci
->device
!= PCI_DEVICE_ID_PHILIPS_SAA7130
)
174 request_module("saa7134-alsa");
178 static void request_submodules(struct saa7134_dev
*dev
)
180 INIT_WORK(&dev
->request_module_wk
, request_module_async
);
181 schedule_work(&dev
->request_module_wk
);
184 static void flush_request_submodules(struct saa7134_dev
*dev
)
186 flush_work(&dev
->request_module_wk
);
190 #define request_submodules(dev)
191 #define flush_request_submodules(dev)
192 #endif /* CONFIG_MODULES */
194 /* ------------------------------------------------------------------ */
196 /* nr of (saa7134-)pages for the given buffer size */
197 static int saa7134_buffer_pages(int size
)
199 size
= PAGE_ALIGN(size
);
200 size
+= PAGE_SIZE
; /* for non-page-aligned buffers */
205 /* calc max # of buffers from size (must not exceed the 4MB virtual
206 * address space per DMA channel) */
207 int saa7134_buffer_count(unsigned int size
, unsigned int count
)
209 unsigned int maxcount
;
211 maxcount
= 1024 / saa7134_buffer_pages(size
);
212 if (count
> maxcount
)
217 int saa7134_buffer_startpage(struct saa7134_buf
*buf
)
219 return saa7134_buffer_pages(vb2_plane_size(&buf
->vb2
.vb2_buf
, 0))
220 * buf
->vb2
.vb2_buf
.index
;
223 unsigned long saa7134_buffer_base(struct saa7134_buf
*buf
)
226 struct sg_table
*dma
= vb2_dma_sg_plane_desc(&buf
->vb2
.vb2_buf
, 0);
228 base
= saa7134_buffer_startpage(buf
) * 4096;
229 base
+= dma
->sgl
[0].offset
;
233 /* ------------------------------------------------------------------ */
235 int saa7134_pgtable_alloc(struct pci_dev
*pci
, struct saa7134_pgtable
*pt
)
238 dma_addr_t dma_addr
= 0;
240 cpu
= pci_alloc_consistent(pci
, SAA7134_PGTABLE_SIZE
, &dma_addr
);
243 pt
->size
= SAA7134_PGTABLE_SIZE
;
249 int saa7134_pgtable_build(struct pci_dev
*pci
, struct saa7134_pgtable
*pt
,
250 struct scatterlist
*list
, unsigned int length
,
251 unsigned int startpage
)
256 BUG_ON(NULL
== pt
|| NULL
== pt
->cpu
);
258 ptr
= pt
->cpu
+ startpage
;
259 for (i
= 0; i
< length
; i
++, list
= sg_next(list
)) {
260 for (p
= 0; p
* 4096 < list
->length
; p
++, ptr
++)
261 *ptr
= cpu_to_le32(sg_dma_address(list
) +
262 list
->offset
+ p
* 4096);
267 void saa7134_pgtable_free(struct pci_dev
*pci
, struct saa7134_pgtable
*pt
)
271 pci_free_consistent(pci
, pt
->size
, pt
->cpu
, pt
->dma
);
275 /* ------------------------------------------------------------------ */
277 int saa7134_buffer_queue(struct saa7134_dev
*dev
,
278 struct saa7134_dmaqueue
*q
,
279 struct saa7134_buf
*buf
)
281 struct saa7134_buf
*next
= NULL
;
284 spin_lock_irqsave(&dev
->slock
, flags
);
285 core_dbg("buffer_queue %p\n", buf
);
286 if (NULL
== q
->curr
) {
289 buf
->activate(dev
, buf
, NULL
);
290 } else if (list_empty(&q
->queue
)) {
291 list_add_tail(&buf
->entry
, &q
->queue
);
293 next
= list_entry(q
->queue
.next
, struct saa7134_buf
,
296 buf
->activate(dev
, buf
, next
);
299 list_add_tail(&buf
->entry
, &q
->queue
);
301 spin_unlock_irqrestore(&dev
->slock
, flags
);
305 void saa7134_buffer_finish(struct saa7134_dev
*dev
,
306 struct saa7134_dmaqueue
*q
,
309 core_dbg("buffer_finish %p\n", q
->curr
);
311 /* finish current buffer */
312 v4l2_get_timestamp(&q
->curr
->vb2
.timestamp
);
313 q
->curr
->vb2
.sequence
= q
->seq_nr
++;
314 vb2_buffer_done(&q
->curr
->vb2
.vb2_buf
, state
);
318 void saa7134_buffer_next(struct saa7134_dev
*dev
,
319 struct saa7134_dmaqueue
*q
)
321 struct saa7134_buf
*buf
,*next
= NULL
;
323 assert_spin_locked(&dev
->slock
);
324 BUG_ON(NULL
!= q
->curr
);
326 if (!list_empty(&q
->queue
)) {
327 /* activate next one from queue */
328 buf
= list_entry(q
->queue
.next
, struct saa7134_buf
, entry
);
329 core_dbg("buffer_next %p [prev=%p/next=%p]\n",
330 buf
, q
->queue
.prev
, q
->queue
.next
);
331 list_del(&buf
->entry
);
332 if (!list_empty(&q
->queue
))
333 next
= list_entry(q
->queue
.next
, struct saa7134_buf
, entry
);
335 buf
->activate(dev
, buf
, next
);
336 core_dbg("buffer_next #2 prev=%p/next=%p\n",
337 q
->queue
.prev
, q
->queue
.next
);
339 /* nothing to do -- just stop DMA */
340 core_dbg("buffer_next %p\n", NULL
);
341 saa7134_set_dmabits(dev
);
342 del_timer(&q
->timeout
);
346 void saa7134_buffer_timeout(unsigned long data
)
348 struct saa7134_dmaqueue
*q
= (struct saa7134_dmaqueue
*)data
;
349 struct saa7134_dev
*dev
= q
->dev
;
352 spin_lock_irqsave(&dev
->slock
, flags
);
354 /* try to reset the hardware (SWRST) */
355 saa_writeb(SAA7134_REGION_ENABLE
, 0x00);
356 saa_writeb(SAA7134_REGION_ENABLE
, 0x80);
357 saa_writeb(SAA7134_REGION_ENABLE
, 0x00);
359 /* flag current buffer as failed,
360 try to start over with the next one. */
362 core_dbg("timeout on %p\n", q
->curr
);
363 saa7134_buffer_finish(dev
, q
, VB2_BUF_STATE_ERROR
);
365 saa7134_buffer_next(dev
, q
);
366 spin_unlock_irqrestore(&dev
->slock
, flags
);
369 void saa7134_stop_streaming(struct saa7134_dev
*dev
, struct saa7134_dmaqueue
*q
)
372 struct list_head
*pos
, *n
;
373 struct saa7134_buf
*tmp
;
375 spin_lock_irqsave(&dev
->slock
, flags
);
376 if (!list_empty(&q
->queue
)) {
377 list_for_each_safe(pos
, n
, &q
->queue
) {
378 tmp
= list_entry(pos
, struct saa7134_buf
, entry
);
379 vb2_buffer_done(&tmp
->vb2
.vb2_buf
,
380 VB2_BUF_STATE_ERROR
);
385 spin_unlock_irqrestore(&dev
->slock
, flags
);
386 saa7134_buffer_timeout((unsigned long)q
); /* also calls del_timer(&q->timeout) */
388 EXPORT_SYMBOL_GPL(saa7134_stop_streaming
);
390 /* ------------------------------------------------------------------ */
392 int saa7134_set_dmabits(struct saa7134_dev
*dev
)
394 u32 split
, task
=0, ctrl
=0, irq
=0;
395 enum v4l2_field cap
= V4L2_FIELD_ANY
;
396 enum v4l2_field ov
= V4L2_FIELD_ANY
;
398 assert_spin_locked(&dev
->slock
);
403 /* video capture -- dma 0 + video task A */
404 if (dev
->video_q
.curr
) {
406 ctrl
|= SAA7134_MAIN_CTRL_TE0
;
407 irq
|= SAA7134_IRQ1_INTE_RA0_1
|
408 SAA7134_IRQ1_INTE_RA0_0
;
412 /* video capture -- dma 1+2 (planar modes) */
413 if (dev
->video_q
.curr
&& dev
->fmt
->planar
) {
414 ctrl
|= SAA7134_MAIN_CTRL_TE4
|
415 SAA7134_MAIN_CTRL_TE5
;
418 /* screen overlay -- dma 0 + video task B */
421 ctrl
|= SAA7134_MAIN_CTRL_TE1
;
425 /* vbi capture -- dma 0 + vbi task A+B */
426 if (dev
->vbi_q
.curr
) {
428 ctrl
|= SAA7134_MAIN_CTRL_TE2
|
429 SAA7134_MAIN_CTRL_TE3
;
430 irq
|= SAA7134_IRQ1_INTE_RA0_7
|
431 SAA7134_IRQ1_INTE_RA0_6
|
432 SAA7134_IRQ1_INTE_RA0_5
|
433 SAA7134_IRQ1_INTE_RA0_4
;
436 /* audio capture -- dma 3 */
437 if (dev
->dmasound
.dma_running
) {
438 ctrl
|= SAA7134_MAIN_CTRL_TE6
;
439 irq
|= SAA7134_IRQ1_INTE_RA3_1
|
440 SAA7134_IRQ1_INTE_RA3_0
;
443 /* TS capture -- dma 5 */
444 if (dev
->ts_q
.curr
) {
445 ctrl
|= SAA7134_MAIN_CTRL_TE5
;
446 irq
|= SAA7134_IRQ1_INTE_RA2_1
|
447 SAA7134_IRQ1_INTE_RA2_0
;
450 /* set task conditions + field handling */
451 if (V4L2_FIELD_HAS_BOTH(cap
) || V4L2_FIELD_HAS_BOTH(ov
) || cap
== ov
) {
452 /* default config -- use full frames */
453 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_A
), 0x0d);
454 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_B
), 0x0d);
455 saa_writeb(SAA7134_FIELD_HANDLING(TASK_A
), 0x02);
456 saa_writeb(SAA7134_FIELD_HANDLING(TASK_B
), 0x02);
459 /* split fields between tasks */
460 if (V4L2_FIELD_TOP
== cap
) {
461 /* odd A, even B, repeat */
462 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_A
), 0x0d);
463 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_B
), 0x0e);
465 /* odd B, even A, repeat */
466 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_A
), 0x0e);
467 saa_writeb(SAA7134_TASK_CONDITIONS(TASK_B
), 0x0d);
469 saa_writeb(SAA7134_FIELD_HANDLING(TASK_A
), 0x01);
470 saa_writeb(SAA7134_FIELD_HANDLING(TASK_B
), 0x01);
475 saa_writeb(SAA7134_REGION_ENABLE
, task
);
476 saa_writel(SAA7134_IRQ1
, irq
);
477 saa_andorl(SAA7134_MAIN_CTRL
,
478 SAA7134_MAIN_CTRL_TE0
|
479 SAA7134_MAIN_CTRL_TE1
|
480 SAA7134_MAIN_CTRL_TE2
|
481 SAA7134_MAIN_CTRL_TE3
|
482 SAA7134_MAIN_CTRL_TE4
|
483 SAA7134_MAIN_CTRL_TE5
|
484 SAA7134_MAIN_CTRL_TE6
,
486 core_dbg("dmabits: task=0x%02x ctrl=0x%02x irq=0x%x split=%s\n",
487 task
, ctrl
, irq
, split
? "no" : "yes");
492 /* ------------------------------------------------------------------ */
493 /* IRQ handler + helpers */
495 static char *irqbits
[] = {
496 "DONE_RA0", "DONE_RA1", "DONE_RA2", "DONE_RA3",
497 "AR", "PE", "PWR_ON", "RDCAP", "INTL", "FIDT", "MMC",
498 "TRIG_ERR", "CONF_ERR", "LOAD_ERR",
499 "GPIO16", "GPIO18", "GPIO22", "GPIO23"
501 #define IRQBITS ARRAY_SIZE(irqbits)
503 static void print_irqstatus(struct saa7134_dev
*dev
, int loop
,
504 unsigned long report
, unsigned long status
)
508 irq_dbg(1, "[%d,%ld]: r=0x%lx s=0x%02lx",
509 loop
, jiffies
, report
, status
);
510 for (i
= 0; i
< IRQBITS
; i
++) {
511 if (!(report
& (1 << i
)))
513 pr_cont(" %s", irqbits
[i
]);
515 if (report
& SAA7134_IRQ_REPORT_DONE_RA0
) {
516 pr_cont(" | RA0=%s,%s,%s,%ld",
517 (status
& 0x40) ? "vbi" : "video",
518 (status
& 0x20) ? "b" : "a",
519 (status
& 0x10) ? "odd" : "even",
525 static irqreturn_t
saa7134_irq(int irq
, void *dev_id
)
527 struct saa7134_dev
*dev
= (struct saa7134_dev
*) dev_id
;
528 unsigned long report
,status
;
529 int loop
, handled
= 0;
534 for (loop
= 0; loop
< 10; loop
++) {
535 report
= saa_readl(SAA7134_IRQ_REPORT
);
536 status
= saa_readl(SAA7134_IRQ_STATUS
);
538 /* If dmasound support is active and we get a sound report,
539 * mask out the report and let the saa7134-alsa module deal
541 if ((report
& SAA7134_IRQ_REPORT_DONE_RA3
) &&
542 (dev
->dmasound
.priv_data
!= NULL
) )
544 irq_dbg(2, "preserving DMA sound interrupt\n");
545 report
&= ~SAA7134_IRQ_REPORT_DONE_RA3
;
549 irq_dbg(2, "no (more) work\n");
554 saa_writel(SAA7134_IRQ_REPORT
,report
);
556 print_irqstatus(dev
,loop
,report
,status
);
559 if ((report
& SAA7134_IRQ_REPORT_RDCAP
) ||
560 (report
& SAA7134_IRQ_REPORT_INTL
))
561 saa7134_irq_video_signalchange(dev
);
564 if ((report
& SAA7134_IRQ_REPORT_DONE_RA0
) &&
565 (status
& 0x60) == 0)
566 saa7134_irq_video_done(dev
,status
);
568 if ((report
& SAA7134_IRQ_REPORT_DONE_RA0
) &&
569 (status
& 0x40) == 0x40)
570 saa7134_irq_vbi_done(dev
,status
);
572 if ((report
& SAA7134_IRQ_REPORT_DONE_RA2
) &&
573 card_has_mpeg(dev
)) {
574 if (dev
->mops
->irq_ts_done
!= NULL
)
575 dev
->mops
->irq_ts_done(dev
, status
);
577 saa7134_irq_ts_done(dev
, status
);
580 if (report
& SAA7134_IRQ_REPORT_GPIO16
) {
581 switch (dev
->has_remote
) {
582 case SAA7134_REMOTE_GPIO
:
585 if (dev
->remote
->mask_keydown
& 0x10000) {
586 saa7134_input_irq(dev
);
590 case SAA7134_REMOTE_I2C
:
591 break; /* FIXME: invoke I2C get_key() */
593 default: /* GPIO16 not used by IR remote */
598 if (report
& SAA7134_IRQ_REPORT_GPIO18
) {
599 switch (dev
->has_remote
) {
600 case SAA7134_REMOTE_GPIO
:
603 if ((dev
->remote
->mask_keydown
& 0x40000) ||
604 (dev
->remote
->mask_keyup
& 0x40000)) {
605 saa7134_input_irq(dev
);
609 case SAA7134_REMOTE_I2C
:
610 break; /* FIXME: invoke I2C get_key() */
612 default: /* GPIO18 not used by IR remote */
619 print_irqstatus(dev
,loop
,report
,status
);
620 if (report
& SAA7134_IRQ_REPORT_PE
) {
621 /* disable all parity error */
622 pr_warn("%s/irq: looping -- "
623 "clearing PE (parity error!) enable bit\n",dev
->name
);
624 saa_clearl(SAA7134_IRQ2
,SAA7134_IRQ2_INTE_PE
);
625 } else if (report
& SAA7134_IRQ_REPORT_GPIO16
) {
626 /* disable gpio16 IRQ */
627 pr_warn("%s/irq: looping -- "
628 "clearing GPIO16 enable bit\n",dev
->name
);
629 saa_clearl(SAA7134_IRQ2
, SAA7134_IRQ2_INTE_GPIO16_P
);
630 saa_clearl(SAA7134_IRQ2
, SAA7134_IRQ2_INTE_GPIO16_N
);
631 } else if (report
& SAA7134_IRQ_REPORT_GPIO18
) {
632 /* disable gpio18 IRQs */
633 pr_warn("%s/irq: looping -- "
634 "clearing GPIO18 enable bit\n",dev
->name
);
635 saa_clearl(SAA7134_IRQ2
, SAA7134_IRQ2_INTE_GPIO18_P
);
636 saa_clearl(SAA7134_IRQ2
, SAA7134_IRQ2_INTE_GPIO18_N
);
638 /* disable all irqs */
639 pr_warn("%s/irq: looping -- "
640 "clearing all enable bits\n",dev
->name
);
641 saa_writel(SAA7134_IRQ1
,0);
642 saa_writel(SAA7134_IRQ2
,0);
647 return IRQ_RETVAL(handled
);
650 /* ------------------------------------------------------------------ */
652 /* early init (no i2c, no irq) */
654 static int saa7134_hw_enable1(struct saa7134_dev
*dev
)
656 /* RAM FIFO config */
657 saa_writel(SAA7134_FIFO_SIZE
, 0x08070503);
658 saa_writel(SAA7134_THRESHOULD
, 0x02020202);
660 /* enable audio + video processing */
661 saa_writel(SAA7134_MAIN_CTRL
,
662 SAA7134_MAIN_CTRL_VPLLE
|
663 SAA7134_MAIN_CTRL_APLLE
|
664 SAA7134_MAIN_CTRL_EXOSC
|
665 SAA7134_MAIN_CTRL_EVFE1
|
666 SAA7134_MAIN_CTRL_EVFE2
|
667 SAA7134_MAIN_CTRL_ESFE
|
668 SAA7134_MAIN_CTRL_EBDAC
);
671 * Initialize OSS _after_ enabling audio clock PLL and audio processing.
672 * OSS initialization writes to registers via the audio DSP; these
673 * writes will fail unless the audio clock has been started. At worst,
674 * audio will not work.
677 /* enable peripheral devices */
678 saa_writeb(SAA7134_SPECIAL_MODE
, 0x01);
680 /* set vertical line numbering start (vbi needs this) */
681 saa_writeb(SAA7134_SOURCE_TIMING2
, 0x20);
686 static int saa7134_hwinit1(struct saa7134_dev
*dev
)
688 core_dbg("hwinit1\n");
690 saa_writel(SAA7134_IRQ1
, 0);
691 saa_writel(SAA7134_IRQ2
, 0);
693 /* Clear any stale IRQ reports */
694 saa_writel(SAA7134_IRQ_REPORT
, saa_readl(SAA7134_IRQ_REPORT
));
696 mutex_init(&dev
->lock
);
697 spin_lock_init(&dev
->slock
);
699 saa7134_track_gpio(dev
,"pre-init");
700 saa7134_video_init1(dev
);
701 saa7134_vbi_init1(dev
);
702 if (card_has_mpeg(dev
))
703 saa7134_ts_init1(dev
);
704 saa7134_input_init1(dev
);
706 saa7134_hw_enable1(dev
);
711 /* late init (with i2c + irq) */
712 static int saa7134_hw_enable2(struct saa7134_dev
*dev
)
715 unsigned int irq2_mask
;
719 SAA7134_IRQ2_INTE_DEC3
|
720 SAA7134_IRQ2_INTE_DEC2
|
721 SAA7134_IRQ2_INTE_DEC1
|
722 SAA7134_IRQ2_INTE_DEC0
|
723 SAA7134_IRQ2_INTE_PE
|
724 SAA7134_IRQ2_INTE_AR
;
726 if (dev
->has_remote
== SAA7134_REMOTE_GPIO
&& dev
->remote
) {
727 if (dev
->remote
->mask_keydown
& 0x10000)
728 irq2_mask
|= SAA7134_IRQ2_INTE_GPIO16_N
;
729 else { /* Allow enabling both IRQ edge triggers */
730 if (dev
->remote
->mask_keydown
& 0x40000)
731 irq2_mask
|= SAA7134_IRQ2_INTE_GPIO18_P
;
732 if (dev
->remote
->mask_keyup
& 0x40000)
733 irq2_mask
|= SAA7134_IRQ2_INTE_GPIO18_N
;
737 if (dev
->has_remote
== SAA7134_REMOTE_I2C
) {
738 request_module("ir-kbd-i2c");
741 saa_writel(SAA7134_IRQ1
, 0);
742 saa_writel(SAA7134_IRQ2
, irq2_mask
);
747 static int saa7134_hwinit2(struct saa7134_dev
*dev
)
750 core_dbg("hwinit2\n");
752 saa7134_video_init2(dev
);
753 saa7134_tvaudio_init2(dev
);
755 saa7134_hw_enable2(dev
);
762 static int saa7134_hwfini(struct saa7134_dev
*dev
)
764 core_dbg("hwfini\n");
766 if (card_has_mpeg(dev
))
767 saa7134_ts_fini(dev
);
768 saa7134_input_fini(dev
);
769 saa7134_vbi_fini(dev
);
770 saa7134_tvaudio_fini(dev
);
771 saa7134_video_fini(dev
);
775 static void must_configure_manually(int has_eeprom
)
780 pr_warn("saa7134: <rant>\n"
781 "saa7134: Congratulations! Your TV card vendor saved a few\n"
782 "saa7134: cents for a eeprom, thus your pci board has no\n"
783 "saa7134: subsystem ID and I can't identify it automatically\n"
785 "saa7134: I feel better now. Ok, here are the good news:\n"
786 "saa7134: You can use the card=<nr> insmod option to specify\n"
787 "saa7134: which board do you have. The list:\n");
789 pr_warn("saa7134: Board is currently unknown. You might try to use the card=<nr>\n"
790 "saa7134: insmod option to specify which board do you have, but this is\n"
791 "saa7134: somewhat risky, as might damage your card. It is better to ask\n"
792 "saa7134: for support at linux-media@vger.kernel.org.\n"
793 "saa7134: The supported cards are:\n");
795 for (i
= 0; i
< saa7134_bcount
; i
++) {
796 pr_warn("saa7134: card=%d -> %-40.40s",
797 i
,saa7134_boards
[i
].name
);
798 for (p
= 0; saa7134_pci_tbl
[p
].driver_data
; p
++) {
799 if (saa7134_pci_tbl
[p
].driver_data
!= i
)
801 pr_cont(" %04x:%04x",
802 saa7134_pci_tbl
[p
].subvendor
,
803 saa7134_pci_tbl
[p
].subdevice
);
809 static struct video_device
*vdev_init(struct saa7134_dev
*dev
,
810 struct video_device
*template,
813 struct video_device
*vfd
;
815 vfd
= video_device_alloc();
819 vfd
->v4l2_dev
= &dev
->v4l2_dev
;
820 vfd
->release
= video_device_release
;
821 snprintf(vfd
->name
, sizeof(vfd
->name
), "%s %s (%s)",
822 dev
->name
, type
, saa7134_boards
[dev
->board
].name
);
823 video_set_drvdata(vfd
, dev
);
827 static void saa7134_unregister_video(struct saa7134_dev
*dev
)
829 if (dev
->video_dev
) {
830 if (video_is_registered(dev
->video_dev
))
831 video_unregister_device(dev
->video_dev
);
833 video_device_release(dev
->video_dev
);
834 dev
->video_dev
= NULL
;
837 if (video_is_registered(dev
->vbi_dev
))
838 video_unregister_device(dev
->vbi_dev
);
840 video_device_release(dev
->vbi_dev
);
843 if (dev
->radio_dev
) {
844 if (video_is_registered(dev
->radio_dev
))
845 video_unregister_device(dev
->radio_dev
);
847 video_device_release(dev
->radio_dev
);
848 dev
->radio_dev
= NULL
;
852 static void mpeg_ops_attach(struct saa7134_mpeg_ops
*ops
,
853 struct saa7134_dev
*dev
)
857 if (NULL
!= dev
->mops
)
859 if (saa7134_boards
[dev
->board
].mpeg
!= ops
->type
)
861 err
= ops
->init(dev
);
867 static void mpeg_ops_detach(struct saa7134_mpeg_ops
*ops
,
868 struct saa7134_dev
*dev
)
870 if (NULL
== dev
->mops
)
872 if (dev
->mops
!= ops
)
874 dev
->mops
->fini(dev
);
878 static int saa7134_initdev(struct pci_dev
*pci_dev
,
879 const struct pci_device_id
*pci_id
)
881 struct saa7134_dev
*dev
;
882 struct saa7134_mpeg_ops
*mops
;
885 if (saa7134_devcount
== SAA7134_MAXBOARDS
)
888 dev
= kzalloc(sizeof(*dev
),GFP_KERNEL
);
892 err
= v4l2_device_register(&pci_dev
->dev
, &dev
->v4l2_dev
);
898 if (pci_enable_device(pci_dev
)) {
903 dev
->nr
= saa7134_devcount
;
904 sprintf(dev
->name
,"saa%x[%d]",pci_dev
->device
,dev
->nr
);
907 if (pci_pci_problems
) {
908 if (pci_pci_problems
& PCIPCI_TRITON
)
909 pr_info("%s: quirk: PCIPCI_TRITON\n", dev
->name
);
910 if (pci_pci_problems
& PCIPCI_NATOMA
)
911 pr_info("%s: quirk: PCIPCI_NATOMA\n", dev
->name
);
912 if (pci_pci_problems
& PCIPCI_VIAETBF
)
913 pr_info("%s: quirk: PCIPCI_VIAETBF\n", dev
->name
);
914 if (pci_pci_problems
& PCIPCI_VSFX
)
915 pr_info("%s: quirk: PCIPCI_VSFX\n", dev
->name
);
916 #ifdef PCIPCI_ALIMAGIK
917 if (pci_pci_problems
& PCIPCI_ALIMAGIK
) {
918 pr_info("%s: quirk: PCIPCI_ALIMAGIK -- latency fixup\n",
923 if (pci_pci_problems
& (PCIPCI_FAIL
|PCIAGP_FAIL
)) {
924 pr_info("%s: quirk: this driver and your "
925 "chipset may not work together"
926 " in overlay mode.\n",dev
->name
);
927 if (!saa7134_no_overlay
) {
928 pr_info("%s: quirk: overlay "
929 "mode will be disabled.\n",
931 saa7134_no_overlay
= 1;
933 pr_info("%s: quirk: overlay "
934 "mode will be forced. Use this"
935 " option at your own risk.\n",
940 if (UNSET
!= latency
) {
941 pr_info("%s: setting pci latency timer to %d\n",
943 pci_write_config_byte(pci_dev
, PCI_LATENCY_TIMER
, latency
);
947 dev
->pci_rev
= pci_dev
->revision
;
948 pci_read_config_byte(pci_dev
, PCI_LATENCY_TIMER
, &dev
->pci_lat
);
949 pr_info("%s: found at %s, rev: %d, irq: %d, "
950 "latency: %d, mmio: 0x%llx\n", dev
->name
,
951 pci_name(pci_dev
), dev
->pci_rev
, pci_dev
->irq
,
952 dev
->pci_lat
,(unsigned long long)pci_resource_start(pci_dev
,0));
953 pci_set_master(pci_dev
);
954 err
= pci_set_dma_mask(pci_dev
, DMA_BIT_MASK(32));
956 pr_warn("%s: Oops: no 32bit PCI DMA ???\n", dev
->name
);
961 dev
->board
= pci_id
->driver_data
;
962 if ((unsigned)card
[dev
->nr
] < saa7134_bcount
)
963 dev
->board
= card
[dev
->nr
];
964 if (SAA7134_BOARD_UNKNOWN
== dev
->board
)
965 must_configure_manually(0);
966 else if (SAA7134_BOARD_NOAUTO
== dev
->board
) {
967 must_configure_manually(1);
968 dev
->board
= SAA7134_BOARD_UNKNOWN
;
970 dev
->autodetected
= card
[dev
->nr
] != dev
->board
;
971 dev
->tuner_type
= saa7134_boards
[dev
->board
].tuner_type
;
972 dev
->tuner_addr
= saa7134_boards
[dev
->board
].tuner_addr
;
973 dev
->radio_type
= saa7134_boards
[dev
->board
].radio_type
;
974 dev
->radio_addr
= saa7134_boards
[dev
->board
].radio_addr
;
975 dev
->tda9887_conf
= saa7134_boards
[dev
->board
].tda9887_conf
;
976 if (UNSET
!= tuner
[dev
->nr
])
977 dev
->tuner_type
= tuner
[dev
->nr
];
978 pr_info("%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n",
979 dev
->name
,pci_dev
->subsystem_vendor
,
980 pci_dev
->subsystem_device
,saa7134_boards
[dev
->board
].name
,
981 dev
->board
, dev
->autodetected
?
982 "autodetected" : "insmod option");
985 if (!request_mem_region(pci_resource_start(pci_dev
,0),
986 pci_resource_len(pci_dev
,0),
989 pr_err("%s: can't get MMIO memory @ 0x%llx\n",
990 dev
->name
,(unsigned long long)pci_resource_start(pci_dev
,0));
993 dev
->lmmio
= ioremap(pci_resource_start(pci_dev
, 0),
994 pci_resource_len(pci_dev
, 0));
995 dev
->bmmio
= (__u8 __iomem
*)dev
->lmmio
;
996 if (NULL
== dev
->lmmio
) {
998 pr_err("%s: can't ioremap() MMIO memory\n",
1003 /* initialize hardware #1 */
1004 saa7134_board_init1(dev
);
1005 saa7134_hwinit1(dev
);
1007 dev
->alloc_ctx
= vb2_dma_sg_init_ctx(&pci_dev
->dev
);
1008 if (IS_ERR(dev
->alloc_ctx
)) {
1009 err
= PTR_ERR(dev
->alloc_ctx
);
1013 err
= request_irq(pci_dev
->irq
, saa7134_irq
,
1014 IRQF_SHARED
, dev
->name
, dev
);
1016 pr_err("%s: can't get IRQ %d\n",
1017 dev
->name
,pci_dev
->irq
);
1021 /* wait a bit, register i2c bus */
1023 saa7134_i2c_register(dev
);
1024 saa7134_board_init2(dev
);
1026 saa7134_hwinit2(dev
);
1028 /* load i2c helpers */
1029 if (card_is_empress(dev
)) {
1031 v4l2_i2c_new_subdev(&dev
->v4l2_dev
, &dev
->i2c_adap
,
1033 saa7134_boards
[dev
->board
].empress_addr
, NULL
);
1035 if (dev
->empress_sd
)
1036 dev
->empress_sd
->grp_id
= GRP_EMPRESS
;
1039 if (saa7134_boards
[dev
->board
].rds_addr
) {
1040 struct v4l2_subdev
*sd
;
1042 sd
= v4l2_i2c_new_subdev(&dev
->v4l2_dev
,
1043 &dev
->i2c_adap
, "saa6588",
1044 0, I2C_ADDRS(saa7134_boards
[dev
->board
].rds_addr
));
1046 pr_info("%s: found RDS decoder\n", dev
->name
);
1051 mutex_lock(&saa7134_devlist_lock
);
1052 list_for_each_entry(mops
, &mops_list
, next
)
1053 mpeg_ops_attach(mops
, dev
);
1054 list_add_tail(&dev
->devlist
, &saa7134_devlist
);
1055 mutex_unlock(&saa7134_devlist_lock
);
1057 /* check for signal */
1058 saa7134_irq_video_signalchange(dev
);
1060 if (TUNER_ABSENT
!= dev
->tuner_type
)
1061 saa_call_all(dev
, core
, s_power
, 0);
1063 /* register v4l devices */
1064 if (saa7134_no_overlay
> 0)
1065 pr_info("%s: Overlay support disabled.\n", dev
->name
);
1067 dev
->video_dev
= vdev_init(dev
,&saa7134_video_template
,"video");
1068 dev
->video_dev
->ctrl_handler
= &dev
->ctrl_handler
;
1069 dev
->video_dev
->lock
= &dev
->lock
;
1070 dev
->video_dev
->queue
= &dev
->video_vbq
;
1071 err
= video_register_device(dev
->video_dev
,VFL_TYPE_GRABBER
,
1074 pr_info("%s: can't register video device\n",
1078 pr_info("%s: registered device %s [v4l2]\n",
1079 dev
->name
, video_device_node_name(dev
->video_dev
));
1081 dev
->vbi_dev
= vdev_init(dev
, &saa7134_video_template
, "vbi");
1082 dev
->vbi_dev
->ctrl_handler
= &dev
->ctrl_handler
;
1083 dev
->vbi_dev
->lock
= &dev
->lock
;
1084 dev
->vbi_dev
->queue
= &dev
->vbi_vbq
;
1086 err
= video_register_device(dev
->vbi_dev
,VFL_TYPE_VBI
,
1090 pr_info("%s: registered device %s\n",
1091 dev
->name
, video_device_node_name(dev
->vbi_dev
));
1093 if (card_has_radio(dev
)) {
1094 dev
->radio_dev
= vdev_init(dev
,&saa7134_radio_template
,"radio");
1095 dev
->radio_dev
->ctrl_handler
= &dev
->radio_ctrl_handler
;
1096 dev
->radio_dev
->lock
= &dev
->lock
;
1097 err
= video_register_device(dev
->radio_dev
,VFL_TYPE_RADIO
,
1101 pr_info("%s: registered device %s\n",
1102 dev
->name
, video_device_node_name(dev
->radio_dev
));
1105 /* everything worked */
1108 if (saa7134_dmasound_init
&& !dev
->dmasound
.priv_data
)
1109 saa7134_dmasound_init(dev
);
1111 request_submodules(dev
);
1115 saa7134_unregister_video(dev
);
1116 saa7134_i2c_unregister(dev
);
1117 free_irq(pci_dev
->irq
, dev
);
1119 vb2_dma_sg_cleanup_ctx(dev
->alloc_ctx
);
1121 saa7134_hwfini(dev
);
1122 iounmap(dev
->lmmio
);
1124 release_mem_region(pci_resource_start(pci_dev
,0),
1125 pci_resource_len(pci_dev
,0));
1127 v4l2_device_unregister(&dev
->v4l2_dev
);
1133 static void saa7134_finidev(struct pci_dev
*pci_dev
)
1135 struct v4l2_device
*v4l2_dev
= pci_get_drvdata(pci_dev
);
1136 struct saa7134_dev
*dev
= container_of(v4l2_dev
, struct saa7134_dev
, v4l2_dev
);
1137 struct saa7134_mpeg_ops
*mops
;
1139 flush_request_submodules(dev
);
1141 /* Release DMA sound modules if present */
1142 if (saa7134_dmasound_exit
&& dev
->dmasound
.priv_data
) {
1143 saa7134_dmasound_exit(dev
);
1148 u32 report
= saa_readl(SAA7134_IRQ_REPORT
);
1149 u32 status
= saa_readl(SAA7134_IRQ_STATUS
);
1150 print_irqstatus(dev
,42,report
,status
);
1153 /* disable peripheral devices */
1154 saa_writeb(SAA7134_SPECIAL_MODE
,0);
1156 /* shutdown hardware */
1157 saa_writel(SAA7134_IRQ1
,0);
1158 saa_writel(SAA7134_IRQ2
,0);
1159 saa_writel(SAA7134_MAIN_CTRL
,0);
1161 /* shutdown subsystems */
1162 saa7134_hwfini(dev
);
1165 mutex_lock(&saa7134_devlist_lock
);
1166 list_del(&dev
->devlist
);
1167 list_for_each_entry(mops
, &mops_list
, next
)
1168 mpeg_ops_detach(mops
, dev
);
1169 mutex_unlock(&saa7134_devlist_lock
);
1172 saa7134_i2c_unregister(dev
);
1173 saa7134_unregister_video(dev
);
1176 /* the DMA sound modules should be unloaded before reaching
1177 this, but just in case they are still present... */
1178 if (dev
->dmasound
.priv_data
!= NULL
) {
1179 free_irq(pci_dev
->irq
, &dev
->dmasound
);
1180 dev
->dmasound
.priv_data
= NULL
;
1184 /* release resources */
1185 free_irq(pci_dev
->irq
, dev
);
1186 vb2_dma_sg_cleanup_ctx(dev
->alloc_ctx
);
1187 iounmap(dev
->lmmio
);
1188 release_mem_region(pci_resource_start(pci_dev
,0),
1189 pci_resource_len(pci_dev
,0));
1192 v4l2_device_unregister(&dev
->v4l2_dev
);
1200 /* resends a current buffer in queue after resume */
1201 static int saa7134_buffer_requeue(struct saa7134_dev
*dev
,
1202 struct saa7134_dmaqueue
*q
)
1204 struct saa7134_buf
*buf
, *next
;
1206 assert_spin_locked(&dev
->slock
);
1210 core_dbg("buffer_requeue\n");
1215 core_dbg("buffer_requeue : resending active buffer\n");
1217 if (!list_empty(&q
->queue
))
1218 next
= list_entry(q
->queue
.next
, struct saa7134_buf
,
1220 buf
->activate(dev
, buf
, next
);
1225 static int saa7134_suspend(struct pci_dev
*pci_dev
, pm_message_t state
)
1227 struct v4l2_device
*v4l2_dev
= pci_get_drvdata(pci_dev
);
1228 struct saa7134_dev
*dev
= container_of(v4l2_dev
, struct saa7134_dev
, v4l2_dev
);
1230 /* disable overlay - apps should enable it explicitly on resume*/
1233 /* Disable interrupts, DMA, and rest of the chip*/
1234 saa_writel(SAA7134_IRQ1
, 0);
1235 saa_writel(SAA7134_IRQ2
, 0);
1236 saa_writel(SAA7134_MAIN_CTRL
, 0);
1239 synchronize_irq(pci_dev
->irq
);
1241 /* ACK interrupts once more, just in case,
1242 since the IRQ handler won't ack them anymore*/
1244 saa_writel(SAA7134_IRQ_REPORT
, saa_readl(SAA7134_IRQ_REPORT
));
1246 /* Disable timeout timers - if we have active buffers, we will
1247 fill them on resume*/
1249 del_timer(&dev
->video_q
.timeout
);
1250 del_timer(&dev
->vbi_q
.timeout
);
1251 del_timer(&dev
->ts_q
.timeout
);
1254 saa7134_ir_stop(dev
);
1256 pci_save_state(pci_dev
);
1257 pci_set_power_state(pci_dev
, pci_choose_state(pci_dev
, state
));
1262 static int saa7134_resume(struct pci_dev
*pci_dev
)
1264 struct v4l2_device
*v4l2_dev
= pci_get_drvdata(pci_dev
);
1265 struct saa7134_dev
*dev
= container_of(v4l2_dev
, struct saa7134_dev
, v4l2_dev
);
1266 unsigned long flags
;
1268 pci_set_power_state(pci_dev
, PCI_D0
);
1269 pci_restore_state(pci_dev
);
1271 /* Do things that are done in saa7134_initdev ,
1272 except of initializing memory structures.*/
1274 saa7134_board_init1(dev
);
1276 /* saa7134_hwinit1 */
1277 if (saa7134_boards
[dev
->board
].video_out
)
1278 saa7134_videoport_init(dev
);
1279 if (card_has_mpeg(dev
))
1280 saa7134_ts_init_hw(dev
);
1282 saa7134_ir_start(dev
);
1283 saa7134_hw_enable1(dev
);
1287 saa7134_board_init2(dev
);
1290 saa7134_set_tvnorm_hw(dev
);
1291 saa7134_tvaudio_setmute(dev
);
1292 saa7134_tvaudio_setvolume(dev
, dev
->ctl_volume
);
1293 saa7134_tvaudio_init(dev
);
1294 saa7134_enable_i2s(dev
);
1295 saa7134_hw_enable2(dev
);
1297 saa7134_irq_video_signalchange(dev
);
1299 /*resume unfinished buffer(s)*/
1300 spin_lock_irqsave(&dev
->slock
, flags
);
1301 saa7134_buffer_requeue(dev
, &dev
->video_q
);
1302 saa7134_buffer_requeue(dev
, &dev
->vbi_q
);
1303 saa7134_buffer_requeue(dev
, &dev
->ts_q
);
1305 /* FIXME: Disable DMA audio sound - temporary till proper support
1308 dev
->dmasound
.dma_running
= 0;
1313 saa7134_set_dmabits(dev
);
1314 spin_unlock_irqrestore(&dev
->slock
, flags
);
1320 /* ----------------------------------------------------------- */
1322 int saa7134_ts_register(struct saa7134_mpeg_ops
*ops
)
1324 struct saa7134_dev
*dev
;
1326 mutex_lock(&saa7134_devlist_lock
);
1327 list_for_each_entry(dev
, &saa7134_devlist
, devlist
)
1328 mpeg_ops_attach(ops
, dev
);
1329 list_add_tail(&ops
->next
,&mops_list
);
1330 mutex_unlock(&saa7134_devlist_lock
);
1334 void saa7134_ts_unregister(struct saa7134_mpeg_ops
*ops
)
1336 struct saa7134_dev
*dev
;
1338 mutex_lock(&saa7134_devlist_lock
);
1339 list_del(&ops
->next
);
1340 list_for_each_entry(dev
, &saa7134_devlist
, devlist
)
1341 mpeg_ops_detach(ops
, dev
);
1342 mutex_unlock(&saa7134_devlist_lock
);
1345 EXPORT_SYMBOL(saa7134_ts_register
);
1346 EXPORT_SYMBOL(saa7134_ts_unregister
);
1348 /* ----------------------------------------------------------- */
1350 static struct pci_driver saa7134_pci_driver
= {
1352 .id_table
= saa7134_pci_tbl
,
1353 .probe
= saa7134_initdev
,
1354 .remove
= saa7134_finidev
,
1356 .suspend
= saa7134_suspend
,
1357 .resume
= saa7134_resume
1361 static int __init
saa7134_init(void)
1363 INIT_LIST_HEAD(&saa7134_devlist
);
1364 pr_info("saa7130/34: v4l2 driver version %s loaded\n",
1366 return pci_register_driver(&saa7134_pci_driver
);
1369 static void __exit
saa7134_fini(void)
1371 pci_unregister_driver(&saa7134_pci_driver
);
1374 module_init(saa7134_init
);
1375 module_exit(saa7134_fini
);
1377 /* ----------------------------------------------------------- */
1379 EXPORT_SYMBOL(saa7134_set_gpio
);
1380 EXPORT_SYMBOL(saa7134_boards
);
1382 /* ----------------- for the DMA sound modules --------------- */
1384 EXPORT_SYMBOL(saa7134_dmasound_init
);
1385 EXPORT_SYMBOL(saa7134_dmasound_exit
);
1386 EXPORT_SYMBOL(saa7134_pgtable_free
);
1387 EXPORT_SYMBOL(saa7134_pgtable_build
);
1388 EXPORT_SYMBOL(saa7134_pgtable_alloc
);
1389 EXPORT_SYMBOL(saa7134_set_dmabits
);