Commit 334822a3 authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Mark Brown

ASoC: qcom: apq8016-sbc: set default mclk rate

MCLK for internal audio codec is expected to be at 9.6MHz by default.
This patch adds support to 9.6MHz to make the default case possible.
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 820f7541
...@@ -34,13 +34,16 @@ struct apq8016_sbc_data { ...@@ -34,13 +34,16 @@ 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 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)
{ {
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_codec *codec;
struct snd_soc_dai_link *dai_link = rtd->dai_link;
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 rval = 0; int i, rval;
switch (cpu_dai->id) { switch (cpu_dai->id) {
case MI2S_PRIMARY: case MI2S_PRIMARY:
...@@ -63,12 +66,24 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd) ...@@ -63,12 +66,24 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
default: default:
dev_err(card->dev, "unsupported cpu dai configuration\n"); dev_err(card->dev, "unsupported cpu dai configuration\n");
rval = -EINVAL; return -EINVAL;
break;
}
for (i = 0 ; i < dai_link->num_codecs; i++) {
struct snd_soc_dai *dai = rtd->codec_dais[i];
codec = dai->codec;
/* Set default mclk for internal codec */
rval = snd_soc_codec_set_sysclk(codec, 0, 0, DEFAULT_MCLK_RATE,
SND_SOC_CLOCK_IN);
if (rval != 0 && rval != -ENOTSUPP) {
dev_warn(card->dev, "Failed to set mclk: %d\n", rval);
return rval;
}
} }
return rval; return 0;
} }
static struct apq8016_sbc_data *apq8016_sbc_parse_of(struct snd_soc_card *card) static struct apq8016_sbc_data *apq8016_sbc_parse_of(struct snd_soc_card *card)
......
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