Commit 1e2c7845 authored by Vincent Knecht's avatar Vincent Knecht Committed by Mark Brown

ASoC: qcom: apq8016_sbc: Add SEC_MI2S support

This patch adds external codec support on secondary mi2s.
It is used for headphones on some devices, eg. alcatel-idol347.
Signed-off-by: default avatarVincent Knecht <vincent.knecht@mailoo.org>
Reviewed-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210806114116.895473-1-vincent.knecht@mailoo.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent ddaa1ed5
...@@ -30,6 +30,13 @@ struct apq8016_sbc_data { ...@@ -30,6 +30,13 @@ struct apq8016_sbc_data {
#define MIC_CTRL_QUA_WS_SLAVE_SEL_10 BIT(17) #define MIC_CTRL_QUA_WS_SLAVE_SEL_10 BIT(17)
#define MIC_CTRL_TLMM_SCLK_EN BIT(1) #define MIC_CTRL_TLMM_SCLK_EN BIT(1)
#define SPKR_CTL_PRI_WS_SLAVE_SEL_11 (BIT(17) | BIT(16)) #define SPKR_CTL_PRI_WS_SLAVE_SEL_11 (BIT(17) | BIT(16))
#define SPKR_CTL_TLMM_MCLK_EN BIT(1)
#define SPKR_CTL_TLMM_SCLK_EN BIT(2)
#define SPKR_CTL_TLMM_DATA1_EN BIT(3)
#define SPKR_CTL_TLMM_WS_OUT_SEL_MASK GENMASK(7, 6)
#define SPKR_CTL_TLMM_WS_OUT_SEL_SEC BIT(6)
#define SPKR_CTL_TLMM_WS_EN_SEL_MASK GENMASK(19, 18)
#define SPKR_CTL_TLMM_WS_EN_SEL_SEC BIT(18)
#define DEFAULT_MCLK_RATE 9600000 #define DEFAULT_MCLK_RATE 9600000
static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd) static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
...@@ -40,6 +47,7 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd) ...@@ -40,6 +47,7 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct apq8016_sbc_data *pdata = snd_soc_card_get_drvdata(card); struct apq8016_sbc_data *pdata = snd_soc_card_get_drvdata(card);
int i, rval; int i, rval;
u32 value;
switch (cpu_dai->id) { switch (cpu_dai->id) {
case MI2S_PRIMARY: case MI2S_PRIMARY:
...@@ -53,6 +61,15 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd) ...@@ -53,6 +61,15 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
MIC_CTRL_TLMM_SCLK_EN, MIC_CTRL_TLMM_SCLK_EN,
pdata->mic_iomux); pdata->mic_iomux);
break; break;
case MI2S_SECONDARY:
/* Clear TLMM_WS_OUT_SEL and TLMM_WS_EN_SEL fields */
value = readl(pdata->spkr_iomux) &
~(SPKR_CTL_TLMM_WS_OUT_SEL_MASK | SPKR_CTL_TLMM_WS_EN_SEL_MASK);
/* Configure the Sec MI2S to TLMM */
writel(value | SPKR_CTL_TLMM_MCLK_EN | SPKR_CTL_TLMM_SCLK_EN |
SPKR_CTL_TLMM_DATA1_EN | SPKR_CTL_TLMM_WS_OUT_SEL_SEC |
SPKR_CTL_TLMM_WS_EN_SEL_SEC, pdata->spkr_iomux);
break;
case MI2S_TERTIARY: case MI2S_TERTIARY:
writel(readl(pdata->mic_iomux) | MIC_CTRL_TER_WS_SLAVE_SEL | writel(readl(pdata->mic_iomux) | MIC_CTRL_TER_WS_SLAVE_SEL |
MIC_CTRL_TLMM_SCLK_EN, MIC_CTRL_TLMM_SCLK_EN,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment