ASoC: tegra-alt: Add LP0 support for T124 audio
Arun Shamanna Lakshmi [Wed, 10 Sep 2014 03:56:01 +0000 (20:56 -0700)]
Initialize the DAPM dai link work struct for non-pcm dai-links
to avoid kernel crash during powercycle in low power mode.

Bug 200034484

Change-Id: Ibc9ab248e3c980d504dfd17e0e971e03e10e40ba
Signed-off-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
Reviewed-on: http://git-master/r/497196
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Rajesh Hosakote <rhosakote@nvidia.com>
Reviewed-by: Justin Kim (SW-TEGRA) <juskim@nvidia.com>

sound/soc/tegra-alt/tegra_vcm30t124_alt.c

index 3a3783c..af040f7 100644 (file)
@@ -984,6 +984,18 @@ static void tegra_vcm30t124_free_codec_conf(void)
        tegra_vcm30t124_codec_conf = NULL;
 }
 
+static int tegra_vcm30t124_suspend_pre(struct snd_soc_card *card)
+{
+       unsigned int idx;
+
+       /* DAPM dai link stream work for non pcm links */
+       for (idx = 0; idx < card->num_rtd; idx++) {
+               if (card->rtd[idx].dai_link->params)
+                       INIT_DELAYED_WORK(&card->rtd[idx].delayed_work, NULL);
+       }
+       return 0;
+}
+
 static const int tegra_vcm30t124_srate_values[] = {
        0,
        8000,
@@ -1130,6 +1142,7 @@ static struct snd_soc_card snd_soc_tegra_vcm30t124 = {
        .name = "tegra-generic",
        .owner = THIS_MODULE,
        .remove = tegra_vcm30t124_remove,
+       .suspend_pre = tegra_vcm30t124_suspend_pre,
        .dapm_widgets = tegra_vcm30t124_dapm_widgets,
        .num_dapm_widgets = ARRAY_SIZE(tegra_vcm30t124_dapm_widgets),
        .controls = tegra_vcm30t124_controls,