Commit 3998b70f authored by Liam Girdwood's avatar Liam Girdwood Committed by Jaroslav Kysela

[ALSA] WM97xx AC97 codec controls

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: default avatarLiam Girdwood <liam.girdwood@wolfsonmicro.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 1fdab81e
...@@ -374,6 +374,9 @@ ...@@ -374,6 +374,9 @@
#define AC97_HAS_NO_PC_BEEP (1<<12) /* no PC Beep volume */ #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_VIDEO (1<<13) /* no Video volume */
#define AC97_HAS_NO_CD (1<<14) /* no CD 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 */ /* rates indexes */
#define AC97_RATES_FRONT_DAC 0 #define AC97_RATES_FRONT_DAC 0
......
...@@ -1307,16 +1307,18 @@ static int snd_ac97_mixer_build(ac97_t * ac97) ...@@ -1307,16 +1307,18 @@ static int snd_ac97_mixer_build(ac97_t * ac97)
} }
/* build master tone controls */ /* build master tone controls */
if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_TONE)) { if (!(ac97->flags & AC97_HAS_NO_TONE)) {
for (idx = 0; idx < 2; idx++) { if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_TONE)) {
if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0) for (idx = 0; idx < 2; idx++) {
return err; if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0)
if (ac97->id == AC97_ID_YMF753) { return err;
kctl->private_value &= ~(0xff << 16); if (ac97->id == AC97_ID_YMF753) {
kctl->private_value |= 7 << 16; 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 */ /* build PC Speaker controls */
...@@ -1339,11 +1341,13 @@ static int snd_ac97_mixer_build(ac97_t * ac97) ...@@ -1339,11 +1341,13 @@ static int snd_ac97_mixer_build(ac97_t * ac97)
} }
/* build MIC controls */ /* build MIC controls */
if (snd_ac97_try_volume_mix(ac97, AC97_MIC)) { if (!(ac97->flags & AC97_HAS_NO_MIC)) {
if ((err = snd_ac97_cmix_new(card, "Mic Playback", AC97_MIC, ac97)) < 0) if (snd_ac97_try_volume_mix(ac97, AC97_MIC)) {
return err; if ((err = snd_ac97_cmix_new(card, "Mic Playback", AC97_MIC, ac97)) < 0)
if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_boost, ac97))) < 0) return err;
return err; if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_boost, ac97))) < 0)
return err;
}
} }
/* build Line controls */ /* build Line controls */
...@@ -1402,12 +1406,14 @@ static int snd_ac97_mixer_build(ac97_t * ac97) ...@@ -1402,12 +1406,14 @@ static int snd_ac97_mixer_build(ac97_t * ac97)
} }
snd_ac97_write_cache(ac97, AC97_PCM, init_val); snd_ac97_write_cache(ac97, AC97_PCM, init_val);
} else { } else {
if (ac97->flags & AC97_HAS_NO_PCM_VOL) if (!(ac97->flags & AC97_HAS_NO_STD_PCM)) {
err = snd_ac97_cmute_new(card, "PCM Playback Switch", AC97_PCM, ac97); if (ac97->flags & AC97_HAS_NO_PCM_VOL)
else err = snd_ac97_cmute_new(card, "PCM Playback Switch", AC97_PCM, ac97);
err = snd_ac97_cmix_new(card, "PCM Playback", AC97_PCM, ac97); else
if (err < 0) err = snd_ac97_cmix_new(card, "PCM Playback", AC97_PCM, ac97);
return err; if (err < 0)
return err;
}
} }
/* build Capture controls */ /* build Capture controls */
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment