From patchwork Thu Apr 5 14:00:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 7673 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 25C3623ECD for ; Thu, 5 Apr 2012 14:00:52 +0000 (UTC) Received: from mail-gy0-f180.google.com (mail-gy0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id EA7D2A18B01 for ; Thu, 5 Apr 2012 14:00:51 +0000 (UTC) Received: by mail-gy0-f180.google.com with SMTP id z12so856973ghb.11 for ; Thu, 05 Apr 2012 07:00:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :mime-version:date:from:in-reply-to:to:message-id:x-mailer :references:cc:subject:x-beenthere:x-mailman-version:precedence :list-id:list-unsubscribe:list-archive:list-post:list-help :list-subscribe:content-type:content-transfer-encoding:sender :errors-to:x-gm-message-state; bh=s7t+gKyHGY8Bs96u7Z63fgfeHJCkp4IspgjVWtECbxE=; b=bvC8cWzf7gymCocPBJ8ch3WDMG9yPRUNgpZWPTUnXMNm7EzUhgjjDJBIxyGDAr4KXg c9f1Ge6nrhKru+HzE9ZJ/Zr65JqA3eAXrs3rutuhU6CDtnlnzbCHURFRhA+SZYcYY5Vf hopdTB1Efbxj8Ets3UWaBvnLcIYebONoeJNU3pyuSh/Oftc+CePPQur104NiDhxwATv/ PogwGEsYjEi9ejovcw3ixCzrplLhY+1/GOWE0UwzraG+dpsSieQZNEqO27fHkmyAx+IE j+xsUv/ir8Kdwdxp4qpAz0mBdSiLVXngMFNLR/VF/8bMIE319D7Se/o3sZIs60cdhMTn 9T8w== Received: by 10.50.156.229 with SMTP id wh5mr4980320igb.28.1333634451243; Thu, 05 Apr 2012 07:00:51 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.164.217 with SMTP id f25csp61165iby; Thu, 5 Apr 2012 07:00:46 -0700 (PDT) Received: by 10.216.144.6 with SMTP id m6mr1637140wej.43.1333634440305; Thu, 05 Apr 2012 07:00:40 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id r80si4432380weq.60.2012.04.05.07.00.39; Thu, 05 Apr 2012 07:00:40 -0700 (PDT) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SFnEs-0004yI-5V; Thu, 05 Apr 2012 14:00:38 +0000 Received: from mailout4.w1.samsung.com ([210.118.77.14]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SFnEo-0003qu-OH for linaro-mm-sig@lists.linaro.org; Thu, 05 Apr 2012 14:00:34 +0000 MIME-version: 1.0 Received: from euspt1 ([210.118.77.14]) by mailout4.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0M2000KB4EX1JT70@mailout4.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Thu, 05 Apr 2012 15:00:37 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M20009R9EWWP5@spt1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Thu, 05 Apr 2012 15:00:32 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 3CE9927008D; Thu, 05 Apr 2012 16:07:23 +0200 (CEST) Date: Thu, 05 Apr 2012 16:00:07 +0200 From: Tomasz Stanislawski In-reply-to: <1333634408-4960-1-git-send-email-t.stanislaws@samsung.com> To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Message-id: <1333634408-4960-11-git-send-email-t.stanislaws@samsung.com> X-Mailer: git-send-email 1.7.9.1 References: <1333634408-4960-1-git-send-email-t.stanislaws@samsung.com> Cc: pawel@osciak.com, sumit.semwal@ti.com, robdclark@gmail.com, linaro-mm-sig@lists.linaro.org, kyungmin.park@samsung.com, airlied@redhat.com Subject: [Linaro-mm-sig] [PATCH 10/11] v4l: vb2-dma-contig: add prepare/finish to dma-contig allocator X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQlmS5dyXIZIfc/W3m5nlF4kvtnNzkXDw447u9RiRkYkXEWRFg9LV44e1CVVU8ZChCd3GYlr From: Marek Szyprowski Add prepare/finish callbacks to vb2-dma-contig allocator. Signed-off-by: Marek Szyprowski --- drivers/media/video/videobuf2-dma-contig.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index 6ab3165..30f316588 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -152,6 +152,28 @@ static unsigned int vb2_dc_num_users(void *buf_priv) return atomic_read(&buf->refcount); } +static void vb2_dc_prepare(void *buf_priv) +{ + struct vb2_dc_buf *buf = buf_priv; + struct sg_table *sgt = buf->dma_sgt; + + if (!sgt) + return; + + dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); +} + +static void vb2_dc_finish(void *buf_priv) +{ + struct vb2_dc_buf *buf = buf_priv; + struct sg_table *sgt = buf->dma_sgt; + + if (!sgt) + return; + + dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); +} + /*********************************************/ /* callbacks for MMAP buffers */ /*********************************************/ @@ -414,6 +436,8 @@ const struct vb2_mem_ops vb2_dma_contig_memops = { .mmap = vb2_dc_mmap, .get_userptr = vb2_dc_get_userptr, .put_userptr = vb2_dc_put_userptr, + .prepare = vb2_dc_prepare, + .finish = vb2_dc_finish, .num_users = vb2_dc_num_users, }; EXPORT_SYMBOL_GPL(vb2_dma_contig_memops);