ALSA: lola - Add Lola-specific module options
authorTakashi Iwai <tiwai@suse.de>
Tue, 3 May 2011 14:48:59 +0000 (16:48 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 3 May 2011 14:48:59 +0000 (16:48 +0200)
Added granularity and sample_rate_min module options.

The former controls the h/w access granularity.  As default, it's set
to the max value 32.

The latter controls the minimum sample rate in Hz, as default 16000.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/lola/lola.c

index 4d82215..7c13ace 100644 (file)
@@ -32,6 +32,7 @@
 #include <sound/initval.h>
 #include "lola.h"
 
+/* Standard options */
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
@@ -43,6 +44,28 @@ MODULE_PARM_DESC(id, "ID string for Digigram Lola driver.");
 module_param_array(enable, bool, NULL, 0444);
 MODULE_PARM_DESC(enable, "Enable Digigram Lola driver.");
 
+/* Lola-specific options */
+
+/* for instance use always max granularity which is compatible
+ * with all sample rates
+ */
+static int granularity[SNDRV_CARDS] = {
+       [0 ... (SNDRV_CARDS - 1)] = LOLA_GRANULARITY_MAX
+};
+
+/* below a sample_rate of 16kHz the analogue audio quality is NOT excellent */
+static int sample_rate_min[SNDRV_CARDS] = {
+       [0 ... (SNDRV_CARDS - 1) ] = 16000
+};
+
+module_param_array(granularity, int, NULL, 0444);
+MODULE_PARM_DESC(granularity, "Granularity value");
+module_param_array(sample_rate_min, int, NULL, 0444);
+MODULE_PARM_DESC(sample_rate_min, "Minimal sample rate");
+
+/*
+ */
+
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{Digigram, Lola}}");
 MODULE_DESCRIPTION("Digigram Lola driver");
@@ -536,7 +559,7 @@ static int lola_dev_free(struct snd_device *device)
 }
 
 static int __devinit lola_create(struct snd_card *card, struct pci_dev *pci,
-                                struct lola **rchip)
+                                int dev, struct lola **rchip)
 {
        struct lola *chip;
        int err;
@@ -564,14 +587,16 @@ static int __devinit lola_create(struct snd_card *card, struct pci_dev *pci,
        chip->pci = pci;
        chip->irq = -1;
 
-       /* below a sample_rate of 16kHz the analogue audio quality
-        * is NOT excellent
-        */
-       chip->sample_rate_min = 16000;
-       /* for instance use always max granularity which is compatible
-        * with all sample rates
-        */
-       chip->granularity = LOLA_GRANULARITY_MAX;
+       chip->sample_rate_min = sample_rate_min[dev];
+
+       chip->granularity = granularity[dev];
+       /* FIXME */
+       if (chip->granularity != LOLA_GRANULARITY_MAX) {
+               snd_printk(KERN_WARNING SFX
+                          "Only %d granularity is supported for now\n",
+                          LOLA_GRANULARITY_MAX);
+               chip->granularity = LOLA_GRANULARITY_MAX;
+       }
 
        err = pci_request_regions(pci, DRVNAME);
        if (err < 0) {
@@ -674,7 +699,7 @@ static int __devinit lola_probe(struct pci_dev *pci,
 
        snd_card_set_dev(card, &pci->dev);
 
-       err = lola_create(card, pci, &chip);
+       err = lola_create(card, pci, dev, &chip);
        if (err < 0)
                goto out_free;
        card->private_data = chip;