1
0
Fork 0

MLK-23638: ASoC: fsl_dai: Make sure clocks are turned on during probe

During probe SOF driver loads the topology, which will send messages
to DSP to create the Audio components.

SOF DAI component at creation time calls probe() and touches DAI
registers thus we need to make sure DAI clocks are turned on during
probe.

Using pm_runtime_get_sync() we force resume to be called which will
enable all necessary clocks.

Later we call the pm_runtime_put_sync() and mark the device as
autosuspend. This will cause suspend to be called which will disable
all clocks to save power.

Later, when userspace uses the sound card (via aplay/arecord) or any
alsa-lib calls the normal runtime resume/suspend flow will happen.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
5.4-rM2-2.2.x-imx-squashed
Daniel Baluta 2020-05-21 20:11:16 +03:00
parent 1f49d90eba
commit 61031bfa4f
1 changed files with 8 additions and 0 deletions

View File

@ -194,6 +194,10 @@ static int fsl_dai_probe(struct platform_device *pdev)
done_pm:
pm_runtime_enable(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, 3000);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
ret = devm_snd_soc_register_component(&pdev->dev, &fsl_dai_component,
&fsl_dai, 1);
@ -201,6 +205,10 @@ done_pm:
dev_err(&pdev->dev, "Failed to register DAI ret = %d\n", ret);
return ret;
}
pm_runtime_mark_last_busy(&pdev->dev);
pm_runtime_put_autosuspend(&pdev->dev);
return 0;
unroll_pm: