From patchwork Fri Apr 13 15:47:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 7802 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 91D3E23E42 for ; Fri, 13 Apr 2012 15:48:53 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 60F56A183CE for ; Fri, 13 Apr 2012 15:48:53 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id l4so2143333yen.11 for ; Fri, 13 Apr 2012 08:48:53 -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:date:from :in-reply-to:to:message-id:mime-version: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=wJ/QX5o/BcUAMZlsaRRCblha84ieQsryo/uJr2t6wLo=; b=mr9wPE6q3jh94h7Ix8r9fehns2jh4QcfbLZozz/0v2eWVCQwvOPuGM7ECnjKzlRIy2 DzqdojXFoQtys9sMXojFy06VC9EAj1ndzinnV266EyLNWFhbh+rW9Ano2uXGrukYUsdo HcewIvsgMmZMu4cSvDID381vbqR6Q1rUo6eS6to5uGanShPMGeBUcdSQA37R3LRF/vSo xUmIz3eUwcjwfn9S32/a/rCPJWS1BQ8cv2IYDs7X+/2WkzoWjpqEeZRZmmYmzVjtPeMQ ewkmjsHhs79VujeL7QwP8zGyUKQ0rJgjVBcn1jzpGrX66/UEiOmHK2JuGcxda2NgL3vs oVfg== Received: by 10.50.187.137 with SMTP id fs9mr2109930igc.50.1334332132964; Fri, 13 Apr 2012 08:48:52 -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.70.69 with SMTP id c5csp38531ibj; Fri, 13 Apr 2012 08:48:52 -0700 (PDT) Received: by 10.180.83.72 with SMTP id o8mr5111890wiy.5.1334332126482; Fri, 13 Apr 2012 08:48:46 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id s43si9907191weq.4.2012.04.13.08.48.16; Fri, 13 Apr 2012 08:48:46 -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 1SIijP-0006L1-0N; Fri, 13 Apr 2012 15:48:15 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SIijH-0006GS-3J for linaro-mm-sig@lists.linaro.org; Fri, 13 Apr 2012 15:48:07 +0000 Received: from euspt1 (mailout1.w1.samsung.com [210.118.77.11]) by mailout1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0M2F0077WD6DVT@mailout1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Fri, 13 Apr 2012 16:47:01 +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 <0M2F005JPD84XW@spt1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Fri, 13 Apr 2012 16:48:05 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 99F39270083; Fri, 13 Apr 2012 17:58:32 +0200 (CEST) Date: Fri, 13 Apr 2012 17:47:52 +0200 From: Tomasz Stanislawski In-reply-to: <1334332076-28489-1-git-send-email-t.stanislaws@samsung.com> To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Message-id: <1334332076-28489-11-git-send-email-t.stanislaws@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.9.1 References: <1334332076-28489-1-git-send-email-t.stanislaws@samsung.com> Cc: pawel@osciak.com, sumit.semwal@ti.com, mchehab@redhat.com, robdclark@gmail.com, linaro-mm-sig@lists.linaro.org, kyungmin.park@samsung.com, airlied@redhat.com, remi@remlab.net Subject: [Linaro-mm-sig] [PATCH v4 10/14] 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: ALoCoQlkCtW4gmUiOM4c3JvrrIdl6bQ/TsFRQvTeWut5vLJ3h82p68y3wFvb4GsZpyC2+fWpZ64Z 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 3a1e314..3b1ac77d 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -157,6 +157,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 */ /*********************************************/ @@ -419,6 +441,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);