From patchwork Wed Feb 17 15:48:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 8340651 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8DED79F372 for ; Wed, 17 Feb 2016 15:49:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E646F203B1 for ; Wed, 17 Feb 2016 15:49:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 38BF320376 for ; Wed, 17 Feb 2016 15:49:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161732AbcBQPtc (ORCPT ); Wed, 17 Feb 2016 10:49:32 -0500 Received: from mail-wm0-f46.google.com ([74.125.82.46]:33107 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161577AbcBQPtR (ORCPT ); Wed, 17 Feb 2016 10:49:17 -0500 Received: by mail-wm0-f46.google.com with SMTP id g62so243169738wme.0; Wed, 17 Feb 2016 07:49:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=xMxy6x7o84lvxXDI7s1/XAED+Oc6vKVFXAPrWCNscg8=; b=XPAGwU53E4nYDNsn6U4upubAmwl2OC8CWxgQHtQ5kOOcCkzKZWk5ThGK2NcR5aAwDl PHmPJ9y9sw1sKWvBwy/9uXLNWb/ZyX5nSsRMAHgYHF5yX8GrmuiIA/+EdlfbmbNhgUBI AQKlBu8eeNrOWJKQCXZoE27hU7PcLWEQoT2l7xr/bUG65F9shYv6p6FmIITvXIkeAqhb HEfliVD0QAYM2GfDCziRBhT7OdUbSm7OmxvbjRrrtzGixjLrZ/KZf2527Ca6PLekB+Eb X7l86u0LclxdM/OuZKfrUgEyOQ/q1plTmr05B1EIYxZ/b+SFo/yPYJkYnCH1TZHg0jOU cU2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=xMxy6x7o84lvxXDI7s1/XAED+Oc6vKVFXAPrWCNscg8=; b=JB0C1tuncBhMo280/8+5aICqZA17pcUZQ88YuSPtEH1ODafWyt7neK8wtUeKhCzx7v GOlOFs5vrJJk1pjbV5hxS/XHJ11UmFOmSJ+AFnFBiaz+qhc9Ky3EpJYmtNan6/elIIMB QEwp+GfF11z+peRDn5swygQVVE9/O0t46dZgaP6i7foUa7GKul4fpPGWtYUVtDeOaebH RpeJNv5S9qFi4HGrgDswCTwGwoD2708Gqkg4mwgHoqhPXLrDDqgwPmrFZW/2/Z43nDVU EPz2nxUIqB44PNZMYT2CmGIcr0Tfdgyv1u8y5MyC2b9Fkxfe5heCIJNirmjfZWPA1Nnq a+ng== X-Gm-Message-State: AG10YOQk6XhdKPVoztH9dFKK+3BtdeaLAe81eLED54l4EAPT3UTXthK6427xw1Q6IOM/fQ== X-Received: by 10.28.97.135 with SMTP id v129mr26707041wmb.90.1455724155459; Wed, 17 Feb 2016 07:49:15 -0800 (PST) Received: from groucho.site (ip9234e209.dynamic.kabel-deutschland.de. [146.52.226.9]) by smtp.gmail.com with ESMTPSA id u4sm2136725wjz.4.2016.02.17.07.49.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Feb 2016 07:49:14 -0800 (PST) From: Ulrich Hecht To: linux-renesas-soc@vger.kernel.org, niklas.soderlund@ragnatech.se Cc: linux-media@vger.kernel.org, magnus.damm@gmail.com, laurent.pinchart@ideasonboard.com, hans.verkuil@cisco.com, ian.molton@codethink.co.uk, lars@metafoo.de, william.towle@codethink.co.uk, Ulrich Hecht Subject: [PATCH/RFC 6/9] media: rcar-vin: add DV timings support Date: Wed, 17 Feb 2016 16:48:42 +0100 Message-Id: <1455724125-13004-7-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1455724125-13004-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1455724125-13004-1-git-send-email-ulrich.hecht+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Adds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS, and QUERY_DV_TIMINGS. Signed-off-by: Ulrich Hecht --- drivers/media/platform/rcar-vin/rcar-dma.c | 69 ++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 6b23c968..d40b39b 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -511,12 +511,17 @@ static int rvin_enum_input(struct file *file, void *priv, struct v4l2_input *i) { struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_sd(vin); if (i->index != 0) return -EINVAL; i->type = V4L2_INPUT_TYPE_CAMERA; i->std = vin->vdev.tvnorms; + + if (v4l2_subdev_has_op(sd, pad, dv_timings_cap)) + i->capabilities = V4L2_IN_CAP_DV_TIMINGS; + strlcpy(i->name, "Camera", sizeof(i->name)); return 0; @@ -572,6 +577,64 @@ static int rvin_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) return ret; } +static int rvin_enum_dv_timings(struct file *file, void *priv_fh, + struct v4l2_enum_dv_timings *timings) +{ + struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_sd(vin); + + timings->pad = 0; + return v4l2_subdev_call(sd, + pad, enum_dv_timings, timings); +} + +static int rvin_s_dv_timings(struct file *file, void *priv_fh, + struct v4l2_dv_timings *timings) +{ + struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_sd(vin); + int err; + + err = v4l2_subdev_call(sd, + video, s_dv_timings, timings); + if (!err) { + vin->sensor.width = timings->bt.width; + vin->sensor.height = timings->bt.height; + } + return err; +} + +static int rvin_g_dv_timings(struct file *file, void *priv_fh, + struct v4l2_dv_timings *timings) +{ + struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_sd(vin); + + return v4l2_subdev_call(sd, + video, g_dv_timings, timings); +} + +static int rvin_query_dv_timings(struct file *file, void *priv_fh, + struct v4l2_dv_timings *timings) +{ + struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_sd(vin); + + return v4l2_subdev_call(sd, + video, query_dv_timings, timings); +} + +static int rvin_dv_timings_cap(struct file *file, void *priv_fh, + struct v4l2_dv_timings_cap *cap) +{ + struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_sd(vin); + + cap->pad = 0; + return v4l2_subdev_call(sd, + pad, dv_timings_cap, cap); +} + static const struct v4l2_ioctl_ops rvin_ioctl_ops = { .vidioc_querycap = rvin_querycap, .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap, @@ -588,6 +651,12 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = { .vidioc_g_input = rvin_g_input, .vidioc_s_input = rvin_s_input, + .vidioc_dv_timings_cap = rvin_dv_timings_cap, + .vidioc_enum_dv_timings = rvin_enum_dv_timings, + .vidioc_g_dv_timings = rvin_g_dv_timings, + .vidioc_s_dv_timings = rvin_s_dv_timings, + .vidioc_query_dv_timings = rvin_query_dv_timings, + .vidioc_reqbufs = vb2_ioctl_reqbufs, .vidioc_create_bufs = vb2_ioctl_create_bufs, .vidioc_querybuf = vb2_ioctl_querybuf,