|
@@ -1149,27 +1149,14 @@ static int lpass_cdc_va_macro_tx_mixer_put(struct snd_kcontrol *kcontrol,
|
|
|
}
|
|
|
|
|
|
static int lpass_cdc_va_macro_enable_dmic(struct snd_soc_dapm_widget *w,
|
|
|
- struct snd_kcontrol *kcontrol, int event)
|
|
|
+ struct snd_kcontrol *kcontrol, int event, u16 adc_mux0_cfg)
|
|
|
{
|
|
|
struct snd_soc_component *component =
|
|
|
snd_soc_dapm_to_component(w->dapm);
|
|
|
unsigned int dmic = 0;
|
|
|
- int ret = 0;
|
|
|
- char *wname;
|
|
|
-
|
|
|
- wname = strpbrk(w->name, "01234567");
|
|
|
- if (!wname) {
|
|
|
- dev_err(component->dev, "%s: widget not found\n", __func__);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
- ret = kstrtouint(wname, 10, &dmic);
|
|
|
- if (ret < 0) {
|
|
|
- dev_err(component->dev, "%s: Invalid DMIC line on the codec\n",
|
|
|
- __func__);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
|
|
|
+ dmic = (snd_soc_component_read(component, adc_mux0_cfg) >> 4) - 1;
|
|
|
+
|
|
|
dev_dbg(component->dev, "%s: event %d DMIC%d\n",
|
|
|
__func__, event, dmic);
|
|
|
|
|
@@ -1195,6 +1182,7 @@ static int lpass_cdc_va_macro_enable_dec(struct snd_soc_dapm_widget *w,
|
|
|
u16 tx_gain_ctl_reg;
|
|
|
u8 hpf_cut_off_freq;
|
|
|
u16 adc_mux_reg = 0;
|
|
|
+ u16 adc_mux0_reg = 0;
|
|
|
u16 tx_fs_reg = 0;
|
|
|
struct device *va_dev = NULL;
|
|
|
struct lpass_cdc_va_macro_priv *va_priv = NULL;
|
|
@@ -1220,11 +1208,16 @@ static int lpass_cdc_va_macro_enable_dec(struct snd_soc_dapm_widget *w,
|
|
|
LPASS_CDC_VA_MACRO_TX_PATH_OFFSET * decimator;
|
|
|
adc_mux_reg = LPASS_CDC_VA_INP_MUX_ADC_MUX0_CFG1 +
|
|
|
LPASS_CDC_VA_MACRO_ADC_MUX_CFG_OFFSET * decimator;
|
|
|
+ adc_mux0_reg = LPASS_CDC_VA_INP_MUX_ADC_MUX0_CFG0 +
|
|
|
+ LPASS_CDC_VA_MACRO_ADC_MUX_CFG_OFFSET * decimator;
|
|
|
tx_fs_reg = LPASS_CDC_VA_TX0_TX_PATH_CTL +
|
|
|
LPASS_CDC_VA_MACRO_TX_PATH_OFFSET * decimator;
|
|
|
va_priv->pcm_rate[decimator] = (snd_soc_component_read(component,
|
|
|
tx_fs_reg) & 0x0F);
|
|
|
|
|
|
+ if(!is_amic_enabled(component, decimator))
|
|
|
+ lpass_cdc_va_macro_enable_dmic(w, kcontrol, event, adc_mux0_reg);
|
|
|
+
|
|
|
switch (event) {
|
|
|
case SND_SOC_DAPM_PRE_PMU:
|
|
|
snd_soc_component_update_bits(component,
|
|
@@ -1823,37 +1816,21 @@ static const struct snd_soc_dapm_widget lpass_cdc_va_macro_dapm_widgets[] = {
|
|
|
lpass_cdc_va_macro_enable_micbias,
|
|
|
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
|
|
|
|
|
|
- SND_SOC_DAPM_ADC_E("VA DMIC0", NULL, SND_SOC_NOPM, 0, 0,
|
|
|
- lpass_cdc_va_macro_enable_dmic, SND_SOC_DAPM_PRE_PMU |
|
|
|
- SND_SOC_DAPM_POST_PMD),
|
|
|
+ SND_SOC_DAPM_ADC("VA DMIC0", NULL, SND_SOC_NOPM, 0, 0),
|
|
|
|
|
|
- SND_SOC_DAPM_ADC_E("VA DMIC1", NULL, SND_SOC_NOPM, 0, 0,
|
|
|
- lpass_cdc_va_macro_enable_dmic, SND_SOC_DAPM_PRE_PMU |
|
|
|
- SND_SOC_DAPM_POST_PMD),
|
|
|
+ SND_SOC_DAPM_ADC("VA DMIC1", NULL, SND_SOC_NOPM, 0, 0),
|
|
|
|
|
|
- SND_SOC_DAPM_ADC_E("VA DMIC2", NULL, SND_SOC_NOPM, 0, 0,
|
|
|
- lpass_cdc_va_macro_enable_dmic, SND_SOC_DAPM_PRE_PMU |
|
|
|
- SND_SOC_DAPM_POST_PMD),
|
|
|
+ SND_SOC_DAPM_ADC("VA DMIC2", NULL, SND_SOC_NOPM, 0, 0),
|
|
|
|
|
|
- SND_SOC_DAPM_ADC_E("VA DMIC3", NULL, SND_SOC_NOPM, 0, 0,
|
|
|
- lpass_cdc_va_macro_enable_dmic, SND_SOC_DAPM_PRE_PMU |
|
|
|
- SND_SOC_DAPM_POST_PMD),
|
|
|
+ SND_SOC_DAPM_ADC("VA DMIC3", NULL, SND_SOC_NOPM, 0, 0),
|
|
|
|
|
|
- SND_SOC_DAPM_ADC_E("VA DMIC4", NULL, SND_SOC_NOPM, 0, 0,
|
|
|
- lpass_cdc_va_macro_enable_dmic, SND_SOC_DAPM_PRE_PMU |
|
|
|
- SND_SOC_DAPM_POST_PMD),
|
|
|
+ SND_SOC_DAPM_ADC("VA DMIC4", NULL, SND_SOC_NOPM, 0, 0),
|
|
|
|
|
|
- SND_SOC_DAPM_ADC_E("VA DMIC5", NULL, SND_SOC_NOPM, 0, 0,
|
|
|
- lpass_cdc_va_macro_enable_dmic, SND_SOC_DAPM_PRE_PMU |
|
|
|
- SND_SOC_DAPM_POST_PMD),
|
|
|
+ SND_SOC_DAPM_ADC("VA DMIC5", NULL, SND_SOC_NOPM, 0, 0),
|
|
|
|
|
|
- SND_SOC_DAPM_ADC_E("VA DMIC6", NULL, SND_SOC_NOPM, 0, 0,
|
|
|
- lpass_cdc_va_macro_enable_dmic, SND_SOC_DAPM_PRE_PMU |
|
|
|
- SND_SOC_DAPM_POST_PMD),
|
|
|
+ SND_SOC_DAPM_ADC("VA DMIC6", NULL, SND_SOC_NOPM, 0, 0),
|
|
|
|
|
|
- SND_SOC_DAPM_ADC_E("VA DMIC7", NULL, SND_SOC_NOPM, 0, 0,
|
|
|
- lpass_cdc_va_macro_enable_dmic, SND_SOC_DAPM_PRE_PMU |
|
|
|
- SND_SOC_DAPM_POST_PMD),
|
|
|
+ SND_SOC_DAPM_ADC("VA DMIC7", NULL, SND_SOC_NOPM, 0, 0),
|
|
|
|
|
|
SND_SOC_DAPM_MUX_E("VA DEC0 MUX", SND_SOC_NOPM, LPASS_CDC_VA_MACRO_DEC0, 0,
|
|
|
&va_dec0_mux, lpass_cdc_va_macro_enable_dec,
|