msm: audio: qdsp5v2: Update pmem_kalloc API

on .38 kernel the pmem_kalloc api is changed to
allocate_contiguous_ebi_nomap and pmem_kfree to
free_contiguous_memory_by_paddr, updated the pmem apis for
7630 target.

Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
diff --git a/arch/arm/mach-msm/qdsp5v2/audio_wma.c b/arch/arm/mach-msm/qdsp5v2/audio_wma.c
index 2695b83..464f66e 100644
--- a/arch/arm/mach-msm/qdsp5v2/audio_wma.c
+++ b/arch/arm/mach-msm/qdsp5v2/audio_wma.c
@@ -21,6 +21,9 @@
  * along with this program; if not, you can find it at http://www.fsf.org
  */
 
+#include <asm/atomic.h>
+#include <asm/ioctls.h>
+
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
@@ -33,20 +36,23 @@
 #include <linux/list.h>
 #include <linux/earlysuspend.h>
 #include <linux/android_pmem.h>
-#include <asm/atomic.h>
-#include <asm/ioctls.h>
-#include <mach/msm_adsp.h>
 #include <linux/slab.h>
 #include <linux/msm_audio.h>
+#include <linux/msm_audio_wma.h>
+#include <linux/memory_alloc.h>
 #include <mach/qdsp5v2/audio_dev_ctl.h>
 
-#include <linux/msm_audio_wma.h>
+#include <mach/msm_adsp.h>
+#include <mach/iommu.h>
+#include <mach/iommu_domains.h>
+#include <mach/msm_subsystem_map.h>
 #include <mach/qdsp5v2/qdsp5audppmsg.h>
 #include <mach/qdsp5v2/qdsp5audplaycmdi.h>
 #include <mach/qdsp5v2/qdsp5audplaymsg.h>
 #include <mach/qdsp5v2/audio_dev_ctl.h>
 #include <mach/qdsp5v2/audpp.h>
 #include <mach/debug_mm.h>
+#include <mach/msm_memtypes.h>
 
 /* Size must be power of 2 */
 #define BUFSZ_MAX 	4110	/* Includes meta in size */
@@ -135,6 +141,8 @@
 	/* data allocated for various buffers */
 	char *data;
 	int32_t phys; /* physical address of write buffer */
+	struct msm_mapped_buffer *map_v_read;
+	struct msm_mapped_buffer *map_v_write;
 
 	int mfield; /* meta field embedded in data */
 	int rflush; /* Read  flush */
@@ -1044,25 +1052,31 @@
 				MM_DBG("allocate PCM buffer %d\n",
 						config.buffer_count *
 						config.buffer_size);
-				audio->read_phys = pmem_kalloc(
+				audio->read_phys =
+						allocate_contiguous_ebi_nomap(
 							config.buffer_size *
 							config.buffer_count,
-							PMEM_MEMTYPE_EBI1|
-							PMEM_ALIGNMENT_4K);
-				if (IS_ERR((void *)audio->read_phys)) {
+							SZ_4K);
+				if (!audio->read_phys) {
 					rc = -ENOMEM;
 					break;
 				}
-				audio->read_data = ioremap(audio->read_phys,
+				audio->map_v_read = msm_subsystem_map_buffer(
+							audio->read_phys,
 							config.buffer_size *
-							config.buffer_count);
-				if (!audio->read_data) {
+							config.buffer_count,
+							MSM_SUBSYSTEM_MAP_KADDR
+							, NULL, 0);
+				if (IS_ERR(audio->map_v_read)) {
 					MM_ERR("read buf alloc fail\n");
 					rc = -ENOMEM;
-					pmem_kfree(audio->read_phys);
+					free_contiguous_memory_by_paddr(
+							audio->read_phys);
 				} else {
 					uint8_t index;
 					uint32_t offset = 0;
+					audio->read_data =
+						audio->map_v_read->vaddr;
 					audio->buf_refresh = 0;
 					audio->pcm_buf_count =
 					    config.buffer_count;
@@ -1443,11 +1457,11 @@
 	audio->event_abort = 1;
 	wake_up(&audio->event_wait);
 	audwma_reset_event_queue(audio);
-	iounmap(audio->data);
-	pmem_kfree(audio->phys);
+	msm_subsystem_unmap_buffer(audio->map_v_write);
+	free_contiguous_memory_by_paddr(audio->phys);
 	if (audio->read_data) {
-		iounmap(audio->read_data);
-		pmem_kfree(audio->read_phys);
+		msm_subsystem_unmap_buffer(audio->map_v_read);
+		free_contiguous_memory_by_paddr(audio->read_phys);
 	}
 	mutex_unlock(&audio->lock);
 #ifdef CONFIG_DEBUG_FS
@@ -1635,20 +1649,23 @@
 
 	while (pmem_sz >= DMASZ_MIN) {
 		MM_DBG("pmemsz = %d\n", pmem_sz);
-		audio->phys = pmem_kalloc(pmem_sz, PMEM_MEMTYPE_EBI1|
-					PMEM_ALIGNMENT_4K);
-		if (!IS_ERR((void *)audio->phys)) {
-			audio->data = ioremap(audio->phys, pmem_sz);
-			if (!audio->data) {
+		audio->phys = allocate_contiguous_ebi_nomap(pmem_sz, SZ_4K);
+		if (audio->phys) {
+			audio->map_v_write = msm_subsystem_map_buffer(
+						audio->phys, pmem_sz,
+						MSM_SUBSYSTEM_MAP_KADDR,
+						NULL, 0);
+			if (IS_ERR(audio->map_v_write)) {
 				MM_ERR("could not allocate write buffers, \
 						freeing instance 0x%08x\n",
 						(int)audio);
 				rc = -ENOMEM;
-				pmem_kfree(audio->phys);
+				free_contiguous_memory_by_paddr(audio->phys);
 				audpp_adec_free(audio->dec_id);
 				kfree(audio);
 				goto done;
 			}
+			audio->data = audio->map_v_write->vaddr;
 			MM_DBG("write buf: phy addr 0x%08x kernel addr \
 				0x%08x\n", audio->phys, (int)audio->data);
 			break;
@@ -1754,8 +1771,8 @@
 event_err:
 	msm_adsp_put(audio->audplay);
 err:
-	iounmap(audio->data);
-	pmem_kfree(audio->phys);
+	msm_subsystem_unmap_buffer(audio->map_v_write);
+	free_contiguous_memory_by_paddr(audio->phys);
 	audpp_adec_free(audio->dec_id);
 	kfree(audio);
 	return rc;