diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2009-02-19 02:42:44 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-02-19 04:22:25 -0500 |
commit | 30459d7b1843cbdea56ca120c8cac10dc5613e90 (patch) | |
tree | 47341d43931193917c28dab16eaf7e1a12b2b6d6 /sound/pci/oxygen/oxygen.h | |
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.h')
-rw-r--r-- | sound/pci/oxygen/oxygen.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index 268bff4f29d2..c500d48ea349 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h | |||
@@ -49,7 +49,13 @@ enum { | |||
49 | .subvendor = sv, \ | 49 | .subvendor = sv, \ |
50 | .subdevice = sd | 50 | .subdevice = sd |
51 | 51 | ||
52 | #define BROKEN_EEPROM_DRIVER_DATA ((unsigned long)-1) | ||
53 | #define OXYGEN_PCI_SUBID_BROKEN_EEPROM \ | ||
54 | OXYGEN_PCI_SUBID(PCI_VENDOR_ID_CMEDIA, 0x8788), \ | ||
55 | .driver_data = BROKEN_EEPROM_DRIVER_DATA | ||
56 | |||
52 | struct pci_dev; | 57 | struct pci_dev; |
58 | struct pci_device_id; | ||
53 | struct snd_card; | 59 | struct snd_card; |
54 | struct snd_pcm_substream; | 60 | struct snd_pcm_substream; |
55 | struct snd_pcm_hardware; | 61 | struct snd_pcm_hardware; |
@@ -62,7 +68,6 @@ struct oxygen_model { | |||
62 | const char *shortname; | 68 | const char *shortname; |
63 | const char *longname; | 69 | const char *longname; |
64 | const char *chip; | 70 | const char *chip; |
65 | int (*probe)(struct oxygen *chip, unsigned long driver_data); | ||
66 | void (*init)(struct oxygen *chip); | 71 | void (*init)(struct oxygen *chip); |
67 | int (*control_filter)(struct snd_kcontrol_new *template); | 72 | int (*control_filter)(struct snd_kcontrol_new *template); |
68 | int (*mixer_init)(struct oxygen *chip); | 73 | int (*mixer_init)(struct oxygen *chip); |
@@ -82,6 +87,7 @@ struct oxygen_model { | |||
82 | void (*ac97_switch)(struct oxygen *chip, | 87 | void (*ac97_switch)(struct oxygen *chip, |
83 | unsigned int reg, unsigned int mute); | 88 | unsigned int reg, unsigned int mute); |
84 | const unsigned int *dac_tlv; | 89 | const unsigned int *dac_tlv; |
90 | unsigned long private_data; | ||
85 | size_t model_data_size; | 91 | size_t model_data_size; |
86 | unsigned int device_config; | 92 | unsigned int device_config; |
87 | u8 dac_channels; | 93 | u8 dac_channels; |
@@ -134,8 +140,11 @@ struct oxygen { | |||
134 | 140 | ||
135 | int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, | 141 | int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, |
136 | struct module *owner, | 142 | struct module *owner, |
137 | const struct oxygen_model *model, | 143 | const struct pci_device_id *ids, |
138 | unsigned long driver_data); | 144 | int (*get_model)(struct oxygen *chip, |
145 | const struct pci_device_id *id | ||
146 | ) | ||
147 | ); | ||
139 | void oxygen_pci_remove(struct pci_dev *pci); | 148 | void oxygen_pci_remove(struct pci_dev *pci); |
140 | #ifdef CONFIG_PM | 149 | #ifdef CONFIG_PM |
141 | int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state); | 150 | int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state); |
@@ -180,6 +189,8 @@ void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data); | |||
180 | void oxygen_reset_uart(struct oxygen *chip); | 189 | void oxygen_reset_uart(struct oxygen *chip); |
181 | void oxygen_write_uart(struct oxygen *chip, u8 data); | 190 | void oxygen_write_uart(struct oxygen *chip, u8 data); |
182 | 191 | ||
192 | u16 oxygen_read_eeprom(struct oxygen *chip, unsigned int index); | ||
193 | |||
183 | static inline void oxygen_set_bits8(struct oxygen *chip, | 194 | static inline void oxygen_set_bits8(struct oxygen *chip, |
184 | unsigned int reg, u8 value) | 195 | unsigned int reg, u8 value) |
185 | { | 196 | { |