ASoC: SOF: mediatek: add shutdown callback
authorRicardo Ribalda <ribalda@chromium.org>
Sun, 27 Nov 2022 20:04:15 +0000 (21:04 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 30 Nov 2022 11:35:43 +0000 (11:35 +0000)
If we do not shutdown the peripheral properly at shutdown, the whole system
crashes after kexec() on the first io access.

Let's implement the appropriate callback.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20221127-mtk-snd-v1-0-b7886faa612b@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/mediatek/mt8186/mt8186.c

index 181189e..79da257 100644 (file)
@@ -430,6 +430,11 @@ static int mt8186_dsp_remove(struct snd_sof_dev *sdev)
        return 0;
 }
 
+static int mt8186_dsp_shutdown(struct snd_sof_dev *sdev)
+{
+       return snd_sof_suspend(sdev->dev);
+}
+
 static int mt8186_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state)
 {
        mt8186_sof_hifixdsp_shutdown(sdev);
@@ -538,6 +543,7 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = {
        /* probe and remove */
        .probe          = mt8186_dsp_probe,
        .remove         = mt8186_dsp_remove,
+       .shutdown       = mt8186_dsp_shutdown,
 
        /* DSP core boot */
        .run            = mt8186_run,
@@ -629,6 +635,7 @@ MODULE_DEVICE_TABLE(of, sof_of_mt8186_ids);
 static struct platform_driver snd_sof_of_mt8186_driver = {
        .probe = sof_of_probe,
        .remove = sof_of_remove,
+       .shutdown = sof_of_shutdown,
        .driver = {
        .name = "sof-audio-of-mt8186",
                .pm = &sof_of_pm,