Commit 8f25d4b
committed
mesa-7i65: fix a bug with stale data in fifo
Writing to BSPI channels with echo enabled also simultaneously reads from
those channels. The read bytes go into the BSPI instance's read fifo,
where they stay until the driver reads them out.
By writing to the (echo-y) ADCs to configure them, we also put some
bytes into the read fifo. When we later try to read the analog and
digital inputs, we'll actually get the old bytes from the ADC setup,
and everything will be off by a handful of bytes, resulting in incorrect
information being used.
This commit fixes the problem by clearing the FIFO after setting up
the ADCs.
There may be another bug lurking in here - if somehow the FIFO becomes
out of sync, we'll never recover. A future hacker will get the pleasure
of rediscovering this problem and fixing it.1 parent c147f05 commit 8f25d4b
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
209 | 218 | | |
210 | 219 | | |
211 | 220 | | |
| |||
0 commit comments