aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/davinci
diff options
context:
space:
mode:
authorLad, Prabhakar <prabhakar.csengg@gmail.com>2014-05-16 09:33:15 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-23 18:05:58 -0400
commitfcc22af21764cc0196997a5531904d1b1f11011e (patch)
tree9a9e615af7f1350452593633df816d789d56bd9e /drivers/media/platform/davinci
parent4be2153cf73d73039c6946b7915e3c0fc4721676 (diff)
[media] media: davinci: vpif_display: use v4l2_fh_open and vb2_fop_release
this patch adds support to use v4l2_fh_open() and vb2_fop_release, which allows to drop driver specific struct vpif_fh, as this is handeled by core. This patch also drops vpif_g/s_priority as this handeled by core. Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform/davinci')
-rw-r--r--drivers/media/platform/davinci/vpif_display.c228
-rw-r--r--drivers/media/platform/davinci/vpif_display.h15
2 files changed, 43 insertions, 200 deletions
diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index cea526b58811..5fc125635433 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -645,85 +645,6 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode)
645 } 645 }
646} 646}
647 647
648/*
649 * vpif_open: It creates object of file handle structure and stores it in
650 * private_data member of filepointer
651 */
652static int vpif_open(struct file *filep)
653{
654 struct video_device *vdev = video_devdata(filep);
655 struct channel_obj *ch = video_get_drvdata(vdev);
656 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
657 struct vpif_fh *fh;
658
659 /* Allocate memory for the file handle object */
660 fh = kzalloc(sizeof(struct vpif_fh), GFP_KERNEL);
661 if (fh == NULL) {
662 vpif_err("unable to allocate memory for file handle object\n");
663 return -ENOMEM;
664 }
665
666 if (mutex_lock_interruptible(&common->lock)) {
667 kfree(fh);
668 return -ERESTARTSYS;
669 }
670 /* store pointer to fh in private_data member of filep */
671 filep->private_data = fh;
672 fh->channel = ch;
673 fh->initialized = 0;
674 if (!ch->initialized) {
675 fh->initialized = 1;
676 ch->initialized = 1;
677 memset(&ch->vpifparams, 0, sizeof(ch->vpifparams));
678 }
679
680 /* Increment channel usrs counter */
681 atomic_inc(&ch->usrs);
682 /* Set io_allowed[VPIF_VIDEO_INDEX] member to false */
683 fh->io_allowed[VPIF_VIDEO_INDEX] = 0;
684 /* Initialize priority of this instance to default priority */
685 fh->prio = V4L2_PRIORITY_UNSET;
686 v4l2_prio_open(&ch->prio, &fh->prio);
687 mutex_unlock(&common->lock);
688
689 return 0;
690}
691
692/*
693 * vpif_release: This function deletes buffer queue, frees the buffers and
694 * the vpif file handle
695 */
696static int vpif_release(struct file *filep)
697{
698 struct vpif_fh *fh = filep->private_data;
699 struct channel_obj *ch = fh->channel;
700 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
701
702 mutex_lock(&common->lock);
703 /* if this instance is doing IO */
704 if (fh->io_allowed[VPIF_VIDEO_INDEX]) {
705 /* Reset io_usrs member of channel object */
706 common->io_usrs = 0;
707 common->numbuffers =
708 config_params.numbuffers[ch->channel_id];
709 }
710
711 /* Decrement channel usrs counter */
712 atomic_dec(&ch->usrs);
713 /* If this file handle has initialize encoder device, reset it */
714 if (fh->initialized)
715 ch->initialized = 0;
716
717 /* Close the priority */
718 v4l2_prio_close(&ch->prio, fh->prio);
719 filep->private_data = NULL;
720 fh->initialized = 0;
721 mutex_unlock(&common->lock);
722 kfree(fh);
723
724 return 0;
725}
726
727/* functions implementing ioctls */ 648/* functions implementing ioctls */
728/** 649/**
729 * vpif_querycap() - QUERYCAP handler 650 * vpif_querycap() - QUERYCAP handler
@@ -765,8 +686,8 @@ static int vpif_enum_fmt_vid_out(struct file *file, void *priv,
765static int vpif_g_fmt_vid_out(struct file *file, void *priv, 686static int vpif_g_fmt_vid_out(struct file *file, void *priv,
766 struct v4l2_format *fmt) 687 struct v4l2_format *fmt)
767{ 688{
768 struct vpif_fh *fh = priv; 689 struct video_device *vdev = video_devdata(file);
769 struct channel_obj *ch = fh->channel; 690 struct channel_obj *ch = video_get_drvdata(vdev);
770 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 691 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
771 692
772 /* Check the validity of the buffer type */ 693 /* Check the validity of the buffer type */
@@ -782,26 +703,12 @@ static int vpif_g_fmt_vid_out(struct file *file, void *priv,
782static int vpif_s_fmt_vid_out(struct file *file, void *priv, 703static int vpif_s_fmt_vid_out(struct file *file, void *priv,
783 struct v4l2_format *fmt) 704 struct v4l2_format *fmt)
784{ 705{
785 struct vpif_fh *fh = priv; 706 struct video_device *vdev = video_devdata(file);
786 struct v4l2_pix_format *pixfmt; 707 struct channel_obj *ch = video_get_drvdata(vdev);
787 struct channel_obj *ch = fh->channel;
788 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 708 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
709 struct v4l2_pix_format *pixfmt;
789 int ret = 0; 710 int ret = 0;
790 711
791 if ((VPIF_CHANNEL2_VIDEO == ch->channel_id)
792 || (VPIF_CHANNEL3_VIDEO == ch->channel_id)) {
793 if (!fh->initialized) {
794 vpif_dbg(1, debug, "Channel Busy\n");
795 return -EBUSY;
796 }
797
798 /* Check for the priority */
799 ret = v4l2_prio_check(&ch->prio, fh->prio);
800 if (0 != ret)
801 return ret;
802 fh->initialized = 1;
803 }
804
805 if (common->started) { 712 if (common->started) {
806 vpif_dbg(1, debug, "Streaming in progress\n"); 713 vpif_dbg(1, debug, "Streaming in progress\n");
807 return -EBUSY; 714 return -EBUSY;
@@ -823,8 +730,8 @@ static int vpif_s_fmt_vid_out(struct file *file, void *priv,
823static int vpif_try_fmt_vid_out(struct file *file, void *priv, 730static int vpif_try_fmt_vid_out(struct file *file, void *priv,
824 struct v4l2_format *fmt) 731 struct v4l2_format *fmt)
825{ 732{
826 struct vpif_fh *fh = priv; 733 struct video_device *vdev = video_devdata(file);
827 struct channel_obj *ch = fh->channel; 734 struct channel_obj *ch = video_get_drvdata(vdev);
828 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 735 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
829 struct v4l2_pix_format *pixfmt = &fmt->fmt.pix; 736 struct v4l2_pix_format *pixfmt = &fmt->fmt.pix;
830 int ret = 0; 737 int ret = 0;
@@ -841,22 +748,12 @@ static int vpif_try_fmt_vid_out(struct file *file, void *priv,
841static int vpif_reqbufs(struct file *file, void *priv, 748static int vpif_reqbufs(struct file *file, void *priv,
842 struct v4l2_requestbuffers *reqbuf) 749 struct v4l2_requestbuffers *reqbuf)
843{ 750{
844 struct vpif_fh *fh = priv; 751 struct video_device *vdev = video_devdata(file);
845 struct channel_obj *ch = fh->channel; 752 struct channel_obj *ch = video_get_drvdata(vdev);
846 struct common_obj *common; 753 struct common_obj *common;
847 enum v4l2_field field; 754 enum v4l2_field field;
848 u8 index = 0; 755 u8 index = 0;
849 756
850 /* This file handle has not initialized the channel,
851 It is not allowed to do settings */
852 if ((VPIF_CHANNEL2_VIDEO == ch->channel_id)
853 || (VPIF_CHANNEL3_VIDEO == ch->channel_id)) {
854 if (!fh->initialized) {
855 vpif_err("Channel Busy\n");
856 return -EBUSY;
857 }
858 }
859
860 if (V4L2_BUF_TYPE_VIDEO_OUTPUT != reqbuf->type) 757 if (V4L2_BUF_TYPE_VIDEO_OUTPUT != reqbuf->type)
861 return -EINVAL; 758 return -EINVAL;
862 759
@@ -877,8 +774,6 @@ static int vpif_reqbufs(struct file *file, void *priv,
877 } else { 774 } else {
878 field = V4L2_VBI_INTERLACED; 775 field = V4L2_VBI_INTERLACED;
879 } 776 }
880 /* Set io allowed member of file handle to TRUE */
881 fh->io_allowed[index] = 1;
882 /* Increment io usrs member of channel object to 1 */ 777 /* Increment io usrs member of channel object to 1 */
883 common->io_usrs = 1; 778 common->io_usrs = 1;
884 /* Store type of memory requested in channel object */ 779 /* Store type of memory requested in channel object */
@@ -890,8 +785,8 @@ static int vpif_reqbufs(struct file *file, void *priv,
890static int vpif_querybuf(struct file *file, void *priv, 785static int vpif_querybuf(struct file *file, void *priv,
891 struct v4l2_buffer *tbuf) 786 struct v4l2_buffer *tbuf)
892{ 787{
893 struct vpif_fh *fh = priv; 788 struct video_device *vdev = video_devdata(file);
894 struct channel_obj *ch = fh->channel; 789 struct channel_obj *ch = video_get_drvdata(vdev);
895 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 790 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
896 791
897 if (common->fmt.type != tbuf->type) 792 if (common->fmt.type != tbuf->type)
@@ -902,15 +797,13 @@ static int vpif_querybuf(struct file *file, void *priv,
902 797
903static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) 798static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
904{ 799{
905 struct vpif_fh *fh = NULL; 800 struct video_device *vdev = video_devdata(file);
906 struct channel_obj *ch = NULL; 801 struct channel_obj *ch = video_get_drvdata(vdev);
907 struct common_obj *common = NULL; 802 struct common_obj *common = NULL;
908 803
909 if (!buf || !priv) 804 if (!buf || !priv)
910 return -EINVAL; 805 return -EINVAL;
911 806
912 fh = priv;
913 ch = fh->channel;
914 if (!ch) 807 if (!ch)
915 return -EINVAL; 808 return -EINVAL;
916 809
@@ -918,18 +811,13 @@ static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
918 if (common->fmt.type != buf->type) 811 if (common->fmt.type != buf->type)
919 return -EINVAL; 812 return -EINVAL;
920 813
921 if (!fh->io_allowed[VPIF_VIDEO_INDEX]) {
922 vpif_err("fh->io_allowed\n");
923 return -EACCES;
924 }
925
926 return vb2_qbuf(&common->buffer_queue, buf); 814 return vb2_qbuf(&common->buffer_queue, buf);
927} 815}
928 816
929static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id) 817static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
930{ 818{
931 struct vpif_fh *fh = priv; 819 struct video_device *vdev = video_devdata(file);
932 struct channel_obj *ch = fh->channel; 820 struct channel_obj *ch = video_get_drvdata(vdev);
933 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 821 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
934 int ret = 0; 822 int ret = 0;
935 823
@@ -975,8 +863,8 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
975 863
976static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std) 864static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
977{ 865{
978 struct vpif_fh *fh = priv; 866 struct video_device *vdev = video_devdata(file);
979 struct channel_obj *ch = fh->channel; 867 struct channel_obj *ch = video_get_drvdata(vdev);
980 868
981 *std = ch->video.stdid; 869 *std = ch->video.stdid;
982 return 0; 870 return 0;
@@ -984,8 +872,8 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
984 872
985static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) 873static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p)
986{ 874{
987 struct vpif_fh *fh = priv; 875 struct video_device *vdev = video_devdata(file);
988 struct channel_obj *ch = fh->channel; 876 struct channel_obj *ch = video_get_drvdata(vdev);
989 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 877 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
990 878
991 return vb2_dqbuf(&common->buffer_queue, p, 879 return vb2_dqbuf(&common->buffer_queue, p,
@@ -995,8 +883,8 @@ static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p)
995static int vpif_streamon(struct file *file, void *priv, 883static int vpif_streamon(struct file *file, void *priv,
996 enum v4l2_buf_type buftype) 884 enum v4l2_buf_type buftype)
997{ 885{
998 struct vpif_fh *fh = priv; 886 struct video_device *vdev = video_devdata(file);
999 struct channel_obj *ch = fh->channel; 887 struct channel_obj *ch = video_get_drvdata(vdev);
1000 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 888 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
1001 struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id]; 889 struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id];
1002 int ret = 0; 890 int ret = 0;
@@ -1006,11 +894,6 @@ static int vpif_streamon(struct file *file, void *priv,
1006 return -EINVAL; 894 return -EINVAL;
1007 } 895 }
1008 896
1009 if (!fh->io_allowed[VPIF_VIDEO_INDEX]) {
1010 vpif_err("fh->io_allowed\n");
1011 return -EACCES;
1012 }
1013
1014 /* If Streaming is already started, return error */ 897 /* If Streaming is already started, return error */
1015 if (common->started) { 898 if (common->started) {
1016 vpif_err("channel->started\n"); 899 vpif_err("channel->started\n");
@@ -1043,8 +926,8 @@ static int vpif_streamon(struct file *file, void *priv,
1043static int vpif_streamoff(struct file *file, void *priv, 926static int vpif_streamoff(struct file *file, void *priv,
1044 enum v4l2_buf_type buftype) 927 enum v4l2_buf_type buftype)
1045{ 928{
1046 struct vpif_fh *fh = priv; 929 struct video_device *vdev = video_devdata(file);
1047 struct channel_obj *ch = fh->channel; 930 struct channel_obj *ch = video_get_drvdata(vdev);
1048 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 931 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
1049 struct vpif_display_config *vpif_config_data = 932 struct vpif_display_config *vpif_config_data =
1050 vpif_dev->platform_data; 933 vpif_dev->platform_data;
@@ -1054,11 +937,6 @@ static int vpif_streamoff(struct file *file, void *priv,
1054 return -EINVAL; 937 return -EINVAL;
1055 } 938 }
1056 939
1057 if (!fh->io_allowed[VPIF_VIDEO_INDEX]) {
1058 vpif_err("fh->io_allowed\n");
1059 return -EACCES;
1060 }
1061
1062 if (!common->started) { 940 if (!common->started) {
1063 vpif_err("channel->started\n"); 941 vpif_err("channel->started\n");
1064 return -EINVAL; 942 return -EINVAL;
@@ -1090,9 +968,10 @@ static int vpif_streamoff(struct file *file, void *priv,
1090static int vpif_cropcap(struct file *file, void *priv, 968static int vpif_cropcap(struct file *file, void *priv,
1091 struct v4l2_cropcap *crop) 969 struct v4l2_cropcap *crop)
1092{ 970{
1093 struct vpif_fh *fh = priv; 971 struct video_device *vdev = video_devdata(file);
1094 struct channel_obj *ch = fh->channel; 972 struct channel_obj *ch = video_get_drvdata(vdev);
1095 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 973 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
974
1096 if (V4L2_BUF_TYPE_VIDEO_OUTPUT != crop->type) 975 if (V4L2_BUF_TYPE_VIDEO_OUTPUT != crop->type)
1097 return -EINVAL; 976 return -EINVAL;
1098 977
@@ -1109,9 +988,9 @@ static int vpif_enum_output(struct file *file, void *fh,
1109{ 988{
1110 989
1111 struct vpif_display_config *config = vpif_dev->platform_data; 990 struct vpif_display_config *config = vpif_dev->platform_data;
991 struct video_device *vdev = video_devdata(file);
992 struct channel_obj *ch = video_get_drvdata(vdev);
1112 struct vpif_display_chan_config *chan_cfg; 993 struct vpif_display_chan_config *chan_cfg;
1113 struct vpif_fh *vpif_handler = fh;
1114 struct channel_obj *ch = vpif_handler->channel;
1115 994
1116 chan_cfg = &config->chan_config[ch->channel_id]; 995 chan_cfg = &config->chan_config[ch->channel_id];
1117 if (output->index >= chan_cfg->output_count) { 996 if (output->index >= chan_cfg->output_count) {
@@ -1205,9 +1084,9 @@ static int vpif_set_output(struct vpif_display_config *vpif_cfg,
1205static int vpif_s_output(struct file *file, void *priv, unsigned int i) 1084static int vpif_s_output(struct file *file, void *priv, unsigned int i)
1206{ 1085{
1207 struct vpif_display_config *config = vpif_dev->platform_data; 1086 struct vpif_display_config *config = vpif_dev->platform_data;
1087 struct video_device *vdev = video_devdata(file);
1088 struct channel_obj *ch = video_get_drvdata(vdev);
1208 struct vpif_display_chan_config *chan_cfg; 1089 struct vpif_display_chan_config *chan_cfg;
1209 struct vpif_fh *fh = priv;
1210 struct channel_obj *ch = fh->channel;
1211 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 1090 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
1212 1091
1213 chan_cfg = &config->chan_config[ch->channel_id]; 1092 chan_cfg = &config->chan_config[ch->channel_id];
@@ -1225,32 +1104,14 @@ static int vpif_s_output(struct file *file, void *priv, unsigned int i)
1225 1104
1226static int vpif_g_output(struct file *file, void *priv, unsigned int *i) 1105static int vpif_g_output(struct file *file, void *priv, unsigned int *i)
1227{ 1106{
1228 struct vpif_fh *fh = priv; 1107 struct video_device *vdev = video_devdata(file);
1229 struct channel_obj *ch = fh->channel; 1108 struct channel_obj *ch = video_get_drvdata(vdev);
1230 1109
1231 *i = ch->output_idx; 1110 *i = ch->output_idx;
1232 1111
1233 return 0; 1112 return 0;
1234} 1113}
1235 1114
1236static int vpif_g_priority(struct file *file, void *priv, enum v4l2_priority *p)
1237{
1238 struct vpif_fh *fh = priv;
1239 struct channel_obj *ch = fh->channel;
1240
1241 *p = v4l2_prio_max(&ch->prio);
1242
1243 return 0;
1244}
1245
1246static int vpif_s_priority(struct file *file, void *priv, enum v4l2_priority p)
1247{
1248 struct vpif_fh *fh = priv;
1249 struct channel_obj *ch = fh->channel;
1250
1251 return v4l2_prio_change(&ch->prio, &fh->prio, p);
1252}
1253
1254/** 1115/**
1255 * vpif_enum_dv_timings() - ENUM_DV_TIMINGS handler 1116 * vpif_enum_dv_timings() - ENUM_DV_TIMINGS handler
1256 * @file: file ptr 1117 * @file: file ptr
@@ -1261,8 +1122,8 @@ static int
1261vpif_enum_dv_timings(struct file *file, void *priv, 1122vpif_enum_dv_timings(struct file *file, void *priv,
1262 struct v4l2_enum_dv_timings *timings) 1123 struct v4l2_enum_dv_timings *timings)
1263{ 1124{
1264 struct vpif_fh *fh = priv; 1125 struct video_device *vdev = video_devdata(file);
1265 struct channel_obj *ch = fh->channel; 1126 struct channel_obj *ch = video_get_drvdata(vdev);
1266 int ret; 1127 int ret;
1267 1128
1268 ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings); 1129 ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings);
@@ -1280,8 +1141,8 @@ vpif_enum_dv_timings(struct file *file, void *priv,
1280static int vpif_s_dv_timings(struct file *file, void *priv, 1141static int vpif_s_dv_timings(struct file *file, void *priv,
1281 struct v4l2_dv_timings *timings) 1142 struct v4l2_dv_timings *timings)
1282{ 1143{
1283 struct vpif_fh *fh = priv; 1144 struct video_device *vdev = video_devdata(file);
1284 struct channel_obj *ch = fh->channel; 1145 struct channel_obj *ch = video_get_drvdata(vdev);
1285 struct vpif_params *vpifparams = &ch->vpifparams; 1146 struct vpif_params *vpifparams = &ch->vpifparams;
1286 struct vpif_channel_config_params *std_info = &vpifparams->std_info; 1147 struct vpif_channel_config_params *std_info = &vpifparams->std_info;
1287 struct video_obj *vid_ch = &ch->video; 1148 struct video_obj *vid_ch = &ch->video;
@@ -1369,8 +1230,8 @@ static int vpif_s_dv_timings(struct file *file, void *priv,
1369static int vpif_g_dv_timings(struct file *file, void *priv, 1230static int vpif_g_dv_timings(struct file *file, void *priv,
1370 struct v4l2_dv_timings *timings) 1231 struct v4l2_dv_timings *timings)
1371{ 1232{
1372 struct vpif_fh *fh = priv; 1233 struct video_device *vdev = video_devdata(file);
1373 struct channel_obj *ch = fh->channel; 1234 struct channel_obj *ch = video_get_drvdata(vdev);
1374 struct video_obj *vid_ch = &ch->video; 1235 struct video_obj *vid_ch = &ch->video;
1375 1236
1376 *timings = vid_ch->dv_timings; 1237 *timings = vid_ch->dv_timings;
@@ -1396,8 +1257,6 @@ static int vpif_log_status(struct file *filep, void *priv)
1396/* vpif display ioctl operations */ 1257/* vpif display ioctl operations */
1397static const struct v4l2_ioctl_ops vpif_ioctl_ops = { 1258static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
1398 .vidioc_querycap = vpif_querycap, 1259 .vidioc_querycap = vpif_querycap,
1399 .vidioc_g_priority = vpif_g_priority,
1400 .vidioc_s_priority = vpif_s_priority,
1401 .vidioc_enum_fmt_vid_out = vpif_enum_fmt_vid_out, 1260 .vidioc_enum_fmt_vid_out = vpif_enum_fmt_vid_out,
1402 .vidioc_g_fmt_vid_out = vpif_g_fmt_vid_out, 1261 .vidioc_g_fmt_vid_out = vpif_g_fmt_vid_out,
1403 .vidioc_s_fmt_vid_out = vpif_s_fmt_vid_out, 1262 .vidioc_s_fmt_vid_out = vpif_s_fmt_vid_out,
@@ -1422,8 +1281,8 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
1422 1281
1423static const struct v4l2_file_operations vpif_fops = { 1282static const struct v4l2_file_operations vpif_fops = {
1424 .owner = THIS_MODULE, 1283 .owner = THIS_MODULE,
1425 .open = vpif_open, 1284 .open = v4l2_fh_open,
1426 .release = vpif_release, 1285 .release = vb2_fop_release,
1427 .unlocked_ioctl = video_ioctl2, 1286 .unlocked_ioctl = video_ioctl2,
1428 .mmap = vb2_fop_mmap, 1287 .mmap = vb2_fop_mmap,
1429 .poll = vb2_fop_poll 1288 .poll = vb2_fop_poll
@@ -1556,12 +1415,8 @@ static int vpif_probe_complete(void)
1556 1415
1557 memset(&ch->vpifparams, 0, sizeof(ch->vpifparams)); 1416 memset(&ch->vpifparams, 0, sizeof(ch->vpifparams));
1558 1417
1559 /* Initialize prio member of channel object */
1560 v4l2_prio_init(&ch->prio);
1561 ch->common[VPIF_VIDEO_INDEX].fmt.type = 1418 ch->common[VPIF_VIDEO_INDEX].fmt.type =
1562 V4L2_BUF_TYPE_VIDEO_OUTPUT; 1419 V4L2_BUF_TYPE_VIDEO_OUTPUT;
1563 ch->video_dev->lock = &common->lock;
1564 video_set_drvdata(ch->video_dev, ch);
1565 1420
1566 /* select output 0 */ 1421 /* select output 0 */
1567 err = vpif_set_output(vpif_obj.config, ch, 0); 1422 err = vpif_set_output(vpif_obj.config, ch, 0);
@@ -1601,6 +1456,9 @@ static int vpif_probe_complete(void)
1601 1456
1602 vdev = ch->video_dev; 1457 vdev = ch->video_dev;
1603 vdev->queue = q; 1458 vdev->queue = q;
1459 vdev->lock = &common->lock;
1460 set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags);
1461 video_set_drvdata(ch->video_dev, ch);
1604 err = video_register_device(vdev, VFL_TYPE_GRABBER, 1462 err = video_register_device(vdev, VFL_TYPE_GRABBER,
1605 (j ? 3 : 2)); 1463 (j ? 3 : 2));
1606 if (err < 0) 1464 if (err < 0)
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index 4d0485b99a80..18c7bd5d8c2c 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -113,8 +113,6 @@ struct channel_obj {
113 /* V4l2 specific parameters */ 113 /* V4l2 specific parameters */
114 struct video_device *video_dev; /* Identifies video device for 114 struct video_device *video_dev; /* Identifies video device for
115 * this channel */ 115 * this channel */
116 struct v4l2_prio_state prio; /* Used to keep track of state of
117 * the priority */
118 atomic_t usrs; /* number of open instances of 116 atomic_t usrs; /* number of open instances of
119 * the channel */ 117 * the channel */
120 u32 field_id; /* Indicates id of the field 118 u32 field_id; /* Indicates id of the field
@@ -130,19 +128,6 @@ struct channel_obj {
130 struct video_obj video; 128 struct video_obj video;
131}; 129};
132 130
133/* File handle structure */
134struct vpif_fh {
135 struct channel_obj *channel; /* pointer to channel object for
136 * opened device */
137 u8 io_allowed[VPIF_NUMOBJECTS]; /* Indicates whether this file handle
138 * is doing IO */
139 enum v4l2_priority prio; /* Used to keep track priority of
140 * this instance */
141 u8 initialized; /* Used to keep track of whether this
142 * file handle has initialized
143 * channel or not */
144};
145
146/* vpif device structure */ 131/* vpif device structure */
147struct vpif_device { 132struct vpif_device {
148 struct v4l2_device v4l2_dev; 133 struct v4l2_device v4l2_dev;