Commit 5ea310ff authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Takashi Iwai

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: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d2119c05
...@@ -197,11 +197,11 @@ void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data) ...@@ -197,11 +197,11 @@ void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data)
{ {
unsigned int count; unsigned int count;
/* should not need more than 7.68 us (24 * 320 ns) */ /* should not need more than 30.72 us (24 * 1.28 us) */
count = 10; count = 10;
while ((oxygen_read8(chip, OXYGEN_SPI_CONTROL) & OXYGEN_SPI_BUSY) while ((oxygen_read8(chip, OXYGEN_SPI_CONTROL) & OXYGEN_SPI_BUSY)
&& count > 0) { && count > 0) {
udelay(1); udelay(4);
--count; --count;
} }
......
...@@ -238,11 +238,11 @@ ...@@ -238,11 +238,11 @@
#define OXYGEN_SPI_DATA_LENGTH_MASK 0x02 #define OXYGEN_SPI_DATA_LENGTH_MASK 0x02
#define OXYGEN_SPI_DATA_LENGTH_2 0x00 #define OXYGEN_SPI_DATA_LENGTH_2 0x00
#define OXYGEN_SPI_DATA_LENGTH_3 0x02 #define OXYGEN_SPI_DATA_LENGTH_3 0x02
#define OXYGEN_SPI_CLOCK_MASK 0xc0 #define OXYGEN_SPI_CLOCK_MASK 0x0c
#define OXYGEN_SPI_CLOCK_160 0x00 /* ns */ #define OXYGEN_SPI_CLOCK_160 0x00 /* ns */
#define OXYGEN_SPI_CLOCK_320 0x40 #define OXYGEN_SPI_CLOCK_320 0x04
#define OXYGEN_SPI_CLOCK_640 0x80 #define OXYGEN_SPI_CLOCK_640 0x08
#define OXYGEN_SPI_CLOCK_1280 0xc0 #define OXYGEN_SPI_CLOCK_1280 0x0c
#define OXYGEN_SPI_CODEC_MASK 0x70 /* 0..5 */ #define OXYGEN_SPI_CODEC_MASK 0x70 /* 0..5 */
#define OXYGEN_SPI_CODEC_SHIFT 4 #define OXYGEN_SPI_CODEC_SHIFT 4
#define OXYGEN_SPI_CEN_MASK 0x80 #define OXYGEN_SPI_CEN_MASK 0x80
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment