aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/oxygen/oxygen_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/oxygen/oxygen_io.c')
-rw-r--r--sound/pci/oxygen/oxygen_io.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c
index 05f48ef1a44..c1eb923f2ac 100644
--- a/sound/pci/oxygen/oxygen_io.c
+++ b/sound/pci/oxygen/oxygen_io.c
@@ -269,3 +269,19 @@ u16 oxygen_read_eeprom(struct oxygen *chip, unsigned int index)
}
return oxygen_read16(chip, OXYGEN_EEPROM_DATA);
}
+
+void oxygen_write_eeprom(struct oxygen *chip, unsigned int index, u16 value)
+{
+ unsigned int timeout;
+
+ oxygen_write16(chip, OXYGEN_EEPROM_DATA, value);
+ oxygen_write8(chip, OXYGEN_EEPROM_CONTROL,
+ index | OXYGEN_EEPROM_DIR_WRITE);
+ for (timeout = 0; timeout < 10; ++timeout) {
+ msleep(1);
+ if (!(oxygen_read8(chip, OXYGEN_EEPROM_STATUS)
+ & OXYGEN_EEPROM_BUSY))
+ return;
+ }
+ snd_printk(KERN_ERR "EEPROM write timeout\n");
+}