18 Jan
2014
18 Jan
'14
11:26 a.m.
Roman Volkov wrote:
This function performs waiting when the SPI bus completes a transaction. Timeout error checking introduced and the timeout increased to 400 from 40.
Why 400? SPI does not allow the codec to delay reads.
- for (count = 100; count > 0; count--) {
if ((oxygen_read8(chip, OXYGEN_SPI_CONTROL) &
OXYGEN_SPI_BUSY) == 0)
return 0;
udelay(4);
--count;
- }
This loop waits for 200 µs.
The SPI transaction will not be finished for the first 30 µs or so, so polling is not needed for that time.
With the wait coming after the transaction, it makes more sense to have the busy check not before but after the udelay.
Regards, Clemens