diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c index c7cbfac..2d60074 100644 --- a/src/i830_sdvo.c +++ b/src/i830_sdvo.c @@ -69,6 +69,9 @@ struct i830_sdvo_priv { /** Pixel clock limitations reported by the SDVO device, in kHz */ int pixel_clock_min, pixel_clock_max; + /** DDC bus used by this SDVO output */ + CARD8 ddc_bus; + /** State for save/restore */ /** @{ */ int save_sdvo_mult; @@ -968,8 +971,9 @@ i830_sdvo_ddc_i2c_start(I2CBusPtr b, int timeout) xf86OutputPtr output = b->DriverPrivate.ptr; I830OutputPrivatePtr intel_output = output->driver_private; I2CBusPtr i2cbus = intel_output->pI2CBus; + struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; - i830_sdvo_set_control_bus_switch(output, SDVO_CONTROL_BUS_DDC2); + i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus); return i2cbus->I2CStart(i2cbus, timeout); } @@ -1280,24 +1284,39 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device) { dev_priv->active_outputs = SDVO_OUTPUT_TMDS0; output->subpixel_order = SubPixelHorizontalRGB; + if (dev_priv->caps.output_flags & + (SDVO_OUTPUT_RGB0 | SDVO_OUTPUT_RGB1)) + dev_priv->ddc_bus = SDVO_CONTROL_BUS_DDC2; + else + dev_priv->ddc_bus = SDVO_CONTROL_BUS_DDC1; name_prefix="TMDS"; } else if (dev_priv->caps.output_flags & SDVO_OUTPUT_TMDS1) { dev_priv->active_outputs = SDVO_OUTPUT_TMDS1; output->subpixel_order = SubPixelHorizontalRGB; + if (dev_priv->caps.output_flags & + (SDVO_OUTPUT_RGB0 | SDVO_OUTPUT_RGB1 | SDVO_OUTPUT_TMDS0)) + dev_priv->ddc_bus = SDVO_CONTROL_BUS_DDC2; + else + dev_priv->ddc_bus = SDVO_CONTROL_BUS_DDC1; name_prefix="TMDS"; } else if (dev_priv->caps.output_flags & SDVO_OUTPUT_RGB0) { dev_priv->active_outputs = SDVO_OUTPUT_RGB0; output->subpixel_order = SubPixelHorizontalRGB; + dev_priv->ddc_bus = SDVO_CONTROL_BUS_DDC1; name_prefix="VGA"; } else if (dev_priv->caps.output_flags & SDVO_OUTPUT_RGB1) { dev_priv->active_outputs = SDVO_OUTPUT_RGB1; output->subpixel_order = SubPixelHorizontalRGB; + if (dev_priv->caps.output_flags & SDVO_OUTPUT_RGB0) + dev_priv->ddc_bus = SDVO_CONTROL_BUS_DDC2; + else + dev_priv->ddc_bus = SDVO_CONTROL_BUS_DDC1; name_prefix="VGA"; } else diff --git a/src/i830_sdvo_regs.h b/src/i830_sdvo_regs.h index 72e58a0..b5a9ad2 100644 --- a/src/i830_sdvo_regs.h +++ b/src/i830_sdvo_regs.h @@ -322,8 +322,8 @@ struct i830_sdvo_set_target_input_args { #define SDVO_CMD_SET_TV_RESOLUTION_SUPPORT 0x93 #define SDVO_CMD_SET_CONTROL_BUS_SWITCH 0x7a -# define SDVO_CONTROL_BUS_PROM 0x0 -# define SDVO_CONTROL_BUS_DDC1 0x1 -# define SDVO_CONTROL_BUS_DDC2 0x2 -# define SDVO_CONTROL_BUS_DDC3 0x3 +# define SDVO_CONTROL_BUS_PROM (1 << 0) +# define SDVO_CONTROL_BUS_DDC1 (1 << 1) +# define SDVO_CONTROL_BUS_DDC2 (1 << 2) +# define SDVO_CONTROL_BUS_DDC3 (1 << 3)