Skip to content

Commit

Permalink
mfd: cros_ec: spi: Calculate delay between transfers correctly
Browse files Browse the repository at this point in the history
To avoid spamming the EC we calculate the time between the previous
transfer and the current transfer and force a delay if the time delta
is too small.

However, a small miscalculation causes the delay period to be
far too short. Most noticably this impacts commands with a long
turnaround time such as EC firmware reads and writes.

Signed-off-by: David Hendricks <dhendrix@chromium.org>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
  • Loading branch information
David Hendricks authored and Lee Jones committed Jun 3, 2014
1 parent d1cb4cc commit 1fe3686
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mfd/cros_ec_spi.c
Original file line number Diff line number Diff line change
@@ -219,7 +219,7 @@ static int cros_ec_command_spi_xfer(struct cros_ec_device *ec_dev,
ktime_get_ts(&ts);
delay = timespec_to_ns(&ts) - ec_spi->last_transfer_ns;
if (delay < EC_SPI_RECOVERY_TIME_NS)
ndelay(delay);
ndelay(EC_SPI_RECOVERY_TIME_NS - delay);
}

/* Transmit phase - send our message */

0 comments on commit 1fe3686

Please sign in to comment.