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 /* ------------------------------------------------------------------ */
79 static LIST_HEAD(cx8800_devlist
);
81 /* ------------------------------------------------------------------- */
84 static struct cx8800_fmt formats
[] = {
86 .name
= "8 bpp, gray",
87 .fourcc
= V4L2_PIX_FMT_GREY
,
88 .cxformat
= ColorFormatY8
,
90 .flags
= FORMAT_FLAGS_PACKED
,
92 .name
= "15 bpp RGB, le",
93 .fourcc
= V4L2_PIX_FMT_RGB555
,
94 .cxformat
= ColorFormatRGB15
,
96 .flags
= FORMAT_FLAGS_PACKED
,
98 .name
= "15 bpp RGB, be",
99 .fourcc
= V4L2_PIX_FMT_RGB555X
,
100 .cxformat
= ColorFormatRGB15
| ColorFormatBSWAP
,
102 .flags
= FORMAT_FLAGS_PACKED
,
104 .name
= "16 bpp RGB, le",
105 .fourcc
= V4L2_PIX_FMT_RGB565
,
106 .cxformat
= ColorFormatRGB16
,
108 .flags
= FORMAT_FLAGS_PACKED
,
110 .name
= "16 bpp RGB, be",
111 .fourcc
= V4L2_PIX_FMT_RGB565X
,
112 .cxformat
= ColorFormatRGB16
| ColorFormatBSWAP
,
114 .flags
= FORMAT_FLAGS_PACKED
,
116 .name
= "24 bpp RGB, le",
117 .fourcc
= V4L2_PIX_FMT_BGR24
,
118 .cxformat
= ColorFormatRGB24
,
120 .flags
= FORMAT_FLAGS_PACKED
,
122 .name
= "32 bpp RGB, le",
123 .fourcc
= V4L2_PIX_FMT_BGR32
,
124 .cxformat
= ColorFormatRGB32
,
126 .flags
= FORMAT_FLAGS_PACKED
,
128 .name
= "32 bpp RGB, be",
129 .fourcc
= V4L2_PIX_FMT_RGB32
,
130 .cxformat
= ColorFormatRGB32
| ColorFormatBSWAP
| ColorFormatWSWAP
,
132 .flags
= FORMAT_FLAGS_PACKED
,
134 .name
= "4:2:2, packed, YUYV",
135 .fourcc
= V4L2_PIX_FMT_YUYV
,
136 .cxformat
= ColorFormatYUY2
,
138 .flags
= FORMAT_FLAGS_PACKED
,
140 .name
= "4:2:2, packed, UYVY",
141 .fourcc
= V4L2_PIX_FMT_UYVY
,
142 .cxformat
= ColorFormatYUY2
| ColorFormatBSWAP
,
144 .flags
= FORMAT_FLAGS_PACKED
,
148 static struct cx8800_fmt
* format_by_fourcc(unsigned int fourcc
)
152 for (i
= 0; i
< ARRAY_SIZE(formats
); i
++)
153 if (formats
[i
].fourcc
== fourcc
)
158 /* ------------------------------------------------------------------- */
160 static const struct v4l2_queryctrl no_ctl
= {
162 .flags
= V4L2_CTRL_FLAG_DISABLED
,
165 static struct cx88_ctrl cx8800_ctls
[] = {
169 .id
= V4L2_CID_BRIGHTNESS
,
170 .name
= "Brightness",
174 .default_value
= 0x7f,
175 .type
= V4L2_CTRL_TYPE_INTEGER
,
178 .reg
= MO_CONTR_BRIGHT
,
183 .id
= V4L2_CID_CONTRAST
,
188 .default_value
= 0x3f,
189 .type
= V4L2_CTRL_TYPE_INTEGER
,
192 .reg
= MO_CONTR_BRIGHT
,
202 .default_value
= 0x7f,
203 .type
= V4L2_CTRL_TYPE_INTEGER
,
210 /* strictly, this only describes only U saturation.
211 * V saturation is handled specially through code.
214 .id
= V4L2_CID_SATURATION
,
215 .name
= "Saturation",
219 .default_value
= 0x7f,
220 .type
= V4L2_CTRL_TYPE_INTEGER
,
223 .reg
= MO_UV_SATURATION
,
228 .id
= V4L2_CID_CHROMA_AGC
,
229 .name
= "Chroma AGC",
232 .default_value
= 0x1,
233 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
235 .reg
= MO_INPUT_FORMAT
,
240 .id
= V4L2_CID_COLOR_KILLER
,
241 .name
= "Color killer",
244 .default_value
= 0x1,
245 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
247 .reg
= MO_INPUT_FORMAT
,
253 .id
= V4L2_CID_AUDIO_MUTE
,
258 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
261 .sreg
= SHADOW_AUD_VOL_CTL
,
266 .id
= V4L2_CID_AUDIO_VOLUME
,
271 .default_value
= 0x3f,
272 .type
= V4L2_CTRL_TYPE_INTEGER
,
275 .sreg
= SHADOW_AUD_VOL_CTL
,
280 .id
= V4L2_CID_AUDIO_BALANCE
,
285 .default_value
= 0x40,
286 .type
= V4L2_CTRL_TYPE_INTEGER
,
289 .sreg
= SHADOW_AUD_BAL_CTL
,
294 static const int CX8800_CTLS
= ARRAY_SIZE(cx8800_ctls
);
296 /* Must be sorted from low to high control ID! */
297 const u32 cx88_user_ctrls
[] = {
303 V4L2_CID_AUDIO_VOLUME
,
304 V4L2_CID_AUDIO_BALANCE
,
307 V4L2_CID_COLOR_KILLER
,
310 EXPORT_SYMBOL(cx88_user_ctrls
);
312 static const u32
*ctrl_classes
[] = {
317 int cx8800_ctrl_query(struct cx88_core
*core
, struct v4l2_queryctrl
*qctrl
)
321 if (qctrl
->id
< V4L2_CID_BASE
||
322 qctrl
->id
>= V4L2_CID_LASTP1
)
324 for (i
= 0; i
< CX8800_CTLS
; i
++)
325 if (cx8800_ctls
[i
].v
.id
== qctrl
->id
)
327 if (i
== CX8800_CTLS
) {
331 *qctrl
= cx8800_ctls
[i
].v
;
332 /* Report chroma AGC as inactive when SECAM is selected */
333 if (cx8800_ctls
[i
].v
.id
== V4L2_CID_CHROMA_AGC
&&
334 core
->tvnorm
& V4L2_STD_SECAM
)
335 qctrl
->flags
|= V4L2_CTRL_FLAG_INACTIVE
;
339 EXPORT_SYMBOL(cx8800_ctrl_query
);
341 /* ------------------------------------------------------------------- */
342 /* resource management */
344 static int res_get(struct cx8800_dev
*dev
, struct cx8800_fh
*fh
, unsigned int bit
)
346 struct cx88_core
*core
= dev
->core
;
347 if (fh
->resources
& bit
)
348 /* have it already allocated */
352 mutex_lock(&core
->lock
);
353 if (dev
->resources
& bit
) {
354 /* no, someone else uses it */
355 mutex_unlock(&core
->lock
);
358 /* it's free, grab it */
359 fh
->resources
|= bit
;
360 dev
->resources
|= bit
;
361 dprintk(1,"res: get %d\n",bit
);
362 mutex_unlock(&core
->lock
);
367 int res_check(struct cx8800_fh
*fh
, unsigned int bit
)
369 return (fh
->resources
& bit
);
373 int res_locked(struct cx8800_dev
*dev
, unsigned int bit
)
375 return (dev
->resources
& bit
);
379 void res_free(struct cx8800_dev
*dev
, struct cx8800_fh
*fh
, unsigned int bits
)
381 struct cx88_core
*core
= dev
->core
;
382 BUG_ON((fh
->resources
& bits
) != bits
);
384 mutex_lock(&core
->lock
);
385 fh
->resources
&= ~bits
;
386 dev
->resources
&= ~bits
;
387 dprintk(1,"res: put %d\n",bits
);
388 mutex_unlock(&core
->lock
);
391 /* ------------------------------------------------------------------ */
393 int cx88_video_mux(struct cx88_core
*core
, unsigned int input
)
395 /* struct cx88_core *core = dev->core; */
397 dprintk(1,"video_mux: %d [vmux=%d,gpio=0x%x,0x%x,0x%x,0x%x]\n",
398 input
, INPUT(input
).vmux
,
399 INPUT(input
).gpio0
,INPUT(input
).gpio1
,
400 INPUT(input
).gpio2
,INPUT(input
).gpio3
);
402 cx_andor(MO_INPUT_FORMAT
, 0x03 << 14, INPUT(input
).vmux
<< 14);
403 cx_write(MO_GP3_IO
, INPUT(input
).gpio3
);
404 cx_write(MO_GP0_IO
, INPUT(input
).gpio0
);
405 cx_write(MO_GP1_IO
, INPUT(input
).gpio1
);
406 cx_write(MO_GP2_IO
, INPUT(input
).gpio2
);
408 switch (INPUT(input
).type
) {
409 case CX88_VMUX_SVIDEO
:
410 cx_set(MO_AFECFG_IO
, 0x00000001);
411 cx_set(MO_INPUT_FORMAT
, 0x00010010);
412 cx_set(MO_FILTER_EVEN
, 0x00002020);
413 cx_set(MO_FILTER_ODD
, 0x00002020);
416 cx_clear(MO_AFECFG_IO
, 0x00000001);
417 cx_clear(MO_INPUT_FORMAT
, 0x00010010);
418 cx_clear(MO_FILTER_EVEN
, 0x00002020);
419 cx_clear(MO_FILTER_ODD
, 0x00002020);
423 /* if there are audioroutes defined, we have an external
424 ADC to deal with audio */
425 if (INPUT(input
).audioroute
) {
426 /* The wm8775 module has the "2" route hardwired into
427 the initialization. Some boards may use different
428 routes for different inputs. HVR-1300 surely does */
429 if (core
->board
.audio_chip
&&
430 core
->board
.audio_chip
== V4L2_IDENT_WM8775
) {
431 call_all(core
, audio
, s_routing
,
432 INPUT(input
).audioroute
, 0, 0);
434 /* cx2388's C-ADC is connected to the tuner only.
435 When used with S-Video, that ADC is busy dealing with
436 chroma, so an external must be used for baseband audio */
437 if (INPUT(input
).type
!= CX88_VMUX_TELEVISION
) {
439 core
->tvaudio
= WW_I2SADC
;
440 cx88_set_tvaudio(core
);
443 cx_write(AUD_I2SCNTL
, 0x0);
444 cx_clear(AUD_CTL
, EN_I2SIN_ENABLE
);
450 EXPORT_SYMBOL(cx88_video_mux
);
452 /* ------------------------------------------------------------------ */
454 static int start_video_dma(struct cx8800_dev
*dev
,
455 struct cx88_dmaqueue
*q
,
456 struct cx88_buffer
*buf
)
458 struct cx88_core
*core
= dev
->core
;
460 /* setup fifo + format */
461 cx88_sram_channel_setup(core
, &cx88_sram_channels
[SRAM_CH21
],
462 buf
->bpl
, buf
->risc
.dma
);
463 cx88_set_scale(core
, buf
->vb
.width
, buf
->vb
.height
, buf
->vb
.field
);
464 cx_write(MO_COLOR_CTRL
, buf
->fmt
->cxformat
| ColorFormatGamma
);
467 cx_write(MO_VIDY_GPCNTRL
,GP_COUNT_CONTROL_RESET
);
471 cx_set(MO_PCI_INTMSK
, core
->pci_irqmask
| PCI_INT_VIDINT
);
473 /* Enables corresponding bits at PCI_INT_STAT:
474 bits 0 to 4: video, audio, transport stream, VIP, Host
476 bits 8 and 9: DMA complete for: SRC, DST
477 bits 10 and 11: BERR signal asserted for RISC: RD, WR
478 bits 12 to 15: BERR signal asserted for: BRDG, SRC, DST, IPB
480 cx_set(MO_VID_INTMSK
, 0x0f0011);
483 cx_set(VID_CAPTURE_CONTROL
,0x06);
486 cx_set(MO_DEV_CNTRL2
, (1<<5));
487 cx_set(MO_VID_DMACNTRL
, 0x11); /* Planar Y and packed FIFO and RISC enable */
493 static int stop_video_dma(struct cx8800_dev
*dev
)
495 struct cx88_core
*core
= dev
->core
;
498 cx_clear(MO_VID_DMACNTRL
, 0x11);
500 /* disable capture */
501 cx_clear(VID_CAPTURE_CONTROL
,0x06);
504 cx_clear(MO_PCI_INTMSK
, PCI_INT_VIDINT
);
505 cx_clear(MO_VID_INTMSK
, 0x0f0011);
510 static int restart_video_queue(struct cx8800_dev
*dev
,
511 struct cx88_dmaqueue
*q
)
513 struct cx88_core
*core
= dev
->core
;
514 struct cx88_buffer
*buf
, *prev
;
516 if (!list_empty(&q
->active
)) {
517 buf
= list_entry(q
->active
.next
, struct cx88_buffer
, vb
.queue
);
518 dprintk(2,"restart_queue [%p/%d]: restart dma\n",
520 start_video_dma(dev
, q
, buf
);
521 list_for_each_entry(buf
, &q
->active
, vb
.queue
)
522 buf
->count
= q
->count
++;
523 mod_timer(&q
->timeout
, jiffies
+BUFFER_TIMEOUT
);
529 if (list_empty(&q
->queued
))
531 buf
= list_entry(q
->queued
.next
, struct cx88_buffer
, vb
.queue
);
533 list_move_tail(&buf
->vb
.queue
, &q
->active
);
534 start_video_dma(dev
, q
, buf
);
535 buf
->vb
.state
= VIDEOBUF_ACTIVE
;
536 buf
->count
= q
->count
++;
537 mod_timer(&q
->timeout
, jiffies
+BUFFER_TIMEOUT
);
538 dprintk(2,"[%p/%d] restart_queue - first active\n",
541 } else if (prev
->vb
.width
== buf
->vb
.width
&&
542 prev
->vb
.height
== buf
->vb
.height
&&
543 prev
->fmt
== buf
->fmt
) {
544 list_move_tail(&buf
->vb
.queue
, &q
->active
);
545 buf
->vb
.state
= VIDEOBUF_ACTIVE
;
546 buf
->count
= q
->count
++;
547 prev
->risc
.jmp
[1] = cpu_to_le32(buf
->risc
.dma
);
548 dprintk(2,"[%p/%d] restart_queue - move to active\n",
557 /* ------------------------------------------------------------------ */
560 buffer_setup(struct videobuf_queue
*q
, unsigned int *count
, unsigned int *size
)
562 struct cx8800_fh
*fh
= q
->priv_data
;
564 *size
= fh
->fmt
->depth
*fh
->width
*fh
->height
>> 3;
567 while (*size
* *count
> vid_limit
* 1024 * 1024)
573 buffer_prepare(struct videobuf_queue
*q
, struct videobuf_buffer
*vb
,
574 enum v4l2_field field
)
576 struct cx8800_fh
*fh
= q
->priv_data
;
577 struct cx8800_dev
*dev
= fh
->dev
;
578 struct cx88_core
*core
= dev
->core
;
579 struct cx88_buffer
*buf
= container_of(vb
,struct cx88_buffer
,vb
);
580 struct videobuf_dmabuf
*dma
=videobuf_to_dma(&buf
->vb
);
581 int rc
, init_buffer
= 0;
583 BUG_ON(NULL
== fh
->fmt
);
584 if (fh
->width
< 48 || fh
->width
> norm_maxw(core
->tvnorm
) ||
585 fh
->height
< 32 || fh
->height
> norm_maxh(core
->tvnorm
))
587 buf
->vb
.size
= (fh
->width
* fh
->height
* fh
->fmt
->depth
) >> 3;
588 if (0 != buf
->vb
.baddr
&& buf
->vb
.bsize
< buf
->vb
.size
)
591 if (buf
->fmt
!= fh
->fmt
||
592 buf
->vb
.width
!= fh
->width
||
593 buf
->vb
.height
!= fh
->height
||
594 buf
->vb
.field
!= field
) {
596 buf
->vb
.width
= fh
->width
;
597 buf
->vb
.height
= fh
->height
;
598 buf
->vb
.field
= field
;
602 if (VIDEOBUF_NEEDS_INIT
== buf
->vb
.state
) {
604 if (0 != (rc
= videobuf_iolock(q
,&buf
->vb
,NULL
)))
609 buf
->bpl
= buf
->vb
.width
* buf
->fmt
->depth
>> 3;
610 switch (buf
->vb
.field
) {
612 cx88_risc_buffer(dev
->pci
, &buf
->risc
,
613 dma
->sglist
, 0, UNSET
,
614 buf
->bpl
, 0, buf
->vb
.height
);
616 case V4L2_FIELD_BOTTOM
:
617 cx88_risc_buffer(dev
->pci
, &buf
->risc
,
618 dma
->sglist
, UNSET
, 0,
619 buf
->bpl
, 0, buf
->vb
.height
);
621 case V4L2_FIELD_INTERLACED
:
622 cx88_risc_buffer(dev
->pci
, &buf
->risc
,
623 dma
->sglist
, 0, buf
->bpl
,
625 buf
->vb
.height
>> 1);
627 case V4L2_FIELD_SEQ_TB
:
628 cx88_risc_buffer(dev
->pci
, &buf
->risc
,
630 0, buf
->bpl
* (buf
->vb
.height
>> 1),
632 buf
->vb
.height
>> 1);
634 case V4L2_FIELD_SEQ_BT
:
635 cx88_risc_buffer(dev
->pci
, &buf
->risc
,
637 buf
->bpl
* (buf
->vb
.height
>> 1), 0,
639 buf
->vb
.height
>> 1);
645 dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
647 fh
->width
, fh
->height
, fh
->fmt
->depth
, fh
->fmt
->name
,
648 (unsigned long)buf
->risc
.dma
);
650 buf
->vb
.state
= VIDEOBUF_PREPARED
;
654 cx88_free_buffer(q
,buf
);
659 buffer_queue(struct videobuf_queue
*vq
, struct videobuf_buffer
*vb
)
661 struct cx88_buffer
*buf
= container_of(vb
,struct cx88_buffer
,vb
);
662 struct cx88_buffer
*prev
;
663 struct cx8800_fh
*fh
= vq
->priv_data
;
664 struct cx8800_dev
*dev
= fh
->dev
;
665 struct cx88_core
*core
= dev
->core
;
666 struct cx88_dmaqueue
*q
= &dev
->vidq
;
668 /* add jump to stopper */
669 buf
->risc
.jmp
[0] = cpu_to_le32(RISC_JUMP
| RISC_IRQ1
| RISC_CNT_INC
);
670 buf
->risc
.jmp
[1] = cpu_to_le32(q
->stopper
.dma
);
672 if (!list_empty(&q
->queued
)) {
673 list_add_tail(&buf
->vb
.queue
,&q
->queued
);
674 buf
->vb
.state
= VIDEOBUF_QUEUED
;
675 dprintk(2,"[%p/%d] buffer_queue - append to queued\n",
678 } else if (list_empty(&q
->active
)) {
679 list_add_tail(&buf
->vb
.queue
,&q
->active
);
680 start_video_dma(dev
, q
, buf
);
681 buf
->vb
.state
= VIDEOBUF_ACTIVE
;
682 buf
->count
= q
->count
++;
683 mod_timer(&q
->timeout
, jiffies
+BUFFER_TIMEOUT
);
684 dprintk(2,"[%p/%d] buffer_queue - first active\n",
688 prev
= list_entry(q
->active
.prev
, struct cx88_buffer
, vb
.queue
);
689 if (prev
->vb
.width
== buf
->vb
.width
&&
690 prev
->vb
.height
== buf
->vb
.height
&&
691 prev
->fmt
== buf
->fmt
) {
692 list_add_tail(&buf
->vb
.queue
,&q
->active
);
693 buf
->vb
.state
= VIDEOBUF_ACTIVE
;
694 buf
->count
= q
->count
++;
695 prev
->risc
.jmp
[1] = cpu_to_le32(buf
->risc
.dma
);
696 dprintk(2,"[%p/%d] buffer_queue - append to active\n",
700 list_add_tail(&buf
->vb
.queue
,&q
->queued
);
701 buf
->vb
.state
= VIDEOBUF_QUEUED
;
702 dprintk(2,"[%p/%d] buffer_queue - first queued\n",
708 static void buffer_release(struct videobuf_queue
*q
, struct videobuf_buffer
*vb
)
710 struct cx88_buffer
*buf
= container_of(vb
,struct cx88_buffer
,vb
);
712 cx88_free_buffer(q
,buf
);
715 static struct videobuf_queue_ops cx8800_video_qops
= {
716 .buf_setup
= buffer_setup
,
717 .buf_prepare
= buffer_prepare
,
718 .buf_queue
= buffer_queue
,
719 .buf_release
= buffer_release
,
722 /* ------------------------------------------------------------------ */
725 /* ------------------------------------------------------------------ */
727 static struct videobuf_queue
* get_queue(struct cx8800_fh
*fh
)
730 case V4L2_BUF_TYPE_VIDEO_CAPTURE
:
732 case V4L2_BUF_TYPE_VBI_CAPTURE
:
740 static int get_ressource(struct cx8800_fh
*fh
)
743 case V4L2_BUF_TYPE_VIDEO_CAPTURE
:
744 return RESOURCE_VIDEO
;
745 case V4L2_BUF_TYPE_VBI_CAPTURE
:
753 static int video_open(struct file
*file
)
755 int minor
= video_devdata(file
)->minor
;
756 struct cx8800_dev
*h
,*dev
= NULL
;
757 struct cx88_core
*core
;
758 struct cx8800_fh
*fh
;
759 enum v4l2_buf_type type
= 0;
763 list_for_each_entry(h
, &cx8800_devlist
, devlist
) {
764 if (h
->video_dev
->minor
== minor
) {
766 type
= V4L2_BUF_TYPE_VIDEO_CAPTURE
;
768 if (h
->vbi_dev
->minor
== minor
) {
770 type
= V4L2_BUF_TYPE_VBI_CAPTURE
;
773 h
->radio_dev
->minor
== minor
) {
785 dprintk(1,"open minor=%d radio=%d type=%s\n",
786 minor
,radio
,v4l2_type_names
[type
]);
788 /* allocate + initialize per filehandle data */
789 fh
= kzalloc(sizeof(*fh
),GFP_KERNEL
);
794 file
->private_data
= fh
;
800 fh
->fmt
= format_by_fourcc(V4L2_PIX_FMT_BGR24
);
802 videobuf_queue_sg_init(&fh
->vidq
, &cx8800_video_qops
,
803 &dev
->pci
->dev
, &dev
->slock
,
804 V4L2_BUF_TYPE_VIDEO_CAPTURE
,
805 V4L2_FIELD_INTERLACED
,
806 sizeof(struct cx88_buffer
),
808 videobuf_queue_sg_init(&fh
->vbiq
, &cx8800_vbi_qops
,
809 &dev
->pci
->dev
, &dev
->slock
,
810 V4L2_BUF_TYPE_VBI_CAPTURE
,
812 sizeof(struct cx88_buffer
),
816 dprintk(1,"video_open: setting radio device\n");
817 cx_write(MO_GP3_IO
, core
->board
.radio
.gpio3
);
818 cx_write(MO_GP0_IO
, core
->board
.radio
.gpio0
);
819 cx_write(MO_GP1_IO
, core
->board
.radio
.gpio1
);
820 cx_write(MO_GP2_IO
, core
->board
.radio
.gpio2
);
821 if (core
->board
.radio
.audioroute
) {
822 if(core
->board
.audio_chip
&&
823 core
->board
.audio_chip
== V4L2_IDENT_WM8775
) {
824 call_all(core
, audio
, s_routing
,
825 core
->board
.radio
.audioroute
, 0, 0);
828 core
->tvaudio
= WW_I2SADC
;
829 cx88_set_tvaudio(core
);
832 core
->tvaudio
= WW_FM
;
833 cx88_set_tvaudio(core
);
834 cx88_set_stereo(core
,V4L2_TUNER_MODE_STEREO
,1);
836 call_all(core
, tuner
, s_radio
);
840 atomic_inc(&core
->users
);
846 video_read(struct file
*file
, char __user
*data
, size_t count
, loff_t
*ppos
)
848 struct cx8800_fh
*fh
= file
->private_data
;
851 case V4L2_BUF_TYPE_VIDEO_CAPTURE
:
852 if (res_locked(fh
->dev
,RESOURCE_VIDEO
))
854 return videobuf_read_one(&fh
->vidq
, data
, count
, ppos
,
855 file
->f_flags
& O_NONBLOCK
);
856 case V4L2_BUF_TYPE_VBI_CAPTURE
:
857 if (!res_get(fh
->dev
,fh
,RESOURCE_VBI
))
859 return videobuf_read_stream(&fh
->vbiq
, data
, count
, ppos
, 1,
860 file
->f_flags
& O_NONBLOCK
);
868 video_poll(struct file
*file
, struct poll_table_struct
*wait
)
870 struct cx8800_fh
*fh
= file
->private_data
;
871 struct cx88_buffer
*buf
;
873 if (V4L2_BUF_TYPE_VBI_CAPTURE
== fh
->type
) {
874 if (!res_get(fh
->dev
,fh
,RESOURCE_VBI
))
876 return videobuf_poll_stream(file
, &fh
->vbiq
, wait
);
879 if (res_check(fh
,RESOURCE_VIDEO
)) {
880 /* streaming capture */
881 if (list_empty(&fh
->vidq
.stream
))
883 buf
= list_entry(fh
->vidq
.stream
.next
,struct cx88_buffer
,vb
.stream
);
886 buf
= (struct cx88_buffer
*)fh
->vidq
.read_buf
;
890 poll_wait(file
, &buf
->vb
.done
, wait
);
891 if (buf
->vb
.state
== VIDEOBUF_DONE
||
892 buf
->vb
.state
== VIDEOBUF_ERROR
)
893 return POLLIN
|POLLRDNORM
;
897 static int video_release(struct file
*file
)
899 struct cx8800_fh
*fh
= file
->private_data
;
900 struct cx8800_dev
*dev
= fh
->dev
;
902 /* turn off overlay */
903 if (res_check(fh
, RESOURCE_OVERLAY
)) {
905 res_free(dev
,fh
,RESOURCE_OVERLAY
);
908 /* stop video capture */
909 if (res_check(fh
, RESOURCE_VIDEO
)) {
910 videobuf_queue_cancel(&fh
->vidq
);
911 res_free(dev
,fh
,RESOURCE_VIDEO
);
913 if (fh
->vidq
.read_buf
) {
914 buffer_release(&fh
->vidq
,fh
->vidq
.read_buf
);
915 kfree(fh
->vidq
.read_buf
);
918 /* stop vbi capture */
919 if (res_check(fh
, RESOURCE_VBI
)) {
920 videobuf_stop(&fh
->vbiq
);
921 res_free(dev
,fh
,RESOURCE_VBI
);
924 videobuf_mmap_free(&fh
->vidq
);
925 videobuf_mmap_free(&fh
->vbiq
);
926 file
->private_data
= NULL
;
929 if(atomic_dec_and_test(&dev
->core
->users
))
930 call_all(dev
->core
, tuner
, s_standby
);
936 video_mmap(struct file
*file
, struct vm_area_struct
* vma
)
938 struct cx8800_fh
*fh
= file
->private_data
;
940 return videobuf_mmap_mapper(get_queue(fh
), vma
);
943 /* ------------------------------------------------------------------ */
944 /* VIDEO CTRL IOCTLS */
946 int cx88_get_control (struct cx88_core
*core
, struct v4l2_control
*ctl
)
948 struct cx88_ctrl
*c
= NULL
;
952 for (i
= 0; i
< CX8800_CTLS
; i
++)
953 if (cx8800_ctls
[i
].v
.id
== ctl
->id
)
955 if (unlikely(NULL
== c
))
958 value
= c
->sreg
? cx_sread(c
->sreg
) : cx_read(c
->reg
);
960 case V4L2_CID_AUDIO_BALANCE
:
961 ctl
->value
= ((value
& 0x7f) < 0x40) ? ((value
& 0x7f) + 0x40)
962 : (0x7f - (value
& 0x7f));
964 case V4L2_CID_AUDIO_VOLUME
:
965 ctl
->value
= 0x3f - (value
& 0x3f);
968 ctl
->value
= ((value
+ (c
->off
<< c
->shift
)) & c
->mask
) >> c
->shift
;
971 dprintk(1,"get_control id=0x%X(%s) ctrl=0x%02x, reg=0x%02x val=0x%02x (mask 0x%02x)%s\n",
972 ctl
->id
, c
->v
.name
, ctl
->value
, c
->reg
,
973 value
,c
->mask
, c
->sreg
? " [shadowed]" : "");
976 EXPORT_SYMBOL(cx88_get_control
);
978 int cx88_set_control(struct cx88_core
*core
, struct v4l2_control
*ctl
)
980 struct cx88_ctrl
*c
= NULL
;
984 for (i
= 0; i
< CX8800_CTLS
; i
++) {
985 if (cx8800_ctls
[i
].v
.id
== ctl
->id
) {
989 if (unlikely(NULL
== c
))
992 if (ctl
->value
< c
->v
.minimum
)
993 ctl
->value
= c
->v
.minimum
;
994 if (ctl
->value
> c
->v
.maximum
)
995 ctl
->value
= c
->v
.maximum
;
998 case V4L2_CID_AUDIO_BALANCE
:
999 value
= (ctl
->value
< 0x40) ? (0x7f - ctl
->value
) : (ctl
->value
- 0x40);
1001 case V4L2_CID_AUDIO_VOLUME
:
1002 value
= 0x3f - (ctl
->value
& 0x3f);
1004 case V4L2_CID_SATURATION
:
1005 /* special v_sat handling */
1007 value
= ((ctl
->value
- c
->off
) << c
->shift
) & c
->mask
;
1009 if (core
->tvnorm
& V4L2_STD_SECAM
) {
1010 /* For SECAM, both U and V sat should be equal */
1011 value
=value
<<8|value
;
1013 /* Keeps U Saturation proportional to V Sat */
1014 value
=(value
*0x5a)/0x7f<<8|value
;
1018 case V4L2_CID_CHROMA_AGC
:
1019 /* Do not allow chroma AGC to be enabled for SECAM */
1020 value
= ((ctl
->value
- c
->off
) << c
->shift
) & c
->mask
;
1021 if (core
->tvnorm
& V4L2_STD_SECAM
&& value
)
1025 value
= ((ctl
->value
- c
->off
) << c
->shift
) & c
->mask
;
1028 dprintk(1,"set_control id=0x%X(%s) ctrl=0x%02x, reg=0x%02x val=0x%02x (mask 0x%02x)%s\n",
1029 ctl
->id
, c
->v
.name
, ctl
->value
, c
->reg
, value
,
1030 mask
, c
->sreg
? " [shadowed]" : "");
1032 cx_sandor(c
->sreg
, c
->reg
, mask
, value
);
1034 cx_andor(c
->reg
, mask
, value
);
1038 EXPORT_SYMBOL(cx88_set_control
);
1040 static void init_controls(struct cx88_core
*core
)
1042 struct v4l2_control ctrl
;
1045 for (i
= 0; i
< CX8800_CTLS
; i
++) {
1046 ctrl
.id
=cx8800_ctls
[i
].v
.id
;
1047 ctrl
.value
=cx8800_ctls
[i
].v
.default_value
;
1049 cx88_set_control(core
, &ctrl
);
1053 /* ------------------------------------------------------------------ */
1056 static int vidioc_g_fmt_vid_cap(struct file
*file
, void *priv
,
1057 struct v4l2_format
*f
)
1059 struct cx8800_fh
*fh
= priv
;
1061 f
->fmt
.pix
.width
= fh
->width
;
1062 f
->fmt
.pix
.height
= fh
->height
;
1063 f
->fmt
.pix
.field
= fh
->vidq
.field
;
1064 f
->fmt
.pix
.pixelformat
= fh
->fmt
->fourcc
;
1065 f
->fmt
.pix
.bytesperline
=
1066 (f
->fmt
.pix
.width
* fh
->fmt
->depth
) >> 3;
1067 f
->fmt
.pix
.sizeimage
=
1068 f
->fmt
.pix
.height
* f
->fmt
.pix
.bytesperline
;
1072 static int vidioc_try_fmt_vid_cap(struct file
*file
, void *priv
,
1073 struct v4l2_format
*f
)
1075 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1076 struct cx8800_fmt
*fmt
;
1077 enum v4l2_field field
;
1078 unsigned int maxw
, maxh
;
1080 fmt
= format_by_fourcc(f
->fmt
.pix
.pixelformat
);
1084 field
= f
->fmt
.pix
.field
;
1085 maxw
= norm_maxw(core
->tvnorm
);
1086 maxh
= norm_maxh(core
->tvnorm
);
1088 if (V4L2_FIELD_ANY
== field
) {
1089 field
= (f
->fmt
.pix
.height
> maxh
/2)
1090 ? V4L2_FIELD_INTERLACED
1091 : V4L2_FIELD_BOTTOM
;
1095 case V4L2_FIELD_TOP
:
1096 case V4L2_FIELD_BOTTOM
:
1099 case V4L2_FIELD_INTERLACED
:
1105 f
->fmt
.pix
.field
= field
;
1106 if (f
->fmt
.pix
.height
< 32)
1107 f
->fmt
.pix
.height
= 32;
1108 if (f
->fmt
.pix
.height
> maxh
)
1109 f
->fmt
.pix
.height
= maxh
;
1110 if (f
->fmt
.pix
.width
< 48)
1111 f
->fmt
.pix
.width
= 48;
1112 if (f
->fmt
.pix
.width
> maxw
)
1113 f
->fmt
.pix
.width
= maxw
;
1114 f
->fmt
.pix
.width
&= ~0x03;
1115 f
->fmt
.pix
.bytesperline
=
1116 (f
->fmt
.pix
.width
* fmt
->depth
) >> 3;
1117 f
->fmt
.pix
.sizeimage
=
1118 f
->fmt
.pix
.height
* f
->fmt
.pix
.bytesperline
;
1123 static int vidioc_s_fmt_vid_cap(struct file
*file
, void *priv
,
1124 struct v4l2_format
*f
)
1126 struct cx8800_fh
*fh
= priv
;
1127 int err
= vidioc_try_fmt_vid_cap (file
,priv
,f
);
1131 fh
->fmt
= format_by_fourcc(f
->fmt
.pix
.pixelformat
);
1132 fh
->width
= f
->fmt
.pix
.width
;
1133 fh
->height
= f
->fmt
.pix
.height
;
1134 fh
->vidq
.field
= f
->fmt
.pix
.field
;
1138 static int vidioc_querycap (struct file
*file
, void *priv
,
1139 struct v4l2_capability
*cap
)
1141 struct cx8800_dev
*dev
= ((struct cx8800_fh
*)priv
)->dev
;
1142 struct cx88_core
*core
= dev
->core
;
1144 strcpy(cap
->driver
, "cx8800");
1145 strlcpy(cap
->card
, core
->board
.name
, sizeof(cap
->card
));
1146 sprintf(cap
->bus_info
,"PCI:%s",pci_name(dev
->pci
));
1147 cap
->version
= CX88_VERSION_CODE
;
1149 V4L2_CAP_VIDEO_CAPTURE
|
1150 V4L2_CAP_READWRITE
|
1151 V4L2_CAP_STREAMING
|
1152 V4L2_CAP_VBI_CAPTURE
;
1153 if (UNSET
!= core
->board
.tuner_type
)
1154 cap
->capabilities
|= V4L2_CAP_TUNER
;
1158 static int vidioc_enum_fmt_vid_cap (struct file
*file
, void *priv
,
1159 struct v4l2_fmtdesc
*f
)
1161 if (unlikely(f
->index
>= ARRAY_SIZE(formats
)))
1164 strlcpy(f
->description
,formats
[f
->index
].name
,sizeof(f
->description
));
1165 f
->pixelformat
= formats
[f
->index
].fourcc
;
1170 #ifdef CONFIG_VIDEO_V4L1_COMPAT
1171 static int vidiocgmbuf (struct file
*file
, void *priv
, struct video_mbuf
*mbuf
)
1173 struct cx8800_fh
*fh
= priv
;
1175 return videobuf_cgmbuf (get_queue(fh
), mbuf
, 8);
1179 static int vidioc_reqbufs (struct file
*file
, void *priv
, struct v4l2_requestbuffers
*p
)
1181 struct cx8800_fh
*fh
= priv
;
1182 return (videobuf_reqbufs(get_queue(fh
), p
));
1185 static int vidioc_querybuf (struct file
*file
, void *priv
, struct v4l2_buffer
*p
)
1187 struct cx8800_fh
*fh
= priv
;
1188 return (videobuf_querybuf(get_queue(fh
), p
));
1191 static int vidioc_qbuf (struct file
*file
, void *priv
, struct v4l2_buffer
*p
)
1193 struct cx8800_fh
*fh
= priv
;
1194 return (videobuf_qbuf(get_queue(fh
), p
));
1197 static int vidioc_dqbuf (struct file
*file
, void *priv
, struct v4l2_buffer
*p
)
1199 struct cx8800_fh
*fh
= priv
;
1200 return (videobuf_dqbuf(get_queue(fh
), p
,
1201 file
->f_flags
& O_NONBLOCK
));
1204 static int vidioc_streamon(struct file
*file
, void *priv
, enum v4l2_buf_type i
)
1206 struct cx8800_fh
*fh
= priv
;
1207 struct cx8800_dev
*dev
= fh
->dev
;
1209 /* We should remember that this driver also supports teletext, */
1210 /* so we have to test if the v4l2_buf_type is VBI capture data. */
1211 if (unlikely((fh
->type
!= V4L2_BUF_TYPE_VIDEO_CAPTURE
) &&
1212 (fh
->type
!= V4L2_BUF_TYPE_VBI_CAPTURE
)))
1215 if (unlikely(i
!= fh
->type
))
1218 if (unlikely(!res_get(dev
,fh
,get_ressource(fh
))))
1220 return videobuf_streamon(get_queue(fh
));
1223 static int vidioc_streamoff(struct file
*file
, void *priv
, enum v4l2_buf_type i
)
1225 struct cx8800_fh
*fh
= priv
;
1226 struct cx8800_dev
*dev
= fh
->dev
;
1229 if ((fh
->type
!= V4L2_BUF_TYPE_VIDEO_CAPTURE
) &&
1230 (fh
->type
!= V4L2_BUF_TYPE_VBI_CAPTURE
))
1236 res
= get_ressource(fh
);
1237 err
= videobuf_streamoff(get_queue(fh
));
1240 res_free(dev
,fh
,res
);
1244 static int vidioc_s_std (struct file
*file
, void *priv
, v4l2_std_id
*tvnorms
)
1246 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1248 mutex_lock(&core
->lock
);
1249 cx88_set_tvnorm(core
,*tvnorms
);
1250 mutex_unlock(&core
->lock
);
1255 /* only one input in this sample driver */
1256 int cx88_enum_input (struct cx88_core
*core
,struct v4l2_input
*i
)
1258 static const char *iname
[] = {
1259 [ CX88_VMUX_COMPOSITE1
] = "Composite1",
1260 [ CX88_VMUX_COMPOSITE2
] = "Composite2",
1261 [ CX88_VMUX_COMPOSITE3
] = "Composite3",
1262 [ CX88_VMUX_COMPOSITE4
] = "Composite4",
1263 [ CX88_VMUX_SVIDEO
] = "S-Video",
1264 [ CX88_VMUX_TELEVISION
] = "Television",
1265 [ CX88_VMUX_CABLE
] = "Cable TV",
1266 [ CX88_VMUX_DVB
] = "DVB",
1267 [ CX88_VMUX_DEBUG
] = "for debug only",
1269 unsigned int n
= i
->index
;
1273 if (0 == INPUT(n
).type
)
1275 i
->type
= V4L2_INPUT_TYPE_CAMERA
;
1276 strcpy(i
->name
,iname
[INPUT(n
).type
]);
1277 if ((CX88_VMUX_TELEVISION
== INPUT(n
).type
) ||
1278 (CX88_VMUX_CABLE
== INPUT(n
).type
))
1279 i
->type
= V4L2_INPUT_TYPE_TUNER
;
1280 i
->std
= CX88_NORMS
;
1283 EXPORT_SYMBOL(cx88_enum_input
);
1285 static int vidioc_enum_input (struct file
*file
, void *priv
,
1286 struct v4l2_input
*i
)
1288 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1289 return cx88_enum_input (core
,i
);
1292 static int vidioc_g_input (struct file
*file
, void *priv
, unsigned int *i
)
1294 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1300 static int vidioc_s_input (struct file
*file
, void *priv
, unsigned int i
)
1302 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1307 mutex_lock(&core
->lock
);
1308 cx88_newstation(core
);
1309 cx88_video_mux(core
,i
);
1310 mutex_unlock(&core
->lock
);
1316 static int vidioc_queryctrl (struct file
*file
, void *priv
,
1317 struct v4l2_queryctrl
*qctrl
)
1319 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1321 qctrl
->id
= v4l2_ctrl_next(ctrl_classes
, qctrl
->id
);
1322 if (unlikely(qctrl
->id
== 0))
1324 return cx8800_ctrl_query(core
, qctrl
);
1327 static int vidioc_g_ctrl (struct file
*file
, void *priv
,
1328 struct v4l2_control
*ctl
)
1330 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1332 cx88_get_control(core
,ctl
);
1335 static int vidioc_s_ctrl (struct file
*file
, void *priv
,
1336 struct v4l2_control
*ctl
)
1338 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1340 cx88_set_control(core
,ctl
);
1343 static int vidioc_g_tuner (struct file
*file
, void *priv
,
1344 struct v4l2_tuner
*t
)
1346 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1349 if (unlikely(UNSET
== core
->board
.tuner_type
))
1354 strcpy(t
->name
, "Television");
1355 t
->type
= V4L2_TUNER_ANALOG_TV
;
1356 t
->capability
= V4L2_TUNER_CAP_NORM
;
1357 t
->rangehigh
= 0xffffffffUL
;
1359 cx88_get_stereo(core
,t
);
1360 reg
= cx_read(MO_DEVICE_STATUS
);
1361 t
->signal
= (reg
& (1<<5)) ? 0xffff : 0x0000;
1365 static int vidioc_s_tuner (struct file
*file
, void *priv
,
1366 struct v4l2_tuner
*t
)
1368 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1370 if (UNSET
== core
->board
.tuner_type
)
1375 cx88_set_stereo(core
, t
->audmode
, 1);
1379 static int vidioc_g_frequency (struct file
*file
, void *priv
,
1380 struct v4l2_frequency
*f
)
1382 struct cx8800_fh
*fh
= priv
;
1383 struct cx88_core
*core
= fh
->dev
->core
;
1385 if (unlikely(UNSET
== core
->board
.tuner_type
))
1388 /* f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; */
1389 f
->type
= fh
->radio
? V4L2_TUNER_RADIO
: V4L2_TUNER_ANALOG_TV
;
1390 f
->frequency
= core
->freq
;
1392 call_all(core
, tuner
, g_frequency
, f
);
1397 int cx88_set_freq (struct cx88_core
*core
,
1398 struct v4l2_frequency
*f
)
1400 if (unlikely(UNSET
== core
->board
.tuner_type
))
1402 if (unlikely(f
->tuner
!= 0))
1405 mutex_lock(&core
->lock
);
1406 core
->freq
= f
->frequency
;
1407 cx88_newstation(core
);
1408 call_all(core
, tuner
, s_frequency
, f
);
1410 /* When changing channels it is required to reset TVAUDIO */
1412 cx88_set_tvaudio(core
);
1414 mutex_unlock(&core
->lock
);
1418 EXPORT_SYMBOL(cx88_set_freq
);
1420 static int vidioc_s_frequency (struct file
*file
, void *priv
,
1421 struct v4l2_frequency
*f
)
1423 struct cx8800_fh
*fh
= priv
;
1424 struct cx88_core
*core
= fh
->dev
->core
;
1426 if (unlikely(0 == fh
->radio
&& f
->type
!= V4L2_TUNER_ANALOG_TV
))
1428 if (unlikely(1 == fh
->radio
&& f
->type
!= V4L2_TUNER_RADIO
))
1432 cx88_set_freq (core
,f
);
1435 #ifdef CONFIG_VIDEO_ADV_DEBUG
1436 static int vidioc_g_register (struct file
*file
, void *fh
,
1437 struct v4l2_dbg_register
*reg
)
1439 struct cx88_core
*core
= ((struct cx8800_fh
*)fh
)->dev
->core
;
1441 if (!v4l2_chip_match_host(®
->match
))
1443 /* cx2388x has a 24-bit register space */
1444 reg
->val
= cx_read(reg
->reg
& 0xffffff);
1449 static int vidioc_s_register (struct file
*file
, void *fh
,
1450 struct v4l2_dbg_register
*reg
)
1452 struct cx88_core
*core
= ((struct cx8800_fh
*)fh
)->dev
->core
;
1454 if (!v4l2_chip_match_host(®
->match
))
1456 cx_write(reg
->reg
& 0xffffff, reg
->val
);
1461 /* ----------------------------------------------------------- */
1462 /* RADIO ESPECIFIC IOCTLS */
1463 /* ----------------------------------------------------------- */
1465 static int radio_querycap (struct file
*file
, void *priv
,
1466 struct v4l2_capability
*cap
)
1468 struct cx8800_dev
*dev
= ((struct cx8800_fh
*)priv
)->dev
;
1469 struct cx88_core
*core
= dev
->core
;
1471 strcpy(cap
->driver
, "cx8800");
1472 strlcpy(cap
->card
, core
->board
.name
, sizeof(cap
->card
));
1473 sprintf(cap
->bus_info
,"PCI:%s", pci_name(dev
->pci
));
1474 cap
->version
= CX88_VERSION_CODE
;
1475 cap
->capabilities
= V4L2_CAP_TUNER
;
1479 static int radio_g_tuner (struct file
*file
, void *priv
,
1480 struct v4l2_tuner
*t
)
1482 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1484 if (unlikely(t
->index
> 0))
1487 strcpy(t
->name
, "Radio");
1488 t
->type
= V4L2_TUNER_RADIO
;
1490 call_all(core
, tuner
, g_tuner
, t
);
1494 static int radio_enum_input (struct file
*file
, void *priv
,
1495 struct v4l2_input
*i
)
1499 strcpy(i
->name
,"Radio");
1500 i
->type
= V4L2_INPUT_TYPE_TUNER
;
1505 static int radio_g_audio (struct file
*file
, void *priv
, struct v4l2_audio
*a
)
1507 if (unlikely(a
->index
))
1510 strcpy(a
->name
,"Radio");
1514 /* FIXME: Should add a standard for radio */
1516 static int radio_s_tuner (struct file
*file
, void *priv
,
1517 struct v4l2_tuner
*t
)
1519 struct cx88_core
*core
= ((struct cx8800_fh
*)priv
)->dev
->core
;
1524 call_all(core
, tuner
, s_tuner
, t
);
1529 static int radio_s_audio (struct file
*file
, void *fh
,
1530 struct v4l2_audio
*a
)
1535 static int radio_s_input (struct file
*file
, void *fh
, unsigned int i
)
1540 static int radio_queryctrl (struct file
*file
, void *priv
,
1541 struct v4l2_queryctrl
*c
)
1545 if (c
->id
< V4L2_CID_BASE
||
1546 c
->id
>= V4L2_CID_LASTP1
)
1548 if (c
->id
== V4L2_CID_AUDIO_MUTE
) {
1549 for (i
= 0; i
< CX8800_CTLS
; i
++)
1550 if (cx8800_ctls
[i
].v
.id
== c
->id
)
1552 *c
= cx8800_ctls
[i
].v
;
1558 /* ----------------------------------------------------------- */
1560 static void cx8800_vid_timeout(unsigned long data
)
1562 struct cx8800_dev
*dev
= (struct cx8800_dev
*)data
;
1563 struct cx88_core
*core
= dev
->core
;
1564 struct cx88_dmaqueue
*q
= &dev
->vidq
;
1565 struct cx88_buffer
*buf
;
1566 unsigned long flags
;
1568 cx88_sram_channel_dump(core
, &cx88_sram_channels
[SRAM_CH21
]);
1570 cx_clear(MO_VID_DMACNTRL
, 0x11);
1571 cx_clear(VID_CAPTURE_CONTROL
, 0x06);
1573 spin_lock_irqsave(&dev
->slock
,flags
);
1574 while (!list_empty(&q
->active
)) {
1575 buf
= list_entry(q
->active
.next
, struct cx88_buffer
, vb
.queue
);
1576 list_del(&buf
->vb
.queue
);
1577 buf
->vb
.state
= VIDEOBUF_ERROR
;
1578 wake_up(&buf
->vb
.done
);
1579 printk("%s/0: [%p/%d] timeout - dma=0x%08lx\n", core
->name
,
1580 buf
, buf
->vb
.i
, (unsigned long)buf
->risc
.dma
);
1582 restart_video_queue(dev
,q
);
1583 spin_unlock_irqrestore(&dev
->slock
,flags
);
1586 static char *cx88_vid_irqs
[32] = {
1587 "y_risci1", "u_risci1", "v_risci1", "vbi_risc1",
1588 "y_risci2", "u_risci2", "v_risci2", "vbi_risc2",
1589 "y_oflow", "u_oflow", "v_oflow", "vbi_oflow",
1590 "y_sync", "u_sync", "v_sync", "vbi_sync",
1591 "opc_err", "par_err", "rip_err", "pci_abort",
1594 static void cx8800_vid_irq(struct cx8800_dev
*dev
)
1596 struct cx88_core
*core
= dev
->core
;
1597 u32 status
, mask
, count
;
1599 status
= cx_read(MO_VID_INTSTAT
);
1600 mask
= cx_read(MO_VID_INTMSK
);
1601 if (0 == (status
& mask
))
1603 cx_write(MO_VID_INTSTAT
, status
);
1604 if (irq_debug
|| (status
& mask
& ~0xff))
1605 cx88_print_irqbits(core
->name
, "irq vid",
1606 cx88_vid_irqs
, ARRAY_SIZE(cx88_vid_irqs
),
1609 /* risc op code error */
1610 if (status
& (1 << 16)) {
1611 printk(KERN_WARNING
"%s/0: video risc op code error\n",core
->name
);
1612 cx_clear(MO_VID_DMACNTRL
, 0x11);
1613 cx_clear(VID_CAPTURE_CONTROL
, 0x06);
1614 cx88_sram_channel_dump(core
, &cx88_sram_channels
[SRAM_CH21
]);
1618 if (status
& 0x01) {
1619 spin_lock(&dev
->slock
);
1620 count
= cx_read(MO_VIDY_GPCNT
);
1621 cx88_wakeup(core
, &dev
->vidq
, count
);
1622 spin_unlock(&dev
->slock
);
1626 if (status
& 0x08) {
1627 spin_lock(&dev
->slock
);
1628 count
= cx_read(MO_VBI_GPCNT
);
1629 cx88_wakeup(core
, &dev
->vbiq
, count
);
1630 spin_unlock(&dev
->slock
);
1634 if (status
& 0x10) {
1635 dprintk(2,"stopper video\n");
1636 spin_lock(&dev
->slock
);
1637 restart_video_queue(dev
,&dev
->vidq
);
1638 spin_unlock(&dev
->slock
);
1642 if (status
& 0x80) {
1643 dprintk(2,"stopper vbi\n");
1644 spin_lock(&dev
->slock
);
1645 cx8800_restart_vbi_queue(dev
,&dev
->vbiq
);
1646 spin_unlock(&dev
->slock
);
1650 static irqreturn_t
cx8800_irq(int irq
, void *dev_id
)
1652 struct cx8800_dev
*dev
= dev_id
;
1653 struct cx88_core
*core
= dev
->core
;
1655 int loop
, handled
= 0;
1657 for (loop
= 0; loop
< 10; loop
++) {
1658 status
= cx_read(MO_PCI_INTSTAT
) &
1659 (core
->pci_irqmask
| PCI_INT_VIDINT
);
1662 cx_write(MO_PCI_INTSTAT
, status
);
1665 if (status
& core
->pci_irqmask
)
1666 cx88_core_irq(core
,status
);
1667 if (status
& PCI_INT_VIDINT
)
1668 cx8800_vid_irq(dev
);
1671 printk(KERN_WARNING
"%s/0: irq loop -- clearing mask\n",
1673 cx_write(MO_PCI_INTMSK
,0);
1677 return IRQ_RETVAL(handled
);
1680 /* ----------------------------------------------------------- */
1681 /* exported stuff */
1683 static const struct v4l2_file_operations video_fops
=
1685 .owner
= THIS_MODULE
,
1687 .release
= video_release
,
1691 .ioctl
= video_ioctl2
,
1694 static const struct v4l2_ioctl_ops video_ioctl_ops
= {
1695 .vidioc_querycap
= vidioc_querycap
,
1696 .vidioc_enum_fmt_vid_cap
= vidioc_enum_fmt_vid_cap
,
1697 .vidioc_g_fmt_vid_cap
= vidioc_g_fmt_vid_cap
,
1698 .vidioc_try_fmt_vid_cap
= vidioc_try_fmt_vid_cap
,
1699 .vidioc_s_fmt_vid_cap
= vidioc_s_fmt_vid_cap
,
1700 .vidioc_g_fmt_vbi_cap
= cx8800_vbi_fmt
,
1701 .vidioc_try_fmt_vbi_cap
= cx8800_vbi_fmt
,
1702 .vidioc_s_fmt_vbi_cap
= cx8800_vbi_fmt
,
1703 .vidioc_reqbufs
= vidioc_reqbufs
,
1704 .vidioc_querybuf
= vidioc_querybuf
,
1705 .vidioc_qbuf
= vidioc_qbuf
,
1706 .vidioc_dqbuf
= vidioc_dqbuf
,
1707 .vidioc_s_std
= vidioc_s_std
,
1708 .vidioc_enum_input
= vidioc_enum_input
,
1709 .vidioc_g_input
= vidioc_g_input
,
1710 .vidioc_s_input
= vidioc_s_input
,
1711 .vidioc_queryctrl
= vidioc_queryctrl
,
1712 .vidioc_g_ctrl
= vidioc_g_ctrl
,
1713 .vidioc_s_ctrl
= vidioc_s_ctrl
,
1714 .vidioc_streamon
= vidioc_streamon
,
1715 .vidioc_streamoff
= vidioc_streamoff
,
1716 #ifdef CONFIG_VIDEO_V4L1_COMPAT
1717 .vidiocgmbuf
= vidiocgmbuf
,
1719 .vidioc_g_tuner
= vidioc_g_tuner
,
1720 .vidioc_s_tuner
= vidioc_s_tuner
,
1721 .vidioc_g_frequency
= vidioc_g_frequency
,
1722 .vidioc_s_frequency
= vidioc_s_frequency
,
1723 #ifdef CONFIG_VIDEO_ADV_DEBUG
1724 .vidioc_g_register
= vidioc_g_register
,
1725 .vidioc_s_register
= vidioc_s_register
,
1729 static struct video_device cx8800_vbi_template
;
1731 static struct video_device cx8800_video_template
= {
1732 .name
= "cx8800-video",
1733 .fops
= &video_fops
,
1735 .ioctl_ops
= &video_ioctl_ops
,
1736 .tvnorms
= CX88_NORMS
,
1737 .current_norm
= V4L2_STD_NTSC_M
,
1740 static const struct v4l2_file_operations radio_fops
=
1742 .owner
= THIS_MODULE
,
1744 .release
= video_release
,
1745 .ioctl
= video_ioctl2
,
1748 static const struct v4l2_ioctl_ops radio_ioctl_ops
= {
1749 .vidioc_querycap
= radio_querycap
,
1750 .vidioc_g_tuner
= radio_g_tuner
,
1751 .vidioc_enum_input
= radio_enum_input
,
1752 .vidioc_g_audio
= radio_g_audio
,
1753 .vidioc_s_tuner
= radio_s_tuner
,
1754 .vidioc_s_audio
= radio_s_audio
,
1755 .vidioc_s_input
= radio_s_input
,
1756 .vidioc_queryctrl
= radio_queryctrl
,
1757 .vidioc_g_ctrl
= vidioc_g_ctrl
,
1758 .vidioc_s_ctrl
= vidioc_s_ctrl
,
1759 .vidioc_g_frequency
= vidioc_g_frequency
,
1760 .vidioc_s_frequency
= vidioc_s_frequency
,
1761 #ifdef CONFIG_VIDEO_ADV_DEBUG
1762 .vidioc_g_register
= vidioc_g_register
,
1763 .vidioc_s_register
= vidioc_s_register
,
1767 static struct video_device cx8800_radio_template
= {
1768 .name
= "cx8800-radio",
1769 .fops
= &radio_fops
,
1771 .ioctl_ops
= &radio_ioctl_ops
,
1774 /* ----------------------------------------------------------- */
1776 static void cx8800_unregister_video(struct cx8800_dev
*dev
)
1778 if (dev
->radio_dev
) {
1779 if (-1 != dev
->radio_dev
->minor
)
1780 video_unregister_device(dev
->radio_dev
);
1782 video_device_release(dev
->radio_dev
);
1783 dev
->radio_dev
= NULL
;
1786 if (-1 != dev
->vbi_dev
->minor
)
1787 video_unregister_device(dev
->vbi_dev
);
1789 video_device_release(dev
->vbi_dev
);
1790 dev
->vbi_dev
= NULL
;
1792 if (dev
->video_dev
) {
1793 if (-1 != dev
->video_dev
->minor
)
1794 video_unregister_device(dev
->video_dev
);
1796 video_device_release(dev
->video_dev
);
1797 dev
->video_dev
= NULL
;
1801 static int __devinit
cx8800_initdev(struct pci_dev
*pci_dev
,
1802 const struct pci_device_id
*pci_id
)
1804 struct cx8800_dev
*dev
;
1805 struct cx88_core
*core
;
1809 dev
= kzalloc(sizeof(*dev
),GFP_KERNEL
);
1815 if (pci_enable_device(pci_dev
)) {
1819 core
= cx88_core_get(dev
->pci
);
1826 /* print pci info */
1827 pci_read_config_byte(pci_dev
, PCI_CLASS_REVISION
, &dev
->pci_rev
);
1828 pci_read_config_byte(pci_dev
, PCI_LATENCY_TIMER
, &dev
->pci_lat
);
1829 printk(KERN_INFO
"%s/0: found at %s, rev: %d, irq: %d, "
1830 "latency: %d, mmio: 0x%llx\n", core
->name
,
1831 pci_name(pci_dev
), dev
->pci_rev
, pci_dev
->irq
,
1832 dev
->pci_lat
,(unsigned long long)pci_resource_start(pci_dev
,0));
1834 pci_set_master(pci_dev
);
1835 if (!pci_dma_supported(pci_dev
,DMA_BIT_MASK(32))) {
1836 printk("%s/0: Oops: no 32bit PCI DMA ???\n",core
->name
);
1841 /* Initialize VBI template */
1842 memcpy( &cx8800_vbi_template
, &cx8800_video_template
,
1843 sizeof(cx8800_vbi_template
) );
1844 strcpy(cx8800_vbi_template
.name
,"cx8800-vbi");
1846 /* initialize driver struct */
1847 spin_lock_init(&dev
->slock
);
1848 core
->tvnorm
= cx8800_video_template
.current_norm
;
1850 /* init video dma queues */
1851 INIT_LIST_HEAD(&dev
->vidq
.active
);
1852 INIT_LIST_HEAD(&dev
->vidq
.queued
);
1853 dev
->vidq
.timeout
.function
= cx8800_vid_timeout
;
1854 dev
->vidq
.timeout
.data
= (unsigned long)dev
;
1855 init_timer(&dev
->vidq
.timeout
);
1856 cx88_risc_stopper(dev
->pci
,&dev
->vidq
.stopper
,
1857 MO_VID_DMACNTRL
,0x11,0x00);
1859 /* init vbi dma queues */
1860 INIT_LIST_HEAD(&dev
->vbiq
.active
);
1861 INIT_LIST_HEAD(&dev
->vbiq
.queued
);
1862 dev
->vbiq
.timeout
.function
= cx8800_vbi_timeout
;
1863 dev
->vbiq
.timeout
.data
= (unsigned long)dev
;
1864 init_timer(&dev
->vbiq
.timeout
);
1865 cx88_risc_stopper(dev
->pci
,&dev
->vbiq
.stopper
,
1866 MO_VID_DMACNTRL
,0x88,0x00);
1869 err
= request_irq(pci_dev
->irq
, cx8800_irq
,
1870 IRQF_SHARED
| IRQF_DISABLED
, core
->name
, dev
);
1872 printk(KERN_ERR
"%s/0: can't get IRQ %d\n",
1873 core
->name
,pci_dev
->irq
);
1876 cx_set(MO_PCI_INTMSK
, core
->pci_irqmask
);
1878 /* load and configure helper modules */
1880 if (core
->board
.audio_chip
== V4L2_IDENT_WM8775
)
1881 v4l2_i2c_new_subdev(&core
->v4l2_dev
, &core
->i2c_adap
,
1882 "wm8775", "wm8775", 0x36 >> 1);
1884 if (core
->board
.audio_chip
== V4L2_IDENT_TVAUDIO
) {
1885 /* This probes for a tda9874 as is used on some
1886 Pixelview Ultra boards. */
1887 v4l2_i2c_new_probed_subdev_addr(&core
->v4l2_dev
,
1889 "tvaudio", "tvaudio", 0xb0 >> 1);
1892 switch (core
->boardnr
) {
1893 case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD
:
1894 case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD
: {
1895 static struct i2c_board_info rtc_info
= {
1896 I2C_BOARD_INFO("isl1208", 0x6f)
1899 request_module("rtc-isl1208");
1900 core
->i2c_rtc
= i2c_new_device(&core
->i2c_adap
, &rtc_info
);
1902 /* break intentionally omitted */
1903 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO
:
1904 request_module("ir-kbd-i2c");
1907 /* register v4l devices */
1908 dev
->video_dev
= cx88_vdev_init(core
,dev
->pci
,
1909 &cx8800_video_template
,"video");
1910 err
= video_register_device(dev
->video_dev
,VFL_TYPE_GRABBER
,
1911 video_nr
[core
->nr
]);
1913 printk(KERN_ERR
"%s/0: can't register video device\n",
1917 printk(KERN_INFO
"%s/0: registered device video%d [v4l2]\n",
1918 core
->name
, dev
->video_dev
->num
);
1920 dev
->vbi_dev
= cx88_vdev_init(core
,dev
->pci
,&cx8800_vbi_template
,"vbi");
1921 err
= video_register_device(dev
->vbi_dev
,VFL_TYPE_VBI
,
1924 printk(KERN_ERR
"%s/0: can't register vbi device\n",
1928 printk(KERN_INFO
"%s/0: registered device vbi%d\n",
1929 core
->name
, dev
->vbi_dev
->num
);
1931 if (core
->board
.radio
.type
== CX88_RADIO
) {
1932 dev
->radio_dev
= cx88_vdev_init(core
,dev
->pci
,
1933 &cx8800_radio_template
,"radio");
1934 err
= video_register_device(dev
->radio_dev
,VFL_TYPE_RADIO
,
1935 radio_nr
[core
->nr
]);
1937 printk(KERN_ERR
"%s/0: can't register radio device\n",
1941 printk(KERN_INFO
"%s/0: registered device radio%d\n",
1942 core
->name
, dev
->radio_dev
->num
);
1945 /* everything worked */
1946 list_add_tail(&dev
->devlist
,&cx8800_devlist
);
1947 pci_set_drvdata(pci_dev
,dev
);
1949 /* initial device configuration */
1950 mutex_lock(&core
->lock
);
1951 cx88_set_tvnorm(core
,core
->tvnorm
);
1952 init_controls(core
);
1953 cx88_video_mux(core
,0);
1954 mutex_unlock(&core
->lock
);
1956 /* start tvaudio thread */
1957 if (core
->board
.tuner_type
!= TUNER_ABSENT
) {
1958 core
->kthread
= kthread_run(cx88_audio_thread
, core
, "cx88 tvaudio");
1959 if (IS_ERR(core
->kthread
)) {
1960 err
= PTR_ERR(core
->kthread
);
1961 printk(KERN_ERR
"%s/0: failed to create cx88 audio thread, err=%d\n",
1968 cx8800_unregister_video(dev
);
1969 free_irq(pci_dev
->irq
, dev
);
1971 cx88_core_put(core
,dev
->pci
);
1977 static void __devexit
cx8800_finidev(struct pci_dev
*pci_dev
)
1979 struct cx8800_dev
*dev
= pci_get_drvdata(pci_dev
);
1980 struct cx88_core
*core
= dev
->core
;
1983 if (core
->kthread
) {
1984 kthread_stop(core
->kthread
);
1985 core
->kthread
= NULL
;
1989 cx88_ir_stop(core
, core
->ir
);
1991 cx88_shutdown(core
); /* FIXME */
1992 pci_disable_device(pci_dev
);
1994 /* unregister stuff */
1996 free_irq(pci_dev
->irq
, dev
);
1997 cx8800_unregister_video(dev
);
1998 pci_set_drvdata(pci_dev
, NULL
);
2001 btcx_riscmem_free(dev
->pci
,&dev
->vidq
.stopper
);
2002 list_del(&dev
->devlist
);
2003 cx88_core_put(core
,dev
->pci
);
2008 static int cx8800_suspend(struct pci_dev
*pci_dev
, pm_message_t state
)
2010 struct cx8800_dev
*dev
= pci_get_drvdata(pci_dev
);
2011 struct cx88_core
*core
= dev
->core
;
2013 /* stop video+vbi capture */
2014 spin_lock(&dev
->slock
);
2015 if (!list_empty(&dev
->vidq
.active
)) {
2016 printk("%s/0: suspend video\n", core
->name
);
2017 stop_video_dma(dev
);
2018 del_timer(&dev
->vidq
.timeout
);
2020 if (!list_empty(&dev
->vbiq
.active
)) {
2021 printk("%s/0: suspend vbi\n", core
->name
);
2022 cx8800_stop_vbi_dma(dev
);
2023 del_timer(&dev
->vbiq
.timeout
);
2025 spin_unlock(&dev
->slock
);
2028 cx88_ir_stop(core
, core
->ir
);
2029 /* FIXME -- shutdown device */
2030 cx88_shutdown(core
);
2032 pci_save_state(pci_dev
);
2033 if (0 != pci_set_power_state(pci_dev
, pci_choose_state(pci_dev
, state
))) {
2034 pci_disable_device(pci_dev
);
2035 dev
->state
.disabled
= 1;
2040 static int cx8800_resume(struct pci_dev
*pci_dev
)
2042 struct cx8800_dev
*dev
= pci_get_drvdata(pci_dev
);
2043 struct cx88_core
*core
= dev
->core
;
2046 if (dev
->state
.disabled
) {
2047 err
=pci_enable_device(pci_dev
);
2049 printk(KERN_ERR
"%s/0: can't enable device\n",
2054 dev
->state
.disabled
= 0;
2056 err
= pci_set_power_state(pci_dev
, PCI_D0
);
2058 printk(KERN_ERR
"%s/0: can't set power state\n", core
->name
);
2059 pci_disable_device(pci_dev
);
2060 dev
->state
.disabled
= 1;
2064 pci_restore_state(pci_dev
);
2066 /* FIXME: re-initialize hardware */
2069 cx88_ir_start(core
, core
->ir
);
2071 cx_set(MO_PCI_INTMSK
, core
->pci_irqmask
);
2073 /* restart video+vbi capture */
2074 spin_lock(&dev
->slock
);
2075 if (!list_empty(&dev
->vidq
.active
)) {
2076 printk("%s/0: resume video\n", core
->name
);
2077 restart_video_queue(dev
,&dev
->vidq
);
2079 if (!list_empty(&dev
->vbiq
.active
)) {
2080 printk("%s/0: resume vbi\n", core
->name
);
2081 cx8800_restart_vbi_queue(dev
,&dev
->vbiq
);
2083 spin_unlock(&dev
->slock
);
2089 /* ----------------------------------------------------------- */
2091 static struct pci_device_id cx8800_pci_tbl
[] = {
2095 .subvendor
= PCI_ANY_ID
,
2096 .subdevice
= PCI_ANY_ID
,
2098 /* --- end of list --- */
2101 MODULE_DEVICE_TABLE(pci
, cx8800_pci_tbl
);
2103 static struct pci_driver cx8800_pci_driver
= {
2105 .id_table
= cx8800_pci_tbl
,
2106 .probe
= cx8800_initdev
,
2107 .remove
= __devexit_p(cx8800_finidev
),
2109 .suspend
= cx8800_suspend
,
2110 .resume
= cx8800_resume
,
2114 static int cx8800_init(void)
2116 printk(KERN_INFO
"cx88/0: cx2388x v4l2 driver version %d.%d.%d loaded\n",
2117 (CX88_VERSION_CODE
>> 16) & 0xff,
2118 (CX88_VERSION_CODE
>> 8) & 0xff,
2119 CX88_VERSION_CODE
& 0xff);
2121 printk(KERN_INFO
"cx2388x: snapshot date %04d-%02d-%02d\n",
2122 SNAPSHOT
/10000, (SNAPSHOT
/100)%100, SNAPSHOT
%100);
2124 return pci_register_driver(&cx8800_pci_driver
);
2127 static void cx8800_fini(void)
2129 pci_unregister_driver(&cx8800_pci_driver
);
2132 module_init(cx8800_init
);
2133 module_exit(cx8800_fini
);
2135 /* ----------------------------------------------------------- */
2140 * 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