[alsa-devel] [PATCH v3 01/16] ALSA: Oxygen: Add the separate SPI waiting function

Clemens Ladisch clemens at ladisch.de
Sun Jan 19 10:39:20 CET 2014

Roman Volkov wrote:
> Clemens Ladisch <clemens at ladisch.de> пишет:
>> The SPI transaction will not be finished for the first 30 µs or so, so
>> polling is not needed for that time.
> We may switch the context and force CPU to
> execute useful code, using something like usleep, msleep. However,
> this may block the thread for too long time. Please suggest
> something how to optimize this.

Actually, SPI transactions could use 2 bytes or a faster clock,
so I don't think this needs to be optimized.

>> With the wait coming after the transaction, it makes more sense to
>> have the busy check not before but after the udelay.
> Okay, this will be:
> for (count = 100; count > 0; count--) {
> 	udelay(4);
> 	if ((oxygen_read8(chip, OXYGEN_SPI_CONTROL) &
> 					OXYGEN_SPI_BUSY) == 0)
> 		return 0;
> }



More information about the Alsa-devel mailing list