From 9189bb6b72a680a4748cccd2d06470aad7b25825 Mon Sep 17 00:00:00 2001 From: Sameer Pujar Date: Fri, 16 Feb 2018 09:54:27 +0530 Subject: [PATCH] ASoC: Machine: ignore suspend for dai-links This patch is being added for Android to avoid high suspend latency resulting from commit bedf87fbcd537a5cc7b5d972c34a92cce9414f93. For android, system cannot go to suspend when audio playback is running. Thus issue mentioned in above commit is not applicable to Android. CONFIG_ANDROID is used to selectively ignore suspend. Bug 2061442 Change-Id: Id536920cb857e6d7a614d2a742012e17eac5f14f Signed-off-by: Sameer Pujar Reviewed-on: https://git-master.nvidia.com/r/1659720 GVS: Gerrit_Virtual_Submit Reviewed-by: Mohan Kumar D Reviewed-by: Ravindra Lokhande Reviewed-by: mobile promotions Tested-by: mobile promotions --- .../tegra_machine_driver_mobile.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c index e60e7aa0..cf4032f2 100644 --- a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c +++ b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c @@ -105,6 +105,7 @@ struct tegra_machine_soc_data { static int tegra_machine_driver_remove(struct platform_device *); static int tegra_machine_driver_probe(struct platform_device *); static void dai_link_setup(struct platform_device *); +static void ignore_suspend(struct snd_soc_card *); static int tegra_machine_sfc_init(struct snd_soc_pcm_runtime *); static int tegra_machine_ext_codec_init(struct snd_soc_pcm_runtime *); @@ -1215,6 +1216,24 @@ static const struct of_device_id tegra_machine_of_match[] = { {}, }; +static void __maybe_unused ignore_suspend(struct snd_soc_card *card) +{ + struct snd_soc_pcm_runtime *rtd; +#if KERNEL_VERSION(4, 5, 0) > LINUX_VERSION_CODE + struct tegra_machine *machine = snd_soc_card_get_drvdata(card); + int idx; + int num_of_dai_links = machine->soc_data->num_xbar_dai_links + + machine->num_codec_links; + + for (idx = 0; idx < num_of_dai_links; idx++) { + rtd = &card->rtd[idx]; +#else + list_for_each_entry(rtd, &card->rtd_list, list) { +#endif + rtd->dai_link->ignore_suspend = true; + } +} + static int tegra_machine_driver_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -1344,6 +1363,10 @@ static int tegra_machine_driver_probe(struct platform_device *pdev) goto err_switch_unregister; } +#ifdef CONFIG_ANDROID + ignore_suspend(card); +#endif + rtd = tegra_machine_get_codec_link(card); if (!rtd) dev_warn(&pdev->dev,