diff options
author | David Hendricks <dhendrix@chromium.org> | 2014-04-30 13:44:04 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-06-03 03:11:46 -0400 |
commit | 1fe368665b1499041919d78467147849989af7c9 (patch) | |
tree | fc52e60331f7072b6c45790cfcb976f7129a324b /drivers/mfd | |
parent | d1cb4cc9051110a0d4f6261e2e8e90398166a4c5 (diff) |
mfd: cros_ec: spi: Calculate delay between transfers correctly
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>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/cros_ec_spi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c index 84af8d7a4295..c185eb67943f 100644 --- a/drivers/mfd/cros_ec_spi.c +++ b/drivers/mfd/cros_ec_spi.c | |||
@@ -219,7 +219,7 @@ static int cros_ec_command_spi_xfer(struct cros_ec_device *ec_dev, | |||
219 | ktime_get_ts(&ts); | 219 | ktime_get_ts(&ts); |
220 | delay = timespec_to_ns(&ts) - ec_spi->last_transfer_ns; | 220 | delay = timespec_to_ns(&ts) - ec_spi->last_transfer_ns; |
221 | if (delay < EC_SPI_RECOVERY_TIME_NS) | 221 | if (delay < EC_SPI_RECOVERY_TIME_NS) |
222 | ndelay(delay); | 222 | ndelay(EC_SPI_RECOVERY_TIME_NS - delay); |
223 | } | 223 | } |
224 | 224 | ||
225 | /* Transmit phase - send our message */ | 225 | /* Transmit phase - send our message */ |