From e55d86f654aa9dd4951b441636c8ca4b37786daf Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 26 Feb 2008 12:26:23 -0800 Subject: [PATCH] Fix SDVO I2C access on Mac Mini in EFI mode. The GMBUS was being left in SDVO pin access mode, which blocked our bit-banging access to those pins. Thanks to Peter Jones for quick debugging turnaround in getting this fixed. --- src/i810_reg.h | 8 ++++++++ src/i830_i2c.c | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/src/i810_reg.h b/src/i810_reg.h index 9eeddc9b..d5b6805e 100644 --- a/src/i810_reg.h +++ b/src/i810_reg.h @@ -290,6 +290,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # define GPIO_DATA_VAL_IN (1 << 12) # define GPIO_DATA_PULLUP_DISABLE (1 << 13) +/* GMBus registers for hardware-assisted (non-bitbanging) I2C access */ +#define GMBUS0 0x5100 +#define GMBUS1 0x5104 +#define GMBUS2 0x5108 +#define GMBUS3 0x510c +#define GMBUS4 0x5110 +#define GMBUS5 0x5120 + /* p317, 319 */ #define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */ diff --git a/src/i830_i2c.c b/src/i830_i2c.c index d80229d5..33a75a81 100644 --- a/src/i830_i2c.c +++ b/src/i830_i2c.c @@ -346,6 +346,7 @@ Bool I830I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name) { I2CBusPtr pI2CBus; + I830Ptr pI830 = I830PTR(pScrn); pI2CBus = xf86CreateI2CBusRec(); @@ -379,6 +380,12 @@ I830I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name) pI2CBus->AcknTimeout = 40; pI2CBus->RiseFallTime = 20; + /* Disable the GMBUS, which we won't use. If it is left enabled (for + * example, by Mac Mini EFI initialization), GPIO access to the pins it + * uses gets disabled. + */ + OUTREG(GMBUS0, 0); + if (!xf86I2CBusInit(pI2CBus)) return FALSE;