Commit 66c8401
surface3-spi: workaround: disable DMA mode to avoid crash by default
On Arch Linux kernel at least after 4.19, touch input is broken after suspend
(s2idle).
kern :err : [ +0.203408] Surface3-spi spi-MSHW0037:00: SPI transfer timed out
On recent stable Arch Linux kernel (at least after 5.1), touch input will
crash after the first touch.
kern :err : [ +0.203592] Surface3-spi spi-MSHW0037:00: SPI transfer timed out
kern :err : [ +0.000173] spi_master spi1: failed to transfer one message from queue
I found on an affected system (Arch Linux kernel, etc.), the touchscreen
driver uses DMA mode by default. Then, we found some kernels with different
kernel config (5.1 kernel config from Jakeday [1] or Chromium OS kernel
chromeos-4.19 [2]) will use PIO mode by default and no such issues there.
So, this commit disables DMA mode on the touchscreen driver side as a quick
workaround to avoid touch input crash.
We may need to properly set up DMA mode to use the touchscreen driver with
DMA mode.
You can still switch DMA/PIO mode if you want:
switch to DMA mode (maybe broken)
echo 1 | sudo tee /sys/module/surface3_spi/parameters/use_dma
back to PIO mode
echo 0 | sudo tee /sys/module/surface3_spi/parameters/use_dma
Link to issue: jakeday/linux-surface#596
References:
[1] https://github.com/jakeday/linux-surface/blob/master/configs/5.1/config
[2] https://chromium.googlesource.com/chromiumos/third_party/kernel/+/refs/heads/chromeos-4.19
Tested on Arch Linux 5.4.1 with Surface 3, which will use DMA by default.
This commit made the driver use PIO by default and no touch input crash.
Also tested on chromeos-4.19 4.19.90 with Surface 3, which will use PIO by default
even without this commit. After this commit, it still uses PIO and confirmed
no functional changes regarding touch input.
More details:
We can confirm which mode the touchscreen driver uses; first, enable
debug output:
echo "file drivers/spi/spi-pxa2xx.c +p" | sudo tee /sys/kernel/debug/dynamic_debug/control
echo "file drivers/input/touchscreen/surface3_spi.c +p" | sudo tee /sys/kernel/debug/dynamic_debug/control
Then, try to make a touch input and see dmesg log
(On Arch Linux kernel, uses DMA)
kern :debug : [ +0.006383] Surface3-spi spi-MSHW0037:00: 7692307 Hz actual, DMA
kern :debug : [ +0.000495] Surface3-spi spi-MSHW0037:00: surface3_spi_irq_handler received
-> ff ff ff ff a5 5a e7 7e 01 d2 00 80 01 03 03 18 00 e4 01 00 04 1a 04 1a e3 0c e3 0c b0 00
c5 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
(On the kernels I referenced above, uses PIO)
kern :debug : [ +0.009260] Surface3-spi spi-MSHW0037:00: 7692307 Hz actual, PIO
kern :debug : [ +0.001105] Surface3-spi spi-MSHW0037:00: surface3_spi_irq_handler received
-> ff ff ff ff a5 5a e7 7e 01 d2 00 80 01 03 03 24 00 e4 01 00 58 0b 58 0b 83 12 83 12 26 01
95 01 00 00 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff1 parent 94e747e commit 66c8401
1 file changed
+26
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
28 | 34 | | |
29 | 35 | | |
30 | 36 | | |
| |||
326 | 332 | | |
327 | 333 | | |
328 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
329 | 342 | | |
330 | 343 | | |
331 | 344 | | |
| |||
368 | 381 | | |
369 | 382 | | |
370 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
371 | 397 | | |
372 | 398 | | |
373 | 399 | | |
| |||
0 commit comments