sound: pci: fix hdmi power usage count
Mohan Kumar [Wed, 6 Nov 2013 09:15:18 +0000 (14:15 +0530)]
after resume from LP0, tegra-hda refcount showing negative values
in PM domains, call power down during suspend if it's on inorder to
maintain the resume/suspend state in sync.

Bug 1399964
Bug 1407992
Bug 1392965
Bug 1407018

Change-Id: I675e8c4fe3edaf3ff4c15aec9f2e3872b9e39164
Reviewed-on: http://git-master/r/327039
Tested-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Reviewed-by: Scott Peterson <speterson@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>

sound/pci/hda/hda_codec.c
sound/pci/hda/hda_intel.c

index 56a2707..a3d3f0f 100644 (file)
@@ -5566,11 +5566,18 @@ EXPORT_SYMBOL_HDA(snd_hda_add_imux_item);
 int snd_hda_suspend(struct hda_bus *bus)
 {
        struct hda_codec *codec;
+       unsigned int state;
 
        list_for_each_entry(codec, &bus->codec_list, list) {
                cancel_delayed_work_sync(&codec->jackpoll_work);
-               if (hda_codec_is_power_on(codec))
-                       hda_call_codec_suspend(codec, false);
+               if (hda_codec_is_power_on(codec)) {
+                       state = hda_call_codec_suspend(codec, false);
+                       codec->pm_down_notified = 0;
+                       if (!bus->power_keep_link_on && (state & AC_PWRST_CLK_STOP_OK)) {
+                               codec->pm_down_notified = 1;
+                               hda_call_pm_notify(bus, false);
+                       }
+               }
        }
        return 0;
 }
index 5ebac87..ea5112f 100644 (file)
@@ -3252,11 +3252,6 @@ static int azx_resume(struct device *dev)
        snd_hda_resume(chip->bus);
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
 
-#ifdef CONFIG_SND_HDA_PLATFORM_DRIVER
-       if (chip->pdev)
-               pm_runtime_put(chip->dev);
-#endif
-
        return 0;
 }
 #endif /* CONFIG_PM_SLEEP || SUPPORT_VGA_SWITCHEROO */