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>
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h
index c500d48..bd615db 100644
--- a/sound/pci/oxygen/oxygen.h
+++ b/sound/pci/oxygen/oxygen.h
@@ -18,6 +18,8 @@
 
 #define OXYGEN_IO_SIZE	0x100
 
+#define OXYGEN_EEPROM_ID	0x434d	/* "CM" */
+
 /* model-specific configuration of outputs/inputs */
 #define PLAYBACK_0_TO_I2S	0x0001
      /* PLAYBACK_0_TO_AC97_0		not implemented */
@@ -190,6 +192,7 @@
 void oxygen_write_uart(struct oxygen *chip, u8 data);
 
 u16 oxygen_read_eeprom(struct oxygen *chip, unsigned int index);
+void oxygen_write_eeprom(struct oxygen *chip, unsigned int index, u16 value);
 
 static inline void oxygen_set_bits8(struct oxygen *chip,
 				    unsigned int reg, u8 value)