Skip to content

Commit

Permalink
drm/i915: sync hdmi detection by hdmi identifier with 2D
Browse files Browse the repository at this point in the history
Currently we detect HDMI monitor by hardware detection, but if an HDMI-DVI
adapter is used to connect a DVI monitor, hardware detection will incorrectly
take monitor as HDMI. HDMI spec says 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 that rule.

Signed-off-by: Ma Ling <ling.ma@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
  • Loading branch information
Ma Ling authored and Eric Anholt committed Apr 8, 2009
1 parent 6115707 commit 9dff6af
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
23 changes: 20 additions & 3 deletions drivers/gpu/drm/i915/intel_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}

Expand Down
22 changes: 20 additions & 2 deletions drivers/gpu/drm/i915/intel_sdvo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,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];
Expand All @@ -1371,9 +1388,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;
}

Expand Down

0 comments on commit 9dff6af

Please sign in to comment.