Commit 568c59e7 authored by Clemens Ladisch's avatar Clemens Ladisch

ALSA: oxygen: add probe callback

Add a probe callback to the model structure so that model-specific
drivers can refine their model detection before the card is initialized.
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
parent 9bd6a73a
...@@ -180,7 +180,7 @@ static int __devinit hifier_probe(struct pci_dev *pci, ...@@ -180,7 +180,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], &model_hifier); err = oxygen_pci_probe(pci, index[dev], id[dev], &model_hifier, 0);
if (err >= 0) if (err >= 0)
++dev; ++dev;
return err; return err;
......
...@@ -354,7 +354,8 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci, ...@@ -354,7 +354,8 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci,
} }
is_meridian = pci_id->driver_data; is_meridian = pci_id->driver_data;
err = oxygen_pci_probe(pci, index[dev], id[dev], err = oxygen_pci_probe(pci, index[dev], id[dev],
is_meridian ? &model_meridian : &model_generic); is_meridian ? &model_meridian : &model_generic,
0);
if (err >= 0) if (err >= 0)
++dev; ++dev;
return err; return err;
......
...@@ -58,6 +58,7 @@ struct oxygen_model { ...@@ -58,6 +58,7 @@ struct oxygen_model {
const char *longname; const char *longname;
const char *chip; const char *chip;
struct module *owner; struct module *owner;
int (*probe)(struct oxygen *chip, unsigned long driver_data);
void (*init)(struct oxygen *chip); void (*init)(struct oxygen *chip);
int (*control_filter)(struct snd_kcontrol_new *template); int (*control_filter)(struct snd_kcontrol_new *template);
int (*mixer_init)(struct oxygen *chip); int (*mixer_init)(struct oxygen *chip);
...@@ -125,7 +126,8 @@ struct oxygen { ...@@ -125,7 +126,8 @@ struct oxygen {
/* oxygen_lib.c */ /* oxygen_lib.c */
int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
const struct oxygen_model *model); const struct oxygen_model *model,
unsigned long driver_data);
void oxygen_pci_remove(struct pci_dev *pci); void oxygen_pci_remove(struct pci_dev *pci);
#ifdef CONFIG_PM #ifdef CONFIG_PM
int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state); int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state);
......
...@@ -424,7 +424,8 @@ static void oxygen_card_free(struct snd_card *card) ...@@ -424,7 +424,8 @@ 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,
const struct oxygen_model *model) const struct oxygen_model *model,
unsigned long driver_data)
{ {
struct snd_card *card; struct snd_card *card;
struct oxygen *chip; struct oxygen *chip;
...@@ -470,6 +471,11 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, ...@@ -470,6 +471,11 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
snd_card_set_dev(card, &pci->dev); snd_card_set_dev(card, &pci->dev);
card->private_free = oxygen_card_free; card->private_free = oxygen_card_free;
if (chip->model.probe) {
err = chip->model.probe(chip, driver_data);
if (err < 0)
goto err_card;
}
oxygen_init(chip); oxygen_init(chip);
chip->model.init(chip); chip->model.init(chip);
......
...@@ -696,7 +696,7 @@ static int __devinit xonar_probe(struct pci_dev *pci, ...@@ -696,7 +696,7 @@ static int __devinit xonar_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
err = oxygen_pci_probe(pci, index[dev], id[dev], err = oxygen_pci_probe(pci, index[dev], id[dev],
&xonar_models[pci_id->driver_data]); &xonar_models[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