Received: by 10.223.176.5 with SMTP id f5csp928529wra; Wed, 7 Feb 2018 09:45:00 -0800 (PST) X-Google-Smtp-Source: AH8x2268Zfs6Hmh4V4MlTxdYfItYFoRwv7nW9oLCKQGf8XH7VJsR3HfIGYBVophCUk8THHwSLqcp X-Received: by 10.99.160.102 with SMTP id u38mr5290686pgn.199.1518025500065; Wed, 07 Feb 2018 09:45:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518025500; cv=none; d=google.com; s=arc-20160816; b=NxkyTK5PlYyf+HuzKCzRZKLJhDXYyT0D18asnpUpAlEZLkWLMgdWIzarVlD+NhxEFw iDnZMF90AgAvV1XNP7u/plY9KDiinKoDWU47oV1hIRRbboj7Ag+YnBzHxDjo8SILgd46 9Q3QA7ycjrw69gQKWG4Yf0/vFpok1AglUwMXNzhfyJs5ALqp2PJ+pI4FjBjCxitKb71H ww0kZxfjmy3D7XSk+E+MrPXQg7lsiq5wlT2Q7WRpddumWpVs+dKDuZGJgsCbIS8tgeg+ 3VHlxNyOA1WJzAWdMus8k8eUJSR4iisJU9+7lnIxYnMTE1iwWEMuFK3/QPiDWeeCcXDi yHwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=kWfLzSqqu15x9qqROCzMjZagNmOVdJDivn5gA+Wr4Nc=; b=QjHjSyAG7TVydZ8CXqZrizyAIvQ4LE11Nuip06KsEccDkArQq3pm36kQD82MNuQZbU qe0Vd8s/gOYgvJYQX69FRRm1gDMC6JVtzPMfGkXeygoCqea3zi2O1CTP9MoPONd83Pt8 G2PoWiGKIoI4PhtnOhp0ef29oCt/hKkyA8bXLXVqQcL+CD8V/ezJ9Q/vqjF7aDwMXvq1 5CByrsq5x7Oq87wfdLizN6r6D8Z3PwidXxEXTpUhcdauUzpcDjT+RpvIU3NBJUyREaRH QLKfVfZTlz9BQ86cAh8MNV0qbkXqNUkqOfTupb7ho5xWvvn0C+dE3HbFzRjI7IsrTz5F Ypiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5-v6si1351717ply.489.2018.02.07.09.44.46; Wed, 07 Feb 2018 09:45:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754556AbeBGRne (ORCPT + 99 others); Wed, 7 Feb 2018 12:43:34 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:64642 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753390AbeBGRna (ORCPT ); Wed, 7 Feb 2018 12:43:30 -0500 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w17HdGZN011953; Wed, 7 Feb 2018 18:43:12 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2fw3qwx60y-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 07 Feb 2018 18:43:12 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2B05C31; Wed, 7 Feb 2018 17:43:12 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 0EB1C5A89; Wed, 7 Feb 2018 17:43:12 +0000 (GMT) Received: from SAFEX1HUBCAS23.st.com (10.75.90.47) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.352.0; Wed, 7 Feb 2018 18:43:11 +0100 Received: from localhost (10.201.23.73) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 7 Feb 2018 18:43:11 +0100 From: Hugues Fruchet To: Maxime Coquelin , Alexandre Torgue , Mauro Carvalho Chehab , "Hans Verkuil" CC: , , , , "Benjamin Gaignard" , Yannick Fertre , Hugues Fruchet Subject: [PATCH] media: stm32-dcmi: add g/s_parm framerate support Date: Wed, 7 Feb 2018 18:43:09 +0100 Message-ID: <1518025389-3677-1-git-send-email-hugues.fruchet@st.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.201.23.73] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-07_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add g/s_parm framerate support by calling subdev g/s_frame_interval ops. This allows user to control sensor framerate by calling ioctl G/S_PARM. Signed-off-by: Hugues Fruchet --- drivers/media/platform/stm32/stm32-dcmi.c | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c index ab555d4..8197554 100644 --- a/drivers/media/platform/stm32/stm32-dcmi.c +++ b/drivers/media/platform/stm32/stm32-dcmi.c @@ -1151,6 +1151,52 @@ static int dcmi_enum_framesizes(struct file *file, void *fh, return 0; } +static int dcmi_g_parm(struct file *file, void *priv, + struct v4l2_streamparm *p) +{ + struct stm32_dcmi *dcmi = video_drvdata(file); + struct v4l2_subdev_frame_interval ival = { 0 }; + int ret; + + if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + p->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; + ret = v4l2_subdev_call(dcmi->entity.subdev, video, + g_frame_interval, &ival); + if (ret) + return ret; + + p->parm.capture.timeperframe = ival.interval; + + return ret; +} + +static int dcmi_s_parm(struct file *file, void *priv, + struct v4l2_streamparm *p) +{ + struct stm32_dcmi *dcmi = video_drvdata(file); + struct v4l2_subdev_frame_interval ival = { + 0, + p->parm.capture.timeperframe + }; + int ret; + + if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + memset(&p->parm, 0, sizeof(p->parm)); + p->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; + ret = v4l2_subdev_call(dcmi->entity.subdev, video, + s_frame_interval, &ival); + if (ret) + return ret; + + p->parm.capture.timeperframe = ival.interval; + + return ret; +} + static int dcmi_enum_frameintervals(struct file *file, void *fh, struct v4l2_frmivalenum *fival) { @@ -1253,6 +1299,9 @@ static int dcmi_release(struct file *file) .vidioc_g_input = dcmi_g_input, .vidioc_s_input = dcmi_s_input, + .vidioc_g_parm = dcmi_g_parm, + .vidioc_s_parm = dcmi_s_parm, + .vidioc_enum_framesizes = dcmi_enum_framesizes, .vidioc_enum_frameintervals = dcmi_enum_frameintervals, -- 1.9.1