@@ -865,6 +865,7 @@
#define GMBUS_RATE_50KHZ (1<<8)
#define GMBUS_RATE_400KHZ (2<<8) /* reserved on Pineview */
#define GMBUS_RATE_1MHZ (3<<8) /* reserved on Pineview */
+#define GMBUS_RATE_MASK (3<<8)
#define GMBUS_HOLD_EXT (1<<7) /* 300ns hold time, rsvd on Pineview */
#define GMBUS_PORT_DISABLED 0
#define GMBUS_PORT_SSC 1
@@ -875,6 +876,7 @@
#define GMBUS_PORT_DPD 6 /* HDMID */
#define GMBUS_PORT_RESERVED 7 /* 7 reserved */
#define GMBUS_NUM_PORTS (GMBUS_PORT_DPD - GMBUS_PORT_SSC + 1)
+#define GMBUS_PORT_MASK 7
#define GMBUS1 0x5104 /* command/status */
#define GMBUS_SW_CLR_INT (1<<31)
#define GMBUS_SW_RDY (1<<30)
@@ -332,6 +332,7 @@ gmbus_xfer(struct i2c_adapter *adapter,
struct drm_i915_private *dev_priv = bus->dev_priv;
int i, reg_offset;
int ret = 0;
+ u32 gmbus0;
mutex_lock(&dev_priv->gmbus_mutex);
@@ -342,7 +343,14 @@ gmbus_xfer(struct i2c_adapter *adapter,
reg_offset = dev_priv->gpio_mmio_base;
- I915_WRITE(GMBUS0 + reg_offset, bus->reg0);
+ /* Hack to use 400kHz only for atmel_mxt i2c devices on ddc ports */
+ gmbus0 = bus->reg0;
+ if (((gmbus0 & GMBUS_PORT_MASK) == GMBUS_PORT_VGADDC &&
+ msgs[0].addr == 0x4b) ||
+ ((gmbus0 & GMBUS_PORT_MASK) == GMBUS_PORT_PANEL &&
+ (msgs[0].addr == 0x4a || msgs[0].addr == 0x26)))
+ gmbus0 = (gmbus0 & ~GMBUS_RATE_MASK) | GMBUS_RATE_400KHZ;
+ I915_WRITE(GMBUS0 + reg_offset, gmbus0);
for (i = 0; i < num; i++) {
u32 gmbus2;