diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-04-09 03:16:33 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 06:00:32 -0400 |
commit | 1d98c7d4be6ac521e3391025ddffcfe0400c798c (patch) | |
tree | baa410a35f6ef8b275cdb40aa56811f5fccf74a5 /sound/pci/oxygen | |
parent | 11864b4b84194b459fc20e0ec47906885bddb12e (diff) |
[ALSA] oxygen: use SPDIF input only if present
If the card model does not have a digital input or an AC97 codec,
disable the respective interrupt and mixer controls.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/oxygen')
-rw-r--r-- | sound/pci/oxygen/hifier.c | 5 | ||||
-rw-r--r-- | sound/pci/oxygen/oxygen_lib.c | 49 | ||||
-rw-r--r-- | sound/pci/oxygen/oxygen_mixer.c | 9 | ||||
-rw-r--r-- | sound/pci/oxygen/virtuoso.c | 5 |
4 files changed, 40 insertions, 28 deletions
diff --git a/sound/pci/oxygen/hifier.c b/sound/pci/oxygen/hifier.c index 1e54a3cd721e..50551ae0b3b4 100644 --- a/sound/pci/oxygen/hifier.c +++ b/sound/pci/oxygen/hifier.c | |||
@@ -132,11 +132,6 @@ static int hifier_control_filter(struct snd_kcontrol_new *template) | |||
132 | template->tlv.p = ak4396_db_scale; | 132 | template->tlv.p = ak4396_db_scale; |
133 | } else if (!strcmp(template->name, "Stereo Upmixing")) { | 133 | } else if (!strcmp(template->name, "Stereo Upmixing")) { |
134 | return 1; /* stereo only - we don't need upmixing */ | 134 | return 1; /* stereo only - we don't need upmixing */ |
135 | } else if (!strcmp(template->name, | ||
136 | SNDRV_CTL_NAME_IEC958("", CAPTURE, MASK)) || | ||
137 | !strcmp(template->name, | ||
138 | SNDRV_CTL_NAME_IEC958("", CAPTURE, DEFAULT))) { | ||
139 | return 1; /* no digital input */ | ||
140 | } | 135 | } |
141 | return 0; | 136 | return 0; |
142 | } | 137 | } |
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 4f3d9e5fc5db..39e4b7a51740 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c | |||
@@ -291,20 +291,27 @@ static void oxygen_init(struct oxygen *chip) | |||
291 | OXYGEN_I2S_MASTER | OXYGEN_I2S_MUTE_MCLK); | 291 | OXYGEN_I2S_MASTER | OXYGEN_I2S_MUTE_MCLK); |
292 | oxygen_write16(chip, OXYGEN_I2S_C_FORMAT, | 292 | oxygen_write16(chip, OXYGEN_I2S_C_FORMAT, |
293 | OXYGEN_I2S_MASTER | OXYGEN_I2S_MUTE_MCLK); | 293 | OXYGEN_I2S_MASTER | OXYGEN_I2S_MUTE_MCLK); |
294 | oxygen_write32_masked(chip, OXYGEN_SPDIF_CONTROL, | 294 | oxygen_clear_bits32(chip, OXYGEN_SPDIF_CONTROL, |
295 | OXYGEN_SPDIF_SENSE_MASK | | 295 | OXYGEN_SPDIF_OUT_ENABLE | |
296 | OXYGEN_SPDIF_LOCK_MASK | | 296 | OXYGEN_SPDIF_LOOPBACK); |
297 | OXYGEN_SPDIF_RATE_MASK | | 297 | if (chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF) |
298 | OXYGEN_SPDIF_LOCK_PAR | | 298 | oxygen_write32_masked(chip, OXYGEN_SPDIF_CONTROL, |
299 | OXYGEN_SPDIF_IN_CLOCK_96, | 299 | OXYGEN_SPDIF_SENSE_MASK | |
300 | OXYGEN_SPDIF_OUT_ENABLE | | 300 | OXYGEN_SPDIF_LOCK_MASK | |
301 | OXYGEN_SPDIF_LOOPBACK | | 301 | OXYGEN_SPDIF_RATE_MASK | |
302 | OXYGEN_SPDIF_SENSE_MASK | | 302 | OXYGEN_SPDIF_LOCK_PAR | |
303 | OXYGEN_SPDIF_LOCK_MASK | | 303 | OXYGEN_SPDIF_IN_CLOCK_96, |
304 | OXYGEN_SPDIF_RATE_MASK | | 304 | OXYGEN_SPDIF_SENSE_MASK | |
305 | OXYGEN_SPDIF_SENSE_PAR | | 305 | OXYGEN_SPDIF_LOCK_MASK | |
306 | OXYGEN_SPDIF_LOCK_PAR | | 306 | OXYGEN_SPDIF_RATE_MASK | |
307 | OXYGEN_SPDIF_IN_CLOCK_MASK); | 307 | OXYGEN_SPDIF_SENSE_PAR | |
308 | OXYGEN_SPDIF_LOCK_PAR | | ||
309 | OXYGEN_SPDIF_IN_CLOCK_MASK); | ||
310 | else | ||
311 | oxygen_clear_bits32(chip, OXYGEN_SPDIF_CONTROL, | ||
312 | OXYGEN_SPDIF_SENSE_MASK | | ||
313 | OXYGEN_SPDIF_LOCK_MASK | | ||
314 | OXYGEN_SPDIF_RATE_MASK); | ||
308 | oxygen_write32(chip, OXYGEN_SPDIF_OUTPUT_BITS, chip->spdif_bits); | 315 | oxygen_write32(chip, OXYGEN_SPDIF_OUTPUT_BITS, chip->spdif_bits); |
309 | oxygen_clear_bits8(chip, OXYGEN_MPU401_CONTROL, OXYGEN_MPU401_LOOPBACK); | 316 | oxygen_clear_bits8(chip, OXYGEN_MPU401_CONTROL, OXYGEN_MPU401_LOOPBACK); |
310 | oxygen_write8(chip, OXYGEN_GPI_INTERRUPT_MASK, 0); | 317 | oxygen_write8(chip, OXYGEN_GPI_INTERRUPT_MASK, 0); |
@@ -327,9 +334,12 @@ static void oxygen_init(struct oxygen *chip) | |||
327 | (2 << OXYGEN_A_MONITOR_ROUTE_2_SHIFT) | | 334 | (2 << OXYGEN_A_MONITOR_ROUTE_2_SHIFT) | |
328 | (3 << OXYGEN_A_MONITOR_ROUTE_3_SHIFT)); | 335 | (3 << OXYGEN_A_MONITOR_ROUTE_3_SHIFT)); |
329 | 336 | ||
330 | oxygen_write8(chip, OXYGEN_AC97_INTERRUPT_MASK, | 337 | if (chip->has_ac97_0 | chip->has_ac97_1) |
331 | OXYGEN_AC97_INT_READ_DONE | | 338 | oxygen_write8(chip, OXYGEN_AC97_INTERRUPT_MASK, |
332 | OXYGEN_AC97_INT_WRITE_DONE); | 339 | OXYGEN_AC97_INT_READ_DONE | |
340 | OXYGEN_AC97_INT_WRITE_DONE); | ||
341 | else | ||
342 | oxygen_write8(chip, OXYGEN_AC97_INTERRUPT_MASK, 0); | ||
333 | oxygen_write32(chip, OXYGEN_AC97_OUT_CONFIG, 0); | 343 | oxygen_write32(chip, OXYGEN_AC97_OUT_CONFIG, 0); |
334 | oxygen_write32(chip, OXYGEN_AC97_IN_CONFIG, 0); | 344 | oxygen_write32(chip, OXYGEN_AC97_IN_CONFIG, 0); |
335 | if (!(chip->has_ac97_0 | chip->has_ac97_1)) | 345 | if (!(chip->has_ac97_0 | chip->has_ac97_1)) |
@@ -495,7 +505,10 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, | |||
495 | oxygen_proc_init(chip); | 505 | oxygen_proc_init(chip); |
496 | 506 | ||
497 | spin_lock_irq(&chip->reg_lock); | 507 | spin_lock_irq(&chip->reg_lock); |
498 | chip->interrupt_mask |= OXYGEN_INT_SPDIF_IN_DETECT | OXYGEN_INT_AC97; | 508 | if (chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF) |
509 | chip->interrupt_mask |= OXYGEN_INT_SPDIF_IN_DETECT; | ||
510 | if (chip->has_ac97_0 | chip->has_ac97_1) | ||
511 | chip->interrupt_mask |= OXYGEN_INT_AC97; | ||
499 | oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, chip->interrupt_mask); | 512 | oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, chip->interrupt_mask); |
500 | spin_unlock_irq(&chip->reg_lock); | 513 | spin_unlock_irq(&chip->reg_lock); |
501 | 514 | ||
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index d0bef09a6999..2cb914498a19 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c | |||
@@ -742,6 +742,9 @@ static const struct snd_kcontrol_new controls[] = { | |||
742 | .get = spdif_pcm_get, | 742 | .get = spdif_pcm_get, |
743 | .put = spdif_pcm_put, | 743 | .put = spdif_pcm_put, |
744 | }, | 744 | }, |
745 | }; | ||
746 | |||
747 | static const struct snd_kcontrol_new spdif_input_controls[] = { | ||
745 | { | 748 | { |
746 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 749 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
747 | .device = 1, | 750 | .device = 1, |
@@ -961,6 +964,12 @@ int oxygen_mixer_init(struct oxygen *chip) | |||
961 | err = add_controls(chip, controls, ARRAY_SIZE(controls)); | 964 | err = add_controls(chip, controls, ARRAY_SIZE(controls)); |
962 | if (err < 0) | 965 | if (err < 0) |
963 | return err; | 966 | return err; |
967 | if (chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF) { | ||
968 | err = add_controls(chip, spdif_input_controls, | ||
969 | ARRAY_SIZE(spdif_input_controls)); | ||
970 | if (err < 0) | ||
971 | return err; | ||
972 | } | ||
964 | for (i = 0; i < ARRAY_SIZE(monitor_controls); ++i) { | 973 | for (i = 0; i < ARRAY_SIZE(monitor_controls); ++i) { |
965 | if (!(chip->model->pcm_dev_cfg & monitor_controls[i].pcm_dev)) | 974 | if (!(chip->model->pcm_dev_cfg & monitor_controls[i].pcm_dev)) |
966 | continue; | 975 | continue; |
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index b678e2de4adf..07d7e9b6afbb 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c | |||
@@ -506,11 +506,6 @@ static int xonar_dx_control_filter(struct snd_kcontrol_new *template) | |||
506 | template->tlv.p = cs4362a_db_scale; | 506 | template->tlv.p = cs4362a_db_scale; |
507 | } else if (!strncmp(template->name, "CD Capture ", 11)) { | 507 | } else if (!strncmp(template->name, "CD Capture ", 11)) { |
508 | return 1; /* no CD input */ | 508 | return 1; /* no CD input */ |
509 | } else if (!strcmp(template->name, | ||
510 | SNDRV_CTL_NAME_IEC958("", CAPTURE, MASK)) || | ||
511 | !strcmp(template->name, | ||
512 | SNDRV_CTL_NAME_IEC958("", CAPTURE, DEFAULT))) { | ||
513 | return 1; /* no digital input */ | ||
514 | } | 509 | } |
515 | return 0; | 510 | return 0; |
516 | } | 511 | } |