diff --git a/src/i830_crt.c b/src/i830_crt.c index d8e4a76..4073b03 100644 --- a/src/i830_crt.c +++ b/src/i830_crt.c @@ -34,6 +34,10 @@ #include "xf86Modes.h" #include "i830_display.h" +/* pre declare for helper function */ +static xf86MonPtr +i830_get_edid(xf86OutputPtr output, int gpio_reg, char *gpio_str); + static void i830_crt_dpms(xf86OutputPtr output, int mode) { @@ -366,17 +370,20 @@ i830_crt_detect_load (xf86CrtcPtr crtc, static Bool i830_crt_detect_ddc(xf86OutputPtr output) { - ScrnInfoPtr pScrn = output->scrn; I830OutputPrivatePtr i830_output = output->driver_private; - Bool detect; + Bool detect = FALSE; + xf86MonPtr edid_mon; /* CRT should always be at 0, but check anyway */ if (i830_output->type != I830_OUTPUT_ANALOG) return FALSE; - I830I2CInit(pScrn, &i830_output->pDDCBus, GPIOA, "CRTDDC_A"); - detect = xf86I2CProbeAddress(i830_output->pDDCBus, 0x00A0); - xf86DestroyI2CBusRec(i830_output->pDDCBus, TRUE, TRUE); + edid_mon = i830_get_edid(output, GPIOA, "CRTDDC_A"); + if (edid_mon) { + detect = TRUE; + xfree(edid_mon); + xf86DestroyI2CBusRec(i830_output->pDDCBus, TRUE, TRUE); + } return detect; }