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

alex dot baldacchino dot alsasub at gmail dot com alex.baldacchino.alsasub at gmail.com
Thu Jun 16 20:50:40 CEST 2011


(Sorry for previous message being too long)

2011/6/14 Raymond Yau <superquad.vortex2 at gmail.com>:
- Nascondi testo citato -
> 2011/6/8 alex dot baldacchino dot alsasub at gmail dot com
> <alex.baldacchino.alsasub at gmail.com>:
>>
>>
>> http://pastebin.ca/2076750
>>
>>
>> By the way, should something like the above be done for capture
>> streams as well? I've noticed (with front panel disabled) that
>> controls "Front Mic Playback Volume" and "Front Mic Playback Switch"
>> are correctly missing from audio-mixer widget 0x21, but node 0x29 is
>> still 'attached' to control "Front Mic Boost Capture Volume", which is
>> accessible through a mixer (though I didn't try to play with it; it is
>> listed also by amixer output in above linked document). Is this the
>> wanted/expected behaviour?
>
> It seem that 0x2b and 0x29 does not have any mic boost capture volume,
> that look like "Playback Switch" when they are retasked as output for
> 3 jacks motherboard
>
> Node 0x29 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
>  Control: name="Front Mic Boost Capture Volume", index=0, device=0
>    ControlAmp: chs=3, dir=In, idx=0, ofs=0
>  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
>  Amp-Out vals:  [0x80 0x80]
>  Pincap 0x0000233c: IN OUT HP Detect
>    Vref caps: HIZ 50 100
>  Pin Default 0x02a19037: [Jack] Mic at Ext Front
>    Conn = 1/8, Color = Pink
>    DefAssociation = 0x3, Sequence = 0x7
>  Pin-ctls: 0x21: IN VREF_50
>  Unsolicited: tag=20, enabled=1
>  Power states:  D0 D1 D2 D3
>  Power: setting=D3, actual=D3
>  Connection: 1
>     0x1c
>
> Node 0x2b [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
>  Control: name="Mic Boost Capture Volume", index=0, device=0
>    ControlAmp: chs=3, dir=In, idx=0, ofs=0
>  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
>  Amp-Out vals:  [0x80 0x80]
>  Pincap 0x00002334: IN OUT Detect
>    Vref caps: HIZ 50 100
>  Pin Default 0x01a19036: [Jack] Mic at Ext Rear
>    Conn = 1/8, Color = Pink
>    DefAssociation = 0x3, Sequence = 0x6
>  Pin-ctls: 0x21: IN VREF_50
>  Unsolicited: tag=20, enabled=1
>  Power states:  D0 D1 D2 D3
>  Power: setting=D0, actual=D0
>  Connection: 2
>     0x0a* 0x0c
>

That pastebin was alsa-info.sh output with front panel disabled in
bios, to show via_build_pcms() can be fixed to avoid creating a
sencond playback pcm substream (thus, a second subdevice) when there's
no front audio panel in the system (or is disabled), even if
snd_hda_find_mixer_ctl() cannot find control "Independent HP" if
called from within via_build_pcms:

APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: VT2020 Analog [VT2020 Analog]
 Subdevices: 1/1
 Subdevice #0: subdevice #0


But I might have pasted a wrong file (sorry for that), correct output
for that (sort of) patch would be:


Node 0x29 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
 Control: name="Front Mic Boost Capture Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=0, ofs=0
 Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
 Amp-Out vals:  [0x80 0x80]
 Pincap 0x0000233c: IN OUT HP Detect
   Vref caps: HIZ 50 100
 Pin Default 0x42a190f7: [N/A] Mic at Ext Front
   Conn = 1/8, Color = Pink
   DefAssociation = 0xf, Sequence = 0x7
 Pin-ctls: 0x00: VREF_HIZ
 Unsolicited: tag=20, enabled=1
 Power states:  D0 D1 D2 D3
 Power: setting=D3, actual=D3
 Connection: 1
    0x1c


Front audio panel not connected (not seen by the BIOS) -> front mic
not available -> power setting D3 (because of set_pin_power_state()
checking for presence, I guess)


Node 0x2b [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
 Control: name="Mic Boost Capture Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=0, ofs=0
 Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
 Amp-Out vals:  [0x80 0x80]
 Pincap 0x00002334: IN OUT Detect
   Vref caps: HIZ 50 100
 Pin Default 0x01a19036: [Jack] Mic at Ext Rear
   Conn = 1/8, Color = Pink
   DefAssociation = 0x3, Sequence = 0x6
 Pin-ctls: 0x21: IN VREF_50
 Unsolicited: tag=20, enabled=1
 Power states:  D0 D1 D2 D3
 Power: setting=D3, actual=D3
 Connection: 2
    0x0a* 0x0c


Rear jack present (on the motherboard), but nothing connected to it ->
power state D3


> /* capture mixer elements */
> static const struct snd_kcontrol_new vt1718S_capture_mixer[] = {
>        HDA_CODEC_VOLUME("Capture Volume", 0x10, 0x0, HDA_INPUT),
>        HDA_CODEC_MUTE("Capture Switch", 0x10, 0x0, HDA_INPUT),
>        HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x11, 0x0, HDA_INPUT),
>        HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x11, 0x0, HDA_INPUT),
> -       HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x2b, 0x0, HDA_INPUT),
> -       HDA_CODEC_VOLUME("Front Mic Boost Capture Volume", 0x29, 0x0,
> -                        HDA_INPUT),
>
>


This would eliminate both boost volume controls at once, but in normal
conditions (e.g. front audio panel enabled in bios, headset connected
to it) Front Mic Boost works (e.g. I can record sound louder and
noisier). I just wondered if creating "Front Mic Boost Capture Volume"
could have been done dynamically, instead, to match the driver
capability (as is) to avoid creating Volume and Switch controls (on
mixer 0x21) for Front Mic:

with front audio panel missing (disabled in bios):

Node 0x21 [Audio Mixer] wcaps 0x20050b: Stereo Amp-In
 Control: name="Mic Playback Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=1, ofs=0
 Control: name="Mic Playback Switch", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=1, ofs=0
 Control: name="Line Playback Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=2, ofs=0
 Control: name="Line Playback Switch", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=2, ofs=0
 Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
 Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x1f 0x1f] [0x80 0x80] [0x80 0x80]
 Power states:  D0 D1 D2 D3
 Power: setting=D0, actual=D0
 Connection: 5
    0x2c 0x2b 0x2a 0x29 0x28


otherwise:


Node 0x21 [Audio Mixer] wcaps 0x20050b: Stereo Amp-In
 Control: name="Front Mic Playback Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=3, ofs=0
 Control: name="Front Mic Playback Switch", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=3, ofs=0
 Control: name="Rear Mic Playback Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=1, ofs=0
 Control: name="Rear Mic Playback Switch", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=1, ofs=0
 Control: name="Line Playback Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=2, ofs=0
 Control: name="Line Playback Switch", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=2, ofs=0
 Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
 Amp-In vals:  [0x80 0x80] [0x1f 0x1f] [0x1f 0x1f] [0x1f 0x1f] [0x80 0x80]
 Power states:  D0 D1 D2 D3
 Power: setting=D0, actual=D0
 Connection: 5
    0x2c 0x2b 0x2a 0x29 0x28


A possible solution:


/* capture mixer elements */
 static const struct snd_kcontrol_new vt1718S_capture_mixer[] = {
        HDA_CODEC_VOLUME("Capture Volume", 0x10, 0x0, HDA_INPUT),
        HDA_CODEC_MUTE("Capture Switch", 0x10, 0x0, HDA_INPUT),
        HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x11, 0x0, HDA_INPUT),
        HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x11, 0x0, HDA_INPUT),
       HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x2b, 0x0, HDA_INPUT),
 -       HDA_CODEC_VOLUME("Front Mic Boost Capture Volume", 0x29, 0x0,
 -                        HDA_INPUT),

...

+ static const struct snd_kcontrol_new vt1718S_front_mic_boost =
+     HDA_CODEC_VOLUME("Front Mic Boost Capture Volume", 0x29, 0x0,
+                         HDA_INPUT);


+ static int vt1718S_add_front_mic_boost( struct via_spec *spec ){
+        snd_kcontrol_new *knew;
+
+        if( spec->front_panel_out == HDA_HW_WITH_FRONT_PANEL){
+                 knew = via_clone_control( spec, &vt1718S_front_mic_boost );
+                 if( knew == NULL )
+                         return -ENOMEM;
+                 return 1;
+        }
+
+        return 0;
+ }


in struct via_spec:

...

       struct hda_pcm pcm_rec[ VIA_NUM_REC];
+       #define HDA_HW_WITHOUT_FRONT_PANEL      0 /* initial value*/
+       #define HDA_HW_WITH_FRONT_PANEL 1
+       unsigned int front_panel_out; /* used to determine the correct
number of playback pcm substreams */


in via_new_spec():

...

       codec->spec = spec;
       spec->codec = codec;
       spec->codec_type = get_codec_type(codec);
+       spec->front_panel_out = HDA_HW_WITHOUT_FRONT_PANEL;


in via_hp_build():

...

       knew = via_clone_control(spec, &via_hp_mixer[0]);
       if (knew == NULL){
               return -ENOMEM;
       }
       knew->subdevice = HDA_SUBDEV_NID_FLAG | nid;
       knew->private_value = nid;
+       spec->front_panel_out = HDA_HW_WITH_FRONT_PANEL; /* now we
know there's a valid secondary playback pcm substream */


in via_build_pcms():

...

       info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
               spec->multiout.dac_nids[0];
+       /* is this a multistream-capable environment? let's compute
real number of playback pcm substreams */
+       info->stream[SNDRV_PCM_STREAM_PLAYBACK].substreams = 1 +
spec->front_panel_out;


in patch_vt1718S():

...
       if (!spec->adc_nids && spec->input_mux) {
               spec->adc_nids = vt1718S_adc_nids;
               spec->num_adc_nids = ARRAY_SIZE(vt1718S_adc_nids);
               get_mux_nids(codec);
               override_mic_boost(codec, 0x2b, 0, 3, 40);
               override_mic_boost(codec, 0x29, 0, 3, 40);
               spec->mixers[spec->num_mixers] = vt1718S_capture_mixer;
               spec->num_mixers++;
+               vt1718S_add_front_mic_boost( spec );
       }


It worked for me, AFAICT:

With front audio panel _enabled_ in bios:

Node 0x21 [Audio Mixer] wcaps 0x20050b: Stereo Amp-In
 Control: name="Front Mic Playback Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=3, ofs=0
 Control: name="Front Mic Playback Switch", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=3, ofs=0
 Control: name="Rear Mic Playback Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=1, ofs=0
 Control: name="Rear Mic Playback Switch", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=1, ofs=0
 Control: name="Line Playback Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=2, ofs=0
 Control: name="Line Playback Switch", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=2, ofs=0
 Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
 Amp-In vals:  [0x80 0x80] [0x1f 0x1f] [0x1f 0x1f] [0x1f 0x1f] [0x80 0x80]
 Power states:  D0 D1 D2 D3
 Power: setting=D0, actual=D0
 Connection: 5
    0x2c 0x2b 0x2a 0x29 0x28


Node 0x29 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
 Control: name="Front Mic Boost Capture Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=0, ofs=0
 Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
 Amp-Out vals:  [0x80 0x80]
 Pincap 0x0000233c: IN OUT HP Detect
   Vref caps: HIZ 50 100
 Pin Default 0x02a19037: [Jack] Mic at Ext Front
   Conn = 1/8, Color = Pink
   DefAssociation = 0x3, Sequence = 0x7
 Pin-ctls: 0x21: IN VREF_50
 Unsolicited: tag=20, enabled=1
 Power states:  D0 D1 D2 D3
 Power: setting=D0, actual=D0
 Connection: 1
    0x1c


aplay -l output

**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: VT2020 Analog [VT2020 Analog]
 Subdevices: 2/2
 Subdevice #0: subdevice #0
 Subdevice #1: subdevice #1
[...]


and front mic boost control listed in amixer:

Simple mixer control 'Front Mic Boost',0
 Capabilities: cvolume penum
 Capture channels: Front Left - Front Right
 Limits: Capture 0 - 3
 Front Left: Capture 0 [0%] [0.00dB]
 Front Right: Capture 0 [0%] [0.00dB]


With front audio panel _disabled_ in bios:


Node 0x21 [Audio Mixer] wcaps 0x20050b: Stereo Amp-In
 Control: name="Mic Playback Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=1, ofs=0
 Control: name="Mic Playback Switch", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=1, ofs=0
 Control: name="Line Playback Volume", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=2, ofs=0
 Control: name="Line Playback Switch", index=0, device=0
   ControlAmp: chs=3, dir=In, idx=2, ofs=0
 Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
 Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x1f 0x1f] [0x80 0x80] [0x80 0x80]
 Power states:  D0 D1 D2 D3
 Power: setting=D0, actual=D0
 Connection: 5
    0x2c 0x2b 0x2a 0x29 0x28


Node 0x29 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
 Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
 Amp-Out vals:  [0x80 0x80]
 Pincap 0x0000233c: IN OUT HP Detect
   Vref caps: HIZ 50 100
 Pin Default 0x42a190f7: [N/A] Mic at Ext Front
   Conn = 1/8, Color = Pink
   DefAssociation = 0xf, Sequence = 0x7
 Pin-ctls: 0x00: VREF_HIZ
 Unsolicited: tag=20, enabled=1
 Power states:  D0 D1 D2 D3
 Power: setting=D3, actual=D3
 Connection: 1
    0x1c


aplay -l output:

**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: VT2020 Analog [VT2020 Analog]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
[...]

and control "Front Mic Boost" missing in amixer output. Attaching
alsa-info.sh outputs.

Perhaps other codecs could benefit of that, like VT1708S, VT1716S,
VT2002P, VT1812, all creating a "Front Mic Boost Capture Volume"
control statically (each one needing its own modification to
vtxxxxx_capture_mixer, patch_vtxxxxx(), and
vt1718S_add_front_mic_boost() function renamed, moved upward in the
file before patch_vt1708S() and modified with a further
snd_kcontrol_new argument to be used by all others, e.g. called as
vt_add_front_mic_boost( spec, &vt1718S_front_mic_boost ):

+ static int vt_add_front_mic_boost( struct via_spec *spec, const
struct snd_kcontrol_new *fmb_ctl ){
+        snd_kcontrol_new *knew;
+
+        if( spec->front_panel_out == HDA_HW_WITH_FRONT_PANEL){
+                 knew = via_clone_control( spec, fmb_ctl );
+                 if( knew == NULL )
+                         return -ENOMEM;
+                 return 1;
+        }
+
+        return 0;
+ }


 ).


>
> The problem is in hda_verb vt1718S_volume_init_verbs
>
>        /* Amp Indices: CD = 1, Mic1 = 2, Line = 3, Mic2 = 4 */
>        {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
>        {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
>        {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
>        {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
>        {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
>
> node 0x21 of your vt2020 has only 5 connections
>
> Refer to commit 4ab2d53a99b6dcee86837d2a9739bfb9f468db45
>
> you will need to ask the author of this patch since the patch
> explicitly change this non exisiting connection of node 0x21 on your
> vt2020
>
> -       {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
> +       {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
>
>

Will do. Perhaps there could be the need to create a separate
vt2020_volume_init_verbs, unless that operation is due to internal
implementation of the codec (reacting properly to the non-existing
connection write query). Thank you for everything.
- Nascondi testo citato -


> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alsa-info-outputs.tar.gz
Type: application/x-gzip
Size: 12337 bytes
Desc: not available
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20110616/27fd93b7/attachment-0001.gz 


More information about the Alsa-devel mailing list