From patchwork Thu Jun 12 17:06:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 4343811 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2F901BEEAA for ; Thu, 12 Jun 2014 17:06:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6B34920340 for ; Thu, 12 Jun 2014 17:06:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 87D042034A for ; Thu, 12 Jun 2014 17:06:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756291AbaFLRGv (ORCPT ); Thu, 12 Jun 2014 13:06:51 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:33037 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756238AbaFLRGq (ORCPT ); Thu, 12 Jun 2014 13:06:46 -0400 Received: from dude.hi.pengutronix.de ([10.1.0.7] helo=dude.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1Wv8Sa-0000jm-Dx; Thu, 12 Jun 2014 19:06:44 +0200 From: Philipp Zabel To: linux-media@vger.kernel.org Cc: Steve Longerbeam , Philipp Zabel Subject: [RFC PATCH 20/26] [media] imx-ipuv3-csi: Export sync lock event to userspace Date: Thu, 12 Jun 2014 19:06:34 +0200 Message-Id: <1402592800-2925-21-git-send-email-p.zabel@pengutronix.de> X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: <1402592800-2925-1-git-send-email-p.zabel@pengutronix.de> References: <1402592800-2925-1-git-send-email-p.zabel@pengutronix.de> X-SA-Exim-Connect-IP: 10.1.0.7 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Signed-off-by: Philipp Zabel --- drivers/media/platform/imx/imx-ipuv3-csi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/media/platform/imx/imx-ipuv3-csi.c b/drivers/media/platform/imx/imx-ipuv3-csi.c index ab22cad..86fadd0 100644 --- a/drivers/media/platform/imx/imx-ipuv3-csi.c +++ b/drivers/media/platform/imx/imx-ipuv3-csi.c @@ -43,12 +43,19 @@ #include #include #include +#include #include #include #include #define DRIVER_NAME "imx-ipuv3-camera" +#define V4L2_EVENT_SYNC_LOCK (V4L2_EVENT_PRIVATE_START | 0x200) + +struct v4l2_event_sync_lock { + __u8 lock; +} __attribute__ ((packed)); + /* CMOS Sensor Interface Registers */ #define CSI_SENS_CONF 0x0000 #define CSI_SENS_FRM_SIZE 0x0004 @@ -579,6 +586,7 @@ static void ipucsi_v4l2_dev_notify(struct v4l2_subdev *sd, if (notification == V4L2_SUBDEV_SYNC_LOCK_NOTIFY) { struct media_entity_graph graph; struct media_entity *entity; + struct v4l2_event event; struct ipucsi *ipucsi; bool lock = *(bool *)arg; @@ -595,6 +603,11 @@ static void ipucsi_v4l2_dev_notify(struct v4l2_subdev *sd, ipucsi_resume_stream(ipucsi); else ipucsi_pause_stream(ipucsi); + + memset(&event, 0, sizeof(event)); + event.type = V4L2_EVENT_SYNC_LOCK; + ((struct v4l2_event_sync_lock *)event.u.data)->lock = lock; + v4l2_event_queue(&ipucsi->vdev, &event); } } @@ -1378,6 +1391,14 @@ static int ipucsi_enum_framesizes(struct file *file, void *fh, return 0; } +static int ipucsi_subscribe_event(struct v4l2_fh *fh, + const struct v4l2_event_subscription *sub) +{ + if (sub->type == V4L2_EVENT_SYNC_LOCK) + return v4l2_event_subscribe(fh, sub, 0, NULL); + return -EINVAL; +} + static const struct v4l2_ioctl_ops ipucsi_capture_ioctl_ops = { .vidioc_querycap = ipucsi_querycap, @@ -1397,6 +1418,9 @@ static const struct v4l2_ioctl_ops ipucsi_capture_ioctl_ops = { .vidioc_streamoff = vb2_ioctl_streamoff, .vidioc_enum_framesizes = ipucsi_enum_framesizes, + + .vidioc_subscribe_event = ipucsi_subscribe_event, + .vidioc_unsubscribe_event = v4l2_event_unsubscribe, }; static int ipucsi_subdev_s_ctrl(struct v4l2_ctrl *ctrl)