HAL: Converting PCM enum to AUDIO FORMAT enum

Add function for PCM FORMAT enum to AUDIO FORMAT enum conversion.

Change-Id: I0fc3c1adfe3aec6b309b790db8be537d50cee0ae
Signed-off-by: Raghu Bankapur <quic_rbankapu@quicinc.com>
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 554b624..ab9536c 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -7188,7 +7188,7 @@
     if(in->usecase == USECASE_COMPRESS_VOIP_CALL)
         return voice_extn_compress_voip_in_get_buffer_size(in);
     else if(audio_extn_compr_cap_usecase_supported(in->usecase))
-        return audio_extn_compr_cap_get_buffer_size(in->config.format);
+        return audio_extn_compr_cap_get_buffer_size(pcm_format_to_audio_format(in->config.format));
     else if(audio_extn_cin_attached_usecase(in))
         return audio_extn_cin_get_buffer_size(in);
 
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index d24202c..058d7a2 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -947,4 +947,29 @@
  * and latch at last.
  */
 
+static inline audio_format_t pcm_format_to_audio_format(const enum pcm_format format)
+{
+   audio_format_t ret = AUDIO_FORMAT_INVALID;
+   switch(format) {
+        case PCM_FORMAT_S16_LE:
+            ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_16_BIT;
+            break;
+        case PCM_FORMAT_S32_LE:
+           ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_32_BIT;
+           break;
+        case PCM_FORMAT_S8:
+           ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_8_BIT;
+           break;
+        case PCM_FORMAT_S24_LE:
+           ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_8_24_BIT;
+           break;
+        case PCM_FORMAT_S24_3LE:
+           ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_24_BIT_PACKED;
+           break;
+        default:
+           break;
+      }
+      return ret;
+}
+
 #endif // QCOM_AUDIO_HW_H