diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/pci/cx25821/cx25821-core.c | 13 | ||||
-rw-r--r-- | drivers/media/pci/cx25821/cx25821-video.c | 201 | ||||
-rw-r--r-- | drivers/media/pci/cx25821/cx25821-video.h | 1 | ||||
-rw-r--r-- | drivers/media/pci/cx25821/cx25821.h | 16 |
4 files changed, 88 insertions, 143 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c index 1f47422d4889..2b38a5005d0e 100644 --- a/drivers/media/pci/cx25821/cx25821-core.c +++ b/drivers/media/pci/cx25821/cx25821-core.c | |||
@@ -988,17 +988,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) | |||
988 | 988 | ||
989 | cx25821_video_register(dev); | 989 | cx25821_video_register(dev); |
990 | 990 | ||
991 | /* register IOCTL device */ | ||
992 | dev->ioctl_dev = cx25821_vdev_init(dev, dev->pci, | ||
993 | &cx25821_videoioctl_template, "video"); | ||
994 | |||
995 | if (video_register_device | ||
996 | (dev->ioctl_dev, VFL_TYPE_GRABBER, VIDEO_IOCTL_CH) < 0) { | ||
997 | cx25821_videoioctl_unregister(dev); | ||
998 | pr_err("%s(): Failed to register video adapter for IOCTL, so unregistering videoioctl device\n", | ||
999 | __func__); | ||
1000 | } | ||
1001 | |||
1002 | cx25821_dev_checkrevision(dev); | 991 | cx25821_dev_checkrevision(dev); |
1003 | CX25821_INFO("setup done!\n"); | 992 | CX25821_INFO("setup done!\n"); |
1004 | 993 | ||
@@ -1057,8 +1046,6 @@ void cx25821_dev_unregister(struct cx25821_dev *dev) | |||
1057 | cx25821_video_unregister(dev, i); | 1046 | cx25821_video_unregister(dev, i); |
1058 | } | 1047 | } |
1059 | 1048 | ||
1060 | cx25821_videoioctl_unregister(dev); | ||
1061 | |||
1062 | cx25821_i2c_unregister(&dev->i2c_bus[0]); | 1049 | cx25821_i2c_unregister(&dev->i2c_bus[0]); |
1063 | cx25821_iounmap(dev); | 1050 | cx25821_iounmap(dev); |
1064 | } | 1051 | } |
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c index 4eaa67a0833b..e785bb98d533 100644 --- a/drivers/media/pci/cx25821/cx25821-video.c +++ b/drivers/media/pci/cx25821/cx25821-video.c | |||
@@ -33,13 +33,10 @@ MODULE_AUTHOR("Hiep Huynh <hiep.huynh@conexant.com>"); | |||
33 | MODULE_LICENSE("GPL"); | 33 | MODULE_LICENSE("GPL"); |
34 | 34 | ||
35 | static unsigned int video_nr[] = {[0 ... (CX25821_MAXBOARDS - 1)] = UNSET }; | 35 | static unsigned int video_nr[] = {[0 ... (CX25821_MAXBOARDS - 1)] = UNSET }; |
36 | static unsigned int radio_nr[] = {[0 ... (CX25821_MAXBOARDS - 1)] = UNSET }; | ||
37 | 36 | ||
38 | module_param_array(video_nr, int, NULL, 0444); | 37 | module_param_array(video_nr, int, NULL, 0444); |
39 | module_param_array(radio_nr, int, NULL, 0444); | ||
40 | 38 | ||
41 | MODULE_PARM_DESC(video_nr, "video device numbers"); | 39 | MODULE_PARM_DESC(video_nr, "video device numbers"); |
42 | MODULE_PARM_DESC(radio_nr, "radio device numbers"); | ||
43 | 40 | ||
44 | static unsigned int video_debug = VIDEO_DEBUG; | 41 | static unsigned int video_debug = VIDEO_DEBUG; |
45 | module_param(video_debug, int, 0644); | 42 | module_param(video_debug, int, 0644); |
@@ -55,9 +52,6 @@ MODULE_PARM_DESC(vid_limit, "capture memory limit in megabytes"); | |||
55 | 52 | ||
56 | static void cx25821_init_controls(struct cx25821_dev *dev, int chan_num); | 53 | static void cx25821_init_controls(struct cx25821_dev *dev, int chan_num); |
57 | 54 | ||
58 | static const struct v4l2_file_operations video_fops; | ||
59 | static const struct v4l2_ioctl_ops video_ioctl_ops; | ||
60 | |||
61 | #define FORMAT_FLAGS_PACKED 0x01 | 55 | #define FORMAT_FLAGS_PACKED 0x01 |
62 | 56 | ||
63 | struct cx25821_fmt formats[] = { | 57 | struct cx25821_fmt formats[] = { |
@@ -411,111 +405,6 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status) | |||
411 | return handled; | 405 | return handled; |
412 | } | 406 | } |
413 | 407 | ||
414 | void cx25821_videoioctl_unregister(struct cx25821_dev *dev) | ||
415 | { | ||
416 | if (dev->ioctl_dev) { | ||
417 | if (video_is_registered(dev->ioctl_dev)) | ||
418 | video_unregister_device(dev->ioctl_dev); | ||
419 | else | ||
420 | video_device_release(dev->ioctl_dev); | ||
421 | |||
422 | dev->ioctl_dev = NULL; | ||
423 | } | ||
424 | } | ||
425 | |||
426 | void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num) | ||
427 | { | ||
428 | cx_clear(PCI_INT_MSK, 1); | ||
429 | |||
430 | if (dev->channels[chan_num].video_dev) { | ||
431 | if (video_is_registered(dev->channels[chan_num].video_dev)) | ||
432 | video_unregister_device( | ||
433 | dev->channels[chan_num].video_dev); | ||
434 | else | ||
435 | video_device_release( | ||
436 | dev->channels[chan_num].video_dev); | ||
437 | |||
438 | dev->channels[chan_num].video_dev = NULL; | ||
439 | |||
440 | btcx_riscmem_free(dev->pci, | ||
441 | &dev->channels[chan_num].vidq.stopper); | ||
442 | |||
443 | pr_warn("device %d released!\n", chan_num); | ||
444 | } | ||
445 | |||
446 | } | ||
447 | |||
448 | int cx25821_video_register(struct cx25821_dev *dev) | ||
449 | { | ||
450 | static const struct video_device cx25821_video_device = { | ||
451 | .name = "cx25821-video", | ||
452 | .fops = &video_fops, | ||
453 | .minor = -1, | ||
454 | .ioctl_ops = &video_ioctl_ops, | ||
455 | .tvnorms = CX25821_NORMS, | ||
456 | .current_norm = V4L2_STD_NTSC_M, | ||
457 | }; | ||
458 | int err; | ||
459 | int i; | ||
460 | |||
461 | spin_lock_init(&dev->slock); | ||
462 | |||
463 | for (i = 0; i < VID_CHANNEL_NUM; ++i) { | ||
464 | if (i == SRAM_CH08) /* audio channel */ | ||
465 | continue; | ||
466 | |||
467 | cx25821_init_controls(dev, i); | ||
468 | |||
469 | cx25821_risc_stopper(dev->pci, &dev->channels[i].vidq.stopper, | ||
470 | dev->channels[i].sram_channels->dma_ctl, 0x11, 0); | ||
471 | |||
472 | dev->channels[i].sram_channels = &cx25821_sram_channels[i]; | ||
473 | dev->channels[i].video_dev = NULL; | ||
474 | dev->channels[i].resources = 0; | ||
475 | |||
476 | cx_write(dev->channels[i].sram_channels->int_stat, 0xffffffff); | ||
477 | |||
478 | INIT_LIST_HEAD(&dev->channels[i].vidq.active); | ||
479 | INIT_LIST_HEAD(&dev->channels[i].vidq.queued); | ||
480 | |||
481 | dev->channels[i].timeout_data.dev = dev; | ||
482 | dev->channels[i].timeout_data.channel = | ||
483 | &cx25821_sram_channels[i]; | ||
484 | dev->channels[i].vidq.timeout.function = cx25821_vid_timeout; | ||
485 | dev->channels[i].vidq.timeout.data = | ||
486 | (unsigned long)&dev->channels[i].timeout_data; | ||
487 | init_timer(&dev->channels[i].vidq.timeout); | ||
488 | |||
489 | /* register v4l devices */ | ||
490 | dev->channels[i].video_dev = cx25821_vdev_init(dev, dev->pci, | ||
491 | &cx25821_video_device, "video"); | ||
492 | |||
493 | err = video_register_device(dev->channels[i].video_dev, | ||
494 | VFL_TYPE_GRABBER, video_nr[dev->nr]); | ||
495 | |||
496 | if (err < 0) | ||
497 | goto fail_unreg; | ||
498 | |||
499 | } | ||
500 | |||
501 | /* set PCI interrupt */ | ||
502 | cx_set(PCI_INT_MSK, 0xff); | ||
503 | |||
504 | /* initial device configuration */ | ||
505 | mutex_lock(&dev->lock); | ||
506 | #ifdef TUNER_FLAG | ||
507 | dev->tvnorm = cx25821_video_device.current_norm; | ||
508 | cx25821_set_tvnorm(dev, dev->tvnorm); | ||
509 | #endif | ||
510 | mutex_unlock(&dev->lock); | ||
511 | |||
512 | return 0; | ||
513 | |||
514 | fail_unreg: | ||
515 | cx25821_video_unregister(dev, i); | ||
516 | return err; | ||
517 | } | ||
518 | |||
519 | int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count, | 408 | int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count, |
520 | unsigned int *size) | 409 | unsigned int *size) |
521 | { | 410 | { |
@@ -1983,10 +1872,96 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
1983 | #endif | 1872 | #endif |
1984 | }; | 1873 | }; |
1985 | 1874 | ||
1986 | struct video_device cx25821_videoioctl_template = { | 1875 | static const struct video_device cx25821_video_device = { |
1987 | .name = "cx25821-videoioctl", | 1876 | .name = "cx25821-video", |
1988 | .fops = &video_fops, | 1877 | .fops = &video_fops, |
1878 | .minor = -1, | ||
1989 | .ioctl_ops = &video_ioctl_ops, | 1879 | .ioctl_ops = &video_ioctl_ops, |
1990 | .tvnorms = CX25821_NORMS, | 1880 | .tvnorms = CX25821_NORMS, |
1991 | .current_norm = V4L2_STD_NTSC_M, | 1881 | .current_norm = V4L2_STD_NTSC_M, |
1992 | }; | 1882 | }; |
1883 | |||
1884 | void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num) | ||
1885 | { | ||
1886 | cx_clear(PCI_INT_MSK, 1); | ||
1887 | |||
1888 | if (dev->channels[chan_num].video_dev) { | ||
1889 | if (video_is_registered(dev->channels[chan_num].video_dev)) | ||
1890 | video_unregister_device( | ||
1891 | dev->channels[chan_num].video_dev); | ||
1892 | else | ||
1893 | video_device_release( | ||
1894 | dev->channels[chan_num].video_dev); | ||
1895 | |||
1896 | dev->channels[chan_num].video_dev = NULL; | ||
1897 | |||
1898 | btcx_riscmem_free(dev->pci, | ||
1899 | &dev->channels[chan_num].vidq.stopper); | ||
1900 | |||
1901 | pr_warn("device %d released!\n", chan_num); | ||
1902 | } | ||
1903 | |||
1904 | } | ||
1905 | |||
1906 | int cx25821_video_register(struct cx25821_dev *dev) | ||
1907 | { | ||
1908 | int err; | ||
1909 | int i; | ||
1910 | |||
1911 | spin_lock_init(&dev->slock); | ||
1912 | |||
1913 | for (i = 0; i < VID_CHANNEL_NUM; ++i) { | ||
1914 | if (i == SRAM_CH08) /* audio channel */ | ||
1915 | continue; | ||
1916 | |||
1917 | cx25821_init_controls(dev, i); | ||
1918 | |||
1919 | cx25821_risc_stopper(dev->pci, &dev->channels[i].vidq.stopper, | ||
1920 | dev->channels[i].sram_channels->dma_ctl, 0x11, 0); | ||
1921 | |||
1922 | dev->channels[i].sram_channels = &cx25821_sram_channels[i]; | ||
1923 | dev->channels[i].video_dev = NULL; | ||
1924 | dev->channels[i].resources = 0; | ||
1925 | |||
1926 | cx_write(dev->channels[i].sram_channels->int_stat, 0xffffffff); | ||
1927 | |||
1928 | INIT_LIST_HEAD(&dev->channels[i].vidq.active); | ||
1929 | INIT_LIST_HEAD(&dev->channels[i].vidq.queued); | ||
1930 | |||
1931 | dev->channels[i].timeout_data.dev = dev; | ||
1932 | dev->channels[i].timeout_data.channel = | ||
1933 | &cx25821_sram_channels[i]; | ||
1934 | dev->channels[i].vidq.timeout.function = cx25821_vid_timeout; | ||
1935 | dev->channels[i].vidq.timeout.data = | ||
1936 | (unsigned long)&dev->channels[i].timeout_data; | ||
1937 | init_timer(&dev->channels[i].vidq.timeout); | ||
1938 | |||
1939 | /* register v4l devices */ | ||
1940 | dev->channels[i].video_dev = cx25821_vdev_init(dev, dev->pci, | ||
1941 | &cx25821_video_device, "video"); | ||
1942 | |||
1943 | err = video_register_device(dev->channels[i].video_dev, | ||
1944 | VFL_TYPE_GRABBER, video_nr[dev->nr]); | ||
1945 | |||
1946 | if (err < 0) | ||
1947 | goto fail_unreg; | ||
1948 | |||
1949 | } | ||
1950 | |||
1951 | /* set PCI interrupt */ | ||
1952 | cx_set(PCI_INT_MSK, 0xff); | ||
1953 | |||
1954 | /* initial device configuration */ | ||
1955 | mutex_lock(&dev->lock); | ||
1956 | #ifdef TUNER_FLAG | ||
1957 | dev->tvnorm = cx25821_video_device.current_norm; | ||
1958 | cx25821_set_tvnorm(dev, dev->tvnorm); | ||
1959 | #endif | ||
1960 | mutex_unlock(&dev->lock); | ||
1961 | |||
1962 | return 0; | ||
1963 | |||
1964 | fail_unreg: | ||
1965 | cx25821_video_unregister(dev, i); | ||
1966 | return err; | ||
1967 | } | ||
diff --git a/drivers/media/pci/cx25821/cx25821-video.h b/drivers/media/pci/cx25821/cx25821-video.h index 11ba5eb93677..37cb0c1b2de0 100644 --- a/drivers/media/pci/cx25821/cx25821-video.h +++ b/drivers/media/pci/cx25821/cx25821-video.h | |||
@@ -76,7 +76,6 @@ extern struct sram_channel *channel7; | |||
76 | extern struct sram_channel *channel9; | 76 | extern struct sram_channel *channel9; |
77 | extern struct sram_channel *channel10; | 77 | extern struct sram_channel *channel10; |
78 | extern struct sram_channel *channel11; | 78 | extern struct sram_channel *channel11; |
79 | extern struct video_device cx25821_videoioctl_template; | ||
80 | /* extern const u32 *ctrl_classes[]; */ | 79 | /* extern const u32 *ctrl_classes[]; */ |
81 | 80 | ||
82 | extern unsigned int vid_limit; | 81 | extern unsigned int vid_limit; |
diff --git a/drivers/media/pci/cx25821/cx25821.h b/drivers/media/pci/cx25821/cx25821.h index 85693cdf0ee1..04c3cb0b6f42 100644 --- a/drivers/media/pci/cx25821/cx25821.h +++ b/drivers/media/pci/cx25821/cx25821.h | |||
@@ -80,7 +80,6 @@ | |||
80 | #define RESOURCE_VIDEO9 512 | 80 | #define RESOURCE_VIDEO9 512 |
81 | #define RESOURCE_VIDEO10 1024 | 81 | #define RESOURCE_VIDEO10 1024 |
82 | #define RESOURCE_VIDEO11 2048 | 82 | #define RESOURCE_VIDEO11 2048 |
83 | #define RESOURCE_VIDEO_IOCTL 4096 | ||
84 | 83 | ||
85 | #define BUFFER_TIMEOUT (HZ) /* 0.5 seconds */ | 84 | #define BUFFER_TIMEOUT (HZ) /* 0.5 seconds */ |
86 | 85 | ||
@@ -125,7 +124,6 @@ struct cx25821_tvnorm { | |||
125 | struct cx25821_fh { | 124 | struct cx25821_fh { |
126 | struct cx25821_dev *dev; | 125 | struct cx25821_dev *dev; |
127 | enum v4l2_buf_type type; | 126 | enum v4l2_buf_type type; |
128 | int radio; | ||
129 | u32 resources; | 127 | u32 resources; |
130 | 128 | ||
131 | enum v4l2_priority prio; | 129 | enum v4l2_priority prio; |
@@ -139,10 +137,7 @@ struct cx25821_fh { | |||
139 | struct cx25821_fmt *fmt; | 137 | struct cx25821_fmt *fmt; |
140 | unsigned int width, height; | 138 | unsigned int width, height; |
141 | int channel_id; | 139 | int channel_id; |
142 | |||
143 | /* vbi capture */ | ||
144 | struct videobuf_queue vidq; | 140 | struct videobuf_queue vidq; |
145 | struct videobuf_queue vbiq; | ||
146 | 141 | ||
147 | /* H264 Encoder specifics ONLY */ | 142 | /* H264 Encoder specifics ONLY */ |
148 | struct videobuf_queue mpegq; | 143 | struct videobuf_queue mpegq; |
@@ -153,7 +148,6 @@ enum cx25821_itype { | |||
153 | CX25821_VMUX_COMPOSITE = 1, | 148 | CX25821_VMUX_COMPOSITE = 1, |
154 | CX25821_VMUX_SVIDEO, | 149 | CX25821_VMUX_SVIDEO, |
155 | CX25821_VMUX_DEBUG, | 150 | CX25821_VMUX_DEBUG, |
156 | CX25821_RADIO, | ||
157 | }; | 151 | }; |
158 | 152 | ||
159 | enum cx25821_src_sel_type { | 153 | enum cx25821_src_sel_type { |
@@ -191,9 +185,7 @@ struct cx25821_board { | |||
191 | enum port portb; | 185 | enum port portb; |
192 | enum port portc; | 186 | enum port portc; |
193 | unsigned int tuner_type; | 187 | unsigned int tuner_type; |
194 | unsigned int radio_type; | ||
195 | unsigned char tuner_addr; | 188 | unsigned char tuner_addr; |
196 | unsigned char radio_addr; | ||
197 | 189 | ||
198 | u32 clk_freq; | 190 | u32 clk_freq; |
199 | struct cx25821_input input[CX25821_NR_INPUT]; | 191 | struct cx25821_input input[CX25821_NR_INPUT]; |
@@ -295,9 +287,6 @@ struct cx25821_dev { | |||
295 | v4l2_std_id tvnorm; | 287 | v4l2_std_id tvnorm; |
296 | unsigned int tuner_type; | 288 | unsigned int tuner_type; |
297 | unsigned char tuner_addr; | 289 | unsigned char tuner_addr; |
298 | unsigned int radio_type; | ||
299 | unsigned char radio_addr; | ||
300 | unsigned int has_radio; | ||
301 | unsigned int videc_type; | 290 | unsigned int videc_type; |
302 | unsigned char videc_addr; | 291 | unsigned char videc_addr; |
303 | unsigned short _max_num_decoders; | 292 | unsigned short _max_num_decoders; |
@@ -326,9 +315,6 @@ struct cx25821_dev { | |||
326 | 315 | ||
327 | /* V4l */ | 316 | /* V4l */ |
328 | u32 freq; | 317 | u32 freq; |
329 | struct video_device *vbi_dev; | ||
330 | struct video_device *radio_dev; | ||
331 | struct video_device *ioctl_dev; | ||
332 | 318 | ||
333 | spinlock_t slock; | 319 | spinlock_t slock; |
334 | 320 | ||
@@ -467,7 +453,6 @@ extern struct cx25821_subid cx25821_subids[]; | |||
467 | #define VID_UPSTREAM_SRAM_CHANNEL_I SRAM_CH09 | 453 | #define VID_UPSTREAM_SRAM_CHANNEL_I SRAM_CH09 |
468 | #define VID_UPSTREAM_SRAM_CHANNEL_J SRAM_CH10 | 454 | #define VID_UPSTREAM_SRAM_CHANNEL_J SRAM_CH10 |
469 | #define AUDIO_UPSTREAM_SRAM_CHANNEL_B SRAM_CH11 | 455 | #define AUDIO_UPSTREAM_SRAM_CHANNEL_B SRAM_CH11 |
470 | #define VIDEO_IOCTL_CH 11 | ||
471 | 456 | ||
472 | struct sram_channel { | 457 | struct sram_channel { |
473 | char *name; | 458 | char *name; |
@@ -607,7 +592,6 @@ extern int cx25821_sram_channel_setup_upstream(struct cx25821_dev *dev, | |||
607 | unsigned int bpl, u32 risc); | 592 | unsigned int bpl, u32 risc); |
608 | extern void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel, | 593 | extern void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel, |
609 | u32 format); | 594 | u32 format); |
610 | extern void cx25821_videoioctl_unregister(struct cx25821_dev *dev); | ||
611 | extern struct video_device *cx25821_vdev_init(struct cx25821_dev *dev, | 595 | extern struct video_device *cx25821_vdev_init(struct cx25821_dev *dev, |
612 | struct pci_dev *pci, | 596 | struct pci_dev *pci, |
613 | const struct video_device *template, | 597 | const struct video_device *template, |