diff options
Diffstat (limited to 'sound/pci/oxygen')
-rw-r--r-- | sound/pci/oxygen/oxygen.h | 1 | ||||
-rw-r--r-- | sound/pci/oxygen/oxygen_io.c | 23 |
2 files changed, 22 insertions, 2 deletions
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index 2f25c8dbaf85..d53c18c6fcd8 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h | |||
@@ -146,6 +146,7 @@ void oxygen_write_ac97_masked(struct oxygen *chip, unsigned int codec, | |||
146 | unsigned int index, u16 data, u16 mask); | 146 | unsigned int index, u16 data, u16 mask); |
147 | 147 | ||
148 | void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data); | 148 | void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data); |
149 | void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data); | ||
149 | 150 | ||
150 | static inline void oxygen_set_bits8(struct oxygen *chip, | 151 | static inline void oxygen_set_bits8(struct oxygen *chip, |
151 | unsigned int reg, u8 value) | 152 | unsigned int reg, u8 value) |
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); | ||