board-msm8960: Add ion heaps corresponding to pmem heaps
Add adsp heaps for ion. This corresponds directly
to what pmem currently does. This also includes disabling
the adsp and pmem heaps for pmem.
Change-Id: I4354c713413ebbe949579741efdd75e9c444c8e7
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index 0f427e9..d5f727d 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -1745,4 +1745,12 @@
Enabling this driver allows configuring L2 SPM for low power modes
on supported chipsets.
+config MSM_MULTIMEDIA_USE_ION
+ bool "Multimedia suport using Ion"
+ depends on ION_MSM
+ help
+ Enable support for multimedia drivers using Ion for buffer management
+ instead of pmem. Selecting this may also involve userspace
+ dependencies as well.
+
endif
diff --git a/arch/arm/mach-msm/board-msm8960.c b/arch/arm/mach-msm/board-msm8960.c
index a7cd02f..397fc25 100644
--- a/arch/arm/mach-msm/board-msm8960.c
+++ b/arch/arm/mach-msm/board-msm8960.c
@@ -793,7 +793,15 @@
#else
#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
#endif
-#define MSM_ION_EBI_SIZE SZ_8M
+
+
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+#define MSM_ION_EBI_SIZE MSM_PMEM_SIZE
+#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
+#define MSM_ION_HEAP_NUM 4
+#else
+#define MSM_ION_HEAP_NUM 2
+#endif
#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
@@ -834,6 +842,7 @@
#endif
#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
static struct android_pmem_platform_data android_pmem_pdata = {
.name = "pmem",
.allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
@@ -858,6 +867,7 @@
.id = 2,
.dev = { .platform_data = &android_pmem_adsp_pdata },
};
+#endif
static struct android_pmem_platform_data android_pmem_audio_pdata = {
.name = "pmem_audio",
@@ -907,8 +917,10 @@
static void __init size_pmem_devices(void)
{
#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
android_pmem_adsp_pdata.size = pmem_adsp_size;
android_pmem_pdata.size = pmem_size;
+#endif
android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
#endif
}
@@ -921,8 +933,10 @@
static void __init reserve_pmem_memory(void)
{
#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
reserve_memory_for(&android_pmem_adsp_pdata);
reserve_memory_for(&android_pmem_pdata);
+#endif
reserve_memory_for(&android_pmem_audio_pdata);
msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
#endif
@@ -935,7 +949,7 @@
#ifdef CONFIG_ION_MSM
struct ion_platform_data ion_pdata = {
- .nr = 3,
+ .nr = MSM_ION_HEAP_NUM,
.heaps = {
{
.id = ION_HEAP_SYSTEM_ID,
@@ -947,6 +961,7 @@
.type = ION_HEAP_TYPE_SYSTEM_CONTIG,
.name = ION_VMALLOC_HEAP_NAME,
},
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
{
.id = ION_HEAP_EBI_ID,
.type = ION_HEAP_TYPE_CARVEOUT,
@@ -954,6 +969,14 @@
.size = MSM_ION_EBI_SIZE,
.memory_type = ION_EBI_TYPE,
},
+ {
+ .id = ION_HEAP_ADSP_ID,
+ .type = ION_HEAP_TYPE_CARVEOUT,
+ .name = ION_ADSP_HEAP_NAME,
+ .size = MSM_ION_ADSP_SIZE,
+ .memory_type = ION_EBI_TYPE,
+ },
+#endif
}
};
@@ -966,8 +989,9 @@
static void reserve_ion_memory(void)
{
-#ifdef CONFIG_ION_MSM
+#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
+ msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
#endif
}
static void __init msm8960_calculate_reserve_sizes(void)
@@ -3645,8 +3669,10 @@
&fish_battery_device,
#endif
#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
&android_pmem_device,
&android_pmem_adsp_device,
+#endif
&android_pmem_audio_device,
#endif
&msm_fb_device,
diff --git a/include/linux/ion.h b/include/linux/ion.h
index b868228..e63d282 100644
--- a/include/linux/ion.h
+++ b/include/linux/ion.h
@@ -57,11 +57,14 @@
ION_HEAP_SYSTEM_CONTIG_ID,
ION_HEAP_EBI_ID,
ION_HEAP_SMI_ID,
+ ION_HEAP_ADSP_ID,
+ ION_HEAP_AUDIO_ID,
};
#define ION_KMALLOC_HEAP_NAME "kmalloc"
#define ION_VMALLOC_HEAP_NAME "vmalloc"
#define ION_EBI1_HEAP_NAME "EBI1"
+#define ION_ADSP_HEAP_NAME "adsp"
#define CACHED 1
#define UNCACHED 0