Loading asoc/codecs/bolero/tx-macro.c +22 −12 Original line number Diff line number Diff line Loading @@ -433,23 +433,31 @@ static int tx_macro_reg_wake_irq(struct snd_soc_component *component, return ret; } static int is_amic_enabled(struct snd_soc_component *component, int decimator) static bool is_amic_enabled(struct snd_soc_component *component, int decimator) { u16 adc_mux_reg = 0, adc_reg = 0; u16 adc_n = BOLERO_ADC_MAX; bool ret = false; struct device *tx_dev = NULL; struct tx_macro_priv *tx_priv = NULL; if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__)) return ret; adc_mux_reg = BOLERO_CDC_TX_INP_MUX_ADC_MUX0_CFG1 + TX_MACRO_ADC_MUX_CFG_OFFSET * decimator; if (snd_soc_component_read32(component, adc_mux_reg) & SWR_MIC) { if (tx_priv->version == BOLERO_VERSION_2_1) return true; adc_reg = BOLERO_CDC_TX_INP_MUX_ADC_MUX0_CFG0 + TX_MACRO_ADC_MUX_CFG_OFFSET * decimator; adc_n = snd_soc_component_read32(component, adc_reg) & TX_MACRO_SWR_MIC_MUX_SEL_MASK; if (adc_n >= BOLERO_ADC_MAX) adc_n = BOLERO_ADC_MAX; if (adc_n < BOLERO_ADC_MAX) return true; } return adc_n; return ret; } static void tx_macro_tx_hpf_corner_freq_callback(struct work_struct *work) Loading @@ -460,7 +468,7 @@ static void tx_macro_tx_hpf_corner_freq_callback(struct work_struct *work) struct snd_soc_component *component = NULL; u16 dec_cfg_reg = 0, hpf_gate_reg = 0; u8 hpf_cut_off_freq = 0; u16 adc_n = 0; u16 adc_reg = 0, adc_n = 0; hpf_delayed_work = to_delayed_work(work); hpf_work = container_of(hpf_delayed_work, struct hpf_work, dwork); Loading @@ -476,8 +484,11 @@ static void tx_macro_tx_hpf_corner_freq_callback(struct work_struct *work) dev_dbg(component->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n", __func__, hpf_work->decimator, hpf_cut_off_freq); adc_n = is_amic_enabled(component, hpf_work->decimator); if (adc_n < BOLERO_ADC_MAX) { if (is_amic_enabled(component, hpf_work->decimator)) { adc_reg = BOLERO_CDC_TX_INP_MUX_ADC_MUX0_CFG0 + TX_MACRO_ADC_MUX_CFG_OFFSET * hpf_work->decimator; adc_n = snd_soc_component_read32(component, adc_reg) & TX_MACRO_SWR_MIC_MUX_SEL_MASK; /* analog mic clear TX hold */ bolero_clear_amic_tx_hold(component->dev, adc_n); snd_soc_component_update_bits(component, Loading Loading @@ -882,7 +893,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_POST_PMU: snd_soc_component_update_bits(component, tx_vol_ctl_reg, 0x20, 0x20); if (!(is_amic_enabled(component, decimator) < BOLERO_ADC_MAX)) { if (!is_amic_enabled(component, decimator)) { snd_soc_component_update_bits(component, hpf_gate_reg, 0x01, 0x00); /* Loading @@ -902,7 +913,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, TX_HPF_CUT_OFF_FREQ_MASK, CF_MIN_3DB_150HZ << 5); if (is_amic_enabled(component, decimator) < BOLERO_ADC_MAX) { if (is_amic_enabled(component, decimator)) { hpf_delay = TX_MACRO_AMIC_HPF_DELAY_MS; unmute_delay = TX_MACRO_AMIC_UNMUTE_DELAY_MS; } Loading @@ -918,8 +929,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, msecs_to_jiffies(hpf_delay)); snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x02); if (!(is_amic_enabled(component, decimator) < BOLERO_ADC_MAX)) if (!is_amic_enabled(component, decimator)) snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x00); /* Loading Loading @@ -959,7 +969,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, component, dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK, hpf_cut_off_freq << 5); if (is_amic_enabled(component, decimator) < BOLERO_ADC_MAX) if (is_amic_enabled(component, decimator)) snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x02); Loading asoc/codecs/bolero/va-macro.c +22 −12 Original line number Diff line number Diff line Loading @@ -781,23 +781,31 @@ static int va_macro_swrm_clock(void *handle, bool enable) return ret; } static int is_amic_enabled(struct snd_soc_component *component, int decimator) static bool is_amic_enabled(struct snd_soc_component *component, int decimator) { u16 adc_mux_reg = 0, adc_reg = 0; u16 adc_n = BOLERO_ADC_MAX; bool ret = false; struct device *va_dev = NULL; struct va_macro_priv *va_priv = NULL; if (!va_macro_get_data(component, &va_dev, &va_priv, __func__)) return ret; adc_mux_reg = BOLERO_CDC_VA_INP_MUX_ADC_MUX0_CFG1 + VA_MACRO_ADC_MUX_CFG_OFFSET * decimator; if (snd_soc_component_read32(component, adc_mux_reg) & SWR_MIC) { if (va_priv->version == BOLERO_VERSION_2_1) return true; adc_reg = BOLERO_CDC_VA_INP_MUX_ADC_MUX0_CFG0 + VA_MACRO_ADC_MUX_CFG_OFFSET * decimator; adc_n = snd_soc_component_read32(component, adc_reg) & VA_MACRO_SWR_MIC_MUX_SEL_MASK; if (adc_n >= BOLERO_ADC_MAX) adc_n = BOLERO_ADC_MAX; if (adc_n < BOLERO_ADC_MAX) return true; } return adc_n; return ret; } static void va_macro_tx_hpf_corner_freq_callback(struct work_struct *work) Loading @@ -808,7 +816,7 @@ static void va_macro_tx_hpf_corner_freq_callback(struct work_struct *work) struct snd_soc_component *component; u16 dec_cfg_reg, hpf_gate_reg; u8 hpf_cut_off_freq; u16 adc_n = 0; u16 adc_reg = 0, adc_n = 0; hpf_delayed_work = to_delayed_work(work); hpf_work = container_of(hpf_delayed_work, struct hpf_work, dwork); Loading @@ -824,8 +832,11 @@ static void va_macro_tx_hpf_corner_freq_callback(struct work_struct *work) dev_dbg(va_priv->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n", __func__, hpf_work->decimator, hpf_cut_off_freq); adc_n = is_amic_enabled(component, hpf_work->decimator); if (adc_n < BOLERO_ADC_MAX) { if (is_amic_enabled(component, hpf_work->decimator)) { adc_reg = BOLERO_CDC_VA_INP_MUX_ADC_MUX0_CFG0 + VA_MACRO_ADC_MUX_CFG_OFFSET * hpf_work->decimator; adc_n = snd_soc_component_read32(component, adc_reg) & VA_MACRO_SWR_MIC_MUX_SEL_MASK; /* analog mic clear TX hold */ bolero_clear_amic_tx_hold(component->dev, adc_n); snd_soc_component_update_bits(component, Loading Loading @@ -1125,7 +1136,7 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w, /* Enable TX CLK */ snd_soc_component_update_bits(component, tx_vol_ctl_reg, 0x20, 0x20); if (!(is_amic_enabled(component, decimator) < BOLERO_ADC_MAX)) { if (!is_amic_enabled(component, decimator)) { snd_soc_component_update_bits(component, hpf_gate_reg, 0x01, 0x00); /* Loading @@ -1144,7 +1155,7 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w, TX_HPF_CUT_OFF_FREQ_MASK, CF_MIN_3DB_150HZ << 5); } if (is_amic_enabled(component, decimator) < BOLERO_ADC_MAX) { if (is_amic_enabled(component, decimator)) { hpf_delay = BOLERO_CDC_VA_TX_AMIC_HPF_DELAY_MS; unmute_delay = BOLERO_CDC_VA_TX_AMIC_UNMUTE_DELAY_MS; if (va_tx_unmute_delay < unmute_delay) Loading @@ -1152,7 +1163,7 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w, } snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x02); if (!(is_amic_enabled(component, decimator) < BOLERO_ADC_MAX)) if (!is_amic_enabled(component, decimator)) snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x00); /* Loading Loading @@ -1189,8 +1200,7 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w, dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK, hpf_cut_off_freq << 5); if (is_amic_enabled(component, decimator) < BOLERO_ADC_MAX) if (is_amic_enabled(component, decimator)) snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x02); Loading Loading
asoc/codecs/bolero/tx-macro.c +22 −12 Original line number Diff line number Diff line Loading @@ -433,23 +433,31 @@ static int tx_macro_reg_wake_irq(struct snd_soc_component *component, return ret; } static int is_amic_enabled(struct snd_soc_component *component, int decimator) static bool is_amic_enabled(struct snd_soc_component *component, int decimator) { u16 adc_mux_reg = 0, adc_reg = 0; u16 adc_n = BOLERO_ADC_MAX; bool ret = false; struct device *tx_dev = NULL; struct tx_macro_priv *tx_priv = NULL; if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__)) return ret; adc_mux_reg = BOLERO_CDC_TX_INP_MUX_ADC_MUX0_CFG1 + TX_MACRO_ADC_MUX_CFG_OFFSET * decimator; if (snd_soc_component_read32(component, adc_mux_reg) & SWR_MIC) { if (tx_priv->version == BOLERO_VERSION_2_1) return true; adc_reg = BOLERO_CDC_TX_INP_MUX_ADC_MUX0_CFG0 + TX_MACRO_ADC_MUX_CFG_OFFSET * decimator; adc_n = snd_soc_component_read32(component, adc_reg) & TX_MACRO_SWR_MIC_MUX_SEL_MASK; if (adc_n >= BOLERO_ADC_MAX) adc_n = BOLERO_ADC_MAX; if (adc_n < BOLERO_ADC_MAX) return true; } return adc_n; return ret; } static void tx_macro_tx_hpf_corner_freq_callback(struct work_struct *work) Loading @@ -460,7 +468,7 @@ static void tx_macro_tx_hpf_corner_freq_callback(struct work_struct *work) struct snd_soc_component *component = NULL; u16 dec_cfg_reg = 0, hpf_gate_reg = 0; u8 hpf_cut_off_freq = 0; u16 adc_n = 0; u16 adc_reg = 0, adc_n = 0; hpf_delayed_work = to_delayed_work(work); hpf_work = container_of(hpf_delayed_work, struct hpf_work, dwork); Loading @@ -476,8 +484,11 @@ static void tx_macro_tx_hpf_corner_freq_callback(struct work_struct *work) dev_dbg(component->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n", __func__, hpf_work->decimator, hpf_cut_off_freq); adc_n = is_amic_enabled(component, hpf_work->decimator); if (adc_n < BOLERO_ADC_MAX) { if (is_amic_enabled(component, hpf_work->decimator)) { adc_reg = BOLERO_CDC_TX_INP_MUX_ADC_MUX0_CFG0 + TX_MACRO_ADC_MUX_CFG_OFFSET * hpf_work->decimator; adc_n = snd_soc_component_read32(component, adc_reg) & TX_MACRO_SWR_MIC_MUX_SEL_MASK; /* analog mic clear TX hold */ bolero_clear_amic_tx_hold(component->dev, adc_n); snd_soc_component_update_bits(component, Loading Loading @@ -882,7 +893,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_POST_PMU: snd_soc_component_update_bits(component, tx_vol_ctl_reg, 0x20, 0x20); if (!(is_amic_enabled(component, decimator) < BOLERO_ADC_MAX)) { if (!is_amic_enabled(component, decimator)) { snd_soc_component_update_bits(component, hpf_gate_reg, 0x01, 0x00); /* Loading @@ -902,7 +913,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, TX_HPF_CUT_OFF_FREQ_MASK, CF_MIN_3DB_150HZ << 5); if (is_amic_enabled(component, decimator) < BOLERO_ADC_MAX) { if (is_amic_enabled(component, decimator)) { hpf_delay = TX_MACRO_AMIC_HPF_DELAY_MS; unmute_delay = TX_MACRO_AMIC_UNMUTE_DELAY_MS; } Loading @@ -918,8 +929,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, msecs_to_jiffies(hpf_delay)); snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x02); if (!(is_amic_enabled(component, decimator) < BOLERO_ADC_MAX)) if (!is_amic_enabled(component, decimator)) snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x00); /* Loading Loading @@ -959,7 +969,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, component, dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK, hpf_cut_off_freq << 5); if (is_amic_enabled(component, decimator) < BOLERO_ADC_MAX) if (is_amic_enabled(component, decimator)) snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x02); Loading
asoc/codecs/bolero/va-macro.c +22 −12 Original line number Diff line number Diff line Loading @@ -781,23 +781,31 @@ static int va_macro_swrm_clock(void *handle, bool enable) return ret; } static int is_amic_enabled(struct snd_soc_component *component, int decimator) static bool is_amic_enabled(struct snd_soc_component *component, int decimator) { u16 adc_mux_reg = 0, adc_reg = 0; u16 adc_n = BOLERO_ADC_MAX; bool ret = false; struct device *va_dev = NULL; struct va_macro_priv *va_priv = NULL; if (!va_macro_get_data(component, &va_dev, &va_priv, __func__)) return ret; adc_mux_reg = BOLERO_CDC_VA_INP_MUX_ADC_MUX0_CFG1 + VA_MACRO_ADC_MUX_CFG_OFFSET * decimator; if (snd_soc_component_read32(component, adc_mux_reg) & SWR_MIC) { if (va_priv->version == BOLERO_VERSION_2_1) return true; adc_reg = BOLERO_CDC_VA_INP_MUX_ADC_MUX0_CFG0 + VA_MACRO_ADC_MUX_CFG_OFFSET * decimator; adc_n = snd_soc_component_read32(component, adc_reg) & VA_MACRO_SWR_MIC_MUX_SEL_MASK; if (adc_n >= BOLERO_ADC_MAX) adc_n = BOLERO_ADC_MAX; if (adc_n < BOLERO_ADC_MAX) return true; } return adc_n; return ret; } static void va_macro_tx_hpf_corner_freq_callback(struct work_struct *work) Loading @@ -808,7 +816,7 @@ static void va_macro_tx_hpf_corner_freq_callback(struct work_struct *work) struct snd_soc_component *component; u16 dec_cfg_reg, hpf_gate_reg; u8 hpf_cut_off_freq; u16 adc_n = 0; u16 adc_reg = 0, adc_n = 0; hpf_delayed_work = to_delayed_work(work); hpf_work = container_of(hpf_delayed_work, struct hpf_work, dwork); Loading @@ -824,8 +832,11 @@ static void va_macro_tx_hpf_corner_freq_callback(struct work_struct *work) dev_dbg(va_priv->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n", __func__, hpf_work->decimator, hpf_cut_off_freq); adc_n = is_amic_enabled(component, hpf_work->decimator); if (adc_n < BOLERO_ADC_MAX) { if (is_amic_enabled(component, hpf_work->decimator)) { adc_reg = BOLERO_CDC_VA_INP_MUX_ADC_MUX0_CFG0 + VA_MACRO_ADC_MUX_CFG_OFFSET * hpf_work->decimator; adc_n = snd_soc_component_read32(component, adc_reg) & VA_MACRO_SWR_MIC_MUX_SEL_MASK; /* analog mic clear TX hold */ bolero_clear_amic_tx_hold(component->dev, adc_n); snd_soc_component_update_bits(component, Loading Loading @@ -1125,7 +1136,7 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w, /* Enable TX CLK */ snd_soc_component_update_bits(component, tx_vol_ctl_reg, 0x20, 0x20); if (!(is_amic_enabled(component, decimator) < BOLERO_ADC_MAX)) { if (!is_amic_enabled(component, decimator)) { snd_soc_component_update_bits(component, hpf_gate_reg, 0x01, 0x00); /* Loading @@ -1144,7 +1155,7 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w, TX_HPF_CUT_OFF_FREQ_MASK, CF_MIN_3DB_150HZ << 5); } if (is_amic_enabled(component, decimator) < BOLERO_ADC_MAX) { if (is_amic_enabled(component, decimator)) { hpf_delay = BOLERO_CDC_VA_TX_AMIC_HPF_DELAY_MS; unmute_delay = BOLERO_CDC_VA_TX_AMIC_UNMUTE_DELAY_MS; if (va_tx_unmute_delay < unmute_delay) Loading @@ -1152,7 +1163,7 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w, } snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x02); if (!(is_amic_enabled(component, decimator) < BOLERO_ADC_MAX)) if (!is_amic_enabled(component, decimator)) snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x00); /* Loading Loading @@ -1189,8 +1200,7 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w, dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK, hpf_cut_off_freq << 5); if (is_amic_enabled(component, decimator) < BOLERO_ADC_MAX) if (is_amic_enabled(component, decimator)) snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x02); Loading