[alsa-devel] Via VT2020: issues with kernel 2.6.38.{2, 3} (alsa 1.0.23) - working with (alsa 1.0.21)

Raymond Yau superquad.vortex2 at gmail.com
Sat Jun 18 10:29:20 CEST 2011

2011/6/8 alex dot baldacchino dot alsasub at gmail dot com
<alex.baldacchino.alsasub at gmail.com>:
> Adding a few printk()'s to file "patch_via.c" showed me function
> via_hp_build() is called before via_build_pcms() (unless front panel
> is disabled in BIOS, in which case via_hp_build() isn't invoked at
> all), therefore, when a control "Independent HP" is created, it should
> be 'visible' by via_build_pcms(); however,
> snd_hda_find_mixer_ctl(codec, "Independent HP") fails to find it until
> the following loop is executed inside via_build_controls:

> and via_build_controls() is called after via_build_pcms(), but then
> it's too late (or seemed to be such) to modify the number of playback
> substreams. At last, I've tried the following, which worked:

The fix is to check spec->multiout.hp_nid  since "Independent HP" need
the extra DAC for HP when there is no HP if front panel is disabled by

static int via_build_pcms(struct hda_codec *codec)

	info->name = spec->stream_name_analog;
	info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
+     info->stream[SNDRV_PCM_STREAM_PLAYBACK].substreams =
+             spec->multiout.hp_nid ? 2 : 1;
	info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
	info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];

	info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max =

However there is a bug in using subdevice 1 for "Independent HP" and
subdevice 0 for multi-channels

The channel count reported by snd_pcm_hw_params_get_channels_max() or
snd_pcm_hw_params_test_channel() for subdevice 1 is also equal to
spec->multiout.max_channels but this subdevice 1 only support stereo

More information about the Alsa-devel mailing list