From patchwork Fri Dec 9 12:35:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 9468085 X-Patchwork-Delegate: geert@linux-m68k.org 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 A6EEF607EE for ; Fri, 9 Dec 2016 12:35:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9ADB928624 for ; Fri, 9 Dec 2016 12:35:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FADA2863B; Fri, 9 Dec 2016 12:35:31 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 1ECB328633 for ; Fri, 9 Dec 2016 12:35:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933552AbcLIMf2 (ORCPT ); Fri, 9 Dec 2016 07:35:28 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36127 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933423AbcLIMf0 (ORCPT ); Fri, 9 Dec 2016 07:35:26 -0500 Received: by mail-wm0-f65.google.com with SMTP id m203so3768848wma.3; Fri, 09 Dec 2016 04:35:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Pv6wkWp0VhfQ9xFMcO1BXl5DXZziTcR1VbttR2nZeFw=; b=Fa8z8O/Qs11fkYSk+qEAhQgqxk81ROgP9gnJ6AAT4GMq5vOQfq95kQ289Z7YaMEhfk nF6MgK4cFpKc3oxVSMe/+Mc9OQYVBrfyIFGnHVm5aKNmy14w6Ig8R8IOu1r4/3oOho74 XDpdlbqhmrOGCeHNmQuMZ4hyKzbFAj1mlcQr5lfwdOuWI7geGoC2p+gZTb3pq4mVGFY6 fqYbqE4f99Z50Jg5TVyxSrmwj33o1PuMaJZ93d9UxkZkNsx3BbWfVjvfNCJidxMJqjtJ 4FvHWr5oYe1mrAXGxtAjoJO7GJggKkhbG2RF/9/8n4tn9TjwZE89oFsvjvCsI0QFPDdd v6sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Pv6wkWp0VhfQ9xFMcO1BXl5DXZziTcR1VbttR2nZeFw=; b=hLwDvDO/wYsMgDcHOFUI7xnw3KbexRMKYQglC5bsAnXPZtYAjkNAREYoC8v2vglTAa bi7rVRjsY4ShJaovLdfHbMxgZI0gH9qb+vjOpnENOKJdMu0J7nEDCR/Uqy9OviVADyLr tErW96jxGaPjfqlD+m9t0i4iiT+hfnG3Mg8NK+VZ0VEs0ybeh99VRHrDA1vnNNoBi2t1 GMg/OR3QPizEygZOasBJHqT34+tzoJhom1zE0EFbNMcqDs5rsNlymbje7g4LOxF1aIeO GzUJKlMaezwFCAEApAnMruLfSYc2IbqtLmxBmikvB6TYzp9lgt3MXIycxexgsojQywuh e5rw== X-Gm-Message-State: AKaTC03Z//ibhTZFiTTs4CC3+qLMWam+isLpUj6ySzh48OySGtorZoMikciwLq3oxCrXow== X-Received: by 10.28.165.131 with SMTP id o125mr6674732wme.9.1481286924964; Fri, 09 Dec 2016 04:35:24 -0800 (PST) Received: from groucho.site (ipbcc17b88.dynamic.kabel-deutschland.de. [188.193.123.136]) by smtp.gmail.com with ESMTPSA id x140sm20360920wme.19.2016.12.09.04.35.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Dec 2016 04:35:24 -0800 (PST) From: Ulrich Hecht To: linux-renesas-soc@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, magnus.damm@gmail.com, Laurent Pinchart Subject: [PATCH v1.5 3/6] v4l: vsp1: Add API to map and unmap DRM buffers through the VSP Date: Fri, 9 Dec 2016 13:35:09 +0100 Message-Id: <1481286912-16555-4-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481286912-16555-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1481286912-16555-1-git-send-email-ulrich.hecht+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Laurent Pinchart The display buffers must be mapped for DMA through the device that performs memory access. Expose an API to map and unmap memory through the VSP device to be used by the DU. Signed-off-by: Laurent Pinchart --- drivers/media/platform/vsp1/vsp1_drm.c | 24 ++++++++++++++++++++++++ include/media/vsp1.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index cd209dc..bb35603 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -12,9 +12,11 @@ */ #include +#include #include #include +#include #include #include @@ -519,6 +521,28 @@ void vsp1_du_atomic_flush(struct device *dev) } EXPORT_SYMBOL_GPL(vsp1_du_atomic_flush); +int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt) +{ + struct vsp1_device *vsp1 = dev_get_drvdata(dev); + struct device *map_dev; + + map_dev = vsp1->fcp ? rcar_fcp_get_device(vsp1->fcp) : dev; + + return dma_map_sg(map_dev, sgt->sgl, sgt->nents, DMA_TO_DEVICE); +} +EXPORT_SYMBOL_GPL(vsp1_du_map_sg); + +void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt) +{ + struct vsp1_device *vsp1 = dev_get_drvdata(dev); + struct device *map_dev; + + map_dev = vsp1->fcp ? rcar_fcp_get_device(vsp1->fcp) : dev; + + dma_unmap_sg(map_dev, sgt->sgl, sgt->nents, DMA_TO_DEVICE); +} +EXPORT_SYMBOL_GPL(vsp1_du_unmap_sg); + /* ----------------------------------------------------------------------------- * Initialization */ diff --git a/include/media/vsp1.h b/include/media/vsp1.h index 458b400..8d3d07a 100644 --- a/include/media/vsp1.h +++ b/include/media/vsp1.h @@ -13,6 +13,7 @@ #ifndef __MEDIA_VSP1_H__ #define __MEDIA_VSP1_H__ +#include #include #include @@ -37,5 +38,7 @@ void vsp1_du_atomic_begin(struct device *dev); int vsp1_du_atomic_update(struct device *dev, unsigned int rpf, const struct vsp1_du_atomic_config *cfg); void vsp1_du_atomic_flush(struct device *dev); +int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt); +void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt); #endif /* __MEDIA_VSP1_H__ */