|
@@ -1332,6 +1332,7 @@ static int wcd938x_codec_enable_dmic(struct snd_soc_dapm_widget *w,
|
|
|
u8 dmic_clk_shift = 0;
|
|
|
u8 dmic_clk_mask = 0;
|
|
|
u16 dmic2_left_en = 0;
|
|
|
+ int ret = 0;
|
|
|
|
|
|
dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
|
|
|
w->name, event);
|
|
@@ -1401,12 +1402,14 @@ static int wcd938x_codec_enable_dmic(struct snd_soc_dapm_widget *w,
|
|
|
/* enable clock scaling */
|
|
|
snd_soc_component_update_bits(component,
|
|
|
WCD938X_DIGITAL_CDC_DMIC_CTL, 0x06, 0x06);
|
|
|
- wcd938x_tx_connect_port(component, DMIC0 + (w->shift),
|
|
|
- SWR_CLK_RATE_2P4MHZ, true);
|
|
|
+ ret = swr_slvdev_datapath_control(wcd938x->tx_swr_dev,
|
|
|
+ wcd938x->tx_swr_dev->dev_num,
|
|
|
+ true);
|
|
|
break;
|
|
|
case SND_SOC_DAPM_POST_PMD:
|
|
|
- wcd938x_tx_connect_port(component, DMIC0 + (w->shift), 0,
|
|
|
- false);
|
|
|
+ ret = swr_slvdev_datapath_control(wcd938x->tx_swr_dev,
|
|
|
+ wcd938x->tx_swr_dev->dev_num,
|
|
|
+ false);
|
|
|
snd_soc_component_update_bits(component,
|
|
|
WCD938X_DIGITAL_CDC_AMIC_CTL,
|
|
|
(0x01 << dmic_ctl_shift),
|
|
@@ -1418,7 +1421,7 @@ static int wcd938x_codec_enable_dmic(struct snd_soc_dapm_widget *w,
|
|
|
dmic_clk_en_reg, 0x08, 0x00);
|
|
|
break;
|
|
|
};
|
|
|
- return 0;
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -1557,12 +1560,21 @@ static int wcd938x_tx_swr_ctrl(struct snd_soc_dapm_widget *w,
|
|
|
rate = wcd938x_get_clk_rate(i);
|
|
|
wcd938x_set_swr_clk_rate(component, rate, bank);
|
|
|
}
|
|
|
- ret = swr_slvdev_datapath_control(wcd938x->tx_swr_dev,
|
|
|
- wcd938x->tx_swr_dev->dev_num,
|
|
|
- true);
|
|
|
+ if (w->shift == ADC2 && !(snd_soc_component_read32(component,
|
|
|
+ WCD938X_TX_NEW_AMIC_MUX_CFG) & 0x80)) {
|
|
|
+ if (!wcd938x->bcs_dis)
|
|
|
+ wcd938x_tx_connect_port(component, MBHC,
|
|
|
+ SWR_CLK_RATE_4P8MHZ, true);
|
|
|
+ set_bit(AMIC2_BCS_ENABLE, &wcd938x->status_mask);
|
|
|
+ }
|
|
|
if (strnstr(w->name, "ADC", sizeof("ADC"))) {
|
|
|
+ wcd938x_tx_connect_port(component, w->shift, rate,
|
|
|
+ true);
|
|
|
/* Copy clk settings to active bank */
|
|
|
wcd938x_set_swr_clk_rate(component, rate, !bank);
|
|
|
+ } else {
|
|
|
+ wcd938x_tx_connect_port(component, w->shift,
|
|
|
+ SWR_CLK_RATE_2P4MHZ, true);
|
|
|
}
|
|
|
break;
|
|
|
case SND_SOC_DAPM_POST_PMD:
|
|
@@ -1570,9 +1582,15 @@ static int wcd938x_tx_swr_ctrl(struct snd_soc_dapm_widget *w,
|
|
|
rate = wcd938x_get_clk_rate(ADC_MODE_INVALID);
|
|
|
wcd938x_set_swr_clk_rate(component, rate, !bank);
|
|
|
}
|
|
|
- ret = swr_slvdev_datapath_control(wcd938x->tx_swr_dev,
|
|
|
- wcd938x->tx_swr_dev->dev_num,
|
|
|
- false);
|
|
|
+ wcd938x_tx_connect_port(component, w->shift, 0, false);
|
|
|
+ if (w->shift == ADC2 &&
|
|
|
+ test_bit(AMIC2_BCS_ENABLE, &wcd938x->status_mask)) {
|
|
|
+ if (!wcd938x->bcs_dis)
|
|
|
+ wcd938x_tx_connect_port(component, MBHC, 0,
|
|
|
+ false);
|
|
|
+ clear_bit(AMIC2_BCS_ENABLE, &wcd938x->status_mask);
|
|
|
+ }
|
|
|
+
|
|
|
if (strnstr(w->name, "ADC", sizeof("ADC")))
|
|
|
wcd938x_set_swr_clk_rate(component, rate, bank);
|
|
|
break;
|
|
@@ -1621,7 +1639,7 @@ static int wcd938x_codec_enable_adc(struct snd_soc_dapm_widget *w,
|
|
|
struct snd_soc_component *component =
|
|
|
snd_soc_dapm_to_component(w->dapm);
|
|
|
struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
|
|
|
- int clk_rate = 0;
|
|
|
+ int clk_rate = 0, ret = 0;
|
|
|
|
|
|
dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
|
|
|
w->name, event);
|
|
@@ -1634,33 +1652,21 @@ static int wcd938x_codec_enable_adc(struct snd_soc_dapm_widget *w,
|
|
|
WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x10, 0x10);
|
|
|
set_bit(w->shift, &wcd938x->status_mask);
|
|
|
clk_rate = wcd938x_get_clk_rate(wcd938x->tx_mode[w->shift]);
|
|
|
- /* Enable BCS for Headset mic */
|
|
|
- if (w->shift == 1 && !(snd_soc_component_read32(component,
|
|
|
- WCD938X_TX_NEW_AMIC_MUX_CFG) & 0x80)) {
|
|
|
- if (!wcd938x->bcs_dis)
|
|
|
- wcd938x_tx_connect_port(component, MBHC,
|
|
|
- SWR_CLK_RATE_4P8MHZ, true);
|
|
|
- set_bit(AMIC2_BCS_ENABLE, &wcd938x->status_mask);
|
|
|
- }
|
|
|
- wcd938x_tx_connect_port(component, ADC1 + (w->shift), clk_rate,
|
|
|
- true);
|
|
|
+ ret = swr_slvdev_datapath_control(wcd938x->tx_swr_dev,
|
|
|
+ wcd938x->tx_swr_dev->dev_num,
|
|
|
+ true);
|
|
|
break;
|
|
|
case SND_SOC_DAPM_POST_PMD:
|
|
|
- wcd938x_tx_connect_port(component, ADC1 + (w->shift), 0, false);
|
|
|
- if (w->shift == 1 &&
|
|
|
- test_bit(AMIC2_BCS_ENABLE, &wcd938x->status_mask)) {
|
|
|
- if (!wcd938x->bcs_dis)
|
|
|
- wcd938x_tx_connect_port(component, MBHC, 0,
|
|
|
- false);
|
|
|
- clear_bit(AMIC2_BCS_ENABLE, &wcd938x->status_mask);
|
|
|
- }
|
|
|
+ ret = swr_slvdev_datapath_control(wcd938x->tx_swr_dev,
|
|
|
+ wcd938x->tx_swr_dev->dev_num,
|
|
|
+ false);
|
|
|
snd_soc_component_update_bits(component,
|
|
|
WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x08, 0x00);
|
|
|
clear_bit(w->shift, &wcd938x->status_mask);
|
|
|
break;
|
|
|
};
|
|
|
|
|
|
- return 0;
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
void wcd938x_disable_bcs_before_slow_insert(struct snd_soc_component *component,
|
|
@@ -3110,49 +3116,49 @@ static const struct snd_soc_dapm_widget wcd938x_dapm_widgets[] = {
|
|
|
SND_SOC_DAPM_MUX("HDR34 MUX", SND_SOC_NOPM, 0, 0,
|
|
|
&tx_hdr34_mux),
|
|
|
/*tx mixers*/
|
|
|
- SND_SOC_DAPM_MIXER_E("ADC1_MIXER", SND_SOC_NOPM, 0, 0,
|
|
|
+ SND_SOC_DAPM_MIXER_E("ADC1_MIXER", SND_SOC_NOPM, ADC1, 0,
|
|
|
adc1_switch, ARRAY_SIZE(adc1_switch),
|
|
|
wcd938x_tx_swr_ctrl, SND_SOC_DAPM_PRE_PMU |
|
|
|
SND_SOC_DAPM_POST_PMD),
|
|
|
- SND_SOC_DAPM_MIXER_E("ADC2_MIXER", SND_SOC_NOPM, 0, 0,
|
|
|
+ SND_SOC_DAPM_MIXER_E("ADC2_MIXER", SND_SOC_NOPM, ADC2, 0,
|
|
|
adc2_switch, ARRAY_SIZE(adc2_switch),
|
|
|
wcd938x_tx_swr_ctrl, SND_SOC_DAPM_PRE_PMU |
|
|
|
SND_SOC_DAPM_POST_PMD),
|
|
|
- SND_SOC_DAPM_MIXER_E("ADC3_MIXER", SND_SOC_NOPM, 0, 0, adc3_switch,
|
|
|
+ SND_SOC_DAPM_MIXER_E("ADC3_MIXER", SND_SOC_NOPM, ADC3, 0, adc3_switch,
|
|
|
ARRAY_SIZE(adc3_switch), wcd938x_tx_swr_ctrl,
|
|
|
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
|
|
|
- SND_SOC_DAPM_MIXER_E("ADC4_MIXER", SND_SOC_NOPM, 0, 0, adc4_switch,
|
|
|
+ SND_SOC_DAPM_MIXER_E("ADC4_MIXER", SND_SOC_NOPM, ADC4, 0, adc4_switch,
|
|
|
ARRAY_SIZE(adc4_switch), wcd938x_tx_swr_ctrl,
|
|
|
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
|
|
|
- SND_SOC_DAPM_MIXER_E("DMIC1_MIXER", SND_SOC_NOPM, 0,
|
|
|
+ SND_SOC_DAPM_MIXER_E("DMIC1_MIXER", SND_SOC_NOPM, DMIC1,
|
|
|
0, dmic1_switch, ARRAY_SIZE(dmic1_switch),
|
|
|
wcd938x_tx_swr_ctrl, SND_SOC_DAPM_PRE_PMU |
|
|
|
SND_SOC_DAPM_POST_PMD),
|
|
|
- SND_SOC_DAPM_MIXER_E("DMIC2_MIXER", SND_SOC_NOPM, 0,
|
|
|
+ SND_SOC_DAPM_MIXER_E("DMIC2_MIXER", SND_SOC_NOPM, DMIC2,
|
|
|
0, dmic2_switch, ARRAY_SIZE(dmic2_switch),
|
|
|
wcd938x_tx_swr_ctrl, SND_SOC_DAPM_PRE_PMU |
|
|
|
SND_SOC_DAPM_POST_PMD),
|
|
|
- SND_SOC_DAPM_MIXER_E("DMIC3_MIXER", SND_SOC_NOPM, 0,
|
|
|
+ SND_SOC_DAPM_MIXER_E("DMIC3_MIXER", SND_SOC_NOPM, DMIC3,
|
|
|
0, dmic3_switch, ARRAY_SIZE(dmic3_switch),
|
|
|
wcd938x_tx_swr_ctrl, SND_SOC_DAPM_PRE_PMU |
|
|
|
SND_SOC_DAPM_POST_PMD),
|
|
|
- SND_SOC_DAPM_MIXER_E("DMIC4_MIXER", SND_SOC_NOPM, 0,
|
|
|
+ SND_SOC_DAPM_MIXER_E("DMIC4_MIXER", SND_SOC_NOPM, DMIC4,
|
|
|
0, dmic4_switch, ARRAY_SIZE(dmic4_switch),
|
|
|
wcd938x_tx_swr_ctrl, SND_SOC_DAPM_PRE_PMU |
|
|
|
SND_SOC_DAPM_POST_PMD),
|
|
|
- SND_SOC_DAPM_MIXER_E("DMIC5_MIXER", SND_SOC_NOPM, 0,
|
|
|
+ SND_SOC_DAPM_MIXER_E("DMIC5_MIXER", SND_SOC_NOPM, DMIC5,
|
|
|
0, dmic5_switch, ARRAY_SIZE(dmic5_switch),
|
|
|
wcd938x_tx_swr_ctrl, SND_SOC_DAPM_PRE_PMU |
|
|
|
SND_SOC_DAPM_POST_PMD),
|
|
|
- SND_SOC_DAPM_MIXER_E("DMIC6_MIXER", SND_SOC_NOPM, 0,
|
|
|
+ SND_SOC_DAPM_MIXER_E("DMIC6_MIXER", SND_SOC_NOPM, DMIC6,
|
|
|
0, dmic6_switch, ARRAY_SIZE(dmic6_switch),
|
|
|
wcd938x_tx_swr_ctrl, SND_SOC_DAPM_PRE_PMU |
|
|
|
SND_SOC_DAPM_POST_PMD),
|
|
|
- SND_SOC_DAPM_MIXER_E("DMIC7_MIXER", SND_SOC_NOPM, 0,
|
|
|
+ SND_SOC_DAPM_MIXER_E("DMIC7_MIXER", SND_SOC_NOPM, DMIC7,
|
|
|
0, dmic7_switch, ARRAY_SIZE(dmic7_switch),
|
|
|
wcd938x_tx_swr_ctrl, SND_SOC_DAPM_PRE_PMU |
|
|
|
SND_SOC_DAPM_POST_PMD),
|
|
|
- SND_SOC_DAPM_MIXER_E("DMIC8_MIXER", SND_SOC_NOPM, 0,
|
|
|
+ SND_SOC_DAPM_MIXER_E("DMIC8_MIXER", SND_SOC_NOPM, DMIC8,
|
|
|
0, dmic8_switch, ARRAY_SIZE(dmic8_switch),
|
|
|
wcd938x_tx_swr_ctrl, SND_SOC_DAPM_PRE_PMU |
|
|
|
SND_SOC_DAPM_POST_PMD),
|