Subject: [Patch] drm/i915: try another two possible DDC bus for the SDVO device with multiple outputs --- drivers/gpu/drm/i915/intel_sdvo.c | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) Index: linux-2.6/drivers/gpu/drm/i915/intel_sdvo.c =================================================================== --- linux-2.6.orig/drivers/gpu/drm/i915/intel_sdvo.c 2009-12-15 23:32:23.000000000 +0800 +++ linux-2.6/drivers/gpu/drm/i915/intel_sdvo.c 2009-12-15 23:58:50.000000000 +0800 @@ -124,6 +124,8 @@ /* DDC bus used by this SDVO output */ uint8_t ddc_bus; + /* the possible DDC bus for multi outputs */ + uint8_t possible_bus[2]; /* Mac mini hack -- use the same DDC as the analog connector */ struct i2c_adapter *analog_ddc_bus; @@ -1627,6 +1629,36 @@ edid = drm_get_edid(&intel_output->base, intel_output->ddc_bus); + if (edid == NULL && intel_sdvo_multifunc_encoder(intel_output)) { + uint8_t saved_ddc = sdvo_priv->ddc_bus; + /* try the first DDC1 */ + if (sdvo_priv->possible_bus[0]) { + sdvo_priv->ddc_bus = sdvo_priv->possible_bus[0]; + edid = drm_get_edid(&intel_output->base, + intel_output->ddc_bus); + } + if (edid != NULL) { + /* + * update the DDC bus for external monitor if EDID + * can be obtained. + * If it is not right, please fix me. + */ + sdvo_priv->ddc_bus = sdvo_priv->possible_bus[0]; + } + /* + * If there is no EDID and exists the DDC2 bus, we will try to + * use it to read the edid + */ + if (edid == NULL && sdvo_priv->possible_bus[1]) { + sdvo_priv->ddc_bus = sdvo_priv->possible_bus[1]; + edid = drm_get_edid(&intel_output->base, + intel_output->ddc_bus); + } + if (edid == NULL) { + /* If there is no EDID, restore the saved ddc */ + sdvo_priv->ddc_bus = saved_ddc; + } + } /* when there is no edid and no monitor is connected with VGA * port, try to use the CRT ddc to read the EDID for DVI-connector */ @@ -2159,6 +2191,16 @@ /* Corresponds to SDVO_CONTROL_BUS_DDCx */ dev_priv->ddc_bus = 1 << num_bits; + if (num_bits == 3) { + dev_priv->possible_bus[0] = 2; + dev_priv->possible_bus[1] = 4; + } else if (num_bits == 2) { + dev_priv->possible_bus[0] = 2; + dev_priv->possible_bus[1] = 0; + } else { + dev_priv->possible_bus[0] = 0; + dev_priv->possible_bus[1] = 0; + } } static bool