diff options
Diffstat (limited to 'sound/pci/oxygen/oxygen_io.c')
| -rw-r--r-- | sound/pci/oxygen/oxygen_io.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c index 74e23ef9c946..5569606ee87f 100644 --- a/sound/pci/oxygen/oxygen_io.c +++ b/sound/pci/oxygen/oxygen_io.c | |||
| @@ -190,12 +190,31 @@ void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data) | |||
| 190 | --count; | 190 | --count; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | spin_lock_irq(&chip->reg_lock); | ||
| 194 | oxygen_write8(chip, OXYGEN_SPI_DATA1, data); | 193 | oxygen_write8(chip, OXYGEN_SPI_DATA1, data); |
| 195 | oxygen_write8(chip, OXYGEN_SPI_DATA2, data >> 8); | 194 | oxygen_write8(chip, OXYGEN_SPI_DATA2, data >> 8); |
| 196 | if (control & OXYGEN_SPI_DATA_LENGTH_3) | 195 | if (control & OXYGEN_SPI_DATA_LENGTH_3) |
| 197 | oxygen_write8(chip, OXYGEN_SPI_DATA3, data >> 16); | 196 | oxygen_write8(chip, OXYGEN_SPI_DATA3, data >> 16); |
| 198 | oxygen_write8(chip, OXYGEN_SPI_CONTROL, control); | 197 | oxygen_write8(chip, OXYGEN_SPI_CONTROL, control); |
| 199 | spin_unlock_irq(&chip->reg_lock); | ||
| 200 | } | 198 | } |
| 201 | EXPORT_SYMBOL(oxygen_write_spi); | 199 | EXPORT_SYMBOL(oxygen_write_spi); |
| 200 | |||
| 201 | void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data) | ||
| 202 | { | ||
| 203 | unsigned long timeout; | ||
| 204 | |||
| 205 | /* should not need more than about 300 us */ | ||
| 206 | timeout = jiffies + msecs_to_jiffies(1); | ||
| 207 | do { | ||
| 208 | if (!(oxygen_read16(chip, OXYGEN_2WIRE_BUS_STATUS) | ||
| 209 | & OXYGEN_2WIRE_BUSY)) | ||
| 210 | break; | ||
| 211 | udelay(1); | ||
| 212 | cond_resched(); | ||
| 213 | } while (time_after_eq(timeout, jiffies)); | ||
| 214 | |||
| 215 | oxygen_write8(chip, OXYGEN_2WIRE_MAP, map); | ||
| 216 | oxygen_write8(chip, OXYGEN_2WIRE_DATA, data); | ||
| 217 | oxygen_write8(chip, OXYGEN_2WIRE_CONTROL, | ||
| 218 | device | OXYGEN_2WIRE_DIR_WRITE); | ||
| 219 | } | ||
| 220 | EXPORT_SYMBOL(oxygen_write_i2c); | ||
