ASoC: msm: Add the support for the MP2 decoder
Support the MP2 as a format for the tunnel mode.
MP2 format to be decoded in the DSP.
Change-Id: I0d268a6ddb57b1470ee2c43449ac31520176232f
Signed-off-by: Aviral Gupta <aviralg@codeaurora.org>
diff --git a/include/sound/apr_audio.h b/include/sound/apr_audio.h
index 90872c9..c9fce0d 100644
--- a/include/sound/apr_audio.h
+++ b/include/sound/apr_audio.h
@@ -1162,6 +1162,7 @@
#define EAC3_DECODER 0x00010C3C
#define DTS 0x00010D88
#define DTS_LBR 0x00010DBB
+#define MP2 0x00010DBE
#define ATRAC 0x00010D89
#define MAT 0x00010D8A
#define G711_ALAW_FS 0x00010BF7
diff --git a/include/sound/compress_params.h b/include/sound/compress_params.h
index 54af7d6a..02d69ea 100644
--- a/include/sound/compress_params.h
+++ b/include/sound/compress_params.h
@@ -87,7 +87,7 @@
#define SND_AUDIOCODEC_DTS_LBR ((__u32) 0x00000013)
#define SND_AUDIOCODEC_DTS_TRANSCODE_LOOPBACK ((__u32) 0x00000014)
#define SND_AUDIOCODEC_PASS_THROUGH ((__u32) 0x00000015)
-
+#define SND_AUDIOCODEC_MP2 ((__u32) 0x00000016)
/*
* Profile and modes are listed with bit masks. This allows for a
* more compact representation of fields that will not evolve
diff --git a/include/sound/q6asm.h b/include/sound/q6asm.h
index 32d3aef..c27051c 100644
--- a/include/sound/q6asm.h
+++ b/include/sound/q6asm.h
@@ -50,6 +50,7 @@
#define FORMAT_AAC 0x0018
#define FORMAT_DTS_LBR 0x0019
#define FORMAT_PASS_THROUGH 0x0020
+#define FORMAT_MP2 0x0021
#define ENCDEC_SBCBITRATE 0x0001
#define ENCDEC_IMMEDIATE_DECODE 0x0002
diff --git a/sound/soc/msm/msm-compr-q6.c b/sound/soc/msm/msm-compr-q6.c
index 0b9d54f..3489f24 100644
--- a/sound/soc/msm/msm-compr-q6.c
+++ b/sound/soc/msm/msm-compr-q6.c
@@ -461,6 +461,9 @@
return ret;
}
break;
+ case SND_AUDIOCODEC_MP2:
+ pr_debug("%s: SND_AUDIOCODEC_MP2\n", __func__);
+ break;
default:
return -EINVAL;
}
@@ -600,7 +603,7 @@
{
pr_debug("%s\n", __func__);
/* MP3 Block */
- compr->info.compr_cap.num_codecs = 12;
+ compr->info.compr_cap.num_codecs = 13;
compr->info.compr_cap.min_fragment_size = runtime->hw.period_bytes_min;
compr->info.compr_cap.max_fragment_size = runtime->hw.period_bytes_max;
compr->info.compr_cap.min_fragments = runtime->hw.periods_min;
@@ -617,6 +620,7 @@
compr->info.compr_cap.codecs[9] = SND_AUDIOCODEC_AMRWBPLUS;
compr->info.compr_cap.codecs[10] = SND_AUDIOCODEC_PASS_THROUGH;
compr->info.compr_cap.codecs[11] = SND_AUDIOCODEC_PCM;
+ compr->info.compr_cap.codecs[12] = SND_AUDIOCODEC_MP2;
/* Add new codecs here and update num_codecs*/
}
@@ -1111,6 +1115,10 @@
pr_debug("msm_compr_ioctl SND_AUDIOCODEC_PCM\n");
compr->codec = FORMAT_MULTI_CHANNEL_LINEAR_PCM;
break;
+ case SND_AUDIOCODEC_MP2:
+ pr_debug("SND_AUDIOCODEC_MP2\n");
+ compr->codec = FORMAT_MP2;
+ break;
default:
pr_err("msm_compr_ioctl failed..unknown codec\n");
return -EFAULT;
diff --git a/sound/soc/msm/qdsp6/q6asm.c b/sound/soc/msm/qdsp6/q6asm.c
index 6865871..5d842f90 100644
--- a/sound/soc/msm/qdsp6/q6asm.c
+++ b/sound/soc/msm/qdsp6/q6asm.c
@@ -1462,6 +1462,9 @@
case FORMAT_MAT:
open.format = MAT;
break;
+ case FORMAT_MP2:
+ open.format = MP2;
+ break;
default:
pr_err("%s: Invalid format[%d]\n", __func__, format);
goto fail_cmd;
@@ -1555,6 +1558,9 @@
open.format = AMR_WB_PLUS;
pr_debug("q6asm_open_write FORMAT_AMR_WB_PLUS");
break;
+ case FORMAT_MP2:
+ open.format = MP2;
+ break;
default:
pr_err("%s: Invalid format[%d]\n", __func__, format);
goto fail_cmd;
@@ -1642,6 +1648,9 @@
case FORMAT_MP3:
open.write_format = MP3;
break;
+ case FORMAT_MP2:
+ open.write_format = MP2;
+ break;
default:
pr_err("Invalid format[%d]\n", wr_format);
goto fail_cmd;
@@ -2574,6 +2583,9 @@
case FORMAT_DTS_LBR:
fmt.format = DTS_LBR;
break;
+ case FORMAT_MP2:
+ fmt.format = MP2;
+ break;
default:
pr_err("Invalid format[%d]\n", format);
goto fail_cmd;