From patchwork Thu Sep 8 13:35:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepthy Ravi X-Patchwork-Id: 1129762 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p88DaB7f025934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 8 Sep 2011 13:36:32 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1R1eld-0000bv-1O; Thu, 08 Sep 2011 13:35:45 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1R1elc-0005i1-LY; Thu, 08 Sep 2011 13:35:44 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1R1elZ-0005hF-51 for linux-arm-kernel@lists.infradead.org; Thu, 08 Sep 2011 13:35:42 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p88DZNnG014737 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Sep 2011 08:35:26 -0500 Received: from dbde71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p88DZNl3001887; Thu, 8 Sep 2011 19:05:23 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 8.3.106.1; Thu, 8 Sep 2011 19:05:23 +0530 Received: from localhost.localdomain (dbdp20.itg.ti.com [172.24.170.38]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p88DZMQU027179; Thu, 8 Sep 2011 19:05:22 +0530 (IST) From: Deepthy Ravi To: Subject: [PATCH 4/8] ispvideo: Add support for G/S/ENUM_STD ioctl Date: Thu, 8 Sep 2011 19:05:22 +0530 Message-ID: <1315488922-16152-1-git-send-email-deepthy.ravi@ti.com> X-Mailer: git-send-email 1.6.2.4 MIME-Version: 1.0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110908_093541_352532_C605E7B6 X-CRM114-Status: GOOD ( 17.48 ) X-Spam-Score: -2.8 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.94.94.41 listed in list.dnswl.org] -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Deepthy Ravi , linux@arm.linux.org.uk, tony@atomide.com, linux-kernel@vger.kernel.org, Vaibhav Hiremath , mchehab@infradead.org, laurent.pinchart@ideasonboard.com, linux-omap@vger.kernel.org, g.liakhovetski@gmx.de, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 08 Sep 2011 13:36:32 +0000 (UTC) From: Vaibhav Hiremath In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node. Signed-off-by: Vaibhav Hiremath Signed-off-by: Deepthy Ravi --- drivers/media/video/omap3isp/ispvideo.c | 98 ++++++++++++++++++++++++++++++- drivers/media/video/omap3isp/ispvideo.h | 1 + 2 files changed, 98 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index d5b8236..ff0ffed 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c @@ -37,6 +37,7 @@ #include #include +#include #include "ispvideo.h" #include "isp.h" @@ -1136,7 +1137,97 @@ isp_video_g_input(struct file *file, void *fh, unsigned int *input) static int isp_video_s_input(struct file *file, void *fh, unsigned int input) { - return input == 0 ? 0 : -EINVAL; + struct isp_video *video = video_drvdata(file); + struct media_entity *entity = &video->video.entity; + struct media_entity_graph graph; + struct v4l2_subdev *subdev; + struct v4l2_routing route; + int ret = 0; + + media_entity_graph_walk_start(&graph, entity); + while ((entity = media_entity_graph_walk_next(&graph))) { + if (media_entity_type(entity) == + MEDIA_ENT_T_V4L2_SUBDEV) { + subdev = media_entity_to_v4l2_subdev(entity); + if (subdev != NULL) { + if (input == 0) + route.input = INPUT_CVBS_VI4A; + else + route.input = INPUT_SVIDEO_VI2C_VI1C; + route.output = 0; + ret = v4l2_subdev_call(subdev, video, s_routing, + route.input, route.output, 0); + if (ret < 0 && ret != -ENOIOCTLCMD) + return ret; + } + } + } + + return 0; +} + +static int isp_video_querystd(struct file *file, void *fh, v4l2_std_id *a) +{ + struct isp_video_fh *vfh = to_isp_video_fh(fh); + struct isp_video *video = video_drvdata(file); + struct media_entity *entity = &video->video.entity; + struct media_entity_graph graph; + struct v4l2_subdev *subdev; + int ret = 0; + + media_entity_graph_walk_start(&graph, entity); + while ((entity = media_entity_graph_walk_next(&graph))) { + if (media_entity_type(entity) == + MEDIA_ENT_T_V4L2_SUBDEV) { + subdev = media_entity_to_v4l2_subdev(entity); + if (subdev != NULL) { + ret = v4l2_subdev_call(subdev, video, querystd, + a); + if (ret < 0 && ret != -ENOIOCTLCMD) + return ret; + } + } + } + + vfh->standard.id = *a; + return 0; +} + +static int isp_video_g_std(struct file *file, void *fh, v4l2_std_id *norm) +{ + struct isp_video_fh *vfh = to_isp_video_fh(fh); + struct isp_video *video = video_drvdata(file); + + mutex_lock(&video->mutex); + *norm = vfh->standard.id; + mutex_unlock(&video->mutex); + + return 0; +} + +static int isp_video_s_std(struct file *file, void *fh, v4l2_std_id *norm) +{ + struct isp_video *video = video_drvdata(file); + struct media_entity *entity = &video->video.entity; + struct media_entity_graph graph; + struct v4l2_subdev *subdev; + int ret = 0; + + media_entity_graph_walk_start(&graph, entity); + while ((entity = media_entity_graph_walk_next(&graph))) { + if (media_entity_type(entity) == + MEDIA_ENT_T_V4L2_SUBDEV) { + subdev = media_entity_to_v4l2_subdev(entity); + if (subdev != NULL) { + ret = v4l2_subdev_call(subdev, core, s_std, + *norm); + if (ret < 0 && ret != -ENOIOCTLCMD) + return ret; + } + } + } + + return 0; } static const struct v4l2_ioctl_ops isp_video_ioctl_ops = { @@ -1161,6 +1252,9 @@ static const struct v4l2_ioctl_ops isp_video_ioctl_ops = { .vidioc_enum_input = isp_video_enum_input, .vidioc_g_input = isp_video_g_input, .vidioc_s_input = isp_video_s_input, + .vidioc_querystd = isp_video_querystd, + .vidioc_g_std = isp_video_g_std, + .vidioc_s_std = isp_video_s_std, }; /* ----------------------------------------------------------------------------- @@ -1325,6 +1419,8 @@ int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev) printk(KERN_ERR "%s: could not register video device (%d)\n", __func__, ret); + video->video.tvnorms = V4L2_STD_NTSC | V4L2_STD_PAL; + video->video.current_norm = V4L2_STD_NTSC; return ret; } diff --git a/drivers/media/video/omap3isp/ispvideo.h b/drivers/media/video/omap3isp/ispvideo.h index 53160aa..bb8feb6 100644 --- a/drivers/media/video/omap3isp/ispvideo.h +++ b/drivers/media/video/omap3isp/ispvideo.h @@ -182,6 +182,7 @@ struct isp_video_fh { struct isp_video *video; struct isp_video_queue queue; struct v4l2_format format; + struct v4l2_standard standard; struct v4l2_fract timeperframe; };