[ALSA] oxygen: move MIDI flag to model struct

Put the flag that enables the MIDI port into the model structure instead
of passing it as a separate parameter to oxygen_pci_probe().

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Clemens Ladisch 2008-03-19 08:20:59 +01:00 committed by Takashi Iwai
parent 87eedd2fd4
commit db12b8e301
5 changed files with 13 additions and 10 deletions

View file

@ -181,7 +181,7 @@ static int __devinit hifier_probe(struct pci_dev *pci,
++dev; ++dev;
return -ENOENT; return -ENOENT;
} }
err = oxygen_pci_probe(pci, index[dev], id[dev], 0, &model_hifier); err = oxygen_pci_probe(pci, index[dev], id[dev], &model_hifier);
if (err >= 0) if (err >= 0)
++dev; ++dev;
return err; return err;

View file

@ -336,6 +336,7 @@ static const struct oxygen_model model_meridian = {
CAPTURE_1_FROM_SPDIF | CAPTURE_1_FROM_SPDIF |
CAPTURE_2_FROM_AC97_1, CAPTURE_2_FROM_AC97_1,
.dac_channels = 8, .dac_channels = 8,
.misc_flags = OXYGEN_MISC_MIDI,
.function_flags = OXYGEN_FUNCTION_SPI | .function_flags = OXYGEN_FUNCTION_SPI |
OXYGEN_FUNCTION_ENABLE_SPI_4_5, OXYGEN_FUNCTION_ENABLE_SPI_4_5,
.dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
@ -356,7 +357,7 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
is_meridian = pci_id->driver_data; is_meridian = pci_id->driver_data;
err = oxygen_pci_probe(pci, index[dev], id[dev], is_meridian, err = oxygen_pci_probe(pci, index[dev], id[dev],
is_meridian ? &model_meridian : &model_generic); is_meridian ? &model_meridian : &model_generic);
if (err >= 0) if (err >= 0)
++dev; ++dev;

View file

@ -103,6 +103,7 @@ struct oxygen_model {
size_t model_data_size; size_t model_data_size;
unsigned int pcm_dev_cfg; unsigned int pcm_dev_cfg;
u8 dac_channels; u8 dac_channels;
u8 misc_flags;
u8 function_flags; u8 function_flags;
u16 dac_i2s_format; u16 dac_i2s_format;
u16 adc_i2s_format; u16 adc_i2s_format;
@ -110,7 +111,7 @@ struct oxygen_model {
/* oxygen_lib.c */ /* oxygen_lib.c */
int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, int midi, int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
const struct oxygen_model *model); const struct oxygen_model *model);
void oxygen_pci_remove(struct pci_dev *pci); void oxygen_pci_remove(struct pci_dev *pci);

View file

@ -253,11 +253,13 @@ static void oxygen_init(struct oxygen *chip)
OXYGEN_DMA_A_BURST_8 | OXYGEN_DMA_A_BURST_8 |
OXYGEN_DMA_MULTICH_BURST_8); OXYGEN_DMA_MULTICH_BURST_8);
oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, 0); oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, 0);
oxygen_write8_masked(chip, OXYGEN_MISC, 0, oxygen_write8_masked(chip, OXYGEN_MISC,
chip->model->misc_flags,
OXYGEN_MISC_WRITE_PCI_SUBID | OXYGEN_MISC_WRITE_PCI_SUBID |
OXYGEN_MISC_REC_C_FROM_SPDIF | OXYGEN_MISC_REC_C_FROM_SPDIF |
OXYGEN_MISC_REC_B_FROM_AC97 | OXYGEN_MISC_REC_B_FROM_AC97 |
OXYGEN_MISC_REC_A_FROM_MULTICH); OXYGEN_MISC_REC_A_FROM_MULTICH |
OXYGEN_MISC_MIDI);
oxygen_write8(chip, OXYGEN_REC_FORMAT, oxygen_write8(chip, OXYGEN_REC_FORMAT,
(OXYGEN_FORMAT_16 << OXYGEN_REC_FORMAT_A_SHIFT) | (OXYGEN_FORMAT_16 << OXYGEN_REC_FORMAT_A_SHIFT) |
(OXYGEN_FORMAT_16 << OXYGEN_REC_FORMAT_B_SHIFT) | (OXYGEN_FORMAT_16 << OXYGEN_REC_FORMAT_B_SHIFT) |
@ -400,7 +402,7 @@ static void oxygen_card_free(struct snd_card *card)
} }
int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
int midi, const struct oxygen_model *model) const struct oxygen_model *model)
{ {
struct snd_card *card; struct snd_card *card;
struct oxygen *chip; struct oxygen *chip;
@ -472,9 +474,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
if (err < 0) if (err < 0)
goto err_card; goto err_card;
oxygen_write8_masked(chip, OXYGEN_MISC, if (model->misc_flags & OXYGEN_MISC_MIDI) {
midi ? OXYGEN_MISC_MIDI : 0, OXYGEN_MISC_MIDI);
if (midi) {
err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI, err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI,
chip->addr + OXYGEN_MPU401, chip->addr + OXYGEN_MPU401,
MPU401_INFO_INTEGRATED, 0, 0, MPU401_INFO_INTEGRATED, 0, 0,

View file

@ -353,6 +353,7 @@ static const struct oxygen_model model_xonar = {
CAPTURE_0_FROM_I2S_2 | CAPTURE_0_FROM_I2S_2 |
CAPTURE_1_FROM_SPDIF, CAPTURE_1_FROM_SPDIF,
.dac_channels = 8, .dac_channels = 8,
.misc_flags = OXYGEN_MISC_MIDI,
.function_flags = OXYGEN_FUNCTION_SPI | .function_flags = OXYGEN_FUNCTION_SPI |
OXYGEN_FUNCTION_ENABLE_SPI_4_5, OXYGEN_FUNCTION_ENABLE_SPI_4_5,
.dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
@ -371,7 +372,7 @@ static int __devinit xonar_probe(struct pci_dev *pci,
++dev; ++dev;
return -ENOENT; return -ENOENT;
} }
err = oxygen_pci_probe(pci, index[dev], id[dev], 1, &model_xonar); err = oxygen_pci_probe(pci, index[dev], id[dev], &model_xonar);
if (err >= 0) if (err >= 0)
++dev; ++dev;
return err; return err;