Commit 5ea310ff8d651246cf001ebc894d2f294123328a

Authored by Clemens Ladisch
Committed by Takashi Iwai
1 parent d2119c05e9

ALSA: oxygen: fix SPI clocks slower than 6.25 MHz

Fix wrong register bits for SPI clock cycle times longer than 160 ns,
and adjust the polling loop timeout for these speeds.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

Showing 2 changed files with 6 additions and 6 deletions Side-by-side Diff

sound/pci/oxygen/oxygen_io.c
... ... @@ -197,11 +197,11 @@
197 197 {
198 198 unsigned int count;
199 199  
200   - /* should not need more than 7.68 us (24 * 320 ns) */
  200 + /* should not need more than 30.72 us (24 * 1.28 us) */
201 201 count = 10;
202 202 while ((oxygen_read8(chip, OXYGEN_SPI_CONTROL) & OXYGEN_SPI_BUSY)
203 203 && count > 0) {
204   - udelay(1);
  204 + udelay(4);
205 205 --count;
206 206 }
207 207  
sound/pci/oxygen/oxygen_regs.h
... ... @@ -238,11 +238,11 @@
238 238 #define OXYGEN_SPI_DATA_LENGTH_MASK 0x02
239 239 #define OXYGEN_SPI_DATA_LENGTH_2 0x00
240 240 #define OXYGEN_SPI_DATA_LENGTH_3 0x02
241   -#define OXYGEN_SPI_CLOCK_MASK 0xc0
  241 +#define OXYGEN_SPI_CLOCK_MASK 0x0c
242 242 #define OXYGEN_SPI_CLOCK_160 0x00 /* ns */
243   -#define OXYGEN_SPI_CLOCK_320 0x40
244   -#define OXYGEN_SPI_CLOCK_640 0x80
245   -#define OXYGEN_SPI_CLOCK_1280 0xc0
  243 +#define OXYGEN_SPI_CLOCK_320 0x04
  244 +#define OXYGEN_SPI_CLOCK_640 0x08
  245 +#define OXYGEN_SPI_CLOCK_1280 0x0c
246 246 #define OXYGEN_SPI_CODEC_MASK 0x70 /* 0..5 */
247 247 #define OXYGEN_SPI_CODEC_SHIFT 4
248 248 #define OXYGEN_SPI_CEN_MASK 0x80