From patchwork Fri Oct 14 17:34:28 2016
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Zabel
X-Patchwork-Id: 9377091
Return-Path:
Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
[172.30.200.125])
by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id
E5DEA607FD for ;
Fri, 14 Oct 2016 17:35:12 +0000 (UTC)
Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3D112A438
for ;
Fri, 14 Oct 2016 17:35:12 +0000 (UTC)
Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
id C83602A44C; Fri, 14 Oct 2016 17:35:12 +0000 (UTC)
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
pdx-wl-mail.web.codeaurora.org
X-Spam-Level:
X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI
autolearn=ham version=3.3.1
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D86DE2A438
for ;
Fri, 14 Oct 2016 17:35:10 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1755789AbcJNRfH (ORCPT
);
Fri, 14 Oct 2016 13:35:07 -0400
Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:57452 "EHLO
metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK)
by vger.kernel.org with ESMTP id S1754800AbcJNRfB (ORCPT
);
Fri, 14 Oct 2016 13:35:01 -0400
Received: from paszta.hi.4.pengutronix.de ([10.1.0.120]
helo=paszta.pengutronix.de.)
by metis.ext.pengutronix.de with esmtp (Exim 4.80)
(envelope-from )
id 1bv6Nn-0001mV-1D; Fri, 14 Oct 2016 19:34:59 +0200
From: Philipp Zabel
To: linux-media@vger.kernel.org
Cc: Steve Longerbeam ,
Marek Vasut , Hans Verkuil ,
Gary Bisson ,
kernel@pengutronix.de, Philipp Zabel ,
Sascha Hauer ,
Marc Kleine-Budde
Subject: [PATCH v2 08/21] [media] imx: Add i.MX IPUv3 capture driver
Date: Fri, 14 Oct 2016 19:34:28 +0200
Message-Id: <1476466481-24030-9-git-send-email-p.zabel@pengutronix.de>
X-Mailer: git-send-email 2.1.4
In-Reply-To: <1476466481-24030-1-git-send-email-p.zabel@pengutronix.de>
References: <1476466481-24030-1-git-send-email-p.zabel@pengutronix.de>
X-SA-Exim-Connect-IP: 10.1.0.120
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-Virus-Scanned: ClamAV using ClamSMTP
This driver uses the IDMAC module's double buffering feature to do the
processing of finished frames in the new frame acknowledge (NFACK)
interrupt handler while the next frame is already being captured. This
avoids a race condition between the end of frame interrupt and NFACK for
very short blanking intervals, but causes the driver to need at least
two buffers in flight. The last remaining frame will never be handed out
to userspace until a new one is queued.
It supports interlaced input and allows to translate between sequential
and interlaced field formats using the IDMAC scan order and interlace
offset parameters.
Currently the direct CSI -> SMFC -> IDMAC path is supported.
Signed-off-by: Sascha Hauer
Signed-off-by: Marc Kleine-Budde
Signed-off-by: Philipp Zabel
---
Changes since v1:
- Remove v4l2_media_subdev_prepare_stream and v4l2_media_subdev_s_stream,
subdevices will propagate s_stream calls to their upstream subdevices
themselves.
- Fix width/height to CSI output size
- Use colorspace provided by CSI output
- Implement enum/g/s/_input for v4l2-compliance
- Fix ipu_capture_g_parm to use the correct pad
---
drivers/media/platform/imx/Kconfig | 9 +
drivers/media/platform/imx/Makefile | 1 +
drivers/media/platform/imx/imx-ipu-capture.c | 1015 ++++++++++++++++++++++++++
drivers/media/platform/imx/imx-ipu.h | 9 +
drivers/media/platform/imx/imx-ipuv3-csi.c | 29 +-
5 files changed, 1061 insertions(+), 2 deletions(-)
create mode 100644 drivers/media/platform/imx/imx-ipu-capture.c
diff --git a/drivers/media/platform/imx/Kconfig b/drivers/media/platform/imx/Kconfig
index a88c4f7..69e8648 100644
--- a/drivers/media/platform/imx/Kconfig
+++ b/drivers/media/platform/imx/Kconfig
@@ -9,6 +9,15 @@ config MEDIA_IMX
config VIDEO_IMX_IPU_COMMON
tristate
+config VIDEO_IMX_IPU_CAPTURE
+ tristate "i.MX5/6 Video Capture driver"
+ depends on IMX_IPUV3_CORE && VIDEO_V4L2_SUBDEV_API && MEDIA_IMX
+ select VIDEOBUF2_DMA_CONTIG
+ select VIDEO_IMX_IPU_COMMON
+ select VIDEO_IMX_IPUV3
+ help
+ This is a v4l2 video capture driver for the IPUv3 on i.MX5/6.
+
config VIDEO_IMX_IPU_CSI
tristate "i.MX5/6 CMOS Sensor Interface driver"
depends on VIDEO_DEV && IMX_IPUV3_CORE && MEDIA_IMX
diff --git a/drivers/media/platform/imx/Makefile b/drivers/media/platform/imx/Makefile
index 82a3616..919eaa1 100644
--- a/drivers/media/platform/imx/Makefile
+++ b/drivers/media/platform/imx/Makefile
@@ -1,3 +1,4 @@
obj-$(CONFIG_MEDIA_IMX) += imx-media.o
obj-$(CONFIG_VIDEO_IMX_IPU_COMMON) += imx-ipu.o
+obj-$(CONFIG_VIDEO_IMX_IPU_CAPTURE) += imx-ipu-capture.o
obj-$(CONFIG_VIDEO_IMX_IPU_CSI) += imx-ipuv3-csi.o
diff --git a/drivers/media/platform/imx/imx-ipu-capture.c b/drivers/media/platform/imx/imx-ipu-capture.c
new file mode 100644
index 0000000..1308c1e
--- /dev/null
+++ b/drivers/media/platform/imx/imx-ipu-capture.c
@@ -0,0 +1,1015 @@
+/*
+ * i.MX IPUv3 V4L2 Capture Driver
+ *
+ * Copyright (C) 2016, Pengutronix, Philipp Zabel
+ *
+ * Based on code
+ * Copyright (C) 2006, Pengutronix, Sascha Hauer
+ * Copyright (C) 2008, Guennadi Liakhovetski
+ * Copyright (C) 2008, Paulius Zaleckas
+ * Copyright (C) 2009, Darius Augulis
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include