aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_dp.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-09-09 11:20:55 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-09 12:00:43 -0400
commitdf0e924883d029a8651a2a0c7b8da67a07611ed2 (patch)
tree7482d6c4942c709f2c6812f397c3239326ade3b8 /drivers/gpu/drm/i915/intel_dp.c
parentf875c15a4fbf37534dda30771d8bde8604fbbf09 (diff)
drm/i915: Make the connector->encoder relationship explicit
Currently we have a exact mapping of a connector onto an encoder for its whole lifetime. Make this an explicit property of the structure and so simplify the code. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_dp.c')
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 6cdc53de24ac..b9efeaf5d5b4 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -67,6 +67,12 @@ static struct intel_dp *enc_to_intel_dp(struct drm_encoder *encoder)
67 return container_of(encoder, struct intel_dp, base.base); 67 return container_of(encoder, struct intel_dp, base.base);
68} 68}
69 69
70static struct intel_dp *intel_attached_dp(struct drm_connector *connector)
71{
72 return container_of(intel_attached_encoder(connector),
73 struct intel_dp, base);
74}
75
70static void intel_dp_start_link_train(struct intel_dp *intel_dp); 76static void intel_dp_start_link_train(struct intel_dp *intel_dp);
71static void intel_dp_complete_link_train(struct intel_dp *intel_dp); 77static void intel_dp_complete_link_train(struct intel_dp *intel_dp);
72static void intel_dp_link_down(struct intel_dp *intel_dp); 78static void intel_dp_link_down(struct intel_dp *intel_dp);
@@ -148,8 +154,7 @@ static int
148intel_dp_mode_valid(struct drm_connector *connector, 154intel_dp_mode_valid(struct drm_connector *connector,
149 struct drm_display_mode *mode) 155 struct drm_display_mode *mode)
150{ 156{
151 struct drm_encoder *encoder = intel_attached_encoder(connector); 157 struct intel_dp *intel_dp = intel_attached_dp(connector);
152 struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
153 struct drm_device *dev = connector->dev; 158 struct drm_device *dev = connector->dev;
154 struct drm_i915_private *dev_priv = dev->dev_private; 159 struct drm_i915_private *dev_priv = dev->dev_private;
155 int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); 160 int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp));
@@ -1405,8 +1410,7 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
1405static enum drm_connector_status 1410static enum drm_connector_status
1406ironlake_dp_detect(struct drm_connector *connector) 1411ironlake_dp_detect(struct drm_connector *connector)
1407{ 1412{
1408 struct drm_encoder *encoder = intel_attached_encoder(connector); 1413 struct intel_dp *intel_dp = intel_attached_dp(connector);
1409 struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
1410 enum drm_connector_status status; 1414 enum drm_connector_status status;
1411 1415
1412 /* Panel needs power for AUX to work */ 1416 /* Panel needs power for AUX to work */
@@ -1436,8 +1440,7 @@ ironlake_dp_detect(struct drm_connector *connector)
1436static enum drm_connector_status 1440static enum drm_connector_status
1437intel_dp_detect(struct drm_connector *connector) 1441intel_dp_detect(struct drm_connector *connector)
1438{ 1442{
1439 struct drm_encoder *encoder = intel_attached_encoder(connector); 1443 struct intel_dp *intel_dp = intel_attached_dp(connector);
1440 struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
1441 struct drm_device *dev = intel_dp->base.base.dev; 1444 struct drm_device *dev = intel_dp->base.base.dev;
1442 struct drm_i915_private *dev_priv = dev->dev_private; 1445 struct drm_i915_private *dev_priv = dev->dev_private;
1443 uint32_t temp, bit; 1446 uint32_t temp, bit;
@@ -1480,8 +1483,7 @@ intel_dp_detect(struct drm_connector *connector)
1480 1483
1481static int intel_dp_get_modes(struct drm_connector *connector) 1484static int intel_dp_get_modes(struct drm_connector *connector)
1482{ 1485{
1483 struct drm_encoder *encoder = intel_attached_encoder(connector); 1486 struct intel_dp *intel_dp = intel_attached_dp(connector);
1484 struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
1485 struct drm_device *dev = intel_dp->base.base.dev; 1487 struct drm_device *dev = intel_dp->base.base.dev;
1486 struct drm_i915_private *dev_priv = dev->dev_private; 1488 struct drm_i915_private *dev_priv = dev->dev_private;
1487 int ret; 1489 int ret;
@@ -1554,7 +1556,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
1554static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs = { 1556static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs = {
1555 .get_modes = intel_dp_get_modes, 1557 .get_modes = intel_dp_get_modes,
1556 .mode_valid = intel_dp_mode_valid, 1558 .mode_valid = intel_dp_mode_valid,
1557 .best_encoder = intel_attached_encoder, 1559 .best_encoder = intel_best_encoder,
1558}; 1560};
1559 1561
1560static const struct drm_encoder_funcs intel_dp_enc_funcs = { 1562static const struct drm_encoder_funcs intel_dp_enc_funcs = {
@@ -1674,8 +1676,7 @@ intel_dp_init(struct drm_device *dev, int output_reg)
1674 DRM_MODE_ENCODER_TMDS); 1676 DRM_MODE_ENCODER_TMDS);
1675 drm_encoder_helper_add(&intel_encoder->base, &intel_dp_helper_funcs); 1677 drm_encoder_helper_add(&intel_encoder->base, &intel_dp_helper_funcs);
1676 1678
1677 drm_mode_connector_attach_encoder(&intel_connector->base, 1679 intel_connector_attach_encoder(intel_connector, intel_encoder);
1678 &intel_encoder->base);
1679 drm_sysfs_connector_add(connector); 1680 drm_sysfs_connector_add(connector);
1680 1681
1681 /* Set up the DDC bus. */ 1682 /* Set up the DDC bus. */