From patchwork Tue Jun 14 22:49:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 9177109 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 D96586021C for ; Tue, 14 Jun 2016 22:52:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C75E928307 for ; Tue, 14 Jun 2016 22:52:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC48B2833E; Tue, 14 Jun 2016 22:52:07 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 28B4728307 for ; Tue, 14 Jun 2016 22:52:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753042AbcFNWvx (ORCPT ); Tue, 14 Jun 2016 18:51:53 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33558 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753028AbcFNWvd (ORCPT ); Tue, 14 Jun 2016 18:51:33 -0400 Received: by mail-pf0-f196.google.com with SMTP id c74so307200pfb.0 for ; Tue, 14 Jun 2016 15:51:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H39CAL5Y97RNtSCR49pm9FxBp2DutmhE+A2q3FHdz0I=; b=d7cYYwzhhabZnB2M7yU0XMkbbqsI0s6HR2PckRMFTgP9bZDabl81nb3pNyDJtw8r2h k1dpUh/i1DZ/6uMD1KZ+PdZcvsMiMdJu5oNp09PKvMRjdycfxcztX1971vST1upVL1Ky HeY0Pl3FTIMl2QwKd7Lm8H7qx9UaEMrZg1dQ2RgfSF00jHbZOcB3tdxT0oPDm9TdHlQd Oxb+qVW0VOsNZopMYpi1FQjOzLCDXbQ1lMJTCVXWAB3boSUbnMduT8gIdsbL9wtg0KNn xsyXZIrf89tMc8m8OdLd2svGHYpm/n12Y87f3gni7NwEuDagiGnan/36pr+cM9nIyG7N vlqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H39CAL5Y97RNtSCR49pm9FxBp2DutmhE+A2q3FHdz0I=; b=PY7GSYDzvUEEy4wnXAf4DjsRfgyx9xUcyFP9/QjIrbMlCHFimnY/v9Gb3X1IWLJazE ctXi8BYIxnBZOTYXV50eokWG1W49xHpMg6rl2FXqfIZsnaTz7cdCaOmGYCT2FxGW0LXC aPCueJLsvbZ585OU2S87Fi3eAE9QWUxmdkBcyIaPddgq3XO7W15nbfmkNEMSvm61IlTk dUzHz5afmXMu1LMp0n9WzUEknWeURuZTFAtzRJ+IvkYnuccVbYm+dxLJiv5xRYaT+RgO u5gznpISCDmlFteDCBdkUvjtnywzGHgnL0SOS//NJXVYoqpAjZMPD5jE1OV4Sf4xJa5j mw4g== X-Gm-Message-State: ALyK8tKT4w5E+65SDUXkjBn5i+tby/1ppzhAIBJBTYY76T6DzP/c2sSLtpoNZaryYpmK2A== X-Received: by 10.67.5.73 with SMTP id ck9mr20027pad.127.1465944692773; Tue, 14 Jun 2016 15:51:32 -0700 (PDT) Received: from mothership.sklembedded.com (c-73-241-2-21.hsd1.ca.comcast.net. [73.241.2.21]) by smtp.googlemail.com with ESMTPSA id v184sm47829999pfb.24.2016.06.14.15.51.32 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Jun 2016 15:51:32 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Steve Longerbeam Subject: [PATCH 37/38] media: Add i.MX5/6 mem2mem driver Date: Tue, 14 Jun 2016 15:49:33 -0700 Message-Id: <1465944574-15745-38-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465944574-15745-1-git-send-email-steve_longerbeam@mentor.com> References: <1465944574-15745-1-git-send-email-steve_longerbeam@mentor.com> 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 Adds a V4L2 mem2mem driver for i.MX5/6 SoC. Uses the IPU IC image converter (post-processor task) to perform scaling, rotation, and color space conversion. Signed-off-by: Steve Longerbeam --- Documentation/devicetree/bindings/media/imx.txt | 25 +- drivers/staging/media/imx/Kconfig | 12 + drivers/staging/media/imx/Makefile | 1 + drivers/staging/media/imx/m2m/Makefile | 1 + drivers/staging/media/imx/m2m/imx-m2m.c | 1049 +++++++++++++++++++++++ 5 files changed, 1087 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/media/imx/m2m/Makefile create mode 100644 drivers/staging/media/imx/m2m/imx-m2m.c diff --git a/Documentation/devicetree/bindings/media/imx.txt b/Documentation/devicetree/bindings/media/imx.txt index 1f2ca4b..12ef06c 100644 --- a/Documentation/devicetree/bindings/media/imx.txt +++ b/Documentation/devicetree/bindings/media/imx.txt @@ -1,4 +1,27 @@ -Freescale i.MX Video Capture +Freescale i.MX Video Capture, Mem2Mem + +Video Mem2Mem node +------------------ + +This is the imx video mem2mem device node. The mem2mem node is an IPU +client and uses the register-level primitives of the IPU, so it does +not require reg or interrupt properties. Only a compatible property +and the ipu phandle is required. + +Required properties: +- compatible : "fsl,imx-video-mem2mem"; +- ipu : the ipu phandle; + +Example: + +/ { + ipum2m0: ipum2m@ipu1 { + compatible = "fsl,imx-video-mem2mem"; + ipu = <&ipu1>; + status = "okay"; + }; +}; + Video Capture node ------------------ diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig index 65e1645..3305daa 100644 --- a/drivers/staging/media/imx/Kconfig +++ b/drivers/staging/media/imx/Kconfig @@ -21,3 +21,15 @@ config VIDEO_IMX_CAMERA if VIDEO_IMX_CAMERA source "drivers/staging/media/imx/capture/Kconfig" endif + +config VIDEO_IMX_M2M + tristate "i.MX5/6 Mem2Mem driver" + depends on VIDEO_IMX && VIDEO_DEV + select VIDEOBUF2_DMA_CONTIG + select V4L2_MEM2MEM_DEV + default y + ---help--- + Use the IPU IC Post-processor on the i.MX5/6 SoC for mem2mem + processing of buffers. Operations include scaling, rotation, + and color space conversion. The driver implements tiling to + support scaling up to 4096x4096. diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile index 7c97629..b9e31d8 100644 --- a/drivers/staging/media/imx/Makefile +++ b/drivers/staging/media/imx/Makefile @@ -1 +1,2 @@ obj-$(CONFIG_VIDEO_IMX_CAMERA) += capture/ +obj-$(CONFIG_VIDEO_IMX_M2M) += m2m/ diff --git a/drivers/staging/media/imx/m2m/Makefile b/drivers/staging/media/imx/m2m/Makefile new file mode 100644 index 0000000..287d258 --- /dev/null +++ b/drivers/staging/media/imx/m2m/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_IMX_M2M) += imx-m2m.o diff --git a/drivers/staging/media/imx/m2m/imx-m2m.c b/drivers/staging/media/imx/m2m/imx-m2m.c new file mode 100644 index 0000000..599f20e --- /dev/null +++ b/drivers/staging/media/imx/m2m/imx-m2m.c @@ -0,0 +1,1049 @@ +/* + * This is a mem2mem driver for the Freescale i.MX5/6 SOC. It carries out + * color-space conversion, downsizing, resizing, and rotation transformations + * on input buffers using the IPU Image Converter's Post-Processing task. + * + * Based on mem2mem_testdev.c by Pawel Osciak. + * + * Copyright (c) 2012-2013 Mentor Graphics Inc. + * Steve Longerbeam + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the + * License, or (at your option) any later version + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include