[Intel-gfx] [PATCH 14/17] drm/i915: Use hotplug callback to retrain DP link
Keith Packard
keithp at keithp.com
Sun May 31 05:42:38 CEST 2009
The display port link must be re-trained when
a monitor is plugged in.
---
drivers/gpu/drm/i915/intel_dp.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index ed3c7de..56b0119 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -538,6 +538,7 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode)
struct drm_i915_private *dev_priv = dev->dev_private;
uint32_t dp_reg = I915_READ(dp_priv->output_reg);
+ printk(KERN_ERR "DP dpms mode %d\n", mode);
if (mode != DRM_MODE_DPMS_ON) {
if (dp_reg & DP_PORT_EN)
intel_dp_link_down(intel_output, dp_priv->DP);
@@ -776,6 +777,7 @@ intel_dp_set_link_train(struct intel_output *intel_output,
struct intel_dp_priv *dp_priv = intel_output->dev_priv;
int ret;
+ printk(KERN_ERR "DP link train\n");
I915_WRITE(dp_priv->output_reg, dp_reg_value);
POSTING_READ(dp_priv->output_reg);
if (first)
@@ -904,6 +906,7 @@ intel_dp_link_down(struct intel_output *intel_output, uint32_t DP)
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_dp_priv *dp_priv = intel_output->dev_priv;
+ printk(KERN_ERR "DP link down\n");
I915_WRITE(dp_priv->output_reg, DP & ~DP_PORT_EN);
POSTING_READ(dp_priv->output_reg);
}
@@ -920,7 +923,6 @@ intel_dp_restore(struct drm_connector *connector)
intel_dp_link_down(intel_output, dp_priv->save_DP);
}
-#if 0
/*
* According to DP spec
* 5.1.2:
@@ -940,14 +942,16 @@ intel_dp_check_link_status(struct intel_output *intel_output)
return;
if (!intel_dp_get_link_status(intel_output, link_status)) {
+ printk(KERN_ERR "DP link down, disabling DP output\n");
intel_dp_link_down(intel_output, dp_priv->DP);
return;
}
- if (!intel_channel_eq_ok(link_status, dp_priv->lane_count))
+ if (!intel_channel_eq_ok(link_status, dp_priv->lane_count)) {
+ printk(KERN_ERR "DP link up, but link not stable. Training\n");
intel_dp_link_train(intel_output, dp_priv->DP, dp_priv->link_configuration);
+ }
}
-#endif
/**
* Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect DP connection.
@@ -1061,6 +1065,16 @@ static const struct drm_encoder_funcs intel_dp_enc_funcs = {
};
void
+intel_dp_hot_plug(struct intel_output *intel_output)
+{
+ struct intel_dp_priv *dp_priv = intel_output->dev_priv;
+
+ printk(KERN_ERR "intel_dp_hotplug\n");
+ if (dp_priv->dpms_mode == DRM_MODE_DPMS_ON)
+ intel_dp_check_link_status(intel_output);
+}
+
+void
intel_dp_init(struct drm_device *dev, int output_reg)
{
struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1103,6 +1117,7 @@ intel_dp_init(struct drm_device *dev, int output_reg)
(output_reg == DP_B) ? "DPDDC-B" :
(output_reg == DP_C) ? "DPDDC-C" : "DPDDC-D");
intel_output->ddc_bus = &dp_priv->adapter;
+ intel_output->hot_plug = intel_dp_hot_plug;
/* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
* 0xd. Failure to do so will result in spurious interrupts being
--
1.6.3.1
More information about the Intel-gfx
mailing list