GFX-display: Audio can't play on hdmi after suspend phone
authorGeng Xiujun <xiujun.geng@intel.com>
Wed, 18 Jan 2012 07:16:42 +0000 (15:16 +0800)
committerbuildbot <buildbot@intel.com>
Thu, 2 Feb 2012 13:27:36 +0000 (05:27 -0800)
BZ: 18580

In this scenario, runtime_idle returns busy, so runtime_suspend should
not be called by runtime pm core. This is the way in GB. But in ics,
runtime_suspend is called, it will disable hdmi plane, while audio sends
data to it.

This patch add some code in runtime_suspend to detect whether audio is busy.

Change-Id: I5b1b20943e2344d15a5800091e7f3e1137e6667b
Signed-off-by: Geng Xiujun <xiujun.geng@intel.com>
Reviewed-on: http://android.intel.com:8080/32311
Reviewed-by: Tong, BoX <box.tong@intel.com>
Tested-by: Tong, BoX <box.tong@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/staging/mrst/drv/psb_powermgmt.c

index 22a3061..184f57b 100644 (file)
@@ -2402,12 +2402,36 @@ int psb_runtime_suspend(struct device *dev)
        int ret = 0;
        state.event = 0;
 
+#ifdef CONFIG_SND_INTELMID_HDMI_AUDIO
+        struct drm_psb_private* dev_priv = gpDrmDevice->dev_private;
+        int hdmi_audio_busy = 0;
+        struct snd_intel_had_interface *had_interface = dev_priv->had_interface;
+        pm_event_t hdmi_audio_event;
+        char *uevent_string = NULL;
+
+        if (dev_priv->had_pvt_data && hdmi_state) {
+                hdmi_audio_event.event = 0;
+                hdmi_audio_busy =
+                        had_interface->suspend(dev_priv->had_pvt_data,
+                                        hdmi_audio_event);
+
+                if (!hdmi_audio_busy) {
+                        uevent_string = "HDMI_AUDIO_PM_SUSPENDED=1";
+                        psb_sysfs_uevent(dev_priv->dev, uevent_string);
+                }
+        }
+#endif
+
 #ifdef OSPM_GFX_DPK
        printk(KERN_ALERT "%s\n", __func__);
 #endif
         if (atomic_read(&g_graphics_access_count) || atomic_read(&g_videoenc_access_count)
                || (gbdispstatus == true)
-               || atomic_read(&g_videodec_access_count) || atomic_read(&g_display_access_count)){
+               || atomic_read(&g_videodec_access_count) || atomic_read(&g_display_access_count)
+#ifdef CONFIG_SND_INTELMID_HDMI_AUDIO
+                || hdmi_audio_busy
+#endif
+           ) {
 #ifdef OSPM_GFX_DPK
                printk(KERN_ALERT "GFX:%d VEC:%d VED:%d DC:%d DSR:%d\n",
                        atomic_read(&g_graphics_access_count),