diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-09-22 03:06:38 -0400 |
---|---|---|
committer | Clemens Ladisch <clemens@ladisch.de> | 2008-09-22 03:06:38 -0400 |
commit | 70c27d345ed74ca9ea7ebf1fa0186af644caeb1d (patch) | |
tree | dd25efe3da590d08a48aa51e104d91d68a5580f0 /sound/pci/oxygen | |
parent | 4f50d2fd00da451261f51f28e929ebd161068422 (diff) |
ALSA: virtuoso: make number of PCM1796 DACs configurable
Do not use a hardcoded number when iterating over the PCM1796 DACs to
allow for cards with a different number of analog output channels.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/pci/oxygen')
-rw-r--r-- | sound/pci/oxygen/virtuoso.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 853e8898bf9b..0cecf1f97173 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c | |||
@@ -131,6 +131,7 @@ MODULE_DEVICE_TABLE(pci, xonar_ids); | |||
131 | struct xonar_data { | 131 | struct xonar_data { |
132 | unsigned int model; | 132 | unsigned int model; |
133 | unsigned int anti_pop_delay; | 133 | unsigned int anti_pop_delay; |
134 | unsigned int dacs; | ||
134 | u16 output_enable_bit; | 135 | u16 output_enable_bit; |
135 | u8 ext_power_reg; | 136 | u8 ext_power_reg; |
136 | u8 ext_power_int_reg; | 137 | u8 ext_power_int_reg; |
@@ -214,9 +215,10 @@ static void xonar_common_init(struct oxygen *chip) | |||
214 | 215 | ||
215 | static void update_pcm1796_volume(struct oxygen *chip) | 216 | static void update_pcm1796_volume(struct oxygen *chip) |
216 | { | 217 | { |
218 | struct xonar_data *data = chip->model_data; | ||
217 | unsigned int i; | 219 | unsigned int i; |
218 | 220 | ||
219 | for (i = 0; i < 4; ++i) { | 221 | for (i = 0; i < data->dacs; ++i) { |
220 | pcm1796_write(chip, i, 16, chip->dac_volume[i * 2]); | 222 | pcm1796_write(chip, i, 16, chip->dac_volume[i * 2]); |
221 | pcm1796_write(chip, i, 17, chip->dac_volume[i * 2 + 1]); | 223 | pcm1796_write(chip, i, 17, chip->dac_volume[i * 2 + 1]); |
222 | } | 224 | } |
@@ -224,13 +226,14 @@ static void update_pcm1796_volume(struct oxygen *chip) | |||
224 | 226 | ||
225 | static void update_pcm1796_mute(struct oxygen *chip) | 227 | static void update_pcm1796_mute(struct oxygen *chip) |
226 | { | 228 | { |
229 | struct xonar_data *data = chip->model_data; | ||
227 | unsigned int i; | 230 | unsigned int i; |
228 | u8 value; | 231 | u8 value; |
229 | 232 | ||
230 | value = PCM1796_DMF_DISABLED | PCM1796_FMT_24_LJUST | PCM1796_ATLD; | 233 | value = PCM1796_DMF_DISABLED | PCM1796_FMT_24_LJUST | PCM1796_ATLD; |
231 | if (chip->dac_mute) | 234 | if (chip->dac_mute) |
232 | value |= PCM1796_MUTE; | 235 | value |= PCM1796_MUTE; |
233 | for (i = 0; i < 4; ++i) | 236 | for (i = 0; i < data->dacs; ++i) |
234 | pcm1796_write(chip, i, 18, value); | 237 | pcm1796_write(chip, i, 18, value); |
235 | } | 238 | } |
236 | 239 | ||
@@ -239,7 +242,7 @@ static void pcm1796_init(struct oxygen *chip) | |||
239 | struct xonar_data *data = chip->model_data; | 242 | struct xonar_data *data = chip->model_data; |
240 | unsigned int i; | 243 | unsigned int i; |
241 | 244 | ||
242 | for (i = 0; i < 4; ++i) { | 245 | for (i = 0; i < data->dacs; ++i) { |
243 | pcm1796_write(chip, i, 19, PCM1796_FLT_SHARP | PCM1796_ATS_1); | 246 | pcm1796_write(chip, i, 19, PCM1796_FLT_SHARP | PCM1796_ATS_1); |
244 | pcm1796_write(chip, i, 20, data->pcm1796_oversampling); | 247 | pcm1796_write(chip, i, 20, data->pcm1796_oversampling); |
245 | pcm1796_write(chip, i, 21, 0); | 248 | pcm1796_write(chip, i, 21, 0); |
@@ -415,7 +418,7 @@ static void set_pcm1796_params(struct oxygen *chip, | |||
415 | 418 | ||
416 | data->pcm1796_oversampling = | 419 | data->pcm1796_oversampling = |
417 | params_rate(params) >= 96000 ? PCM1796_OS_32 : PCM1796_OS_64; | 420 | params_rate(params) >= 96000 ? PCM1796_OS_32 : PCM1796_OS_64; |
418 | for (i = 0; i < 4; ++i) | 421 | for (i = 0; i < data->dacs; ++i) |
419 | pcm1796_write(chip, i, 20, data->pcm1796_oversampling); | 422 | pcm1796_write(chip, i, 20, data->pcm1796_oversampling); |
420 | } | 423 | } |
421 | 424 | ||
@@ -574,9 +577,17 @@ static int xonar_model_probe(struct oxygen *chip, unsigned long driver_data) | |||
574 | [MODEL_D2] = "Xonar D2", | 577 | [MODEL_D2] = "Xonar D2", |
575 | [MODEL_D2X] = "Xonar D2X", | 578 | [MODEL_D2X] = "Xonar D2X", |
576 | }; | 579 | }; |
580 | static const u8 dacs[] = { | ||
581 | [MODEL_D1] = 2, | ||
582 | [MODEL_DX] = 2, | ||
583 | [MODEL_D2] = 4, | ||
584 | [MODEL_D2X] = 4, | ||
585 | }; | ||
577 | struct xonar_data *data = chip->model_data; | 586 | struct xonar_data *data = chip->model_data; |
578 | 587 | ||
579 | data->model = driver_data; | 588 | data->model = driver_data; |
589 | |||
590 | data->dacs = dacs[data->model]; | ||
580 | chip->model.shortname = names[data->model]; | 591 | chip->model.shortname = names[data->model]; |
581 | return 0; | 592 | return 0; |
582 | } | 593 | } |