aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2008-09-22 02:56:01 -0400
committerClemens Ladisch <clemens@ladisch.de>2008-09-22 02:56:01 -0400
commit568c59e722da22c9b0a485c2f1aaf28cb1b36b79 (patch)
tree295bdb15737e938992a9cd01450be516276b0ccd
parent9bd6a73aef955216816fd6e28f371a868ed073d5 (diff)
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: Clemens Ladisch <clemens@ladisch.de>
-rw-r--r--sound/pci/oxygen/hifier.c2
-rw-r--r--sound/pci/oxygen/oxygen.c3
-rw-r--r--sound/pci/oxygen/oxygen.h4
-rw-r--r--sound/pci/oxygen/oxygen_lib.c8
-rw-r--r--sound/pci/oxygen/virtuoso.c2
5 files changed, 14 insertions, 5 deletions
diff --git a/sound/pci/oxygen/hifier.c b/sound/pci/oxygen/hifier.c
index dad393ae040a..173d6dddc937 100644
--- a/sound/pci/oxygen/hifier.c
+++ b/sound/pci/oxygen/hifier.c
@@ -180,7 +180,7 @@ static int __devinit hifier_probe(struct pci_dev *pci,
180 ++dev; 180 ++dev;
181 return -ENOENT; 181 return -ENOENT;
182 } 182 }
183 err = oxygen_pci_probe(pci, index[dev], id[dev], &model_hifier); 183 err = oxygen_pci_probe(pci, index[dev], id[dev], &model_hifier, 0);
184 if (err >= 0) 184 if (err >= 0)
185 ++dev; 185 ++dev;
186 return err; 186 return err;
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index c5829d30ef86..4722fe08dca8 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -354,7 +354,8 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci,
354 } 354 }
355 is_meridian = pci_id->driver_data; 355 is_meridian = pci_id->driver_data;
356 err = oxygen_pci_probe(pci, index[dev], id[dev], 356 err = oxygen_pci_probe(pci, index[dev], id[dev],
357 is_meridian ? &model_meridian : &model_generic); 357 is_meridian ? &model_meridian : &model_generic,
358 0);
358 if (err >= 0) 359 if (err >= 0)
359 ++dev; 360 ++dev;
360 return err; 361 return err;
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h
index 5f3fbf802222..914b8f406b14 100644
--- a/sound/pci/oxygen/oxygen.h
+++ b/sound/pci/oxygen/oxygen.h
@@ -58,6 +58,7 @@ struct oxygen_model {
58 const char *longname; 58 const char *longname;
59 const char *chip; 59 const char *chip;
60 struct module *owner; 60 struct module *owner;
61 int (*probe)(struct oxygen *chip, unsigned long driver_data);
61 void (*init)(struct oxygen *chip); 62 void (*init)(struct oxygen *chip);
62 int (*control_filter)(struct snd_kcontrol_new *template); 63 int (*control_filter)(struct snd_kcontrol_new *template);
63 int (*mixer_init)(struct oxygen *chip); 64 int (*mixer_init)(struct oxygen *chip);
@@ -125,7 +126,8 @@ struct oxygen {
125/* oxygen_lib.c */ 126/* oxygen_lib.c */
126 127
127int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, 128int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
128 const struct oxygen_model *model); 129 const struct oxygen_model *model,
130 unsigned long driver_data);
129void oxygen_pci_remove(struct pci_dev *pci); 131void oxygen_pci_remove(struct pci_dev *pci);
130#ifdef CONFIG_PM 132#ifdef CONFIG_PM
131int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state); 133int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state);
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index 07b0563cc903..58bbc010ed89 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -424,7 +424,8 @@ static void oxygen_card_free(struct snd_card *card)
424} 424}
425 425
426int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, 426int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
427 const struct oxygen_model *model) 427 const struct oxygen_model *model,
428 unsigned long driver_data)
428{ 429{
429 struct snd_card *card; 430 struct snd_card *card;
430 struct oxygen *chip; 431 struct oxygen *chip;
@@ -470,6 +471,11 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
470 snd_card_set_dev(card, &pci->dev); 471 snd_card_set_dev(card, &pci->dev);
471 card->private_free = oxygen_card_free; 472 card->private_free = oxygen_card_free;
472 473
474 if (chip->model.probe) {
475 err = chip->model.probe(chip, driver_data);
476 if (err < 0)
477 goto err_card;
478 }
473 oxygen_init(chip); 479 oxygen_init(chip);
474 chip->model.init(chip); 480 chip->model.init(chip);
475 481
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 01d7b75f9182..4aa2857a1b05 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -696,7 +696,7 @@ static int __devinit xonar_probe(struct pci_dev *pci,
696 return -ENOENT; 696 return -ENOENT;
697 } 697 }
698 err = oxygen_pci_probe(pci, index[dev], id[dev], 698 err = oxygen_pci_probe(pci, index[dev], id[dev],
699 &xonar_models[pci_id->driver_data]); 699 &xonar_models[pci_id->driver_data], 0);
700 if (err >= 0) 700 if (err >= 0)
701 ++dev; 701 ++dev;
702 return err; 702 return err;