|
@@ -42,6 +42,9 @@
|
|
|
SNDRV_PCM_FMTBIT_S24_LE |\
|
|
|
SNDRV_PCM_FMTBIT_S24_3LE)
|
|
|
|
|
|
+#define LPASS_CDC_WSA_MACRO_CPS_RATES (48000)
|
|
|
+#define LPASS_CDC_WSA_MACRO_CPS_FORMATS (SNDRV_PCM_FMTBIT_S32_LE)
|
|
|
+
|
|
|
#define NUM_INTERPOLATORS 2
|
|
|
|
|
|
#define LPASS_CDC_WSA_MACRO_MUX_INP_SHFT 0x3
|
|
@@ -231,6 +234,7 @@ enum {
|
|
|
LPASS_CDC_WSA_MACRO_AIF_MIX1_PB,
|
|
|
LPASS_CDC_WSA_MACRO_AIF_VI,
|
|
|
LPASS_CDC_WSA_MACRO_AIF_ECHO,
|
|
|
+ LPASS_CDC_WSA_MACRO_AIF_CPS,
|
|
|
LPASS_CDC_WSA_MACRO_MAX_DAIS,
|
|
|
};
|
|
|
|
|
@@ -501,6 +505,20 @@ static struct snd_soc_dai_driver lpass_cdc_wsa_macro_dai[] = {
|
|
|
},
|
|
|
.ops = &lpass_cdc_wsa_macro_dai_ops,
|
|
|
},
|
|
|
+ {
|
|
|
+ .name = "wsa_macro_cpsfeedback",
|
|
|
+ .id = LPASS_CDC_WSA_MACRO_AIF_CPS,
|
|
|
+ .capture = {
|
|
|
+ .stream_name = "WSA_AIF_CPS Capture",
|
|
|
+ .rates = LPASS_CDC_WSA_MACRO_CPS_RATES,
|
|
|
+ .formats = LPASS_CDC_WSA_MACRO_CPS_FORMATS,
|
|
|
+ .rate_max = 48000,
|
|
|
+ .rate_min = 48000,
|
|
|
+ .channels_min = 1,
|
|
|
+ .channels_max = 2,
|
|
|
+ },
|
|
|
+ .ops = &lpass_cdc_wsa_macro_dai_ops,
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
static bool lpass_cdc_wsa_macro_get_data(struct snd_soc_component *component,
|
|
@@ -770,6 +788,9 @@ static int lpass_cdc_wsa_macro_hw_params(struct snd_pcm_substream *substream,
|
|
|
case 24:
|
|
|
wsa_priv->bit_width[dai->id] = 24;
|
|
|
break;
|
|
|
+ case 32:
|
|
|
+ wsa_priv->bit_width[dai->id] = 32;
|
|
|
+ break;
|
|
|
default:
|
|
|
dev_err_ratelimited(component->dev, "%s: Invalid format 0x%x\n",
|
|
|
__func__, params_width(params));
|
|
@@ -799,6 +820,7 @@ static int lpass_cdc_wsa_macro_get_channel_map(struct snd_soc_dai *dai,
|
|
|
|
|
|
switch (dai->id) {
|
|
|
case LPASS_CDC_WSA_MACRO_AIF_VI:
|
|
|
+ case LPASS_CDC_WSA_MACRO_AIF_CPS:
|
|
|
*tx_slot = wsa_priv->active_ch_mask[dai->id];
|
|
|
*tx_num = wsa_priv->active_ch_cnt[dai->id];
|
|
|
break;
|
|
@@ -2714,6 +2736,94 @@ static const struct snd_kcontrol_new aif_vi_mixer[] = {
|
|
|
lpass_cdc_wsa_macro_vi_feed_mixer_put),
|
|
|
};
|
|
|
|
|
|
+static int lpass_cdc_wsa_macro_cps_feed_mixer_get(struct snd_kcontrol *kcontrol,
|
|
|
+ struct snd_ctl_elem_value *ucontrol)
|
|
|
+{
|
|
|
+ struct snd_soc_dapm_widget *widget =
|
|
|
+ snd_soc_dapm_kcontrol_widget(kcontrol);
|
|
|
+ struct snd_soc_component *component =
|
|
|
+ snd_soc_dapm_to_component(widget->dapm);
|
|
|
+ struct soc_multi_mixer_control *mixer =
|
|
|
+ ((struct soc_multi_mixer_control *)kcontrol->private_value);
|
|
|
+ u32 dai_id = widget->shift;
|
|
|
+ u32 spk_tx_id = mixer->shift;
|
|
|
+ struct device *wsa_dev = NULL;
|
|
|
+ struct lpass_cdc_wsa_macro_priv *wsa_priv = NULL;
|
|
|
+
|
|
|
+ if (!lpass_cdc_wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ if (test_bit(spk_tx_id, &wsa_priv->active_ch_mask[dai_id]))
|
|
|
+ ucontrol->value.integer.value[0] = 1;
|
|
|
+ else
|
|
|
+ ucontrol->value.integer.value[0] = 0;
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int lpass_cdc_wsa_macro_cps_feed_mixer_put(struct snd_kcontrol *kcontrol,
|
|
|
+ struct snd_ctl_elem_value *ucontrol)
|
|
|
+{
|
|
|
+ struct snd_soc_dapm_widget *widget =
|
|
|
+ snd_soc_dapm_kcontrol_widget(kcontrol);
|
|
|
+ struct snd_soc_component *component =
|
|
|
+ snd_soc_dapm_to_component(widget->dapm);
|
|
|
+ struct soc_multi_mixer_control *mixer =
|
|
|
+ ((struct soc_multi_mixer_control *)kcontrol->private_value);
|
|
|
+ u32 dai_id = widget->shift;
|
|
|
+ u32 spk_tx_id = mixer->shift;
|
|
|
+ u32 enable = ucontrol->value.integer.value[0];
|
|
|
+ struct device *wsa_dev = NULL;
|
|
|
+ struct lpass_cdc_wsa_macro_priv *wsa_priv = NULL;
|
|
|
+
|
|
|
+ if (!lpass_cdc_wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ if (enable) {
|
|
|
+ if (spk_tx_id == LPASS_CDC_WSA_MACRO_TX0 &&
|
|
|
+ !test_bit(LPASS_CDC_WSA_MACRO_TX0,
|
|
|
+ &wsa_priv->active_ch_mask[dai_id])) {
|
|
|
+ set_bit(LPASS_CDC_WSA_MACRO_TX0,
|
|
|
+ &wsa_priv->active_ch_mask[dai_id]);
|
|
|
+ wsa_priv->active_ch_cnt[dai_id]++;
|
|
|
+ }
|
|
|
+ if (spk_tx_id == LPASS_CDC_WSA_MACRO_TX1 &&
|
|
|
+ !test_bit(LPASS_CDC_WSA_MACRO_TX1,
|
|
|
+ &wsa_priv->active_ch_mask[dai_id])) {
|
|
|
+ set_bit(LPASS_CDC_WSA_MACRO_TX1,
|
|
|
+ &wsa_priv->active_ch_mask[dai_id]);
|
|
|
+ wsa_priv->active_ch_cnt[dai_id]++;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (spk_tx_id == LPASS_CDC_WSA_MACRO_TX0 &&
|
|
|
+ test_bit(LPASS_CDC_WSA_MACRO_TX0,
|
|
|
+ &wsa_priv->active_ch_mask[dai_id])) {
|
|
|
+ clear_bit(LPASS_CDC_WSA_MACRO_TX0,
|
|
|
+ &wsa_priv->active_ch_mask[dai_id]);
|
|
|
+ wsa_priv->active_ch_cnt[dai_id]--;
|
|
|
+ }
|
|
|
+ if (spk_tx_id == LPASS_CDC_WSA_MACRO_TX1 &&
|
|
|
+ test_bit(LPASS_CDC_WSA_MACRO_TX1,
|
|
|
+ &wsa_priv->active_ch_mask[dai_id])) {
|
|
|
+ clear_bit(LPASS_CDC_WSA_MACRO_TX1,
|
|
|
+ &wsa_priv->active_ch_mask[dai_id]);
|
|
|
+ wsa_priv->active_ch_cnt[dai_id]--;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, NULL);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static const struct snd_kcontrol_new aif_cps_mixer[] = {
|
|
|
+ SOC_SINGLE_EXT("WSA_SPKR_CPS_1", SND_SOC_NOPM, LPASS_CDC_WSA_MACRO_TX0, 1, 0,
|
|
|
+ lpass_cdc_wsa_macro_cps_feed_mixer_get,
|
|
|
+ lpass_cdc_wsa_macro_cps_feed_mixer_put),
|
|
|
+ SOC_SINGLE_EXT("WSA_SPKR_CPS_2", SND_SOC_NOPM, LPASS_CDC_WSA_MACRO_TX1, 1, 0,
|
|
|
+ lpass_cdc_wsa_macro_cps_feed_mixer_get,
|
|
|
+ lpass_cdc_wsa_macro_cps_feed_mixer_put),
|
|
|
+};
|
|
|
+
|
|
|
static const struct snd_soc_dapm_widget lpass_cdc_wsa_macro_dapm_widgets[] = {
|
|
|
SND_SOC_DAPM_AIF_IN("WSA AIF1 PB", "WSA_AIF1 Playback", 0,
|
|
|
SND_SOC_NOPM, 0, 0),
|
|
@@ -2729,8 +2839,16 @@ static const struct snd_soc_dapm_widget lpass_cdc_wsa_macro_dapm_widgets[] = {
|
|
|
SND_SOC_DAPM_AIF_OUT("WSA AIF_ECHO", "WSA_AIF_ECHO Capture", 0,
|
|
|
SND_SOC_NOPM, 0, 0),
|
|
|
|
|
|
+ SND_SOC_DAPM_AIF_OUT("WSA AIF_CPS", "WSA_AIF_CPS Capture", 0,
|
|
|
+ SND_SOC_NOPM, 0, 0),
|
|
|
+
|
|
|
+ SND_SOC_DAPM_AIF_OUT("WSA AIF_CPS", "WSA_AIF_CPS Capture", 0,
|
|
|
+ SND_SOC_NOPM, 0, 0),
|
|
|
+
|
|
|
SND_SOC_DAPM_MIXER("WSA_AIF_VI Mixer", SND_SOC_NOPM, LPASS_CDC_WSA_MACRO_AIF_VI,
|
|
|
0, aif_vi_mixer, ARRAY_SIZE(aif_vi_mixer)),
|
|
|
+ SND_SOC_DAPM_MIXER("WSA_AIF_CPS Mixer", SND_SOC_NOPM, LPASS_CDC_WSA_MACRO_AIF_CPS,
|
|
|
+ 0, aif_cps_mixer, ARRAY_SIZE(aif_cps_mixer)),
|
|
|
SND_SOC_DAPM_MUX_E("WSA RX_MIX EC0_MUX", SND_SOC_NOPM,
|
|
|
LPASS_CDC_WSA_MACRO_EC0_MUX, 0,
|
|
|
&rx_mix_ec0_mux, lpass_cdc_wsa_macro_enable_echo,
|
|
@@ -2833,6 +2951,8 @@ static const struct snd_soc_dapm_widget lpass_cdc_wsa_macro_dapm_widgets[] = {
|
|
|
|
|
|
SND_SOC_DAPM_INPUT("VIINPUT_WSA"),
|
|
|
|
|
|
+ SND_SOC_DAPM_INPUT("CPSINPUT_WSA"),
|
|
|
+
|
|
|
SND_SOC_DAPM_OUTPUT("WSA_SPK1 OUT"),
|
|
|
SND_SOC_DAPM_OUTPUT("WSA_SPK2 OUT"),
|
|
|
|
|
@@ -2847,6 +2967,12 @@ static const struct snd_soc_dapm_route wsa_audio_map[] = {
|
|
|
{"WSA AIF_VI", NULL, "WSA_AIF_VI Mixer"},
|
|
|
{"WSA AIF_VI", NULL, "WSA_MCLK"},
|
|
|
|
|
|
+ /* CPS Feedback */
|
|
|
+ {"WSA_AIF_CPS Mixer", "WSA_SPKR_CPS_1", "CPSINPUT_WSA"},
|
|
|
+ {"WSA_AIF_CPS Mixer", "WSA_SPKR_CPS_2", "CPSINPUT_WSA"},
|
|
|
+ {"WSA AIF_CPS", NULL, "WSA_AIF_CPS Mixer"},
|
|
|
+ {"WSA AIF_CPS", NULL, "WSA_MCLK"},
|
|
|
+
|
|
|
{"WSA RX_MIX EC0_MUX", "RX_MIX_TX0", "WSA_RX INT0 SEC MIX"},
|
|
|
{"WSA RX_MIX EC1_MUX", "RX_MIX_TX0", "WSA_RX INT0 SEC MIX"},
|
|
|
{"WSA RX_MIX EC0_MUX", "RX_MIX_TX1", "WSA_RX INT1 SEC MIX"},
|
|
@@ -3401,9 +3527,11 @@ static int lpass_cdc_wsa_macro_init(struct snd_soc_component *component)
|
|
|
snd_soc_dapm_ignore_suspend(dapm, "WSA_AIF_MIX1 Playback");
|
|
|
snd_soc_dapm_ignore_suspend(dapm, "WSA_AIF_VI Capture");
|
|
|
snd_soc_dapm_ignore_suspend(dapm, "WSA_AIF_ECHO Capture");
|
|
|
+ snd_soc_dapm_ignore_suspend(dapm, "WSA_AIF_CPS Capture");
|
|
|
snd_soc_dapm_ignore_suspend(dapm, "WSA_SPK1 OUT");
|
|
|
snd_soc_dapm_ignore_suspend(dapm, "WSA_SPK2 OUT");
|
|
|
snd_soc_dapm_ignore_suspend(dapm, "VIINPUT_WSA");
|
|
|
+ snd_soc_dapm_ignore_suspend(dapm, "CPSINPUT_WSA");
|
|
|
snd_soc_dapm_ignore_suspend(dapm, "WSA SRC0_INP");
|
|
|
snd_soc_dapm_ignore_suspend(dapm, "WSA_TX DEC0_INP");
|
|
|
snd_soc_dapm_ignore_suspend(dapm, "WSA_TX DEC1_INP");
|