aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-blackbird.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2005-09-09 16:03:41 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:57:49 -0400
commite52e98a7eccfb0e7e91630d01690fb11d77db77d (patch)
treed910e743159977ee695c40b795a4b84d43a4dbcb /drivers/media/video/cx88/cx88-blackbird.c
parent24a70fdce872d70171b1f49dcd1a7c3a4e8396b2 (diff)
[PATCH] v4l: CX88 updates and card additions
- Remove $Id CVS logs for V4L files - add ioctl indirection via cx88_ioctl_hook and cx88_ioctl_translator to cx88-blackbird.c. - declare the indirection hooks from cx88-blackbird.c. - dcprintk macro which uses core instead of dev->core on cx88-video.c. - replace dev->core occurances with core on cx88-video.c. - CodingStyle fixes. - MaxInput replaced by a define. - cx8801 structures moved from cx88.h. - The output_mode needs to be set for the Hauppauge Nova-T DVB-T for versions after 2.6.12. - Corrected GPIO values for cx88 cards #28 & #31 for s-video and composite. - Updated DViCO FusionHDTV5 Gold & added DVB support. - Fixed DViCO FusionHDTV 3 Gold-Q GPIO. - Some clean up in cx88-tvaudio.c - replaced hex values when writing to AUD_CTL to EN_xx for better reading. - Allow select by hand between Mono, Lang1, Lang2 and Stereo for BTSC. - Support for stereo NICAM and BTSC improved. - Broken stereo check removed. - Added support for remote control to Cinergy DVBT-1400. - local var renamed from rc5 to a better name (ircode). - LGDT330X QAM lock bug fixes. - Some reorg: move some bits to struct cx88_core, factor out common ioctl's to cx88_do_ioctl. - Get rid of '//' comments, replace them with #if 0 and /**/. - Minor clean-ups: remove dcprintk and replace all instances of "dev->core" with "core". - Added some registers to control PCI controller at CX2388x chips. - New tuner standby API. - Small mpeg fixes and cleanups for blackbird. - fix mpeg packet size & count - add VIDIOC_QUERYCAP ioctl for the mpeg stream - return more information in struct v4l2_format - fix default window height - small cleanups Signed-off-by: Uli Luckas <luckas@musoft.de> Signed-off-by: Torsten Seeboth <Torsten.Seeboth@t-online.de> Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru> Signed-off-by: Michael Krufky <mkrufky@m1k.net> Signed-off-by: Patrick Boettcher <patrick.boettcher@desy.de> Signed-off-by: Catalin Climov <catalin@climov.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/cx88/cx88-blackbird.c')
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c73
1 files changed, 59 insertions, 14 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 4f39688f780..0c0c59e9477 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: cx88-blackbird.c,v 1.27 2005/06/03 13:31:50 mchehab Exp $
3 * 2 *
4 * Support for a cx23416 mpeg encoder via cx2388x host port. 3 * Support for a cx23416 mpeg encoder via cx2388x host port.
5 * "blackbird" reference design. 4 * "blackbird" reference design.
@@ -62,7 +61,6 @@ static LIST_HEAD(cx8802_devlist);
62#define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF 61#define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF
63 62
64/* Firmware API commands */ 63/* Firmware API commands */
65/* #define IVTV_API_STD_TIMEOUT 0x00010000 // 65536, units?? */
66#define IVTV_API_STD_TIMEOUT 500 64#define IVTV_API_STD_TIMEOUT 500
67 65
68#define BLACKBIRD_API_PING 0x80 66#define BLACKBIRD_API_PING 0x80
@@ -696,7 +694,6 @@ static void blackbird_codec_settings(struct cx8802_dev *dev)
696 694
697 /* assign stream type */ 695 /* assign stream type */
698 blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM); 696 blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM);
699 /* blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_TRANSPORT); */
700 697
701 /* assign output port */ 698 /* assign output port */
702 blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */ 699 blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */
@@ -824,7 +821,8 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev)
824 BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, 821 BLACKBIRD_CUSTOM_EXTENSION_USR_DATA,
825 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); 822 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
826 823
827 blackbird_api_cmd(dev, BLACKBIRD_API_INIT_VIDEO_INPUT, 0, 0); /* initialize the video input */ 824 /* initialize the video input */
825 blackbird_api_cmd(dev, BLACKBIRD_API_INIT_VIDEO_INPUT, 0, 0);
828 826
829 msleep(1); 827 msleep(1);
830 828
@@ -833,11 +831,12 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev)
833 blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE); 831 blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE);
834 msleep(1); 832 msleep(1);
835 833
836 /* blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); // start capturing to the host interface */ 834 /* start capturing to the host interface */
835 /* blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); */
837 blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 836 blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0,
838 BLACKBIRD_MPEG_CAPTURE, 837 BLACKBIRD_MPEG_CAPTURE,
839 BLACKBIRD_RAW_BITS_NONE 838 BLACKBIRD_RAW_BITS_NONE
840 ); /* start capturing to the host interface */ 839 );
841 msleep(10); 840 msleep(10);
842 841
843 blackbird_api_cmd(dev, BLACKBIRD_API_REFRESH_INPUT, 0,0); 842 blackbird_api_cmd(dev, BLACKBIRD_API_REFRESH_INPUT, 0,0);
@@ -851,8 +850,8 @@ static int bb_buf_setup(struct videobuf_queue *q,
851{ 850{
852 struct cx8802_fh *fh = q->priv_data; 851 struct cx8802_fh *fh = q->priv_data;
853 852
854 fh->dev->ts_packet_size = 512; 853 fh->dev->ts_packet_size = 188 * 4; /* was: 512 */
855 fh->dev->ts_packet_count = 100; 854 fh->dev->ts_packet_count = 32; /* was: 100 */
856 855
857 *size = fh->dev->ts_packet_size * fh->dev->ts_packet_count; 856 *size = fh->dev->ts_packet_size * fh->dev->ts_packet_count;
858 if (0 == *count) 857 if (0 == *count)
@@ -900,12 +899,36 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
900{ 899{
901 struct cx8802_fh *fh = file->private_data; 900 struct cx8802_fh *fh = file->private_data;
902 struct cx8802_dev *dev = fh->dev; 901 struct cx8802_dev *dev = fh->dev;
902 struct cx88_core *core = dev->core;
903 903
904 if (debug > 1) 904 if (debug > 1)
905 cx88_print_ioctl(dev->core->name,cmd); 905 cx88_print_ioctl(core->name,cmd);
906 906
907 switch (cmd) { 907 switch (cmd) {
908 908
909 /* --- capabilities ------------------------------------------ */
910 case VIDIOC_QUERYCAP:
911 {
912 struct v4l2_capability *cap = arg;
913
914 memset(cap,0,sizeof(*cap));
915 strcpy(cap->driver, "cx88_blackbird");
916 strlcpy(cap->card, cx88_boards[core->board].name,sizeof(cap->card));
917 sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci));
918 cap->version = CX88_VERSION_CODE;
919 cap->capabilities =
920 V4L2_CAP_VIDEO_CAPTURE |
921 V4L2_CAP_READWRITE |
922 V4L2_CAP_STREAMING |
923 V4L2_CAP_VBI_CAPTURE |
924 V4L2_CAP_VIDEO_OVERLAY |
925 0;
926 if (UNSET != core->tuner_type)
927 cap->capabilities |= V4L2_CAP_TUNER;
928
929 return 0;
930 }
931
909 /* --- capture ioctls ---------------------------------------- */ 932 /* --- capture ioctls ---------------------------------------- */
910 case VIDIOC_ENUM_FMT: 933 case VIDIOC_ENUM_FMT:
911 { 934 {
@@ -935,7 +958,11 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
935 f->fmt.pix.width = dev->width; 958 f->fmt.pix.width = dev->width;
936 f->fmt.pix.height = dev->height; 959 f->fmt.pix.height = dev->height;
937 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; 960 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
938 f->fmt.pix.sizeimage = 1024 * 512 /* FIXME: BUFFER_SIZE */; 961 f->fmt.pix.field = V4L2_FIELD_NONE;
962 f->fmt.pix.bytesperline = 0;
963 f->fmt.pix.sizeimage = 188 * 4 * 1024; /* 1024 * 512 */ /* FIXME: BUFFER_SIZE */;
964 f->fmt.pix.colorspace = 0;
965 return 0;
939 } 966 }
940 967
941 /* --- streaming capture ------------------------------------- */ 968 /* --- streaming capture ------------------------------------- */
@@ -959,15 +986,25 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
959 return videobuf_streamoff(&fh->mpegq); 986 return videobuf_streamoff(&fh->mpegq);
960 987
961 default: 988 default:
962 return -EINVAL; 989 return cx88_do_ioctl( inode, file, 0, dev->core, cmd, arg, cx88_ioctl_hook );
963 } 990 }
964 return 0; 991 return 0;
965} 992}
966 993
994int (*cx88_ioctl_hook)(struct inode *inode, struct file *file,
995 unsigned int cmd, void *arg);
996unsigned int (*cx88_ioctl_translator)(unsigned int cmd);
997
998static unsigned int mpeg_translate_ioctl(unsigned int cmd)
999{
1000 return cmd;
1001}
1002
967static int mpeg_ioctl(struct inode *inode, struct file *file, 1003static int mpeg_ioctl(struct inode *inode, struct file *file,
968 unsigned int cmd, unsigned long arg) 1004 unsigned int cmd, unsigned long arg)
969{ 1005{
970 return video_usercopy(inode, file, cmd, arg, mpeg_do_ioctl); 1006 cmd = cx88_ioctl_translator( cmd );
1007 return video_usercopy(inode, file, cmd, arg, cx88_ioctl_hook);
971} 1008}
972 1009
973static int mpeg_open(struct inode *inode, struct file *file) 1010static int mpeg_open(struct inode *inode, struct file *file)
@@ -1135,7 +1172,7 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev,
1135 dev->pci = pci_dev; 1172 dev->pci = pci_dev;
1136 dev->core = core; 1173 dev->core = core;
1137 dev->width = 720; 1174 dev->width = 720;
1138 dev->height = 480; 1175 dev->height = 576;
1139 1176
1140 err = cx8802_init_common(dev); 1177 err = cx8802_init_common(dev);
1141 if (0 != err) 1178 if (0 != err)
@@ -1148,6 +1185,9 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev,
1148 1185
1149 list_add_tail(&dev->devlist,&cx8802_devlist); 1186 list_add_tail(&dev->devlist,&cx8802_devlist);
1150 blackbird_register_video(dev); 1187 blackbird_register_video(dev);
1188
1189 /* initial device configuration: needed ? */
1190
1151 return 0; 1191 return 0;
1152 1192
1153 fail_free: 1193 fail_free:
@@ -1202,6 +1242,8 @@ static int blackbird_init(void)
1202 printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", 1242 printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n",
1203 SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); 1243 SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100);
1204#endif 1244#endif
1245 cx88_ioctl_hook = mpeg_do_ioctl;
1246 cx88_ioctl_translator = mpeg_translate_ioctl;
1205 return pci_register_driver(&blackbird_pci_driver); 1247 return pci_register_driver(&blackbird_pci_driver);
1206} 1248}
1207 1249
@@ -1213,6 +1255,9 @@ static void blackbird_fini(void)
1213module_init(blackbird_init); 1255module_init(blackbird_init);
1214module_exit(blackbird_fini); 1256module_exit(blackbird_fini);
1215 1257
1258EXPORT_SYMBOL(cx88_ioctl_hook);
1259EXPORT_SYMBOL(cx88_ioctl_translator);
1260
1216/* ----------------------------------------------------------- */ 1261/* ----------------------------------------------------------- */
1217/* 1262/*
1218 * Local variables: 1263 * Local variables: