Browse Source

Merge "asoc: qcs405: add machine driver support for compress loopback"

Linux Build Service Account 6 years ago
parent
commit
39ed36f371
5 changed files with 648 additions and 241 deletions
  1. 39 0
      asoc/msm-dai-fe.c
  2. 83 0
      asoc/msm-dai-q6-v2.c
  3. 332 1
      asoc/msm-pcm-routing-v2.c
  4. 2 0
      asoc/msm-pcm-routing-v2.h
  5. 192 240
      asoc/qcs405.c

+ 39 - 0
asoc/msm-dai-fe.c

@@ -2667,6 +2667,45 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
 		.name = "MultiMedia21",
 		.probe = fe_dai_probe,
 	},
+	{
+		.playback = {
+			.stream_name = "MultiMedia26 Playback",
+			.aif_name = "MM_DL26",
+			.rates = (SNDRV_PCM_RATE_8000_384000|
+					SNDRV_PCM_RATE_KNOT),
+			.formats = (SNDRV_PCM_FMTBIT_S16_LE |
+				    SNDRV_PCM_FMTBIT_S24_LE |
+				    SNDRV_PCM_FMTBIT_S24_3LE |
+				    SNDRV_PCM_FMTBIT_S32_LE),
+			.channels_min = 1,
+			.channels_max = 32,
+			.rate_min = 8000,
+			.rate_max = 384000,
+		},
+		.ops = &msm_fe_Multimedia_dai_ops,
+		.compress_new = snd_soc_new_compress,
+		.name = "MultiMedia26",
+		.probe = fe_dai_probe,
+	},
+	{
+		.capture = {
+			.stream_name = "MultiMedia27 Capture",
+			.aif_name = "MM_UL27",
+			.rates = (SNDRV_PCM_RATE_8000_192000|
+					SNDRV_PCM_RATE_KNOT),
+			.formats = (SNDRV_PCM_FMTBIT_S16_LE |
+				    SNDRV_PCM_FMTBIT_S24_LE |
+				    SNDRV_PCM_FMTBIT_S24_3LE),
+			.channels_min = 1,
+			.channels_max = 32,
+			.rate_min = 8000,
+			.rate_max = 192000,
+		},
+		.ops = &msm_fe_Multimedia_dai_ops,
+		.compress_new = snd_soc_new_compress,
+		.name = "MultiMedia27",
+		.probe = fe_dai_probe,
+	},
 	{
 		.capture = {
 		.stream_name = "MultiMedia28 Capture",

+ 83 - 0
asoc/msm-dai-q6-v2.c

@@ -7140,6 +7140,9 @@ static int msm_dai_q6_tdm_set_tdm_slot(struct snd_soc_dai *dai,
 
 	/* HW supports 1-32 slots configuration. Typical: 1, 2, 4, 8, 16, 32 */
 	switch (slots) {
+	case 1:
+		cap_mask = 0x01;
+		break;
 	case 2:
 		cap_mask = 0x03;
 		break;
@@ -7761,6 +7764,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_RX_0",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_RX,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -7781,6 +7785,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_RX_1",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_RX_1,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -7801,6 +7806,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_RX_2",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_RX_2,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -7821,6 +7827,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_RX_3",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_RX_3,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -7841,6 +7848,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_RX_4",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_RX_4,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -7861,6 +7869,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_RX_5",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_RX_5,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -7881,6 +7890,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_RX_6",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_RX_6,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -7901,6 +7911,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_RX_7",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_RX_7,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -7921,6 +7932,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_TX_0",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_TX,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -7941,6 +7953,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_TX_1",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_TX_1,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -7961,6 +7974,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_TX_2",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_TX_2,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -7981,6 +7995,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_TX_3",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_TX_3,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8001,6 +8016,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_TX_4",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_TX_4,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8021,6 +8037,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_TX_5",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_TX_5,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8041,6 +8058,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_TX_6",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_TX_6,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8061,6 +8079,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "PRI_TDM_TX_7",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_PRIMARY_TDM_TX_7,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8081,6 +8100,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_RX_0",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_RX,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8101,6 +8121,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_RX_1",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_RX_1,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8121,6 +8142,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_RX_2",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_RX_2,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8141,6 +8163,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_RX_3",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_RX_3,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8161,6 +8184,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_RX_4",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_RX_4,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8181,6 +8205,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_RX_5",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_RX_5,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8201,6 +8226,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_RX_6",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_RX_6,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8221,6 +8247,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_RX_7",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_RX_7,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8241,6 +8268,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_TX_0",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_TX,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8261,6 +8289,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_TX_1",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_TX_1,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8281,6 +8310,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_TX_2",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_TX_2,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8301,6 +8331,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_TX_3",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_TX_3,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8321,6 +8352,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_TX_4",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_TX_4,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8341,6 +8373,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_TX_5",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_TX_5,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8361,6 +8394,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_TX_6",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_TX_6,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8381,6 +8415,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "SEC_TDM_TX_7",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_SECONDARY_TDM_TX_7,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8401,6 +8436,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_RX_0",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_RX,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8421,6 +8457,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_RX_1",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_RX_1,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8441,6 +8478,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_RX_2",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_RX_2,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8461,6 +8499,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_RX_3",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_RX_3,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8481,6 +8520,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_RX_4",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_RX_4,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8501,6 +8541,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_RX_5",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_RX_5,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8521,6 +8562,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_RX_6",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_RX_6,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8541,6 +8583,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_RX_7",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_RX_7,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8561,6 +8604,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_TX_0",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_TX,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8581,6 +8625,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_TX_1",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_TX_1,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8601,6 +8646,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_TX_2",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_TX_2,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8621,6 +8667,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_TX_3",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_TX_3,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8641,6 +8688,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_TX_4",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_TX_4,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8661,6 +8709,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_TX_5",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_TX_5,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8681,6 +8730,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_TX_6",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_TX_6,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8701,6 +8751,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "TERT_TDM_TX_7",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_TERTIARY_TDM_TX_7,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8721,6 +8772,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_RX_0",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_RX,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8741,6 +8793,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_RX_1",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_RX_1,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8761,6 +8814,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_RX_2",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_RX_2,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8781,6 +8835,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_RX_3",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_RX_3,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8801,6 +8856,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_RX_4",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_RX_4,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8821,6 +8877,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_RX_5",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_RX_5,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8841,6 +8898,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_RX_6",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_RX_6,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8861,6 +8919,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_RX_7",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_RX_7,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8881,6 +8940,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_TX_0",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_TX,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8901,6 +8961,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_TX_1",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_TX_1,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8921,6 +8982,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_TX_2",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_TX_2,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8941,6 +9003,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_TX_3",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_TX_3,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8961,6 +9024,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_TX_4",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_TX_4,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -8981,6 +9045,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_TX_5",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_TX_5,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9001,6 +9066,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_TX_6",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_TX_6,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9021,6 +9087,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUAT_TDM_TX_7",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUATERNARY_TDM_TX_7,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9041,6 +9108,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_RX_0",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_RX,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9061,6 +9129,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_RX_1",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_RX_1,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9081,6 +9150,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_RX_2",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_RX_2,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9101,6 +9171,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_RX_3",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_RX_3,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9121,6 +9192,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_RX_4",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_RX_4,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9141,6 +9213,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_RX_5",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_RX_5,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9161,6 +9234,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_RX_6",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_RX_6,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9181,6 +9255,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_RX_7",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_RX_7,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9201,6 +9276,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_TX_0",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_TX,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9221,6 +9297,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_TX_1",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_TX_1,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9241,6 +9318,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_TX_2",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_TX_2,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9261,6 +9339,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_TX_3",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_TX_3,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9281,6 +9360,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_TX_4",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_TX_4,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9301,6 +9381,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_TX_5",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_TX_5,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9321,6 +9402,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_TX_6",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_TX_6,
 		.probe = msm_dai_q6_dai_tdm_probe,
@@ -9341,6 +9423,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
 			.rate_min = 8000,
 			.rate_max = 352800,
 		},
+		.name = "QUIN_TDM_TX_7",
 		.ops = &msm_dai_q6_tdm_ops,
 		.id = AFE_PORT_ID_QUINARY_TDM_TX_7,
 		.probe = msm_dai_q6_dai_tdm_probe,

File diff suppressed because it is too large
+ 332 - 1
asoc/msm-pcm-routing-v2.c


+ 2 - 0
asoc/msm-pcm-routing-v2.h

@@ -240,6 +240,8 @@ enum {
 	MSM_FRONTEND_DAI_MULTIMEDIA19,
 	MSM_FRONTEND_DAI_MULTIMEDIA20,
 	MSM_FRONTEND_DAI_MULTIMEDIA21,
+	MSM_FRONTEND_DAI_MULTIMEDIA26,
+	MSM_FRONTEND_DAI_MULTIMEDIA27,
 	MSM_FRONTEND_DAI_MULTIMEDIA28,
 	MSM_FRONTEND_DAI_MULTIMEDIA29,
 	MSM_FRONTEND_DAI_VOIP,

+ 192 - 240
asoc/qcs405.c

@@ -22,6 +22,7 @@
 #include <linux/input.h>
 #include <linux/of_device.h>
 #include <linux/pm_qos.h>
+#include <linux/regulator/consumer.h>
 #include <sound/core.h>
 #include <sound/soc.h>
 #include <sound/soc-dapm.h>
@@ -176,32 +177,20 @@ struct msm_csra66x0_dev_info {
 	u32 index;
 };
 
-enum pinctrl_pin_state {
-	STATE_DISABLE = 0, /* All pins are in sleep state */
-	STATE_MI2S_ACTIVE,  /* I2S = active, TDM = sleep */
-	STATE_TDM_ACTIVE,  /* I2S = sleep, TDM = active */
-};
-
-struct msm_pinctrl_info {
-	struct pinctrl *pinctrl;
-	struct pinctrl_state *mi2s_disable;
-	struct pinctrl_state *tdm_disable;
-	struct pinctrl_state *mi2s_active;
-	struct pinctrl_state *tdm_active;
-	enum pinctrl_pin_state curr_state;
-};
-
 struct msm_asoc_mach_data {
 	struct snd_info_entry *codec_root;
-	struct msm_pinctrl_info pinctrl_info;
 	struct device_node *dmic_01_gpio_p; /* used by pinctrl API */
 	struct device_node *dmic_23_gpio_p; /* used by pinctrl API */
 	struct device_node *dmic_45_gpio_p; /* used by pinctrl API */
 	struct device_node *dmic_67_gpio_p; /* used by pinctrl API */
+	struct device_node *mi2s_gpio_p[MI2S_MAX]; /* used by pinctrl API */
 	int dmic_01_gpio_cnt;
 	int dmic_23_gpio_cnt;
 	int dmic_45_gpio_cnt;
 	int dmic_67_gpio_cnt;
+	struct regulator *tdm_micb_supply;
+	u32 tdm_micb_voltage;
+	u32 tdm_micb_current;
 };
 
 struct msm_asoc_wcd93xx_codec {
@@ -5074,164 +5063,6 @@ err:
 	return ret;
 }
 
-static int msm_set_pinctrl(struct msm_pinctrl_info *pinctrl_info,
-				enum pinctrl_pin_state new_state)
-{
-	int ret = 0;
-	int curr_state = 0;
-
-	if (pinctrl_info == NULL) {
-		pr_err("%s: pinctrl_info is NULL\n", __func__);
-		ret = -EINVAL;
-		goto err;
-	}
-
-	if (pinctrl_info->pinctrl == NULL) {
-		pr_err("%s: pinctrl_info->pinctrl is NULL\n", __func__);
-		ret = -EINVAL;
-		goto err;
-	}
-
-	curr_state = pinctrl_info->curr_state;
-	pinctrl_info->curr_state = new_state;
-	pr_debug("%s: curr_state = %s new_state = %s\n", __func__,
-		 pin_states[curr_state], pin_states[pinctrl_info->curr_state]);
-
-	if (curr_state == pinctrl_info->curr_state) {
-		pr_debug("%s: Already in same state\n", __func__);
-		goto err;
-	}
-
-	if (curr_state != STATE_DISABLE &&
-		pinctrl_info->curr_state != STATE_DISABLE) {
-		pr_debug("%s: state already active cannot switch\n", __func__);
-		ret = -EIO;
-		goto err;
-	}
-
-	switch (pinctrl_info->curr_state) {
-	case STATE_MI2S_ACTIVE:
-		ret = pinctrl_select_state(pinctrl_info->pinctrl,
-					pinctrl_info->mi2s_active);
-		if (ret) {
-			pr_err("%s: MI2S state select failed with %d\n",
-				__func__, ret);
-			ret = -EIO;
-			goto err;
-		}
-		break;
-	case STATE_TDM_ACTIVE:
-		ret = pinctrl_select_state(pinctrl_info->pinctrl,
-					pinctrl_info->tdm_active);
-		if (ret) {
-			pr_err("%s: TDM state select failed with %d\n",
-				__func__, ret);
-			ret = -EIO;
-			goto err;
-		}
-		break;
-	case STATE_DISABLE:
-		if (curr_state == STATE_MI2S_ACTIVE) {
-			ret = pinctrl_select_state(pinctrl_info->pinctrl,
-					pinctrl_info->mi2s_disable);
-		} else {
-			ret = pinctrl_select_state(pinctrl_info->pinctrl,
-					pinctrl_info->tdm_disable);
-		}
-		if (ret) {
-			pr_err("%s:  state disable failed with %d\n",
-				__func__, ret);
-			ret = -EIO;
-			goto err;
-		}
-		break;
-	default:
-		pr_err("%s: TLMM pin state is invalid\n", __func__);
-		return -EINVAL;
-	}
-
-err:
-	return ret;
-}
-
-static void msm_release_pinctrl(struct platform_device *pdev)
-{
-	struct snd_soc_card *card = platform_get_drvdata(pdev);
-	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
-	struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
-
-	if (pinctrl_info->pinctrl) {
-		devm_pinctrl_put(pinctrl_info->pinctrl);
-		pinctrl_info->pinctrl = NULL;
-	}
-}
-
-static int msm_get_pinctrl(struct platform_device *pdev)
-{
-	struct snd_soc_card *card = platform_get_drvdata(pdev);
-	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
-	struct msm_pinctrl_info *pinctrl_info = NULL;
-	struct pinctrl *pinctrl;
-	int ret;
-
-	pinctrl_info = &pdata->pinctrl_info;
-
-	if (pinctrl_info == NULL) {
-		pr_err("%s: pinctrl_info is NULL\n", __func__);
-		return -EINVAL;
-	}
-
-	pinctrl = devm_pinctrl_get(&pdev->dev);
-	if (IS_ERR_OR_NULL(pinctrl)) {
-		pr_err("%s: Unable to get pinctrl handle\n", __func__);
-		return -EINVAL;
-	}
-	pinctrl_info->pinctrl = pinctrl;
-
-	/* get all the states handles from Device Tree */
-	pinctrl_info->mi2s_disable = pinctrl_lookup_state(pinctrl,
-						"quat-mi2s-sleep");
-	if (IS_ERR(pinctrl_info->mi2s_disable)) {
-		pr_err("%s: could not get mi2s_disable pinstate\n", __func__);
-		goto err;
-	}
-	pinctrl_info->mi2s_active = pinctrl_lookup_state(pinctrl,
-						"quat-mi2s-active");
-	if (IS_ERR(pinctrl_info->mi2s_active)) {
-		pr_err("%s: could not get mi2s_active pinstate\n", __func__);
-		goto err;
-	}
-	pinctrl_info->tdm_disable = pinctrl_lookup_state(pinctrl,
-						"quat-tdm-sleep");
-	if (IS_ERR(pinctrl_info->tdm_disable)) {
-		pr_err("%s: could not get tdm_disable pinstate\n", __func__);
-		goto err;
-	}
-	pinctrl_info->tdm_active = pinctrl_lookup_state(pinctrl,
-						"quat-tdm-active");
-	if (IS_ERR(pinctrl_info->tdm_active)) {
-		pr_err("%s: could not get tdm_active pinstate\n",
-			__func__);
-		goto err;
-	}
-	/* Reset the TLMM pins to a default state */
-	ret = pinctrl_select_state(pinctrl_info->pinctrl,
-					pinctrl_info->mi2s_disable);
-	if (ret != 0) {
-		pr_err("%s: Disable TLMM pins failed with %d\n",
-			__func__, ret);
-		ret = -EIO;
-		goto err;
-	}
-	pinctrl_info->curr_state = STATE_DISABLE;
-
-	return 0;
-
-err:
-	devm_pinctrl_put(pinctrl);
-	pinctrl_info->pinctrl = NULL;
-	return -EINVAL;
-}
 
 static int msm_tdm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 				      struct snd_pcm_hw_params *params)
@@ -5281,7 +5112,7 @@ static int qcs405_tdm_snd_hw_params(struct snd_pcm_substream *substream,
 	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
 	int ret = 0;
 	int slot_width = 32;
-	int channels, slots;
+	int channels, slots = 8;
 	unsigned int slot_mask, rate, clk_freq;
 	unsigned int slot_offset[8] = {0, 4, 8, 12, 16, 20, 24, 28};
 
@@ -5290,34 +5121,34 @@ static int qcs405_tdm_snd_hw_params(struct snd_pcm_substream *substream,
 	/* currently only supporting TDM_RX_0 and TDM_TX_0 */
 	switch (cpu_dai->id) {
 	case AFE_PORT_ID_PRIMARY_TDM_RX:
-		slots = tdm_rx_cfg[TDM_PRI][TDM_0].channels;
+		channels = tdm_rx_cfg[TDM_PRI][TDM_0].channels;
 		break;
 	case AFE_PORT_ID_SECONDARY_TDM_RX:
-		slots = tdm_rx_cfg[TDM_SEC][TDM_0].channels;
+		channels = tdm_rx_cfg[TDM_SEC][TDM_0].channels;
 		break;
 	case AFE_PORT_ID_TERTIARY_TDM_RX:
-		slots = tdm_rx_cfg[TDM_TERT][TDM_0].channels;
+		channels = tdm_rx_cfg[TDM_TERT][TDM_0].channels;
 		break;
 	case AFE_PORT_ID_QUATERNARY_TDM_RX:
-		slots = tdm_rx_cfg[TDM_QUAT][TDM_0].channels;
+		channels = tdm_rx_cfg[TDM_QUAT][TDM_0].channels;
 		break;
 	case AFE_PORT_ID_QUINARY_TDM_RX:
-		slots = tdm_rx_cfg[TDM_QUIN][TDM_0].channels;
+		channels = tdm_rx_cfg[TDM_QUIN][TDM_0].channels;
 		break;
 	case AFE_PORT_ID_PRIMARY_TDM_TX:
-		slots = tdm_tx_cfg[TDM_PRI][TDM_0].channels;
+		channels = tdm_tx_cfg[TDM_PRI][TDM_0].channels;
 		break;
 	case AFE_PORT_ID_SECONDARY_TDM_TX:
-		slots = tdm_tx_cfg[TDM_SEC][TDM_0].channels;
+		channels = tdm_tx_cfg[TDM_SEC][TDM_0].channels;
 		break;
 	case AFE_PORT_ID_TERTIARY_TDM_TX:
-		slots = tdm_tx_cfg[TDM_TERT][TDM_0].channels;
+		channels = tdm_tx_cfg[TDM_TERT][TDM_0].channels;
 		break;
 	case AFE_PORT_ID_QUATERNARY_TDM_TX:
-		slots = tdm_tx_cfg[TDM_QUAT][TDM_0].channels;
+		channels = tdm_tx_cfg[TDM_QUAT][TDM_0].channels;
 		break;
 	case AFE_PORT_ID_QUINARY_TDM_TX:
-		slots = tdm_tx_cfg[TDM_QUIN][TDM_0].channels;
+		channels = tdm_tx_cfg[TDM_QUIN][TDM_0].channels;
 		break;
 
 	default:
@@ -5328,8 +5159,7 @@ static int qcs405_tdm_snd_hw_params(struct snd_pcm_substream *substream,
 
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		/*2 slot config - bits 0 and 1 set for the first two slots */
-		slot_mask = 0x0000FFFF >> (16-slots);
-		channels = slots;
+		slot_mask = 0x0000FFFF >> (16-channels);
 
 		pr_debug("%s: tdm rx slot_width %d slots %d\n",
 			__func__, slot_width, slots);
@@ -5351,8 +5181,7 @@ static int qcs405_tdm_snd_hw_params(struct snd_pcm_substream *substream,
 		}
 	} else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
 		/*2 slot config - bits 0 and 1 set for the first two slots */
-		slot_mask = 0x0000FFFF >> (16-slots);
-		channels = slots;
+		slot_mask = 0x0000FFFF >> (16-channels);
 
 		pr_debug("%s: tdm tx slot_width %d slots %d\n",
 			__func__, slot_width, slots);
@@ -5390,6 +5219,38 @@ end:
 	return ret;
 }
 
+static int msm_get_tdm_mode(u32 port_id)
+{
+	u32 tdm_mode;
+
+	switch (port_id) {
+	case AFE_PORT_ID_PRIMARY_TDM_RX:
+	case AFE_PORT_ID_PRIMARY_TDM_TX:
+		tdm_mode = TDM_PRI;
+		break;
+	case AFE_PORT_ID_SECONDARY_TDM_RX:
+	case AFE_PORT_ID_SECONDARY_TDM_TX:
+		tdm_mode = TDM_SEC;
+		break;
+	case AFE_PORT_ID_TERTIARY_TDM_RX:
+	case AFE_PORT_ID_TERTIARY_TDM_TX:
+		tdm_mode = TDM_TERT;
+		break;
+	case AFE_PORT_ID_QUATERNARY_TDM_RX:
+	case AFE_PORT_ID_QUATERNARY_TDM_TX:
+		tdm_mode = TDM_QUAT;
+		break;
+	case AFE_PORT_ID_QUINARY_TDM_RX:
+	case AFE_PORT_ID_QUINARY_TDM_TX:
+		tdm_mode = TDM_QUIN;
+		break;
+	default:
+		pr_err("%s: Invalid port id: %d\n", __func__, port_id);
+		tdm_mode = -EINVAL;
+	}
+	return tdm_mode;
+}
+
 static int qcs405_tdm_snd_startup(struct snd_pcm_substream *substream)
 {
 	int ret = 0;
@@ -5397,17 +5258,50 @@ static int qcs405_tdm_snd_startup(struct snd_pcm_substream *substream)
 	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
 	struct snd_soc_card *card = rtd->card;
 	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
-	struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
+	u32 tdm_mode = msm_get_tdm_mode(cpu_dai->id);
 
-	/* currently only supporting TDM_RX_0 and TDM_TX_0 */
-	if ((cpu_dai->id == AFE_PORT_ID_QUATERNARY_TDM_RX) ||
-		(cpu_dai->id == AFE_PORT_ID_QUATERNARY_TDM_TX)) {
-		ret = msm_set_pinctrl(pinctrl_info, STATE_TDM_ACTIVE);
+	if (tdm_mode >= TDM_INTERFACE_MAX) {
+		ret = -EINVAL;
+		pr_err("%s: Invalid TDM interface %d\n",
+			__func__, ret);
+		return ret;
+	}
+
+	if (pdata->mi2s_gpio_p[tdm_mode]) {
+		ret = msm_cdc_pinctrl_select_active_state(
+			pdata->mi2s_gpio_p[tdm_mode]);
 		if (ret)
-			pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
+			pr_err("%s: TDM GPIO pinctrl set active failed with %d\n",
 				__func__, ret);
 	}
 
+	/* Enable Mic bias for TDM Mics */
+	if (cpu_dai->id == AFE_PORT_ID_QUINARY_TDM_TX) {
+		if (pdata->tdm_micb_supply) {
+			ret = regulator_set_voltage(pdata->tdm_micb_supply,
+						pdata->tdm_micb_voltage,
+						pdata->tdm_micb_voltage);
+			if (ret) {
+				pr_err("%s: Setting voltage failed, err = %d\n",
+					__func__, ret);
+				return ret;
+			}
+			ret = regulator_set_load(pdata->tdm_micb_supply,
+						pdata->tdm_micb_current);
+			if (ret) {
+				pr_err("%s: Setting current failed, err = %d\n",
+					__func__, ret);
+				return ret;
+			}
+			ret = regulator_enable(pdata->tdm_micb_supply);
+			if (ret) {
+				pr_err("%s: regulator enable failed, err = %d\n",
+					__func__, ret);
+				return ret;
+			}
+		}
+	}
+
 	return ret;
 }
 
@@ -5418,14 +5312,25 @@ static void qcs405_tdm_snd_shutdown(struct snd_pcm_substream *substream)
 	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
 	struct snd_soc_card *card = rtd->card;
 	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
-	struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
+	u32 tdm_mode = msm_get_tdm_mode(cpu_dai->id);
 
-	/* currently only supporting TDM_RX_0 and TDM_TX_0 */
-	if ((cpu_dai->id == AFE_PORT_ID_QUATERNARY_TDM_RX) ||
-		(cpu_dai->id == AFE_PORT_ID_QUATERNARY_TDM_TX)) {
-		ret = msm_set_pinctrl(pinctrl_info, STATE_DISABLE);
+	if (cpu_dai->id == AFE_PORT_ID_QUINARY_TDM_TX) {
+		if (pdata->tdm_micb_supply) {
+			ret = regulator_disable(pdata->tdm_micb_supply);
+			if (ret)
+				pr_err("%s: regulator disable failed, err = %d\n",
+					__func__, ret);
+			regulator_set_voltage(pdata->tdm_micb_supply, 0,
+					pdata->tdm_micb_voltage);
+			regulator_set_load(pdata->tdm_micb_supply, 0);
+		}
+	}
+
+	if (pdata->mi2s_gpio_p[tdm_mode]) {
+		ret = msm_cdc_pinctrl_select_sleep_state(
+			pdata->mi2s_gpio_p[tdm_mode]);
 		if (ret)
-			pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
+			pr_err("%s: TDM GPIO pinctrl set sleep failed with %d\n",
 				__func__, ret);
 	}
 }
@@ -5469,8 +5374,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
 	unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
 	struct snd_soc_card *card = rtd->card;
 	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
-	struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
-	int ret_pinctrl = 0;
 
 	dev_dbg(rtd->card->dev,
 		"%s: substream = %s  stream = %d, dai name %s, dai ID %d\n",
@@ -5510,13 +5413,9 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
 				__func__, index, ret);
 			goto clk_off;
 		}
-		if (index == QUAT_MI2S) {
-			ret_pinctrl = msm_set_pinctrl(pinctrl_info,
-						      STATE_MI2S_ACTIVE);
-			if (ret_pinctrl)
-				pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
-					__func__, ret_pinctrl);
-		}
+		if (pdata->mi2s_gpio_p[index])
+			msm_cdc_pinctrl_select_active_state(
+					pdata->mi2s_gpio_p[index]);
 	}
 clk_off:
 	if (ret < 0)
@@ -5536,8 +5435,6 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
 	int index = rtd->cpu_dai->id;
 	struct snd_soc_card *card = rtd->card;
 	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
-	struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
-	int ret_pinctrl = 0;
 
 	pr_debug("%s(): substream = %s  stream = %d\n", __func__,
 		 substream->name, substream->stream);
@@ -5548,17 +5445,14 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
 
 	mutex_lock(&mi2s_intf_conf[index].lock);
 	if (--mi2s_intf_conf[index].ref_cnt == 0) {
+		if (pdata->mi2s_gpio_p[index])
+			msm_cdc_pinctrl_select_sleep_state(
+					pdata->mi2s_gpio_p[index]);
+
 		ret = msm_mi2s_set_sclk(substream, false);
 		if (ret < 0)
 			pr_err("%s:clock disable failed for MI2S (%d); ret=%d\n",
 				__func__, index, ret);
-		if (index == QUAT_MI2S) {
-			ret_pinctrl = msm_set_pinctrl(pinctrl_info,
-						      STATE_DISABLE);
-			if (ret_pinctrl)
-				pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
-					__func__, ret_pinctrl);
-		}
 	}
 	mutex_unlock(&mi2s_intf_conf[index].lock);
 }
@@ -6384,6 +6278,37 @@ static struct snd_soc_dai_link msm_common_misc_fe_dai_links[] = {
 		.ignore_pmdown_time = 1,
 		.id = MSM_FRONTEND_DAI_MULTIMEDIA18,
 	},
+	{
+		.name = MSM_DAILINK_NAME(Transcode Loopback Playback),
+		.stream_name = "Transcode Loopback Playback",
+		.cpu_dai_name = "MultiMedia26",
+		.platform_name = "msm-transcode-loopback",
+		.dynamic = 1,
+		.dpcm_playback = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+			 SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1,
+		 /* this dailink has playback support */
+		.id = MSM_FRONTEND_DAI_MULTIMEDIA26,
+	},
+	{
+		.name = MSM_DAILINK_NAME(Transcode Loopback Capture),
+		.stream_name = "Transcode Loopback Capture",
+		.cpu_dai_name = "MultiMedia27",
+		.platform_name = "msm-transcode-loopback",
+		.dynamic = 1,
+		.dpcm_capture = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+			 SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1,
+		.id = MSM_FRONTEND_DAI_MULTIMEDIA27,
+	},
 };
 
 static struct snd_soc_dai_link msm_common_be_dai_links[] = {
@@ -8342,6 +8267,10 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
 	struct msm_asoc_mach_data *pdata;
 	int ret;
 	u32 val;
+	const char *micb_supply_str = "tdm-vdd-micb-supply";
+	const char *micb_supply_str1 = "tdm-vdd-micb";
+	const char *micb_voltage_str = "qcom,tdm-vdd-micb-voltage";
+	const char *micb_current_str = "qcom,tdm-vdd-micb-current";
 
 	if (!pdev->dev.of_node) {
 		dev_err(&pdev->dev, "No platform supplied from device tree\n");
@@ -8404,17 +8333,53 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
 	}
 
 	pdata->dmic_01_gpio_p = of_parse_phandle(pdev->dev.of_node,
-					      "qcom,cdc-dmic01-gpios",
-					       0);
+					"qcom,cdc-dmic01-gpios", 0);
 	pdata->dmic_23_gpio_p = of_parse_phandle(pdev->dev.of_node,
-					      "qcom,cdc-dmic23-gpios",
-					       0);
+					"qcom,cdc-dmic23-gpios", 0);
 	pdata->dmic_45_gpio_p = of_parse_phandle(pdev->dev.of_node,
-					      "qcom,cdc-dmic45-gpios",
-					       0);
+					"qcom,cdc-dmic45-gpios", 0);
 	pdata->dmic_67_gpio_p = of_parse_phandle(pdev->dev.of_node,
-					      "qcom,cdc-dmic67-gpios",
-					       0);
+					"qcom,cdc-dmic67-gpios", 0);
+
+	pdata->mi2s_gpio_p[PRIM_MI2S] = of_parse_phandle(pdev->dev.of_node,
+					"qcom,pri-mi2s-gpios", 0);
+	pdata->mi2s_gpio_p[SEC_MI2S] = of_parse_phandle(pdev->dev.of_node,
+					"qcom,sec-mi2s-gpios", 0);
+	pdata->mi2s_gpio_p[TERT_MI2S] = of_parse_phandle(pdev->dev.of_node,
+					"qcom,tert-mi2s-gpios", 0);
+	pdata->mi2s_gpio_p[QUAT_MI2S] = of_parse_phandle(pdev->dev.of_node,
+					"qcom,quat-mi2s-gpios", 0);
+	pdata->mi2s_gpio_p[QUIN_MI2S] = of_parse_phandle(pdev->dev.of_node,
+					"qcom,quin-mi2s-gpios", 0);
+
+	if (of_parse_phandle(pdev->dev.of_node, micb_supply_str, 0)) {
+		pdata->tdm_micb_supply = devm_regulator_get(&pdev->dev,
+					micb_supply_str1);
+		if (IS_ERR(pdata->tdm_micb_supply)) {
+			ret = PTR_ERR(pdata->tdm_micb_supply);
+			dev_err(&pdev->dev,
+				"%s:Failed to get micbias supply for TDM Mic %d\n",
+				__func__, ret);
+		}
+		ret = of_property_read_u32(pdev->dev.of_node,
+					micb_voltage_str,
+					&pdata->tdm_micb_voltage);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"%s:Looking up %s property in node %s failed\n",
+				__func__, micb_voltage_str,
+				pdev->dev.of_node->full_name);
+		}
+		ret = of_property_read_u32(pdev->dev.of_node,
+					micb_current_str,
+					&pdata->tdm_micb_current);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"%s:Looking up %s property in node %s failed\n",
+				__func__, micb_current_str,
+				pdev->dev.of_node->full_name);
+		}
+	}
 
 	ret = devm_snd_soc_register_card(&pdev->dev, card);
 	if (ret == -EPROBE_DEFER) {
@@ -8434,23 +8399,11 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "msm_mdf_mem_init failed (%d)\n",
 			 ret);
 
-	/* Parse pinctrl info from devicetree */
-	ret = msm_get_pinctrl(pdev);
-	if (!ret) {
-		pr_debug("%s: pinctrl parsing successful\n", __func__);
-	} else {
-		dev_dbg(&pdev->dev,
-			"%s: Parsing pinctrl failed with %d. Cannot use Ports\n",
-			__func__, ret);
-		ret = 0;
-	}
-
 	msm_i2s_auxpcm_init(pdev);
 
 	is_initial_boot = true;
 	return 0;
 err:
-	msm_release_pinctrl(pdev);
 	return ret;
 }
 
@@ -8460,7 +8413,6 @@ static int msm_asoc_machine_remove(struct platform_device *pdev)
 	msm_i2s_auxpcm_deinit();
 	msm_mdf_mem_deinit();
 
-	msm_release_pinctrl(pdev);
 	return 0;
 }
 

Some files were not shown because too many files changed in this diff