sound: oxygen: automatically restore overwritten EEPROM

If the EEPROM was partially overwritten (which seems to happen before the OS is
booted), restore its entire contents by deducing it from the remaining
information.

This does not have any effect on the Linux driver, which works even with
incomplete information in the EEPROM, but it makes other drivers work again.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Clemens Ladisch
2009-02-19 08:44:12 +01:00
committed by Takashi Iwai
부모 30459d7b18
커밋 1275d6f608
3개의 변경된 파일48개의 추가작업 그리고 0개의 파일을 삭제

파일 보기

@@ -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");
}