diff options
Diffstat (limited to 'drivers/media/video/cx88/cx88-blackbird.c')
| -rw-r--r-- | drivers/media/video/cx88/cx88-blackbird.c | 73 |
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 4f39688f780a..0c0c59e94774 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 | ||
| 994 | int (*cx88_ioctl_hook)(struct inode *inode, struct file *file, | ||
| 995 | unsigned int cmd, void *arg); | ||
| 996 | unsigned int (*cx88_ioctl_translator)(unsigned int cmd); | ||
| 997 | |||
| 998 | static unsigned int mpeg_translate_ioctl(unsigned int cmd) | ||
| 999 | { | ||
| 1000 | return cmd; | ||
| 1001 | } | ||
| 1002 | |||
| 967 | static int mpeg_ioctl(struct inode *inode, struct file *file, | 1003 | static 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 | ||
| 973 | static int mpeg_open(struct inode *inode, struct file *file) | 1010 | static 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) | |||
| 1213 | module_init(blackbird_init); | 1255 | module_init(blackbird_init); |
| 1214 | module_exit(blackbird_fini); | 1256 | module_exit(blackbird_fini); |
| 1215 | 1257 | ||
| 1258 | EXPORT_SYMBOL(cx88_ioctl_hook); | ||
| 1259 | EXPORT_SYMBOL(cx88_ioctl_translator); | ||
| 1260 | |||
| 1216 | /* ----------------------------------------------------------- */ | 1261 | /* ----------------------------------------------------------- */ |
| 1217 | /* | 1262 | /* |
| 1218 | * Local variables: | 1263 | * Local variables: |
