From patchwork Wed Jul 6 23:06:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 9217343 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 631B6607D9 for ; Wed, 6 Jul 2016 23:08:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52AF428525 for ; Wed, 6 Jul 2016 23:08:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 476FB28527; Wed, 6 Jul 2016 23:08:15 +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 2141E28525 for ; Wed, 6 Jul 2016 23:08:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932709AbcGFXIC (ORCPT ); Wed, 6 Jul 2016 19:08:02 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:36467 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932671AbcGFXHt (ORCPT ); Wed, 6 Jul 2016 19:07:49 -0400 Received: by mail-pa0-f66.google.com with SMTP id ib6so90967pad.3 for ; Wed, 06 Jul 2016 16:07:49 -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=iKJXRerFB/EvtunuaaaIt4/1qCa7B9u8Z2doYgIgfFA=; b=wt//W5OPSIAcH1jqiYPZMZVcfVArDqfIV6Ot+vrLllccypE50VOs9keBV0JyHVTYS3 m27Zdq/WOBxUbpTWDXQS+5LGjttRQUm1EDDM3n2/2vtQ+CmicJiJtYPMRBVgV1TRbwYJ pKBML/tGqAfMW6QPckp1hZktp1y1OYqDyaJHMIZrVTER7rog4zpPLX9LrCBeh78mhPCP zN17975o9fLPo0OetyN6MLzfHbx/8MZnxJ0Dv19F4kH2rwEaTrANOqR7tfKbnne680sC Yjedo9Bn0DxD4EEBVp4msl8hRzaYn5xI1AOls5Mg8Y8BWCx7ZcRoikZpzeLTXd/AT/Z7 VO1g== 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=iKJXRerFB/EvtunuaaaIt4/1qCa7B9u8Z2doYgIgfFA=; b=gGRkTberHACrT8p0/EtlxzsArCqx+nXfebrreuEUH5lSUZKltPz893rFTiBPa12PEp 1Ga5aO9Q1mi37CJVIHwUTAQnHMhkL+8c0W0IMiR9IDxTyGqHJwY/zdcnuVYC3QFZjulz gvo097SdWso2ThQRwq7rvQLlhlV4w0/q2e7PDDEE6BD/6ElN6prGTqmPrYNzMWXwtG8Z qlZ9n7Cb7DRNB6u16UaxgEyCdus04A3wxypjweMSAgWncFI4ZdOpuf6kV79o33Jwbf6u bTq0atrydeLxPXK6LL5ubLFfLGyaE8Ly8xBO2G9LkqYk6ine1Ohz9PEZEjHgD1w+eI0M bjmw== X-Gm-Message-State: ALyK8tJ1G0MEH/9vla5FKYpGm5IApd00Xx9PIK/cas+OhS0+SPNE4OeN3bePPTDlVTVddQ== X-Received: by 10.66.162.3 with SMTP id xw3mr45988649pab.82.1467846467898; Wed, 06 Jul 2016 16:07:47 -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 c189sm6724125pfg.19.2016.07.06.16.07.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Jul 2016 16:07:47 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Steve Longerbeam Subject: [PATCH 24/28] media: Add i.MX5/6 mem2mem driver Date: Wed, 6 Jul 2016 16:06:54 -0700 Message-Id: <1467846418-12913-25-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467846418-12913-1-git-send-email-steve_longerbeam@mentor.com> References: <1465944574-15745-1-git-send-email-steve_longerbeam@mentor.com> <1467846418-12913-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 5a89b51..67d3817 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..66b49ff --- /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