1 /* linux/drivers/media/video/s5p-fimc/fimc_vb2.c
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
6 * Core file for Samsung Camera Interface (FIMC) driver
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/platform_device.h>
14 #include "fimc-core.h"
16 #ifdef CONFIG_VIDEOBUF2_SDVMM
17 void *fimc_sdvmm_init(struct fimc_dev *fimc)
19 struct vb2_vcm vb2_vcm;
20 struct vb2_cma vb2_cma;
21 char cma_name[FIMC_CMA_NAME_SIZE] = {0,};
22 struct vb2_drv vb2_drv;
24 fimc->vcm_id = VCM_DEV_FIMC0 + fimc->id;
26 vb2_vcm.vcm_id = fimc->vcm_id;
27 vb2_vcm.size = SZ_64M;
29 vb2_cma.dev = &fimc->pdev->dev;
30 /* FIXME: need to set type value */
31 sprintf(cma_name, "%s%d", FIMC_CMA_NAME, fimc->id);
32 vb2_cma.type = cma_name;
33 vb2_cma.alignment = SZ_4K;
35 vb2_drv.cacheable = false;
36 vb2_drv.remap_dva = false;
38 return vb2_sdvmm_init(&vb2_vcm, &vb2_cma, &vb2_drv);
41 const struct fimc_vb2 fimc_vb2_sdvmm = {
42 .ops = &vb2_sdvmm_memops,
43 .init = fimc_sdvmm_init,
44 .cleanup = vb2_sdvmm_cleanup,
45 .plane_addr = vb2_sdvmm_plane_dvaddr,
46 .resume = vb2_sdvmm_resume,
47 .suspend = vb2_sdvmm_suspend,
48 .cache_flush = vb2_sdvmm_cache_flush,
50 .cache_flush = vb2_sdvmm_cache_clean,
51 .cache_flush = vb2_sdvmm_cache_clean2,
52 .cache_flush = vb2_sdvmm_cache_inv,
54 .set_cacheable = vb2_sdvmm_set_cacheable,
59 void *fimc_cma_init(struct fimc_dev *fimc)
61 return vb2_cma_init(&fimc->pdev->dev, NULL, 0);
64 void fimc_cma_resume(void *alloc_ctx){}
65 void fimc_cma_suspend(void *alloc_ctx){}
66 int fimc_cma_cache_flush(void *alloc_ctx, struct vb2_buffer *vb, u32 plane_no){}
67 void fimc_cma_set_cacheable(void *alloc_ctx, bool cacheable){}
69 const struct fimc_vb2 fimc_vb2_cma = {
70 .ops = &vb2_cma_memops,
71 .init = fimc_cma_init,
72 .cleanup = vb2_cma_cleanup,
73 .plane_addr = vb2_cma_plane_paddr,
74 .resume = fimc_cma_resume,
75 .suspend = fimc_cma_suspend,
76 .cache_flush = fimc_cma_cache_flush,
77 .set_cacheable = fimc_cma_set_cacheable,