Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 307123
b: refs/heads/master
c: e646d57
h: refs/heads/master
i:
  307121: a7672c4
  307119: f8b47ad
v: v3
  • Loading branch information
Daniel Kurtz authored and Daniel Vetter committed Apr 12, 2012
1 parent 15a6356 commit ff73fd9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 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: 7a39a9d4767e8d22d60f2c4bf5eece4f4398c274
refs/heads/master: e646d5773572bf52017983d758bdf05777dc5600
41 changes: 31 additions & 10 deletions trunk/drivers/gpu/drm/i915/intel_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,26 +324,47 @@ gmbus_xfer(struct i2c_adapter *adapter,
goto clear_err;
}

goto done;
/* Mark the GMBUS interface as disabled after waiting for idle.
* We will re-enable it at the start of the next xfer,
* till then let it sleep.
*/
if (wait_for((I915_READ(GMBUS2 + reg_offset) & GMBUS_ACTIVE) == 0, 10))
DRM_INFO("GMBUS [%s] timed out waiting for idle\n",
adapter->name);
I915_WRITE(GMBUS0 + reg_offset, 0);
ret = i;
goto out;

clear_err:
/*
* Wait for bus to IDLE before clearing NAK.
* If we clear the NAK while bus is still active, then it will stay
* active and the next transaction may fail.
*/
if (wait_for((I915_READ(GMBUS2 + reg_offset) & GMBUS_ACTIVE) == 0,
10))
DRM_INFO("GMBUS [%s] timed out after NAK\n", adapter->name);

/* Toggle the Software Clear Interrupt bit. This has the effect
* of resetting the GMBUS controller and so clearing the
* BUS_ERROR raised by the slave's NAK.
*/
I915_WRITE(GMBUS1 + reg_offset, GMBUS_SW_CLR_INT);
I915_WRITE(GMBUS1 + reg_offset, 0);
I915_WRITE(GMBUS0 + reg_offset, 0);

done:
/* Mark the GMBUS interface as disabled after waiting for idle.
* We will re-enable it at the start of the next xfer,
* till then let it sleep.
DRM_DEBUG_DRIVER("GMBUS [%s] NAK for addr: %04x %c(%d)\n",
adapter->name, msgs[i].addr,
(msgs[i].flags & I2C_M_RD) ? 'r' : 'w', msgs[i].len);

/*
* If no ACK is received during the address phase of a transaction,
* the adapter must report -ENXIO.
* It is not clear what to return if no ACK is received at other times.
* So, we always return -ENXIO in all NAK cases, to ensure we send
* it at least during the one case that is specified.
*/
if (wait_for((I915_READ(GMBUS2 + reg_offset) & GMBUS_ACTIVE) == 0, 10))
DRM_INFO("GMBUS [%s] timed out waiting for idle\n",
bus->adapter.name);
I915_WRITE(GMBUS0 + reg_offset, 0);
ret = i;
ret = -ENXIO;
goto out;

timeout:
Expand Down

0 comments on commit ff73fd9

Please sign in to comment.