[alsa-devel] Clevo P170HM / Sager NP8170 audio
Julian Sikorski
belegdol at gmail.com
Fri Dec 2 16:41:52 CET 2011
W dniu 02.12.2011 01:52, Raymond Yau pisze:
> 2011/12/2 Julian Sikorski <belegdol at gmail.com>:
>>>>>> There is a bug in hda-emu which cannot detect two playback switches
>>>>>> "Front" and "Side" create at same switch pin
>>>>>>
>>>>>> Try add the following to dump the value of switch pin
>>>>>>
>>>>>> In function alc_auto_create_multi_out_ctls()
>>>>>>
>>>>>>
>>>>>> + printk(KERN_INFO "%s playback volume %x pin %x\n",name,vol,pin);
>>>>>> err = alc_auto_add_stereo_vol(codec, name, index, vol);
>>>>>> if (err < 0)
>>>>>> return err;
>>>>>> + printk(KERN_INFO "%s playback switch %x\n",name,sw);
>>>>>> err = alc_auto_add_stereo_sw(codec, name, index, sw);
>>>>>> if (err < 0)
>>>>>> return err;
>>>>>
>>>>> This is what is shown in /var/log/messages:
>>>>>
>>>>> Nov 28 11:59:27 snowball2 kernel: [ 19.156689] Front playback volume 2
>>>>> pin 14
>>>>> Nov 28 11:59:27 snowball2 kernel: [ 19.156695] Front playback switch 14
>
> Node 0x14 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
> Control: name="Front Playback Switch", index=0, device=0
> ControlAmp: chs=3, dir=Out, idx=0, ofs=0
> Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
> Amp-Out vals: [0x00 0x00]
> Pincap 0x0001003e: IN OUT HP EAPD Detect Trigger
> EAPD 0x2: EAPD
> Pin Default 0x99130110: [Fixed] Speaker at Int ATAPI
> Conn = ATAPI, Color = Unknown
> DefAssociation = 0x1, Sequence = 0x0
> Misc = NO_PRESENCE
> Pin-ctls: 0x40: OUT
> Unsolicited: tag=00, enabled=0
> Power states: D0 D1 D2 D3
> Power: setting=D0, actual=D0
>
>
>
>>>>> Nov 28 11:59:27 snowball2 kernel: [ 19.156789] Surround playback
>>>>> volume 3 pin 1a
>>>>> Nov 28 11:59:27 snowball2 kernel: [ 19.156794] Surround playback switch 1a
>>>>> Nov 28 11:59:27 snowball2 kernel: [ 19.156956] Side playback volume 5
>>>>> pin 17
>>>>> Nov 28 11:59:27 snowball2 kernel: [ 19.156960] Side playback switch 17
>>>>>
>
> Node 0x17 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
> Control: name="Side Playback Switch", index=0, device=0
> ControlAmp: chs=3, dir=Out, idx=0, ofs=0
> Control: name="Line-Out Jack", index=0, device=0
> Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
> Amp-Out vals: [0x00 0x00]
> Pincap 0x00000036: IN OUT Detect Trigger
> Pin Default 0x01011013: [Jack] Line Out at Ext Rear
> Conn = 1/8, Color = Black
> DefAssociation = 0x1, Sequence = 0x3
> Pin-ctls: 0x40: OUT
> Unsolicited: tag=02, enabled=1
> Power states: D0 D1 D2 D3
> Power: setting=D0, actual=D0
> Connection: 1
> 0x0f
>
>>>>>>
>>>>>>>>>>>>>> Plug the front speaker cables into the Headphone-Out Jack.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> • Line-In Jack = Rear Speaker Out
>>>>>>>>>>>>>> • Microphone-In Jack = Center/Subwoofer Speaker Out
>>>>>>>>>>>>>> • S/PDIF-Out Jack = Side Speaker Out (for 7.1 Surround Sound Only)
>>>>>>
>>>>>>
>>>>>> Method 1) HP Playback volume for HP jack and Speaker Playback Volume
>>>>>>
>>>>>>
>>>>>> fix the "Side Playback Switch" and "Front playback Switch"
>>>>>>
>>>>>> In function alc_auto_create_multi_out_ctls()
>>>>>>
>>>>>> else
>>>>>> - pin = cfg->line_out_pins[i];
>>>>>> + if (cfg->speaker_pins[0] &&
>>>>>> + get_defcfg_location(snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0])) ==
>>>>>> get_defcfg_location(snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0])))
>>>>>> + pin = cfg->speaker_pins[0];
>>>>>> + else
>>>>>> + pin = cfg->line_out_pins[i];
>>>>>>
>>>>>> add "Headpone Playback Volume" by using dac 0x25
>>>>>>
>>>>>> In function alc_auto_fill_dac_nids() and the end of previous patch in
>>>>>> previous email
>>>>>>
>>>>>> spec->multi_ios++;
>>>>>> spec->multiout.num_dacs++;
>>>>>> }
>>>>>> + spec->multiout.hp_out_nid[0] = alc_auto_look_for_dac(codec, cfg->hp_pins[0]);
>>>>>> return 0;
>>>>>>
>>>>>>
>>>>>>>>>>>>>> • S/PDIF-Out Jack = Side Speaker Out (for 7.1 Surround Sound Only)
>>>>>>
>>>>>> assign dac spec->alt_dac_nid for creating alt playback device
>>>>>>
>>>>>> aplay -Dhw:0,2 any.wav
>>>>>>
>>>>>> Try either a) or b) but not both
>>>>>> a) use "side jack" for "alt playback" but device 2 be disabled when
>>>>>> channel mode is 8ch
>>>>>>
>>>>>> In function alc_auto_fill_dac_nids()
>>>>>>
>>>>>> + spec->alt_dac_nid = spec->private_dac_nids[3];
>>>>>> return 0;
>>>>>>
>>>>>> in function alc_set_multi_io()
>>>>>>
>>>>>>
>>>>>> } else {
>>>>>> + if ( i < 2 ) {
>>>>>> - if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
>>>>>> snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
>>>>>> HDA_AMP_MUTE, HDA_AMP_MUTE);
>>>>>> - snd_hda_codec_update_cache(codec, nid, 0,
>>>>>> AC_VERB_SET_PIN_WIDGET_CONTROL,
>>>>>> spec->multi_io[idx].ctl_in);
>>>>>>
>>>>>> + if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
>>>>>> snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
>>>>>> HDA_AMP_MUTE, HDA_AMP_MUTE);
>>>>>> + snd_hda_codec_update_cache(codec, nid, 0,
>>>>>> AC_VERB_SET_PIN_WIDGET_CONTROL,
>>>>>> spec->multi_io[idx].ctl_in);
>>>>>> + }
>>>>>>
>>>>>
>>>>> With the above version and everything is almost perfect:
>>>>>
>>>>> http://www.alsa-project.org/db/?f=35d300b2eaec79699ec37febc6321687a894be50
>>>>>
>>>>> * mute for side channel is present and functions correctly
>>>>> * auto-mute situation is unchanged, but I don't think it matters
>>>>> * speaker/HP controls are much neater
>>>>> - front mute and slider control the internal speakers
>>>>> - headphone mute and slider control the headphone jack
>>>>>
>>>>> The only nitpick would be that the alt device does not work:
>>>>
>>>
>>> I tried 0001-Add-Multistreaming-Playback-using-Front-Panel-Headph.patch,
>>> but unfortunately it does not apply on top of current kernels anymore,
>>> and it is not trivial enough for me to fix.
>>> Anyway, in my opinion it does not make a lot of sense, as the jacks are
>>> 2 cm away from each other and I don't see a use case where someone would
>>> want to play a different sound on each of them.
>>>
>
> Pincap 0x00000036: IN OUT Detect Trigger
> Pin Default 0x01011013: [Jack] Line Out at Ext Rear
>
> As the pincaps of "side" jack does not support HP, so it cannot used
> as dual headphone
>
> it is strange that alt_device cannot be create if you have assign a
> valid dac to spec->alt_dac_nid
>
>>>>>
>>>>> $ aplay -l
>>>>> **** List of PLAYBACK Hardware Devices ****
>>>>> card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
>>>>> Subdevices: 1/1
>>>>> Subdevice #0: subdevice #0
>>>>> card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital]
>>>>> Subdevices: 1/1
>>>>> Subdevice #0: subdevice #0
>>>>> card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
>>>>> Subdevices: 1/1
>>>>> Subdevice #0: subdevice #0
>>>>> card 1: NVidia [HDA NVidia], device 7: HDMI 0 [HDMI 0]
>>>>> Subdevices: 1/1
>>>>> Subdevice #0: subdevice #0
>>>>> card 1: NVidia [HDA NVidia], device 8: HDMI 0 [HDMI 0]
>>>>> Subdevices: 1/1
>>>>> Subdevice #0: subdevice #0
>>>>> card 1: NVidia [HDA NVidia], device 9: HDMI 0 [HDMI 0]
>>>>> Subdevices: 1/1
>>>>> Subdevice #0: subdevice #0
>>>>>
>
> How many hdmi connectors on your nvidia ?
>
> From the viewpoint of the user, I expect only one PCM device for each
> hdmi connector
There is one hdmi and one dvi. I did not try sending sound via hdmi, though.
>
>
>>>>> And that the sound is coming out of the side jack no matter the number
>>>>> of channels.
>>>>>
>>>>>>
>>>>>> b) use "Headphone" for "alt playback"
>>>>>>
>>>>>> In function alc_auto_fill_dac_nids()
>>>>>>
>>>>>> + spec->alt_dac_nid = spec->multiout.hp_out_nid[0];
>>>>>> return 0;
>>>>>
>>>>> I also tried this version (attached with versionb suffix), it works even
>>>>> better. As with version a), controls are working correctly. Auto-mute
>>>>> still mutes upon plugging into either side or headphone jack no matter
>>>>> the alsamixer setting. Alt device is still not there. The improvement is
>>>>> that sound only comes out of the side jack when alsamixer is set to 8
>>>>> channels.
>>>>>
>>>>> http://www.alsa-project.org/db/?f=31f808d43fc26c29718d239600741b5b069ce427
>>>>>
>>>>> So it seems like the version b does everything it is supposed to, maybe
>>>>> aside from the side jack muting behaviour.
>
> if you compled alsa-driver in debug mode, you should see the following
> message in system log.
>
How would I do that? Which config option do I need to change?
> realtek: Enable HP auto-muting on NID 0x1b
> realtek: Enable Line-Out auto-muting on NID 0x17
>
> The drawback is "Front Playback Volume" and "Front Playback Switch"
> does not control the "Headphone Jack" which used as "Front" jack
Not really a drawback, since in an unpatched 3.1.2 kernel there are
separate "Speaker" and "Headphone" controls which are independent of
each other:
http://www.alsa-project.org/db/?f=c8a6fc8ced6993631bad6f754249454323422d1a
>
>
> Node 0x1b [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
> Control: name="Headphone Playback Switch", index=0, device=0
> ControlAmp: chs=3, dir=Out, idx=0, ofs=0
> Control: name="Headphone Jack", index=0, device=0
> Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
> Amp-In vals: [0x00 0x00]
> Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
> Amp-Out vals: [0x00 0x00]
> Pincap 0x0001373e: IN OUT HP EAPD Detect Trigger
> Vref caps: HIZ 50 GRD 80 100
> EAPD 0x0:
> Pin Default 0x0121101f: [Jack] HP Out at Ext Rear
> Conn = 1/8, Color = Black
> DefAssociation = 0x1, Sequence = 0xf
> Pin-ctls: 0xc0: OUT HP VREF_HIZ
> Unsolicited: tag=01, enabled=1
> Power states: D0 D1 D2 D3
> Power: setting=D0, actual=D0
> Connection: 5
> 0x0c 0x0d 0x0e 0x0f 0x26*
>
> The other method is using "hp_pin" instead of "speaker_pin" to assign
> "Front" dac 0x02
>
> but this method won't create "headphone playback volume" and
> "Headphone playback switch" since "hp_pin" is used to create "Front
> Playback Volume" and "Front Playback Switch"
>
>
>>>>> Summing up, when it comes to P150HM, the only missing piece is the
>>>>> internal subwoofer. I tried emailing Andrew, who started this thread,
>>>>> but got no answer so far. The problem might be that we might need to
>>>>> figure out what is that THX TruStudio PRO is doing under Windows that
>>>>> makes the internal subwoofer work.
>>>>
>>>>
>>>> Take a look at the removed model="targa_8ch_dig" which touch those gpio
>>>>
>>>> Have you ask the notebook vendor clevo support/engineer the subwoofer
>>>> is connected to which pin of alc892 ?
>>>
>>> I have just sent an email to Clevo UK Support. Let's see what they answer.
>>
>> I was forwarded to realtek. Is there any way to figure it out ourselves?
>>
>>>
>
> The remaining unused output pin is 0x15 and 0x16
Yes, this is what we figured earlier already. If P170hm is any similar,
0x16 is the sub:
http://mailman.alsa-project.org/pipermail/alsa-devel/2011-August/042981.html
The problem is that, as opposed to 0x17, simply switching the pin from
in to out and unmuting it does not make sound come out of the subwoofer.
Can it be because the center/lfe channel is already assigned to the mic
pin? Or do you think that THX is doing some sort of pre-amplification
which we need to emulate?
Julian
More information about the Alsa-devel
mailing list