3 * device driver for Conexant 2388x based TV cards
4 * video4linux video interface
6 * (c) 2003-04 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
8 * (c) 2005-2006 Mauro Carvalho Chehab <mchehab@infradead.org>
10 * - video_ioctl2 conversion
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <linux/init.h>
29 #include <linux/list.h>
30 #include <linux/module.h>
31 #include <linux/kmod.h>
32 #include <linux/kernel.h>
33 #include <linux/slab.h>
34 #include <linux/interrupt.h>
35 #include <linux/dma-mapping.h>
36 #include <linux/delay.h>
37 #include <linux/kthread.h>
38 #include <asm/div64.h>
41 #include <media/v4l2-common.h>
42 #include <media/v4l2-ioctl.h>
44 MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");
45 MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
46 MODULE_LICENSE("GPL");
48 /* ------------------------------------------------------------------ */
50 static unsigned int video_nr
[] = {[0 ... (CX88_MAXBOARDS
- 1)] = UNSET
};
51 static unsigned int vbi_nr
[] = {[0 ... (CX88_MAXBOARDS
- 1)] = UNSET
};
52 static unsigned int radio_nr
[] = {[0 ... (CX88_MAXBOARDS
- 1)] = UNSET
};
54 module_param_array(video_nr
, int, NULL
, 0444);
55 module_param_array(vbi_nr
, int, NULL
, 0444);
56 module_param_array(radio_nr
, int, NULL
, 0444);
58 MODULE_PARM_DESC(video_nr
,"video device numbers");
59 MODULE_PARM_DESC(vbi_nr
,"vbi device numbers");
60 MODULE_PARM_DESC(radio_nr
,"radio device numbers");
62 static unsigned int video_debug
;
63 module_param(video_debug
,int,0644);
64 MODULE_PARM_DESC(video_debug
,"enable debug messages [video]");
66 static unsigned int irq_debug
;
67 module_param(irq_debug
,int,0644);
68 MODULE_PARM_DESC(irq_debug
,"enable debug messages [IRQ handler]");
70 static unsigned int vid_limit
= 16;
71 module_param(vid_limit
,int,0644);
72 MODULE_PARM_DESC(vid_limit
,"capture memory limit in megabytes");
74 #define dprintk(level,fmt, arg...) if (video_debug >= level) \
75 printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg)
77 /* ------------------------------------------------------------------- */
80 static const struct cx8800_fmt formats
[] = {
82 .name
= "8 bpp, gray",
83 .fourcc
= V4L2_PIX_FMT_GREY
,
84 .cxformat
= ColorFormatY8
,
86 .flags
= FORMAT_FLAGS_PACKED
,
88 .name
= "15 bpp RGB, le",
89 .fourcc
= V4L2_PIX_FMT_RGB555
,
90 .cxformat
= ColorFormatRGB15
,
92 .flags
= FORMAT_FLAGS_PACKED
,
94 .name
= "15 bpp RGB, be",
95 .fourcc
= V4L2_PIX_FMT_RGB555X
,
96 .cxformat
= ColorFormatRGB15
| ColorFormatBSWAP
,
98 .flags
= FORMAT_FLAGS_PACKED
,
100 .name
= "16 bpp RGB, le",
101 .fourcc
= V4L2_PIX_FMT_RGB565
,
102 .cxformat
= ColorFormatRGB16
,
104 .flags
= FORMAT_FLAGS_PACKED
,
106 .name
= "16 bpp RGB, be",
107 .fourcc
= V4L2_PIX_FMT_RGB565X
,
108 .cxformat
= ColorFormatRGB16
| ColorFormatBSWAP
,
110 .flags
= FORMAT_FLAGS_PACKED
,
112 .name
= "24 bpp RGB, le",
113 .fourcc
= V4L2_PIX_FMT_BGR24
,
114 .cxformat
= ColorFormatRGB24
,
116 .flags
= FORMAT_FLAGS_PACKED
,
118 .name
= "32 bpp RGB, le",
119 .fourcc
= V4L2_PIX_FMT_BGR32
,
120 .cxformat
= ColorFormatRGB32
,
122 .flags
= FORMAT_FLAGS_PACKED
,
124 .name
= "32 bpp RGB, be",
125 .fourcc
= V4L2_PIX_FMT_RGB32
,
126 .cxformat
= ColorFormatRGB32
| ColorFormatBSWAP
| ColorFormatWSWAP
,
128 .flags
= FORMAT_FLAGS_PACKED
,
130 .name
= "4:2:2, packed, YUYV",
131 .fourcc
= V4L2_PIX_FMT_YUYV
,
132 .cxformat
= ColorFormatYUY2
,
134 .flags
= FORMAT_FLAGS_PACKED
,
136 .name
= "4:2:2, packed, UYVY",
137 .fourcc
= V4L2_PIX_FMT_UYVY
,
138 .cxformat
= ColorFormatYUY2
| ColorFormatBSWAP
,
140 .flags
= FORMAT_FLAGS_PACKED
,
144 static const struct cx8800_fmt
* format_by_fourcc(unsigned int fourcc
)
148 for (i
= 0; i
< ARRAY_SIZE(formats
); i
++)
149 if (formats
[i
].fourcc
== fourcc
)
154 /* ------------------------------------------------------------------- */
156 static const struct v4l2_queryctrl no_ctl
= {
158 .flags
= V4L2_CTRL_FLAG_DISABLED
,
161 static const struct cx88_ctrl cx8800_ctls
[] = {
165 .id
= V4L2_CID_BRIGHTNESS
,
166 .name
= "Brightness",
170 .default_value
= 0x7f,
171 .type
= V4L2_CTRL_TYPE_INTEGER
,
174 .reg
= MO_CONTR_BRIGHT
,
179 .id
= V4L2_CID_CONTRAST
,
184 .default_value
= 0x3f,
185 .type
= V4L2_CTRL_TYPE_INTEGER
,
188 .reg
= MO_CONTR_BRIGHT
,
198 .default_value
= 0x7f,
199 .type
= V4L2_CTRL_TYPE_INTEGER
,
206 /* strictly, this only describes only U saturation.
207 * V saturation is handled specially through code.
210 .id
= V4L2_CID_SATURATION
,
211 .name
= "Saturation",
215 .default_value
= 0x7f,
216 .type
= V4L2_CTRL_TYPE_INTEGER
,
219 .reg
= MO_UV_SATURATION
,
224 .id
= V4L2_CID_CHROMA_AGC
,
225 .name
= "Chroma AGC",
228 .default_value
= 0x1,
229 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
231 .reg
= MO_INPUT_FORMAT
,
236 .id
= V4L2_CID_COLOR_KILLER
,
237 .name
= "Color killer",
240 .default_value
= 0x1,
241 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
243 .reg
= MO_INPUT_FORMAT
,
249 .id
= V4L2_CID_AUDIO_MUTE
,
254 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
257 .sreg
= SHADOW_AUD_VOL_CTL
,
262 .id
= V4L2_CID_AUDIO_VOLUME
,
267 .default_value
= 0x3f,
268 .type
= V4L2_CTRL_TYPE_INTEGER
,
271 .sreg
= SHADOW_AUD_VOL_CTL
,
276 .id
= V4L2_CID_AUDIO_BALANCE
,
281 .default_value
= 0x40,
282 .type
= V4L2_CTRL_TYPE_INTEGER
,
285 .sreg
= SHADOW_AUD_BAL_CTL
,
290 enum { CX8800_CTLS
= ARRAY_SIZE(cx8800_ctls
) };
292 /* Must be sorted from low to high control ID! */
293 const u32 cx88_user_ctrls
[] = {
299 V4L2_CID_AUDIO_VOLUME
,
300 V4L2_CID_AUDIO_BALANCE
,
303 V4L2_CID_COLOR_KILLER
,
306 EXPORT_SYMBOL(cx88_user_ctrls
);
308 static const u32
* const ctrl_classes
[] = {
313 int cx8800_ctrl_query(struct cx88_core
*core
, struct v4l2_queryctrl
*qctrl
)
317 if (qctrl
->id
< V4L2_CID_BASE
||
318 qctrl
->id
>= V4L2_CID_LASTP1
)
320 for (i
= 0; i
< CX8800_CTLS
; i
++)
321 if (cx8800_ctls
[i
].v
.id
== qctrl
->id
)
323 if (i
== CX8800_CTLS
) {
327 *qctrl
= cx8800_ctls
[i
].v
;
328 /* Report chroma AGC as inactive when SECAM is selected */
329 if (cx8800_ctls
[i
].v
.id
== V4L2_CID_CHROMA_AGC
&&
330 core
->tvnorm
& V4L2_STD_SECAM
)
331 qctrl
->flags
|= V4L2_CTRL_FLAG_INACTIVE
;
335 EXPORT_SYMBOL(cx8800_ctrl_query
);
337 /* ------------------------------------------------------------------- */
338 /* resource management */
340 static int res_get(struct cx8800_dev
*dev
, struct cx8800_fh
*fh
, unsigned int bit
)
342 struct cx88_core
*core
= dev
->core
;
343 if (fh
->resources
& bit
)
344 /* have it already allocated */
348 mutex_lock(&core
->lock
);
349 if (dev
->resources
& bit
) {
350 /* no, someone else uses it */
351 mutex_unlock(&core
->lock
);
354 /* it's free, grab it */
355 fh
->resources
|= bit
;
356 dev
->resources
|= bit
;
357 dprintk(1,"res: get %d\n",bit
);
358 mutex_unlock(&core
->lock
);
363 int res_check(struct cx8800_fh
*fh
, unsigned int bit
)
365 return (fh
->resources
& bit
);
369 int res_locked(struct cx8800_dev
*dev
, unsigned int bit
)
371 return (dev
->resources
& bit
);
375 void res_free(struct cx8800_dev
*dev
, struct cx8800_fh
*fh
, unsigned int bits
)
377 struct cx88_core
*core
= dev
->core
;
378 BUG_ON((fh
->resources
& bits
) != bits
);
380 mutex_lock(&core
->lock
);
381 fh
->resources
&= ~bits
;
382 dev
->resources
&= ~bits
;
383 dprintk(1,"res: put %d\n",bits
);
384 mutex_unlock(&core
->lock
);
387 /* ------------------------------------------------------------------ */
389 int cx88_video_mux(struct cx88_core
*core
, unsigned int input
)
391 /* struct cx88_core *core = dev->core; */
393 dprintk(1,"video_mux: %d [vmux=%d,gpio=0x%x,0x%x,0x%x,0x%x]\n",
394 input
, INPUT(input
).vmux
,
395 INPUT(input
).gpio0
,INPUT(input
).gpio1
,
396 INPUT(input
).gpio2
,INPUT(input
).gpio3
);
398 cx_andor(MO_INPUT_FORMAT
, 0x03 << 14, INPUT(input
).vmux
<< 14);
399 cx_write(MO_GP3_IO
, INPUT(input
).gpio3
);
400 cx_write(MO_GP0_IO
, INPUT(input
).gpio0
);
401 cx_write(MO_GP1_IO
, INPUT(input
).gpio1
);
402 cx_write(MO_GP2_IO
, INPUT(input
).gpio2
);
404 switch (INPUT(input
).type
) {
405 case CX88_VMUX_SVIDEO
:
406 cx_set(MO_AFECFG_IO
, 0x00000001);
407 cx_set(MO_INPUT_FORMAT
, 0x00010010);
408 cx_set(MO_FILTER_EVEN
, 0x00002020);
409 cx_set(MO_FILTER_ODD
, 0x00002020);
412 cx_clear(MO_AFECFG_IO
, 0x00000001);
413 cx_clear(MO_INPUT_FORMAT
, 0x00010010);
414 cx_clear(MO_FILTER_EVEN
, 0x00002020);
415 cx_clear(MO_FILTER_ODD
, 0x00002020);
419 /* if there are audioroutes defined, we have an external
420 ADC to deal with audio */
421 if (INPUT(input
).audioroute
) {
422 /* The wm8775 module has the "2" route hardwired into
423 the initialization. Some boards may use different
424 routes for different inputs. HVR-1300 surely does */
425 if (core
->board
.audio_chip
&&
426 core
->board
.audio_chip
== V4L2_IDENT_WM8775
) {
427 call_all(core
, audio
, s_routing
,
428 INPUT(input
).audioroute
, 0, 0);
430 /* cx2388's C-ADC is connected to the tuner only.
431 When used with S-Video, that ADC is busy dealing with
432 chroma, so an external must be used for baseband audio */
433 if (INPUT(input
).type
!= CX88_VMUX_TELEVISION
&&
434 INPUT(input
).type
!= CX88_VMUX_CABLE
) {
436 core
->tvaudio
= WW_I2SADC
;
437 cx88_set_tvaudio(core
);
440 cx_write(AUD_I2SCNTL
, 0x0);
441 cx_clear(AUD_CTL
, EN_I2SIN_ENABLE
);
447 EXPORT_SYMBOL(cx88_video_mux
);
449 /* ------------------------------------------------------------------ */
451 static int start_video_dma(struct cx8800_dev
*dev
,
452 struct cx88_dmaqueue
*q
,
453 struct cx88_buffer
*buf
)
455 struct cx88_core
*core
= dev
->core
;
457 /* setup fifo + format */
458 cx88_sram_channel_setup(core
, &cx88_sram_channels
[SRAM_CH21
],
459 buf
->bpl
, buf
->risc
.dma
);
460 cx88_set_scale(core
, buf
->vb
.width
, buf
->vb
.height
, buf
->vb
.field
);
461 cx_write(MO_COLOR_CTRL
, buf
->fmt
->cxformat
| ColorFormatGamma
);
464 cx_write(MO_VIDY_GPCNTRL
,GP_COUNT_CONTROL_RESET
);
468 cx_set(MO_PCI_INTMSK
, core
->pci_irqmask
| PCI_INT_VIDINT
);
470 /* Enables corresponding bits at PCI_INT_STAT:
471 bits 0 to 4: video, audio, transport stream, VIP, Host
473 bits 8 and 9: DMA complete for: SRC, DST
474 bits 10 and 11: BERR signal asserted for RISC: RD, WR
475 bits 12 to 15: BERR signal asserted for: BRDG, SRC, DST, IPB
477 cx_set(MO_VID_INTMSK
, 0x0f0011);
480 cx_set(VID_CAPTURE_CONTROL
,0x06);
483 cx_set(MO_DEV_CNTRL2
, (1<<5));
484 cx_set(MO_VID_DMACNTRL
, 0x11); /* Planar Y and packed FIFO and RISC enable */
490 static int stop_video_dma(struct cx8800_dev
*dev
)
492 struct cx88_core
*core
= dev
->core
;
495 cx_clear(MO_VID_DMACNTRL
, 0x11);
497 /* disable capture */
498 cx_clear(VID_CAPTURE_CONTROL
,0x06);
501 cx_clear(MO_PCI_INTMSK
, PCI_INT_VIDINT
);
502 cx_clear(MO_VID_INTMSK
, 0x0f0011);
507 static int restart_video_queue(struct cx8800_dev
*dev
,
508 struct cx88_dmaqueue
*q
)
510 struct cx88_core
*core
= dev
->core
;
511 struct cx88_buffer
*buf
, *prev
;
513 if (!list_empty(&q
->active
)) {
514 buf
= list_entry(q
->active
.next
, struct cx88_buffer
, vb
.queue
);
515 dprintk(2,"restart_queue [%p/%d]: restart dma\n",
517 start_video_dma(dev
, q
, buf
);
518 list_for_each_entry(buf
, &q
->active
, vb
.queue
)
519 buf
->count
= q
->count
++;
520 mod_timer(&q
->timeout
, jiffies
+BUFFER_TIMEOUT
);
526 if (list_empty(&q
->queued
))
528 buf
= list_entry(q
->queued
.next
, struct cx88_buffer
, vb
.queue
);
530 list_move_tail(&buf
->vb
.queue
, &q
->active
);
531 start_video_dma(dev
, q
, buf
);
532 buf
->vb
.state
= VIDEOBUF_ACTIVE
;
533 buf
->count
= q
->count
++;
534 mod_timer(&q
->timeout
, jiffies
+BUFFER_TIMEOUT
);
535 dprintk(2,"[%p/%d] restart_queue - first active\n",
538 } else if (prev
->vb
.width
== buf
->vb
.width
&&
539 prev
->vb
.height
== buf
->vb
.height
&&
540 prev
->fmt
== buf
->fmt
) {
541 list_move_tail(&buf
->vb
.queue
, &q
->active
);
542 buf
->vb
.state
= VIDEOBUF_ACTIVE
;
543 buf
->count
= q
->count
++;
544 prev
->risc
.jmp
[1] = cpu_to_le32(buf
->risc
.dma
);
545 dprintk(2,"[%p/%d] restart_queue - move to active\n",
554 /* ------------------------------------------------------------------ */
557 buffer_setup(struct videobuf_queue
*q
, unsigned int *count
, unsigned int *size
)
559 struct cx8800_fh
*fh
= q
->priv_data
;
561 *size
= fh
->fmt
->depth
*fh
->width
*fh
->height
>> 3;
564 if (*size
* *count
> vid_limit
* 1024 * 1024)
565 *count
= (vid_limit
* 1024 * 1024) / *size
;
570 buffer_prepare(struct videobuf_queue
*q
, struct videobuf_buffer
*vb
,
571 enum v4l2_field field
)
573 struct cx8800_fh
*fh
= q
->priv_data
;
574 struct cx8800_dev
*dev
= fh
->dev
;
575 struct cx88_core
*core
= dev
->core
;
576 struct cx88_buffer
*buf
= container_of(vb
,struct cx88_buffer
,vb
);
577 struct videobuf_dmabuf
*dma
=videobuf_to_dma(&buf
->vb
);
578 int rc
, init_buffer
= 0;
580 BUG_ON(NULL
== fh
->fmt
);
581 if (fh
->width
< 48 || fh
->width
> norm_maxw(core
->tvnorm
) ||
582 fh
->height
< 32 || fh
->height
> norm_maxh(core
->tvnorm
))
584 buf
->vb
.size
= (fh
->width
* fh
->height
* fh
->fmt
->depth
) >> 3;
585 if (0 != buf
->vb
.baddr
&& buf
->vb
.bsize
< buf
->vb
.size
)
588 if (buf
->fmt
!= fh
->fmt
||
589 buf
->vb
.width
!= fh
->width
||
590 buf
->vb
.height
!= fh
->height
||
591 buf
->vb
.field
!= field
) {
593 buf
->vb
.width
= fh
->width
;
594 buf
->vb
.height
= fh
->height
;
595 buf
->vb
.field
= field
;
599 if (VIDEOBUF_NEEDS_INIT
== buf
->vb
.state
) {
601 if (0 != (rc
= videobuf_iolock(q
,&buf
->vb
,NULL
)))
606 buf
->bpl
= buf
->vb
.width
* buf
->fmt
->depth
>> 3;
607 switch (buf
->vb
.field
) {
609 cx88_risc_buffer(dev
->pci
, &buf
->risc
,
610 dma
->sglist
, 0, UNSET
,
611 buf
->bpl
, 0, buf
->vb
.height
);
613 case V4L2_FIELD_BOTTOM
:
614 cx88_risc_buffer(dev
->pci
, &buf
->risc
,
615 dma
->sglist
, UNSET
, 0,
616 buf
->bpl
, 0, buf
->vb
.height
);
618 case V4L2_FIELD_INTERLACED
:
619 cx88_risc_buffer(dev
->pci
, &buf
->risc
,
620 dma
->sglist
, 0, buf
->bpl
,
622 buf
->vb
.height
>> 1);
624 case V4L2_FIELD_SEQ_TB
:
625 cx88_risc_buffer(dev
->pci
, &buf
->risc
,
627 0, buf
->bpl
* (buf
->vb
.height
>> 1),
629 buf
->vb
.height
>> 1);
631 case V4L2_FIELD_SEQ_BT
:
632 cx88_risc_buffer(dev
->pci
, &buf
->risc
,
634 buf
->bpl
* (buf
->vb
.height
>> 1), 0,
636 buf
->vb
.height
>> 1);
642 dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
644 fh
->width
, fh
->height
, fh
->fmt
->depth
, fh
->fmt
->name
,
645 (unsigned long)buf
->risc
.dma
);
647 buf
->vb
.state
= VIDEOBUF_PREPARED
;
651 cx88_free_buffer(q
,buf
);
656 buffer_queue(struct videobuf_queue
*vq
, struct videobuf_buffer
*vb
)
658 struct cx88_buffer
*buf
= container_of(vb
,struct cx88_buffer
,vb
);
659 struct cx88_buffer
*prev
;
660 struct cx8800_fh
*fh
= vq
->priv_data
;
661 struct cx8800_dev
*dev
= fh
->dev
;
662 struct cx88_core
*core
= dev
->core
;
663 struct cx88_dmaqueue
*q
= &dev
->vidq
;
665 /* add jump to stopper */
666 buf
->risc
.jmp
[0] = cpu_to_le32(RISC_JUMP
| RISC_IRQ1
| RISC_CNT_INC
);
667 buf
->risc
.jmp
[1] = cpu_to_le32(q
->stopper
.dma
);
669 if (!list_empty(&q
->queued
)) {
670 list_add_tail(&buf
->vb
.queue
,&q
->queued
);
671 buf
->vb
.state
= VIDEOBUF_QUEUED
;
672 dprintk(2,"[%p/%d] buffer_queue - append to queued\n",
675 } else if (list_empty(&q
->active
)) {
676 list_add_tail(&buf
->vb
.queue
,&q
->active
);
677 start_video_dma(dev
, q
, buf
);
678 buf
->vb
.state
= VIDEOBUF_ACTIVE
;
679 buf
->count
= q
->count
++;
680 mod_timer(&q
->timeout
, jiffies
+BUFFER_TIMEOUT
);
681 dprintk(2,"[%p/%d] buffer_queue - first active\n",
685 prev
= list_entry(q
->active
.prev
, struct cx88_buffer
, vb
.queue
);
686 if (prev
->vb
.width
== buf
->vb
.width
&&
687 prev
->vb
.height
== buf
->vb
.height
&&
688 prev
->fmt
== buf
->fmt
) {
689 list_add_tail(&buf
->vb
.queue
,&q
->active
);
690 buf
->vb
.state
= VIDEOBUF_ACTIVE
;
691 buf
->count
= q
->count
++;
692 prev
->risc
.jmp
[1] = cpu_to_le32(buf
->risc
.dma
);
693 dprintk(2,"[%p/%d] buffer_queue - append to active\n",
697 list_add_tail(&buf
->vb
.queue
,&q
->queued
);
698 buf
->vb
.state
= VIDEOBUF_QUEUED
;
699 dprintk(2,"[%p/%d] buffer_queue - first queued\n",
705 static void buffer_release(struct videobuf_queue
*q
, struct videobuf_buffer
*vb
)
707 struct cx88_buffer
*buf
= container_of(vb
,struct cx88_buffer
,vb
);
709 cx88_free_buffer(q
,buf
);
712 static const struct videobuf_queue_ops cx8800_video_qops
= {
713 .buf_setup
= buffer_setup
,
714 .buf_prepare
= buffer_prepare
,
715 .buf_queue
= buffer_queue
,
716 .buf_release
= buffer_release
,
719 /* ------------------------------------------------------------------ */
722 /* ------------------------------------------------------------------ */
724 static struct videobuf_queue
* get_queue(struct cx8800_fh
*fh
)
727 case V4L2_BUF_TYPE_VIDEO_CAPTURE
:
729 case V4L2_BUF_TYPE_VBI_CAPTURE
:
737 static int get_ressource(struct cx8800_fh
*fh
)
740 case V4L2_BUF_TYPE_VIDEO_CAPTURE
:
741 return RESOURCE_VIDEO
;
742 case V4L2_BUF_TYPE_VBI_CAPTURE
:
750 static int video_open(struct file
*file
)
752 struct video_device
*vdev
= video_devdata(file
);
753 struct cx8800_dev
*dev
= video_drvdata(file
);
754 struct cx88_core
*core
= dev
->core
;
755 struct cx8800_fh
*fh
;
756 enum v4l2_buf_type type
= 0;
759 switch (vdev
->vfl_type
) {
760 case VFL_TYPE_GRABBER
:
761 type
= V4L2_BUF_TYPE_VIDEO_CAPTURE
;
764 type
= V4L2_BUF_TYPE_VBI_CAPTURE
;
771 dprintk(1, "open dev=%s radio=%d type=%s\n",
772 video_device_node_name(vdev
), radio
, v4l2_type_names
[type
]);
774 /* allocate + initialize per filehandle data */
775 fh
= kzalloc(sizeof(*fh
),GFP_KERNEL
);
779 file
->private_data
= fh
;
785 fh
->fmt
= format_by_fourcc(V4L2_PIX_FMT_BGR24
);
787 mutex_lock(&core
->lock
);
789 videobuf_queue_sg_init(&fh
->vidq
, &cx8800_video_qops
,
790 &dev
->pci
->dev
, &dev
->slock
,
791 V4L2_BUF_TYPE_VIDEO_CAPTURE
,
792 V4L2_FIELD_INTERLACED
,
793 sizeof(struct cx88_buffer
),
795 videobuf_queue_sg_init(&fh
->vbiq
, &cx8800_vbi_qops
,
796 &dev
->pci
->dev
, &dev
->slock
,
797 V4L2_BUF_TYPE_VBI_CAPTURE
,
799 sizeof(struct cx88_buffer
),
803 dprintk(1,"video_open: setting radio device\n");
804 cx_write(MO_GP3_IO
, core
->board
.radio
.gpio3
);
805 cx_write(MO_GP0_IO
, core
->board
.radio
.gpio0
);
806 cx_write(MO_GP1_IO
, core
->board
.radio
.gpio1
);
807 cx_write(MO_GP2_IO
, core
->board
.radio
.gpio2
);
808 if (core
->board
.radio
.audioroute
) {
809 if(core
->board
.audio_chip
&&
810 core
->board
.audio_chip
== V4L2_IDENT_WM8775
) {
811 call_all(core
, audio
, s_routing
,
812 core
->board
.radio
.audioroute
, 0, 0);
815 core
->tvaudio
= WW_I2SADC
;
816 cx88_set_tvaudio(core
);
819 core
->tvaudio
= WW_FM
;
820 cx88_set_tvaudio(core
);
821 cx88_set_stereo(core
,V4L2_TUNER_MODE_STEREO
,1);
823 call_all(core
, tuner
, s_radio
);
826 atomic_inc(&core
->users
);
827 mutex_unlock(&core
->lock
);
833 video_read(struct file
*file
, char __user
*data
, size_t count
, loff_t
*ppos
)
835 struct cx8800_fh
*fh
= file
->private_data
;
838 case V4L2_BUF_TYPE_VIDEO_CAPTURE
:
839 if (res_locked(fh
->dev
,RESOURCE_VIDEO
))
841 return videobuf_read_one(&fh
->vidq
, data
, count
, ppos
,
842 file
->f_flags
& O_NONBLOCK
);
843 case V4L2_BUF_TYPE_VBI_CAPTURE
:
844 if (!res_get(fh
->dev
,fh
,RESOURCE_VBI
))
846 return videobuf_read_stream(&fh
->vbiq
, data
, count
, ppos
, 1,
847 file
->f_flags
& O_NONBLOCK
);
855 video_poll(struct file
*file
, struct poll_table_struct
*wait
)
857 struct cx8800_fh
*fh
= file
->private_data
;
858 struct cx88_buffer
*buf
;
859 unsigned int rc
= POLLERR
;
861 if (V4L2_BUF_TYPE_VBI_CAPTURE
== fh
->type
) {
862 if (!res_get(fh
->dev
,fh
,RESOURCE_VBI
))
864 return videobuf_poll_stream(file
, &fh
->vbiq
, wait
);
867 mutex_lock(&fh
->vidq
.vb_lock
);
868 if (res_check(fh
,RESOURCE_VIDEO
)) {
869 /* streaming capture */
870 if (list_empty(&fh
->vidq
.stream
))
872 buf
= list_entry(fh
->vidq
.stream
.next
,struct cx88_buffer
,vb
.stream
);
875 buf
= (struct cx88_buffer
*)fh
->vidq
.read_buf
;
879 poll_wait(file
, &buf
->vb
.done
, wait
);
880 if (buf
->vb
.state
== VIDEOBUF_DONE
||
881 buf
->vb
.state
== VIDEOBUF_ERROR
)
882 rc
= POLLIN
|POLLRDNORM
;
886 mutex_unlock(&fh
->vidq
.vb_lock
);
890 static int video_release(struct file
*file
)
892 struct cx8800_fh
*fh
= file
->private_data
;
893 struct cx8800_dev
*dev
= fh
->dev
;
895 /* turn off overlay */
896 if (res_check(fh
, RESOURCE_OVERLAY
)) {
898 res_free(dev
,fh
,RESOURCE_OVERLAY
);
901 /* stop video capture */
902 if (res_check(fh
, RESOURCE_VIDEO
)) {
903 videobuf_queue_cancel(&fh
->vidq
);
904 res_free(dev
,fh
,RESOURCE_VIDEO
);
906 if (fh
->vidq
.read_buf
) {
907 buffer_release(&fh
->vidq
,fh
->vidq
.read_buf
);
908 kfree(fh
->vidq
.read_buf
);
911 /* stop vbi capture */
912 if (res_check(fh
, RESOURCE_VBI
)) {
913 videobuf_stop(&fh
->vbiq
);
914 res_free(dev
,fh
,RESOURCE_VBI
);
917 videobuf_mmap_free(&fh
->vidq
);
918 videobuf_mmap_free(&fh
->vbiq
);
920 mutex_lock(&dev
->core
->lock
);
921 file
->private_data
= NULL
;
924 if(atomic_dec_and_test(&dev
->core
->users
))
925 call_all(dev
->core
, core
, s_power
, 0);
926 mutex_unlock(&dev
->core
->lock
);
932 video_mmap(struct file
*file
, struct vm_area_struct
* vma
)
934 struct cx8800_fh
*fh
= file
->private_data
;
936 return videobuf_mmap_mapper(get_queue(fh
), vma
);
939 /* ------------------------------------------------------------------ */
940 /* VIDEO CTRL IOCTLS */
942 int cx88_get_control (struct cx88_core
*core
, struct v4l2_control
*ctl
)
944 const struct cx88_ctrl
*c
= NULL
;
948 for (i
= 0; i
< CX8800_CTLS
; i
++)
949 if (cx8800_ctls
[i
].v
.id
== ctl
->id
)
951 if (unlikely(NULL
== c
))
954 value
= c
->sreg
? cx_sread(c
->sreg
) : cx_read(c
->reg
);
956 case V4L2_CID_AUDIO_BALANCE
:
957 ctl
->value
= ((value
& 0x7f) < 0x40) ? ((value
& 0x7f) + 0x40)
958 : (0x7f - (value
& 0x7f));
960 case V4L2_CID_AUDIO_VOLUME
:
961 ctl
->value
= 0x3f - (value
& 0x3f);
964 ctl
->value
= ((value
+ (c
->off
<< c
->shift
)) & c
->mask
) >> c
->shift
;
967 dprintk(1,"get_control id=0x%X(%s) ctrl=0x%02x, reg=0x%02x val=0x%02x (mask 0x%02x)%s\n",
968 ctl
->id
, c
->v
.name
, ctl
->value
, c
->reg
,
969 value
,c
->mask
, c
->sreg
? " [shadowed]" : "");
972 EXPORT_SYMBOL(cx88_get_control
);
974 int cx88_set_control(struct cx88_core
*core
, struct v4l2_control
*ctl
)
976 const struct cx88_ctrl
*c
= NULL
;
980 for (i
= 0; i
< CX8800_CTLS
; i
++) {
981 if (cx8800_ctls
[i
].v
.id
== ctl
->id
) {
985 if (unlikely(NULL
== c
))
988 if (ctl
->value
< c
->v
.minimum
)
989 ctl
->value
= c
->v
.minimum
;
990 if (ctl
->value
> c
->v
.maximum
)
991 ctl
->value
= c
->v
.maximum
;
994 case V4L2_CID_AUDIO_BALANCE
:
995 value
= (ctl
->value
< 0x40) ? (0x7f - ctl
->value
) : (ctl
->value
- 0x40);
997 case V4L2_CID_AUDIO_VOLUME
:
998 value
= 0x3f - (ctl
->value
& 0x3f);
1000 case V4L2_CID_SATURATION
:
1001 /* special v_sat handling */
1003 value
= ((ctl
->value
- c
->off
) << c
->shift
) & c
->mask
;
1005 if (core
->tvnorm
& V4L2_STD_SECAM
) {
1006 /* For SECAM, both U and V sat should be equal */
1007 value
=value
<<8|value
;
1009 /* Keeps U Saturation proportional to V Sat */
1010 value
=(value
*0x5a)/0x7f<<8|value
;
1014 case V4L2_CID_CHROMA_AGC
:
1015 /* Do not allow chroma AGC to be enabled for SECAM */
1016 value
= ((ctl
->value
- c
->off
) << c
->shift
) & c
->mask
;
1017 if (core
->tvnorm
& V4L2_STD_SECAM
&& value
)
1021 value
= ((ctl
->value
- c
->off
) << c
->shift
) & c
->mask
;
1024 dprintk(1,"set_control id=0x%X(%s) ctrl=0x%02x, reg=0x%02x val=0x%02x (mask 0x%02x)%s\n",
1025 ctl
->id
, c
->v
.name
, ctl
->value
, c
->reg
, value
,
1026 mask
, c
->sreg
? " [shadowed]" : "");
1028 cx_sandor(c
->sreg
, c
->reg
, mask
, value
);
1030 cx_andor(c
->reg
, mask
, value
);
1034 EXPORT_SYMBOL(cx88_set_control
);
1036 static void init_controls(struct cx88_core
*core
)
1038 struct v4l2_control ctrl
;
1041 for (i
= 0; i
< CX8800_CTLS
; i
++) {
1042 ctrl
.id
=cx8800_ctls
[i
].v
.id
;
1043 ctrl
.value
=cx8800_ctls
[i
].v
.default_value
;
1045 cx88_set_control(core
, &ctrl
);
1049 /* ------------------------------------------------------------------ */
1052 static int vidioc_g_fmt_vid_cap(struct file
*file
, void *priv
,
1053 struct v4l2_format
*f
)
1055 struct cx8800_fh
*fh
= priv
;
1057 f
->fmt
.pix
.width
= fh
->width
;
1058 f
->fmt
.pix
.height
= fh
->height
;
1059 f
->fmt
.pix
.field
= fh
->vidq
.field
;
1060 f
->fmt
.pix
.pixelformat
= fh
->fmt
->fourcc
;
1061 f
->fmt
.pix
.bytesperline
=
1062 (f
->fmt
.pix
.width
* fh
->fmt
->depth
) >> 3;
1063 f
->fmt
.pix
.sizeimage
=
1064 f
->fmt
.pix
.height
* f
->fmt
.pix
.bytesperline
;
1068 static int vidioc_try_fmt_vid_cap(struct file
*file
, void *priv
,
1069 struct v4l2_format
*f
)
1071 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1072 const struct cx8800_fmt
*fmt
;
1073 enum v4l2_field field
;
1074 unsigned int maxw
, maxh
;
1076 fmt
= format_by_fourcc(f
->fmt
.pix
.pixelformat
);
1080 field
= f
->fmt
.pix
.field
;
1081 maxw
= norm_maxw(core
->tvnorm
);
1082 maxh
= norm_maxh(core
->tvnorm
);
1084 if (V4L2_FIELD_ANY
== field
) {
1085 field
= (f
->fmt
.pix
.height
> maxh
/2)
1086 ? V4L2_FIELD_INTERLACED
1087 : V4L2_FIELD_BOTTOM
;
1091 case V4L2_FIELD_TOP
:
1092 case V4L2_FIELD_BOTTOM
:
1095 case V4L2_FIELD_INTERLACED
:
1101 f
->fmt
.pix
.field
= field
;
1102 v4l_bound_align_image(&f
->fmt
.pix
.width
, 48, maxw
, 2,
1103 &f
->fmt
.pix
.height
, 32, maxh
, 0, 0);
1104 f
->fmt
.pix
.bytesperline
=
1105 (f
->fmt
.pix
.width
* fmt
->depth
) >> 3;
1106 f
->fmt
.pix
.sizeimage
=
1107 f
->fmt
.pix
.height
* f
->fmt
.pix
.bytesperline
;
1112 static int vidioc_s_fmt_vid_cap(struct file
*file
, void *priv
,
1113 struct v4l2_format
*f
)
1115 struct cx8800_fh
*fh
= priv
;
1116 int err
= vidioc_try_fmt_vid_cap (file
,priv
,f
);
1120 fh
->fmt
= format_by_fourcc(f
->fmt
.pix
.pixelformat
);
1121 fh
->width
= f
->fmt
.pix
.width
;
1122 fh
->height
= f
->fmt
.pix
.height
;
1123 fh
->vidq
.field
= f
->fmt
.pix
.field
;
1127 static int vidioc_querycap (struct file
*file
, void *priv
,
1128 struct v4l2_capability
*cap
)
1130 struct cx8800_dev
*dev
= ((struct cx8800_fh
*)priv
)->dev
;
1131 struct cx88_core
*core
= dev
->core
;
1133 strcpy(cap
->driver
, "cx8800");
1134 strlcpy(cap
->card
, core
->board
.name
, sizeof(cap
->card
));
1135 sprintf(cap
->bus_info
,"PCI:%s",pci_name(dev
->pci
));
1136 cap
->version
= CX88_VERSION_CODE
;
1138 V4L2_CAP_VIDEO_CAPTURE
|
1139 V4L2_CAP_READWRITE
|
1140 V4L2_CAP_STREAMING
|
1141 V4L2_CAP_VBI_CAPTURE
;
1142 if (UNSET
!= core
->board
.tuner_type
)
1143 cap
->capabilities
|= V4L2_CAP_TUNER
;
1147 static int vidioc_enum_fmt_vid_cap (struct file
*file
, void *priv
,
1148 struct v4l2_fmtdesc
*f
)
1150 if (unlikely(f
->index
>= ARRAY_SIZE(formats
)))
1153 strlcpy(f
->description
,formats
[f
->index
].name
,sizeof(f
->description
));
1154 f
->pixelformat
= formats
[f
->index
].fourcc
;
1159 #ifdef CONFIG_VIDEO_V4L1_COMPAT
1160 static int vidiocgmbuf (struct file
*file
, void *priv
, struct video_mbuf
*mbuf
)
1162 struct cx8800_fh
*fh
= priv
;
1164 return videobuf_cgmbuf (get_queue(fh
), mbuf
, 8);
1168 static int vidioc_reqbufs (struct file
*file
, void *priv
, struct v4l2_requestbuffers
*p
)
1170 struct cx8800_fh
*fh
= priv
;
1171 return (videobuf_reqbufs(get_queue(fh
), p
));
1174 static int vidioc_querybuf (struct file
*file
, void *priv
, struct v4l2_buffer
*p
)
1176 struct cx8800_fh
*fh
= priv
;
1177 return (videobuf_querybuf(get_queue(fh
), p
));
1180 static int vidioc_qbuf (struct file
*file
, void *priv
, struct v4l2_buffer
*p
)
1182 struct cx8800_fh
*fh
= priv
;
1183 return (videobuf_qbuf(get_queue(fh
), p
));
1186 static int vidioc_dqbuf (struct file
*file
, void *priv
, struct v4l2_buffer
*p
)
1188 struct cx8800_fh
*fh
= priv
;
1189 return (videobuf_dqbuf(get_queue(fh
), p
,
1190 file
->f_flags
& O_NONBLOCK
));
1193 static int vidioc_streamon(struct file
*file
, void *priv
, enum v4l2_buf_type i
)
1195 struct cx8800_fh
*fh
= priv
;
1196 struct cx8800_dev
*dev
= fh
->dev
;
1198 /* We should remember that this driver also supports teletext, */
1199 /* so we have to test if the v4l2_buf_type is VBI capture data. */
1200 if (unlikely((fh
->type
!= V4L2_BUF_TYPE_VIDEO_CAPTURE
) &&
1201 (fh
->type
!= V4L2_BUF_TYPE_VBI_CAPTURE
)))
1204 if (unlikely(i
!= fh
->type
))
1207 if (unlikely(!res_get(dev
,fh
,get_ressource(fh
))))
1209 return videobuf_streamon(get_queue(fh
));
1212 static int vidioc_streamoff(struct file
*file
, void *priv
, enum v4l2_buf_type i
)
1214 struct cx8800_fh
*fh
= priv
;
1215 struct cx8800_dev
*dev
= fh
->dev
;
1218 if ((fh
->type
!= V4L2_BUF_TYPE_VIDEO_CAPTURE
) &&
1219 (fh
->type
!= V4L2_BUF_TYPE_VBI_CAPTURE
))
1225 res
= get_ressource(fh
);
1226 err
= videobuf_streamoff(get_queue(fh
));
1229 res_free(dev
,fh
,res
);
1233 static int vidioc_s_std (struct file
*file
, void *priv
, v4l2_std_id
*tvnorms
)
1235 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1237 mutex_lock(&core
->lock
);
1238 cx88_set_tvnorm(core
,*tvnorms
);
1239 mutex_unlock(&core
->lock
);
1244 /* only one input in this sample driver */
1245 int cx88_enum_input (struct cx88_core
*core
,struct v4l2_input
*i
)
1247 static const char * const iname
[] = {
1248 [ CX88_VMUX_COMPOSITE1
] = "Composite1",
1249 [ CX88_VMUX_COMPOSITE2
] = "Composite2",
1250 [ CX88_VMUX_COMPOSITE3
] = "Composite3",
1251 [ CX88_VMUX_COMPOSITE4
] = "Composite4",
1252 [ CX88_VMUX_SVIDEO
] = "S-Video",
1253 [ CX88_VMUX_TELEVISION
] = "Television",
1254 [ CX88_VMUX_CABLE
] = "Cable TV",
1255 [ CX88_VMUX_DVB
] = "DVB",
1256 [ CX88_VMUX_DEBUG
] = "for debug only",
1258 unsigned int n
= i
->index
;
1262 if (0 == INPUT(n
).type
)
1264 i
->type
= V4L2_INPUT_TYPE_CAMERA
;
1265 strcpy(i
->name
,iname
[INPUT(n
).type
]);
1266 if ((CX88_VMUX_TELEVISION
== INPUT(n
).type
) ||
1267 (CX88_VMUX_CABLE
== INPUT(n
).type
)) {
1268 i
->type
= V4L2_INPUT_TYPE_TUNER
;
1269 i
->std
= CX88_NORMS
;
1273 EXPORT_SYMBOL(cx88_enum_input
);
1275 static int vidioc_enum_input (struct file
*file
, void *priv
,
1276 struct v4l2_input
*i
)
1278 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1279 return cx88_enum_input (core
,i
);
1282 static int vidioc_g_input (struct file
*file
, void *priv
, unsigned int *i
)
1284 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1290 static int vidioc_s_input (struct file
*file
, void *priv
, unsigned int i
)
1292 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1297 mutex_lock(&core
->lock
);
1298 cx88_newstation(core
);
1299 cx88_video_mux(core
,i
);
1300 mutex_unlock(&core
->lock
);
1306 static int vidioc_queryctrl (struct file
*file
, void *priv
,
1307 struct v4l2_queryctrl
*qctrl
)
1309 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1311 qctrl
->id
= v4l2_ctrl_next(ctrl_classes
, qctrl
->id
);
1312 if (unlikely(qctrl
->id
== 0))
1314 return cx8800_ctrl_query(core
, qctrl
);
1317 static int vidioc_g_ctrl (struct file
*file
, void *priv
,
1318 struct v4l2_control
*ctl
)
1320 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1322 cx88_get_control(core
,ctl
);
1325 static int vidioc_s_ctrl (struct file
*file
, void *priv
,
1326 struct v4l2_control
*ctl
)
1328 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1330 cx88_set_control(core
,ctl
);
1333 static int vidioc_g_tuner (struct file
*file
, void *priv
,
1334 struct v4l2_tuner
*t
)
1336 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1339 if (unlikely(UNSET
== core
->board
.tuner_type
))
1344 strcpy(t
->name
, "Television");
1345 t
->type
= V4L2_TUNER_ANALOG_TV
;
1346 t
->capability
= V4L2_TUNER_CAP_NORM
;
1347 t
->rangehigh
= 0xffffffffUL
;
1349 cx88_get_stereo(core
,t
);
1350 reg
= cx_read(MO_DEVICE_STATUS
);
1351 t
->signal
= (reg
& (1<<5)) ? 0xffff : 0x0000;
1355 static int vidioc_s_tuner (struct file
*file
, void *priv
,
1356 struct v4l2_tuner
*t
)
1358 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1360 if (UNSET
== core
->board
.tuner_type
)
1365 cx88_set_stereo(core
, t
->audmode
, 1);
1369 static int vidioc_g_frequency (struct file
*file
, void *priv
,
1370 struct v4l2_frequency
*f
)
1372 struct cx8800_fh
*fh
= priv
;
1373 struct cx88_core
*core
= fh
->dev
->core
;
1375 if (unlikely(UNSET
== core
->board
.tuner_type
))
1378 /* f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; */
1379 f
->type
= fh
->radio
? V4L2_TUNER_RADIO
: V4L2_TUNER_ANALOG_TV
;
1380 f
->frequency
= core
->freq
;
1382 call_all(core
, tuner
, g_frequency
, f
);
1387 int cx88_set_freq (struct cx88_core
*core
,
1388 struct v4l2_frequency
*f
)
1390 if (unlikely(UNSET
== core
->board
.tuner_type
))
1392 if (unlikely(f
->tuner
!= 0))
1395 mutex_lock(&core
->lock
);
1396 core
->freq
= f
->frequency
;
1397 cx88_newstation(core
);
1398 call_all(core
, tuner
, s_frequency
, f
);
1400 /* When changing channels it is required to reset TVAUDIO */
1402 cx88_set_tvaudio(core
);
1404 mutex_unlock(&core
->lock
);
1408 EXPORT_SYMBOL(cx88_set_freq
);
1410 static int vidioc_s_frequency (struct file
*file
, void *priv
,
1411 struct v4l2_frequency
*f
)
1413 struct cx8800_fh
*fh
= priv
;
1414 struct cx88_core
*core
= fh
->dev
->core
;
1416 if (unlikely(0 == fh
->radio
&& f
->type
!= V4L2_TUNER_ANALOG_TV
))
1418 if (unlikely(1 == fh
->radio
&& f
->type
!= V4L2_TUNER_RADIO
))
1422 cx88_set_freq (core
,f
);
1425 #ifdef CONFIG_VIDEO_ADV_DEBUG
1426 static int vidioc_g_register (struct file
*file
, void *fh
,
1427 struct v4l2_dbg_register
*reg
)
1429 struct cx88_core
*core
= ((struct cx8800_fh
*)fh
)->dev
->core
;
1431 if (!v4l2_chip_match_host(®
->match
))
1433 /* cx2388x has a 24-bit register space */
1434 reg
->val
= cx_read(reg
->reg
& 0xffffff);
1439 static int vidioc_s_register (struct file
*file
, void *fh
,
1440 struct v4l2_dbg_register
*reg
)
1442 struct cx88_core
*core
= ((struct cx8800_fh
*)fh
)->dev
->core
;
1444 if (!v4l2_chip_match_host(®
->match
))
1446 cx_write(reg
->reg
& 0xffffff, reg
->val
);
1451 /* ----------------------------------------------------------- */
1452 /* RADIO ESPECIFIC IOCTLS */
1453 /* ----------------------------------------------------------- */
1455 static int radio_querycap (struct file
*file
, void *priv
,
1456 struct v4l2_capability
*cap
)
1458 struct cx8800_dev
*dev
= ((struct cx8800_fh
*)priv
)->dev
;
1459 struct cx88_core
*core
= dev
->core
;
1461 strcpy(cap
->driver
, "cx8800");
1462 strlcpy(cap
->card
, core
->board
.name
, sizeof(cap
->card
));
1463 sprintf(cap
->bus_info
,"PCI:%s", pci_name(dev
->pci
));
1464 cap
->version
= CX88_VERSION_CODE
;
1465 cap
->capabilities
= V4L2_CAP_TUNER
;
1469 static int radio_g_tuner (struct file
*file
, void *priv
,
1470 struct v4l2_tuner
*t
)
1472 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1474 if (unlikely(t
->index
> 0))
1477 strcpy(t
->name
, "Radio");
1478 t
->type
= V4L2_TUNER_RADIO
;
1480 call_all(core
, tuner
, g_tuner
, t
);
1484 static int radio_enum_input (struct file
*file
, void *priv
,
1485 struct v4l2_input
*i
)
1489 strcpy(i
->name
,"Radio");
1490 i
->type
= V4L2_INPUT_TYPE_TUNER
;
1495 static int radio_g_audio (struct file
*file
, void *priv
, struct v4l2_audio
*a
)
1497 if (unlikely(a
->index
))
1500 strcpy(a
->name
,"Radio");
1504 /* FIXME: Should add a standard for radio */
1506 static int radio_s_tuner (struct file
*file
, void *priv
,
1507 struct v4l2_tuner
*t
)
1509 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1514 call_all(core
, tuner
, s_tuner
, t
);
1519 static int radio_s_audio (struct file
*file
, void *fh
,
1520 struct v4l2_audio
*a
)
1525 static int radio_s_input (struct file
*file
, void *fh
, unsigned int i
)
1530 static int radio_queryctrl (struct file
*file
, void *priv
,
1531 struct v4l2_queryctrl
*c
)
1535 if (c
->id
< V4L2_CID_BASE
||
1536 c
->id
>= V4L2_CID_LASTP1
)
1538 if (c
->id
== V4L2_CID_AUDIO_MUTE
) {
1539 for (i
= 0; i
< CX8800_CTLS
; i
++) {
1540 if (cx8800_ctls
[i
].v
.id
== c
->id
)
1543 if (i
== CX8800_CTLS
)
1545 *c
= cx8800_ctls
[i
].v
;
1551 /* ----------------------------------------------------------- */
1553 static void cx8800_vid_timeout(unsigned long data
)
1555 struct cx8800_dev
*dev
= (struct cx8800_dev
*)data
;
1556 struct cx88_core
*core
= dev
->core
;
1557 struct cx88_dmaqueue
*q
= &dev
->vidq
;
1558 struct cx88_buffer
*buf
;
1559 unsigned long flags
;
1561 cx88_sram_channel_dump(core
, &cx88_sram_channels
[SRAM_CH21
]);
1563 cx_clear(MO_VID_DMACNTRL
, 0x11);
1564 cx_clear(VID_CAPTURE_CONTROL
, 0x06);
1566 spin_lock_irqsave(&dev
->slock
,flags
);
1567 while (!list_empty(&q
->active
)) {
1568 buf
= list_entry(q
->active
.next
, struct cx88_buffer
, vb
.queue
);
1569 list_del(&buf
->vb
.queue
);
1570 buf
->vb
.state
= VIDEOBUF_ERROR
;
1571 wake_up(&buf
->vb
.done
);
1572 printk("%s/0: [%p/%d] timeout - dma=0x%08lx\n", core
->name
,
1573 buf
, buf
->vb
.i
, (unsigned long)buf
->risc
.dma
);
1575 restart_video_queue(dev
,q
);
1576 spin_unlock_irqrestore(&dev
->slock
,flags
);
1579 static const char *cx88_vid_irqs
[32] = {
1580 "y_risci1", "u_risci1", "v_risci1", "vbi_risc1",
1581 "y_risci2", "u_risci2", "v_risci2", "vbi_risc2",
1582 "y_oflow", "u_oflow", "v_oflow", "vbi_oflow",
1583 "y_sync", "u_sync", "v_sync", "vbi_sync",
1584 "opc_err", "par_err", "rip_err", "pci_abort",
1587 static void cx8800_vid_irq(struct cx8800_dev
*dev
)
1589 struct cx88_core
*core
= dev
->core
;
1590 u32 status
, mask
, count
;
1592 status
= cx_read(MO_VID_INTSTAT
);
1593 mask
= cx_read(MO_VID_INTMSK
);
1594 if (0 == (status
& mask
))
1596 cx_write(MO_VID_INTSTAT
, status
);
1597 if (irq_debug
|| (status
& mask
& ~0xff))
1598 cx88_print_irqbits(core
->name
, "irq vid",
1599 cx88_vid_irqs
, ARRAY_SIZE(cx88_vid_irqs
),
1602 /* risc op code error */
1603 if (status
& (1 << 16)) {
1604 printk(KERN_WARNING
"%s/0: video risc op code error\n",core
->name
);
1605 cx_clear(MO_VID_DMACNTRL
, 0x11);
1606 cx_clear(VID_CAPTURE_CONTROL
, 0x06);
1607 cx88_sram_channel_dump(core
, &cx88_sram_channels
[SRAM_CH21
]);
1611 if (status
& 0x01) {
1612 spin_lock(&dev
->slock
);
1613 count
= cx_read(MO_VIDY_GPCNT
);
1614 cx88_wakeup(core
, &dev
->vidq
, count
);
1615 spin_unlock(&dev
->slock
);
1619 if (status
& 0x08) {
1620 spin_lock(&dev
->slock
);
1621 count
= cx_read(MO_VBI_GPCNT
);
1622 cx88_wakeup(core
, &dev
->vbiq
, count
);
1623 spin_unlock(&dev
->slock
);
1627 if (status
& 0x10) {
1628 dprintk(2,"stopper video\n");
1629 spin_lock(&dev
->slock
);
1630 restart_video_queue(dev
,&dev
->vidq
);
1631 spin_unlock(&dev
->slock
);
1635 if (status
& 0x80) {
1636 dprintk(2,"stopper vbi\n");
1637 spin_lock(&dev
->slock
);
1638 cx8800_restart_vbi_queue(dev
,&dev
->vbiq
);
1639 spin_unlock(&dev
->slock
);
1643 static irqreturn_t
cx8800_irq(int irq
, void *dev_id
)
1645 struct cx8800_dev
*dev
= dev_id
;
1646 struct cx88_core
*core
= dev
->core
;
1648 int loop
, handled
= 0;
1650 for (loop
= 0; loop
< 10; loop
++) {
1651 status
= cx_read(MO_PCI_INTSTAT
) &
1652 (core
->pci_irqmask
| PCI_INT_VIDINT
);
1655 cx_write(MO_PCI_INTSTAT
, status
);
1658 if (status
& core
->pci_irqmask
)
1659 cx88_core_irq(core
,status
);
1660 if (status
& PCI_INT_VIDINT
)
1661 cx8800_vid_irq(dev
);
1664 printk(KERN_WARNING
"%s/0: irq loop -- clearing mask\n",
1666 cx_write(MO_PCI_INTMSK
,0);
1670 return IRQ_RETVAL(handled
);
1673 /* ----------------------------------------------------------- */
1674 /* exported stuff */
1676 static const struct v4l2_file_operations video_fops
=
1678 .owner
= THIS_MODULE
,
1680 .release
= video_release
,
1684 .ioctl
= video_ioctl2
,
1687 static const struct v4l2_ioctl_ops video_ioctl_ops
= {
1688 .vidioc_querycap
= vidioc_querycap
,
1689 .vidioc_enum_fmt_vid_cap
= vidioc_enum_fmt_vid_cap
,
1690 .vidioc_g_fmt_vid_cap
= vidioc_g_fmt_vid_cap
,
1691 .vidioc_try_fmt_vid_cap
= vidioc_try_fmt_vid_cap
,
1692 .vidioc_s_fmt_vid_cap
= vidioc_s_fmt_vid_cap
,
1693 .vidioc_g_fmt_vbi_cap
= cx8800_vbi_fmt
,
1694 .vidioc_try_fmt_vbi_cap
= cx8800_vbi_fmt
,
1695 .vidioc_s_fmt_vbi_cap
= cx8800_vbi_fmt
,
1696 .vidioc_reqbufs
= vidioc_reqbufs
,
1697 .vidioc_querybuf
= vidioc_querybuf
,
1698 .vidioc_qbuf
= vidioc_qbuf
,
1699 .vidioc_dqbuf
= vidioc_dqbuf
,
1700 .vidioc_s_std
= vidioc_s_std
,
1701 .vidioc_enum_input
= vidioc_enum_input
,
1702 .vidioc_g_input
= vidioc_g_input
,
1703 .vidioc_s_input
= vidioc_s_input
,
1704 .vidioc_queryctrl
= vidioc_queryctrl
,
1705 .vidioc_g_ctrl
= vidioc_g_ctrl
,
1706 .vidioc_s_ctrl
= vidioc_s_ctrl
,
1707 .vidioc_streamon
= vidioc_streamon
,
1708 .vidioc_streamoff
= vidioc_streamoff
,
1709 #ifdef CONFIG_VIDEO_V4L1_COMPAT
1710 .vidiocgmbuf
= vidiocgmbuf
,
1712 .vidioc_g_tuner
= vidioc_g_tuner
,
1713 .vidioc_s_tuner
= vidioc_s_tuner
,
1714 .vidioc_g_frequency
= vidioc_g_frequency
,
1715 .vidioc_s_frequency
= vidioc_s_frequency
,
1716 #ifdef CONFIG_VIDEO_ADV_DEBUG
1717 .vidioc_g_register
= vidioc_g_register
,
1718 .vidioc_s_register
= vidioc_s_register
,
1722 static struct video_device cx8800_vbi_template
;
1724 static const struct video_device cx8800_video_template
= {
1725 .name
= "cx8800-video",
1726 .fops
= &video_fops
,
1727 .ioctl_ops
= &video_ioctl_ops
,
1728 .tvnorms
= CX88_NORMS
,
1729 .current_norm
= V4L2_STD_NTSC_M
,
1732 static const struct v4l2_file_operations radio_fops
=
1734 .owner
= THIS_MODULE
,
1736 .release
= video_release
,
1737 .ioctl
= video_ioctl2
,
1740 static const struct v4l2_ioctl_ops radio_ioctl_ops
= {
1741 .vidioc_querycap
= radio_querycap
,
1742 .vidioc_g_tuner
= radio_g_tuner
,
1743 .vidioc_enum_input
= radio_enum_input
,
1744 .vidioc_g_audio
= radio_g_audio
,
1745 .vidioc_s_tuner
= radio_s_tuner
,
1746 .vidioc_s_audio
= radio_s_audio
,
1747 .vidioc_s_input
= radio_s_input
,
1748 .vidioc_queryctrl
= radio_queryctrl
,
1749 .vidioc_g_ctrl
= vidioc_g_ctrl
,
1750 .vidioc_s_ctrl
= vidioc_s_ctrl
,
1751 .vidioc_g_frequency
= vidioc_g_frequency
,
1752 .vidioc_s_frequency
= vidioc_s_frequency
,
1753 #ifdef CONFIG_VIDEO_ADV_DEBUG
1754 .vidioc_g_register
= vidioc_g_register
,
1755 .vidioc_s_register
= vidioc_s_register
,
1759 static const struct video_device cx8800_radio_template
= {
1760 .name
= "cx8800-radio",
1761 .fops
= &radio_fops
,
1762 .ioctl_ops
= &radio_ioctl_ops
,
1765 /* ----------------------------------------------------------- */
1767 static void cx8800_unregister_video(struct cx8800_dev
*dev
)
1769 if (dev
->radio_dev
) {
1770 if (video_is_registered(dev
->radio_dev
))
1771 video_unregister_device(dev
->radio_dev
);
1773 video_device_release(dev
->radio_dev
);
1774 dev
->radio_dev
= NULL
;
1777 if (video_is_registered(dev
->vbi_dev
))
1778 video_unregister_device(dev
->vbi_dev
);
1780 video_device_release(dev
->vbi_dev
);
1781 dev
->vbi_dev
= NULL
;
1783 if (dev
->video_dev
) {
1784 if (video_is_registered(dev
->video_dev
))
1785 video_unregister_device(dev
->video_dev
);
1787 video_device_release(dev
->video_dev
);
1788 dev
->video_dev
= NULL
;
1792 static int __devinit
cx8800_initdev(struct pci_dev
*pci_dev
,
1793 const struct pci_device_id
*pci_id
)
1795 struct cx8800_dev
*dev
;
1796 struct cx88_core
*core
;
1800 dev
= kzalloc(sizeof(*dev
),GFP_KERNEL
);
1806 if (pci_enable_device(pci_dev
)) {
1810 core
= cx88_core_get(dev
->pci
);
1817 /* print pci info */
1818 pci_read_config_byte(pci_dev
, PCI_CLASS_REVISION
, &dev
->pci_rev
);
1819 pci_read_config_byte(pci_dev
, PCI_LATENCY_TIMER
, &dev
->pci_lat
);
1820 printk(KERN_INFO
"%s/0: found at %s, rev: %d, irq: %d, "
1821 "latency: %d, mmio: 0x%llx\n", core
->name
,
1822 pci_name(pci_dev
), dev
->pci_rev
, pci_dev
->irq
,
1823 dev
->pci_lat
,(unsigned long long)pci_resource_start(pci_dev
,0));
1825 pci_set_master(pci_dev
);
1826 if (!pci_dma_supported(pci_dev
,DMA_BIT_MASK(32))) {
1827 printk("%s/0: Oops: no 32bit PCI DMA ???\n",core
->name
);
1832 /* Initialize VBI template */
1833 memcpy( &cx8800_vbi_template
, &cx8800_video_template
,
1834 sizeof(cx8800_vbi_template
) );
1835 strcpy(cx8800_vbi_template
.name
,"cx8800-vbi");
1837 /* initialize driver struct */
1838 spin_lock_init(&dev
->slock
);
1839 core
->tvnorm
= cx8800_video_template
.current_norm
;
1841 /* init video dma queues */
1842 INIT_LIST_HEAD(&dev
->vidq
.active
);
1843 INIT_LIST_HEAD(&dev
->vidq
.queued
);
1844 dev
->vidq
.timeout
.function
= cx8800_vid_timeout
;
1845 dev
->vidq
.timeout
.data
= (unsigned long)dev
;
1846 init_timer(&dev
->vidq
.timeout
);
1847 cx88_risc_stopper(dev
->pci
,&dev
->vidq
.stopper
,
1848 MO_VID_DMACNTRL
,0x11,0x00);
1850 /* init vbi dma queues */
1851 INIT_LIST_HEAD(&dev
->vbiq
.active
);
1852 INIT_LIST_HEAD(&dev
->vbiq
.queued
);
1853 dev
->vbiq
.timeout
.function
= cx8800_vbi_timeout
;
1854 dev
->vbiq
.timeout
.data
= (unsigned long)dev
;
1855 init_timer(&dev
->vbiq
.timeout
);
1856 cx88_risc_stopper(dev
->pci
,&dev
->vbiq
.stopper
,
1857 MO_VID_DMACNTRL
,0x88,0x00);
1860 err
= request_irq(pci_dev
->irq
, cx8800_irq
,
1861 IRQF_SHARED
| IRQF_DISABLED
, core
->name
, dev
);
1863 printk(KERN_ERR
"%s/0: can't get IRQ %d\n",
1864 core
->name
,pci_dev
->irq
);
1867 cx_set(MO_PCI_INTMSK
, core
->pci_irqmask
);
1869 /* load and configure helper modules */
1871 if (core
->board
.audio_chip
== V4L2_IDENT_WM8775
)
1872 v4l2_i2c_new_subdev(&core
->v4l2_dev
, &core
->i2c_adap
,
1873 "wm8775", 0x36 >> 1, NULL
);
1875 if (core
->board
.audio_chip
== V4L2_IDENT_TVAUDIO
) {
1876 /* This probes for a tda9874 as is used on some
1877 Pixelview Ultra boards. */
1878 v4l2_i2c_new_subdev(&core
->v4l2_dev
, &core
->i2c_adap
,
1879 "tvaudio", 0, I2C_ADDRS(0xb0 >> 1));
1882 switch (core
->boardnr
) {
1883 case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD
:
1884 case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD
: {
1885 static const struct i2c_board_info rtc_info
= {
1886 I2C_BOARD_INFO("isl1208", 0x6f)
1889 request_module("rtc-isl1208");
1890 core
->i2c_rtc
= i2c_new_device(&core
->i2c_adap
, &rtc_info
);
1892 /* break intentionally omitted */
1893 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO
:
1894 request_module("ir-kbd-i2c");
1897 /* register v4l devices */
1898 dev
->video_dev
= cx88_vdev_init(core
,dev
->pci
,
1899 &cx8800_video_template
,"video");
1900 video_set_drvdata(dev
->video_dev
, dev
);
1901 err
= video_register_device(dev
->video_dev
,VFL_TYPE_GRABBER
,
1902 video_nr
[core
->nr
]);
1904 printk(KERN_ERR
"%s/0: can't register video device\n",
1908 printk(KERN_INFO
"%s/0: registered device %s [v4l2]\n",
1909 core
->name
, video_device_node_name(dev
->video_dev
));
1911 dev
->vbi_dev
= cx88_vdev_init(core
,dev
->pci
,&cx8800_vbi_template
,"vbi");
1912 video_set_drvdata(dev
->vbi_dev
, dev
);
1913 err
= video_register_device(dev
->vbi_dev
,VFL_TYPE_VBI
,
1916 printk(KERN_ERR
"%s/0: can't register vbi device\n",
1920 printk(KERN_INFO
"%s/0: registered device %s\n",
1921 core
->name
, video_device_node_name(dev
->vbi_dev
));
1923 if (core
->board
.radio
.type
== CX88_RADIO
) {
1924 dev
->radio_dev
= cx88_vdev_init(core
,dev
->pci
,
1925 &cx8800_radio_template
,"radio");
1926 video_set_drvdata(dev
->radio_dev
, dev
);
1927 err
= video_register_device(dev
->radio_dev
,VFL_TYPE_RADIO
,
1928 radio_nr
[core
->nr
]);
1930 printk(KERN_ERR
"%s/0: can't register radio device\n",
1934 printk(KERN_INFO
"%s/0: registered device %s\n",
1935 core
->name
, video_device_node_name(dev
->radio_dev
));
1938 /* everything worked */
1939 pci_set_drvdata(pci_dev
,dev
);
1941 /* initial device configuration */
1942 mutex_lock(&core
->lock
);
1943 cx88_set_tvnorm(core
,core
->tvnorm
);
1944 init_controls(core
);
1945 cx88_video_mux(core
,0);
1946 mutex_unlock(&core
->lock
);
1948 /* start tvaudio thread */
1949 if (core
->board
.tuner_type
!= TUNER_ABSENT
) {
1950 core
->kthread
= kthread_run(cx88_audio_thread
, core
, "cx88 tvaudio");
1951 if (IS_ERR(core
->kthread
)) {
1952 err
= PTR_ERR(core
->kthread
);
1953 printk(KERN_ERR
"%s/0: failed to create cx88 audio thread, err=%d\n",
1960 cx8800_unregister_video(dev
);
1961 free_irq(pci_dev
->irq
, dev
);
1963 cx88_core_put(core
,dev
->pci
);
1969 static void __devexit
cx8800_finidev(struct pci_dev
*pci_dev
)
1971 struct cx8800_dev
*dev
= pci_get_drvdata(pci_dev
);
1972 struct cx88_core
*core
= dev
->core
;
1975 if (core
->kthread
) {
1976 kthread_stop(core
->kthread
);
1977 core
->kthread
= NULL
;
1983 cx88_shutdown(core
); /* FIXME */
1984 pci_disable_device(pci_dev
);
1986 /* unregister stuff */
1988 free_irq(pci_dev
->irq
, dev
);
1989 cx8800_unregister_video(dev
);
1990 pci_set_drvdata(pci_dev
, NULL
);
1993 btcx_riscmem_free(dev
->pci
,&dev
->vidq
.stopper
);
1994 cx88_core_put(core
,dev
->pci
);
1999 static int cx8800_suspend(struct pci_dev
*pci_dev
, pm_message_t state
)
2001 struct cx8800_dev
*dev
= pci_get_drvdata(pci_dev
);
2002 struct cx88_core
*core
= dev
->core
;
2004 /* stop video+vbi capture */
2005 spin_lock(&dev
->slock
);
2006 if (!list_empty(&dev
->vidq
.active
)) {
2007 printk("%s/0: suspend video\n", core
->name
);
2008 stop_video_dma(dev
);
2009 del_timer(&dev
->vidq
.timeout
);
2011 if (!list_empty(&dev
->vbiq
.active
)) {
2012 printk("%s/0: suspend vbi\n", core
->name
);
2013 cx8800_stop_vbi_dma(dev
);
2014 del_timer(&dev
->vbiq
.timeout
);
2016 spin_unlock(&dev
->slock
);
2020 /* FIXME -- shutdown device */
2021 cx88_shutdown(core
);
2023 pci_save_state(pci_dev
);
2024 if (0 != pci_set_power_state(pci_dev
, pci_choose_state(pci_dev
, state
))) {
2025 pci_disable_device(pci_dev
);
2026 dev
->state
.disabled
= 1;
2031 static int cx8800_resume(struct pci_dev
*pci_dev
)
2033 struct cx8800_dev
*dev
= pci_get_drvdata(pci_dev
);
2034 struct cx88_core
*core
= dev
->core
;
2037 if (dev
->state
.disabled
) {
2038 err
=pci_enable_device(pci_dev
);
2040 printk(KERN_ERR
"%s/0: can't enable device\n",
2045 dev
->state
.disabled
= 0;
2047 err
= pci_set_power_state(pci_dev
, PCI_D0
);
2049 printk(KERN_ERR
"%s/0: can't set power state\n", core
->name
);
2050 pci_disable_device(pci_dev
);
2051 dev
->state
.disabled
= 1;
2055 pci_restore_state(pci_dev
);
2057 /* FIXME: re-initialize hardware */
2060 cx88_ir_start(core
);
2062 cx_set(MO_PCI_INTMSK
, core
->pci_irqmask
);
2064 /* restart video+vbi capture */
2065 spin_lock(&dev
->slock
);
2066 if (!list_empty(&dev
->vidq
.active
)) {
2067 printk("%s/0: resume video\n", core
->name
);
2068 restart_video_queue(dev
,&dev
->vidq
);
2070 if (!list_empty(&dev
->vbiq
.active
)) {
2071 printk("%s/0: resume vbi\n", core
->name
);
2072 cx8800_restart_vbi_queue(dev
,&dev
->vbiq
);
2074 spin_unlock(&dev
->slock
);
2080 /* ----------------------------------------------------------- */
2082 static const struct pci_device_id cx8800_pci_tbl
[] = {
2086 .subvendor
= PCI_ANY_ID
,
2087 .subdevice
= PCI_ANY_ID
,
2089 /* --- end of list --- */
2092 MODULE_DEVICE_TABLE(pci
, cx8800_pci_tbl
);
2094 static struct pci_driver cx8800_pci_driver
= {
2096 .id_table
= cx8800_pci_tbl
,
2097 .probe
= cx8800_initdev
,
2098 .remove
= __devexit_p(cx8800_finidev
),
2100 .suspend
= cx8800_suspend
,
2101 .resume
= cx8800_resume
,
2105 static int __init
cx8800_init(void)
2107 printk(KERN_INFO
"cx88/0: cx2388x v4l2 driver version %d.%d.%d loaded\n",
2108 (CX88_VERSION_CODE
>> 16) & 0xff,
2109 (CX88_VERSION_CODE
>> 8) & 0xff,
2110 CX88_VERSION_CODE
& 0xff);
2112 printk(KERN_INFO
"cx2388x: snapshot date %04d-%02d-%02d\n",
2113 SNAPSHOT
/10000, (SNAPSHOT
/100)%100, SNAPSHOT
%100);
2115 return pci_register_driver(&cx8800_pci_driver
);
2118 static void __exit
cx8800_fini(void)
2120 pci_unregister_driver(&cx8800_pci_driver
);
2123 module_init(cx8800_init
);
2124 module_exit(cx8800_fini
);
2126 /* ----------------------------------------------------------- */
2131 * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off