Commit b6adb57d authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda/realtek - Keep the channel count for multiple speakers

The current Realtek driver reconfigures the max PCM channels
dynamically according to the value of Channel Mode enum if the
multi-io retasking is available.  It works fine for multi-io pins.
But when multiple speaker pins are available, the channels of speakers
also have to obey to the channel mode, which isn't nice.
(That is, when you select "2ch" in Channel Mode so that the line-in
 and mic jack behave as input, you can't play surrounds properly from
 the built-in speaker.)

This patch fixes the problem by taking the channel number for multiple
speakers into account in the channel-mode setup code.
Also it fixes the wrongly set up max_channels value in the case of
multi-io extension.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent eb10149d
...@@ -153,8 +153,8 @@ struct alc_spec { ...@@ -153,8 +153,8 @@ struct alc_spec {
const struct hda_channel_mode *channel_mode; const struct hda_channel_mode *channel_mode;
int num_channel_mode; int num_channel_mode;
int need_dac_fix; int need_dac_fix;
int const_channel_count; int const_channel_count; /* min. channel count (for speakers) */
int ext_channel_count; int ext_channel_count; /* current channel count for multi-io */
/* PCM information */ /* PCM information */
struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
...@@ -3961,8 +3961,9 @@ static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol, ...@@ -3961,8 +3961,9 @@ static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol,
spec->ext_channel_count = (ch + 1) * 2; spec->ext_channel_count = (ch + 1) * 2;
for (i = 0; i < spec->multi_ios; i++) for (i = 0; i < spec->multi_ios; i++)
alc_set_multi_io(codec, i, i < ch); alc_set_multi_io(codec, i, i < ch);
spec->multiout.max_channels = spec->ext_channel_count; spec->multiout.max_channels = max(spec->ext_channel_count,
if (spec->need_dac_fix && !spec->const_channel_count) spec->const_channel_count);
if (spec->need_dac_fix)
spec->multiout.num_dacs = spec->multiout.max_channels / 2; spec->multiout.num_dacs = spec->multiout.max_channels / 2;
return 1; return 1;
} }
...@@ -4324,6 +4325,16 @@ static int alc_parse_auto_config(struct hda_codec *codec, ...@@ -4324,6 +4325,16 @@ static int alc_parse_auto_config(struct hda_codec *codec,
if (err < 0) if (err < 0)
return err; return err;
/* check the multiple speaker pins */
if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
spec->const_channel_count = cfg->line_outs * 2;
else
spec->const_channel_count = cfg->speaker_outs * 2;
if (spec->multi_ios > 0)
spec->multiout.max_channels = max(spec->ext_channel_count,
spec->const_channel_count);
else
spec->multiout.max_channels = spec->multiout.num_dacs * 2; spec->multiout.max_channels = spec->multiout.num_dacs * 2;
dig_only: dig_only:
......
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