diff options
author | Roman Volkov <v1ron@mail.ru> | 2014-01-24 16:18:03 +0400 |
---|---|---|
committer | Clemens Ladisch <clemens@ladisch.de> | 2014-01-29 23:45:44 +0400 |
commit | 303cff30d36e6a450c3ced1e3bed034038d87a86 (patch) | |
tree | d7dfa1fe1c0a0a1ac98ddc953620ff35c6b92598 /sound/pci/oxygen/oxygen_io.c | |
parent | 10dd44dc88419ba5278435669ac9e35f9f410c7e (diff) | |
download | linux-303cff30d36e6a450c3ced1e3bed034038d87a86.tar.xz |
ALSA: oxygen: modify the SPI writing function
Modify the oxygen_write_spi() function to use the newly
introduced oxygen_wait_spi() function. Change return value
from void to int, so it can return error codes. Older
drivers just ignore that return value, new drivers can
check this value. We need to wait AFTER
initiating the SPI transaction, otherwise read
operation will not work.
Signed-off-by: Roman Volkov <v1ron@mail.ru>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/pci/oxygen/oxygen_io.c')
-rw-r--r-- | sound/pci/oxygen/oxygen_io.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c index 4b88c7a332e4..3274907189fe 100644 --- a/sound/pci/oxygen/oxygen_io.c +++ b/sound/pci/oxygen/oxygen_io.c @@ -212,23 +212,18 @@ static int oxygen_wait_spi(struct oxygen *chip) return -EIO; } -void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data) +int oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data) { - unsigned int count; - - /* should not need more than 30.72 us (24 * 1.28 us) */ - count = 10; - while ((oxygen_read8(chip, OXYGEN_SPI_CONTROL) & OXYGEN_SPI_BUSY) - && count > 0) { - udelay(4); - --count; - } - + /* + * We need to wait AFTER initiating the SPI transaction, + * otherwise read operations will not work. + */ oxygen_write8(chip, OXYGEN_SPI_DATA1, data); oxygen_write8(chip, OXYGEN_SPI_DATA2, data >> 8); if (control & OXYGEN_SPI_DATA_LENGTH_3) oxygen_write8(chip, OXYGEN_SPI_DATA3, data >> 16); oxygen_write8(chip, OXYGEN_SPI_CONTROL, control); + return oxygen_wait_spi(chip); } EXPORT_SYMBOL(oxygen_write_spi); |