twsi: use tsleep instead of pause for better responsiveness

wakeup() does not have any effect on pause(), so if a transfer was
not finished by the time of the first check, then the thread
would sleep full 30 ms.

To do: protect the transfer and interrupt code with the mutex,
switch from tsleep from msleep

Reviewed by:	manu
MFC after:	3 weeks
Differential Revision: https://reviews.freebsd.org/D26309
This commit is contained in:
Andriy Gapon 2020-09-07 06:29:41 +00:00
parent c3a7328be8
commit e21a4ccfd1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365396

View File

@ -510,7 +510,7 @@ twsi_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
sc->control_val &= ~TWSI_CONTROL_ACK;
TWSI_WRITE(sc, sc->reg_control, sc->control_val | TWSI_CONTROL_START);
while (sc->error == 0 && sc->transfer != 0) {
pause_sbt("twsi", SBT_1MS * 30, SBT_1MS, 0);
tsleep_sbt(sc, 0, "twsi", SBT_1MS * 30, SBT_1MS, 0);
}
debugf(sc->dev, "pause finish\n");