mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
ASoC: mediatek: mt8195: add sof be ops to check audio active
In MT8195 SOF design, both DSP and audio driver would access audio registers. Before DSP accesses audio registers, audio power and clock should be enabled. DSP will hang up if DSP access audio register but audio power and clock are disabled. Therefore, we add audio pm runtime active checking before accessing audio registers in SOF BE's callback hw_params function to avoid this situation. Signed-off-by: YC Hung <yc.hung@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Acked-by: Curtis Malainey <cujomalainey@chromium.org> Link: https://lore.kernel.org/r/20221209031053.8444-1-yc.hung@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
e85b1f5a97
commit
83f1b7f39a
|
|
@ -633,6 +633,32 @@ static const struct snd_soc_ops mt8195_rt1011_etdm_ops = {
|
|||
.hw_params = mt8195_rt1011_etdm_hw_params,
|
||||
};
|
||||
|
||||
static int mt8195_sof_be_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct snd_soc_component *cmpnt_afe = NULL;
|
||||
struct snd_soc_pcm_runtime *runtime;
|
||||
|
||||
/* find afe component */
|
||||
for_each_card_rtds(rtd->card, runtime) {
|
||||
cmpnt_afe = snd_soc_rtdcom_lookup(runtime, AFE_PCM_NAME);
|
||||
if (cmpnt_afe)
|
||||
break;
|
||||
}
|
||||
|
||||
if (cmpnt_afe && !pm_runtime_active(cmpnt_afe->dev)) {
|
||||
dev_err(rtd->dev, "afe pm runtime is not active!!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_ops mt8195_sof_be_ops = {
|
||||
.hw_params = mt8195_sof_be_hw_params,
|
||||
};
|
||||
|
||||
static int mt8195_rt1011_init(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct snd_soc_card *card = rtd->card;
|
||||
|
|
@ -1272,24 +1298,28 @@ static struct snd_soc_dai_link mt8195_mt6359_dai_links[] = {
|
|||
.name = "AFE_SOF_DL2",
|
||||
.no_pcm = 1,
|
||||
.dpcm_playback = 1,
|
||||
.ops = &mt8195_sof_be_ops,
|
||||
SND_SOC_DAILINK_REG(AFE_SOF_DL2),
|
||||
},
|
||||
[DAI_LINK_SOF_DL3_BE] = {
|
||||
.name = "AFE_SOF_DL3",
|
||||
.no_pcm = 1,
|
||||
.dpcm_playback = 1,
|
||||
.ops = &mt8195_sof_be_ops,
|
||||
SND_SOC_DAILINK_REG(AFE_SOF_DL3),
|
||||
},
|
||||
[DAI_LINK_SOF_UL4_BE] = {
|
||||
.name = "AFE_SOF_UL4",
|
||||
.no_pcm = 1,
|
||||
.dpcm_capture = 1,
|
||||
.ops = &mt8195_sof_be_ops,
|
||||
SND_SOC_DAILINK_REG(AFE_SOF_UL4),
|
||||
},
|
||||
[DAI_LINK_SOF_UL5_BE] = {
|
||||
.name = "AFE_SOF_UL5",
|
||||
.no_pcm = 1,
|
||||
.dpcm_capture = 1,
|
||||
.ops = &mt8195_sof_be_ops,
|
||||
SND_SOC_DAILINK_REG(AFE_SOF_UL5),
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user