From 554314911cee72b5cebdbbe72f612d07690565c9 Mon Sep 17 00:00:00 2001 From: Ariff Abdullah Date: Fri, 26 Oct 2007 20:49:59 +0000 Subject: [PATCH] Remap and virtualize mixer controls for HP nx6110 with AD1981B AC97 codec, unifying master volume control. * Remap "phout" --> SOUND_MIXER_VOLUME (internal speakers) * Virtual "vol" --> { "phout", "ogain" (headphone) } Tested by: Frederic Chardon MFC after: 3 days --- sys/dev/sound/pcm/ac97.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c index 9fcad10be50..22c14e81dd8 100644 --- a/sys/dev/sound/pcm/ac97.c +++ b/sys/dev/sound/pcm/ac97.c @@ -932,10 +932,12 @@ ac97mix_init(struct snd_mixer *m) switch (codec->id) { case 0x41445374: /* AD1981B */ - if (codec->subvendor == 0x02d91014) { + switch (codec->subvendor) { + case 0x02d91014: /* * IBM Thinkcentre: - * Tie "ogain" and "phone" to "vol" since its + * + * Tie "ogain" and "phout" to "vol" since its * master volume is basically useless and can't * control anything. */ @@ -953,6 +955,28 @@ ac97mix_init(struct snd_mixer *m) mix_setrealdev(m, SOUND_MIXER_VOLUME, SOUND_MIXER_NONE); } + break; + case 0x099c103c: + /* + * HP nx6110: + * + * By default, "vol" is controlling internal speakers + * (not a master volume!) and "ogain" is controlling + * headphone. Enable dummy "phout" so it can be + * remapped to internal speakers and virtualize + * "vol" to control both. + */ + codec->mix[SOUND_MIXER_OGAIN].enable = 1; + codec->mix[SOUND_MIXER_PHONEOUT].enable = 1; + mix_setrealdev(m, SOUND_MIXER_PHONEOUT, + SOUND_MIXER_VOLUME); + mix_setrealdev(m, SOUND_MIXER_VOLUME, + SOUND_MIXER_NONE); + mix_setparentchild(m, SOUND_MIXER_VOLUME, + SOUND_MASK_OGAIN | SOUND_MASK_PHONEOUT); + break; + default: + break; } break; case 0x434d4941: /* CMI9738 */