Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 307126
b: refs/heads/master
c: 90e6b26
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Kurtz authored and Daniel Vetter committed Apr 12, 2012
1 parent 4b3d7ca commit d02e83a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 56f9eac05489912ac0165ffc0ebff0f8588f77d2
refs/heads/master: 90e6b26d6b28ade684a4b16b856a74f27bc644bc
34 changes: 22 additions & 12 deletions trunk/drivers/gpu/drm/i915/intel_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,16 @@ gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,
GMBUS_SLAVE_READ | GMBUS_SW_RDY);
POSTING_READ(GMBUS2 + reg_offset);
do {
int ret;
u32 val, loop = 0;
u32 gmbus2;

if (wait_for(I915_READ(GMBUS2 + reg_offset) &
(GMBUS_SATOER | GMBUS_HW_RDY),
50))
ret = wait_for((gmbus2 = I915_READ(GMBUS2 + reg_offset)) &
(GMBUS_SATOER | GMBUS_HW_RDY),
50);
if (ret)
return -ETIMEDOUT;
if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER)
if (gmbus2 & GMBUS_SATOER)
return -ENXIO;

val = I915_READ(GMBUS3 + reg_offset);
Expand Down Expand Up @@ -260,6 +263,9 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
GMBUS_SLAVE_WRITE | GMBUS_SW_RDY);
POSTING_READ(GMBUS2 + reg_offset);
while (len) {
int ret;
u32 gmbus2;

val = loop = 0;
do {
val |= *buf++ << (8 * loop);
Expand All @@ -268,11 +274,12 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
I915_WRITE(GMBUS3 + reg_offset, val);
POSTING_READ(GMBUS2 + reg_offset);

if (wait_for(I915_READ(GMBUS2 + reg_offset) &
(GMBUS_SATOER | GMBUS_HW_RDY),
50))
ret = wait_for((gmbus2 = I915_READ(GMBUS2 + reg_offset)) &
(GMBUS_SATOER | GMBUS_HW_RDY),
50);
if (ret)
return -ETIMEDOUT;
if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER)
if (gmbus2 & GMBUS_SATOER)
return -ENXIO;
}
return 0;
Expand Down Expand Up @@ -342,6 +349,8 @@ gmbus_xfer(struct i2c_adapter *adapter,
I915_WRITE(GMBUS0 + reg_offset, bus->reg0);

for (i = 0; i < num; i++) {
u32 gmbus2;

if (gmbus_is_index_read(msgs, i, num)) {
ret = gmbus_xfer_index_read(dev_priv, &msgs[i]);
i += 1; /* set i to the index of the read xfer */
Expand All @@ -356,11 +365,12 @@ gmbus_xfer(struct i2c_adapter *adapter,
if (ret == -ENXIO)
goto clear_err;

if (wait_for(I915_READ(GMBUS2 + reg_offset) &
(GMBUS_SATOER | GMBUS_HW_WAIT_PHASE),
50))
ret = wait_for((gmbus2 = I915_READ(GMBUS2 + reg_offset)) &
(GMBUS_SATOER | GMBUS_HW_WAIT_PHASE),
50);
if (ret)
goto timeout;
if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER)
if (gmbus2 & GMBUS_SATOER)
goto clear_err;
}

Expand Down

0 comments on commit d02e83a

Please sign in to comment.