diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h index 449a122..0608667 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi.h +++ b/drivers/video/fbdev/omap2/dss/hdmi.h @@ -332,6 +332,8 @@ struct omap_hdmi { void (*audio_abort_cb)(struct device *dev); int wp_idlemode; + bool audio_playing; + struct omap_dss_audio audio_config; }; #endif diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c index 45925d1..8101b82 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi4.c +++ b/drivers/video/fbdev/omap2/dss/hdmi4.c @@ -381,6 +381,18 @@ static int hdmi_display_enable(struct omap_dss_device *dssdev) hdmi.display_enabled = true; + if (hdmi.audio_abort_cb && hdmi.audio_playing) { + hdmi4_audio_stop(&hdmi.core, &hdmi.wp); + r = hdmi4_audio_config(&hdmi.core, &hdmi.wp, &hdmi.audio_config, + hdmi.cfg.timings.pixelclock); + if (!r) + r = hdmi4_audio_start(&hdmi.core, &hdmi.wp); + if (r) { + DSSERR("Error restoring audio stream"); + hdmi.audio_abort_cb(&hdmi.pdev->dev); + } + } + mutex_unlock(&hdmi.lock); return 0; @@ -608,8 +620,10 @@ static int audio_enable(struct device *dev, bool enable) ret = hdmi_wp_audio_enable(&hd->wp, enable); - if (!enable) + if (!enable) { hd->audio_abort_cb = NULL; + hd->audio_playing = false; + } mutex_unlock(&hd->lock); @@ -625,6 +639,8 @@ static int audio_start(struct device *dev, bool enable) ret = hdmi4_audio_start(&hd->core, &hd->wp); else hdmi4_audio_stop(&hd->core, &hd->wp); + if (!ret) + hd->audio_playing = enable; return ret; } @@ -640,6 +656,8 @@ static int audio_config(struct device *dev, struct omap_dss_audio *dss_audio) else ret = hdmi4_audio_config(&hd->core, &hd->wp, dss_audio, hd->cfg.timings.pixelclock); + if (!ret) + hd->audio_config = *dss_audio; mutex_unlock(&hd->lock); return ret; diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c index 8863ade..3effe32 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi5.c +++ b/drivers/video/fbdev/omap2/dss/hdmi5.c @@ -409,6 +409,18 @@ static int hdmi_display_enable(struct omap_dss_device *dssdev) hdmi.display_enabled = true; + if (hdmi.audio_abort_cb && hdmi.audio_playing) { + hdmi_wp_audio_core_req_enable(&hdmi.wp, false); + r = hdmi5_audio_config(&hdmi.core, &hdmi.wp, &hdmi.audio_config, + hdmi.cfg.timings.pixelclock); + if (!r) + r = hdmi_wp_audio_core_req_enable(&hdmi.wp, true); + if (r) { + DSSERR("Error restoring audio stream"); + hdmi.audio_abort_cb(&hdmi.pdev->dev); + } + } + mutex_unlock(&hdmi.lock); return 0; @@ -649,6 +661,7 @@ static int audio_enable(struct device *dev, bool enable) 3, 2); hd->audio_abort_cb = NULL; + hd->audio_playing = false; } mutex_unlock(&hd->lock); @@ -660,6 +673,8 @@ static int audio_start(struct device *dev, bool enable) { struct omap_hdmi *hd = dev_get_drvdata(dev); + hd->audio_playing = enable; + return hdmi_wp_audio_core_req_enable(&hd->wp, enable); } @@ -674,6 +689,8 @@ static int audio_config(struct device *dev, struct omap_dss_audio *dss_audio) else ret = hdmi5_audio_config(&hd->core, &hd->wp, dss_audio, hd->cfg.timings.pixelclock); + if (!ret) + hd->audio_config = *dss_audio; mutex_unlock(&hd->lock); return ret;