diff options
author | Jani Nikula <jani.nikula@intel.com> | 2012-08-13 06:22:35 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-08-17 03:21:36 -0400 |
commit | f1a2f5b7c5f0941d23eef0a095c0b99bf8d051e6 (patch) | |
tree | 6826689fea622320d9ee48e01bbd8f1b0fe13c2b | |
parent | 4eab81366465aedcfd26de960c595bc03599c09f (diff) |
drm/i915: fall back to bit-banging if GMBUS fails in CRT EDID reads
GMBUS was enabled over bit-banging as the default in commits:
commit c3dfefa0a6d235bd465309e12f4c56ea16e71111
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Tue Feb 14 22:37:25 2012 +0100
drm/i915: reenable gmbus on gen3+ again
and
commit 0fb3f969c8683505fb7323c06bf8a999a5a45a15
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Fri Mar 2 19:38:30 2012 +0100
drm/i915: enable gmbus on gen2
Unfortunately, GMBUS seems to fail on some CRT displays. Add a bit-banging
fallback to CRT EDID reads.
LKML-Reference: <201207251020.47637.maciej.rutecki@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=45881
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Alex Ferrando <alferpal@gmail.com>
Cc: stable@vger.kernel.org (for 3.4+3.5)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/intel_crt.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 7ed4a41c3965..23bdc8cd1458 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -326,6 +326,36 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector) | |||
326 | return ret; | 326 | return ret; |
327 | } | 327 | } |
328 | 328 | ||
329 | static struct edid *intel_crt_get_edid(struct drm_connector *connector, | ||
330 | struct i2c_adapter *i2c) | ||
331 | { | ||
332 | struct edid *edid; | ||
333 | |||
334 | edid = drm_get_edid(connector, i2c); | ||
335 | |||
336 | if (!edid && !intel_gmbus_is_forced_bit(i2c)) { | ||
337 | DRM_DEBUG_KMS("CRT GMBUS EDID read failed, retry using GPIO bit-banging\n"); | ||
338 | intel_gmbus_force_bit(i2c, true); | ||
339 | edid = drm_get_edid(connector, i2c); | ||
340 | intel_gmbus_force_bit(i2c, false); | ||
341 | } | ||
342 | |||
343 | return edid; | ||
344 | } | ||
345 | |||
346 | /* local version of intel_ddc_get_modes() to use intel_crt_get_edid() */ | ||
347 | static int intel_crt_ddc_get_modes(struct drm_connector *connector, | ||
348 | struct i2c_adapter *adapter) | ||
349 | { | ||
350 | struct edid *edid; | ||
351 | |||
352 | edid = intel_crt_get_edid(connector, adapter); | ||
353 | if (!edid) | ||
354 | return 0; | ||
355 | |||
356 | return intel_connector_update_modes(connector, edid); | ||
357 | } | ||
358 | |||
329 | static bool intel_crt_detect_ddc(struct drm_connector *connector) | 359 | static bool intel_crt_detect_ddc(struct drm_connector *connector) |
330 | { | 360 | { |
331 | struct intel_crt *crt = intel_attached_crt(connector); | 361 | struct intel_crt *crt = intel_attached_crt(connector); |
@@ -336,7 +366,7 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector) | |||
336 | BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG); | 366 | BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG); |
337 | 367 | ||
338 | i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin); | 368 | i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin); |
339 | edid = drm_get_edid(connector, i2c); | 369 | edid = intel_crt_get_edid(connector, i2c); |
340 | 370 | ||
341 | if (edid) { | 371 | if (edid) { |
342 | bool is_digital = edid->input & DRM_EDID_INPUT_DIGITAL; | 372 | bool is_digital = edid->input & DRM_EDID_INPUT_DIGITAL; |
@@ -544,13 +574,13 @@ static int intel_crt_get_modes(struct drm_connector *connector) | |||
544 | struct i2c_adapter *i2c; | 574 | struct i2c_adapter *i2c; |
545 | 575 | ||
546 | i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin); | 576 | i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin); |
547 | ret = intel_ddc_get_modes(connector, i2c); | 577 | ret = intel_crt_ddc_get_modes(connector, i2c); |
548 | if (ret || !IS_G4X(dev)) | 578 | if (ret || !IS_G4X(dev)) |
549 | return ret; | 579 | return ret; |
550 | 580 | ||
551 | /* Try to probe digital port for output in DVI-I -> VGA mode. */ | 581 | /* Try to probe digital port for output in DVI-I -> VGA mode. */ |
552 | i2c = intel_gmbus_get_adapter(dev_priv, GMBUS_PORT_DPB); | 582 | i2c = intel_gmbus_get_adapter(dev_priv, GMBUS_PORT_DPB); |
553 | return intel_ddc_get_modes(connector, i2c); | 583 | return intel_crt_ddc_get_modes(connector, i2c); |
554 | } | 584 | } |
555 | 585 | ||
556 | static int intel_crt_set_property(struct drm_connector *connector, | 586 | static int intel_crt_set_property(struct drm_connector *connector, |