[Intel-gfx] [PATCH] drm/i915: sync hdmi detection by hdmi identifier with 2D
Ma Ling
ling.ma at intel.com
Tue Apr 7 05:45:18 CEST 2009
Any comments ?
Thanks
Ma Ling
On Thu, 2009-04-02 at 13:16 +0800, Ma Ling wrote:
> Currently we detect HDMI monitor by hardware detection, but if user utilize HDMI-DVI adapter
> to connect DVI monitor, hardware detection will incorrectly take monitor as HDMI. HDMI spec
> say any device containing IEEE registration identifier will be treated as HDMI device.
> The patch intends to detect HDMI monitor by drm_detect_hdmi_monitor function which follows
> above rule.
>
> Signed-off-by: Ma Ling <ling.ma at intel.com>
> ---
> drivers/gpu/drm/i915/intel_hdmi.c | 23 ++++++++++++++++++++---
> drivers/gpu/drm/i915/intel_sdvo.c | 22 ++++++++++++++++++++--
> 2 files changed, 40 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index b06a4a3..5503742 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -38,7 +38,7 @@
> struct intel_hdmi_priv {
> u32 sdvox_reg;
> u32 save_SDVOX;
> - int has_hdmi_sink;
> + bool has_hdmi_sink;
> };
>
> static void intel_hdmi_mode_set(struct drm_encoder *encoder,
> @@ -128,6 +128,22 @@ static bool intel_hdmi_mode_fixup(struct drm_encoder *encoder,
> return true;
> }
>
> +static void
> +intel_hdmi_sink_detect(struct drm_connector *connector)
> +{
> + struct intel_output *intel_output = to_intel_output(connector);
> + struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv;
> + struct edid *edid = NULL;
> +
> + edid = drm_get_edid(&intel_output->base,
> + &intel_output->ddc_bus->adapter);
> + if (edid != NULL) {
> + hdmi_priv->has_hdmi_sink = drm_detect_hdmi_monitor(edid);
> + kfree(edid);
> + intel_output->base.display_info.raw_edid = NULL;
> + }
> +}
> +
> static enum drm_connector_status
> intel_hdmi_detect(struct drm_connector *connector)
> {
> @@ -158,9 +174,10 @@ intel_hdmi_detect(struct drm_connector *connector)
> return connector_status_unknown;
> }
>
> - if ((I915_READ(PORT_HOTPLUG_STAT) & bit) != 0)
> + if ((I915_READ(PORT_HOTPLUG_STAT) & bit) != 0) {
> + intel_hdmi_sink_detect(connector);
> return connector_status_connected;
> - else
> + } else
> return connector_status_disconnected;
> }
>
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index fbe6f39..01d1173 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -1335,6 +1335,23 @@ void intel_sdvo_set_hotplug(struct drm_connector *connector, int on)
> intel_sdvo_read_response(intel_output, &response, 2);
> }
>
> +static void
> +intel_sdvo_hdmi_sink_detect(struct drm_connector *connector)
> +{
> + struct intel_output *intel_output = to_intel_output(connector);
> + struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
> + struct edid *edid = NULL;
> +
> + intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus);
> + edid = drm_get_edid(&intel_output->base,
> + &intel_output->ddc_bus->adapter);
> + if (edid != NULL) {
> + sdvo_priv->is_hdmi = drm_detect_hdmi_monitor(edid);
> + kfree(edid);
> + intel_output->base.display_info.raw_edid = NULL;
> + }
> +}
> +
> static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connector)
> {
> u8 response[2];
> @@ -1349,9 +1366,10 @@ static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connect
> if (status != SDVO_CMD_STATUS_SUCCESS)
> return connector_status_unknown;
>
> - if ((response[0] != 0) || (response[1] != 0))
> + if ((response[0] != 0) || (response[1] != 0)) {
> + intel_sdvo_hdmi_sink_detect(connector);
> return connector_status_connected;
> - else
> + } else
> return connector_status_disconnected;
> }
>
More information about the Intel-gfx
mailing list