[ALSA] hda-codec - add snd_hda_codec_stereo() function

Added snd_hda_codec_amp_stereo() function that changes both of stereo
channels with the same mask and value bits.  It simplifies most of
amp-handling codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
This commit is contained in:
Takashi Iwai
2007-08-10 17:11:07 +02:00
committed by Jaroslav Kysela
parent 82beb8fd36
commit 47fd830acf
7 changed files with 205 additions and 278 deletions

View File

@@ -218,8 +218,7 @@ static int unmute_output(struct hda_codec *codec, struct hda_gnode *node)
ofs = (node->amp_out_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT;
if (val >= ofs)
val -= ofs;
snd_hda_codec_amp_update(codec, node->nid, 0, HDA_OUTPUT, 0, 0xff, val);
snd_hda_codec_amp_update(codec, node->nid, 0, HDA_OUTPUT, 1, 0xff, val);
snd_hda_codec_amp_stereo(codec, node->nid, HDA_OUTPUT, 0, 0xff, val);
return 0;
}
@@ -234,10 +233,7 @@ static int unmute_input(struct hda_codec *codec, struct hda_gnode *node, unsigne
ofs = (node->amp_in_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT;
if (val >= ofs)
val -= ofs;
snd_hda_codec_amp_update(codec, node->nid, 0, HDA_INPUT, index,
0xff, val);
snd_hda_codec_amp_update(codec, node->nid, 1, HDA_INPUT, index,
0xff, val);
snd_hda_codec_amp_stereo(codec, node->nid, HDA_INPUT, index, 0xff, val);
return 0;
}