ALSA: HDA VIA: Modify vt1709_auto_create_multi_out_ctls.
Rewrite nid_vol/mute assignment for clearity, and check line connection before adding control for it. Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn> Signed-off-by: Logan Li <loganli@viatech.com.cn> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
9645c2039d
commit
4483a2f590
1 changed files with 14 additions and 12 deletions
|
@ -2160,7 +2160,7 @@ static int vt1709_auto_create_multi_out_ctls(struct via_spec *spec,
|
||||||
{
|
{
|
||||||
char name[32];
|
char name[32];
|
||||||
static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" };
|
static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" };
|
||||||
hda_nid_t nid = 0;
|
hda_nid_t nid, nid_vol, nid_vols[] = {0x18, 0x1a, 0x1b, 0x29};
|
||||||
int i, err;
|
int i, err;
|
||||||
|
|
||||||
for (i = 0; i <= AUTO_SEQ_SIDE; i++) {
|
for (i = 0; i <= AUTO_SEQ_SIDE; i++) {
|
||||||
|
@ -2169,43 +2169,45 @@ static int vt1709_auto_create_multi_out_ctls(struct via_spec *spec,
|
||||||
if (!nid)
|
if (!nid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
nid_vol = nid_vols[i];
|
||||||
|
|
||||||
if (i == AUTO_SEQ_CENLFE) {
|
if (i == AUTO_SEQ_CENLFE) {
|
||||||
/* Center/LFE */
|
/* Center/LFE */
|
||||||
err = via_add_control(spec, VIA_CTL_WIDGET_VOL,
|
err = via_add_control(spec, VIA_CTL_WIDGET_VOL,
|
||||||
"Center Playback Volume",
|
"Center Playback Volume",
|
||||||
HDA_COMPOSE_AMP_VAL(0x1b, 1, 0,
|
HDA_COMPOSE_AMP_VAL(nid_vol, 1, 0,
|
||||||
HDA_OUTPUT));
|
HDA_OUTPUT));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
err = via_add_control(spec, VIA_CTL_WIDGET_VOL,
|
err = via_add_control(spec, VIA_CTL_WIDGET_VOL,
|
||||||
"LFE Playback Volume",
|
"LFE Playback Volume",
|
||||||
HDA_COMPOSE_AMP_VAL(0x1b, 2, 0,
|
HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0,
|
||||||
HDA_OUTPUT));
|
HDA_OUTPUT));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
err = via_add_control(spec, VIA_CTL_WIDGET_MUTE,
|
err = via_add_control(spec, VIA_CTL_WIDGET_MUTE,
|
||||||
"Center Playback Switch",
|
"Center Playback Switch",
|
||||||
HDA_COMPOSE_AMP_VAL(0x1b, 1, 0,
|
HDA_COMPOSE_AMP_VAL(nid_vol, 1, 0,
|
||||||
HDA_OUTPUT));
|
HDA_OUTPUT));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
err = via_add_control(spec, VIA_CTL_WIDGET_MUTE,
|
err = via_add_control(spec, VIA_CTL_WIDGET_MUTE,
|
||||||
"LFE Playback Switch",
|
"LFE Playback Switch",
|
||||||
HDA_COMPOSE_AMP_VAL(0x1b, 2, 0,
|
HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0,
|
||||||
HDA_OUTPUT));
|
HDA_OUTPUT));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
} else if (i == AUTO_SEQ_FRONT){
|
} else if (i == AUTO_SEQ_FRONT){
|
||||||
/* add control to mixer index 0 */
|
/* ADD control to mixer index 0 */
|
||||||
err = via_add_control(spec, VIA_CTL_WIDGET_VOL,
|
err = via_add_control(spec, VIA_CTL_WIDGET_VOL,
|
||||||
"Master Front Playback Volume",
|
"Master Front Playback Volume",
|
||||||
HDA_COMPOSE_AMP_VAL(0x18, 3, 0,
|
HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0,
|
||||||
HDA_INPUT));
|
HDA_INPUT));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
err = via_add_control(spec, VIA_CTL_WIDGET_MUTE,
|
err = via_add_control(spec, VIA_CTL_WIDGET_MUTE,
|
||||||
"Master Front Playback Switch",
|
"Master Front Playback Switch",
|
||||||
HDA_COMPOSE_AMP_VAL(0x18, 3, 0,
|
HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0,
|
||||||
HDA_INPUT));
|
HDA_INPUT));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
@ -2226,26 +2228,26 @@ static int vt1709_auto_create_multi_out_ctls(struct via_spec *spec,
|
||||||
} else if (i == AUTO_SEQ_SURROUND) {
|
} else if (i == AUTO_SEQ_SURROUND) {
|
||||||
sprintf(name, "%s Playback Volume", chname[i]);
|
sprintf(name, "%s Playback Volume", chname[i]);
|
||||||
err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name,
|
err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name,
|
||||||
HDA_COMPOSE_AMP_VAL(0x1a, 3, 0,
|
HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0,
|
||||||
HDA_OUTPUT));
|
HDA_OUTPUT));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
sprintf(name, "%s Playback Switch", chname[i]);
|
sprintf(name, "%s Playback Switch", chname[i]);
|
||||||
err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name,
|
err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name,
|
||||||
HDA_COMPOSE_AMP_VAL(0x1a, 3, 0,
|
HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0,
|
||||||
HDA_OUTPUT));
|
HDA_OUTPUT));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
} else if (i == AUTO_SEQ_SIDE) {
|
} else if (i == AUTO_SEQ_SIDE) {
|
||||||
sprintf(name, "%s Playback Volume", chname[i]);
|
sprintf(name, "%s Playback Volume", chname[i]);
|
||||||
err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name,
|
err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name,
|
||||||
HDA_COMPOSE_AMP_VAL(0x29, 3, 0,
|
HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0,
|
||||||
HDA_OUTPUT));
|
HDA_OUTPUT));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
sprintf(name, "%s Playback Switch", chname[i]);
|
sprintf(name, "%s Playback Switch", chname[i]);
|
||||||
err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name,
|
err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name,
|
||||||
HDA_COMPOSE_AMP_VAL(0x29, 3, 0,
|
HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0,
|
||||||
HDA_OUTPUT));
|
HDA_OUTPUT));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
Reference in a new issue