aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/android/ion/css/css_ion_dev.c
blob: 6e88c492c6fd859f07c98c1a1a5e084cabf1a70b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * drivers/gpu/ion/css/css_ion_dev.c
 *
 * Copyright (C) 2014 ARM, Inc.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include "../ion.h"
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */

u64 css_dmamask = DMA_BIT_MASK(64);

struct platform_device css_device_ion = {
        .name           = "ion-css",
        .id             = -1,
};

struct ion_platform_heap css_heaps[] = {
		{
			.id	= ION_HEAP_TYPE_SYSTEM,
			.type	= ION_HEAP_TYPE_SYSTEM,
			.name	= "system",
		},
		{
			.id	= ION_HEAP_TYPE_SYSTEM_CONTIG,
			.type	= ION_HEAP_TYPE_SYSTEM_CONTIG,
			.name	= "system contig",
		},
		{
			.id	= ION_HEAP_TYPE_DMA,
			.type 	= ION_HEAP_TYPE_DMA,
			.name	= "ion_dma_heap-3",
			.priv	= &css_device_ion.dev,
		}
};

struct ion_platform_data css_ion_pdata = {
	.nr = 3,
	.heaps = css_heaps,
};

static int __init css_ion_dev_init(void)
{
	css_device_ion.dev.platform_data = &css_ion_pdata;
	css_device_ion.dev.coherent_dma_mask = css_dmamask;
	css_device_ion.dev.dma_mask = &css_dmamask;


	return platform_device_register(&css_device_ion);
}

static void __exit css_ion_dev_exit(void)
{
        platform_device_unregister(&css_device_ion);
}

module_init(css_ion_dev_init);
module_exit(css_ion_dev_exit);