aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2012-08-29 09:43:58 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-09-03 04:09:30 -0400
commit5fa7ac9c9cadd598a22c09660c270bdb92da1e91 (patch)
tree504c065aa77951aa5294064a321122aa8052b513
parentff04b35af0e40956764596e3d032f786e5451238 (diff)
drm/i915: fix sdvo hotplug support check and activation
The sdvo hotplug support check and activation has worked by coincidence for TMDS0. The boolean value returned by intel_sdvo_supports_hotplug() was masked with a bit shifted by device number, which also should have been one of SDVO_OUTPUT_* bits instead. Boolean true masked with 1 shifted by 0 just happened to match SDVO_OUTPUT_TMDS0... Get hotplug support as a bit mask, check the correct bits for support, and use the correct bits for activating hotplug support. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Simon Farnsworth <simon.farnsworth@onelan.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 9a31211a60c6..6c9a85759bc3 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -97,7 +97,7 @@ struct intel_sdvo {
97 /* 97 /*
98 * Hotplug activation bits for this device 98 * Hotplug activation bits for this device
99 */ 99 */
100 uint8_t hotplug_active[2]; 100 uint16_t hotplug_active;
101 101
102 /** 102 /**
103 * This is used to select the color range of RBG outputs in HDMI mode. 103 * This is used to select the color range of RBG outputs in HDMI mode.
@@ -1251,25 +1251,29 @@ static bool intel_sdvo_get_capabilities(struct intel_sdvo *intel_sdvo, struct in
1251 return true; 1251 return true;
1252} 1252}
1253 1253
1254static int intel_sdvo_supports_hotplug(struct intel_sdvo *intel_sdvo) 1254static uint16_t intel_sdvo_get_hotplug_support(struct intel_sdvo *intel_sdvo)
1255{ 1255{
1256 struct drm_device *dev = intel_sdvo->base.base.dev; 1256 struct drm_device *dev = intel_sdvo->base.base.dev;
1257 u8 response[2]; 1257 uint16_t hotplug;
1258 1258
1259 /* HW Erratum: SDVO Hotplug is broken on all i945G chips, there's noise 1259 /* HW Erratum: SDVO Hotplug is broken on all i945G chips, there's noise
1260 * on the line. */ 1260 * on the line. */
1261 if (IS_I945G(dev) || IS_I945GM(dev)) 1261 if (IS_I945G(dev) || IS_I945GM(dev))
1262 return false; 1262 return 0;
1263
1264 if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HOT_PLUG_SUPPORT,
1265 &hotplug, sizeof(hotplug)))
1266 return 0;
1263 1267
1264 return intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HOT_PLUG_SUPPORT, 1268 return hotplug;
1265 &response, 2) && response[0];
1266} 1269}
1267 1270
1268static void intel_sdvo_enable_hotplug(struct intel_encoder *encoder) 1271static void intel_sdvo_enable_hotplug(struct intel_encoder *encoder)
1269{ 1272{
1270 struct intel_sdvo *intel_sdvo = to_intel_sdvo(&encoder->base); 1273 struct intel_sdvo *intel_sdvo = to_intel_sdvo(&encoder->base);
1271 1274
1272 intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_ACTIVE_HOT_PLUG, &intel_sdvo->hotplug_active, 2); 1275 intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_ACTIVE_HOT_PLUG,
1276 &intel_sdvo->hotplug_active, 2);
1273} 1277}
1274 1278
1275static bool 1279static bool
@@ -2061,17 +2065,18 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
2061 2065
2062 intel_connector = &intel_sdvo_connector->base; 2066 intel_connector = &intel_sdvo_connector->base;
2063 connector = &intel_connector->base; 2067 connector = &intel_connector->base;
2064 if (intel_sdvo_supports_hotplug(intel_sdvo) & (1 << device)) { 2068 if (intel_sdvo_get_hotplug_support(intel_sdvo) &
2069 intel_sdvo_connector->output_flag) {
2065 connector->polled = DRM_CONNECTOR_POLL_HPD; 2070 connector->polled = DRM_CONNECTOR_POLL_HPD;
2066 intel_sdvo->hotplug_active[0] |= 1 << device; 2071 intel_sdvo->hotplug_active |= intel_sdvo_connector->output_flag;
2067 /* Some SDVO devices have one-shot hotplug interrupts. 2072 /* Some SDVO devices have one-shot hotplug interrupts.
2068 * Ensure that they get re-enabled when an interrupt happens. 2073 * Ensure that they get re-enabled when an interrupt happens.
2069 */ 2074 */
2070 intel_encoder->hot_plug = intel_sdvo_enable_hotplug; 2075 intel_encoder->hot_plug = intel_sdvo_enable_hotplug;
2071 intel_sdvo_enable_hotplug(intel_encoder); 2076 intel_sdvo_enable_hotplug(intel_encoder);
2072 } 2077 } else {
2073 else
2074 connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; 2078 connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
2079 }
2075 encoder->encoder_type = DRM_MODE_ENCODER_TMDS; 2080 encoder->encoder_type = DRM_MODE_ENCODER_TMDS;
2076 connector->connector_type = DRM_MODE_CONNECTOR_DVID; 2081 connector->connector_type = DRM_MODE_CONNECTOR_DVID;
2077 2082
@@ -2587,7 +2592,7 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
2587 /* Only enable the hotplug irq if we need it, to work around noisy 2592 /* Only enable the hotplug irq if we need it, to work around noisy
2588 * hotplug lines. 2593 * hotplug lines.
2589 */ 2594 */
2590 if (intel_sdvo->hotplug_active[0]) 2595 if (intel_sdvo->hotplug_active)
2591 dev_priv->hotplug_supported_mask |= hotplug_mask; 2596 dev_priv->hotplug_supported_mask |= hotplug_mask;
2592 2597
2593 intel_sdvo_select_ddc_bus(dev_priv, intel_sdvo, sdvo_reg); 2598 intel_sdvo_select_ddc_bus(dev_priv, intel_sdvo, sdvo_reg);