Skip to content

Commit 766ddee

Browse files
committed
ALSA: hda/realtek - Don't create extra controls with channel suffix
The multiple headphone or speaker pins are usually provided to output the same stream unlike line-out jacks (which are supposed to be multi-channel surrounds). Thus giving a mixer name like "Headphone Surround" is rather confusing. Instead, when multiple headphone volumes are available, use index with the same "Headphone" name. Signed-off-by: Takashi Iwai <[email protected]>
1 parent 6c39d6a commit 766ddee

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

sound/pci/hda/patch_realtek.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3173,7 +3173,8 @@ static int alc_auto_create_multi_out_ctls(struct hda_codec *codec,
31733173
}
31743174

31753175
static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
3176-
hda_nid_t dac, const char *pfx)
3176+
hda_nid_t dac, const char *pfx,
3177+
int cidx)
31773178
{
31783179
struct alc_spec *spec = codec->spec;
31793180
hda_nid_t sw, vol;
@@ -3189,15 +3190,15 @@ static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
31893190
if (is_ctl_used(spec->sw_ctls, val))
31903191
return 0; /* already created */
31913192
mark_ctl_usage(spec->sw_ctls, val);
3192-
return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
3193+
return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, cidx, val);
31933194
}
31943195

31953196
sw = alc_look_for_out_mute_nid(codec, pin, dac);
31963197
vol = alc_look_for_out_vol_nid(codec, pin, dac);
3197-
err = alc_auto_add_stereo_vol(codec, pfx, 0, vol);
3198+
err = alc_auto_add_stereo_vol(codec, pfx, cidx, vol);
31983199
if (err < 0)
31993200
return err;
3200-
err = alc_auto_add_stereo_sw(codec, pfx, 0, sw);
3201+
err = alc_auto_add_stereo_sw(codec, pfx, cidx, sw);
32013202
if (err < 0)
32023203
return err;
32033204
return 0;
@@ -3238,16 +3239,21 @@ static int alc_auto_create_extra_outs(struct hda_codec *codec, int num_pins,
32383239
hda_nid_t dac = *dacs;
32393240
if (!dac)
32403241
dac = spec->multiout.dac_nids[0];
3241-
return alc_auto_create_extra_out(codec, *pins, dac, pfx);
3242+
return alc_auto_create_extra_out(codec, *pins, dac, pfx, 0);
32423243
}
32433244

32443245
if (dacs[num_pins - 1]) {
32453246
/* OK, we have a multi-output system with individual volumes */
32463247
for (i = 0; i < num_pins; i++) {
3247-
snprintf(name, sizeof(name), "%s %s",
3248-
pfx, channel_name[i]);
3249-
err = alc_auto_create_extra_out(codec, pins[i], dacs[i],
3250-
name);
3248+
if (num_pins >= 3) {
3249+
snprintf(name, sizeof(name), "%s %s",
3250+
pfx, channel_name[i]);
3251+
err = alc_auto_create_extra_out(codec, pins[i], dacs[i],
3252+
name, 0);
3253+
} else {
3254+
err = alc_auto_create_extra_out(codec, pins[i], dacs[i],
3255+
pfx, i);
3256+
}
32513257
if (err < 0)
32523258
return err;
32533259
}

0 commit comments

Comments
 (0)