msm: qdsp5v2: Update MVS driver for evrc codec

-Update MVS driver to address evrc codec properly
-MVS driver is updated to support evrc codec.MVS_MAX_VOC_PKT_SIZE size
 incresed to 640 to support PCM WB for 8660 targets.Unfortunately
 7630 modem do not support PCM WB but the app changes effected all
 the targets where modem expecting the packet size as 320 but 7630
 application is sending packet size of 640
 increse in PKT size 7630,modem not receving the packet info since
 modem expecting PKT size 320 only.
-To address this issue Added new structure q5v2_msm_audio_mvs_frame
 and variable Q5V2_MVS_MAX_VOC_PKT_SIZE.
 Updated the EVRC rate info properly.

CRs-Fixed: 354100
Change-Id: Iafefc71142f51d74168471bd87d1fac98a46b80a
Signed-off-by: Vinay Vaka <vvaka@codeaurora.org>
diff --git a/arch/arm/mach-msm/qdsp5v2/audio_mvs.c b/arch/arm/mach-msm/qdsp5v2/audio_mvs.c
index dc41bf4..fae2401 100644
--- a/arch/arm/mach-msm/qdsp5v2/audio_mvs.c
+++ b/arch/arm/mach-msm/qdsp5v2/audio_mvs.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -276,7 +276,7 @@
 struct audio_mvs_dl_reply {
 	struct rpc_reply_hdr reply_hdr;
 
-	uint32_t voc_pkt[MVS_MAX_VOC_PKT_SIZE/4];
+	uint32_t voc_pkt[Q5V2_MVS_MAX_VOC_PKT_SIZE/4];
 
 	uint32_t valid_frame_info_ptr;
 	uint32_t frame_mode;
@@ -288,7 +288,7 @@
 
 struct audio_mvs_buf_node {
 	struct list_head list;
-	struct msm_audio_mvs_frame frame;
+	struct q5v2_msm_audio_mvs_frame frame;
 };
 
 /* Each buffer is 20 ms, queue holds 200 ms of data. */
@@ -933,10 +933,15 @@
 
 				pr_debug("%s: UL AMR frame_type %d\n",
 					 __func__, be32_to_cpu(*args));
-			} else if ((frame_mode == MVS_FRAME_MODE_PCM_UL) ||
-				   (frame_mode == MVS_FRAME_MODE_VOC_TX)) {
-				/* PCM and EVRC don't have frame_type */
+			} else if (frame_mode == MVS_FRAME_MODE_PCM_UL) {
+				/* PCM don't have frame_type */
 				buf_node->frame.frame_type = 0;
+			} else if (frame_mode == MVS_FRAME_MODE_VOC_TX) {
+				/* Extracting EVRC current buffer frame rate*/
+				buf_node->frame.frame_type = be32_to_cpu(*args);
+
+				pr_debug("%s: UL EVRC frame_type %d\n",
+					__func__, be32_to_cpu(*args));
 			} else if (frame_mode == MVS_FRAME_MODE_G711_UL) {
 				/* Extract G711 frame type. */
 				buf_node->frame.frame_type = be32_to_cpu(*args);
@@ -1065,7 +1070,7 @@
 					cpu_to_be32(AUDIO_MVS_PKT_NORMAL);
 			} else if (frame_mode == MVS_FRAME_MODE_VOC_RX) {
 				dl_reply.cdc_param.gnr_arg.param1 =
-						cpu_to_be32(audio->rate_type);
+				cpu_to_be32(buf_node->frame.frame_type);
 				dl_reply.cdc_param.gnr_arg.param2 = 0;
 				dl_reply.cdc_param.\
 						gnr_arg.valid_pkt_status_ptr =
@@ -1427,7 +1432,7 @@
 		if ((audio->state == AUDIO_MVS_STARTED) &&
 		    (!list_empty(&audio->out_queue))) {
 
-			if (count >= sizeof(struct msm_audio_mvs_frame)) {
+			if (count >= sizeof(struct q5v2_msm_audio_mvs_frame)) {
 				buf_node = list_first_entry(&audio->out_queue,
 						struct audio_mvs_buf_node,
 						list);
@@ -1435,7 +1440,8 @@
 
 				rc = copy_to_user(buf,
 					&buf_node->frame,
-					sizeof(struct msm_audio_mvs_frame));
+					sizeof(struct q5v2_msm_audio_mvs_frame)
+					);
 
 				if (rc == 0) {
 					rc = buf_node->frame.len +
@@ -1453,7 +1459,7 @@
 			} else {
 				pr_err("%s: Read count %d < sizeof(frame) %d",
 				       __func__, count,
-				       sizeof(struct msm_audio_mvs_frame));
+				       sizeof(struct q5v2_msm_audio_mvs_frame));
 
 				rc = -ENOMEM;
 			}
@@ -1491,7 +1497,7 @@
 
 	mutex_lock(&audio->in_lock);
 	if (audio->state == AUDIO_MVS_STARTED) {
-		if (count <= sizeof(struct msm_audio_mvs_frame)) {
+		if (count <= sizeof(struct q5v2_msm_audio_mvs_frame)) {
 			if (!list_empty(&audio->free_in_queue)) {
 				buf_node =
 					list_first_entry(&audio->free_in_queue,
@@ -1511,7 +1517,7 @@
 		} else {
 			pr_err("%s: Write count %d < sizeof(frame) %d",
 			       __func__, count,
-			       sizeof(struct msm_audio_mvs_frame));
+			       sizeof(struct q5v2_msm_audio_mvs_frame));
 
 			rc = -ENOMEM;
 		}
diff --git a/include/linux/msm_audio_mvs.h b/include/linux/msm_audio_mvs.h
index 8ec9796..1807cb0 100644
--- a/include/linux/msm_audio_mvs.h
+++ b/include/linux/msm_audio_mvs.h
@@ -133,4 +133,12 @@
 
 };
 
+#define Q5V2_MVS_MAX_VOC_PKT_SIZE 320
+
+struct q5v2_msm_audio_mvs_frame {
+	uint32_t frame_type;
+	uint32_t len;
+	uint8_t voc_pkt[Q5V2_MVS_MAX_VOC_PKT_SIZE];
+
+};
 #endif /* __MSM_AUDIO_MVS_H */