Commit 15747a80 authored by Brent Lu's avatar Brent Lu Committed by Mark Brown

ASoC: eve: implement set_bias_level function for rt5514

The first DMIC capture always fail (zero sequence data from PCM port)
after using DSP hotwording function (i.e. Google assistant).

This rt5514 codec requires to control mclk directly in the set_bias_level
function. Implement this function in machine driver to control the
ssp1_mclk clock explicitly could fix this issue.
Signed-off-by: default avatarBrent Lu <brent.lu@intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/1571994691-20199-1-git-send-email-brent.lu@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 24d05966
......@@ -653,6 +653,55 @@ static struct snd_soc_dai_link kabylake_dais[] = {
},
};
static int kabylake_set_bias_level(struct snd_soc_card *card,
struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level)
{
struct snd_soc_component *component = dapm->component;
struct kbl_codec_private *priv = snd_soc_card_get_drvdata(card);
int ret = 0;
if (!component || strcmp(component->name, RT5514_DEV_NAME))
return 0;
if (IS_ERR(priv->mclk))
return 0;
/*
* It's required to control mclk directly in the set_bias_level
* function for rt5514 codec or the recording function could
* break.
*/
switch (level) {
case SND_SOC_BIAS_PREPARE:
if (dapm->bias_level == SND_SOC_BIAS_ON) {
dev_dbg(card->dev, "Disable mclk");
clk_disable_unprepare(priv->mclk);
} else {
dev_dbg(card->dev, "Enable mclk");
ret = clk_set_rate(priv->mclk, 24000000);
if (ret) {
dev_err(card->dev, "Can't set rate for mclk, err: %d\n",
ret);
return ret;
}
ret = clk_prepare_enable(priv->mclk);
if (ret) {
dev_err(card->dev, "Can't enable mclk, err: %d\n",
ret);
/* mclk is already enabled in FW */
ret = 0;
}
}
break;
default:
break;
}
return ret;
}
static int kabylake_card_late_probe(struct snd_soc_card *card)
{
struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(card);
......@@ -692,6 +741,7 @@ static struct snd_soc_card kabylake_audio_card = {
.owner = THIS_MODULE,
.dai_link = kabylake_dais,
.num_links = ARRAY_SIZE(kabylake_dais),
.set_bias_level = kabylake_set_bias_level,
.controls = kabylake_controls,
.num_controls = ARRAY_SIZE(kabylake_controls),
.dapm_widgets = kabylake_widgets,
......
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