asoc: codecs: Update on support for WCD938x DMICs

WCD938x codec can support upto 8 DMICs.
Fix driver to enable support for these DMICs
over soundwire.

Change-Id: I82b9c7c6f56271c03acee3a966dbaa4fefb62102
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
This commit is contained in:
Laxminath Kasam 2019-07-18 13:44:17 +05:30
commit 549d11d4fe
2 changed files with 36 additions and 5 deletions

View file

@ -470,6 +470,12 @@ static int tx_macro_put_dec_enum(struct snd_kcontrol *kcontrol,
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int val = 0;
u16 mic_sel_reg = 0;
u16 dmic_clk_reg = 0;
struct device *tx_dev = NULL;
struct tx_macro_priv *tx_priv = NULL;
if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
return -EINVAL;
val = ucontrol->value.enumerated.item[0];
if (val > e->items - 1)
@ -510,14 +516,24 @@ static int tx_macro_put_dec_enum(struct snd_kcontrol *kcontrol,
}
if (strnstr(widget->name, "SMIC", strlen(widget->name))) {
if (val != 0) {
if (val < 5)
if (val < 5) {
snd_soc_component_update_bits(component,
mic_sel_reg,
1 << 7, 0x0 << 7);
else
} else {
snd_soc_component_update_bits(component,
mic_sel_reg,
1 << 7, 0x1 << 7);
snd_soc_component_update_bits(component,
BOLERO_CDC_VA_TOP_CSR_DMIC_CFG,
0x80, 0x00);
dmic_clk_reg =
BOLERO_CDC_TX_TOP_CSR_SWR_DMIC0_CTL +
((val - 5)/2) * 4;
snd_soc_component_update_bits(component,
dmic_clk_reg,
0x0E, tx_priv->dmic_clk_div << 0x1);
}
}
} else {
/* DMIC selected */

View file

@ -409,7 +409,12 @@ static int va_macro_put_dec_enum(struct snd_kcontrol *kcontrol,
snd_soc_dapm_to_component(widget->dapm);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int val;
u16 mic_sel_reg;
u16 mic_sel_reg, dmic_clk_reg;
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
return -EINVAL;
val = ucontrol->value.enumerated.item[0];
if (val > e->items - 1)
@ -450,14 +455,24 @@ static int va_macro_put_dec_enum(struct snd_kcontrol *kcontrol,
}
if (strnstr(widget->name, "SMIC", strlen(widget->name))) {
if (val != 0) {
if (val < 5)
if (val < 5) {
snd_soc_component_update_bits(component,
mic_sel_reg,
1 << 7, 0x0 << 7);
else
} else {
snd_soc_component_update_bits(component,
mic_sel_reg,
1 << 7, 0x1 << 7);
snd_soc_component_update_bits(component,
BOLERO_CDC_VA_TOP_CSR_DMIC_CFG,
0x80, 0x00);
dmic_clk_reg =
BOLERO_CDC_TX_TOP_CSR_SWR_DMIC0_CTL +
((val - 5)/2) * 4;
snd_soc_component_update_bits(component,
dmic_clk_reg,
0x0E, va_priv->dmic_clk_div << 0x1);
}
}
} else {
/* DMIC selected */