diff options
author | Clemens Ladisch | 2009-02-19 08:42:44 +0100 |
---|---|---|
committer | Takashi Iwai | 2009-02-19 10:22:25 +0100 |
commit | 30459d7b1843cbdea56ca120c8cac10dc5613e90 (patch) | |
tree | 47341d43931193917c28dab16eaf7e1a12b2b6d6 /sound/pci/oxygen/oxygen_io.c | |
parent | a69bb3c3fe0881d986ec78e253cb8a6bb9c28230 (diff) |
sound: oxygen: handle cards with broken EEPROM
Under as yet unknown circumstances, the first word of the sound card's
EEPROM gets overwritten. When this has happened, we cannot rely on the
subsystem IDs that the kernel reads from the PCI configuration
registers. Instead, we read the IDs directly from the EEPROM and do the
ID matching manually.
Because the model-specific driver cannot determine the model before
calling oxygen_pci_probe(), that function now gets a get_model()
callback as parameter. The customizing of the model structure, which
was formerly done by the probe() callback, also has moved into
get_model().
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/oxygen/oxygen_io.c')
-rw-r--r-- | sound/pci/oxygen/oxygen_io.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c index 3126c4b403dd..05f48ef1a442 100644 --- a/sound/pci/oxygen/oxygen_io.c +++ b/sound/pci/oxygen/oxygen_io.c @@ -254,3 +254,18 @@ void oxygen_write_uart(struct oxygen *chip, u8 data) _write_uart(chip, 0, data); } EXPORT_SYMBOL(oxygen_write_uart); + +u16 oxygen_read_eeprom(struct oxygen *chip, unsigned int index) +{ + unsigned int timeout; + + oxygen_write8(chip, OXYGEN_EEPROM_CONTROL, + index | OXYGEN_EEPROM_DIR_READ); + for (timeout = 0; timeout < 100; ++timeout) { + udelay(1); + if (!(oxygen_read8(chip, OXYGEN_EEPROM_STATUS) + & OXYGEN_EEPROM_BUSY)) + break; + } + return oxygen_read16(chip, OXYGEN_EEPROM_DATA); +} |