[Intel-gfx] [PATCH] SDVO: Fix for HDMI encode and audio setup
Zhenyu Wang
zhenyu.z.wang at intel.com
Thu Feb 5 03:17:43 CET 2009
SDVO HDMI encode and audio is not setup in detect,
which fails in hotplug case for HDMI audio. Fix to
check current encode type and set flag for HDMI audio
enabling.
---
src/i830_sdvo.c | 64 ++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 42 insertions(+), 22 deletions(-)
diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index 6f073d3..7d6befd 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -786,6 +786,22 @@ i830_sdvo_get_supp_encode(xf86OutputPtr output, struct i830_sdvo_encode *encode)
}
static Bool
+i830_sdvo_get_digital_encoding_mode(xf86OutputPtr output)
+{
+ I830OutputPrivatePtr intel_output = output->driver_private;
+ struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
+ uint8_t status;
+
+ i830_sdvo_set_target_output(output, dev_priv->controlled_output);
+
+ i830_sdvo_write_cmd(output, SDVO_CMD_GET_ENCODE, NULL, 0);
+ status = i830_sdvo_read_response(output, &dev_priv->is_hdmi, 1);
+ if (status != SDVO_CMD_STATUS_SUCCESS)
+ return FALSE;
+ return TRUE;
+}
+
+static Bool
i830_sdvo_set_encode(xf86OutputPtr output, uint8_t mode)
{
uint8_t status;
@@ -1448,6 +1464,27 @@ i830_sdvo_dump(ScrnInfoPtr pScrn)
}
/**
+ * Determine if current TMDS encoding is HDMI.
+ * Return TRUE if found HDMI encoding is used, otherwise return FALSE.
+ */
+static Bool
+i830_sdvo_check_hdmi_encode (xf86OutputPtr output)
+{
+ I830OutputPrivatePtr intel_output = output->driver_private;
+ struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
+
+ if (i830_sdvo_get_supp_encode(output, &dev_priv->encode) &&
+ i830_sdvo_get_digital_encoding_mode(output) &&
+ dev_priv->is_hdmi) {
+ /* enable hdmi encoding mode if supported */
+ i830_sdvo_set_encode(output, SDVO_ENCODE_HDMI);
+ i830_sdvo_set_colorimetry(output, SDVO_COLORIMETRY_RGB256);
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+/**
* Asks the SDVO device if any displays are currently connected.
*
* This interface will need to be augmented, since we could potentially have
@@ -1484,6 +1521,10 @@ i830_sdvo_detect(xf86OutputPtr output)
return XF86OutputStatusDisconnected;
}
xfree(edid_mon);
+
+ /* Check if HDMI encode, setup it and set the flag for HDMI audio */
+ if (!i830_sdvo_check_hdmi_encode(output))
+ dev_priv->is_hdmi = FALSE;
}
return XF86OutputStatusConnected;
}
@@ -1748,21 +1789,6 @@ i830_sdvo_select_ddc_bus(struct i830_sdvo_priv *dev_priv)
dev_priv->ddc_bus = 1 << num_bits;
}
-static Bool
-i830_sdvo_get_digital_encoding_mode(xf86OutputPtr output)
-{
- I830OutputPrivatePtr intel_output = output->driver_private;
- struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
- uint8_t status;
-
- i830_sdvo_set_target_output(output, dev_priv->controlled_output);
-
- i830_sdvo_write_cmd(output, SDVO_CMD_GET_ENCODE, NULL, 0);
- status = i830_sdvo_read_response(output, &dev_priv->is_hdmi, 1);
- if (status != SDVO_CMD_STATUS_SUCCESS)
- return FALSE;
- return TRUE;
-}
Bool
i830_sdvo_init(ScrnInfoPtr pScrn, int output_device)
@@ -1891,14 +1917,8 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device)
output->subpixel_order = SubPixelHorizontalRGB;
name_prefix="TMDS";
- if (i830_sdvo_get_supp_encode(output, &dev_priv->encode) &&
- i830_sdvo_get_digital_encoding_mode(output) &&
- dev_priv->is_hdmi) {
- /* enable hdmi encoding mode if supported */
- i830_sdvo_set_encode(output, SDVO_ENCODE_HDMI);
- i830_sdvo_set_colorimetry(output, SDVO_COLORIMETRY_RGB256);
+ if (i830_sdvo_check_hdmi_encode (output))
name_prefix = "HDMI";
- }
}
else if (dev_priv->caps.output_flags & SDVO_OUTPUT_SVID0)
{
--
1.5.6.5
More information about the Intel-gfx
mailing list