]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ALSA: oxygen: add probe callback
authorClemens Ladisch <clemens@ladisch.de>
Mon, 22 Sep 2008 06:56:01 +0000 (08:56 +0200)
committerClemens Ladisch <clemens@ladisch.de>
Mon, 22 Sep 2008 06:56:01 +0000 (08:56 +0200)
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>
sound/pci/oxygen/hifier.c
sound/pci/oxygen/oxygen.c
sound/pci/oxygen/oxygen.h
sound/pci/oxygen/oxygen_lib.c
sound/pci/oxygen/virtuoso.c

index dad393ae040a2dc474f638ff8e95817bed95ed57..173d6dddc937de3e947cf405b3d1cb9a3e164bd8 100644 (file)
@@ -180,7 +180,7 @@ static int __devinit hifier_probe(struct pci_dev *pci,
                ++dev;
                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)
                ++dev;
        return err;
index c5829d30ef8640519becefaa8a2f2ca130523297..4722fe08dca87ae7198e5efd0b5569b58618e8fd 100644 (file)
@@ -354,7 +354,8 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci,
        }
        is_meridian = pci_id->driver_data;
        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)
                ++dev;
        return err;
index 5f3fbf802222acda40ec853b9e68215aeee42df8..914b8f406b149ab68a4b72108b16c8cc33975533 100644 (file)
@@ -58,6 +58,7 @@ struct oxygen_model {
        const char *longname;
        const char *chip;
        struct module *owner;
+       int (*probe)(struct oxygen *chip, unsigned long driver_data);
        void (*init)(struct oxygen *chip);
        int (*control_filter)(struct snd_kcontrol_new *template);
        int (*mixer_init)(struct oxygen *chip);
@@ -125,7 +126,8 @@ struct oxygen {
 /* oxygen_lib.c */
 
 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);
 #ifdef CONFIG_PM
 int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state);
index 07b0563cc903e39d6ac173502380d834d545c24a..58bbc010ed89c2f9bc3921af0f740cb0923b494c 100644 (file)
@@ -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,
-                    const struct oxygen_model *model)
+                    const struct oxygen_model *model,
+                    unsigned long driver_data)
 {
        struct snd_card *card;
        struct oxygen *chip;
@@ -470,6 +471,11 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
        snd_card_set_dev(card, &pci->dev);
        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);
        chip->model.init(chip);
 
index 01d7b75f91828144f16c33b4ce81fb4e47ce7438..4aa2857a1b05b6fecc35730b7a4d4eae9ef0c7a2 100644 (file)
@@ -696,7 +696,7 @@ static int __devinit xonar_probe(struct pci_dev *pci,
                return -ENOENT;
        }
        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)
                ++dev;
        return err;