msm: audio: qdsp5: 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
7627, 7627a and 7625 targets.

Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
diff --git a/arch/arm/mach-msm/qdsp5/audio_evrc.c b/arch/arm/mach-msm/qdsp5/audio_evrc.c
index eaa6528..3c39b6d 100644
--- a/arch/arm/mach-msm/qdsp5/audio_evrc.c
+++ b/arch/arm/mach-msm/qdsp5/audio_evrc.c
@@ -1,6 +1,6 @@
 /* arch/arm/mach-msm/audio_evrc.c
  *
- * Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2008-2009, 2011, Code Aurora Forum. All rights reserved.
  *
  * This code also borrows from audio_aac.c, which is
  * Copyright (C) 2008 Google, Inc.
@@ -19,6 +19,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>
@@ -32,18 +35,22 @@
 #include <linux/earlysuspend.h>
 #include <linux/android_pmem.h>
 #include <linux/slab.h>
-#include <asm/atomic.h>
-#include <asm/ioctls.h>
-#include <mach/msm_adsp.h>
 #include <linux/msm_audio.h>
-#include "audmgr.h"
+#include <linux/memory_alloc.h>
 
+#include <mach/msm_adsp.h>
+#include <mach/iommu.h>
+#include <mach/iommu_domains.h>
+#include <mach/msm_subsystem_map.h>
 #include <mach/qdsp5/qdsp5audppcmdi.h>
 #include <mach/qdsp5/qdsp5audppmsg.h>
 #include <mach/qdsp5/qdsp5audplaycmdi.h>
 #include <mach/qdsp5/qdsp5audplaymsg.h>
 #include <mach/qdsp5/qdsp5rmtcmdi.h>
 #include <mach/debug_mm.h>
+#include <mach/msm_memtypes.h>
+
+#include "audmgr.h"
 
 /* Hold 30 packets of 24 bytes each and 14 bytes of meta in */
 #define BUFSZ 			734
@@ -128,6 +135,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 */
@@ -941,25 +950,32 @@
 				MM_DBG("allocate PCM buf %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) {
-					MM_ERR("no mem for read buf\n");
+							config.buffer_count,
+							MSM_SUBSYSTEM_MAP_KADDR,
+							NULL, 0);
+				if (IS_ERR(audio->map_v_read)) {
+					MM_ERR("failed to map mem"
+							" for read buf\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;
@@ -1268,11 +1284,11 @@
 	audio->event_abort = 1;
 	wake_up(&audio->event_wait);
 	audevrc_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
@@ -1454,8 +1470,8 @@
 
 	audio->dec_id = decid & MSM_AUD_DECODER_MASK;
 
-	audio->phys = pmem_kalloc(DMASZ, PMEM_MEMTYPE_EBI1|PMEM_ALIGNMENT_4K);
-	if (IS_ERR((void *)audio->phys)) {
+	audio->phys = allocate_contiguous_ebi_nomap(DMASZ, SZ_4K);
+	if (!audio->phys) {
 		MM_ERR("could not allocate write buffers, freeing instance \
 				0x%08x\n", (int)audio);
 		rc = -ENOMEM;
@@ -1463,16 +1479,20 @@
 		kfree(audio);
 		goto done;
 	} else {
-		audio->data = ioremap(audio->phys, DMASZ);
-		if (!audio->data) {
-			MM_ERR("could not allocate write buffers, freeing \
+		audio->map_v_write = msm_subsystem_map_buffer(
+						audio->phys, DMASZ,
+						MSM_SUBSYSTEM_MAP_KADDR,
+						NULL, 0);
+		if (IS_ERR(audio->map_v_write)) {
+			MM_ERR("could not map 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);
 	}
@@ -1562,8 +1582,8 @@
 done:
 	return rc;
 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;