diff options
Diffstat (limited to 'drivers/media')
| -rw-r--r-- | drivers/media/pci/cx25821/cx25821-video.c | 193 | ||||
| -rw-r--r-- | drivers/media/pci/cx25821/cx25821-video.h | 1 | ||||
| -rw-r--r-- | drivers/media/pci/cx25821/cx25821.h | 13 |
3 files changed, 59 insertions, 148 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c index e7a2db158a0e..f82da1e69e60 100644 --- a/drivers/media/pci/cx25821/cx25821-video.c +++ b/drivers/media/pci/cx25821/cx25821-video.c | |||
| @@ -337,7 +337,6 @@ static int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buff | |||
| 337 | u32 line0_offset; | 337 | u32 line0_offset; |
| 338 | struct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb); | 338 | struct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb); |
| 339 | int bpl_local = LINE_SIZE_D1; | 339 | int bpl_local = LINE_SIZE_D1; |
| 340 | int channel_opened = chan->id; | ||
| 341 | 340 | ||
| 342 | BUG_ON(NULL == chan->fmt); | 341 | BUG_ON(NULL == chan->fmt); |
| 343 | if (chan->width < 48 || chan->width > 720 || | 342 | if (chan->width < 48 || chan->width > 720 || |
| @@ -371,33 +370,22 @@ static int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buff | |||
| 371 | dprintk(1, "init_buffer=%d\n", init_buffer); | 370 | dprintk(1, "init_buffer=%d\n", init_buffer); |
| 372 | 371 | ||
| 373 | if (init_buffer) { | 372 | if (init_buffer) { |
| 374 | channel_opened = dev->channel_opened; | 373 | if (chan->pixel_formats == PIXEL_FRMT_411) |
| 375 | if (channel_opened < 0 || channel_opened > 7) | ||
| 376 | channel_opened = 7; | ||
| 377 | |||
| 378 | if (dev->channels[channel_opened].pixel_formats == | ||
| 379 | PIXEL_FRMT_411) | ||
| 380 | buf->bpl = (buf->fmt->depth * buf->vb.width) >> 3; | 374 | buf->bpl = (buf->fmt->depth * buf->vb.width) >> 3; |
| 381 | else | 375 | else |
| 382 | buf->bpl = (buf->fmt->depth >> 3) * (buf->vb.width); | 376 | buf->bpl = (buf->fmt->depth >> 3) * (buf->vb.width); |
| 383 | 377 | ||
| 384 | if (dev->channels[channel_opened].pixel_formats == | 378 | if (chan->pixel_formats == PIXEL_FRMT_411) { |
| 385 | PIXEL_FRMT_411) { | ||
| 386 | bpl_local = buf->bpl; | 379 | bpl_local = buf->bpl; |
| 387 | } else { | 380 | } else { |
| 388 | bpl_local = buf->bpl; /* Default */ | 381 | bpl_local = buf->bpl; /* Default */ |
| 389 | 382 | ||
| 390 | if (channel_opened >= 0 && channel_opened <= 7) { | 383 | if (chan->use_cif_resolution) { |
| 391 | if (dev->channels[channel_opened] | 384 | if (dev->tvnorm & V4L2_STD_PAL_BG || |
| 392 | .use_cif_resolution) { | 385 | dev->tvnorm & V4L2_STD_PAL_DK) |
| 393 | if (dev->tvnorm & V4L2_STD_PAL_BG || | 386 | bpl_local = 352 << 1; |
| 394 | dev->tvnorm & V4L2_STD_PAL_DK) | 387 | else |
| 395 | bpl_local = 352 << 1; | 388 | bpl_local = chan->cif_width << 1; |
| 396 | else | ||
| 397 | bpl_local = dev->channels[ | ||
| 398 | channel_opened]. | ||
| 399 | cif_width << 1; | ||
| 400 | } | ||
| 401 | } | 389 | } |
| 402 | } | 390 | } |
| 403 | 391 | ||
| @@ -534,36 +522,12 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
| 534 | .buf_release = cx25821_buffer_release, | 522 | .buf_release = cx25821_buffer_release, |
| 535 | }; | 523 | }; |
| 536 | 524 | ||
| 537 | static int video_open(struct file *file) | ||
| 538 | { | ||
| 539 | struct cx25821_channel *chan = video_drvdata(file); | ||
| 540 | struct cx25821_dev *dev = chan->dev; | ||
| 541 | struct cx25821_fh *fh; | ||
| 542 | |||
| 543 | /* allocate + initialize per filehandle data */ | ||
| 544 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | ||
| 545 | if (NULL == fh) | ||
| 546 | return -ENOMEM; | ||
| 547 | |||
| 548 | file->private_data = fh; | ||
| 549 | fh->dev = dev; | ||
| 550 | fh->channel_id = chan->id; | ||
| 551 | |||
| 552 | dev->channel_opened = fh->channel_id; | ||
| 553 | |||
| 554 | v4l2_prio_open(&chan->prio, &fh->prio); | ||
| 555 | |||
| 556 | dprintk(1, "post videobuf_queue_init()\n"); | ||
| 557 | |||
| 558 | return 0; | ||
| 559 | } | ||
| 560 | |||
| 561 | static ssize_t video_read(struct file *file, char __user * data, size_t count, | 525 | static ssize_t video_read(struct file *file, char __user * data, size_t count, |
| 562 | loff_t *ppos) | 526 | loff_t *ppos) |
| 563 | { | 527 | { |
| 564 | struct cx25821_fh *fh = file->private_data; | 528 | struct v4l2_fh *fh = file->private_data; |
| 565 | struct cx25821_channel *chan = video_drvdata(file); | 529 | struct cx25821_channel *chan = video_drvdata(file); |
| 566 | struct cx25821_dev *dev = fh->dev; | 530 | struct cx25821_dev *dev = chan->dev; |
| 567 | int err = 0; | 531 | int err = 0; |
| 568 | 532 | ||
| 569 | if (mutex_lock_interruptible(&dev->lock)) | 533 | if (mutex_lock_interruptible(&dev->lock)) |
| @@ -585,8 +549,12 @@ static unsigned int video_poll(struct file *file, | |||
| 585 | struct poll_table_struct *wait) | 549 | struct poll_table_struct *wait) |
| 586 | { | 550 | { |
| 587 | struct cx25821_channel *chan = video_drvdata(file); | 551 | struct cx25821_channel *chan = video_drvdata(file); |
| 552 | unsigned long req_events = poll_requested_events(wait); | ||
| 553 | unsigned int res = v4l2_ctrl_poll(file, wait); | ||
| 588 | 554 | ||
| 589 | return videobuf_poll_stream(file, &chan->vidq, wait); | 555 | if (req_events & (POLLIN | POLLRDNORM)) |
| 556 | res |= videobuf_poll_stream(file, &chan->vidq, wait); | ||
| 557 | return res; | ||
| 590 | 558 | ||
| 591 | /* This doesn't belong in poll(). This can be done | 559 | /* This doesn't belong in poll(). This can be done |
| 592 | * much better with vb2. We keep this code here as a | 560 | * much better with vb2. We keep this code here as a |
| @@ -608,7 +576,7 @@ static unsigned int video_poll(struct file *file, | |||
| 608 | static int video_release(struct file *file) | 576 | static int video_release(struct file *file) |
| 609 | { | 577 | { |
| 610 | struct cx25821_channel *chan = video_drvdata(file); | 578 | struct cx25821_channel *chan = video_drvdata(file); |
| 611 | struct cx25821_fh *fh = file->private_data; | 579 | struct v4l2_fh *fh = file->private_data; |
| 612 | struct cx25821_dev *dev = chan->dev; | 580 | struct cx25821_dev *dev = chan->dev; |
| 613 | const struct sram_channel *sram_ch = | 581 | const struct sram_channel *sram_ch = |
| 614 | dev->channels[0].sram_channels; | 582 | dev->channels[0].sram_channels; |
| @@ -631,11 +599,7 @@ static int video_release(struct file *file) | |||
| 631 | videobuf_mmap_free(&chan->vidq); | 599 | videobuf_mmap_free(&chan->vidq); |
| 632 | mutex_unlock(&dev->lock); | 600 | mutex_unlock(&dev->lock); |
| 633 | 601 | ||
| 634 | v4l2_prio_close(&chan->prio, fh->prio); | 602 | return v4l2_fh_release(file); |
| 635 | file->private_data = NULL; | ||
| 636 | kfree(fh); | ||
| 637 | |||
| 638 | return 0; | ||
| 639 | } | 603 | } |
| 640 | 604 | ||
| 641 | /* VIDEO IOCTLS */ | 605 | /* VIDEO IOCTLS */ |
| @@ -705,14 +669,13 @@ static int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
| 705 | static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) | 669 | static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) |
| 706 | { | 670 | { |
| 707 | struct cx25821_channel *chan = video_drvdata(file); | 671 | struct cx25821_channel *chan = video_drvdata(file); |
| 708 | struct cx25821_fh *fh = priv; | ||
| 709 | 672 | ||
| 710 | if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 673 | if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
| 711 | return -EINVAL; | 674 | return -EINVAL; |
| 712 | 675 | ||
| 713 | if (chan->streaming_fh && chan->streaming_fh != fh) | 676 | if (chan->streaming_fh && chan->streaming_fh != priv) |
| 714 | return -EBUSY; | 677 | return -EBUSY; |
| 715 | chan->streaming_fh = fh; | 678 | chan->streaming_fh = priv; |
| 716 | 679 | ||
| 717 | return videobuf_streamon(&chan->vidq); | 680 | return videobuf_streamon(&chan->vidq); |
| 718 | } | 681 | } |
| @@ -720,12 +683,11 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) | |||
| 720 | static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) | 683 | static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) |
| 721 | { | 684 | { |
| 722 | struct cx25821_channel *chan = video_drvdata(file); | 685 | struct cx25821_channel *chan = video_drvdata(file); |
| 723 | struct cx25821_fh *fh = priv; | ||
| 724 | 686 | ||
| 725 | if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 687 | if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
| 726 | return -EINVAL; | 688 | return -EINVAL; |
| 727 | 689 | ||
| 728 | if (chan->streaming_fh && chan->streaming_fh != fh) | 690 | if (chan->streaming_fh && chan->streaming_fh != priv) |
| 729 | return -EBUSY; | 691 | return -EBUSY; |
| 730 | if (chan->streaming_fh == NULL) | 692 | if (chan->streaming_fh == NULL) |
| 731 | return 0; | 693 | return 0; |
| @@ -774,20 +736,12 @@ static int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm) | |||
| 774 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | 736 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, |
| 775 | struct v4l2_format *f) | 737 | struct v4l2_format *f) |
| 776 | { | 738 | { |
| 777 | struct cx25821_fh *fh = priv; | ||
| 778 | struct cx25821_channel *chan = video_drvdata(file); | 739 | struct cx25821_channel *chan = video_drvdata(file); |
| 779 | struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; | 740 | struct cx25821_dev *dev = chan->dev; |
| 780 | struct v4l2_mbus_framefmt mbus_fmt; | 741 | struct v4l2_mbus_framefmt mbus_fmt; |
| 781 | int err; | 742 | int err; |
| 782 | int pix_format = PIXEL_FRMT_422; | 743 | int pix_format = PIXEL_FRMT_422; |
| 783 | 744 | ||
| 784 | if (fh) { | ||
| 785 | err = v4l2_prio_check(&dev->channels[fh->channel_id].prio, | ||
| 786 | fh->prio); | ||
| 787 | if (0 != err) | ||
| 788 | return err; | ||
| 789 | } | ||
| 790 | |||
| 791 | err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); | 745 | err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); |
| 792 | 746 | ||
| 793 | if (0 != err) | 747 | if (0 != err) |
| @@ -840,10 +794,9 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) | |||
| 840 | 794 | ||
| 841 | static int vidioc_log_status(struct file *file, void *priv) | 795 | static int vidioc_log_status(struct file *file, void *priv) |
| 842 | { | 796 | { |
| 843 | struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; | 797 | struct cx25821_channel *chan = video_drvdata(file); |
| 844 | struct cx25821_fh *fh = priv; | 798 | struct cx25821_dev *dev = chan->dev; |
| 845 | const struct sram_channel *sram_ch = | 799 | const struct sram_channel *sram_ch = chan->sram_channels; |
| 846 | dev->channels[fh->channel_id].sram_channels; | ||
| 847 | u32 tmp = 0; | 800 | u32 tmp = 0; |
| 848 | 801 | ||
| 849 | cx25821_call_all(dev, core, log_status); | 802 | cx25821_call_all(dev, core, log_status); |
| @@ -857,8 +810,8 @@ static int vidioc_log_status(struct file *file, void *priv) | |||
| 857 | static int cx25821_vidioc_querycap(struct file *file, void *priv, | 810 | static int cx25821_vidioc_querycap(struct file *file, void *priv, |
| 858 | struct v4l2_capability *cap) | 811 | struct v4l2_capability *cap) |
| 859 | { | 812 | { |
| 860 | struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; | 813 | struct cx25821_channel *chan = video_drvdata(file); |
| 861 | struct cx25821_fh *fh = priv; | 814 | struct cx25821_dev *dev = chan->dev; |
| 862 | const u32 cap_input = V4L2_CAP_VIDEO_CAPTURE | | 815 | const u32 cap_input = V4L2_CAP_VIDEO_CAPTURE | |
| 863 | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; | 816 | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; |
| 864 | const u32 cap_output = V4L2_CAP_VIDEO_OUTPUT; | 817 | const u32 cap_output = V4L2_CAP_VIDEO_OUTPUT; |
| @@ -866,7 +819,7 @@ static int cx25821_vidioc_querycap(struct file *file, void *priv, | |||
| 866 | strcpy(cap->driver, "cx25821"); | 819 | strcpy(cap->driver, "cx25821"); |
| 867 | strlcpy(cap->card, cx25821_boards[dev->board].name, sizeof(cap->card)); | 820 | strlcpy(cap->card, cx25821_boards[dev->board].name, sizeof(cap->card)); |
| 868 | sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci)); | 821 | sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci)); |
| 869 | if (fh->channel_id >= VID_CHANNEL_NUM) | 822 | if (chan->id >= VID_CHANNEL_NUM) |
| 870 | cap->device_caps = cap_output; | 823 | cap->device_caps = cap_output; |
| 871 | else | 824 | else |
| 872 | cap->device_caps = cap_input; | 825 | cap->device_caps = cap_input; |
| @@ -909,46 +862,18 @@ static int cx25821_vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer | |||
| 909 | return videobuf_qbuf(&chan->vidq, p); | 862 | return videobuf_qbuf(&chan->vidq, p); |
| 910 | } | 863 | } |
| 911 | 864 | ||
| 912 | static int cx25821_vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p) | ||
| 913 | { | ||
| 914 | struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev; | ||
| 915 | struct cx25821_fh *fh = f; | ||
| 916 | |||
| 917 | *p = v4l2_prio_max(&dev->channels[fh->channel_id].prio); | ||
| 918 | |||
| 919 | return 0; | ||
| 920 | } | ||
| 921 | |||
| 922 | static int cx25821_vidioc_s_priority(struct file *file, void *f, | ||
| 923 | enum v4l2_priority prio) | ||
| 924 | { | ||
| 925 | struct cx25821_fh *fh = f; | ||
| 926 | struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev; | ||
| 927 | |||
| 928 | return v4l2_prio_change(&dev->channels[fh->channel_id].prio, &fh->prio, | ||
| 929 | prio); | ||
| 930 | } | ||
| 931 | |||
| 932 | static int cx25821_vidioc_g_std(struct file *file, void *priv, v4l2_std_id *tvnorms) | 865 | static int cx25821_vidioc_g_std(struct file *file, void *priv, v4l2_std_id *tvnorms) |
| 933 | { | 866 | { |
| 934 | struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; | 867 | struct cx25821_channel *chan = video_drvdata(file); |
| 935 | 868 | ||
| 936 | *tvnorms = dev->tvnorm; | 869 | *tvnorms = chan->dev->tvnorm; |
| 937 | return 0; | 870 | return 0; |
| 938 | } | 871 | } |
| 939 | 872 | ||
| 940 | int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms) | 873 | int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms) |
| 941 | { | 874 | { |
| 942 | struct cx25821_fh *fh = priv; | 875 | struct cx25821_channel *chan = video_drvdata(file); |
| 943 | struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; | 876 | struct cx25821_dev *dev = chan->dev; |
| 944 | int err; | ||
| 945 | |||
| 946 | if (fh) { | ||
| 947 | err = v4l2_prio_check(&dev->channels[fh->channel_id].prio, | ||
| 948 | fh->prio); | ||
| 949 | if (0 != err) | ||
| 950 | return err; | ||
| 951 | } | ||
| 952 | 877 | ||
| 953 | if (dev->tvnorm == tvnorms) | 878 | if (dev->tvnorm == tvnorms) |
| 954 | return 0; | 879 | return 0; |
| @@ -968,7 +893,8 @@ static int cx25821_vidioc_enum_input(struct file *file, void *priv, | |||
| 968 | [CX25821_VMUX_SVIDEO] = "S-Video", | 893 | [CX25821_VMUX_SVIDEO] = "S-Video", |
| 969 | [CX25821_VMUX_DEBUG] = "for debug only", | 894 | [CX25821_VMUX_DEBUG] = "for debug only", |
| 970 | }; | 895 | }; |
| 971 | struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; | 896 | struct cx25821_channel *chan = video_drvdata(file); |
| 897 | struct cx25821_dev *dev = chan->dev; | ||
| 972 | unsigned int n; | 898 | unsigned int n; |
| 973 | 899 | ||
| 974 | n = i->index; | 900 | n = i->index; |
| @@ -987,7 +913,8 @@ static int cx25821_vidioc_enum_input(struct file *file, void *priv, | |||
| 987 | 913 | ||
| 988 | static int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i) | 914 | static int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i) |
| 989 | { | 915 | { |
| 990 | struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; | 916 | struct cx25821_channel *chan = video_drvdata(file); |
| 917 | struct cx25821_dev *dev = chan->dev; | ||
| 991 | 918 | ||
| 992 | *i = dev->input; | 919 | *i = dev->input; |
| 993 | return 0; | 920 | return 0; |
| @@ -995,16 +922,8 @@ static int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i | |||
| 995 | 922 | ||
| 996 | static int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i) | 923 | static int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i) |
| 997 | { | 924 | { |
| 998 | struct cx25821_fh *fh = priv; | 925 | struct cx25821_channel *chan = video_drvdata(file); |
| 999 | struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; | 926 | struct cx25821_dev *dev = chan->dev; |
| 1000 | int err; | ||
| 1001 | |||
| 1002 | if (fh) { | ||
| 1003 | err = v4l2_prio_check(&dev->channels[fh->channel_id].prio, | ||
| 1004 | fh->prio); | ||
| 1005 | if (0 != err) | ||
| 1006 | return err; | ||
| 1007 | } | ||
| 1008 | 927 | ||
| 1009 | if (i >= CX25821_NR_INPUT || INPUT(i)->type == 0) | 928 | if (i >= CX25821_NR_INPUT || INPUT(i)->type == 0) |
| 1010 | return -EINVAL; | 929 | return -EINVAL; |
| @@ -1017,7 +936,8 @@ static int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i) | |||
| 1017 | int cx25821_vidioc_g_register(struct file *file, void *fh, | 936 | int cx25821_vidioc_g_register(struct file *file, void *fh, |
| 1018 | struct v4l2_dbg_register *reg) | 937 | struct v4l2_dbg_register *reg) |
| 1019 | { | 938 | { |
| 1020 | struct cx25821_dev *dev = ((struct cx25821_fh *)fh)->dev; | 939 | struct cx25821_channel *chan = video_drvdata(file); |
| 940 | struct cx25821_dev *dev = chan->dev; | ||
| 1021 | 941 | ||
| 1022 | if (!v4l2_chip_match_host(®->match)) | 942 | if (!v4l2_chip_match_host(®->match)) |
| 1023 | return -EINVAL; | 943 | return -EINVAL; |
| @@ -1030,7 +950,8 @@ int cx25821_vidioc_g_register(struct file *file, void *fh, | |||
| 1030 | int cx25821_vidioc_s_register(struct file *file, void *fh, | 950 | int cx25821_vidioc_s_register(struct file *file, void *fh, |
| 1031 | const struct v4l2_dbg_register *reg) | 951 | const struct v4l2_dbg_register *reg) |
| 1032 | { | 952 | { |
| 1033 | struct cx25821_dev *dev = ((struct cx25821_fh *)fh)->dev; | 953 | struct cx25821_channel *chan = video_drvdata(file); |
| 954 | struct cx25821_dev *dev = chan->dev; | ||
| 1034 | 955 | ||
| 1035 | if (!v4l2_chip_match_host(®->match)) | 956 | if (!v4l2_chip_match_host(®->match)) |
| 1036 | return -EINVAL; | 957 | return -EINVAL; |
| @@ -1070,8 +991,8 @@ static int cx25821_s_ctrl(struct v4l2_ctrl *ctrl) | |||
| 1070 | static long video_ioctl_upstream9(struct file *file, unsigned int cmd, | 991 | static long video_ioctl_upstream9(struct file *file, unsigned int cmd, |
| 1071 | unsigned long arg) | 992 | unsigned long arg) |
| 1072 | { | 993 | { |
| 1073 | struct cx25821_fh *fh = file->private_data; | 994 | struct cx25821_channel *chan = video_drvdata(file); |
| 1074 | struct cx25821_dev *dev = fh->dev; | 995 | struct cx25821_dev *dev = chan->dev; |
| 1075 | int command = 0; | 996 | int command = 0; |
| 1076 | struct upstream_user_struct *data_from_user; | 997 | struct upstream_user_struct *data_from_user; |
| 1077 | 998 | ||
| @@ -1110,8 +1031,8 @@ static long video_ioctl_upstream9(struct file *file, unsigned int cmd, | |||
| 1110 | static long video_ioctl_upstream10(struct file *file, unsigned int cmd, | 1031 | static long video_ioctl_upstream10(struct file *file, unsigned int cmd, |
| 1111 | unsigned long arg) | 1032 | unsigned long arg) |
| 1112 | { | 1033 | { |
| 1113 | struct cx25821_fh *fh = file->private_data; | 1034 | struct cx25821_channel *chan = video_drvdata(file); |
| 1114 | struct cx25821_dev *dev = fh->dev; | 1035 | struct cx25821_dev *dev = chan->dev; |
| 1115 | int command = 0; | 1036 | int command = 0; |
| 1116 | struct upstream_user_struct *data_from_user; | 1037 | struct upstream_user_struct *data_from_user; |
| 1117 | 1038 | ||
| @@ -1150,8 +1071,8 @@ static long video_ioctl_upstream10(struct file *file, unsigned int cmd, | |||
| 1150 | static long video_ioctl_upstream11(struct file *file, unsigned int cmd, | 1071 | static long video_ioctl_upstream11(struct file *file, unsigned int cmd, |
| 1151 | unsigned long arg) | 1072 | unsigned long arg) |
| 1152 | { | 1073 | { |
| 1153 | struct cx25821_fh *fh = file->private_data; | 1074 | struct cx25821_channel *chan = video_drvdata(file); |
| 1154 | struct cx25821_dev *dev = fh->dev; | 1075 | struct cx25821_dev *dev = chan->dev; |
| 1155 | int command = 0; | 1076 | int command = 0; |
| 1156 | struct upstream_user_struct *data_from_user; | 1077 | struct upstream_user_struct *data_from_user; |
| 1157 | 1078 | ||
| @@ -1190,8 +1111,8 @@ static long video_ioctl_upstream11(struct file *file, unsigned int cmd, | |||
| 1190 | static long video_ioctl_set(struct file *file, unsigned int cmd, | 1111 | static long video_ioctl_set(struct file *file, unsigned int cmd, |
| 1191 | unsigned long arg) | 1112 | unsigned long arg) |
| 1192 | { | 1113 | { |
| 1193 | struct cx25821_fh *fh = file->private_data; | 1114 | struct cx25821_channel *chan = video_drvdata(file); |
| 1194 | struct cx25821_dev *dev = fh->dev; | 1115 | struct cx25821_dev *dev = chan->dev; |
| 1195 | struct downstream_user_struct *data_from_user; | 1116 | struct downstream_user_struct *data_from_user; |
| 1196 | int command; | 1117 | int command; |
| 1197 | int width = 720; | 1118 | int width = 720; |
| @@ -1300,18 +1221,17 @@ static long video_ioctl_set(struct file *file, unsigned int cmd, | |||
| 1300 | static long cx25821_video_ioctl(struct file *file, | 1221 | static long cx25821_video_ioctl(struct file *file, |
| 1301 | unsigned int cmd, unsigned long arg) | 1222 | unsigned int cmd, unsigned long arg) |
| 1302 | { | 1223 | { |
| 1224 | struct cx25821_channel *chan = video_drvdata(file); | ||
| 1303 | int ret = 0; | 1225 | int ret = 0; |
| 1304 | 1226 | ||
| 1305 | struct cx25821_fh *fh = file->private_data; | ||
| 1306 | |||
| 1307 | /* check to see if it's the video upstream */ | 1227 | /* check to see if it's the video upstream */ |
| 1308 | if (fh->channel_id == SRAM_CH09) { | 1228 | if (chan->id == SRAM_CH09) { |
| 1309 | ret = video_ioctl_upstream9(file, cmd, arg); | 1229 | ret = video_ioctl_upstream9(file, cmd, arg); |
| 1310 | return ret; | 1230 | return ret; |
| 1311 | } else if (fh->channel_id == SRAM_CH10) { | 1231 | } else if (chan->id == SRAM_CH10) { |
| 1312 | ret = video_ioctl_upstream10(file, cmd, arg); | 1232 | ret = video_ioctl_upstream10(file, cmd, arg); |
| 1313 | return ret; | 1233 | return ret; |
| 1314 | } else if (fh->channel_id == SRAM_CH11) { | 1234 | } else if (chan->id == SRAM_CH11) { |
| 1315 | ret = video_ioctl_upstream11(file, cmd, arg); | 1235 | ret = video_ioctl_upstream11(file, cmd, arg); |
| 1316 | ret = video_ioctl_set(file, cmd, arg); | 1236 | ret = video_ioctl_set(file, cmd, arg); |
| 1317 | return ret; | 1237 | return ret; |
| @@ -1326,7 +1246,7 @@ static const struct v4l2_ctrl_ops cx25821_ctrl_ops = { | |||
| 1326 | 1246 | ||
| 1327 | static const struct v4l2_file_operations video_fops = { | 1247 | static const struct v4l2_file_operations video_fops = { |
| 1328 | .owner = THIS_MODULE, | 1248 | .owner = THIS_MODULE, |
| 1329 | .open = video_open, | 1249 | .open = v4l2_fh_open, |
| 1330 | .release = video_release, | 1250 | .release = video_release, |
| 1331 | .read = video_read, | 1251 | .read = video_read, |
| 1332 | .poll = video_poll, | 1252 | .poll = video_poll, |
| @@ -1352,8 +1272,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
| 1352 | .vidioc_streamon = vidioc_streamon, | 1272 | .vidioc_streamon = vidioc_streamon, |
| 1353 | .vidioc_streamoff = vidioc_streamoff, | 1273 | .vidioc_streamoff = vidioc_streamoff, |
| 1354 | .vidioc_log_status = vidioc_log_status, | 1274 | .vidioc_log_status = vidioc_log_status, |
| 1355 | .vidioc_g_priority = cx25821_vidioc_g_priority, | 1275 | .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, |
| 1356 | .vidioc_s_priority = cx25821_vidioc_s_priority, | 1276 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, |
| 1357 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1277 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
| 1358 | .vidioc_g_register = cx25821_vidioc_g_register, | 1278 | .vidioc_g_register = cx25821_vidioc_g_register, |
| 1359 | .vidioc_s_register = cx25821_vidioc_s_register, | 1279 | .vidioc_s_register = cx25821_vidioc_s_register, |
| @@ -1454,6 +1374,7 @@ int cx25821_video_register(struct cx25821_dev *dev) | |||
| 1454 | vdev->v4l2_dev = &dev->v4l2_dev; | 1374 | vdev->v4l2_dev = &dev->v4l2_dev; |
| 1455 | vdev->ctrl_handler = hdl; | 1375 | vdev->ctrl_handler = hdl; |
| 1456 | vdev->lock = &dev->lock; | 1376 | vdev->lock = &dev->lock; |
| 1377 | set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags); | ||
| 1457 | snprintf(vdev->name, sizeof(vdev->name), "%s #%d", dev->name, i); | 1378 | snprintf(vdev->name, sizeof(vdev->name), "%s #%d", dev->name, i); |
| 1458 | video_set_drvdata(vdev, chan); | 1379 | video_set_drvdata(vdev, chan); |
| 1459 | 1380 | ||
diff --git a/drivers/media/pci/cx25821/cx25821-video.h b/drivers/media/pci/cx25821/cx25821-video.h index b0f0d5395490..eb54e5347cc4 100644 --- a/drivers/media/pci/cx25821/cx25821-video.h +++ b/drivers/media/pci/cx25821/cx25821-video.h | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include "cx25821.h" | 39 | #include "cx25821.h" |
| 40 | #include <media/v4l2-common.h> | 40 | #include <media/v4l2-common.h> |
| 41 | #include <media/v4l2-ioctl.h> | 41 | #include <media/v4l2-ioctl.h> |
| 42 | #include <media/v4l2-event.h> | ||
| 42 | 43 | ||
| 43 | #define VIDEO_DEBUG 0 | 44 | #define VIDEO_DEBUG 0 |
| 44 | 45 | ||
diff --git a/drivers/media/pci/cx25821/cx25821.h b/drivers/media/pci/cx25821/cx25821.h index 128c9f320dfb..40b16b01349b 100644 --- a/drivers/media/pci/cx25821/cx25821.h +++ b/drivers/media/pci/cx25821/cx25821.h | |||
| @@ -116,15 +116,6 @@ struct cx25821_tvnorm { | |||
| 116 | u32 cxoformat; | 116 | u32 cxoformat; |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | struct cx25821_fh { | ||
| 120 | struct cx25821_dev *dev; | ||
| 121 | |||
| 122 | enum v4l2_priority prio; | ||
| 123 | |||
| 124 | /* video capture */ | ||
| 125 | int channel_id; | ||
| 126 | }; | ||
| 127 | |||
| 128 | enum cx25821_itype { | 119 | enum cx25821_itype { |
| 129 | CX25821_VMUX_COMPOSITE = 1, | 120 | CX25821_VMUX_COMPOSITE = 1, |
| 130 | CX25821_VMUX_SVIDEO, | 121 | CX25821_VMUX_SVIDEO, |
| @@ -207,8 +198,7 @@ struct cx25821_dev; | |||
| 207 | struct cx25821_channel { | 198 | struct cx25821_channel { |
| 208 | unsigned id; | 199 | unsigned id; |
| 209 | struct cx25821_dev *dev; | 200 | struct cx25821_dev *dev; |
| 210 | struct cx25821_fh *streaming_fh; | 201 | struct v4l2_fh *streaming_fh; |
| 211 | struct v4l2_prio_state prio; | ||
| 212 | 202 | ||
| 213 | struct v4l2_ctrl_handler hdl; | 203 | struct v4l2_ctrl_handler hdl; |
| 214 | struct cx25821_data timeout_data; | 204 | struct cx25821_data timeout_data; |
| @@ -360,7 +350,6 @@ struct cx25821_dev { | |||
| 360 | int pixel_format; | 350 | int pixel_format; |
| 361 | int channel_select; | 351 | int channel_select; |
| 362 | int command; | 352 | int command; |
| 363 | int channel_opened; | ||
| 364 | }; | 353 | }; |
| 365 | 354 | ||
| 366 | struct upstream_user_struct { | 355 | struct upstream_user_struct { |
