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: Brent Lu <brent.lu@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/1571994691-20199-1-git-send-email-brent.lu@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Brent Lu 2019-10-25 17:11:31 +08:00 committed by Mark Brown
parent 24d05966b5
commit 15747a8020
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 50 additions and 0 deletions

View File

@ -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,