aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2008-01-16 02:32:53 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:30:00 -0500
commit747c6016ced692db18d7e849e8cbdc523fba0874 (patch)
tree76b4e8652318d090c788e172df03afe65c9a37ce /sound/pci
parentccc80fb467a88ceb7ce1b68546632b91e5ba6c18 (diff)
[ALSA] oxygen: make PCM limits configurable
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>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/oxygen/oxygen.c13
-rw-r--r--sound/pci/oxygen/oxygen.h3
-rw-r--r--sound/pci/oxygen/oxygen_pcm.c10
3 files changed, 24 insertions, 2 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index adf91cc3e1ae..f8e3fd39749d 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -163,6 +163,18 @@ static void generic_cleanup(struct oxygen *chip)
163{ 163{
164} 164}
165 165
166static void generic_pcm_hardware_filter(unsigned int channel,
167 struct snd_pcm_hardware *hardware)
168{
169 if (channel == PCM_A) {
170 hardware->rates = SNDRV_PCM_RATE_44100 |
171 SNDRV_PCM_RATE_48000 |
172 SNDRV_PCM_RATE_96000 |
173 SNDRV_PCM_RATE_192000;
174 hardware->rate_min = 44100;
175 }
176}
177
166static void set_ak4396_params(struct oxygen *chip, 178static void set_ak4396_params(struct oxygen *chip,
167 struct snd_pcm_hw_params *params) 179 struct snd_pcm_hw_params *params)
168{ 180{
@@ -262,6 +274,7 @@ static const struct oxygen_model model_generic = {
262 .init = generic_init, 274 .init = generic_init,
263 .control_filter = ak4396_control_filter, 275 .control_filter = ak4396_control_filter,
264 .cleanup = generic_cleanup, 276 .cleanup = generic_cleanup,
277 .pcm_hardware_filter = generic_pcm_hardware_filter,
265 .set_dac_params = set_ak4396_params, 278 .set_dac_params = set_ak4396_params,
266 .set_adc_params = set_wm8785_params, 279 .set_adc_params = set_wm8785_params,
267 .update_dac_volume = update_ak4396_volume, 280 .update_dac_volume = update_ak4396_volume,
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h
index 7278c1563597..602105ce2947 100644
--- a/sound/pci/oxygen/oxygen.h
+++ b/sound/pci/oxygen/oxygen.h
@@ -34,6 +34,7 @@ enum {
34struct pci_dev; 34struct pci_dev;
35struct snd_card; 35struct snd_card;
36struct snd_pcm_substream; 36struct snd_pcm_substream;
37struct snd_pcm_hardware;
37struct snd_pcm_hw_params; 38struct snd_pcm_hw_params;
38struct snd_kcontrol_new; 39struct snd_kcontrol_new;
39struct snd_rawmidi; 40struct snd_rawmidi;
@@ -75,6 +76,8 @@ struct oxygen_model {
75 int (*control_filter)(struct snd_kcontrol_new *template); 76 int (*control_filter)(struct snd_kcontrol_new *template);
76 int (*mixer_init)(struct oxygen *chip); 77 int (*mixer_init)(struct oxygen *chip);
77 void (*cleanup)(struct oxygen *chip); 78 void (*cleanup)(struct oxygen *chip);
79 void (*pcm_hardware_filter)(unsigned int channel,
80 struct snd_pcm_hardware *hardware);
78 void (*set_dac_params)(struct oxygen *chip, 81 void (*set_dac_params)(struct oxygen *chip,
79 struct snd_pcm_hw_params *params); 82 struct snd_pcm_hw_params *params);
80 void (*set_adc_params)(struct oxygen *chip, 83 void (*set_adc_params)(struct oxygen *chip,
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c
index 5f15d355a431..5515c757ec4b 100644
--- a/sound/pci/oxygen/oxygen_pcm.c
+++ b/sound/pci/oxygen/oxygen_pcm.c
@@ -33,11 +33,15 @@ static struct snd_pcm_hardware oxygen_hardware[PCM_COUNT] = {
33 SNDRV_PCM_INFO_SYNC_START, 33 SNDRV_PCM_INFO_SYNC_START,
34 .formats = SNDRV_PCM_FMTBIT_S16_LE | 34 .formats = SNDRV_PCM_FMTBIT_S16_LE |
35 SNDRV_PCM_FMTBIT_S32_LE, 35 SNDRV_PCM_FMTBIT_S32_LE,
36 .rates = SNDRV_PCM_RATE_44100 | 36 .rates = SNDRV_PCM_RATE_32000 |
37 SNDRV_PCM_RATE_44100 |
37 SNDRV_PCM_RATE_48000 | 38 SNDRV_PCM_RATE_48000 |
39 SNDRV_PCM_RATE_64000 |
40 SNDRV_PCM_RATE_88200 |
38 SNDRV_PCM_RATE_96000 | 41 SNDRV_PCM_RATE_96000 |
42 SNDRV_PCM_RATE_176400 |
39 SNDRV_PCM_RATE_192000, 43 SNDRV_PCM_RATE_192000,
40 .rate_min = 44100, 44 .rate_min = 32000,
41 .rate_max = 192000, 45 .rate_max = 192000,
42 .channels_min = 2, 46 .channels_min = 2,
43 .channels_max = 2, 47 .channels_max = 2,
@@ -182,6 +186,8 @@ static int oxygen_open(struct snd_pcm_substream *substream,
182 186
183 runtime->private_data = (void *)(uintptr_t)channel; 187 runtime->private_data = (void *)(uintptr_t)channel;
184 runtime->hw = oxygen_hardware[channel]; 188 runtime->hw = oxygen_hardware[channel];
189 if (chip->model->pcm_hardware_filter)
190 chip->model->pcm_hardware_filter(channel, &runtime->hw);
185 err = snd_pcm_hw_constraint_step(runtime, 0, 191 err = snd_pcm_hw_constraint_step(runtime, 0,
186 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 32); 192 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 32);
187 if (err < 0) 193 if (err < 0)