From 9741ad037ae64dc57507396c4588829874394104 Mon Sep 17 00:00:00 2001 From: Sanjay Rama Reddy Date: Tue, 14 Feb 2012 14:06:50 -0800 Subject: [PATCH] Enable HDMI Audio callbacks from HDMI driver. HDMI audio driver needs to register itself with the HDMI display driver in order to be notified of HDMI events. This patch will register the audio driver during boot-up and callback HDMI audio driver functions when an event like PLUG/UNPLUG occurs. Signed-off-by: Arun Kannan Signed-off-by: Kirill A. Shutemov --- drivers/staging/mrst/drv/mdfld_hdmi_audio.c | 16 +++++++++++++--- drivers/staging/mrst/drv/psb_intel_hdmi.c | 7 +++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/staging/mrst/drv/mdfld_hdmi_audio.c b/drivers/staging/mrst/drv/mdfld_hdmi_audio.c index 0b2351e..c75a85b 100644 --- a/drivers/staging/mrst/drv/mdfld_hdmi_audio.c +++ b/drivers/staging/mrst/drv/mdfld_hdmi_audio.c @@ -25,7 +25,7 @@ #include "psb_intel_hdmi_edid.h" #include "psb_intel_hdmi.h" #include "mdfld_hdmi_audio_if.h" - +#include /* * Audio register range 0x69000 to 0x69117 @@ -227,10 +227,20 @@ int intel_hdmi_audio_query_capabilities (had_event_call_back audio_callbacks, st int display_register(struct snd_intel_had_interface *driver, void * had_data) { - struct drm_device *dev = hdmi_priv->dev; - struct drm_psb_private *dev_priv = (struct drm_psb_private *) dev->dev_private; + struct drm_device *dev = hdmi_priv->dev; + struct drm_psb_private *dev_priv = dev->dev_private; + u8 data = 0; dev_priv->had_pvt_data = had_data; dev_priv->had_interface = driver; + + /* The Audio driver is loading now and we need to notify + * it if there is an HDMI device attached */ + intel_scu_ipc_ioread8(MSIC_HDMI_STATUS, &data); + if (data & HPD_SIGNAL_STATUS) { + if (dev_priv->mdfld_had_event_callbacks) + (*dev_priv->mdfld_had_event_callbacks) + (HAD_EVENT_HOT_PLUG, dev_priv->had_pvt_data); + } return 0; } diff --git a/drivers/staging/mrst/drv/psb_intel_hdmi.c b/drivers/staging/mrst/drv/psb_intel_hdmi.c index f31cfea..02912ca 100644 --- a/drivers/staging/mrst/drv/psb_intel_hdmi.c +++ b/drivers/staging/mrst/drv/psb_intel_hdmi.c @@ -297,6 +297,7 @@ static bool mdfld_hdmi_mode_fixup(struct drm_encoder *encoder, static void mdfld_hdmi_dpms(struct drm_encoder *encoder, int mode) { struct drm_device *dev = encoder->dev; + struct drm_psb_private *dev_priv = dev->dev_private; struct psb_intel_output *output = enc_to_psb_intel_output(encoder); struct android_hdmi_priv *hdmi_priv = output->dev_priv; u32 hdmib, hdmi_phy_misc; @@ -313,11 +314,17 @@ static void mdfld_hdmi_dpms(struct drm_encoder *encoder, int mode) hdmi_phy_misc = REG_READ(HDMIPHYMISCCTL); if (mode != DRM_MODE_DPMS_ON) { + if (dev_priv->mdfld_had_event_callbacks) + (*dev_priv->mdfld_had_event_callbacks) + (HAD_EVENT_HOT_UNPLUG, dev_priv->had_pvt_data); REG_WRITE(hdmi_priv->hdmib_reg, hdmib & ~HDMIB_PORT_EN); REG_WRITE(HDMIPHYMISCCTL, hdmi_phy_misc | HDMI_PHY_POWER_DOWN); } else { REG_WRITE(HDMIPHYMISCCTL, hdmi_phy_misc & ~HDMI_PHY_POWER_DOWN); REG_WRITE(hdmi_priv->hdmib_reg, hdmib | HDMIB_PORT_EN); + if (dev_priv->mdfld_had_event_callbacks) + (*dev_priv->mdfld_had_event_callbacks) + (HAD_EVENT_HOT_PLUG, dev_priv->had_pvt_data); } REG_READ(hdmi_priv->hdmib_reg); -- 2.7.4