aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/oxygen/oxygen.c')
-rw-r--r--sound/pci/oxygen/oxygen.c92
1 files changed, 44 insertions, 48 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index c5829d30ef86..b60f6212745a 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -58,17 +58,22 @@ MODULE_PARM_DESC(id, "ID string");
58module_param_array(enable, bool, NULL, 0444); 58module_param_array(enable, bool, NULL, 0444);
59MODULE_PARM_DESC(enable, "enable card"); 59MODULE_PARM_DESC(enable, "enable card");
60 60
61enum {
62 MODEL_CMEDIA_REF, /* C-Media's reference design */
63 MODEL_MERIDIAN, /* AuzenTech X-Meridian */
64};
65
61static struct pci_device_id oxygen_ids[] __devinitdata = { 66static struct pci_device_id oxygen_ids[] __devinitdata = {
62 { OXYGEN_PCI_SUBID(0x10b0, 0x0216) }, 67 { OXYGEN_PCI_SUBID(0x10b0, 0x0216), .driver_data = MODEL_CMEDIA_REF },
63 { OXYGEN_PCI_SUBID(0x10b0, 0x0218) }, 68 { OXYGEN_PCI_SUBID(0x10b0, 0x0218), .driver_data = MODEL_CMEDIA_REF },
64 { OXYGEN_PCI_SUBID(0x10b0, 0x0219) }, 69 { OXYGEN_PCI_SUBID(0x10b0, 0x0219), .driver_data = MODEL_CMEDIA_REF },
65 { OXYGEN_PCI_SUBID(0x13f6, 0x0001) }, 70 { OXYGEN_PCI_SUBID(0x13f6, 0x0001), .driver_data = MODEL_CMEDIA_REF },
66 { OXYGEN_PCI_SUBID(0x13f6, 0x0010) }, 71 { OXYGEN_PCI_SUBID(0x13f6, 0x0010), .driver_data = MODEL_CMEDIA_REF },
67 { OXYGEN_PCI_SUBID(0x13f6, 0x8788) }, 72 { OXYGEN_PCI_SUBID(0x13f6, 0x8788), .driver_data = MODEL_CMEDIA_REF },
68 { OXYGEN_PCI_SUBID(0x147a, 0xa017) }, 73 { OXYGEN_PCI_SUBID(0x147a, 0xa017), .driver_data = MODEL_CMEDIA_REF },
69 { OXYGEN_PCI_SUBID(0x1a58, 0x0910) }, 74 { OXYGEN_PCI_SUBID(0x1a58, 0x0910), .driver_data = MODEL_CMEDIA_REF },
70 { OXYGEN_PCI_SUBID(0x415a, 0x5431), .driver_data = 1 }, 75 { OXYGEN_PCI_SUBID(0x415a, 0x5431), .driver_data = MODEL_MERIDIAN },
71 { OXYGEN_PCI_SUBID(0x7284, 0x9761) }, 76 { OXYGEN_PCI_SUBID(0x7284, 0x9761), .driver_data = MODEL_CMEDIA_REF },
72 { } 77 { }
73}; 78};
74MODULE_DEVICE_TABLE(pci, oxygen_ids); 79MODULE_DEVICE_TABLE(pci, oxygen_ids);
@@ -199,6 +204,11 @@ static void generic_resume(struct oxygen *chip)
199 wm8785_registers_init(chip); 204 wm8785_registers_init(chip);
200} 205}
201 206
207static void meridian_resume(struct oxygen *chip)
208{
209 ak4396_registers_init(chip);
210}
211
202static void set_ak4396_params(struct oxygen *chip, 212static void set_ak4396_params(struct oxygen *chip,
203 struct snd_pcm_hw_params *params) 213 struct snd_pcm_hw_params *params)
204{ 214{
@@ -281,11 +291,28 @@ static void set_ak5385_params(struct oxygen *chip,
281 291
282static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); 292static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
283 293
294static int generic_probe(struct oxygen *chip, unsigned long driver_data)
295{
296 if (driver_data == MODEL_MERIDIAN) {
297 chip->model.init = meridian_init;
298 chip->model.resume = meridian_resume;
299 chip->model.set_adc_params = set_ak5385_params;
300 chip->model.device_config = PLAYBACK_0_TO_I2S |
301 PLAYBACK_1_TO_SPDIF |
302 CAPTURE_0_FROM_I2S_2 |
303 CAPTURE_1_FROM_SPDIF;
304 chip->model.misc_flags = OXYGEN_MISC_MIDI;
305 chip->model.device_config |= MIDI_OUTPUT | MIDI_INPUT;
306 }
307 return 0;
308}
309
284static const struct oxygen_model model_generic = { 310static const struct oxygen_model model_generic = {
285 .shortname = "C-Media CMI8788", 311 .shortname = "C-Media CMI8788",
286 .longname = "C-Media Oxygen HD Audio", 312 .longname = "C-Media Oxygen HD Audio",
287 .chip = "CMI8788", 313 .chip = "CMI8788",
288 .owner = THIS_MODULE, 314 .owner = THIS_MODULE,
315 .probe = generic_probe,
289 .init = generic_init, 316 .init = generic_init,
290 .cleanup = generic_cleanup, 317 .cleanup = generic_cleanup,
291 .resume = generic_resume, 318 .resume = generic_resume,
@@ -295,44 +322,15 @@ static const struct oxygen_model model_generic = {
295 .update_dac_mute = update_ak4396_mute, 322 .update_dac_mute = update_ak4396_mute,
296 .dac_tlv = ak4396_db_scale, 323 .dac_tlv = ak4396_db_scale,
297 .model_data_size = sizeof(struct generic_data), 324 .model_data_size = sizeof(struct generic_data),
298 .pcm_dev_cfg = PLAYBACK_0_TO_I2S | 325 .device_config = PLAYBACK_0_TO_I2S |
299 PLAYBACK_1_TO_SPDIF | 326 PLAYBACK_1_TO_SPDIF |
300 PLAYBACK_2_TO_AC97_1 | 327 PLAYBACK_2_TO_AC97_1 |
301 CAPTURE_0_FROM_I2S_1 | 328 CAPTURE_0_FROM_I2S_1 |
302 CAPTURE_1_FROM_SPDIF | 329 CAPTURE_1_FROM_SPDIF |
303 CAPTURE_2_FROM_AC97_1, 330 CAPTURE_2_FROM_AC97_1,
304 .dac_channels = 8,
305 .dac_volume_min = 0,
306 .dac_volume_max = 255,
307 .function_flags = OXYGEN_FUNCTION_SPI |
308 OXYGEN_FUNCTION_ENABLE_SPI_4_5,
309 .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
310 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
311};
312static const struct oxygen_model model_meridian = {
313 .shortname = "C-Media CMI8788",
314 .longname = "C-Media Oxygen HD Audio",
315 .chip = "CMI8788",
316 .owner = THIS_MODULE,
317 .init = meridian_init,
318 .cleanup = generic_cleanup,
319 .resume = ak4396_registers_init,
320 .set_dac_params = set_ak4396_params,
321 .set_adc_params = set_ak5385_params,
322 .update_dac_volume = update_ak4396_volume,
323 .update_dac_mute = update_ak4396_mute,
324 .dac_tlv = ak4396_db_scale,
325 .model_data_size = sizeof(struct generic_data),
326 .pcm_dev_cfg = PLAYBACK_0_TO_I2S |
327 PLAYBACK_1_TO_SPDIF |
328 PLAYBACK_2_TO_AC97_1 |
329 CAPTURE_0_FROM_I2S_2 |
330 CAPTURE_1_FROM_SPDIF |
331 CAPTURE_2_FROM_AC97_1,
332 .dac_channels = 8, 331 .dac_channels = 8,
333 .dac_volume_min = 0, 332 .dac_volume_min = 0,
334 .dac_volume_max = 255, 333 .dac_volume_max = 255,
335 .misc_flags = OXYGEN_MISC_MIDI,
336 .function_flags = OXYGEN_FUNCTION_SPI | 334 .function_flags = OXYGEN_FUNCTION_SPI |
337 OXYGEN_FUNCTION_ENABLE_SPI_4_5, 335 OXYGEN_FUNCTION_ENABLE_SPI_4_5,
338 .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 336 .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
@@ -343,7 +341,6 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci,
343 const struct pci_device_id *pci_id) 341 const struct pci_device_id *pci_id)
344{ 342{
345 static int dev; 343 static int dev;
346 int is_meridian;
347 int err; 344 int err;
348 345
349 if (dev >= SNDRV_CARDS) 346 if (dev >= SNDRV_CARDS)
@@ -352,9 +349,8 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci,
352 ++dev; 349 ++dev;
353 return -ENOENT; 350 return -ENOENT;
354 } 351 }
355 is_meridian = pci_id->driver_data;
356 err = oxygen_pci_probe(pci, index[dev], id[dev], 352 err = oxygen_pci_probe(pci, index[dev], id[dev],
357 is_meridian ? &model_meridian : &model_generic); 353 &model_generic, pci_id->driver_data);
358 if (err >= 0) 354 if (err >= 0)
359 ++dev; 355 ++dev;
360 return err; 356 return err;