From patchwork Wed Oct 10 14:46:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 1574171 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 6E5633FE36 for ; Wed, 10 Oct 2012 14:54:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756809Ab2JJOyE (ORCPT ); Wed, 10 Oct 2012 10:54:04 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:20795 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756779Ab2JJOyC (ORCPT ); Wed, 10 Oct 2012 10:54:02 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBO00FV4MPUOC60@mailout1.samsung.com> for linux-media@vger.kernel.org; Wed, 10 Oct 2012 23:54:00 +0900 (KST) X-AuditID: cbfee61b-b7f2b6d000000f14-b1-50758c088f4c Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id AE.6B.03860.80C85705; Wed, 10 Oct 2012 23:54:00 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBO002YDME0EC70@mmp1.samsung.com> for linux-media@vger.kernel.org; Wed, 10 Oct 2012 23:54:00 +0900 (KST) From: Tomasz Stanislawski To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: airlied@redhat.com, m.szyprowski@samsung.com, t.stanislaws@samsung.com, kyungmin.park@samsung.com, laurent.pinchart@ideasonboard.com, sumit.semwal@ti.com, daeinki@gmail.com, daniel.vetter@ffwll.ch, robdclark@gmail.com, pawel@osciak.com, linaro-mm-sig@lists.linaro.org, hverkuil@xs4all.nl, remi@remlab.net, subashrp@gmail.com, mchehab@redhat.com, zhangfei.gao@gmail.com, s.nawrocki@samsung.com, k.debski@samsung.com Subject: [PATCHv10 10/26] v4l: vb2-dma-contig: add prepare/finish to dma-contig allocator Date: Wed, 10 Oct 2012 16:46:29 +0200 Message-id: <1349880405-26049-11-git-send-email-t.stanislaws@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1349880405-26049-1-git-send-email-t.stanislaws@samsung.com> References: <1349880405-26049-1-git-send-email-t.stanislaws@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jAV2OntIAg77zehY9G7ayOjB6fN4k F8AYxWWTkpqTWZZapG+XwJUx99o+1oKjvBXHbms2MB7g7mLk5JAQMJFY8WQNE4QtJnHh3nq2 LkYuDiGBRYwS15feYIRwVjFJ3Nq6kQWkig2o49iSz4wgtoiAg8Tpu7OYQYqYBdYwS7xYeYMN JCEsEC2xd8c2sCIWAVWJ5f9WgjXzCnhKNK6dxgixTl7i6f0+sHpOoPiFedOZQWwhAQ+J/+s3 M01g5F3AyLCKUTS1ILmgOCk910ivODG3uDQvXS85P3cTI9jnz6R3MK5qsDjEKMDBqMTDW5FR EiDEmlhWXJl7iFGCg1lJhNfUpzRAiDclsbIqtSg/vqg0J7X4EKM0B4uSOG+zR0qAkEB6Yklq dmpqQWoRTJaJg1OqgdFRTHY+Z2KK5xtHM/1rYos3rqoX5POw4Ft34nTxmrq9YhLJO7JUOs2s OR2k5+i/ZVdeZfQtwdFpxRqvUOGOmrmz1k4y/2WXtCRdVmCmrHt5buXaax/Z18VbnOCY8LzQ T3lGfVzb2dd5z/l2lfdfeViz+lrcgTNfXeL3HPk4dWnTfYXQveztaUosxRmJhlrMRcWJAKI9 xVr1AQAA Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Marek Szyprowski Add prepare/finish callbacks to vb2-dma-contig allocator. Signed-off-by: Marek Szyprowski Acked-by: Laurent Pinchart Acked-by: Hans Verkuil --- drivers/media/v4l2-core/videobuf2-dma-contig.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 8486e06..494a824 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -103,6 +103,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 */ /*********************************************/ @@ -366,6 +388,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);