]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[ALSA] oxygen: make PCM limits configurable
authorClemens Ladisch <clemens@ladisch.de>
Wed, 16 Jan 2008 07:32:53 +0000 (08:32 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 31 Jan 2008 16:30:00 +0000 (17:30 +0100)
Add a callback to the model structure to allow modification of the
hardware PCM limits.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
sound/pci/oxygen/oxygen.c
sound/pci/oxygen/oxygen.h
sound/pci/oxygen/oxygen_pcm.c

index adf91cc3e1ae5b836bdc4af69af994408577363d..f8e3fd39749d9bf79596391b539e05939404f2bc 100644 (file)
@@ -163,6 +163,18 @@ static void generic_cleanup(struct oxygen *chip)
 {
 }
 
+static void generic_pcm_hardware_filter(unsigned int channel,
+                                       struct snd_pcm_hardware *hardware)
+{
+       if (channel == PCM_A) {
+               hardware->rates = SNDRV_PCM_RATE_44100 |
+                                 SNDRV_PCM_RATE_48000 |
+                                 SNDRV_PCM_RATE_96000 |
+                                 SNDRV_PCM_RATE_192000;
+               hardware->rate_min = 44100;
+       }
+}
+
 static void set_ak4396_params(struct oxygen *chip,
                              struct snd_pcm_hw_params *params)
 {
@@ -262,6 +274,7 @@ static const struct oxygen_model model_generic = {
        .init = generic_init,
        .control_filter = ak4396_control_filter,
        .cleanup = generic_cleanup,
+       .pcm_hardware_filter = generic_pcm_hardware_filter,
        .set_dac_params = set_ak4396_params,
        .set_adc_params = set_wm8785_params,
        .update_dac_volume = update_ak4396_volume,
index 7278c1563597f516c98f4645684b7a35855c36ce..602105ce2947b2728393a693005d17a5f73aa399 100644 (file)
@@ -34,6 +34,7 @@ enum {
 struct pci_dev;
 struct snd_card;
 struct snd_pcm_substream;
+struct snd_pcm_hardware;
 struct snd_pcm_hw_params;
 struct snd_kcontrol_new;
 struct snd_rawmidi;
@@ -75,6 +76,8 @@ struct oxygen_model {
        int (*control_filter)(struct snd_kcontrol_new *template);
        int (*mixer_init)(struct oxygen *chip);
        void (*cleanup)(struct oxygen *chip);
+       void (*pcm_hardware_filter)(unsigned int channel,
+                                   struct snd_pcm_hardware *hardware);
        void (*set_dac_params)(struct oxygen *chip,
                               struct snd_pcm_hw_params *params);
        void (*set_adc_params)(struct oxygen *chip,
index 5f15d355a4311fd00c6eaea22c752d1f3b4520dc..5515c757ec4bf6aa709dbece192e6557bc8f9c05 100644 (file)
@@ -33,11 +33,15 @@ static struct snd_pcm_hardware oxygen_hardware[PCM_COUNT] = {
                        SNDRV_PCM_INFO_SYNC_START,
                .formats = SNDRV_PCM_FMTBIT_S16_LE |
                           SNDRV_PCM_FMTBIT_S32_LE,
-               .rates = SNDRV_PCM_RATE_44100 |
+               .rates = SNDRV_PCM_RATE_32000 |
+                        SNDRV_PCM_RATE_44100 |
                         SNDRV_PCM_RATE_48000 |
+                        SNDRV_PCM_RATE_64000 |
+                        SNDRV_PCM_RATE_88200 |
                         SNDRV_PCM_RATE_96000 |
+                        SNDRV_PCM_RATE_176400 |
                         SNDRV_PCM_RATE_192000,
-               .rate_min = 44100,
+               .rate_min = 32000,
                .rate_max = 192000,
                .channels_min = 2,
                .channels_max = 2,
@@ -182,6 +186,8 @@ static int oxygen_open(struct snd_pcm_substream *substream,
 
        runtime->private_data = (void *)(uintptr_t)channel;
        runtime->hw = oxygen_hardware[channel];
+       if (chip->model->pcm_hardware_filter)
+               chip->model->pcm_hardware_filter(channel, &runtime->hw);
        err = snd_pcm_hw_constraint_step(runtime, 0,
                                         SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 32);
        if (err < 0)