Commit b1083333 authored by Adam Jackson's avatar Adam Jackson Committed by Eric Anholt

drm/i915: Fix DDC bus selection for multifunction SDVO

Multifunction SDVO cards stopped working after 14571b4c, and would report
something that looked remarkably like an ADD2 SPD ROM instead of EDID.
This appears to be because DDC bus selection was utterly horked by that
commit; controlled_output was no longer always a single bit, so
intel_sdvo_select_ddc_bus would pick bus 0, which is (unsurprisingly)
the SPD ROM bus, not a DDC bus.

So, instead of that, let's just use the DDC bus the child device table
tells us to use.  I'm guessing at the bitmask and shifting from VBIOS
dumps, but it can't possibly be worse.

cf. https://bugzilla.redhat.com/584229Signed-off-by: default avatarAdam Jackson <ajax@redhat.com>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent 34dc4d44
...@@ -135,6 +135,7 @@ struct sdvo_device_mapping { ...@@ -135,6 +135,7 @@ struct sdvo_device_mapping {
u8 slave_addr; u8 slave_addr;
u8 dvo_wiring; u8 dvo_wiring;
u8 initialized; u8 initialized;
u8 ddc_pin;
}; };
struct drm_i915_error_state { struct drm_i915_error_state {
......
...@@ -366,6 +366,7 @@ parse_sdvo_device_mapping(struct drm_i915_private *dev_priv, ...@@ -366,6 +366,7 @@ parse_sdvo_device_mapping(struct drm_i915_private *dev_priv,
p_mapping->dvo_port = p_child->dvo_port; p_mapping->dvo_port = p_child->dvo_port;
p_mapping->slave_addr = p_child->slave_addr; p_mapping->slave_addr = p_child->slave_addr;
p_mapping->dvo_wiring = p_child->dvo_wiring; p_mapping->dvo_wiring = p_child->dvo_wiring;
p_mapping->ddc_pin = p_child->ddc_pin;
p_mapping->initialized = 1; p_mapping->initialized = 1;
} else { } else {
DRM_DEBUG_KMS("Maybe one SDVO port is shared by " DRM_DEBUG_KMS("Maybe one SDVO port is shared by "
......
...@@ -2054,40 +2054,17 @@ static const struct drm_encoder_funcs intel_sdvo_enc_funcs = { ...@@ -2054,40 +2054,17 @@ static const struct drm_encoder_funcs intel_sdvo_enc_funcs = {
* outputs, then LVDS outputs. * outputs, then LVDS outputs.
*/ */
static void static void
intel_sdvo_select_ddc_bus(struct intel_sdvo_priv *dev_priv) intel_sdvo_select_ddc_bus(struct drm_i915_private *dev_priv,
struct intel_sdvo_priv *sdvo, u32 reg)
{ {
uint16_t mask = 0; struct sdvo_device_mapping *mapping;
unsigned int num_bits;
/* Make a mask of outputs less than or equal to our own priority in the if (IS_SDVOB(reg))
* list. mapping = &(dev_priv->sdvo_mappings[0]);
*/ else
switch (dev_priv->controlled_output) { mapping = &(dev_priv->sdvo_mappings[1]);
case SDVO_OUTPUT_LVDS1:
mask |= SDVO_OUTPUT_LVDS1;
case SDVO_OUTPUT_LVDS0:
mask |= SDVO_OUTPUT_LVDS0;
case SDVO_OUTPUT_TMDS1:
mask |= SDVO_OUTPUT_TMDS1;
case SDVO_OUTPUT_TMDS0:
mask |= SDVO_OUTPUT_TMDS0;
case SDVO_OUTPUT_RGB1:
mask |= SDVO_OUTPUT_RGB1;
case SDVO_OUTPUT_RGB0:
mask |= SDVO_OUTPUT_RGB0;
break;
}
/* Count bits to find what number we are in the priority list. */
mask &= dev_priv->caps.output_flags;
num_bits = hweight16(mask);
if (num_bits > 3) {
/* if more than 3 outputs, default to DDC bus 3 for now */
num_bits = 3;
}
/* Corresponds to SDVO_CONTROL_BUS_DDCx */ sdvo->ddc_bus = 1 << ((mapping->ddc_pin & 0xf0) >> 4);
dev_priv->ddc_bus = 1 << num_bits;
} }
static bool static bool
...@@ -2864,7 +2841,7 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg) ...@@ -2864,7 +2841,7 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
goto err_i2c; goto err_i2c;
} }
intel_sdvo_select_ddc_bus(sdvo_priv); intel_sdvo_select_ddc_bus(dev_priv, sdvo_priv, sdvo_reg);
/* Set the input timing to the screen. Assume always input 0. */ /* Set the input timing to the screen. Assume always input 0. */
intel_sdvo_set_target_input(intel_encoder, true, false); intel_sdvo_set_target_input(intel_encoder, true, false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment