diff options
author | Roman Volkov <v1ron@mail.ru> | 2014-01-24 07:18:02 -0500 |
---|---|---|
committer | Clemens Ladisch <clemens@ladisch.de> | 2014-01-29 14:45:43 -0500 |
commit | 10dd44dc88419ba5278435669ac9e35f9f410c7e (patch) | |
tree | 9f9de11ed1b86e7bdd266aaa291fe1324b5e4aed /sound/pci/oxygen/oxygen_io.c | |
parent | d8ec26d7f8287f5788a494f56e8814210f0e64be (diff) |
ALSA: oxygen: add the separate SPI waiting function
The oxygen_wait_spi() function now performs waiting when the
SPI bus completes a transaction. Introduce the timeout error
checking and increase timeout to 200 from 40.
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 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c index 521eae458348..4b88c7a332e4 100644 --- a/sound/pci/oxygen/oxygen_io.c +++ b/sound/pci/oxygen/oxygen_io.c | |||
@@ -194,6 +194,24 @@ void oxygen_write_ac97_masked(struct oxygen *chip, unsigned int codec, | |||
194 | } | 194 | } |
195 | EXPORT_SYMBOL(oxygen_write_ac97_masked); | 195 | EXPORT_SYMBOL(oxygen_write_ac97_masked); |
196 | 196 | ||
197 | static int oxygen_wait_spi(struct oxygen *chip) | ||
198 | { | ||
199 | unsigned int count; | ||
200 | |||
201 | /* | ||
202 | * Higher timeout to be sure: 200 us; | ||
203 | * actual transaction should not need more than 40 us. | ||
204 | */ | ||
205 | for (count = 50; count > 0; count--) { | ||
206 | udelay(4); | ||
207 | if ((oxygen_read8(chip, OXYGEN_SPI_CONTROL) & | ||
208 | OXYGEN_SPI_BUSY) == 0) | ||
209 | return 0; | ||
210 | } | ||
211 | snd_printk(KERN_ERR "oxygen: SPI wait timeout\n"); | ||
212 | return -EIO; | ||
213 | } | ||
214 | |||
197 | void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data) | 215 | void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data) |
198 | { | 216 | { |
199 | unsigned int count; | 217 | unsigned int count; |