diff options
author | Stefan Eichenberger <stefan.eichenberger@toradex.com> | 2024-10-14 15:15:14 +0200 |
---|---|---|
committer | Andi Shyti <andi.shyti@kernel.org> | 2024-11-17 11:58:14 +0100 |
commit | 5f5c2d4579ca6836f5604cca979debd68ecfe23f (patch) | |
tree | 07bbdf080b422aa11a6d11ba95b95bbc65867537 /MAINTAINERS | |
parent | b460b15b3cc23ef3639cc51043bf8b2a70ca1878 (diff) | |
download | lwn-5f5c2d4579ca6836f5604cca979debd68ecfe23f.tar.gz lwn-5f5c2d4579ca6836f5604cca979debd68ecfe23f.zip |
i2c: imx: prevent rescheduling in non dma mode
We are experiencing a problem with the i.MX I2C controller when
communicating with SMBus devices. We are seeing devices time-out because
the time between sending/receiving two bytes is too long, and the SMBus
device returns to the idle state. This happens because the i.MX I2C
controller sends and receives byte by byte. When a byte is sent or
received, we get an interrupt and can send or receive the next byte.
The current implementation sends a byte and then waits for an event
generated by the interrupt subroutine. After the event is received, the
next byte is sent and we wait again. This waiting allows the scheduler
to reschedule other tasks, with the disadvantage that we may not send
the next byte for a long time because the send task is not immediately
scheduled. For example, if the rescheduling takes more than 25ms, this
can cause SMBus devices to timeout and communication to fail.
This patch changes the behavior so that we do not reschedule the
send/receive task, but instead send or receive the next byte in the
interrupt subroutine. This prevents rescheduling and drastically reduces
the time between sending/receiving bytes. The cost in the interrupt
subroutine is relatively small, we check what state we are in and then
send/receive the next byte. Before we had to call wake_up, which is even
less expensive. However, we also had to do some scheduling, which
increased the overall cost compared to the new solution. The wake_up
function to wake up the send/receive task is now only called when an
error occurs or when the transfer is complete.
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Diffstat (limited to 'MAINTAINERS')
0 files changed, 0 insertions, 0 deletions