Skip to content

Commit

Permalink
[ALSA] WM97xx AC97 codec controls
Browse files Browse the repository at this point in the history
AC97 Codec
o Enhanced current WM97xx support to provide additional controls and
  use the kcontrol suffix naming convention.
o Added AC97_HAS_NO_MIC, AC97_HAS_NO_TONE and AC97_HAS_NO_STD_PCM.
o Cleaned up WM97xx related comments.
o Removed some wm9713 double mono controls and replaced with stereo
  controls.

Signed-off-by: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Liam Girdwood authored and Jaroslav Kysela committed Aug 30, 2005
1 parent 1fdab81 commit 3998b70
Show file tree
Hide file tree
Showing 3 changed files with 367 additions and 109 deletions.
3 changes: 3 additions & 0 deletions include/sound/ac97_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@
#define AC97_HAS_NO_PC_BEEP (1<<12) /* no PC Beep volume */
#define AC97_HAS_NO_VIDEO (1<<13) /* no Video volume */
#define AC97_HAS_NO_CD (1<<14) /* no CD volume */
#define AC97_HAS_NO_MIC (1<<15) /* no MIC volume */
#define AC97_HAS_NO_TONE (1<<16) /* no Tone volume */
#define AC97_HAS_NO_STD_PCM (1<<17) /* no standard AC97 PCM volume and mute */

/* rates indexes */
#define AC97_RATES_FRONT_DAC 0
Expand Down
44 changes: 25 additions & 19 deletions sound/pci/ac97/ac97_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1307,16 +1307,18 @@ static int snd_ac97_mixer_build(ac97_t * ac97)
}

/* build master tone controls */
if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_TONE)) {
for (idx = 0; idx < 2; idx++) {
if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0)
return err;
if (ac97->id == AC97_ID_YMF753) {
kctl->private_value &= ~(0xff << 16);
kctl->private_value |= 7 << 16;
if (!(ac97->flags & AC97_HAS_NO_TONE)) {
if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_TONE)) {
for (idx = 0; idx < 2; idx++) {
if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0)
return err;
if (ac97->id == AC97_ID_YMF753) {
kctl->private_value &= ~(0xff << 16);
kctl->private_value |= 7 << 16;
}
}
snd_ac97_write_cache(ac97, AC97_MASTER_TONE, 0x0f0f);
}
snd_ac97_write_cache(ac97, AC97_MASTER_TONE, 0x0f0f);
}

/* build PC Speaker controls */
Expand All @@ -1339,11 +1341,13 @@ static int snd_ac97_mixer_build(ac97_t * ac97)
}

/* build MIC controls */
if (snd_ac97_try_volume_mix(ac97, AC97_MIC)) {
if ((err = snd_ac97_cmix_new(card, "Mic Playback", AC97_MIC, ac97)) < 0)
return err;
if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_boost, ac97))) < 0)
return err;
if (!(ac97->flags & AC97_HAS_NO_MIC)) {
if (snd_ac97_try_volume_mix(ac97, AC97_MIC)) {
if ((err = snd_ac97_cmix_new(card, "Mic Playback", AC97_MIC, ac97)) < 0)
return err;
if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_boost, ac97))) < 0)
return err;
}
}

/* build Line controls */
Expand Down Expand Up @@ -1402,12 +1406,14 @@ static int snd_ac97_mixer_build(ac97_t * ac97)
}
snd_ac97_write_cache(ac97, AC97_PCM, init_val);
} else {
if (ac97->flags & AC97_HAS_NO_PCM_VOL)
err = snd_ac97_cmute_new(card, "PCM Playback Switch", AC97_PCM, ac97);
else
err = snd_ac97_cmix_new(card, "PCM Playback", AC97_PCM, ac97);
if (err < 0)
return err;
if (!(ac97->flags & AC97_HAS_NO_STD_PCM)) {
if (ac97->flags & AC97_HAS_NO_PCM_VOL)
err = snd_ac97_cmute_new(card, "PCM Playback Switch", AC97_PCM, ac97);
else
err = snd_ac97_cmix_new(card, "PCM Playback", AC97_PCM, ac97);
if (err < 0)
return err;
}
}

/* build Capture controls */
Expand Down
Loading

0 comments on commit 3998b70

Please sign in to comment.