Commit 4bd0c3a6 authored by Clemens Ladisch's avatar Clemens Ladisch

ALSA: oxygen: handle X-Meridian dynamically

Handle the differences between the X-Meridian and the other models in
the probe callback instead of using a second model structure.
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
parent 2f1b0ec7
...@@ -286,11 +286,27 @@ static void set_ak5385_params(struct oxygen *chip, ...@@ -286,11 +286,27 @@ static void set_ak5385_params(struct oxygen *chip,
static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
static int generic_probe(struct oxygen *chip, unsigned long driver_data)
{
if (driver_data == MODEL_MERIDIAN) {
chip->model.init = meridian_init;
chip->model.resume = ak4396_registers_init;
chip->model.set_adc_params = set_ak5385_params;
chip->model.pcm_dev_cfg = PLAYBACK_0_TO_I2S |
PLAYBACK_1_TO_SPDIF |
CAPTURE_0_FROM_I2S_2 |
CAPTURE_1_FROM_SPDIF;
chip->model.misc_flags = OXYGEN_MISC_MIDI;
}
return 0;
}
static const struct oxygen_model model_generic = { static const struct oxygen_model model_generic = {
.shortname = "C-Media CMI8788", .shortname = "C-Media CMI8788",
.longname = "C-Media Oxygen HD Audio", .longname = "C-Media Oxygen HD Audio",
.chip = "CMI8788", .chip = "CMI8788",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.probe = generic_probe,
.init = generic_init, .init = generic_init,
.cleanup = generic_cleanup, .cleanup = generic_cleanup,
.resume = generic_resume, .resume = generic_resume,
...@@ -314,41 +330,11 @@ static const struct oxygen_model model_generic = { ...@@ -314,41 +330,11 @@ static const struct oxygen_model model_generic = {
.dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
.adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
}; };
static const struct oxygen_model model_meridian = {
.shortname = "C-Media CMI8788",
.longname = "C-Media Oxygen HD Audio",
.chip = "CMI8788",
.owner = THIS_MODULE,
.init = meridian_init,
.cleanup = generic_cleanup,
.resume = ak4396_registers_init,
.set_dac_params = set_ak4396_params,
.set_adc_params = set_ak5385_params,
.update_dac_volume = update_ak4396_volume,
.update_dac_mute = update_ak4396_mute,
.dac_tlv = ak4396_db_scale,
.model_data_size = sizeof(struct generic_data),
.pcm_dev_cfg = PLAYBACK_0_TO_I2S |
PLAYBACK_1_TO_SPDIF |
PLAYBACK_2_TO_AC97_1 |
CAPTURE_0_FROM_I2S_2 |
CAPTURE_1_FROM_SPDIF |
CAPTURE_2_FROM_AC97_1,
.dac_channels = 8,
.dac_volume_min = 0,
.dac_volume_max = 255,
.misc_flags = OXYGEN_MISC_MIDI,
.function_flags = OXYGEN_FUNCTION_SPI |
OXYGEN_FUNCTION_ENABLE_SPI_4_5,
.dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
.adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
};
static int __devinit generic_oxygen_probe(struct pci_dev *pci, static int __devinit generic_oxygen_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id) const struct pci_device_id *pci_id)
{ {
static int dev; static int dev;
int is_meridian;
int err; int err;
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
...@@ -357,10 +343,8 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci, ...@@ -357,10 +343,8 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci,
++dev; ++dev;
return -ENOENT; return -ENOENT;
} }
is_meridian = pci_id->driver_data == MODEL_MERIDIAN;
err = oxygen_pci_probe(pci, index[dev], id[dev], err = oxygen_pci_probe(pci, index[dev], id[dev],
is_meridian ? &model_meridian : &model_generic, &model_generic, pci_id->driver_data);
0);
if (err >= 0) if (err >= 0)
++dev; ++dev;
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment