platform/chrome: cros_ec_spi: Request the SPI thread be realtime
authorDouglas Anderson <dianders@chromium.org>
Wed, 15 May 2019 16:48:13 +0000 (09:48 -0700)
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>
Fri, 24 May 2019 09:35:30 +0000 (11:35 +0200)
All currently known ECs in the wild are very sensitive to timing.
Specifically the ECs are known to drop a transfer if more than 8 ms
passes from the assertion of the chip select until the transfer
finishes.

Let's use the new feature introduced in the patch (spi: Allow SPI
devices to request the pumping thread be realtime") to request the SPI
pumping thread be realtime.  This means that if we get shunted off to
the SPI thread for whatever reason we won't get downgraded to low
priority.

NOTES:
- We still need to keep ourselves as high priority since the SPI core
  doesn't guarantee that all transfers end up on the pumping thread
  (in fact, it tries pretty hard to do them in the calling context).
- If future Chrome OS ECs ever fix themselves to be less sensitive
  then we could consider adding a property (or compatible string) to
  not set this property.  For now we need it across the board.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
drivers/platform/chrome/cros_ec_spi.c

index 5877a572e0bd4d972929e9d534be2cd7dbdf982b..006a8ff640573fa56e42a9c421cfd8f6664f5cd4 100644 (file)
@@ -740,6 +740,7 @@ static int cros_ec_spi_probe(struct spi_device *spi)
 
        spi->bits_per_word = 8;
        spi->mode = SPI_MODE_0;
+       spi->rt = true;
        err = spi_setup(spi);
        if (err < 0)
                return err;