ASoC: sdm660-cdc: Add 4-mic DMIC support
Add route map and mix controls to support 4 digital mics in SDM660 internal codec. Change-Id: Ida16a910961d01a57d7d03dd64b61ecd36bad37d Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
This commit is contained in:
parent
892e41e7c7
commit
0328d8d137
2 changed files with 66 additions and 12 deletions
|
@ -50,6 +50,9 @@ static unsigned long rx_digital_gain_reg[] = {
|
|||
static unsigned long tx_digital_gain_reg[] = {
|
||||
MSM89XX_CDC_CORE_TX1_VOL_CTL_GAIN,
|
||||
MSM89XX_CDC_CORE_TX2_VOL_CTL_GAIN,
|
||||
MSM89XX_CDC_CORE_TX3_VOL_CTL_GAIN,
|
||||
MSM89XX_CDC_CORE_TX4_VOL_CTL_GAIN,
|
||||
MSM89XX_CDC_CORE_TX5_VOL_CTL_GAIN,
|
||||
};
|
||||
|
||||
static const DECLARE_TLV_DB_SCALE(digital_gain, 0, 1, 0);
|
||||
|
@ -729,6 +732,7 @@ static int msm_dig_cdc_hw_params(struct snd_pcm_substream *substream,
|
|||
MSM89XX_CDC_CORE_CLK_RX_I2S_CTL, 0x20, 0x20);
|
||||
break;
|
||||
case SNDRV_PCM_FORMAT_S24_LE:
|
||||
case SNDRV_PCM_FORMAT_S24_3LE:
|
||||
snd_soc_update_bits(dai->codec,
|
||||
MSM89XX_CDC_CORE_CLK_RX_I2S_CTL, 0x20, 0x00);
|
||||
break;
|
||||
|
@ -799,13 +803,8 @@ static int msm_dig_cdc_codec_enable_dmic(struct snd_soc_dapm_widget *w,
|
|||
dmic_clk_en, dmic_clk_en);
|
||||
}
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_TX1_DMIC_CTL, 0x07, 0x02);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_TX2_DMIC_CTL, 0x07, 0x02);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_TX3_DMIC_CTL, 0x07, 0x02);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_TX4_DMIC_CTL, 0x07, 0x02);
|
||||
MSM89XX_CDC_CORE_TX1_DMIC_CTL + (dmic - 1) * 0x20,
|
||||
0x07, 0x02);
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
(*dmic_clk_cnt)--;
|
||||
|
@ -884,6 +883,10 @@ static int msm_dig_cdc_codec_enable_dec(struct snd_soc_dapm_widget *w,
|
|||
32 * (decimator - 1);
|
||||
tx_mux_ctl_reg = MSM89XX_CDC_CORE_TX1_MUX_CTL +
|
||||
32 * (decimator - 1);
|
||||
if (decimator == 5) {
|
||||
tx_vol_ctl_reg = MSM89XX_CDC_CORE_TX5_VOL_CTL_CFG;
|
||||
tx_mux_ctl_reg = MSM89XX_CDC_CORE_TX5_MUX_CTL;
|
||||
}
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
|
@ -1225,11 +1228,18 @@ static const struct snd_soc_dapm_route audio_dig_map[] = {
|
|||
|
||||
{"I2S TX1", NULL, "DEC1 MUX"},
|
||||
{"I2S TX2", NULL, "DEC2 MUX"},
|
||||
{"I2S TX3", NULL, "DEC3 MUX"},
|
||||
{"I2S TX4", NULL, "DEC4 MUX"},
|
||||
{"I2S TX3", NULL, "I2S TX2 INP1"},
|
||||
{"I2S TX4", NULL, "I2S TX2 INP2"},
|
||||
{"I2S TX5", NULL, "DEC3 MUX"},
|
||||
{"I2S TX6", NULL, "DEC4 MUX"},
|
||||
{"I2S TX6", NULL, "DEC5 MUX"},
|
||||
{"I2S TX6", NULL, "I2S TX3 INP2"},
|
||||
|
||||
{"I2S TX2 INP1", "RX_MIX1", "RX1 MIX2"},
|
||||
{"I2S TX2 INP1", "DEC3", "DEC3 MUX"},
|
||||
{"I2S TX2 INP2", "RX_MIX2", "RX2 MIX2"},
|
||||
{"I2S TX2 INP2", "RX_MIX3", "RX3 MIX1"},
|
||||
{"I2S TX2 INP2", "DEC4", "DEC4 MUX"},
|
||||
{"I2S TX3 INP2", "DEC4", "DEC4 MUX"},
|
||||
{"I2S TX3 INP2", "DEC5", "DEC5 MUX"},
|
||||
|
||||
{"PDM_OUT_RX1", NULL, "RX1 CHAIN"},
|
||||
{"PDM_OUT_RX2", NULL, "RX2 CHAIN"},
|
||||
|
@ -1350,6 +1360,19 @@ static const struct snd_soc_dapm_route audio_dig_map[] = {
|
|||
{"IIR1 INP1 MUX", "DEC4", "DEC4 MUX"},
|
||||
};
|
||||
|
||||
|
||||
static const char * const i2s_tx2_inp1_text[] = {
|
||||
"ZERO", "RX_MIX1", "DEC3"
|
||||
};
|
||||
|
||||
static const char * const i2s_tx2_inp2_text[] = {
|
||||
"ZERO", "RX_MIX2", "RX_MIX3", "DEC4"
|
||||
};
|
||||
|
||||
static const char * const i2s_tx3_inp2_text[] = {
|
||||
"DEC4", "DEC5"
|
||||
};
|
||||
|
||||
static const char * const rx_mix1_text[] = {
|
||||
"ZERO", "IIR1", "IIR2", "RX1", "RX2", "RX3"
|
||||
};
|
||||
|
@ -1365,6 +1388,20 @@ static const char * const dec_mux_text[] = {
|
|||
static const char * const iir_inp1_text[] = {
|
||||
"ZERO", "DEC1", "DEC2", "RX1", "RX2", "RX3", "DEC3", "DEC4"
|
||||
};
|
||||
|
||||
/* I2S TX MUXes */
|
||||
static const struct soc_enum i2s_tx2_inp1_chain_enum =
|
||||
SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_TX_I2S_SD1_CTL,
|
||||
2, 3, i2s_tx2_inp1_text);
|
||||
|
||||
static const struct soc_enum i2s_tx2_inp2_chain_enum =
|
||||
SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_TX_I2S_SD1_CTL,
|
||||
0, 4, i2s_tx2_inp2_text);
|
||||
|
||||
static const struct soc_enum i2s_tx3_inp2_chain_enum =
|
||||
SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_TX_I2S_SD1_CTL,
|
||||
4, 2, i2s_tx3_inp2_text);
|
||||
|
||||
/* RX1 MIX1 */
|
||||
static const struct soc_enum rx_mix1_inp1_chain_enum =
|
||||
SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_RX1_B1_CTL,
|
||||
|
@ -1482,6 +1519,15 @@ static const struct snd_kcontrol_new dec4_mux =
|
|||
static const struct snd_kcontrol_new decsva_mux =
|
||||
MSM89XX_DEC_ENUM("DEC5 MUX Mux", decsva_mux_enum);
|
||||
|
||||
static const struct snd_kcontrol_new i2s_tx2_inp1_mux =
|
||||
SOC_DAPM_ENUM("I2S TX2 INP1 Mux", i2s_tx2_inp1_chain_enum);
|
||||
|
||||
static const struct snd_kcontrol_new i2s_tx2_inp2_mux =
|
||||
SOC_DAPM_ENUM("I2S TX2 INP2 Mux", i2s_tx2_inp2_chain_enum);
|
||||
|
||||
static const struct snd_kcontrol_new i2s_tx3_inp2_mux =
|
||||
SOC_DAPM_ENUM("I2S TX3 INP2 Mux", i2s_tx3_inp2_chain_enum);
|
||||
|
||||
static const struct snd_kcontrol_new iir1_inp1_mux =
|
||||
SOC_DAPM_ENUM("IIR1 INP1 Mux", iir1_inp1_mux_enum);
|
||||
|
||||
|
@ -1623,6 +1669,14 @@ static const struct snd_soc_dapm_widget msm_dig_dapm_widgets[] = {
|
|||
SND_SOC_DAPM_SUPPLY("TX_I2S_CLK",
|
||||
MSM89XX_CDC_CORE_CLK_TX_I2S_CTL, 4, 0, NULL, 0),
|
||||
|
||||
|
||||
SND_SOC_DAPM_MUX("I2S TX2 INP1", SND_SOC_NOPM, 0, 0,
|
||||
&i2s_tx2_inp1_mux),
|
||||
SND_SOC_DAPM_MUX("I2S TX2 INP2", SND_SOC_NOPM, 0, 0,
|
||||
&i2s_tx2_inp2_mux),
|
||||
SND_SOC_DAPM_MUX("I2S TX3 INP2", SND_SOC_NOPM, 0, 0,
|
||||
&i2s_tx3_inp2_mux),
|
||||
|
||||
/* Digital Mic Inputs */
|
||||
SND_SOC_DAPM_ADC_E("DMIC1", NULL, SND_SOC_NOPM, 0, 0,
|
||||
msm_dig_cdc_codec_enable_dmic, SND_SOC_DAPM_PRE_PMU |
|
||||
|
|
|
@ -2316,7 +2316,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = {
|
|||
.async_ops = ASYNC_DPCM_SND_SOC_PREPARE |
|
||||
ASYNC_DPCM_SND_SOC_HW_PARAMS,
|
||||
.be_id = MSM_BACKEND_DAI_INT3_MI2S_TX,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
.be_hw_params_fixup = int_mi2s_be_hw_params_fixup,
|
||||
.ops = &msm_int_mi2s_be_ops,
|
||||
.ignore_suspend = 1,
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue