All of lore.kernel.org
 help / color / mirror / Atom feed
* Clevo P170HM / Sager NP8170 audio
@ 2011-08-20  7:33 Andrew Mahone
  2011-11-08  5:42 ` Julian Sikorski
  2011-11-24  9:20 ` Julian Sikorski
  0 siblings, 2 replies; 30+ messages in thread
From: Andrew Mahone @ 2011-08-20  7:33 UTC (permalink / raw)
  To: alsa-devel

This laptop is detected as ALC892 audio (and by the codec ID this
seems to be valid), but none of the configurations for it quite match
this device. I've been working on documenting the connections with HDA
Analyzer.

alsa-info output:
http://www.alsa-project.org/db/?f=b86e4c6447867fbd129a36d8a63e2f5caa836c52

The laptop has built-in 5.1, and 5.1 or 7.1 output via jacks.

DAC NIDs:
0x02 front
0x03 rear
0x04 clfe
0x05 side

internal mixers:
0x0c front
0x0d rear
0x0e clfe
0x0f side

internal speaker pins:
0x14 front
0x15 "rear" (front of laptop)
0x16 clfe

external ports:
fixed route:
0x17 side

can select any output:
0x18 mic / output
0x1a line-in / output
0x1b headphone

I've been experimenting with patch_realtek.c to add the extra DAC NID,
and have had some success with a 6-channel mode for the built-in
speakers and an 8-channel mode that mutes all internal speakers and
sets the jacks up for output. I still need to manually connect pins
0x18, 0x1a, 0x1b to the correct internal mixers for 7.1 to work, and
headphone plugin does not mute internal speakers in 5.1 mode. I have
not added a plain stereo mode for internal speakers, although it
appears that i can probably configure the codec to mix the front
channels to center and LFE.

Are there any suggestions for what to do next? My current state as a
patch against the linux-3.0.y repository is at
http://pastie.org/2400649

-- 
Andrew Mahone
andrew DOT mahone AT gmail DOT com

Q: How many voters does it take to change a lightbulb?
A: None - if voting could change anything they'd make it illegal

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-08-20  7:33 Clevo P170HM / Sager NP8170 audio Andrew Mahone
@ 2011-11-08  5:42 ` Julian Sikorski
  2011-11-16 13:08   ` Raymond Yau
  2011-11-24  9:20 ` Julian Sikorski
  1 sibling, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-08  5:42 UTC (permalink / raw)
  To: Andrew Mahone; +Cc: alsa-devel

W dniu 20.08.2011 09:33, Andrew Mahone pisze:
> This laptop is detected as ALC892 audio (and by the codec ID this
> seems to be valid), but none of the configurations for it quite match
> this device. I've been working on documenting the connections with HDA
> Analyzer.
> 
> alsa-info output:
> http://www.alsa-project.org/db/?f=b86e4c6447867fbd129a36d8a63e2f5caa836c52
> 
> The laptop has built-in 5.1, and 5.1 or 7.1 output via jacks.
> 
> DAC NIDs:
> 0x02 front
> 0x03 rear
> 0x04 clfe
> 0x05 side
> 
> internal mixers:
> 0x0c front
> 0x0d rear
> 0x0e clfe
> 0x0f side
> 
> internal speaker pins:
> 0x14 front
> 0x15 "rear" (front of laptop)
> 0x16 clfe
> 
> external ports:
> fixed route:
> 0x17 side
> 
> can select any output:
> 0x18 mic / output
> 0x1a line-in / output
> 0x1b headphone
> 
> I've been experimenting with patch_realtek.c to add the extra DAC NID,
> and have had some success with a 6-channel mode for the built-in
> speakers and an 8-channel mode that mutes all internal speakers and
> sets the jacks up for output. I still need to manually connect pins
> 0x18, 0x1a, 0x1b to the correct internal mixers for 7.1 to work, and
> headphone plugin does not mute internal speakers in 5.1 mode. I have
> not added a plain stereo mode for internal speakers, although it
> appears that i can probably configure the codec to mix the front
> channels to center and LFE.
> 
> Are there any suggestions for what to do next? My current state as a
> patch against the linux-3.0.y repository is at
> http://pastie.org/2400649
> 
Please check out this thread:
http://thread.gmane.org/gmane.linux.alsa.devel/86475
With linux-3.1, everything apart from 8-channel sound seems to work with
autoparser, and I was able to get the sound going out from the analog
part of the spdif jack by fiddling with hda-analyzer:
http://article.gmane.org/gmane.linux.alsa.devel/87235
To get this to work automatically, code needs to be written but this is
beyond my skillset.

Julian

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-08  5:42 ` Julian Sikorski
@ 2011-11-16 13:08   ` Raymond Yau
  2011-11-16 15:15     ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Raymond Yau @ 2011-11-16 13:08 UTC (permalink / raw)
  To: ALSA Development Mailing List

2011/11/8 Julian Sikorski <belegdol@gmail.com>:
> W dniu 20.08.2011 09:33, Andrew Mahone pisze:
>> This laptop is detected as ALC892 audio (and by the codec ID this
>> seems to be valid), but none of the configurations for it quite match
>> this device. I've been working on documenting the connections with HDA
>> Analyzer.
>>
>> alsa-info output:
>> http://www.alsa-project.org/db/?f=b86e4c6447867fbd129a36d8a63e2f5caa836c52
>>
>> The laptop has built-in 5.1, and 5.1 or 7.1 output via jacks.
>>
>> DAC NIDs:
>> 0x02 front
>> 0x03 rear
>> 0x04 clfe
>> 0x05 side
>>
>> internal mixers:
>> 0x0c front
>> 0x0d rear
>> 0x0e clfe
>> 0x0f side
>>
>> internal speaker pins:
>> 0x14 front
>> 0x15 "rear" (front of laptop)
>> 0x16 clfe
>>
>> external ports:
>> fixed route:
>> 0x17 side
>>
>> can select any output:
>> 0x18 mic / output
>> 0x1a line-in / output
>> 0x1b headphone
>>
>> I've been experimenting with patch_realtek.c to add the extra DAC NID,
>> and have had some success with a 6-channel mode for the built-in
>> speakers and an 8-channel mode that mutes all internal speakers and
>> sets the jacks up for output. I still need to manually connect pins
>> 0x18, 0x1a, 0x1b to the correct internal mixers for 7.1 to work, and
>> headphone plugin does not mute internal speakers in 5.1 mode. I have
>> not added a plain stereo mode for internal speakers, although it
>> appears that i can probably configure the codec to mix the front
>> channels to center and LFE.
>>
>> Are there any suggestions for what to do next? My current state as a
>> patch against the linux-3.0.y repository is at
>> http://pastie.org/2400649
>>

your patch only support 6ch and 8ch , you have to add
alc892_clevo_p170hm_ch2_init() ch for stereo playback and ext mic and
line-in jack

seem the bios did not setup "side" jack 0x17 ?

autoconfig: line_outs=3 (0x14/0x16/0x15/0x0/0x0) type:speaker
   speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
   hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
   mono: mono_out=0x0
   dig-out=0x1e/0x0
   inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a

seem need to add  pin default of side jack 0x17 to force the auto
parser to put those speaker pins in correct places

Node 0x17 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x00000036: IN OUT Detect Trigger
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x0f

>> internal speaker pins:
>> 0x14 front
>> 0x15 "rear" (front of laptop)
>> 0x16 clfe


and sort the speaker pin by default association 02, 03, 04 (0x14, 0x15
and 0x16) when all pin defaults have same location

autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
   speaker_outs=3 (0x14/0x16/0x15/0x0/0x0)
   hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
   mono: mono_out=0x0
   dig-out=0x1e/0x0
   inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a


> Please check out this thread:
> http://thread.gmane.org/gmane.linux.alsa.devel/86475
> With linux-3.1, everything apart from 8-channel sound seems to work with
> autoparser, and I was able to get the sound going out from the analog
> part of the spdif jack by fiddling with hda-analyzer:
> http://article.gmane.org/gmane.linux.alsa.devel/87235
> To get this to work automatically, code needs to be written but this is
> beyond my skillset.
>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-16 13:08   ` Raymond Yau
@ 2011-11-16 15:15     ` Julian Sikorski
  2011-11-17  2:08       ` Raymond Yau
  0 siblings, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-16 15:15 UTC (permalink / raw)
  To: alsa-devel

W dniu 16.11.2011 14:08, Raymond Yau pisze:
> 2011/11/8 Julian Sikorski <belegdol@gmail.com>:
>> W dniu 20.08.2011 09:33, Andrew Mahone pisze:
>>> This laptop is detected as ALC892 audio (and by the codec ID this
>>> seems to be valid), but none of the configurations for it quite match
>>> this device. I've been working on documenting the connections with HDA
>>> Analyzer.
>>>
>>> alsa-info output:
>>> http://www.alsa-project.org/db/?f=b86e4c6447867fbd129a36d8a63e2f5caa836c52
>>>
>>> The laptop has built-in 5.1, and 5.1 or 7.1 output via jacks.
>>>
>>> DAC NIDs:
>>> 0x02 front
>>> 0x03 rear
>>> 0x04 clfe
>>> 0x05 side
>>>
>>> internal mixers:
>>> 0x0c front
>>> 0x0d rear
>>> 0x0e clfe
>>> 0x0f side
>>>
>>> internal speaker pins:
>>> 0x14 front
>>> 0x15 "rear" (front of laptop)
>>> 0x16 clfe
>>>
>>> external ports:
>>> fixed route:
>>> 0x17 side
>>>
>>> can select any output:
>>> 0x18 mic / output
>>> 0x1a line-in / output
>>> 0x1b headphone
>>>
>>> I've been experimenting with patch_realtek.c to add the extra DAC NID,
>>> and have had some success with a 6-channel mode for the built-in
>>> speakers and an 8-channel mode that mutes all internal speakers and
>>> sets the jacks up for output. I still need to manually connect pins
>>> 0x18, 0x1a, 0x1b to the correct internal mixers for 7.1 to work, and
>>> headphone plugin does not mute internal speakers in 5.1 mode. I have
>>> not added a plain stereo mode for internal speakers, although it
>>> appears that i can probably configure the codec to mix the front
>>> channels to center and LFE.
>>>
>>> Are there any suggestions for what to do next? My current state as a
>>> patch against the linux-3.0.y repository is at
>>> http://pastie.org/2400649
>>>
> 
> your patch only support 6ch and 8ch , you have to add
> alc892_clevo_p170hm_ch2_init() ch for stereo playback and ext mic and
> line-in jack
> 
> seem the bios did not setup "side" jack 0x17 ?
> 
> autoconfig: line_outs=3 (0x14/0x16/0x15/0x0/0x0) type:speaker
>    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
>    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>    mono: mono_out=0x0
>    dig-out=0x1e/0x0
>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
> 
> seem need to add  pin default of side jack 0x17 to force the auto
> parser to put those speaker pins in correct places
> 
> Node 0x17 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
>   Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
>   Amp-Out vals:  [0x80 0x80]
>   Pincap 0x00000036: IN OUT Detect Trigger
>   Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
>     Conn = 1/8, Color = Black
>     DefAssociation = 0xf, Sequence = 0x0
>     Misc = NO_PRESENCE
>   Pin-ctls: 0x40: OUT
>   Unsolicited: tag=00, enabled=0
>   Power states:  D0 D1 D2 D3 EPSS
>   Power: setting=D0, actual=D0
>   Connection: 1
>      0x0f
> 
>>> internal speaker pins:
>>> 0x14 front
>>> 0x15 "rear" (front of laptop)
>>> 0x16 clfe
> 
> 
> and sort the speaker pin by default association 02, 03, 04 (0x14, 0x15
> and 0x16) when all pin defaults have same location
> 
> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>    speaker_outs=3 (0x14/0x16/0x15/0x0/0x0)
>    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>    mono: mono_out=0x0
>    dig-out=0x1e/0x0
>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
> 
> 
>> Please check out this thread:
>> http://thread.gmane.org/gmane.linux.alsa.devel/86475
>> With linux-3.1, everything apart from 8-channel sound seems to work with
>> autoparser, and I was able to get the sound going out from the analog
>> part of the spdif jack by fiddling with hda-analyzer:
>> http://article.gmane.org/gmane.linux.alsa.devel/87235
>> To get this to work automatically, code needs to be written but this is
>> beyond my skillset.
>>
Keep in mind that IIRC P170HM has 4.1 speakers while P150HM has 2.1. I
think the other audio outputs are the same.

Julian

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-16 15:15     ` Julian Sikorski
@ 2011-11-17  2:08       ` Raymond Yau
  2011-11-17  8:46         ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Raymond Yau @ 2011-11-17  2:08 UTC (permalink / raw)
  To: ALSA Development Mailing List

2011/11/16 Julian Sikorski <belegdol@gmail.com>:
> W dniu 16.11.2011 14:08, Raymond Yau pisze:
>> 2011/11/8 Julian Sikorski <belegdol@gmail.com>:
>>> W dniu 20.08.2011 09:33, Andrew Mahone pisze:
>>>> This laptop is detected as ALC892 audio (and by the codec ID this
>>>> seems to be valid), but none of the configurations for it quite match
>>>> this device. I've been working on documenting the connections with HDA
>>>> Analyzer.
>>>>
>>>> alsa-info output:
>>>> http://www.alsa-project.org/db/?f=b86e4c6447867fbd129a36d8a63e2f5caa836c52
>>>>
>>>> The laptop has built-in 5.1, and 5.1 or 7.1 output via jacks.
>>>>
>>>> DAC NIDs:
>>>> 0x02 front
>>>> 0x03 rear
>>>> 0x04 clfe
>>>> 0x05 side
>>>>
>>>> internal mixers:
>>>> 0x0c front
>>>> 0x0d rear
>>>> 0x0e clfe
>>>> 0x0f side
>>>>
>>>> internal speaker pins:
>>>> 0x14 front
>>>> 0x15 "rear" (front of laptop)
>>>> 0x16 clfe
>>>>
>>>> external ports:
>>>> fixed route:
>>>> 0x17 side
>>>>
>>>> can select any output:
>>>> 0x18 mic / output
>>>> 0x1a line-in / output
>>>> 0x1b headphone
>>>>
>>>> I've been experimenting with patch_realtek.c to add the extra DAC NID,
>>>> and have had some success with a 6-channel mode for the built-in
>>>> speakers and an 8-channel mode that mutes all internal speakers and
>>>> sets the jacks up for output. I still need to manually connect pins
>>>> 0x18, 0x1a, 0x1b to the correct internal mixers for 7.1 to work, and
>>>> headphone plugin does not mute internal speakers in 5.1 mode. I have
>>>> not added a plain stereo mode for internal speakers, although it
>>>> appears that i can probably configure the codec to mix the front
>>>> channels to center and LFE.
>>>>
>>>> Are there any suggestions for what to do next? My current state as a
>>>> patch against the linux-3.0.y repository is at
>>>> http://pastie.org/2400649
>>>>
>>
>> your patch only support 6ch and 8ch , you have to add
>> alc892_clevo_p170hm_ch2_init() ch for stereo playback and ext mic and
>> line-in jack
>>
>> seem the bios did not setup "side" jack 0x17 ?
>>
>> autoconfig: line_outs=3 (0x14/0x16/0x15/0x0/0x0) type:speaker
>>    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
>>    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>    mono: mono_out=0x0
>>    dig-out=0x1e/0x0
>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>
>> seem need to add  pin default of side jack 0x17 to force the auto
>> parser to put those speaker pins in correct places
>>
>> Node 0x17 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
>>   Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
>>   Amp-Out vals:  [0x80 0x80]
>>   Pincap 0x00000036: IN OUT Detect Trigger
>>   Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
>>     Conn = 1/8, Color = Black
>>     DefAssociation = 0xf, Sequence = 0x0
>>     Misc = NO_PRESENCE
>>   Pin-ctls: 0x40: OUT
>>   Unsolicited: tag=00, enabled=0
>>   Power states:  D0 D1 D2 D3 EPSS
>>   Power: setting=D0, actual=D0
>>   Connection: 1
>>      0x0f
>>
>>>> internal speaker pins:
>>>> 0x14 front
>>>> 0x15 "rear" (front of laptop)
>>>> 0x16 clfe
>>
>>
>> and sort the speaker pin by default association 02, 03, 04 (0x14, 0x15
>> and 0x16) when all pin defaults have same location
>>
>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>    speaker_outs=3 (0x14/0x16/0x15/0x0/0x0)
>>    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>    mono: mono_out=0x0
>>    dig-out=0x1e/0x0
>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>
>>
>>> Please check out this thread:
>>> http://thread.gmane.org/gmane.linux.alsa.devel/86475
>>> With linux-3.1, everything apart from 8-channel sound seems to work with
>>> autoparser, and I was able to get the sound going out from the analog
>>> part of the spdif jack by fiddling with hda-analyzer:
>>> http://article.gmane.org/gmane.linux.alsa.devel/87235
>>> To get this to work automatically, code needs to be written but this is
>>> beyond my skillset.
>>>
> Keep in mind that IIRC P170HM has 4.1 speakers while P150HM has 2.1. I
> think the other audio outputs are the same.
>

>>>> internal speaker pins:
>>>> 0x14 front
>>>> 0x15 "rear" (front of laptop)
>>>> 0x16 clfe

Do you mean the speaker info is incorrect as there is no center ?

0x16 is a stereo pin, and you have to check whether the subwoofer is
connected to left, right or both

Let the auto parser to put the speakers pin in autocfg 's line out won't help

the four jacks need alc883_4st_8ch mixer of "targa-8ch-dig" which has
been removed

http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=7a689ebcefe5feba626816929fd75046e455a96f;hp=34913cda7af335d748a424d91984576b8c9d9cae

The main problem is the signal of "rear" speaker of the notebook is
not really at the rear of the user.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-17  2:08       ` Raymond Yau
@ 2011-11-17  8:46         ` Julian Sikorski
  2011-11-17  8:55           ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-17  8:46 UTC (permalink / raw)
  To: alsa-devel

W dniu 17.11.2011 03:08, Raymond Yau pisze:
> 2011/11/16 Julian Sikorski <belegdol@gmail.com>:
>> W dniu 16.11.2011 14:08, Raymond Yau pisze:
>>> 2011/11/8 Julian Sikorski <belegdol@gmail.com>:
>>>> W dniu 20.08.2011 09:33, Andrew Mahone pisze:
>>>>> This laptop is detected as ALC892 audio (and by the codec ID this
>>>>> seems to be valid), but none of the configurations for it quite match
>>>>> this device. I've been working on documenting the connections with HDA
>>>>> Analyzer.
>>>>>
>>>>> alsa-info output:
>>>>> http://www.alsa-project.org/db/?f=b86e4c6447867fbd129a36d8a63e2f5caa836c52
>>>>>
>>>>> The laptop has built-in 5.1, and 5.1 or 7.1 output via jacks.
>>>>>
>>>>> DAC NIDs:
>>>>> 0x02 front
>>>>> 0x03 rear
>>>>> 0x04 clfe
>>>>> 0x05 side
>>>>>
>>>>> internal mixers:
>>>>> 0x0c front
>>>>> 0x0d rear
>>>>> 0x0e clfe
>>>>> 0x0f side
>>>>>
>>>>> internal speaker pins:
>>>>> 0x14 front
>>>>> 0x15 "rear" (front of laptop)
>>>>> 0x16 clfe
>>>>>
>>>>> external ports:
>>>>> fixed route:
>>>>> 0x17 side
>>>>>
>>>>> can select any output:
>>>>> 0x18 mic / output
>>>>> 0x1a line-in / output
>>>>> 0x1b headphone
>>>>>
>>>>> I've been experimenting with patch_realtek.c to add the extra DAC NID,
>>>>> and have had some success with a 6-channel mode for the built-in
>>>>> speakers and an 8-channel mode that mutes all internal speakers and
>>>>> sets the jacks up for output. I still need to manually connect pins
>>>>> 0x18, 0x1a, 0x1b to the correct internal mixers for 7.1 to work, and
>>>>> headphone plugin does not mute internal speakers in 5.1 mode. I have
>>>>> not added a plain stereo mode for internal speakers, although it
>>>>> appears that i can probably configure the codec to mix the front
>>>>> channels to center and LFE.
>>>>>
>>>>> Are there any suggestions for what to do next? My current state as a
>>>>> patch against the linux-3.0.y repository is at
>>>>> http://pastie.org/2400649
>>>>>
>>>
>>> your patch only support 6ch and 8ch , you have to add
>>> alc892_clevo_p170hm_ch2_init() ch for stereo playback and ext mic and
>>> line-in jack
>>>
>>> seem the bios did not setup "side" jack 0x17 ?
>>>
>>> autoconfig: line_outs=3 (0x14/0x16/0x15/0x0/0x0) type:speaker
>>>    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
>>>    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>    mono: mono_out=0x0
>>>    dig-out=0x1e/0x0
>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>
>>> seem need to add  pin default of side jack 0x17 to force the auto
>>> parser to put those speaker pins in correct places
>>>
>>> Node 0x17 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
>>>   Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
>>>   Amp-Out vals:  [0x80 0x80]
>>>   Pincap 0x00000036: IN OUT Detect Trigger
>>>   Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
>>>     Conn = 1/8, Color = Black
>>>     DefAssociation = 0xf, Sequence = 0x0
>>>     Misc = NO_PRESENCE
>>>   Pin-ctls: 0x40: OUT
>>>   Unsolicited: tag=00, enabled=0
>>>   Power states:  D0 D1 D2 D3 EPSS
>>>   Power: setting=D0, actual=D0
>>>   Connection: 1
>>>      0x0f
>>>
>>>>> internal speaker pins:
>>>>> 0x14 front
>>>>> 0x15 "rear" (front of laptop)
>>>>> 0x16 clfe
>>>
>>>
>>> and sort the speaker pin by default association 02, 03, 04 (0x14, 0x15
>>> and 0x16) when all pin defaults have same location
>>>
>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>    speaker_outs=3 (0x14/0x16/0x15/0x0/0x0)
>>>    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>    mono: mono_out=0x0
>>>    dig-out=0x1e/0x0
>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>
>>>
>>>> Please check out this thread:
>>>> http://thread.gmane.org/gmane.linux.alsa.devel/86475
>>>> With linux-3.1, everything apart from 8-channel sound seems to work with
>>>> autoparser, and I was able to get the sound going out from the analog
>>>> part of the spdif jack by fiddling with hda-analyzer:
>>>> http://article.gmane.org/gmane.linux.alsa.devel/87235
>>>> To get this to work automatically, code needs to be written but this is
>>>> beyond my skillset.
>>>>
>> Keep in mind that IIRC P170HM has 4.1 speakers while P150HM has 2.1. I
>> think the other audio outputs are the same.
>>
> 
>>>>> internal speaker pins:
>>>>> 0x14 front
>>>>> 0x15 "rear" (front of laptop)
>>>>> 0x16 clfe
> 
> Do you mean the speaker info is incorrect as there is no center ?
> 
> 0x16 is a stereo pin, and you have to check whether the subwoofer is
> connected to left, right or both
> 
> Let the auto parser to put the speakers pin in autocfg 's line out won't help
> 
> the four jacks need alc883_4st_8ch mixer of "targa-8ch-dig" which has
> been removed
> 
> http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=7a689ebcefe5feba626816929fd75046e455a96f;hp=34913cda7af335d748a424d91984576b8c9d9cae
> 
> The main problem is the signal of "rear" speaker of the notebook is
> not really at the rear of the user.
I cannot speak for P170HM as I do not have one, but on P150HM there are
two speakers between the screen and the keyboard and something supposed
to act as a subwoofer on the bottom side of the laptop. On Windows 7 you
need THX TruStudio PRO to make it work. No center speaker that I know of.
There are service manuals with schematics for these laptops floating
around the internet. ALC892 connections are described on page 86 for
P150HM and page 91 for P170HM. You should be able to understand far more
than I.

Regards,
Julian

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-17  8:46         ` Julian Sikorski
@ 2011-11-17  8:55           ` Julian Sikorski
  2011-11-19  2:31             ` Raymond Yau
  0 siblings, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-17  8:55 UTC (permalink / raw)
  To: alsa-devel

W dniu 17.11.2011 09:46, Julian Sikorski pisze:
> W dniu 17.11.2011 03:08, Raymond Yau pisze:
>> 2011/11/16 Julian Sikorski <belegdol@gmail.com>:
>>> W dniu 16.11.2011 14:08, Raymond Yau pisze:
>>>> 2011/11/8 Julian Sikorski <belegdol@gmail.com>:
>>>>> W dniu 20.08.2011 09:33, Andrew Mahone pisze:
>>>>>> This laptop is detected as ALC892 audio (and by the codec ID this
>>>>>> seems to be valid), but none of the configurations for it quite match
>>>>>> this device. I've been working on documenting the connections with HDA
>>>>>> Analyzer.
>>>>>>
>>>>>> alsa-info output:
>>>>>> http://www.alsa-project.org/db/?f=b86e4c6447867fbd129a36d8a63e2f5caa836c52
>>>>>>
>>>>>> The laptop has built-in 5.1, and 5.1 or 7.1 output via jacks.
>>>>>>
>>>>>> DAC NIDs:
>>>>>> 0x02 front
>>>>>> 0x03 rear
>>>>>> 0x04 clfe
>>>>>> 0x05 side
>>>>>>
>>>>>> internal mixers:
>>>>>> 0x0c front
>>>>>> 0x0d rear
>>>>>> 0x0e clfe
>>>>>> 0x0f side
>>>>>>
>>>>>> internal speaker pins:
>>>>>> 0x14 front
>>>>>> 0x15 "rear" (front of laptop)
>>>>>> 0x16 clfe
>>>>>>
>>>>>> external ports:
>>>>>> fixed route:
>>>>>> 0x17 side
>>>>>>
>>>>>> can select any output:
>>>>>> 0x18 mic / output
>>>>>> 0x1a line-in / output
>>>>>> 0x1b headphone
>>>>>>
>>>>>> I've been experimenting with patch_realtek.c to add the extra DAC NID,
>>>>>> and have had some success with a 6-channel mode for the built-in
>>>>>> speakers and an 8-channel mode that mutes all internal speakers and
>>>>>> sets the jacks up for output. I still need to manually connect pins
>>>>>> 0x18, 0x1a, 0x1b to the correct internal mixers for 7.1 to work, and
>>>>>> headphone plugin does not mute internal speakers in 5.1 mode. I have
>>>>>> not added a plain stereo mode for internal speakers, although it
>>>>>> appears that i can probably configure the codec to mix the front
>>>>>> channels to center and LFE.
>>>>>>
>>>>>> Are there any suggestions for what to do next? My current state as a
>>>>>> patch against the linux-3.0.y repository is at
>>>>>> http://pastie.org/2400649
>>>>>>
>>>>
>>>> your patch only support 6ch and 8ch , you have to add
>>>> alc892_clevo_p170hm_ch2_init() ch for stereo playback and ext mic and
>>>> line-in jack
>>>>
>>>> seem the bios did not setup "side" jack 0x17 ?
>>>>
>>>> autoconfig: line_outs=3 (0x14/0x16/0x15/0x0/0x0) type:speaker
>>>>    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
>>>>    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>>    mono: mono_out=0x0
>>>>    dig-out=0x1e/0x0
>>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>>
>>>> seem need to add  pin default of side jack 0x17 to force the auto
>>>> parser to put those speaker pins in correct places
>>>>
>>>> Node 0x17 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
>>>>   Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
>>>>   Amp-Out vals:  [0x80 0x80]
>>>>   Pincap 0x00000036: IN OUT Detect Trigger
>>>>   Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
>>>>     Conn = 1/8, Color = Black
>>>>     DefAssociation = 0xf, Sequence = 0x0
>>>>     Misc = NO_PRESENCE
>>>>   Pin-ctls: 0x40: OUT
>>>>   Unsolicited: tag=00, enabled=0
>>>>   Power states:  D0 D1 D2 D3 EPSS
>>>>   Power: setting=D0, actual=D0
>>>>   Connection: 1
>>>>      0x0f
>>>>
>>>>>> internal speaker pins:
>>>>>> 0x14 front
>>>>>> 0x15 "rear" (front of laptop)
>>>>>> 0x16 clfe
>>>>
>>>>
>>>> and sort the speaker pin by default association 02, 03, 04 (0x14, 0x15
>>>> and 0x16) when all pin defaults have same location
>>>>
>>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>>    speaker_outs=3 (0x14/0x16/0x15/0x0/0x0)
>>>>    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>>    mono: mono_out=0x0
>>>>    dig-out=0x1e/0x0
>>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>>
>>>>
>>>>> Please check out this thread:
>>>>> http://thread.gmane.org/gmane.linux.alsa.devel/86475
>>>>> With linux-3.1, everything apart from 8-channel sound seems to work with
>>>>> autoparser, and I was able to get the sound going out from the analog
>>>>> part of the spdif jack by fiddling with hda-analyzer:
>>>>> http://article.gmane.org/gmane.linux.alsa.devel/87235
>>>>> To get this to work automatically, code needs to be written but this is
>>>>> beyond my skillset.
>>>>>
>>> Keep in mind that IIRC P170HM has 4.1 speakers while P150HM has 2.1. I
>>> think the other audio outputs are the same.
>>>
>>
>>>>>> internal speaker pins:
>>>>>> 0x14 front
>>>>>> 0x15 "rear" (front of laptop)
>>>>>> 0x16 clfe
>>
>> Do you mean the speaker info is incorrect as there is no center ?
>>
>> 0x16 is a stereo pin, and you have to check whether the subwoofer is
>> connected to left, right or both
>>
>> Let the auto parser to put the speakers pin in autocfg 's line out won't help
>>
>> the four jacks need alc883_4st_8ch mixer of "targa-8ch-dig" which has
>> been removed
>>
>> http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=7a689ebcefe5feba626816929fd75046e455a96f;hp=34913cda7af335d748a424d91984576b8c9d9cae
>>
>> The main problem is the signal of "rear" speaker of the notebook is
>> not really at the rear of the user.
> I cannot speak for P170HM as I do not have one, but on P150HM there are
> two speakers between the screen and the keyboard and something supposed
> to act as a subwoofer on the bottom side of the laptop. On Windows 7 you
> need THX TruStudio PRO to make it work. No center speaker that I know of.
> There are service manuals with schematics for these laptops floating
> around the internet. ALC892 connections are described on page 86 for
> P150HM and page 91 for P170HM. You should be able to understand far more
> than I.
> 
> Regards,
> Julian
> 
>From the official (non-service) manual, page 309:

Audio
High Definition Audio
3D Enhanced Sound System
S/PDIF Digital Output
Built-In Microphone
THX TruStudio Pro
7.1CH Audio output supported by
headphone, microphone, S/PDIF & Line-
In Jack
Models A & B:
2 Built-In Speakers and One Sub Woofer
Model C:
5 Built-In Speakers and One Sub Woofer

Model A is P150HM, and model C is P170HM.

Regards,
Julian

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-17  8:55           ` Julian Sikorski
@ 2011-11-19  2:31             ` Raymond Yau
  2011-11-19  9:11               ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Raymond Yau @ 2011-11-19  2:31 UTC (permalink / raw)
  To: ALSA Development Mailing List

2011/11/17 Julian Sikorski <belegdol@gmail.com>:

>>>
>>> the four jacks need alc883_4st_8ch mixer of "targa-8ch-dig" which has
>>> been removed
>>>
>>> http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=7a689ebcefe5feba626816929fd75046e455a96f;hp=34913cda7af335d748a424d91984576b8c9d9cae
>>>
>>> The main problem is the signal of "rear" speaker of the notebook is
>>> not really at the rear of the user.
>> I cannot speak for P170HM as I do not have one, but on P150HM there are
>> two speakers between the screen and the keyboard and something supposed
>> to act as a subwoofer on the bottom side of the laptop. On Windows 7 you
>> need THX TruStudio PRO to make it work. No center speaker that I know of.
>> There are service manuals with schematics for these laptops floating
>> around the internet. ALC892 connections are described on page 86 for
>> P150HM and page 91 for P170HM. You should be able to understand far more
>> than I.
>>
>> Regards,
>> Julian
>>
> From the official (non-service) manual, page 309:
>
> Audio
> High Definition Audio
> 3D Enhanced Sound System
> S/PDIF Digital Output
> Built-In Microphone
> THX TruStudio Pro
> 7.1CH Audio output supported by
> headphone, microphone, S/PDIF & Line-
> In Jack
> Models A & B:
> 2 Built-In Speakers and One Sub Woofer
> Model C:
> 5 Built-In Speakers and One Sub Woofer
>
> Model A is P150HM, and model C is P170HM.
>

Refer to P170HM 's photo in user manual

There are 3 speakers and a subwoofer at the bottom of the laptop and
two speakers at the top

Refer to user manual of P150HM,

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)

7. As you plug in each cable a dialog box will pop up (see “Auto Popup
Dialog” on
page 2 - 9).

Auto Popup Dialog mean support jack detect

you can try David's hda-jack-sense-test.py

http://thread.gmane.org/gmane.linux.alsa.devel/85051


Is Node 0x17 also the side jack of your p150hm ?
pin cap support Detect and Trigger but Misc = NO_PRESENCE

which node is your subwoofer ?

Refer to your P150HM alsa-info

http://thread.gmane.org/gmane.linux.alsa.devel/86475/focus=86601


Node 0x17 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x00000036: IN OUT Detect Trigger
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x20: IN
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x0f



autoconfig: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker
   speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
   hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
   mono: mono_out=0x0
   dig-out=0x1e/0x0
   inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a

CTRL: add: Channel Mode:0
CTRL: add: Headphone Playback Volume:0
CTRL: add: Headphone Playback Switch:0
CTRL: add: Surround Playback Volume:0
CTRL: add: Surround Playback Switch:0
CTRL: add: Center Playback Volume:0
CTRL: add: LFE Playback Volume:0
CTRL: add: Center Playback Switch:0
CTRL: add: LFE Playback Switch:0
CTRL: add: Speaker Playback Volume:0
CTRL: add: Speaker Playback Switch:0
> jack
NID 0x14: cfg 0x99130110: [Fixed] Speaker at Int ATAPI
NID 0x18: cfg 0x01a11c30: [Jack] Mic at Ext Rear
NID 0x19: cfg 0x99a30931: [Fixed] Mic at Int ATAPI
NID 0x1a: cfg 0x0181143f: [Jack] Line In at Ext Rear
NID 0x1b: cfg 0x0121101f: [Jack] HP Out at Ext Rear
NID 0x1e: cfg 0x01451120: [Jack] SPDIF Out at Ext Rear
> get 1
1 Channel Mode:0
ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]



Node 0x1b [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
  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 0x2: EAPD
  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=04, enabled=1
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 5
     0x0c* 0x0d 0x0e 0x0f 0x26

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-19  2:31             ` Raymond Yau
@ 2011-11-19  9:11               ` Julian Sikorski
  2011-11-21  6:47                 ` Raymond Yau
  0 siblings, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-19  9:11 UTC (permalink / raw)
  To: alsa-devel

W dniu 19.11.2011 03:31, Raymond Yau pisze:
> 2011/11/17 Julian Sikorski <belegdol@gmail.com>:
> 
>>>>
>>>> the four jacks need alc883_4st_8ch mixer of "targa-8ch-dig" which has
>>>> been removed
>>>>
>>>> http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=7a689ebcefe5feba626816929fd75046e455a96f;hp=34913cda7af335d748a424d91984576b8c9d9cae
>>>>
>>>> The main problem is the signal of "rear" speaker of the notebook is
>>>> not really at the rear of the user.
>>> I cannot speak for P170HM as I do not have one, but on P150HM there are
>>> two speakers between the screen and the keyboard and something supposed
>>> to act as a subwoofer on the bottom side of the laptop. On Windows 7 you
>>> need THX TruStudio PRO to make it work. No center speaker that I know of.
>>> There are service manuals with schematics for these laptops floating
>>> around the internet. ALC892 connections are described on page 86 for
>>> P150HM and page 91 for P170HM. You should be able to understand far more
>>> than I.
>>>
>>> Regards,
>>> Julian
>>>
>> From the official (non-service) manual, page 309:
>>
>> Audio
>> High Definition Audio
>> 3D Enhanced Sound System
>> S/PDIF Digital Output
>> Built-In Microphone
>> THX TruStudio Pro
>> 7.1CH Audio output supported by
>> headphone, microphone, S/PDIF & Line-
>> In Jack
>> Models A & B:
>> 2 Built-In Speakers and One Sub Woofer
>> Model C:
>> 5 Built-In Speakers and One Sub Woofer
>>
>> Model A is P150HM, and model C is P170HM.
>>
> 
> Refer to P170HM 's photo in user manual
> 
> There are 3 speakers and a subwoofer at the bottom of the laptop and
> two speakers at the top
> 
> Refer to user manual of P150HM,
> 
> 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)
> 
> 7. As you plug in each cable a dialog box will pop up (see “Auto Popup
> Dialog” on
> page 2 - 9).
> 
> Auto Popup Dialog mean support jack detect
> 
> you can try David's hda-jack-sense-test.py
> 
> http://thread.gmane.org/gmane.linux.alsa.devel/85051

Yes, it is working:
[julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
Pin 0x18 (Black Mic): present = No
Pin 0x1a (Black Line In): present = No
Pin 0x1b (Black HP Out): present = Yes
[julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
Pin 0x18 (Black Mic): present = No
Pin 0x1a (Black Line In): present = No
Pin 0x1b (Black HP Out): present = No
[julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
Pin 0x18 (Black Mic): present = No
Pin 0x1a (Black Line In): present = Yes
Pin 0x1b (Black HP Out): present = No
[julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
Pin 0x18 (Black Mic): present = Yes
Pin 0x1a (Black Line In): present = No
Pin 0x1b (Black HP Out): present = No

> 
> 
> Is Node 0x17 also the side jack of your p150hm ?
> pin cap support Detect and Trigger but Misc = NO_PRESENCE

Yes, it is between mic and line in jacks, third one from the front. The
only difference is that there is red light coming out of it.

> 
> which node is your subwoofer ?

This I have not figured out yet unfortunately. Keep in mind that in
windows you need THX TruStudio PRO to get it working, and the config is
advertised as stereo. There was a discussion about this on
notebookreview forums [1], so maybe it configured in some weird way?

[1]
http://forum.notebookreview.com/sager-clevo/577492-subwoofer-p150hm-not-working.html

> 
> Refer to your P150HM alsa-info
> 
> http://thread.gmane.org/gmane.linux.alsa.devel/86475/focus=86601
> 
> 
> Node 0x17 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
>   Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
>   Amp-Out vals:  [0x80 0x80]
>   Pincap 0x00000036: IN OUT Detect Trigger
>   Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
>     Conn = 1/8, Color = Black
>     DefAssociation = 0xf, Sequence = 0x0
>     Misc = NO_PRESENCE
>   Pin-ctls: 0x20: IN
>   Unsolicited: tag=00, enabled=0
>   Power states:  D0 D1 D2 D3 EPSS
>   Power: setting=D0, actual=D0
>   Connection: 1
>      0x0f
> 
> 
> 
> autoconfig: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker
>    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
>    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>    mono: mono_out=0x0
>    dig-out=0x1e/0x0
>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
> 
> CTRL: add: Channel Mode:0
> CTRL: add: Headphone Playback Volume:0
> CTRL: add: Headphone Playback Switch:0
> CTRL: add: Surround Playback Volume:0
> CTRL: add: Surround Playback Switch:0
> CTRL: add: Center Playback Volume:0
> CTRL: add: LFE Playback Volume:0
> CTRL: add: Center Playback Switch:0
> CTRL: add: LFE Playback Switch:0
> CTRL: add: Speaker Playback Volume:0
> CTRL: add: Speaker Playback Switch:0
>> jack
> NID 0x14: cfg 0x99130110: [Fixed] Speaker at Int ATAPI
> NID 0x18: cfg 0x01a11c30: [Jack] Mic at Ext Rear
> NID 0x19: cfg 0x99a30931: [Fixed] Mic at Int ATAPI
> NID 0x1a: cfg 0x0181143f: [Jack] Line In at Ext Rear
> NID 0x1b: cfg 0x0121101f: [Jack] HP Out at Ext Rear
> NID 0x1e: cfg 0x01451120: [Jack] SPDIF Out at Ext Rear
>> get 1
> 1 Channel Mode:0
> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
> 
> 
> 
> Node 0x1b [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
>   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 0x2: EAPD
>   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=04, enabled=1
>   Power states:  D0 D1 D2 D3 EPSS
>   Power: setting=D0, actual=D0
>   Connection: 5
>      0x0c* 0x0d 0x0e 0x0f 0x26

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-19  9:11               ` Julian Sikorski
@ 2011-11-21  6:47                 ` Raymond Yau
  2011-11-21 11:39                   ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Raymond Yau @ 2011-11-21  6:47 UTC (permalink / raw)
  To: ALSA Development Mailing List

2011/11/19 Julian Sikorski <belegdol@gmail.com>:
>>> From the official (non-service) manual, page 309:
>>>
>>> Audio
>>> High Definition Audio
>>> 3D Enhanced Sound System
>>> S/PDIF Digital Output
>>> Built-In Microphone
>>> THX TruStudio Pro
>>> 7.1CH Audio output supported by
>>> headphone, microphone, S/PDIF & Line-
>>> In Jack
>>> Models A & B:
>>> 2 Built-In Speakers and One Sub Woofer
>>> Model C:
>>> 5 Built-In Speakers and One Sub Woofer
>>>
>>> Model A is P150HM, and model C is P170HM.
>>>
>>
>> Refer to P170HM 's photo in user manual
>>
>> There are 3 speakers and a subwoofer at the bottom of the laptop and
>> two speakers at the top
>>
>> Refer to user manual of P150HM,
>>
>> 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)

You may need to ask Takashi , David, PA developers and Media
controller developers how to handle this case

since it may need to set_pin_ctl to PIN_HP and PIN_OUT of 0x1b and
retasking of input jacks as output  whether PA or Media controller API
expect to change the name of the volume control and switch from
"Headphone" to "Front" by hda-reconfig

http://thread.gmane.org/gmane.linux.alsa.devel/91334

>>
>> 7. As you plug in each cable a dialog box will pop up (see “Auto Popup
>> Dialog” on
>> page 2 - 9).
>>
>> Auto Popup Dialog mean support jack detect
>>
>> you can try David's hda-jack-sense-test.py
>>
>> http://thread.gmane.org/gmane.linux.alsa.devel/85051
>
> Yes, it is working:
> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
> Pin 0x18 (Black Mic): present = No
> Pin 0x1a (Black Line In): present = No
> Pin 0x1b (Black HP Out): present = Yes
> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
> Pin 0x18 (Black Mic): present = No
> Pin 0x1a (Black Line In): present = No
> Pin 0x1b (Black HP Out): present = No
> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
> Pin 0x18 (Black Mic): present = No
> Pin 0x1a (Black Line In): present = Yes
> Pin 0x1b (Black HP Out): present = No
> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
> Pin 0x18 (Black Mic): present = Yes
> Pin 0x1a (Black Line In): present = No
> Pin 0x1b (Black HP Out): present = No

>>
>>
>> Is Node 0x17 also the side jack of your p150hm ?
>> pin cap support Detect and Trigger but Misc = NO_PRESENCE
>
> Yes, it is between mic and line in jacks, third one from the front. The
> only difference is that there is red light coming out of it.
>

you can use hda-verb to set the pin default of 0x17 and use
hda-jack-sense-test retest the side jack

The red light is due to you turn "IEC958 Default PCM" on since this
switch copy the signal to digital out

If you don't use SPDIF, may need to turn off this switch to turn off
red light and save power for your notebook

Simple mixer control 'IEC958 Default PCM',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [on]


To add the missing pin default of side jack 0x17

	ALC662_FIXUP_ASUS_MODE8,
+	ALC892_FIXUP_CLEVO_4ST_8CH,
};

static const struct alc_fixup alc662_fixups[] = {


+	[ALC892_FIXUP_CLEVO_4ST_8CH] = {
+		.type = ALC_FIXUP_PINS,
+		.v.pins = (const struct alc_pincfg[]) {
+/*
+  need to be same location as the other jack
+  may need to change the default association and sequence since
+  Lower Default Association values would be higher in priority for resources
+  such as processing nodes or Input and Output Converters.
+  A value of 0000b is reserved and should not be used
+*/
+			{ 0x17, 0x01011013 }, /* Side */
+			{ }
+		},
+	},


+	SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
+	SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),

SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
out(grey) at same location (ext rear)   for surround71 (and also 1
speakers, 1 int mic)


hda_codec: ALC1200: BIOS auto-probing.
hda_codec: ALC1200: SKU not ready 0x598301f0
autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
   speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
   hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
   mono: mono_out=0x0
   dig-out=0x1e/0x0
   inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a


CTRL: add: Line-Out Jack:0
CTRL: add: Headphone Jack:0
CTRL: add: Mic Jack:0
CTRL: add: Line Jack:0

> get 1
1 Channel Mode:0
ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]

what is missing are
1) 8ch in "Channel Mode" ,
2) Side Playback Volume
3)Side Playback Switch

Study the logic to add 8ch and "side" in

1) alc_auto_fill_dac_nids()
2) alc_auto_fill_multi_ios() which add line-in and mic jack to multi_ios,


This mean that when switch to 6/8 channel mode, it will conflict with
automic detection since the pin cap alc892 's mic jack does not
support impedance sense and the driver does not know the plug is mic
or speaker by measuring the impedance

The driver have to disable automic detection when user switch "channel
mode" to 6ch/8ch as the user should still able to use the internal mic
when the external mic jack is retasked as output


>>
>> which node is your subwoofer ?
>
> This I have not figured out yet unfortunately. Keep in mind that in
> windows you need THX TruStudio PRO to get it working, and the config is
> advertised as stereo. There was a discussion about this on
> notebookreview forums [1], so maybe it configured in some weird way?
>

you have to find out whether subwoofer is connected to 0x16 of your
p150hm since your mic jack (retasked as clfe) is connected to dac 0x4.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-21  6:47                 ` Raymond Yau
@ 2011-11-21 11:39                   ` Julian Sikorski
  2011-11-22  5:17                     ` Raymond Yau
  0 siblings, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-21 11:39 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 7568 bytes --]

W dniu 21.11.2011 07:47, Raymond Yau pisze:
> 2011/11/19 Julian Sikorski <belegdol@gmail.com>:
>>>> From the official (non-service) manual, page 309:
>>>>
>>>> Audio
>>>> High Definition Audio
>>>> 3D Enhanced Sound System
>>>> S/PDIF Digital Output
>>>> Built-In Microphone
>>>> THX TruStudio Pro
>>>> 7.1CH Audio output supported by
>>>> headphone, microphone, S/PDIF & Line-
>>>> In Jack
>>>> Models A & B:
>>>> 2 Built-In Speakers and One Sub Woofer
>>>> Model C:
>>>> 5 Built-In Speakers and One Sub Woofer
>>>>
>>>> Model A is P150HM, and model C is P170HM.
>>>>
>>>
>>> Refer to P170HM 's photo in user manual
>>>
>>> There are 3 speakers and a subwoofer at the bottom of the laptop and
>>> two speakers at the top
>>>
>>> Refer to user manual of P150HM,
>>>
>>> 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)
> 
> You may need to ask Takashi , David, PA developers and Media
> controller developers how to handle this case
> 
> since it may need to set_pin_ctl to PIN_HP and PIN_OUT of 0x1b and
> retasking of input jacks as output  whether PA or Media controller API
> expect to change the name of the volume control and switch from
> "Headphone" to "Front" by hda-reconfig
> 
> http://thread.gmane.org/gmane.linux.alsa.devel/91334
> 
>>>
>>> 7. As you plug in each cable a dialog box will pop up (see “Auto Popup
>>> Dialog” on
>>> page 2 - 9).
>>>
>>> Auto Popup Dialog mean support jack detect
>>>
>>> you can try David's hda-jack-sense-test.py
>>>
>>> http://thread.gmane.org/gmane.linux.alsa.devel/85051
>>
>> Yes, it is working:
>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>> Pin 0x18 (Black Mic): present = No
>> Pin 0x1a (Black Line In): present = No
>> Pin 0x1b (Black HP Out): present = Yes
>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>> Pin 0x18 (Black Mic): present = No
>> Pin 0x1a (Black Line In): present = No
>> Pin 0x1b (Black HP Out): present = No
>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>> Pin 0x18 (Black Mic): present = No
>> Pin 0x1a (Black Line In): present = Yes
>> Pin 0x1b (Black HP Out): present = No
>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>> Pin 0x18 (Black Mic): present = Yes
>> Pin 0x1a (Black Line In): present = No
>> Pin 0x1b (Black HP Out): present = No
> 
>>>
>>>
>>> Is Node 0x17 also the side jack of your p150hm ?
>>> pin cap support Detect and Trigger but Misc = NO_PRESENCE
>>
>> Yes, it is between mic and line in jacks, third one from the front. The
>> only difference is that there is red light coming out of it.
>>
> 
> you can use hda-verb to set the pin default of 0x17 and use
> hda-jack-sense-test retest the side jack

Well, it kind of works:
* I was able to assign 0x01011013 to pin 0x17 using user_pin_configs
* it then shows up in hda-jack-sense-test.py, which detects if the jack
is connected
$ sudo python hda-jack-sense-test.py
[sudo] password for julas:
Pin 0x17 (Black Line Out): present = Yes
Pin 0x18 (Black Mic): present = No
Pin 0x1a (Black Line In): present = No
Pin 0x1b (Black HP Out): present = No
* for some reason this program started locking up after showing the
output, I am not sure if this is related.
I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
attached). After reboot:
* hda-jack-sense-test.py was still working, without lockups this time
* alsamixer -c0 revealed a new "Front" slider, which was controlling the
volume on 0x17
* there was still no 8-channel mode (probably related to what you wrote
below)
* there were more options for auto mute (Disabled, Speaker Only, Line
Out+Speaker)
* here is the new alsa-info.sh:
http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052

> 
> The red light is due to you turn "IEC958 Default PCM" on since this
> switch copy the signal to digital out
> 
> If you don't use SPDIF, may need to turn off this switch to turn off
> red light and save power for your notebook

I can indeed turn off the red light by muting the S/PDIF item in alsamixer.

> 
> Simple mixer control 'IEC958 Default PCM',0
>   Capabilities: pswitch pswitch-joined penum
>   Playback channels: Mono
>   Mono: Playback [on]
> 
> 
> To add the missing pin default of side jack 0x17
> 
> 	ALC662_FIXUP_ASUS_MODE8,
> +	ALC892_FIXUP_CLEVO_4ST_8CH,
> };
> 
> static const struct alc_fixup alc662_fixups[] = {
> 
> 
> +	[ALC892_FIXUP_CLEVO_4ST_8CH] = {
> +		.type = ALC_FIXUP_PINS,
> +		.v.pins = (const struct alc_pincfg[]) {
> +/*
> +  need to be same location as the other jack
> +  may need to change the default association and sequence since
> +  Lower Default Association values would be higher in priority for resources
> +  such as processing nodes or Input and Output Converters.
> +  A value of 0000b is reserved and should not be used
> +*/
> +			{ 0x17, 0x01011013 }, /* Side */
> +			{ }
> +		},
> +	},
> 
> 
> +	SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
> +	SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
> 
> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
> out(grey) at same location (ext rear)   for surround71 (and also 1
> speakers, 1 int mic)
> 
> 
> hda_codec: ALC1200: BIOS auto-probing.
> hda_codec: ALC1200: SKU not ready 0x598301f0
> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>    mono: mono_out=0x0
>    dig-out=0x1e/0x0
>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
> 
> 
> CTRL: add: Line-Out Jack:0
> CTRL: add: Headphone Jack:0
> CTRL: add: Mic Jack:0
> CTRL: add: Line Jack:0
> 
>> get 1
> 1 Channel Mode:0
> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
> 
> what is missing are
> 1) 8ch in "Channel Mode" ,
> 2) Side Playback Volume
> 3)Side Playback Switch
> 
> Study the logic to add 8ch and "side" in
> 
> 1) alc_auto_fill_dac_nids()
> 2) alc_auto_fill_multi_ios() which add line-in and mic jack to multi_ios,

I am sorry, I am afraid I lack the knowledge to do that. What I can do
is test patches and commands, but writing new code is beyond my skillset.

> 
> 
> This mean that when switch to 6/8 channel mode, it will conflict with
> automic detection since the pin cap alc892 's mic jack does not
> support impedance sense and the driver does not know the plug is mic
> or speaker by measuring the impedance
> 
> The driver have to disable automic detection when user switch "channel
> mode" to 6ch/8ch as the user should still able to use the internal mic
> when the external mic jack is retasked as output
> 
> 
>>>
>>> which node is your subwoofer ?
>>
>> This I have not figured out yet unfortunately. Keep in mind that in
>> windows you need THX TruStudio PRO to get it working, and the config is
>> advertised as stereo. There was a discussion about this on
>> notebookreview forums [1], so maybe it configured in some weird way?
>>
> 
> you have to find out whether subwoofer is connected to 0x16 of your
> p150hm since your mic jack (retasked as clfe) is connected to dac 0x4.

Simply changing this pin to out and unmuting it did not work (this is
the way I discovered 0x17.


[-- Attachment #2: clevo-0x17.patch --]
[-- Type: text/x-patch, Size: 1432 bytes --]

diff -up ./sound/pci/hda/patch_realtek.c~ ./sound/pci/hda/patch_realtek.c
--- ./sound/pci/hda/patch_realtek.c~	2011-10-24 09:10:05.000000000 +0200
+++ ./sound/pci/hda/patch_realtek.c	2011-11-21 11:34:54.838250254 +0100
@@ -5121,9 +5121,24 @@
 	ALC662_FIXUP_CZC_P10T,
 	ALC662_FIXUP_SKU_IGNORE,
 	ALC662_FIXUP_HP_RP5800,
+	ALC892_FIXUP_CLEVO_4ST_8CH,
 };
 
 static const struct alc_fixup alc662_fixups[] = {
+	[ALC892_FIXUP_CLEVO_4ST_8CH] = {
+		.type = ALC_FIXUP_PINS,
+		.v.pins = (const struct alc_pincfg[]) {
+/*
+  need to be same location as the other jack
+  may need to change the default association and sequence since
+  Lower Default Association values would be higher in priority for resources
+  such as processing nodes or Input and Output Converters.
+  A value of 0000b is reserved and should not be used
+*/
+			{ 0x17, 0x01011013 }, /* Side */
+			{ }
+		},
+	},
 	[ALC662_FIXUP_ASPIRE] = {
 		.type = ALC_FIXUP_PINS,
 		.v.pins = (const struct alc_pincfg[]) {
@@ -5170,6 +5184,8 @@ static const struct snd_pci_quirk alc662
 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
+	SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
+	SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
 	{}
 };
 


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-21 11:39                   ` Julian Sikorski
@ 2011-11-22  5:17                     ` Raymond Yau
  2011-11-22 12:45                       ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Raymond Yau @ 2011-11-22  5:17 UTC (permalink / raw)
  To: ALSA Development Mailing List

2011/11/21 Julian Sikorski <belegdol@gmail.com>:
> W dniu 21.11.2011 07:47, Raymond Yau pisze:
>> 2011/11/19 Julian Sikorski <belegdol@gmail.com>:
>>>>> From the official (non-service) manual, page 309:
>>>>>
>>>>
>>>> Refer to P170HM 's photo in user manual
>>>>
>>>> There are 3 speakers and a subwoofer at the bottom of the laptop and
>>>> two speakers at the top
>>>>
>>>> Refer to user manual of P150HM,
>>>>
>>>> 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)
>>
>> You may need to ask Takashi , David, PA developers and Media
>> controller developers how to handle this case
>>
>> since it may need to set_pin_ctl to PIN_HP and PIN_OUT of 0x1b and
>> retasking of input jacks as output  whether PA or Media controller API
>> expect to change the name of the volume control and switch from
>> "Headphone" to "Front" by hda-reconfig
>>
>> http://thread.gmane.org/gmane.linux.alsa.devel/91334
>>
>>>>
>>>> 7. As you plug in each cable a dialog box will pop up (see “Auto Popup
>>>> Dialog” on
>>>> page 2 - 9).
>>>>
>>>> Auto Popup Dialog mean support jack detect
>>>>
>>>> you can try David's hda-jack-sense-test.py
>>>>
>>>> http://thread.gmane.org/gmane.linux.alsa.devel/85051
>>>
>>> Yes, it is working:
>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>> Pin 0x18 (Black Mic): present = No
>>> Pin 0x1a (Black Line In): present = No
>>> Pin 0x1b (Black HP Out): present = Yes
>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>> Pin 0x18 (Black Mic): present = No
>>> Pin 0x1a (Black Line In): present = No
>>> Pin 0x1b (Black HP Out): present = No
>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>> Pin 0x18 (Black Mic): present = No
>>> Pin 0x1a (Black Line In): present = Yes
>>> Pin 0x1b (Black HP Out): present = No
>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>> Pin 0x18 (Black Mic): present = Yes
>>> Pin 0x1a (Black Line In): present = No
>>> Pin 0x1b (Black HP Out): present = No
>>
>>>>
>>>>
>>>> Is Node 0x17 also the side jack of your p150hm ?
>>>> pin cap support Detect and Trigger but Misc = NO_PRESENCE
>>>
>>> Yes, it is between mic and line in jacks, third one from the front. The
>>> only difference is that there is red light coming out of it.
>>>
>>
>> you can use hda-verb to set the pin default of 0x17 and use
>> hda-jack-sense-test retest the side jack
>
> Well, it kind of works:
> * I was able to assign 0x01011013 to pin 0x17 using user_pin_configs
> * it then shows up in hda-jack-sense-test.py, which detects if the jack
> is connected
> $ sudo python hda-jack-sense-test.py
> [sudo] password for julas:
> Pin 0x17 (Black Line Out): present = Yes
> Pin 0x18 (Black Mic): present = No
> Pin 0x1a (Black Line In): present = No
> Pin 0x1b (Black HP Out): present = No
> * for some reason this program started locking up after showing the
> output, I am not sure if this is related.
> I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
> attached). After reboot:
> * hda-jack-sense-test.py was still working, without lockups this time
> * alsamixer -c0 revealed a new "Front" slider, which was controlling the
> volume on 0x17
> * there was still no 8-channel mode (probably related to what you wrote
> below)
> * there were more options for auto mute (Disabled, Speaker Only, Line
> Out+Speaker)
> * here is the new alsa-info.sh:
> http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052
>

You can add the following code to assign dac and pin in alc_auto_fill_dac_nids()

However this cannot create "Headphone Playback Volume" and "Speaker
Playback Volume"


 again:
	/* set num_dacs once to full for alc_auto_look_for_dac() */
	spec->multiout.num_dacs = cfg->line_outs;
	spec->multiout.hp_out_nid[0] = 0;
	spec->multiout.extra_out_nid[0] = 0;
	memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
	spec->multiout.dac_nids = spec->private_dac_nids;

+/*
+	may check bit 2 of SKU ID in alc_subsystem_id() to determine this is
a laptop with 4 jacks
+	 * 2 : 0 --> Desktop, 1 --> Laptop
+*/
+	if (cfg->hp_outs == 1 && cfg->line_outs == 1 && cfg->speaker_outs >= 1) {
+		num_pins = 0;
+		spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec, cfg->hp_pins[0]);
+		spec->multi_io[num_pins].pin = cfg->hp_pins[0];
+		spec->multi_io[num_pins].dac = spec->private_dac_nids[0];
+		num_pins++;
+		defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
+		location = get_defcfg_location(defcfg);
+		spec->multiout.num_dacs = 1;
+		num_pins = alc_auto_fill_multi_ios(codec, location, 0);
+		if (num_pins > 0) {
+			spec->multi_ios = num_pins;
+			spec->ext_channel_count = 2;
+		}
+		spec->private_dac_nids[3] = alc_auto_look_for_dac(codec,
cfg->line_out_pins[0]);
+		spec->multi_io[num_pins].pin = cfg->line_out_pins[0];
+		spec->multi_io[num_pins].dac = spec->private_dac_nids[3];
+		spec->multi_ios++;
+		spec->multiout.max_channels = 2;
+		spec->multiout.num_dacs = 1;
+/*
+	Still missing
+	1) need to swap dac of hp with speaker to create speaker volume
+	2) hda-jack of mic, line and side
+       3) p170hm has 5.1 speakers
+*/
+		spec->multiout.extra_out_nid[0] =
+			get_dac_if_single(codec, cfg->speaker_pins[0]);
+		return 0;
+	}


>>
>> To add the missing pin default of side jack 0x17
>>
>>       ALC662_FIXUP_ASUS_MODE8,
>> +     ALC892_FIXUP_CLEVO_4ST_8CH,
>> };
>>
>> static const struct alc_fixup alc662_fixups[] = {
>>
>>
>> +     [ALC892_FIXUP_CLEVO_4ST_8CH] = {
>> +             .type = ALC_FIXUP_PINS,
>> +             .v.pins = (const struct alc_pincfg[]) {
>> +/*
>> +  need to be same location as the other jack
>> +  may need to change the default association and sequence since
>> +  Lower Default Association values would be higher in priority for resources
>> +  such as processing nodes or Input and Output Converters.
>> +  A value of 0000b is reserved and should not be used
>> +*/
>> +                     { 0x17, 0x01011013 }, /* Side */
>> +                     { }
>> +             },
>> +     },
>>
>>
>> +     SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>> +     SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>
>> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
>> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
>> out(grey) at same location (ext rear)   for surround71 (and also 1
>> speakers, 1 int mic)
>>
>>
>> hda_codec: ALC1200: BIOS auto-probing.
>> hda_codec: ALC1200: SKU not ready 0x598301f0
>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>>    mono: mono_out=0x0
>>    dig-out=0x1e/0x0
>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>
>>
>> CTRL: add: Line-Out Jack:0
>> CTRL: add: Headphone Jack:0
>> CTRL: add: Mic Jack:0
>> CTRL: add: Line Jack:0
>>
>>> get 1
>> 1 Channel Mode:0
>> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
>>
>> what is missing are
>> 1) 8ch in "Channel Mode" ,
>> 2) Side Playback Volume
>> 3)Side Playback Switch
>>
>> Study the logic to add 8ch and "side" in
>>
>> 1) alc_auto_fill_dac_nids()
>> 2) alc_auto_fill_multi_ios() which add line-in and mic jack to multi_ios,
>
> I am sorry, I am afraid I lack the knowledge to do that. What I can do
> is test patches and commands, but writing new code is beyond my skillset.
>
>>
>>
>> This mean that when switch to 6/8 channel mode, it will conflict with
>> automic detection since the pin cap alc892 's mic jack does not
>> support impedance sense and the driver does not know the plug is mic
>> or speaker by measuring the impedance
>>
>> The driver have to disable automic detection when user switch "channel
>> mode" to 6ch/8ch as the user should still able to use the internal mic
>> when the external mic jack is retasked as output
>>
>>
>>>>
>>>> which node is your subwoofer ?
>>>
>>> This I have not figured out yet unfortunately. Keep in mind that in
>>> windows you need THX TruStudio PRO to get it working, and the config is
>>> advertised as stereo. There was a discussion about this on
>>> notebookreview forums [1], so maybe it configured in some weird way?
>>>
>>
>> you have to find out whether subwoofer is connected to 0x16 of your
>> p150hm since your mic jack (retasked as clfe) is connected to dac 0x4.
>
> Simply changing this pin to out and unmuting it did not work (this is
> the way I discovered 0x17.
>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-22  5:17                     ` Raymond Yau
@ 2011-11-22 12:45                       ` Julian Sikorski
  2011-11-25  6:39                         ` Raymond Yau
  0 siblings, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-22 12:45 UTC (permalink / raw)
  To: alsa-devel

W dniu 22.11.2011 06:17, Raymond Yau pisze:
> 2011/11/21 Julian Sikorski <belegdol@gmail.com>:
>> W dniu 21.11.2011 07:47, Raymond Yau pisze:
>>> 2011/11/19 Julian Sikorski <belegdol@gmail.com>:
>>>>>> From the official (non-service) manual, page 309:
>>>>>>
>>>>>
>>>>> Refer to P170HM 's photo in user manual
>>>>>
>>>>> There are 3 speakers and a subwoofer at the bottom of the laptop and
>>>>> two speakers at the top
>>>>>
>>>>> Refer to user manual of P150HM,
>>>>>
>>>>> 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)
>>>
>>> You may need to ask Takashi , David, PA developers and Media
>>> controller developers how to handle this case
>>>
>>> since it may need to set_pin_ctl to PIN_HP and PIN_OUT of 0x1b and
>>> retasking of input jacks as output  whether PA or Media controller API
>>> expect to change the name of the volume control and switch from
>>> "Headphone" to "Front" by hda-reconfig
>>>
>>> http://thread.gmane.org/gmane.linux.alsa.devel/91334
>>>
>>>>>
>>>>> 7. As you plug in each cable a dialog box will pop up (see “Auto Popup
>>>>> Dialog” on
>>>>> page 2 - 9).
>>>>>
>>>>> Auto Popup Dialog mean support jack detect
>>>>>
>>>>> you can try David's hda-jack-sense-test.py
>>>>>
>>>>> http://thread.gmane.org/gmane.linux.alsa.devel/85051
>>>>
>>>> Yes, it is working:
>>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>>> Pin 0x18 (Black Mic): present = No
>>>> Pin 0x1a (Black Line In): present = No
>>>> Pin 0x1b (Black HP Out): present = Yes
>>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>>> Pin 0x18 (Black Mic): present = No
>>>> Pin 0x1a (Black Line In): present = No
>>>> Pin 0x1b (Black HP Out): present = No
>>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>>> Pin 0x18 (Black Mic): present = No
>>>> Pin 0x1a (Black Line In): present = Yes
>>>> Pin 0x1b (Black HP Out): present = No
>>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>>> Pin 0x18 (Black Mic): present = Yes
>>>> Pin 0x1a (Black Line In): present = No
>>>> Pin 0x1b (Black HP Out): present = No
>>>
>>>>>
>>>>>
>>>>> Is Node 0x17 also the side jack of your p150hm ?
>>>>> pin cap support Detect and Trigger but Misc = NO_PRESENCE
>>>>
>>>> Yes, it is between mic and line in jacks, third one from the front. The
>>>> only difference is that there is red light coming out of it.
>>>>
>>>
>>> you can use hda-verb to set the pin default of 0x17 and use
>>> hda-jack-sense-test retest the side jack
>>
>> Well, it kind of works:
>> * I was able to assign 0x01011013 to pin 0x17 using user_pin_configs
>> * it then shows up in hda-jack-sense-test.py, which detects if the jack
>> is connected
>> $ sudo python hda-jack-sense-test.py
>> [sudo] password for julas:
>> Pin 0x17 (Black Line Out): present = Yes
>> Pin 0x18 (Black Mic): present = No
>> Pin 0x1a (Black Line In): present = No
>> Pin 0x1b (Black HP Out): present = No
>> * for some reason this program started locking up after showing the
>> output, I am not sure if this is related.
>> I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
>> attached). After reboot:
>> * hda-jack-sense-test.py was still working, without lockups this time
>> * alsamixer -c0 revealed a new "Front" slider, which was controlling the
>> volume on 0x17
>> * there was still no 8-channel mode (probably related to what you wrote
>> below)
>> * there were more options for auto mute (Disabled, Speaker Only, Line
>> Out+Speaker)
>> * here is the new alsa-info.sh:
>> http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052
>>
> 
> You can add the following code to assign dac and pin in alc_auto_fill_dac_nids()
> 
> However this cannot create "Headphone Playback Volume" and "Speaker
> Playback Volume"
> 

I am also not sure what you mean by HP and Speaker Playback Volumes - it
is working now, even with unpatched Fedora kernels (3.1.1-2.fc16).
With this patch applied on top of sound/master tree it is much worse:
* Front and HP sliders are gone
* only 2-ch sound is working, changing to 4, 6, or 8 does not produce
output on any of the other jacks
* just to be sure, I checked sound/master tree without both of your
patches, and both Headphone/Speaker, as well as 4 and 6 channel sound
are working fine.

> 
>  again:
> 	/* set num_dacs once to full for alc_auto_look_for_dac() */
> 	spec->multiout.num_dacs = cfg->line_outs;
> 	spec->multiout.hp_out_nid[0] = 0;
> 	spec->multiout.extra_out_nid[0] = 0;
> 	memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
> 	spec->multiout.dac_nids = spec->private_dac_nids;
> 
> +/*
> +	may check bit 2 of SKU ID in alc_subsystem_id() to determine this is
> a laptop with 4 jacks
> +	 * 2 : 0 --> Desktop, 1 --> Laptop
> +*/
> +	if (cfg->hp_outs == 1 && cfg->line_outs == 1 && cfg->speaker_outs >= 1) {
> +		num_pins = 0;
> +		spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec, cfg->hp_pins[0]);
> +		spec->multi_io[num_pins].pin = cfg->hp_pins[0];
> +		spec->multi_io[num_pins].dac = spec->private_dac_nids[0];
> +		num_pins++;
> +		defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
> +		location = get_defcfg_location(defcfg);
> +		spec->multiout.num_dacs = 1;
> +		num_pins = alc_auto_fill_multi_ios(codec, location, 0);
> +		if (num_pins > 0) {
> +			spec->multi_ios = num_pins;
> +			spec->ext_channel_count = 2;
> +		}
> +		spec->private_dac_nids[3] = alc_auto_look_for_dac(codec,
> cfg->line_out_pins[0]);
> +		spec->multi_io[num_pins].pin = cfg->line_out_pins[0];
> +		spec->multi_io[num_pins].dac = spec->private_dac_nids[3];
> +		spec->multi_ios++;
> +		spec->multiout.max_channels = 2;
> +		spec->multiout.num_dacs = 1;
> +/*
> +	Still missing
> +	1) need to swap dac of hp with speaker to create speaker volume
> +	2) hda-jack of mic, line and side
> +       3) p170hm has 5.1 speakers
> +*/
> +		spec->multiout.extra_out_nid[0] =
> +			get_dac_if_single(codec, cfg->speaker_pins[0]);
> +		return 0;
> +	}
> 
> 
>>>
>>> To add the missing pin default of side jack 0x17
>>>
>>>       ALC662_FIXUP_ASUS_MODE8,
>>> +     ALC892_FIXUP_CLEVO_4ST_8CH,
>>> };
>>>
>>> static const struct alc_fixup alc662_fixups[] = {
>>>
>>>
>>> +     [ALC892_FIXUP_CLEVO_4ST_8CH] = {
>>> +             .type = ALC_FIXUP_PINS,
>>> +             .v.pins = (const struct alc_pincfg[]) {
>>> +/*
>>> +  need to be same location as the other jack
>>> +  may need to change the default association and sequence since
>>> +  Lower Default Association values would be higher in priority for resources
>>> +  such as processing nodes or Input and Output Converters.
>>> +  A value of 0000b is reserved and should not be used
>>> +*/
>>> +                     { 0x17, 0x01011013 }, /* Side */
>>> +                     { }
>>> +             },
>>> +     },
>>>
>>>
>>> +     SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>> +     SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>
>>> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
>>> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
>>> out(grey) at same location (ext rear)   for surround71 (and also 1
>>> speakers, 1 int mic)
>>>
>>>
>>> hda_codec: ALC1200: BIOS auto-probing.
>>> hda_codec: ALC1200: SKU not ready 0x598301f0
>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>>>    mono: mono_out=0x0
>>>    dig-out=0x1e/0x0
>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>
>>>
>>> CTRL: add: Line-Out Jack:0
>>> CTRL: add: Headphone Jack:0
>>> CTRL: add: Mic Jack:0
>>> CTRL: add: Line Jack:0
>>>
>>>> get 1
>>> 1 Channel Mode:0
>>> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
>>>
>>> what is missing are
>>> 1) 8ch in "Channel Mode" ,
>>> 2) Side Playback Volume
>>> 3)Side Playback Switch
>>>
>>> Study the logic to add 8ch and "side" in
>>>
>>> 1) alc_auto_fill_dac_nids()
>>> 2) alc_auto_fill_multi_ios() which add line-in and mic jack to multi_ios,
>>
>> I am sorry, I am afraid I lack the knowledge to do that. What I can do
>> is test patches and commands, but writing new code is beyond my skillset.
>>
>>>
>>>
>>> This mean that when switch to 6/8 channel mode, it will conflict with
>>> automic detection since the pin cap alc892 's mic jack does not
>>> support impedance sense and the driver does not know the plug is mic
>>> or speaker by measuring the impedance
>>>
>>> The driver have to disable automic detection when user switch "channel
>>> mode" to 6ch/8ch as the user should still able to use the internal mic
>>> when the external mic jack is retasked as output
>>>
>>>
>>>>>
>>>>> which node is your subwoofer ?
>>>>
>>>> This I have not figured out yet unfortunately. Keep in mind that in
>>>> windows you need THX TruStudio PRO to get it working, and the config is
>>>> advertised as stereo. There was a discussion about this on
>>>> notebookreview forums [1], so maybe it configured in some weird way?
>>>>
>>>
>>> you have to find out whether subwoofer is connected to 0x16 of your
>>> p150hm since your mic jack (retasked as clfe) is connected to dac 0x4.
>>
>> Simply changing this pin to out and unmuting it did not work (this is
>> the way I discovered 0x17.
>>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-08-20  7:33 Clevo P170HM / Sager NP8170 audio Andrew Mahone
  2011-11-08  5:42 ` Julian Sikorski
@ 2011-11-24  9:20 ` Julian Sikorski
  2011-11-24 10:03   ` Julian Sikorski
  1 sibling, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-24  9:20 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 1852 bytes --]

W dniu 20.08.2011 09:33, Andrew Mahone pisze:
> This laptop is detected as ALC892 audio (and by the codec ID this
> seems to be valid), but none of the configurations for it quite match
> this device. I've been working on documenting the connections with HDA
> Analyzer.
> 
> alsa-info output:
> http://www.alsa-project.org/db/?f=b86e4c6447867fbd129a36d8a63e2f5caa836c52
> 
> The laptop has built-in 5.1, and 5.1 or 7.1 output via jacks.
> 
> DAC NIDs:
> 0x02 front
> 0x03 rear
> 0x04 clfe
> 0x05 side
> 
> internal mixers:
> 0x0c front
> 0x0d rear
> 0x0e clfe
> 0x0f side
> 
> internal speaker pins:
> 0x14 front
> 0x15 "rear" (front of laptop)
> 0x16 clfe
> 
> external ports:
> fixed route:
> 0x17 side
> 
> can select any output:
> 0x18 mic / output
> 0x1a line-in / output
> 0x1b headphone
> 
> I've been experimenting with patch_realtek.c to add the extra DAC NID,
> and have had some success with a 6-channel mode for the built-in
> speakers and an 8-channel mode that mutes all internal speakers and
> sets the jacks up for output. I still need to manually connect pins
> 0x18, 0x1a, 0x1b to the correct internal mixers for 7.1 to work, and
> headphone plugin does not mute internal speakers in 5.1 mode. I have
> not added a plain stereo mode for internal speakers, although it
> appears that i can probably configure the codec to mix the front
> channels to center and LFE.
> 
> Are there any suggestions for what to do next? My current state as a
> patch against the linux-3.0.y repository is at
> http://pastie.org/2400649
> 
I tried this patch (attached a version ported to 3.1.x kernel) with
P150HM and I was still unable to get sound out of the subwoofer when on
6 channel mode, could nonexisting rear be interfering?
As Andrew said, 8 channel mode works once you manually unmute and
reattach mixers using hda-analyzer.

Regards,
Julian

[-- Attachment #2: clevo-p170hm-quirk.patch --]
[-- Type: text/x-patch, Size: 3117 bytes --]

--- vanilla-3.1/sound/pci/hda/alc662_quirks.c	2011-10-24 09:10:05.000000000 +0200
+++ linux-3.1.x86_64/sound/pci/hda/alc662_quirks.c	2011-11-24 08:29:00.443842837 +0100
@@ -29,15 +29,16 @@
 	ALC272_DELL,
 	ALC272_DELL_ZM1,
 	ALC272_SAMSUNG_NC10,
+	ALC892_CLEVO_P170HM,
 	ALC662_MODEL_LAST,
 };
 
 #define ALC662_DIGOUT_NID	0x06
 #define ALC662_DIGIN_NID	0x0a
 
-static const hda_nid_t alc662_dac_nids[3] = {
-	/* front, rear, clfe */
-	0x02, 0x03, 0x04
+static const hda_nid_t alc662_dac_nids[4] = {
+	/* front, rear, clfe, side */
+	0x02, 0x03, 0x04, 0x05
 };
 
 static const hda_nid_t alc272_dac_nids[2] = {
@@ -172,6 +173,39 @@
 	{ 6, alc662_sixstack_ch8_init },
 };
 
+/*
+ * 6ch mode
+ */
+static const struct hda_verb alc892_clevo_p170hm_ch6_init[] = {
+	{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
+	{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ } /* end */
+};
+
+/*
+ * 8ch mode
+ */
+static const struct hda_verb alc892_clevo_p170hm_ch8_init[] = {
+	{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ } /* end */
+};
+
+static const struct hda_channel_mode alc892_clevo_p170hm_modes[2] = {
+	{ 6, alc892_clevo_p170hm_ch6_init },
+	{ 8, alc892_clevo_p170hm_ch8_init },
+};
+
 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
  *                 Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
  */
@@ -547,6 +581,12 @@
 	{}
 };
 
+static const struct hda_verb alc892_clevo_p170hm_init_verbs[] = {
+	{0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT},
+	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
+	{}
+};
+
 /* Set Unsolicited Event*/
 static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
 	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -987,6 +1027,7 @@
 	[ALC272_DELL]		= "dell",
 	[ALC272_DELL_ZM1]	= "dell-zm1",
 	[ALC272_SAMSUNG_NC10]	= "samsung-nc10",
+	[ALC892_CLEVO_P170HM]   = "clevo-p170hm",
 	[ALC662_AUTO]		= "auto",
 };
 
@@ -1403,6 +1444,18 @@
 		.setup = alc663_mode4_setup,
 		.init_hook = alc_inithook,
 	},
+	[ALC892_CLEVO_P170HM] = {
+		.mixers = { alc662_base_mixer, alc662_chmode_mixer },
+		.init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs, alc892_clevo_p170hm_init_verbs },
+		.num_dacs = ARRAY_SIZE(alc662_dac_nids),
+		.dac_nids = alc662_dac_nids,
+		.dig_out_nid = ALC662_DIGOUT_NID,
+		.dig_in_nid = ALC662_DIGIN_NID,
+		.num_channel_mode = ARRAY_SIZE(alc892_clevo_p170hm_modes),
+		.channel_mode = alc892_clevo_p170hm_modes,
+		.input_mux = &alc662_capture_source,
+		.init_hook = alc_inithook,
+	},
 };
 
 

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-24  9:20 ` Julian Sikorski
@ 2011-11-24 10:03   ` Julian Sikorski
  2011-11-24 10:30     ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-24 10:03 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 2126 bytes --]

W dniu 24.11.2011 10:20, Julian Sikorski pisze:
> W dniu 20.08.2011 09:33, Andrew Mahone pisze:
>> This laptop is detected as ALC892 audio (and by the codec ID this
>> seems to be valid), but none of the configurations for it quite match
>> this device. I've been working on documenting the connections with HDA
>> Analyzer.
>>
>> alsa-info output:
>> http://www.alsa-project.org/db/?f=b86e4c6447867fbd129a36d8a63e2f5caa836c52
>>
>> The laptop has built-in 5.1, and 5.1 or 7.1 output via jacks.
>>
>> DAC NIDs:
>> 0x02 front
>> 0x03 rear
>> 0x04 clfe
>> 0x05 side
>>
>> internal mixers:
>> 0x0c front
>> 0x0d rear
>> 0x0e clfe
>> 0x0f side
>>
>> internal speaker pins:
>> 0x14 front
>> 0x15 "rear" (front of laptop)
>> 0x16 clfe
>>
>> external ports:
>> fixed route:
>> 0x17 side
>>
>> can select any output:
>> 0x18 mic / output
>> 0x1a line-in / output
>> 0x1b headphone
>>
>> I've been experimenting with patch_realtek.c to add the extra DAC NID,
>> and have had some success with a 6-channel mode for the built-in
>> speakers and an 8-channel mode that mutes all internal speakers and
>> sets the jacks up for output. I still need to manually connect pins
>> 0x18, 0x1a, 0x1b to the correct internal mixers for 7.1 to work, and
>> headphone plugin does not mute internal speakers in 5.1 mode. I have
>> not added a plain stereo mode for internal speakers, although it
>> appears that i can probably configure the codec to mix the front
>> channels to center and LFE.
>>
>> Are there any suggestions for what to do next? My current state as a
>> patch against the linux-3.0.y repository is at
>> http://pastie.org/2400649
>>
> I tried this patch (attached a version ported to 3.1.x kernel) with
> P150HM and I was still unable to get sound out of the subwoofer when on
> 6 channel mode, could nonexisting rear be interfering?

I tried a similar patch but also no luck there... Any ideas why the
subwoofer might not be working? Is there a way to somehow eavesdrop the
windows driver?

> As Andrew said, 8 channel mode works once you manually unmute and
> reattach mixers using hda-analyzer.
> 
> Regards,
> Julian
> 
> 
> 


[-- Attachment #2: clevo-p150hm-quirk.patch --]
[-- Type: text/x-patch, Size: 3114 bytes --]

--- vanilla-3.1/sound/pci/hda/alc662_quirks.c	2011-10-24 09:10:05.000000000 +0200
+++ linux-3.1.x86_64/sound/pci/hda/alc662_quirks.c	2011-11-24 08:29:00.443842837 +0100
@@ -29,15 +29,16 @@
 	ALC272_DELL,
 	ALC272_DELL_ZM1,
 	ALC272_SAMSUNG_NC10,
+	ALC892_CLEVO_P150HM,
 	ALC662_MODEL_LAST,
 };
 
 #define ALC662_DIGOUT_NID	0x06
 #define ALC662_DIGIN_NID	0x0a
 
-static const hda_nid_t alc662_dac_nids[3] = {
-	/* front, rear, clfe */
-	0x02, 0x03, 0x04
+static const hda_nid_t alc662_dac_nids[4] = {
+	/* front, rear, clfe, side */
+	0x02, 0x03, 0x04, 0x05
 };
 
 static const hda_nid_t alc272_dac_nids[2] = {
@@ -172,6 +173,39 @@
 	{ 6, alc662_sixstack_ch8_init },
 };
 
+/*
+ * 4ch mode
+ */
+static const struct hda_verb alc892_clevo_p150hm_ch4_init[] = {
+	{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
+	{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ } /* end */
+};
+
+/*
+ * 8ch mode
+ */
+static const struct hda_verb alc892_clevo_p150hm_ch8_init[] = {
+	{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ } /* end */
+};
+
+static const struct hda_channel_mode alc892_clevo_p150hm_modes[2] = {
+	{ 4, alc892_clevo_p150hm_ch4_init },
+	{ 8, alc892_clevo_p150hm_ch8_init },
+};
+
 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
  *                 Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
  */
@@ -547,6 +581,12 @@
 	{}
 };
 
+static const struct hda_verb alc892_clevo_p150hm_init_verbs[] = {
+	{0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT},
+	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
+	{}
+};
+
 /* Set Unsolicited Event*/
 static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
 	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -987,6 +1027,7 @@
 	[ALC272_DELL]		= "dell",
 	[ALC272_DELL_ZM1]	= "dell-zm1",
 	[ALC272_SAMSUNG_NC10]	= "samsung-nc10",
+	[ALC892_CLEVO_P150HM]   = "clevo-p150hm",
 	[ALC662_AUTO]		= "auto",
 };
 
@@ -1403,6 +1444,18 @@
 		.setup = alc663_mode4_setup,
 		.init_hook = alc_inithook,
 	},
+	[ALC892_CLEVO_P150HM] = {
+		.mixers = { alc662_base_mixer, alc662_chmode_mixer },
+		.init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs, alc892_clevo_p150hm_init_verbs },
+		.num_dacs = ARRAY_SIZE(alc662_dac_nids),
+		.dac_nids = alc662_dac_nids,
+		.dig_out_nid = ALC662_DIGOUT_NID,
+		.dig_in_nid = ALC662_DIGIN_NID,
+		.num_channel_mode = ARRAY_SIZE(alc892_clevo_p150hm_modes),
+		.channel_mode = alc892_clevo_p150hm_modes,
+		.input_mux = &alc662_capture_source,
+		.init_hook = alc_inithook,
+	},
 };
 
 

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-24 10:03   ` Julian Sikorski
@ 2011-11-24 10:30     ` Julian Sikorski
  0 siblings, 0 replies; 30+ messages in thread
From: Julian Sikorski @ 2011-11-24 10:30 UTC (permalink / raw)
  To: alsa-devel

W dniu 2011-11-24 11:03, Julian Sikorski pisze:
> W dniu 24.11.2011 10:20, Julian Sikorski pisze:
>> W dniu 20.08.2011 09:33, Andrew Mahone pisze:
>>> This laptop is detected as ALC892 audio (and by the codec ID this
>>> seems to be valid), but none of the configurations for it quite match
>>> this device. I've been working on documenting the connections with HDA
>>> Analyzer.
>>>
>>> alsa-info output:
>>> http://www.alsa-project.org/db/?f=b86e4c6447867fbd129a36d8a63e2f5caa836c52
>>>
>>> The laptop has built-in 5.1, and 5.1 or 7.1 output via jacks.
>>>
>>> DAC NIDs:
>>> 0x02 front
>>> 0x03 rear
>>> 0x04 clfe
>>> 0x05 side
>>>
>>> internal mixers:
>>> 0x0c front
>>> 0x0d rear
>>> 0x0e clfe
>>> 0x0f side
>>>
>>> internal speaker pins:
>>> 0x14 front
>>> 0x15 "rear" (front of laptop)
>>> 0x16 clfe
>>>
>>> external ports:
>>> fixed route:
>>> 0x17 side
>>>
>>> can select any output:
>>> 0x18 mic / output
>>> 0x1a line-in / output
>>> 0x1b headphone
>>>
>>> I've been experimenting with patch_realtek.c to add the extra DAC NID,
>>> and have had some success with a 6-channel mode for the built-in
>>> speakers and an 8-channel mode that mutes all internal speakers and
>>> sets the jacks up for output. I still need to manually connect pins
>>> 0x18, 0x1a, 0x1b to the correct internal mixers for 7.1 to work, and
>>> headphone plugin does not mute internal speakers in 5.1 mode. I have
>>> not added a plain stereo mode for internal speakers, although it
>>> appears that i can probably configure the codec to mix the front
>>> channels to center and LFE.
>>>
>>> Are there any suggestions for what to do next? My current state as a
>>> patch against the linux-3.0.y repository is at
>>> http://pastie.org/2400649
>>>
>> I tried this patch (attached a version ported to 3.1.x kernel) with
>> P150HM and I was still unable to get sound out of the subwoofer when on
>> 6 channel mode, could nonexisting rear be interfering?
>
> I tried a similar patch but also no luck there... Any ideas why the
> subwoofer might not be working? Is there a way to somehow eavesdrop the
> windows driver?

I am starting to be really convinced that THX TruStudio PRO is doing 
some shenanigans, since its "Speaker" function needs to be active for 
the subwoofer to work, even in realtek HD Audio Manager Speaker test. It 
will work if the function is dialled down all the way to 0 %, but as 
soon as you turn it off nothing can be heard.
Do you guys have any ideas what it might be doing. and is there a way to 
emulate this function under linux?

>> As Andrew said, 8 channel mode works once you manually unmute and
>> reattach mixers using hda-analyzer.
>>
>> Regards,
>> Julian
>>
>>
>>
>
>
>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-22 12:45                       ` Julian Sikorski
@ 2011-11-25  6:39                         ` Raymond Yau
  2011-11-25 12:10                           ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Raymond Yau @ 2011-11-25  6:39 UTC (permalink / raw)
  To: ALSA Development Mailing List, Takashi Iwai

2011/11/22 Julian Sikorski <belegdol@gmail.com>:
> W dniu 22.11.2011 06:17, Raymond Yau pisze:
>> 2011/11/21 Julian Sikorski <belegdol@gmail.com>:
>>> W dniu 21.11.2011 07:47, Raymond Yau pisze:
>>>> 2011/11/19 Julian Sikorski <belegdol@gmail.com>:
>>>>>>> From the official (non-service) manual, page 309:
>>>>>>>
>>>>>>
>>>>>> Refer to P170HM 's photo in user manual
>>>>>>
>>>>>> There are 3 speakers and a subwoofer at the bottom of the laptop and
>>>>>> two speakers at the top
>>>>>>
>>>>>> Refer to user manual of P150HM,
>>>>>>
>>>>>> 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)
>>>>
>>>> You may need to ask Takashi , David, PA developers and Media
>>>> controller developers how to handle this case
>>>>
>>>> since it may need to set_pin_ctl to PIN_HP and PIN_OUT of 0x1b and
>>>> retasking of input jacks as output  whether PA or Media controller API
>>>> expect to change the name of the volume control and switch from
>>>> "Headphone" to "Front" by hda-reconfig
>>>>
>>>> http://thread.gmane.org/gmane.linux.alsa.devel/91334
>>>>
>>>>>>
>>>>>> 7. As you plug in each cable a dialog box will pop up (see “Auto Popup
>>>>>> Dialog” on
>>>>>> page 2 - 9).
>>>>>>
>>>>>> Auto Popup Dialog mean support jack detect
>>>>>>
>>>>>> you can try David's hda-jack-sense-test.py
>>>>>>
>>>>>> http://thread.gmane.org/gmane.linux.alsa.devel/85051
>>>>>
>>>>> Yes, it is working:
>>>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>>>> Pin 0x18 (Black Mic): present = No
>>>>> Pin 0x1a (Black Line In): present = No
>>>>> Pin 0x1b (Black HP Out): present = Yes
>>>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>>>> Pin 0x18 (Black Mic): present = No
>>>>> Pin 0x1a (Black Line In): present = No
>>>>> Pin 0x1b (Black HP Out): present = No
>>>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>>>> Pin 0x18 (Black Mic): present = No
>>>>> Pin 0x1a (Black Line In): present = Yes
>>>>> Pin 0x1b (Black HP Out): present = No
>>>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>>>> Pin 0x18 (Black Mic): present = Yes
>>>>> Pin 0x1a (Black Line In): present = No
>>>>> Pin 0x1b (Black HP Out): present = No
>>>>
>>>>>>
>>>>>>
>>>>>> Is Node 0x17 also the side jack of your p150hm ?
>>>>>> pin cap support Detect and Trigger but Misc = NO_PRESENCE
>>>>>
>>>>> Yes, it is between mic and line in jacks, third one from the front. The
>>>>> only difference is that there is red light coming out of it.
>>>>>
>>>>
>>>> you can use hda-verb to set the pin default of 0x17 and use
>>>> hda-jack-sense-test retest the side jack
>>>
>>> Well, it kind of works:
>>> * I was able to assign 0x01011013 to pin 0x17 using user_pin_configs
>>> * it then shows up in hda-jack-sense-test.py, which detects if the jack
>>> is connected
>>> $ sudo python hda-jack-sense-test.py
>>> [sudo] password for julas:
>>> Pin 0x17 (Black Line Out): present = Yes
>>> Pin 0x18 (Black Mic): present = No
>>> Pin 0x1a (Black Line In): present = No
>>> Pin 0x1b (Black HP Out): present = No
>>> * for some reason this program started locking up after showing the
>>> output, I am not sure if this is related.

Don't have any realtek codec, not sure why hda-jack-sense-test.py
locked up when you use user_pin_configs

>>> I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
>>> attached). After reboot:
>>> * hda-jack-sense-test.py was still working, without lockups this time
>>> * alsamixer -c0 revealed a new "Front" slider, which was controlling the
>>> volume on 0x17
>>> * there was still no 8-channel mode (probably related to what you wrote
>>> below)
>>> * there were more options for auto mute (Disabled, Speaker Only, Line
>>> Out+Speaker)
>>> * here is the new alsa-info.sh:
>>> http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052
>>>
>>
>>
>>>>
>>>> To add the missing pin default of side jack 0x17
>>>>
>>>>       ALC662_FIXUP_ASUS_MODE8,
>>>> +     ALC892_FIXUP_CLEVO_4ST_8CH,
>>>> };
>>>>
>>>> static const struct alc_fixup alc662_fixups[] = {
>>>>
>>>>
>>>> +     [ALC892_FIXUP_CLEVO_4ST_8CH] = {
>>>> +             .type = ALC_FIXUP_PINS,
>>>> +             .v.pins = (const struct alc_pincfg[]) {
>>>> +/*
>>>> +  need to be same location as the other jack
>>>> +  may need to change the default association and sequence since
>>>> +  Lower Default Association values would be higher in priority for resources
>>>> +  such as processing nodes or Input and Output Converters.
>>>> +  A value of 0000b is reserved and should not be used
>>>> +*/
>>>> +                     { 0x17, 0x01011013 }, /* Side */
>>>> +                     { }
>>>> +             },
>>>> +     },
>>>>
>>>>
>>>> +     SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>> +     SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>
>>>> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
>>>> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
>>>> out(grey) at same location (ext rear)   for surround71 (and also 1
>>>> speakers, 1 int mic)
>>>>
>>>>
>>>> hda_codec: ALC1200: BIOS auto-probing.
>>>> hda_codec: ALC1200: SKU not ready 0x598301f0
>>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>>>>    mono: mono_out=0x0
>>>>    dig-out=0x1e/0x0
>>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>>
>>>>
>>>> CTRL: add: Line-Out Jack:0
>>>> CTRL: add: Headphone Jack:0
>>>> CTRL: add: Mic Jack:0
>>>> CTRL: add: Line Jack:0
>>>>
>>>>> get 1
>>>> 1 Channel Mode:0
>>>> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
>>>>

After the pin fixup, your notebook is almost like alc1200 msi gx460
except speaker and hp are swapped, this mean that those volume
controls and switches are similar to targa_mixer , targa_8ch_mixer of
model="targa-8ch-dig"

>>>>
>>>> This mean that when switch to 6/8 channel mode, it will conflict with
>>>> automic detection since the pin cap alc892 's mic jack does not
>>>> support impedance sense and the driver does not know the plug is mic
>>>> or speaker by measuring the impedance
>>>>
>>>> The driver have to disable automic detection when user switch "channel
>>>> mode" to 6ch/8ch as the user should still able to use the internal mic
>>>> when the external mic jack is retasked as output
>>>>

The are some difference between p170hm and your p150hm if p170hm has
5.1 speakers which still can have auto mic detection enabled.


you can add the following code in alc_auto_ch_mode_put() for debugging
and need to switch "auto mute mode" to "speaker" for 8 channels


	if (spec->need_dac_fix && !spec->const_channel_count)
		spec->multiout.num_dacs = spec->multiout.max_channels / 2;

+	printk(KERN_INFO "ch = %d\n",ch);
+	printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
+	for (i=0; i<spec->autocfg.hp_outs; i++)
+		printk(KERN_INFO "hp dac(%d) %x pin %x\n", i,
spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
+	for (i=0; i<spec->multiout.num_dacs; i++)
+		printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
+	for (i=0; i<spec->autocfg.line_outs; i++)
+		printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
+	for (i=0; i<spec->multiout.num_dacs-1; i++)
+		printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i,
spec->multi_io[i].dac, spec->multi_io[i].pin);
+	for (i=0; i<spec->autocfg.speaker_outs; i++)
+		printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i,
spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
               return 1

Try the following code  which try to assign dac 02, 03, 04, and 05 to
spec->private_dac front, surround, clfe and side.

static int alc_auto_fill_dac_nids(struct hda_codec *codec)
{
...
 again:
	/* set num_dacs once to full for alc_auto_look_for_dac() */
	spec->multiout.num_dacs = cfg->line_outs;
	spec->multiout.hp_out_nid[0] = 0;
	spec->multiout.extra_out_nid[0] = 0;
	memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
	spec->multiout.dac_nids = spec->private_dac_nids;

+	if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
+		cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
+/* assign 0x02 as Front DAC by using speaker or hp pins*/
+		spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec,
cfg->speaker_pins[0]);
+/* hp , mic and line-in at the same location
+   use alc_auto_fill_multi_ios() to assign surround and clfe dacs
+*/
+		defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
+		location = get_defcfg_location(defcfg);
+		spec->multiout.num_dacs = 1;
+		num_pins = alc_auto_fill_multi_ios(codec, location, 1);
+		if (num_pins > 0) {
+			spec->multi_ios = num_pins;
+			spec->ext_channel_count = 2;
+			spec->multiout.num_dacs = num_pins + 1;
+		}
+/* an ugly hack to add side as multi io even side does not support input
+   set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT */
+		if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec,
cfg->line_out_pins[0]))) {
+			spec->private_dac_nids[3] = alc_auto_look_for_dac(codec,
cfg->line_out_pins[0]);
+			spec->multi_io[2].dac = spec->private_dac_nids[3];
+			spec->multi_io[2].pin = cfg->line_out_pins[0];
+			snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
				AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
+			spec->multi_ios++;
+			spec->multiout.num_dacs++;
+		}
+		return 0;
+	}

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-25  6:39                         ` Raymond Yau
@ 2011-11-25 12:10                           ` Julian Sikorski
  2011-11-28  0:42                             ` Raymond Yau
  0 siblings, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-25 12:10 UTC (permalink / raw)
  To: Raymond Yau; +Cc: Takashi Iwai, ALSA Development Mailing List

[-- Attachment #1: Type: text/plain, Size: 16030 bytes --]

W dniu 25.11.2011 07:39, Raymond Yau pisze:
> 2011/11/22 Julian Sikorski <belegdol@gmail.com>:
>> W dniu 22.11.2011 06:17, Raymond Yau pisze:
>>> 2011/11/21 Julian Sikorski <belegdol@gmail.com>:
>>>> W dniu 21.11.2011 07:47, Raymond Yau pisze:
>>>>> 2011/11/19 Julian Sikorski <belegdol@gmail.com>:
>>>>>>>> From the official (non-service) manual, page 309:
>>>>>>>>
>>>>>>>
>>>>>>> Refer to P170HM 's photo in user manual
>>>>>>>
>>>>>>> There are 3 speakers and a subwoofer at the bottom of the laptop and
>>>>>>> two speakers at the top
>>>>>>>
>>>>>>> Refer to user manual of P150HM,
>>>>>>>
>>>>>>> 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)
>>>>>
>>>>> You may need to ask Takashi , David, PA developers and Media
>>>>> controller developers how to handle this case
>>>>>
>>>>> since it may need to set_pin_ctl to PIN_HP and PIN_OUT of 0x1b and
>>>>> retasking of input jacks as output  whether PA or Media controller API
>>>>> expect to change the name of the volume control and switch from
>>>>> "Headphone" to "Front" by hda-reconfig
>>>>>
>>>>> http://thread.gmane.org/gmane.linux.alsa.devel/91334
>>>>>
>>>>>>>
>>>>>>> 7. As you plug in each cable a dialog box will pop up (see “Auto Popup
>>>>>>> Dialog” on
>>>>>>> page 2 - 9).
>>>>>>>
>>>>>>> Auto Popup Dialog mean support jack detect
>>>>>>>
>>>>>>> you can try David's hda-jack-sense-test.py
>>>>>>>
>>>>>>> http://thread.gmane.org/gmane.linux.alsa.devel/85051
>>>>>>
>>>>>> Yes, it is working:
>>>>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>>>>> Pin 0x18 (Black Mic): present = No
>>>>>> Pin 0x1a (Black Line In): present = No
>>>>>> Pin 0x1b (Black HP Out): present = Yes
>>>>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>>>>> Pin 0x18 (Black Mic): present = No
>>>>>> Pin 0x1a (Black Line In): present = No
>>>>>> Pin 0x1b (Black HP Out): present = No
>>>>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>>>>> Pin 0x18 (Black Mic): present = No
>>>>>> Pin 0x1a (Black Line In): present = Yes
>>>>>> Pin 0x1b (Black HP Out): present = No
>>>>>> [julas@snowball2 ~]$ sudo python hda-jack-sense-test.py
>>>>>> Pin 0x18 (Black Mic): present = Yes
>>>>>> Pin 0x1a (Black Line In): present = No
>>>>>> Pin 0x1b (Black HP Out): present = No
>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Is Node 0x17 also the side jack of your p150hm ?
>>>>>>> pin cap support Detect and Trigger but Misc = NO_PRESENCE
>>>>>>
>>>>>> Yes, it is between mic and line in jacks, third one from the front. The
>>>>>> only difference is that there is red light coming out of it.
>>>>>>
>>>>>
>>>>> you can use hda-verb to set the pin default of 0x17 and use
>>>>> hda-jack-sense-test retest the side jack
>>>>
>>>> Well, it kind of works:
>>>> * I was able to assign 0x01011013 to pin 0x17 using user_pin_configs
>>>> * it then shows up in hda-jack-sense-test.py, which detects if the jack
>>>> is connected
>>>> $ sudo python hda-jack-sense-test.py
>>>> [sudo] password for julas:
>>>> Pin 0x17 (Black Line Out): present = Yes
>>>> Pin 0x18 (Black Mic): present = No
>>>> Pin 0x1a (Black Line In): present = No
>>>> Pin 0x1b (Black HP Out): present = No
>>>> * for some reason this program started locking up after showing the
>>>> output, I am not sure if this is related.
> 
> Don't have any realtek codec, not sure why hda-jack-sense-test.py
> locked up when you use user_pin_configs
> 
>>>> I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
>>>> attached). After reboot:
>>>> * hda-jack-sense-test.py was still working, without lockups this time
>>>> * alsamixer -c0 revealed a new "Front" slider, which was controlling the
>>>> volume on 0x17
>>>> * there was still no 8-channel mode (probably related to what you wrote
>>>> below)
>>>> * there were more options for auto mute (Disabled, Speaker Only, Line
>>>> Out+Speaker)
>>>> * here is the new alsa-info.sh:
>>>> http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052
>>>>
>>>
>>>
>>>>>
>>>>> To add the missing pin default of side jack 0x17
>>>>>
>>>>>       ALC662_FIXUP_ASUS_MODE8,
>>>>> +     ALC892_FIXUP_CLEVO_4ST_8CH,
>>>>> };
>>>>>
>>>>> static const struct alc_fixup alc662_fixups[] = {
>>>>>
>>>>>
>>>>> +     [ALC892_FIXUP_CLEVO_4ST_8CH] = {
>>>>> +             .type = ALC_FIXUP_PINS,
>>>>> +             .v.pins = (const struct alc_pincfg[]) {
>>>>> +/*
>>>>> +  need to be same location as the other jack
>>>>> +  may need to change the default association and sequence since
>>>>> +  Lower Default Association values would be higher in priority for resources
>>>>> +  such as processing nodes or Input and Output Converters.
>>>>> +  A value of 0000b is reserved and should not be used
>>>>> +*/
>>>>> +                     { 0x17, 0x01011013 }, /* Side */
>>>>> +                     { }
>>>>> +             },
>>>>> +     },
>>>>>
>>>>>
>>>>> +     SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>> +     SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>
>>>>> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
>>>>> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
>>>>> out(grey) at same location (ext rear)   for surround71 (and also 1
>>>>> speakers, 1 int mic)
>>>>>
>>>>>
>>>>> hda_codec: ALC1200: BIOS auto-probing.
>>>>> hda_codec: ALC1200: SKU not ready 0x598301f0
>>>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>>>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>>>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>>>>>    mono: mono_out=0x0
>>>>>    dig-out=0x1e/0x0
>>>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>>>
>>>>>
>>>>> CTRL: add: Line-Out Jack:0
>>>>> CTRL: add: Headphone Jack:0
>>>>> CTRL: add: Mic Jack:0
>>>>> CTRL: add: Line Jack:0
>>>>>
>>>>>> get 1
>>>>> 1 Channel Mode:0
>>>>> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
>>>>>
> 
> After the pin fixup, your notebook is almost like alc1200 msi gx460
> except speaker and hp are swapped, this mean that those volume
> controls and switches are similar to targa_mixer , targa_8ch_mixer of
> model="targa-8ch-dig"
> 
>>>>>
>>>>> This mean that when switch to 6/8 channel mode, it will conflict with
>>>>> automic detection since the pin cap alc892 's mic jack does not
>>>>> support impedance sense and the driver does not know the plug is mic
>>>>> or speaker by measuring the impedance
>>>>>
>>>>> The driver have to disable automic detection when user switch "channel
>>>>> mode" to 6ch/8ch as the user should still able to use the internal mic
>>>>> when the external mic jack is retasked as output
>>>>>
> 
> The are some difference between p170hm and your p150hm if p170hm has
> 5.1 speakers which still can have auto mic detection enabled.
> 
> 
> you can add the following code in alc_auto_ch_mode_put() for debugging
> and need to switch "auto mute mode" to "speaker" for 8 channels
> 
> 
> 	if (spec->need_dac_fix && !spec->const_channel_count)
> 		spec->multiout.num_dacs = spec->multiout.max_channels / 2;
> 
> +	printk(KERN_INFO "ch = %d\n",ch);
> +	printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
> +	for (i=0; i<spec->autocfg.hp_outs; i++)
> +		printk(KERN_INFO "hp dac(%d) %x pin %x\n", i,
> spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
> +	for (i=0; i<spec->multiout.num_dacs; i++)
> +		printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
> +	for (i=0; i<spec->autocfg.line_outs; i++)
> +		printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
> +	for (i=0; i<spec->multiout.num_dacs-1; i++)
> +		printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i,
> spec->multi_io[i].dac, spec->multi_io[i].pin);
> +	for (i=0; i<spec->autocfg.speaker_outs; i++)
> +		printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i,
> spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
>                return 1

This is what appears in /var/log/messages if you go from 8 to 2 channels
and back:

Nov 25 13:05:11 snowball2 kernel: [ 1515.853640] ch = 2
Nov 25 13:05:11 snowball2 kernel: [ 1515.853642] max channel 6
Nov 25 13:05:11 snowball2 kernel: [ 1515.853643] hp dac(0) 0 pin 1b
Nov 25 13:05:11 snowball2 kernel: [ 1515.853644] private_dac(0) 2
Nov 25 13:05:11 snowball2 kernel: [ 1515.853645] private_dac(1) 3
Nov 25 13:05:11 snowball2 kernel: [ 1515.853646] private_dac(2) 4
Nov 25 13:05:11 snowball2 kernel: [ 1515.853647] private_dac(3) 5
Nov 25 13:05:11 snowball2 kernel: [ 1515.853648] line_out(0) pin 17
Nov 25 13:05:11 snowball2 kernel: [ 1515.853649] multi_io(0) dac 3 pin 1a
Nov 25 13:05:11 snowball2 kernel: [ 1515.853650] multi_io(1) dac 4 pin 18
Nov 25 13:05:11 snowball2 kernel: [ 1515.853651] multi_io(2) dac 5 pin 17
Nov 25 13:05:11 snowball2 kernel: [ 1515.853652] extra_out(0) dac 0 pin 14
Nov 25 13:05:24 snowball2 kernel: [ 1528.952829] ch = 1
Nov 25 13:05:24 snowball2 kernel: [ 1528.952835] max channel 4
Nov 25 13:05:24 snowball2 kernel: [ 1528.952840] hp dac(0) 0 pin 1b
Nov 25 13:05:24 snowball2 kernel: [ 1528.952843] private_dac(0) 2
Nov 25 13:05:24 snowball2 kernel: [ 1528.952846] private_dac(1) 3
Nov 25 13:05:24 snowball2 kernel: [ 1528.952849] private_dac(2) 4
Nov 25 13:05:24 snowball2 kernel: [ 1528.952852] private_dac(3) 5
Nov 25 13:05:24 snowball2 kernel: [ 1528.952855] line_out(0) pin 17
Nov 25 13:05:24 snowball2 kernel: [ 1528.952859] multi_io(0) dac 3 pin 1a
Nov 25 13:05:24 snowball2 kernel: [ 1528.952863] multi_io(1) dac 4 pin 18
Nov 25 13:05:24 snowball2 kernel: [ 1528.952866] multi_io(2) dac 5 pin 17
Nov 25 13:05:24 snowball2 kernel: [ 1528.952870] extra_out(0) dac 0 pin 14
Nov 25 13:05:26 snowball2 kernel: [ 1531.378952] ch = 0
Nov 25 13:05:26 snowball2 kernel: [ 1531.378958] max channel 2
Nov 25 13:05:26 snowball2 kernel: [ 1531.378963] hp dac(0) 0 pin 1b
Nov 25 13:05:26 snowball2 kernel: [ 1531.378966] private_dac(0) 2
Nov 25 13:05:26 snowball2 kernel: [ 1531.378969] private_dac(1) 3
Nov 25 13:05:26 snowball2 kernel: [ 1531.378972] private_dac(2) 4
Nov 25 13:05:26 snowball2 kernel: [ 1531.378975] private_dac(3) 5
Nov 25 13:05:26 snowball2 kernel: [ 1531.378978] line_out(0) pin 17
Nov 25 13:05:26 snowball2 kernel: [ 1531.378982] multi_io(0) dac 3 pin 1a
Nov 25 13:05:26 snowball2 kernel: [ 1531.379002] multi_io(1) dac 4 pin 18
Nov 25 13:05:26 snowball2 kernel: [ 1531.379006] multi_io(2) dac 5 pin 17
Nov 25 13:05:26 snowball2 kernel: [ 1531.379010] extra_out(0) dac 0 pin 14
Nov 25 13:06:29 snowball2 kernel: [ 1593.746269] ch = 1
Nov 25 13:06:29 snowball2 kernel: [ 1593.746275] max channel 4
Nov 25 13:06:29 snowball2 kernel: [ 1593.746279] hp dac(0) 0 pin 1b
Nov 25 13:06:29 snowball2 kernel: [ 1593.746283] private_dac(0) 2
Nov 25 13:06:29 snowball2 kernel: [ 1593.746286] private_dac(1) 3
Nov 25 13:06:29 snowball2 kernel: [ 1593.746289] private_dac(2) 4
Nov 25 13:06:29 snowball2 kernel: [ 1593.746291] private_dac(3) 5
Nov 25 13:06:29 snowball2 kernel: [ 1593.746295] line_out(0) pin 17
Nov 25 13:06:29 snowball2 kernel: [ 1593.746298] multi_io(0) dac 3 pin 1a
Nov 25 13:06:29 snowball2 kernel: [ 1593.746302] multi_io(1) dac 4 pin 18
Nov 25 13:06:29 snowball2 kernel: [ 1593.746306] multi_io(2) dac 5 pin 17
Nov 25 13:06:29 snowball2 kernel: [ 1593.746310] extra_out(0) dac 0 pin 14
Nov 25 13:06:31 snowball2 kernel: [ 1596.174127] ch = 2
Nov 25 13:06:31 snowball2 kernel: [ 1596.174133] max channel 6
Nov 25 13:06:31 snowball2 kernel: [ 1596.174195] hp dac(0) 0 pin 1b
Nov 25 13:06:31 snowball2 kernel: [ 1596.174199] private_dac(0) 2
Nov 25 13:06:31 snowball2 kernel: [ 1596.174202] private_dac(1) 3
Nov 25 13:06:31 snowball2 kernel: [ 1596.174205] private_dac(2) 4
Nov 25 13:06:31 snowball2 kernel: [ 1596.174208] private_dac(3) 5
Nov 25 13:06:31 snowball2 kernel: [ 1596.174211] line_out(0) pin 17
Nov 25 13:06:31 snowball2 kernel: [ 1596.174215] multi_io(0) dac 3 pin 1a
Nov 25 13:06:31 snowball2 kernel: [ 1596.174219] multi_io(1) dac 4 pin 18
Nov 25 13:06:31 snowball2 kernel: [ 1596.174223] multi_io(2) dac 5 pin 17
Nov 25 13:06:31 snowball2 kernel: [ 1596.174226] extra_out(0) dac 0 pin 14
Nov 25 13:06:33 snowball2 kernel: [ 1598.111893] ch = 3
Nov 25 13:06:33 snowball2 kernel: [ 1598.111900] max channel 8
Nov 25 13:06:33 snowball2 kernel: [ 1598.111904] hp dac(0) 0 pin 1b
Nov 25 13:06:33 snowball2 kernel: [ 1598.111908] private_dac(0) 2
Nov 25 13:06:33 snowball2 kernel: [ 1598.111911] private_dac(1) 3
Nov 25 13:06:33 snowball2 kernel: [ 1598.111914] private_dac(2) 4
Nov 25 13:06:33 snowball2 kernel: [ 1598.111917] private_dac(3) 5
Nov 25 13:06:33 snowball2 kernel: [ 1598.111920] line_out(0) pin 17
Nov 25 13:06:33 snowball2 kernel: [ 1598.111924] multi_io(0) dac 3 pin 1a
Nov 25 13:06:33 snowball2 kernel: [ 1598.111927] multi_io(1) dac 4 pin 18
Nov 25 13:06:33 snowball2 kernel: [ 1598.111931] multi_io(2) dac 5 pin 17
Nov 25 13:06:33 snowball2 kernel: [ 1598.111935] extra_out(0) dac 0 pin 14

> 
> Try the following code  which try to assign dac 02, 03, 04, and 05 to
> spec->private_dac front, surround, clfe and side.
> 
> static int alc_auto_fill_dac_nids(struct hda_codec *codec)
> {
> ...
>  again:
> 	/* set num_dacs once to full for alc_auto_look_for_dac() */
> 	spec->multiout.num_dacs = cfg->line_outs;
> 	spec->multiout.hp_out_nid[0] = 0;
> 	spec->multiout.extra_out_nid[0] = 0;
> 	memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
> 	spec->multiout.dac_nids = spec->private_dac_nids;
> 
> +	if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
> +		cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
> +/* assign 0x02 as Front DAC by using speaker or hp pins*/
> +		spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec,
> cfg->speaker_pins[0]);
> +/* hp , mic and line-in at the same location
> +   use alc_auto_fill_multi_ios() to assign surround and clfe dacs
> +*/
> +		defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
> +		location = get_defcfg_location(defcfg);
> +		spec->multiout.num_dacs = 1;
> +		num_pins = alc_auto_fill_multi_ios(codec, location, 1);
> +		if (num_pins > 0) {
> +			spec->multi_ios = num_pins;
> +			spec->ext_channel_count = 2;
> +			spec->multiout.num_dacs = num_pins + 1;
> +		}
> +/* an ugly hack to add side as multi io even side does not support input
> +   set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT */
> +		if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec,
> cfg->line_out_pins[0]))) {
> +			spec->private_dac_nids[3] = alc_auto_look_for_dac(codec,
> cfg->line_out_pins[0]);
> +			spec->multi_io[2].dac = spec->private_dac_nids[3];
> +			spec->multi_io[2].pin = cfg->line_out_pins[0];
> +			snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
> 				AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
> +			spec->multi_ios++;
> +			spec->multiout.num_dacs++;
> +		}
> +		return 0;
> +	}

It is much better now. I applied the attached patch and 2, 4, 6 and 8
channel sound is working, enabling outputs incrementally as I change the
number of channels in alsamixer. Observations:
* there is no mute for side channel
* no matter if Auto-Mute is set to Speaker or Line Out+Speaker, speakers
will mute upon plugging a jack into either headphone or side/spdif socket
* there is a "front" slider which controls internal speakers and HP
jack, but the mute control under it does nothing. There are separate
mute controls for HP and Speakers, which work as advertised.
This is the alsa-info.sh output:
http://www.alsa-project.org/db/?f=7df8ccac0a5ae751110f7b7e56f9e0ba5cc3b302
Looks like we are almost there, thanks for all the input so far!

Regards,
Julian

[-- Attachment #2: clevo-0x17-rawhide.patch --]
[-- Type: text/x-patch, Size: 4012 bytes --]

--- ./sound/pci/hda/patch_realtek.c.orig	2011-11-25 11:37:01.303999976 +0100
+++ ./sound/pci/hda/patch_realtek.c	2011-11-25 11:39:02.780497718 +0100
@@ -3053,6 +3053,37 @@
 	memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
 	spec->multiout.dac_nids = spec->private_dac_nids;
 
+	if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
+		cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
+	/* assign 0x02 as Front DAC by using speaker or hp pins */
+		spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec, cfg->speaker_pins[0]);
+	/* hp , mic and line-in at the same location
+	 * use alc_auto_fill_multi_ios() to assign surround and clfe dacs
+	 */
+		defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
+		location = get_defcfg_location(defcfg);
+		spec->multiout.num_dacs = 1;
+		num_pins = alc_auto_fill_multi_ios(codec, location, 1);
+		if (num_pins > 0) {
+			spec->multi_ios = num_pins;
+			spec->ext_channel_count = 2;
+			spec->multiout.num_dacs = num_pins + 1;
+		}
+	/* an ugly hack to add side as multi io even side does not support input
+	 * set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT
+	 */
+		if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]))) {
+			spec->private_dac_nids[3] = alc_auto_look_for_dac(codec, cfg->line_out_pins[0]);
+			spec->multi_io[2].dac = spec->private_dac_nids[3];
+			spec->multi_io[2].pin = cfg->line_out_pins[0];
+			snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
+				AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
+			spec->multi_ios++;
+			spec->multiout.num_dacs++;
+		}
+		return 0;
+	}
+
 	/* fill hard-wired DACs first */
 	if (!redone) {
 		for (i = 0; i < cfg->line_outs; i++)
@@ -3645,6 +3676,19 @@
 	spec->multiout.max_channels = spec->ext_channel_count;
 	if (spec->need_dac_fix && !spec->const_channel_count)
 		spec->multiout.num_dacs = spec->multiout.max_channels / 2;
+
+	printk(KERN_INFO "ch = %d\n",ch);
+	printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
+	for (i=0; i<spec->autocfg.hp_outs; i++)
+		printk(KERN_INFO "hp dac(%d) %x pin %x\n", i, spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
+	for (i=0; i<spec->multiout.num_dacs; i++)
+		printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
+	for (i=0; i<spec->autocfg.line_outs; i++)
+		printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
+	for (i=0; i<spec->multiout.num_dacs-1; i++)
+		printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i, spec->multi_io[i].dac, spec->multi_io[i].pin);
+	for (i=0; i<spec->autocfg.speaker_outs; i++)
+		printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i, spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
 	return 1;
 }
 
@@ -5850,6 +5894,7 @@
 	ALC662_FIXUP_ASUS_MODE6,
 	ALC662_FIXUP_ASUS_MODE7,
 	ALC662_FIXUP_ASUS_MODE8,
+	ALC892_FIXUP_CLEVO_4ST_8CH,
 };
 
 static const struct alc_fixup alc662_fixups[] = {
@@ -5995,6 +6040,20 @@
 		.chained = true,
 		.chain_id = ALC662_FIXUP_SKU_IGNORE
 	},
+	[ALC892_FIXUP_CLEVO_4ST_8CH] = {
+		.type = ALC_FIXUP_PINS,
+		.v.pins = (const struct alc_pincfg[]) {
+/*
+  need to be same location as the other jack
+  may need to change the default association and sequence since
+  Lower Default Association values would be higher in priority for resources
+  such as processing nodes or Input and Output Converters.
+  A value of 0000b is reserved and should not be used
+*/
+			{ 0x17, 0x01011013 }, /* Side */
+			{ }
+		},
+	},
 };
 
 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -6008,6 +6067,8 @@
 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
+	SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
+	SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
 
 #if 0
 	/* Below is a quirk table taken from the old code.

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-25 12:10                           ` Julian Sikorski
@ 2011-11-28  0:42                             ` Raymond Yau
  2011-11-28 10:27                               ` Julian Sikorski
  2011-11-28 12:34                               ` Julian Sikorski
  0 siblings, 2 replies; 30+ messages in thread
From: Raymond Yau @ 2011-11-28  0:42 UTC (permalink / raw)
  To: ALSA Development Mailing List

2011/11/25 Julian Sikorski <belegdol@gmail.com>:
> W dniu 25.11.2011 07:39, Raymond Yau pisze:
>> 2011/11/22 Julian Sikorski <belegdol@gmail.com>:
>>
>> Don't have any realtek codec, not sure why hda-jack-sense-test.py
>> locked up when you use user_pin_configs
>>
>>>>> I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
>>>>> attached). After reboot:
>>>>> * hda-jack-sense-test.py was still working, without lockups this time
>>>>> * alsamixer -c0 revealed a new "Front" slider, which was controlling the
>>>>> volume on 0x17
>>>>> * there was still no 8-channel mode (probably related to what you wrote
>>>>> below)
>>>>> * there were more options for auto mute (Disabled, Speaker Only, Line
>>>>> Out+Speaker)
>>>>> * here is the new alsa-info.sh:
>>>>> http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052
>>>>>
>>>>
>>>>
>>>>>>
>>>>>> To add the missing pin default of side jack 0x17
>>>>>>
>>>>>>       ALC662_FIXUP_ASUS_MODE8,
>>>>>> +     ALC892_FIXUP_CLEVO_4ST_8CH,
>>>>>> };
>>>>>>
>>>>>> static const struct alc_fixup alc662_fixups[] = {
>>>>>>
>>>>>>
>>>>>> +     [ALC892_FIXUP_CLEVO_4ST_8CH] = {
>>>>>> +             .type = ALC_FIXUP_PINS,
>>>>>> +             .v.pins = (const struct alc_pincfg[]) {
>>>>>> +/*
>>>>>> +  need to be same location as the other jack
>>>>>> +  may need to change the default association and sequence since
>>>>>> +  Lower Default Association values would be higher in priority for resources
>>>>>> +  such as processing nodes or Input and Output Converters.
>>>>>> +  A value of 0000b is reserved and should not be used
>>>>>> +*/
>>>>>> +                     { 0x17, 0x01011013 }, /* Side */
>>>>>> +                     { }
>>>>>> +             },
>>>>>> +     },
>>>>>>
>>>>>>
>>>>>> +     SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>> +     SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>
>>>>>> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
>>>>>> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
>>>>>> out(grey) at same location (ext rear)   for surround71 (and also 1
>>>>>> speakers, 1 int mic)
>>>>>>
>>>>>>
>>>>>> hda_codec: ALC1200: BIOS auto-probing.
>>>>>> hda_codec: ALC1200: SKU not ready 0x598301f0
>>>>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>>>>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>>>>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>>>>>>    mono: mono_out=0x0
>>>>>>    dig-out=0x1e/0x0
>>>>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>>>>
>>>>>>
>>>>>> CTRL: add: Line-Out Jack:0
>>>>>> CTRL: add: Headphone Jack:0
>>>>>> CTRL: add: Mic Jack:0
>>>>>> CTRL: add: Line Jack:0
>>>>>>
>>>>>>> get 1
>>>>>> 1 Channel Mode:0
>>>>>> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
>>>>>>
>>
>> After the pin fixup, your notebook is almost like alc1200 msi gx460
>> except speaker and hp are swapped, this mean that those volume
>> controls and switches are similar to targa_mixer , targa_8ch_mixer of
>> model="targa-8ch-dig"
>>
>>>>>>
>>>>>> This mean that when switch to 6/8 channel mode, it will conflict with
>>>>>> automic detection since the pin cap alc892 's mic jack does not
>>>>>> support impedance sense and the driver does not know the plug is mic
>>>>>> or speaker by measuring the impedance
>>>>>>
>>>>>> The driver have to disable automic detection when user switch "channel
>>>>>> mode" to 6ch/8ch as the user should still able to use the internal mic
>>>>>> when the external mic jack is retasked as output
>>>>>>
>>
>> The are some difference between p170hm and your p150hm if p170hm has
>> 5.1 speakers which still can have auto mic detection enabled.
>>
>>
>> you can add the following code in alc_auto_ch_mode_put() for debugging
>> and need to switch "auto mute mode" to "speaker" for 8 channels
>>
>>
>>       if (spec->need_dac_fix && !spec->const_channel_count)
>>               spec->multiout.num_dacs = spec->multiout.max_channels / 2;
>>
>> +     printk(KERN_INFO "ch = %d\n",ch);
>> +     printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
>> +     for (i=0; i<spec->autocfg.hp_outs; i++)
>> +             printk(KERN_INFO "hp dac(%d) %x pin %x\n", i,
>> spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
>> +     for (i=0; i<spec->multiout.num_dacs; i++)
>> +             printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
>> +     for (i=0; i<spec->autocfg.line_outs; i++)
>> +             printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
>> +     for (i=0; i<spec->multiout.num_dacs-1; i++)
>> +             printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i,
>> spec->multi_io[i].dac, spec->multi_io[i].pin);
>> +     for (i=0; i<spec->autocfg.speaker_outs; i++)
>> +             printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i,
>> spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
>>                return 1
>
> This is what appears in /var/log/messages if you go from 8 to 2 channels
> and back:
>
> Nov 25 13:05:11 snowball2 kernel: [ 1515.853640] ch = 2
> Nov 25 13:05:11 snowball2 kernel: [ 1515.853642] max channel 6
> Nov 25 13:05:11 snowball2 kernel: [ 1515.853643] hp dac(0) 0 pin 1b
> Nov 25 13:05:11 snowball2 kernel: [ 1515.853644] private_dac(0) 2
> Nov 25 13:05:11 snowball2 kernel: [ 1515.853645] private_dac(1) 3
> Nov 25 13:05:11 snowball2 kernel: [ 1515.853646] private_dac(2) 4
> Nov 25 13:05:11 snowball2 kernel: [ 1515.853647] private_dac(3) 5
> Nov 25 13:05:11 snowball2 kernel: [ 1515.853648] line_out(0) pin 17
> Nov 25 13:05:11 snowball2 kernel: [ 1515.853649] multi_io(0) dac 3 pin 1a
> Nov 25 13:05:11 snowball2 kernel: [ 1515.853650] multi_io(1) dac 4 pin 18
> Nov 25 13:05:11 snowball2 kernel: [ 1515.853651] multi_io(2) dac 5 pin 17
> Nov 25 13:05:11 snowball2 kernel: [ 1515.853652] extra_out(0) dac 0 pin 14
> Nov 25 13:05:24 snowball2 kernel: [ 1528.952829] ch = 1
> Nov 25 13:05:24 snowball2 kernel: [ 1528.952835] max channel 4
> Nov 25 13:05:24 snowball2 kernel: [ 1528.952840] hp dac(0) 0 pin 1b
> Nov 25 13:05:24 snowball2 kernel: [ 1528.952843] private_dac(0) 2
> Nov 25 13:05:24 snowball2 kernel: [ 1528.952846] private_dac(1) 3
> Nov 25 13:05:24 snowball2 kernel: [ 1528.952849] private_dac(2) 4
> Nov 25 13:05:24 snowball2 kernel: [ 1528.952852] private_dac(3) 5
> Nov 25 13:05:24 snowball2 kernel: [ 1528.952855] line_out(0) pin 17
> Nov 25 13:05:24 snowball2 kernel: [ 1528.952859] multi_io(0) dac 3 pin 1a
> Nov 25 13:05:24 snowball2 kernel: [ 1528.952863] multi_io(1) dac 4 pin 18
> Nov 25 13:05:24 snowball2 kernel: [ 1528.952866] multi_io(2) dac 5 pin 17
> Nov 25 13:05:24 snowball2 kernel: [ 1528.952870] extra_out(0) dac 0 pin 14
> Nov 25 13:05:26 snowball2 kernel: [ 1531.378952] ch = 0
> Nov 25 13:05:26 snowball2 kernel: [ 1531.378958] max channel 2
> Nov 25 13:05:26 snowball2 kernel: [ 1531.378963] hp dac(0) 0 pin 1b
> Nov 25 13:05:26 snowball2 kernel: [ 1531.378966] private_dac(0) 2
> Nov 25 13:05:26 snowball2 kernel: [ 1531.378969] private_dac(1) 3
> Nov 25 13:05:26 snowball2 kernel: [ 1531.378972] private_dac(2) 4
> Nov 25 13:05:26 snowball2 kernel: [ 1531.378975] private_dac(3) 5
> Nov 25 13:05:26 snowball2 kernel: [ 1531.378978] line_out(0) pin 17
> Nov 25 13:05:26 snowball2 kernel: [ 1531.378982] multi_io(0) dac 3 pin 1a
> Nov 25 13:05:26 snowball2 kernel: [ 1531.379002] multi_io(1) dac 4 pin 18
> Nov 25 13:05:26 snowball2 kernel: [ 1531.379006] multi_io(2) dac 5 pin 17
> Nov 25 13:05:26 snowball2 kernel: [ 1531.379010] extra_out(0) dac 0 pin 14
> Nov 25 13:06:29 snowball2 kernel: [ 1593.746269] ch = 1
> Nov 25 13:06:29 snowball2 kernel: [ 1593.746275] max channel 4
> Nov 25 13:06:29 snowball2 kernel: [ 1593.746279] hp dac(0) 0 pin 1b
> Nov 25 13:06:29 snowball2 kernel: [ 1593.746283] private_dac(0) 2
> Nov 25 13:06:29 snowball2 kernel: [ 1593.746286] private_dac(1) 3
> Nov 25 13:06:29 snowball2 kernel: [ 1593.746289] private_dac(2) 4
> Nov 25 13:06:29 snowball2 kernel: [ 1593.746291] private_dac(3) 5
> Nov 25 13:06:29 snowball2 kernel: [ 1593.746295] line_out(0) pin 17
> Nov 25 13:06:29 snowball2 kernel: [ 1593.746298] multi_io(0) dac 3 pin 1a
> Nov 25 13:06:29 snowball2 kernel: [ 1593.746302] multi_io(1) dac 4 pin 18
> Nov 25 13:06:29 snowball2 kernel: [ 1593.746306] multi_io(2) dac 5 pin 17
> Nov 25 13:06:29 snowball2 kernel: [ 1593.746310] extra_out(0) dac 0 pin 14
> Nov 25 13:06:31 snowball2 kernel: [ 1596.174127] ch = 2
> Nov 25 13:06:31 snowball2 kernel: [ 1596.174133] max channel 6
> Nov 25 13:06:31 snowball2 kernel: [ 1596.174195] hp dac(0) 0 pin 1b
> Nov 25 13:06:31 snowball2 kernel: [ 1596.174199] private_dac(0) 2
> Nov 25 13:06:31 snowball2 kernel: [ 1596.174202] private_dac(1) 3
> Nov 25 13:06:31 snowball2 kernel: [ 1596.174205] private_dac(2) 4
> Nov 25 13:06:31 snowball2 kernel: [ 1596.174208] private_dac(3) 5
> Nov 25 13:06:31 snowball2 kernel: [ 1596.174211] line_out(0) pin 17
> Nov 25 13:06:31 snowball2 kernel: [ 1596.174215] multi_io(0) dac 3 pin 1a
> Nov 25 13:06:31 snowball2 kernel: [ 1596.174219] multi_io(1) dac 4 pin 18
> Nov 25 13:06:31 snowball2 kernel: [ 1596.174223] multi_io(2) dac 5 pin 17
> Nov 25 13:06:31 snowball2 kernel: [ 1596.174226] extra_out(0) dac 0 pin 14
> Nov 25 13:06:33 snowball2 kernel: [ 1598.111893] ch = 3
> Nov 25 13:06:33 snowball2 kernel: [ 1598.111900] max channel 8
> Nov 25 13:06:33 snowball2 kernel: [ 1598.111904] hp dac(0) 0 pin 1b
> Nov 25 13:06:33 snowball2 kernel: [ 1598.111908] private_dac(0) 2
> Nov 25 13:06:33 snowball2 kernel: [ 1598.111911] private_dac(1) 3
> Nov 25 13:06:33 snowball2 kernel: [ 1598.111914] private_dac(2) 4
> Nov 25 13:06:33 snowball2 kernel: [ 1598.111917] private_dac(3) 5
> Nov 25 13:06:33 snowball2 kernel: [ 1598.111920] line_out(0) pin 17
> Nov 25 13:06:33 snowball2 kernel: [ 1598.111924] multi_io(0) dac 3 pin 1a
> Nov 25 13:06:33 snowball2 kernel: [ 1598.111927] multi_io(1) dac 4 pin 18
> Nov 25 13:06:33 snowball2 kernel: [ 1598.111931] multi_io(2) dac 5 pin 17
> Nov 25 13:06:33 snowball2 kernel: [ 1598.111935] extra_out(0) dac 0 pin 14
>
>>
>> Try the following code  which try to assign dac 02, 03, 04, and 05 to
>> spec->private_dac front, surround, clfe and side.
>>
>> static int alc_auto_fill_dac_nids(struct hda_codec *codec)
>> {
>> ...
>>  again:
>>       /* set num_dacs once to full for alc_auto_look_for_dac() */
>>       spec->multiout.num_dacs = cfg->line_outs;
>>       spec->multiout.hp_out_nid[0] = 0;
>>       spec->multiout.extra_out_nid[0] = 0;
>>       memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
>>       spec->multiout.dac_nids = spec->private_dac_nids;
>>
>> +     if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
>> +             cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
>> +/* assign 0x02 as Front DAC by using speaker or hp pins*/
>> +             spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec,
>> cfg->speaker_pins[0]);
>> +/* hp , mic and line-in at the same location
>> +   use alc_auto_fill_multi_ios() to assign surround and clfe dacs
>> +*/
>> +             defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
>> +             location = get_defcfg_location(defcfg);
>> +             spec->multiout.num_dacs = 1;
>> +             num_pins = alc_auto_fill_multi_ios(codec, location, 1);
>> +             if (num_pins > 0) {
>> +                     spec->multi_ios = num_pins;
>> +                     spec->ext_channel_count = 2;
>> +                     spec->multiout.num_dacs = num_pins + 1;
>> +             }
>> +/* an ugly hack to add side as multi io even side does not support input
>> +   set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT */
>> +             if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec,
>> cfg->line_out_pins[0]))) {
>> +                     spec->private_dac_nids[3] = alc_auto_look_for_dac(codec,
>> cfg->line_out_pins[0]);
>> +                     spec->multi_io[2].dac = spec->private_dac_nids[3];
>> +                     spec->multi_io[2].pin = cfg->line_out_pins[0];
>> +                     snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
>>                               AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
>> +                     spec->multi_ios++;
>> +                     spec->multiout.num_dacs++;
>> +             }
>> +             return 0;
>> +     }
>
> It is much better now. I applied the attached patch and 2, 4, 6 and 8
> channel sound is working, enabling outputs incrementally as I change the
> number of channels in alsamixer. Observations:


> * there is no mute for side channel

> * no matter if Auto-Mute is set to Speaker or Line Out+Speaker, speakers
> will mute upon plugging a jack into either headphone or side/spdif socket
> * there is a "front" slider which controls internal speakers and HP
> jack, but the mute control under it does nothing. There are separate
> mute controls for HP and Speakers, which work as advertised.
> This is the alsa-info.sh output:
> http://www.alsa-project.org/db/?f=7df8ccac0a5ae751110f7b7e56f9e0ba5cc3b302
> Looks like we are almost there, thanks for all the input so far!


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;

>>>>>>>> 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);
+             }


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;

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-28  0:42                             ` Raymond Yau
@ 2011-11-28 10:27                               ` Julian Sikorski
  2011-11-28 11:46                                 ` Raymond Yau
  2011-11-28 12:34                               ` Julian Sikorski
  1 sibling, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-28 10:27 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 17149 bytes --]

W dniu 28.11.2011 01:42, Raymond Yau pisze:
> 2011/11/25 Julian Sikorski <belegdol@gmail.com>:
>> W dniu 25.11.2011 07:39, Raymond Yau pisze:
>>> 2011/11/22 Julian Sikorski <belegdol@gmail.com>:
>>>
>>> Don't have any realtek codec, not sure why hda-jack-sense-test.py
>>> locked up when you use user_pin_configs
>>>
>>>>>> I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
>>>>>> attached). After reboot:
>>>>>> * hda-jack-sense-test.py was still working, without lockups this time
>>>>>> * alsamixer -c0 revealed a new "Front" slider, which was controlling the
>>>>>> volume on 0x17
>>>>>> * there was still no 8-channel mode (probably related to what you wrote
>>>>>> below)
>>>>>> * there were more options for auto mute (Disabled, Speaker Only, Line
>>>>>> Out+Speaker)
>>>>>> * here is the new alsa-info.sh:
>>>>>> http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052
>>>>>>
>>>>>
>>>>>
>>>>>>>
>>>>>>> To add the missing pin default of side jack 0x17
>>>>>>>
>>>>>>>       ALC662_FIXUP_ASUS_MODE8,
>>>>>>> +     ALC892_FIXUP_CLEVO_4ST_8CH,
>>>>>>> };
>>>>>>>
>>>>>>> static const struct alc_fixup alc662_fixups[] = {
>>>>>>>
>>>>>>>
>>>>>>> +     [ALC892_FIXUP_CLEVO_4ST_8CH] = {
>>>>>>> +             .type = ALC_FIXUP_PINS,
>>>>>>> +             .v.pins = (const struct alc_pincfg[]) {
>>>>>>> +/*
>>>>>>> +  need to be same location as the other jack
>>>>>>> +  may need to change the default association and sequence since
>>>>>>> +  Lower Default Association values would be higher in priority for resources
>>>>>>> +  such as processing nodes or Input and Output Converters.
>>>>>>> +  A value of 0000b is reserved and should not be used
>>>>>>> +*/
>>>>>>> +                     { 0x17, 0x01011013 }, /* Side */
>>>>>>> +                     { }
>>>>>>> +             },
>>>>>>> +     },
>>>>>>>
>>>>>>>
>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>>
>>>>>>> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
>>>>>>> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
>>>>>>> out(grey) at same location (ext rear)   for surround71 (and also 1
>>>>>>> speakers, 1 int mic)
>>>>>>>
>>>>>>>
>>>>>>> hda_codec: ALC1200: BIOS auto-probing.
>>>>>>> hda_codec: ALC1200: SKU not ready 0x598301f0
>>>>>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>>>>>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>>>>>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>>>>>>>    mono: mono_out=0x0
>>>>>>>    dig-out=0x1e/0x0
>>>>>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>>>>>
>>>>>>>
>>>>>>> CTRL: add: Line-Out Jack:0
>>>>>>> CTRL: add: Headphone Jack:0
>>>>>>> CTRL: add: Mic Jack:0
>>>>>>> CTRL: add: Line Jack:0
>>>>>>>
>>>>>>>> get 1
>>>>>>> 1 Channel Mode:0
>>>>>>> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
>>>>>>>
>>>
>>> After the pin fixup, your notebook is almost like alc1200 msi gx460
>>> except speaker and hp are swapped, this mean that those volume
>>> controls and switches are similar to targa_mixer , targa_8ch_mixer of
>>> model="targa-8ch-dig"
>>>
>>>>>>>
>>>>>>> This mean that when switch to 6/8 channel mode, it will conflict with
>>>>>>> automic detection since the pin cap alc892 's mic jack does not
>>>>>>> support impedance sense and the driver does not know the plug is mic
>>>>>>> or speaker by measuring the impedance
>>>>>>>
>>>>>>> The driver have to disable automic detection when user switch "channel
>>>>>>> mode" to 6ch/8ch as the user should still able to use the internal mic
>>>>>>> when the external mic jack is retasked as output
>>>>>>>
>>>
>>> The are some difference between p170hm and your p150hm if p170hm has
>>> 5.1 speakers which still can have auto mic detection enabled.
>>>
>>>
>>> you can add the following code in alc_auto_ch_mode_put() for debugging
>>> and need to switch "auto mute mode" to "speaker" for 8 channels
>>>
>>>
>>>       if (spec->need_dac_fix && !spec->const_channel_count)
>>>               spec->multiout.num_dacs = spec->multiout.max_channels / 2;
>>>
>>> +     printk(KERN_INFO "ch = %d\n",ch);
>>> +     printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
>>> +     for (i=0; i<spec->autocfg.hp_outs; i++)
>>> +             printk(KERN_INFO "hp dac(%d) %x pin %x\n", i,
>>> spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
>>> +     for (i=0; i<spec->multiout.num_dacs; i++)
>>> +             printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
>>> +     for (i=0; i<spec->autocfg.line_outs; i++)
>>> +             printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
>>> +     for (i=0; i<spec->multiout.num_dacs-1; i++)
>>> +             printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i,
>>> spec->multi_io[i].dac, spec->multi_io[i].pin);
>>> +     for (i=0; i<spec->autocfg.speaker_outs; i++)
>>> +             printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i,
>>> spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
>>>                return 1
>>
>> This is what appears in /var/log/messages if you go from 8 to 2 channels
>> and back:
>>
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853640] ch = 2
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853642] max channel 6
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853643] hp dac(0) 0 pin 1b
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853644] private_dac(0) 2
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853645] private_dac(1) 3
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853646] private_dac(2) 4
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853647] private_dac(3) 5
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853648] line_out(0) pin 17
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853649] multi_io(0) dac 3 pin 1a
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853650] multi_io(1) dac 4 pin 18
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853651] multi_io(2) dac 5 pin 17
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853652] extra_out(0) dac 0 pin 14
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952829] ch = 1
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952835] max channel 4
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952840] hp dac(0) 0 pin 1b
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952843] private_dac(0) 2
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952846] private_dac(1) 3
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952849] private_dac(2) 4
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952852] private_dac(3) 5
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952855] line_out(0) pin 17
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952859] multi_io(0) dac 3 pin 1a
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952863] multi_io(1) dac 4 pin 18
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952866] multi_io(2) dac 5 pin 17
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952870] extra_out(0) dac 0 pin 14
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378952] ch = 0
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378958] max channel 2
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378963] hp dac(0) 0 pin 1b
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378966] private_dac(0) 2
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378969] private_dac(1) 3
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378972] private_dac(2) 4
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378975] private_dac(3) 5
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378978] line_out(0) pin 17
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378982] multi_io(0) dac 3 pin 1a
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379002] multi_io(1) dac 4 pin 18
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379006] multi_io(2) dac 5 pin 17
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379010] extra_out(0) dac 0 pin 14
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746269] ch = 1
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746275] max channel 4
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746279] hp dac(0) 0 pin 1b
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746283] private_dac(0) 2
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746286] private_dac(1) 3
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746289] private_dac(2) 4
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746291] private_dac(3) 5
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746295] line_out(0) pin 17
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746298] multi_io(0) dac 3 pin 1a
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746302] multi_io(1) dac 4 pin 18
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746306] multi_io(2) dac 5 pin 17
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746310] extra_out(0) dac 0 pin 14
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174127] ch = 2
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174133] max channel 6
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174195] hp dac(0) 0 pin 1b
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174199] private_dac(0) 2
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174202] private_dac(1) 3
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174205] private_dac(2) 4
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174208] private_dac(3) 5
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174211] line_out(0) pin 17
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174215] multi_io(0) dac 3 pin 1a
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174219] multi_io(1) dac 4 pin 18
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174223] multi_io(2) dac 5 pin 17
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174226] extra_out(0) dac 0 pin 14
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111893] ch = 3
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111900] max channel 8
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111904] hp dac(0) 0 pin 1b
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111908] private_dac(0) 2
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111911] private_dac(1) 3
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111914] private_dac(2) 4
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111917] private_dac(3) 5
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111920] line_out(0) pin 17
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111924] multi_io(0) dac 3 pin 1a
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111927] multi_io(1) dac 4 pin 18
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111931] multi_io(2) dac 5 pin 17
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111935] extra_out(0) dac 0 pin 14
>>
>>>
>>> Try the following code  which try to assign dac 02, 03, 04, and 05 to
>>> spec->private_dac front, surround, clfe and side.
>>>
>>> static int alc_auto_fill_dac_nids(struct hda_codec *codec)
>>> {
>>> ...
>>>  again:
>>>       /* set num_dacs once to full for alc_auto_look_for_dac() */
>>>       spec->multiout.num_dacs = cfg->line_outs;
>>>       spec->multiout.hp_out_nid[0] = 0;
>>>       spec->multiout.extra_out_nid[0] = 0;
>>>       memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
>>>       spec->multiout.dac_nids = spec->private_dac_nids;
>>>
>>> +     if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
>>> +             cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
>>> +/* assign 0x02 as Front DAC by using speaker or hp pins*/
>>> +             spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec,
>>> cfg->speaker_pins[0]);
>>> +/* hp , mic and line-in at the same location
>>> +   use alc_auto_fill_multi_ios() to assign surround and clfe dacs
>>> +*/
>>> +             defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
>>> +             location = get_defcfg_location(defcfg);
>>> +             spec->multiout.num_dacs = 1;
>>> +             num_pins = alc_auto_fill_multi_ios(codec, location, 1);
>>> +             if (num_pins > 0) {
>>> +                     spec->multi_ios = num_pins;
>>> +                     spec->ext_channel_count = 2;
>>> +                     spec->multiout.num_dacs = num_pins + 1;
>>> +             }
>>> +/* an ugly hack to add side as multi io even side does not support input
>>> +   set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT */
>>> +             if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec,
>>> cfg->line_out_pins[0]))) {
>>> +                     spec->private_dac_nids[3] = alc_auto_look_for_dac(codec,
>>> cfg->line_out_pins[0]);
>>> +                     spec->multi_io[2].dac = spec->private_dac_nids[3];
>>> +                     spec->multi_io[2].pin = cfg->line_out_pins[0];
>>> +                     snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
>>>                               AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
>>> +                     spec->multi_ios++;
>>> +                     spec->multiout.num_dacs++;
>>> +             }
>>> +             return 0;
>>> +     }
>>
>> It is much better now. I applied the attached patch and 2, 4, 6 and 8
>> channel sound is working, enabling outputs incrementally as I change the
>> number of channels in alsamixer. Observations:
> 
> 
>> * there is no mute for side channel
> 
>> * no matter if Auto-Mute is set to Speaker or Line Out+Speaker, speakers
>> will mute upon plugging a jack into either headphone or side/spdif socket
>> * there is a "front" slider which controls internal speakers and HP
>> jack, but the mute control under it does nothing. There are separate
>> mute controls for HP and Speakers, which work as advertised.
>> This is the alsa-info.sh output:
>> http://www.alsa-project.org/db/?f=7df8ccac0a5ae751110f7b7e56f9e0ba5cc3b302
>> Looks like we are almost there, thanks for all the input so far!
> 
> 
> 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;
> 
>>>>>>>>> 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 ) {

Patched kernel does not build (the patch I used is attached):
sound/pci/hda/patch_realtek.c: In function 'alc_set_multi_io':
sound/pci/hda/patch_realtek.c:3660:8: error: 'i' undeclared (first use
in this function)
sound/pci/hda/patch_realtek.c:3660:8: note: each undeclared identifier
is reported only once for each function it appears in
make[3]: *** [sound/pci/hda/patch_realtek.o] Error 1

Regards,
Julian


> -		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);
> +             }
> 
> 
> 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;


[-- Attachment #2: clevo-0x17-rawhide.patch --]
[-- Type: text/x-patch, Size: 6194 bytes --]

diff -up ./sound/pci/hda/patch_realtek.c.clevo ./sound/pci/hda/patch_realtek.c
--- ./sound/pci/hda/patch_realtek.c.clevo	2011-11-28 10:38:29.643369001 +0100
+++ ./sound/pci/hda/patch_realtek.c	2011-11-28 10:52:38.741831448 +0100
@@ -3053,6 +3053,38 @@ static int alc_auto_fill_dac_nids(struct
 	memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
 	spec->multiout.dac_nids = spec->private_dac_nids;
 
+	if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
+		cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
+	/* assign 0x02 as Front DAC by using speaker or hp pins */
+		spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec, cfg->speaker_pins[0]);
+	/* hp , mic and line-in at the same location
+	 * use alc_auto_fill_multi_ios() to assign surround and clfe dacs
+	 */
+		defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
+		location = get_defcfg_location(defcfg);
+		spec->multiout.num_dacs = 1;
+		num_pins = alc_auto_fill_multi_ios(codec, location, 1);
+		if (num_pins > 0) {
+			spec->multi_ios = num_pins;
+			spec->ext_channel_count = 2;
+			spec->multiout.num_dacs = num_pins + 1;
+		}
+	/* an ugly hack to add side as multi io even side does not support input
+	 * set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT
+	 */
+		if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]))) {
+			spec->private_dac_nids[3] = alc_auto_look_for_dac(codec, cfg->line_out_pins[0]);
+			spec->multi_io[2].dac = spec->private_dac_nids[3];
+			spec->multi_io[2].pin = cfg->line_out_pins[0];
+			snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
+				AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
+			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;
+	}
+
 	/* fill hard-wired DACs first */
 	if (!redone) {
 		for (i = 0; i < cfg->line_outs; i++)
@@ -3126,6 +3158,7 @@ static int alc_auto_fill_dac_nids(struct
 		}
 	}
 
+	spec->alt_dac_nid = spec->private_dac_nids[3];
 	return 0;
 }
 
@@ -3255,7 +3288,12 @@ static int alc_auto_create_multi_out_ctl
 		if (i >= cfg->line_outs)
 			pin = spec->multi_io[i - 1].pin;
 		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];
 
 		sw = alc_look_for_out_mute_nid(codec, pin, dac);
 		vol = alc_look_for_out_vol_nid(codec, pin, dac);
@@ -3275,9 +3313,11 @@ static int alc_auto_create_multi_out_ctl
 			if (err < 0)
 				return err;
 		} else {
+			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;
@@ -3617,12 +3657,16 @@ static int alc_set_multi_io(struct hda_c
 						 HDA_AMP_MUTE, 0);
 		alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac);
 	} else {
-		if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
+		if ( i < 2 ) {
 			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);
+		}
 	}
 	return 0;
 }
@@ -3645,6 +3689,19 @@ static int alc_auto_ch_mode_put(struct s
 	spec->multiout.max_channels = spec->ext_channel_count;
 	if (spec->need_dac_fix && !spec->const_channel_count)
 		spec->multiout.num_dacs = spec->multiout.max_channels / 2;
+
+	printk(KERN_INFO "ch = %d\n",ch);
+	printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
+	for (i=0; i<spec->autocfg.hp_outs; i++)
+		printk(KERN_INFO "hp dac(%d) %x pin %x\n", i, spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
+	for (i=0; i<spec->multiout.num_dacs; i++)
+		printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
+	for (i=0; i<spec->autocfg.line_outs; i++)
+		printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
+	for (i=0; i<spec->multiout.num_dacs-1; i++)
+		printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i, spec->multi_io[i].dac, spec->multi_io[i].pin);
+	for (i=0; i<spec->autocfg.speaker_outs; i++)
+		printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i, spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
 	return 1;
 }
 
@@ -5850,6 +5907,7 @@ enum {
 	ALC662_FIXUP_ASUS_MODE6,
 	ALC662_FIXUP_ASUS_MODE7,
 	ALC662_FIXUP_ASUS_MODE8,
+	ALC892_FIXUP_CLEVO_4ST_8CH,
 };
 
 static const struct alc_fixup alc662_fixups[] = {
@@ -5995,6 +6053,20 @@ static const struct alc_fixup alc662_fix
 		.chained = true,
 		.chain_id = ALC662_FIXUP_SKU_IGNORE
 	},
+	[ALC892_FIXUP_CLEVO_4ST_8CH] = {
+		.type = ALC_FIXUP_PINS,
+		.v.pins = (const struct alc_pincfg[]) {
+/*
+  need to be same location as the other jack
+  may need to change the default association and sequence since
+  Lower Default Association values would be higher in priority for resources
+  such as processing nodes or Input and Output Converters.
+  A value of 0000b is reserved and should not be used
+*/
+			{ 0x17, 0x01011013 }, /* Side */
+			{ }
+		},
+	},
 };
 
 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -6008,6 +6080,8 @@ static const struct snd_pci_quirk alc662
 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
+	SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
+	SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
 
 #if 0
 	/* Below is a quirk table taken from the old code.

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-28 10:27                               ` Julian Sikorski
@ 2011-11-28 11:46                                 ` Raymond Yau
  2011-11-28 12:02                                   ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Raymond Yau @ 2011-11-28 11:46 UTC (permalink / raw)
  To: ALSA Development Mailing List

2011/11/28 Julian Sikorski <belegdol@gmail.com>:
> W dniu 28.11.2011 01:42, Raymond Yau pisze:
>> 2011/11/25 Julian Sikorski <belegdol@gmail.com>:
>>> W dniu 25.11.2011 07:39, Raymond Yau pisze:
>>>> 2011/11/22 Julian Sikorski <belegdol@gmail.com>:
>>>>
>>>> Don't have any realtek codec, not sure why hda-jack-sense-test.py
>>>> locked up when you use user_pin_configs
>>>>
>>>>>>> I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
>>>>>>> attached). After reboot:
>>>>>>> * hda-jack-sense-test.py was still working, without lockups this time
>>>>>>> * alsamixer -c0 revealed a new "Front" slider, which was controlling the
>>>>>>> volume on 0x17
>>>>>>> * there was still no 8-channel mode (probably related to what you wrote
>>>>>>> below)
>>>>>>> * there were more options for auto mute (Disabled, Speaker Only, Line
>>>>>>> Out+Speaker)
>>>>>>> * here is the new alsa-info.sh:
>>>>>>> http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052
>>>>>>>
>>>>>>
>>>>>>
>>>>>>>>
>>>>>>>> To add the missing pin default of side jack 0x17
>>>>>>>>
>>>>>>>>       ALC662_FIXUP_ASUS_MODE8,
>>>>>>>> +     ALC892_FIXUP_CLEVO_4ST_8CH,
>>>>>>>> };
>>>>>>>>
>>>>>>>> static const struct alc_fixup alc662_fixups[] = {
>>>>>>>>
>>>>>>>>
>>>>>>>> +     [ALC892_FIXUP_CLEVO_4ST_8CH] = {
>>>>>>>> +             .type = ALC_FIXUP_PINS,
>>>>>>>> +             .v.pins = (const struct alc_pincfg[]) {
>>>>>>>> +/*
>>>>>>>> +  need to be same location as the other jack
>>>>>>>> +  may need to change the default association and sequence since
>>>>>>>> +  Lower Default Association values would be higher in priority for resources
>>>>>>>> +  such as processing nodes or Input and Output Converters.
>>>>>>>> +  A value of 0000b is reserved and should not be used
>>>>>>>> +*/
>>>>>>>> +                     { 0x17, 0x01011013 }, /* Side */
>>>>>>>> +                     { }
>>>>>>>> +             },
>>>>>>>> +     },
>>>>>>>>
>>>>>>>>
>>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>>>
>>>>>>>> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
>>>>>>>> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
>>>>>>>> out(grey) at same location (ext rear)   for surround71 (and also 1
>>>>>>>> speakers, 1 int mic)
>>>>>>>>
>>>>>>>>
>>>>>>>> hda_codec: ALC1200: BIOS auto-probing.
>>>>>>>> hda_codec: ALC1200: SKU not ready 0x598301f0
>>>>>>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>>>>>>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>>>>>>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>>>>>>>>    mono: mono_out=0x0
>>>>>>>>    dig-out=0x1e/0x0
>>>>>>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>>>>>>
>>>>>>>>
>>>>>>>> CTRL: add: Line-Out Jack:0
>>>>>>>> CTRL: add: Headphone Jack:0
>>>>>>>> CTRL: add: Mic Jack:0
>>>>>>>> CTRL: add: Line Jack:0
>>>>>>>>
>>>>>>>>> get 1
>>>>>>>> 1 Channel Mode:0
>>>>>>>> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
>>>>>>>>
>>>>
>>>> After the pin fixup, your notebook is almost like alc1200 msi gx460
>>>> except speaker and hp are swapped, this mean that those volume
>>>> controls and switches are similar to targa_mixer , targa_8ch_mixer of
>>>> model="targa-8ch-dig"
>>>>
>>>>>>>>
>>>>>>>> This mean that when switch to 6/8 channel mode, it will conflict with
>>>>>>>> automic detection since the pin cap alc892 's mic jack does not
>>>>>>>> support impedance sense and the driver does not know the plug is mic
>>>>>>>> or speaker by measuring the impedance
>>>>>>>>
>>>>>>>> The driver have to disable automic detection when user switch "channel
>>>>>>>> mode" to 6ch/8ch as the user should still able to use the internal mic
>>>>>>>> when the external mic jack is retasked as output
>>>>>>>>
>>>>
>>>> The are some difference between p170hm and your p150hm if p170hm has
>>>> 5.1 speakers which still can have auto mic detection enabled.
>>>>
>>>>
>>>> you can add the following code in alc_auto_ch_mode_put() for debugging
>>>> and need to switch "auto mute mode" to "speaker" for 8 channels
>>>>
>>>>
>>>>       if (spec->need_dac_fix && !spec->const_channel_count)
>>>>               spec->multiout.num_dacs = spec->multiout.max_channels / 2;
>>>>
>>>> +     printk(KERN_INFO "ch = %d\n",ch);
>>>> +     printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
>>>> +     for (i=0; i<spec->autocfg.hp_outs; i++)
>>>> +             printk(KERN_INFO "hp dac(%d) %x pin %x\n", i,
>>>> spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
>>>> +     for (i=0; i<spec->multiout.num_dacs; i++)
>>>> +             printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
>>>> +     for (i=0; i<spec->autocfg.line_outs; i++)
>>>> +             printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
>>>> +     for (i=0; i<spec->multiout.num_dacs-1; i++)
>>>> +             printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i,
>>>> spec->multi_io[i].dac, spec->multi_io[i].pin);
>>>> +     for (i=0; i<spec->autocfg.speaker_outs; i++)
>>>> +             printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i,
>>>> spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
>>>>                return 1
>>>
>>> This is what appears in /var/log/messages if you go from 8 to 2 channels
>>> and back:
>>>
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853640] ch = 2
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853642] max channel 6
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853643] hp dac(0) 0 pin 1b
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853644] private_dac(0) 2
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853645] private_dac(1) 3
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853646] private_dac(2) 4
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853647] private_dac(3) 5
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853648] line_out(0) pin 17
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853649] multi_io(0) dac 3 pin 1a
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853650] multi_io(1) dac 4 pin 18
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853651] multi_io(2) dac 5 pin 17
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853652] extra_out(0) dac 0 pin 14
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952829] ch = 1
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952835] max channel 4
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952840] hp dac(0) 0 pin 1b
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952843] private_dac(0) 2
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952846] private_dac(1) 3
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952849] private_dac(2) 4
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952852] private_dac(3) 5
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952855] line_out(0) pin 17
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952859] multi_io(0) dac 3 pin 1a
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952863] multi_io(1) dac 4 pin 18
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952866] multi_io(2) dac 5 pin 17
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952870] extra_out(0) dac 0 pin 14
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378952] ch = 0
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378958] max channel 2
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378963] hp dac(0) 0 pin 1b
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378966] private_dac(0) 2
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378969] private_dac(1) 3
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378972] private_dac(2) 4
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378975] private_dac(3) 5
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378978] line_out(0) pin 17
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378982] multi_io(0) dac 3 pin 1a
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379002] multi_io(1) dac 4 pin 18
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379006] multi_io(2) dac 5 pin 17
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379010] extra_out(0) dac 0 pin 14
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746269] ch = 1
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746275] max channel 4
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746279] hp dac(0) 0 pin 1b
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746283] private_dac(0) 2
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746286] private_dac(1) 3
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746289] private_dac(2) 4
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746291] private_dac(3) 5
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746295] line_out(0) pin 17
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746298] multi_io(0) dac 3 pin 1a
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746302] multi_io(1) dac 4 pin 18
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746306] multi_io(2) dac 5 pin 17
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746310] extra_out(0) dac 0 pin 14
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174127] ch = 2
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174133] max channel 6
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174195] hp dac(0) 0 pin 1b
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174199] private_dac(0) 2
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174202] private_dac(1) 3
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174205] private_dac(2) 4
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174208] private_dac(3) 5
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174211] line_out(0) pin 17
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174215] multi_io(0) dac 3 pin 1a
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174219] multi_io(1) dac 4 pin 18
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174223] multi_io(2) dac 5 pin 17
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174226] extra_out(0) dac 0 pin 14
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111893] ch = 3
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111900] max channel 8
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111904] hp dac(0) 0 pin 1b
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111908] private_dac(0) 2
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111911] private_dac(1) 3
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111914] private_dac(2) 4
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111917] private_dac(3) 5
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111920] line_out(0) pin 17
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111924] multi_io(0) dac 3 pin 1a
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111927] multi_io(1) dac 4 pin 18
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111931] multi_io(2) dac 5 pin 17
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111935] extra_out(0) dac 0 pin 14
>>>
>>>>
>>>> Try the following code  which try to assign dac 02, 03, 04, and 05 to
>>>> spec->private_dac front, surround, clfe and side.
>>>>
>>>> static int alc_auto_fill_dac_nids(struct hda_codec *codec)
>>>> {
>>>> ...
>>>>  again:
>>>>       /* set num_dacs once to full for alc_auto_look_for_dac() */
>>>>       spec->multiout.num_dacs = cfg->line_outs;
>>>>       spec->multiout.hp_out_nid[0] = 0;
>>>>       spec->multiout.extra_out_nid[0] = 0;
>>>>       memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
>>>>       spec->multiout.dac_nids = spec->private_dac_nids;
>>>>
>>>> +     if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
>>>> +             cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
>>>> +/* assign 0x02 as Front DAC by using speaker or hp pins*/
>>>> +             spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec,
>>>> cfg->speaker_pins[0]);
>>>> +/* hp , mic and line-in at the same location
>>>> +   use alc_auto_fill_multi_ios() to assign surround and clfe dacs
>>>> +*/
>>>> +             defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
>>>> +             location = get_defcfg_location(defcfg);
>>>> +             spec->multiout.num_dacs = 1;
>>>> +             num_pins = alc_auto_fill_multi_ios(codec, location, 1);
>>>> +             if (num_pins > 0) {
>>>> +                     spec->multi_ios = num_pins;
>>>> +                     spec->ext_channel_count = 2;
>>>> +                     spec->multiout.num_dacs = num_pins + 1;
>>>> +             }
>>>> +/* an ugly hack to add side as multi io even side does not support input
>>>> +   set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT */
>>>> +             if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec,
>>>> cfg->line_out_pins[0]))) {
>>>> +                     spec->private_dac_nids[3] = alc_auto_look_for_dac(codec,
>>>> cfg->line_out_pins[0]);
>>>> +                     spec->multi_io[2].dac = spec->private_dac_nids[3];
>>>> +                     spec->multi_io[2].pin = cfg->line_out_pins[0];
>>>> +                     snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
>>>>                               AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
>>>> +                     spec->multi_ios++;
>>>> +                     spec->multiout.num_dacs++;
>>>> +             }
>>>> +             return 0;
>>>> +     }
>>>
>>> It is much better now. I applied the attached patch and 2, 4, 6 and 8
>>> channel sound is working, enabling outputs incrementally as I change the
>>> number of channels in alsamixer. Observations:
>>
>>
>>> * there is no mute for side channel
>>
>>> * no matter if Auto-Mute is set to Speaker or Line Out+Speaker, speakers
>>> will mute upon plugging a jack into either headphone or side/spdif socket
>>> * there is a "front" slider which controls internal speakers and HP
>>> jack, but the mute control under it does nothing. There are separate
>>> mute controls for HP and Speakers, which work as advertised.
>>> This is the alsa-info.sh output:
>>> http://www.alsa-project.org/db/?f=7df8ccac0a5ae751110f7b7e56f9e0ba5cc3b302
>>> Looks like we are almost there, thanks for all the input so far!
>>
>>
>> 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;
>>
>>>>>>>>>> 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 ) {
>
> Patched kernel does not build (the patch I used is attached):
> sound/pci/hda/patch_realtek.c: In function 'alc_set_multi_io':
> sound/pci/hda/patch_realtek.c:3660:8: error: 'i' undeclared (first use
> in this function)
> sound/pci/hda/patch_realtek.c:3660:8: note: each undeclared identifier
> is reported only once for each function it appears in
> make[3]: *** [sound/pci/hda/patch_realtek.o] Error 1
>
> Regards,
> Julian
>
>
>> -             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);
>> +             }
>>
>>
>> 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;
>
>

Sorry, it should be  idx instead of i

             if ( idx < 2)

it is a hack to set PIN_WIDGET_CONTROL of two input pins (idx=0 or
idx=1) to ctl.in (PIN_IN and PIN_MIC) and does not mute side jack when
idx = 2 for alt_playback when channel mode is not 8ch

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-28 11:46                                 ` Raymond Yau
@ 2011-11-28 12:02                                   ` Julian Sikorski
  0 siblings, 0 replies; 30+ messages in thread
From: Julian Sikorski @ 2011-11-28 12:02 UTC (permalink / raw)
  To: alsa-devel

W dniu 28.11.2011 12:46, Raymond Yau pisze:
> 2011/11/28 Julian Sikorski <belegdol@gmail.com>:
>> W dniu 28.11.2011 01:42, Raymond Yau pisze:
>>> 2011/11/25 Julian Sikorski <belegdol@gmail.com>:
>>>> W dniu 25.11.2011 07:39, Raymond Yau pisze:
>>>>> 2011/11/22 Julian Sikorski <belegdol@gmail.com>:
>>>>>
>>>>> Don't have any realtek codec, not sure why hda-jack-sense-test.py
>>>>> locked up when you use user_pin_configs
>>>>>
>>>>>>>> I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
>>>>>>>> attached). After reboot:
>>>>>>>> * hda-jack-sense-test.py was still working, without lockups this time
>>>>>>>> * alsamixer -c0 revealed a new "Front" slider, which was controlling the
>>>>>>>> volume on 0x17
>>>>>>>> * there was still no 8-channel mode (probably related to what you wrote
>>>>>>>> below)
>>>>>>>> * there were more options for auto mute (Disabled, Speaker Only, Line
>>>>>>>> Out+Speaker)
>>>>>>>> * here is the new alsa-info.sh:
>>>>>>>> http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>>
>>>>>>>>> To add the missing pin default of side jack 0x17
>>>>>>>>>
>>>>>>>>>       ALC662_FIXUP_ASUS_MODE8,
>>>>>>>>> +     ALC892_FIXUP_CLEVO_4ST_8CH,
>>>>>>>>> };
>>>>>>>>>
>>>>>>>>> static const struct alc_fixup alc662_fixups[] = {
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> +     [ALC892_FIXUP_CLEVO_4ST_8CH] = {
>>>>>>>>> +             .type = ALC_FIXUP_PINS,
>>>>>>>>> +             .v.pins = (const struct alc_pincfg[]) {
>>>>>>>>> +/*
>>>>>>>>> +  need to be same location as the other jack
>>>>>>>>> +  may need to change the default association and sequence since
>>>>>>>>> +  Lower Default Association values would be higher in priority for resources
>>>>>>>>> +  such as processing nodes or Input and Output Converters.
>>>>>>>>> +  A value of 0000b is reserved and should not be used
>>>>>>>>> +*/
>>>>>>>>> +                     { 0x17, 0x01011013 }, /* Side */
>>>>>>>>> +                     { }
>>>>>>>>> +             },
>>>>>>>>> +     },
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>>>>
>>>>>>>>> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
>>>>>>>>> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
>>>>>>>>> out(grey) at same location (ext rear)   for surround71 (and also 1
>>>>>>>>> speakers, 1 int mic)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> hda_codec: ALC1200: BIOS auto-probing.
>>>>>>>>> hda_codec: ALC1200: SKU not ready 0x598301f0
>>>>>>>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>>>>>>>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>>>>>>>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>>>>>>>>>    mono: mono_out=0x0
>>>>>>>>>    dig-out=0x1e/0x0
>>>>>>>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> CTRL: add: Line-Out Jack:0
>>>>>>>>> CTRL: add: Headphone Jack:0
>>>>>>>>> CTRL: add: Mic Jack:0
>>>>>>>>> CTRL: add: Line Jack:0
>>>>>>>>>
>>>>>>>>>> get 1
>>>>>>>>> 1 Channel Mode:0
>>>>>>>>> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
>>>>>>>>>
>>>>>
>>>>> After the pin fixup, your notebook is almost like alc1200 msi gx460
>>>>> except speaker and hp are swapped, this mean that those volume
>>>>> controls and switches are similar to targa_mixer , targa_8ch_mixer of
>>>>> model="targa-8ch-dig"
>>>>>
>>>>>>>>>
>>>>>>>>> This mean that when switch to 6/8 channel mode, it will conflict with
>>>>>>>>> automic detection since the pin cap alc892 's mic jack does not
>>>>>>>>> support impedance sense and the driver does not know the plug is mic
>>>>>>>>> or speaker by measuring the impedance
>>>>>>>>>
>>>>>>>>> The driver have to disable automic detection when user switch "channel
>>>>>>>>> mode" to 6ch/8ch as the user should still able to use the internal mic
>>>>>>>>> when the external mic jack is retasked as output
>>>>>>>>>
>>>>>
>>>>> The are some difference between p170hm and your p150hm if p170hm has
>>>>> 5.1 speakers which still can have auto mic detection enabled.
>>>>>
>>>>>
>>>>> you can add the following code in alc_auto_ch_mode_put() for debugging
>>>>> and need to switch "auto mute mode" to "speaker" for 8 channels
>>>>>
>>>>>
>>>>>       if (spec->need_dac_fix && !spec->const_channel_count)
>>>>>               spec->multiout.num_dacs = spec->multiout.max_channels / 2;
>>>>>
>>>>> +     printk(KERN_INFO "ch = %d\n",ch);
>>>>> +     printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
>>>>> +     for (i=0; i<spec->autocfg.hp_outs; i++)
>>>>> +             printk(KERN_INFO "hp dac(%d) %x pin %x\n", i,
>>>>> spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
>>>>> +     for (i=0; i<spec->multiout.num_dacs; i++)
>>>>> +             printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
>>>>> +     for (i=0; i<spec->autocfg.line_outs; i++)
>>>>> +             printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
>>>>> +     for (i=0; i<spec->multiout.num_dacs-1; i++)
>>>>> +             printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i,
>>>>> spec->multi_io[i].dac, spec->multi_io[i].pin);
>>>>> +     for (i=0; i<spec->autocfg.speaker_outs; i++)
>>>>> +             printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i,
>>>>> spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
>>>>>                return 1
>>>>
>>>> This is what appears in /var/log/messages if you go from 8 to 2 channels
>>>> and back:
>>>>
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853640] ch = 2
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853642] max channel 6
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853643] hp dac(0) 0 pin 1b
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853644] private_dac(0) 2
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853645] private_dac(1) 3
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853646] private_dac(2) 4
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853647] private_dac(3) 5
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853648] line_out(0) pin 17
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853649] multi_io(0) dac 3 pin 1a
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853650] multi_io(1) dac 4 pin 18
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853651] multi_io(2) dac 5 pin 17
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853652] extra_out(0) dac 0 pin 14
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952829] ch = 1
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952835] max channel 4
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952840] hp dac(0) 0 pin 1b
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952843] private_dac(0) 2
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952846] private_dac(1) 3
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952849] private_dac(2) 4
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952852] private_dac(3) 5
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952855] line_out(0) pin 17
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952859] multi_io(0) dac 3 pin 1a
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952863] multi_io(1) dac 4 pin 18
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952866] multi_io(2) dac 5 pin 17
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952870] extra_out(0) dac 0 pin 14
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378952] ch = 0
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378958] max channel 2
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378963] hp dac(0) 0 pin 1b
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378966] private_dac(0) 2
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378969] private_dac(1) 3
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378972] private_dac(2) 4
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378975] private_dac(3) 5
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378978] line_out(0) pin 17
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378982] multi_io(0) dac 3 pin 1a
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379002] multi_io(1) dac 4 pin 18
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379006] multi_io(2) dac 5 pin 17
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379010] extra_out(0) dac 0 pin 14
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746269] ch = 1
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746275] max channel 4
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746279] hp dac(0) 0 pin 1b
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746283] private_dac(0) 2
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746286] private_dac(1) 3
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746289] private_dac(2) 4
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746291] private_dac(3) 5
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746295] line_out(0) pin 17
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746298] multi_io(0) dac 3 pin 1a
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746302] multi_io(1) dac 4 pin 18
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746306] multi_io(2) dac 5 pin 17
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746310] extra_out(0) dac 0 pin 14
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174127] ch = 2
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174133] max channel 6
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174195] hp dac(0) 0 pin 1b
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174199] private_dac(0) 2
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174202] private_dac(1) 3
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174205] private_dac(2) 4
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174208] private_dac(3) 5
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174211] line_out(0) pin 17
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174215] multi_io(0) dac 3 pin 1a
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174219] multi_io(1) dac 4 pin 18
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174223] multi_io(2) dac 5 pin 17
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174226] extra_out(0) dac 0 pin 14
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111893] ch = 3
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111900] max channel 8
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111904] hp dac(0) 0 pin 1b
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111908] private_dac(0) 2
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111911] private_dac(1) 3
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111914] private_dac(2) 4
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111917] private_dac(3) 5
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111920] line_out(0) pin 17
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111924] multi_io(0) dac 3 pin 1a
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111927] multi_io(1) dac 4 pin 18
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111931] multi_io(2) dac 5 pin 17
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111935] extra_out(0) dac 0 pin 14
>>>>
>>>>>
>>>>> Try the following code  which try to assign dac 02, 03, 04, and 05 to
>>>>> spec->private_dac front, surround, clfe and side.
>>>>>
>>>>> static int alc_auto_fill_dac_nids(struct hda_codec *codec)
>>>>> {
>>>>> ...
>>>>>  again:
>>>>>       /* set num_dacs once to full for alc_auto_look_for_dac() */
>>>>>       spec->multiout.num_dacs = cfg->line_outs;
>>>>>       spec->multiout.hp_out_nid[0] = 0;
>>>>>       spec->multiout.extra_out_nid[0] = 0;
>>>>>       memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
>>>>>       spec->multiout.dac_nids = spec->private_dac_nids;
>>>>>
>>>>> +     if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
>>>>> +             cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
>>>>> +/* assign 0x02 as Front DAC by using speaker or hp pins*/
>>>>> +             spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec,
>>>>> cfg->speaker_pins[0]);
>>>>> +/* hp , mic and line-in at the same location
>>>>> +   use alc_auto_fill_multi_ios() to assign surround and clfe dacs
>>>>> +*/
>>>>> +             defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
>>>>> +             location = get_defcfg_location(defcfg);
>>>>> +             spec->multiout.num_dacs = 1;
>>>>> +             num_pins = alc_auto_fill_multi_ios(codec, location, 1);
>>>>> +             if (num_pins > 0) {
>>>>> +                     spec->multi_ios = num_pins;
>>>>> +                     spec->ext_channel_count = 2;
>>>>> +                     spec->multiout.num_dacs = num_pins + 1;
>>>>> +             }
>>>>> +/* an ugly hack to add side as multi io even side does not support input
>>>>> +   set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT */
>>>>> +             if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec,
>>>>> cfg->line_out_pins[0]))) {
>>>>> +                     spec->private_dac_nids[3] = alc_auto_look_for_dac(codec,
>>>>> cfg->line_out_pins[0]);
>>>>> +                     spec->multi_io[2].dac = spec->private_dac_nids[3];
>>>>> +                     spec->multi_io[2].pin = cfg->line_out_pins[0];
>>>>> +                     snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
>>>>>                               AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
>>>>> +                     spec->multi_ios++;
>>>>> +                     spec->multiout.num_dacs++;
>>>>> +             }
>>>>> +             return 0;
>>>>> +     }
>>>>
>>>> It is much better now. I applied the attached patch and 2, 4, 6 and 8
>>>> channel sound is working, enabling outputs incrementally as I change the
>>>> number of channels in alsamixer. Observations:
>>>
>>>
>>>> * there is no mute for side channel
>>>
>>>> * no matter if Auto-Mute is set to Speaker or Line Out+Speaker, speakers
>>>> will mute upon plugging a jack into either headphone or side/spdif socket
>>>> * there is a "front" slider which controls internal speakers and HP
>>>> jack, but the mute control under it does nothing. There are separate
>>>> mute controls for HP and Speakers, which work as advertised.
>>>> This is the alsa-info.sh output:
>>>> http://www.alsa-project.org/db/?f=7df8ccac0a5ae751110f7b7e56f9e0ba5cc3b302
>>>> Looks like we are almost there, thanks for all the input so far!
>>>
>>>
>>> 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;
>>>
>>>>>>>>>>> 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 ) {
>>
>> Patched kernel does not build (the patch I used is attached):
>> sound/pci/hda/patch_realtek.c: In function 'alc_set_multi_io':
>> sound/pci/hda/patch_realtek.c:3660:8: error: 'i' undeclared (first use
>> in this function)
>> sound/pci/hda/patch_realtek.c:3660:8: note: each undeclared identifier
>> is reported only once for each function it appears in
>> make[3]: *** [sound/pci/hda/patch_realtek.o] Error 1
>>
>> Regards,
>> Julian
>>
>>
>>> -             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);
>>> +             }
>>>
>>>
>>> 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;
>>
>>
> 
> Sorry, it should be  idx instead of i
> 
>              if ( idx < 2)
> 
> it is a hack to set PIN_WIDGET_CONTROL of two input pins (idx=0 or
> idx=1) to ctl.in (PIN_IN and PIN_MIC) and does not mute side jack when
> idx = 2 for alt_playback when channel mode is not 8ch
Yeah, I have figured it out. I am testing the working patch and writing
a report.
I'll send it as soon as I am able to test the b) version, the kernel is
still building.
What timezone are you in by the way? I am in CET.

Julian

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-28  0:42                             ` Raymond Yau
  2011-11-28 10:27                               ` Julian Sikorski
@ 2011-11-28 12:34                               ` Julian Sikorski
  2011-11-28 23:45                                 ` Raymond Yau
  1 sibling, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-28 12:34 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 19509 bytes --]

W dniu 28.11.2011 01:42, Raymond Yau pisze:
> 2011/11/25 Julian Sikorski <belegdol@gmail.com>:
>> W dniu 25.11.2011 07:39, Raymond Yau pisze:
>>> 2011/11/22 Julian Sikorski <belegdol@gmail.com>:
>>>
>>> Don't have any realtek codec, not sure why hda-jack-sense-test.py
>>> locked up when you use user_pin_configs
>>>
>>>>>> I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
>>>>>> attached). After reboot:
>>>>>> * hda-jack-sense-test.py was still working, without lockups this time
>>>>>> * alsamixer -c0 revealed a new "Front" slider, which was controlling the
>>>>>> volume on 0x17
>>>>>> * there was still no 8-channel mode (probably related to what you wrote
>>>>>> below)
>>>>>> * there were more options for auto mute (Disabled, Speaker Only, Line
>>>>>> Out+Speaker)
>>>>>> * here is the new alsa-info.sh:
>>>>>> http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052
>>>>>>
>>>>>
>>>>>
>>>>>>>
>>>>>>> To add the missing pin default of side jack 0x17
>>>>>>>
>>>>>>>       ALC662_FIXUP_ASUS_MODE8,
>>>>>>> +     ALC892_FIXUP_CLEVO_4ST_8CH,
>>>>>>> };
>>>>>>>
>>>>>>> static const struct alc_fixup alc662_fixups[] = {
>>>>>>>
>>>>>>>
>>>>>>> +     [ALC892_FIXUP_CLEVO_4ST_8CH] = {
>>>>>>> +             .type = ALC_FIXUP_PINS,
>>>>>>> +             .v.pins = (const struct alc_pincfg[]) {
>>>>>>> +/*
>>>>>>> +  need to be same location as the other jack
>>>>>>> +  may need to change the default association and sequence since
>>>>>>> +  Lower Default Association values would be higher in priority for resources
>>>>>>> +  such as processing nodes or Input and Output Converters.
>>>>>>> +  A value of 0000b is reserved and should not be used
>>>>>>> +*/
>>>>>>> +                     { 0x17, 0x01011013 }, /* Side */
>>>>>>> +                     { }
>>>>>>> +             },
>>>>>>> +     },
>>>>>>>
>>>>>>>
>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>>
>>>>>>> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
>>>>>>> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
>>>>>>> out(grey) at same location (ext rear)   for surround71 (and also 1
>>>>>>> speakers, 1 int mic)
>>>>>>>
>>>>>>>
>>>>>>> hda_codec: ALC1200: BIOS auto-probing.
>>>>>>> hda_codec: ALC1200: SKU not ready 0x598301f0
>>>>>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>>>>>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>>>>>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>>>>>>>    mono: mono_out=0x0
>>>>>>>    dig-out=0x1e/0x0
>>>>>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>>>>>
>>>>>>>
>>>>>>> CTRL: add: Line-Out Jack:0
>>>>>>> CTRL: add: Headphone Jack:0
>>>>>>> CTRL: add: Mic Jack:0
>>>>>>> CTRL: add: Line Jack:0
>>>>>>>
>>>>>>>> get 1
>>>>>>> 1 Channel Mode:0
>>>>>>> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
>>>>>>>
>>>
>>> After the pin fixup, your notebook is almost like alc1200 msi gx460
>>> except speaker and hp are swapped, this mean that those volume
>>> controls and switches are similar to targa_mixer , targa_8ch_mixer of
>>> model="targa-8ch-dig"
>>>
>>>>>>>
>>>>>>> This mean that when switch to 6/8 channel mode, it will conflict with
>>>>>>> automic detection since the pin cap alc892 's mic jack does not
>>>>>>> support impedance sense and the driver does not know the plug is mic
>>>>>>> or speaker by measuring the impedance
>>>>>>>
>>>>>>> The driver have to disable automic detection when user switch "channel
>>>>>>> mode" to 6ch/8ch as the user should still able to use the internal mic
>>>>>>> when the external mic jack is retasked as output
>>>>>>>
>>>
>>> The are some difference between p170hm and your p150hm if p170hm has
>>> 5.1 speakers which still can have auto mic detection enabled.
>>>
>>>
>>> you can add the following code in alc_auto_ch_mode_put() for debugging
>>> and need to switch "auto mute mode" to "speaker" for 8 channels
>>>
>>>
>>>       if (spec->need_dac_fix && !spec->const_channel_count)
>>>               spec->multiout.num_dacs = spec->multiout.max_channels / 2;
>>>
>>> +     printk(KERN_INFO "ch = %d\n",ch);
>>> +     printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
>>> +     for (i=0; i<spec->autocfg.hp_outs; i++)
>>> +             printk(KERN_INFO "hp dac(%d) %x pin %x\n", i,
>>> spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
>>> +     for (i=0; i<spec->multiout.num_dacs; i++)
>>> +             printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
>>> +     for (i=0; i<spec->autocfg.line_outs; i++)
>>> +             printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
>>> +     for (i=0; i<spec->multiout.num_dacs-1; i++)
>>> +             printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i,
>>> spec->multi_io[i].dac, spec->multi_io[i].pin);
>>> +     for (i=0; i<spec->autocfg.speaker_outs; i++)
>>> +             printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i,
>>> spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
>>>                return 1
>>
>> This is what appears in /var/log/messages if you go from 8 to 2 channels
>> and back:
>>
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853640] ch = 2
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853642] max channel 6
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853643] hp dac(0) 0 pin 1b
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853644] private_dac(0) 2
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853645] private_dac(1) 3
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853646] private_dac(2) 4
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853647] private_dac(3) 5
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853648] line_out(0) pin 17
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853649] multi_io(0) dac 3 pin 1a
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853650] multi_io(1) dac 4 pin 18
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853651] multi_io(2) dac 5 pin 17
>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853652] extra_out(0) dac 0 pin 14
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952829] ch = 1
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952835] max channel 4
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952840] hp dac(0) 0 pin 1b
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952843] private_dac(0) 2
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952846] private_dac(1) 3
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952849] private_dac(2) 4
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952852] private_dac(3) 5
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952855] line_out(0) pin 17
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952859] multi_io(0) dac 3 pin 1a
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952863] multi_io(1) dac 4 pin 18
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952866] multi_io(2) dac 5 pin 17
>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952870] extra_out(0) dac 0 pin 14
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378952] ch = 0
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378958] max channel 2
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378963] hp dac(0) 0 pin 1b
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378966] private_dac(0) 2
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378969] private_dac(1) 3
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378972] private_dac(2) 4
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378975] private_dac(3) 5
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378978] line_out(0) pin 17
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378982] multi_io(0) dac 3 pin 1a
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379002] multi_io(1) dac 4 pin 18
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379006] multi_io(2) dac 5 pin 17
>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379010] extra_out(0) dac 0 pin 14
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746269] ch = 1
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746275] max channel 4
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746279] hp dac(0) 0 pin 1b
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746283] private_dac(0) 2
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746286] private_dac(1) 3
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746289] private_dac(2) 4
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746291] private_dac(3) 5
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746295] line_out(0) pin 17
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746298] multi_io(0) dac 3 pin 1a
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746302] multi_io(1) dac 4 pin 18
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746306] multi_io(2) dac 5 pin 17
>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746310] extra_out(0) dac 0 pin 14
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174127] ch = 2
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174133] max channel 6
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174195] hp dac(0) 0 pin 1b
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174199] private_dac(0) 2
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174202] private_dac(1) 3
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174205] private_dac(2) 4
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174208] private_dac(3) 5
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174211] line_out(0) pin 17
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174215] multi_io(0) dac 3 pin 1a
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174219] multi_io(1) dac 4 pin 18
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174223] multi_io(2) dac 5 pin 17
>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174226] extra_out(0) dac 0 pin 14
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111893] ch = 3
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111900] max channel 8
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111904] hp dac(0) 0 pin 1b
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111908] private_dac(0) 2
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111911] private_dac(1) 3
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111914] private_dac(2) 4
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111917] private_dac(3) 5
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111920] line_out(0) pin 17
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111924] multi_io(0) dac 3 pin 1a
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111927] multi_io(1) dac 4 pin 18
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111931] multi_io(2) dac 5 pin 17
>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111935] extra_out(0) dac 0 pin 14
>>
>>>
>>> Try the following code  which try to assign dac 02, 03, 04, and 05 to
>>> spec->private_dac front, surround, clfe and side.
>>>
>>> static int alc_auto_fill_dac_nids(struct hda_codec *codec)
>>> {
>>> ...
>>>  again:
>>>       /* set num_dacs once to full for alc_auto_look_for_dac() */
>>>       spec->multiout.num_dacs = cfg->line_outs;
>>>       spec->multiout.hp_out_nid[0] = 0;
>>>       spec->multiout.extra_out_nid[0] = 0;
>>>       memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
>>>       spec->multiout.dac_nids = spec->private_dac_nids;
>>>
>>> +     if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
>>> +             cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
>>> +/* assign 0x02 as Front DAC by using speaker or hp pins*/
>>> +             spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec,
>>> cfg->speaker_pins[0]);
>>> +/* hp , mic and line-in at the same location
>>> +   use alc_auto_fill_multi_ios() to assign surround and clfe dacs
>>> +*/
>>> +             defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
>>> +             location = get_defcfg_location(defcfg);
>>> +             spec->multiout.num_dacs = 1;
>>> +             num_pins = alc_auto_fill_multi_ios(codec, location, 1);
>>> +             if (num_pins > 0) {
>>> +                     spec->multi_ios = num_pins;
>>> +                     spec->ext_channel_count = 2;
>>> +                     spec->multiout.num_dacs = num_pins + 1;
>>> +             }
>>> +/* an ugly hack to add side as multi io even side does not support input
>>> +   set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT */
>>> +             if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec,
>>> cfg->line_out_pins[0]))) {
>>> +                     spec->private_dac_nids[3] = alc_auto_look_for_dac(codec,
>>> cfg->line_out_pins[0]);
>>> +                     spec->multi_io[2].dac = spec->private_dac_nids[3];
>>> +                     spec->multi_io[2].pin = cfg->line_out_pins[0];
>>> +                     snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
>>>                               AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
>>> +                     spec->multi_ios++;
>>> +                     spec->multiout.num_dacs++;
>>> +             }
>>> +             return 0;
>>> +     }
>>
>> It is much better now. I applied the attached patch and 2, 4, 6 and 8
>> channel sound is working, enabling outputs incrementally as I change the
>> number of channels in alsamixer. Observations:
> 
> 
>> * there is no mute for side channel
> 
>> * no matter if Auto-Mute is set to Speaker or Line Out+Speaker, speakers
>> will mute upon plugging a jack into either headphone or side/spdif socket
>> * there is a "front" slider which controls internal speakers and HP
>> jack, but the mute control under it does nothing. There are separate
>> mute controls for HP and Speakers, which work as advertised.
>> This is the alsa-info.sh output:
>> http://www.alsa-project.org/db/?f=7df8ccac0a5ae751110f7b7e56f9e0ba5cc3b302
>> Looks like we are almost there, thanks for all the input so far!
> 
> 
> 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
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

> 
>>>>>>>>> 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:

$ 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

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.
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.
Once again, thank you for all the input so far.

Best regards,
Julian




[-- Attachment #2: clevo-0x17-rawhide.patch --]
[-- Type: text/x-patch, Size: 6198 bytes --]

diff -up ./sound/pci/hda/patch_realtek.c.clevo ./sound/pci/hda/patch_realtek.c
--- ./sound/pci/hda/patch_realtek.c.clevo	2011-11-28 10:38:29.643369001 +0100
+++ ./sound/pci/hda/patch_realtek.c	2011-11-28 11:32:31.622653828 +0100
@@ -3053,6 +3053,38 @@ static int alc_auto_fill_dac_nids(struct
 	memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
 	spec->multiout.dac_nids = spec->private_dac_nids;
 
+	if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
+		cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
+	/* assign 0x02 as Front DAC by using speaker or hp pins */
+		spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec, cfg->speaker_pins[0]);
+	/* hp , mic and line-in at the same location
+	 * use alc_auto_fill_multi_ios() to assign surround and clfe dacs
+	 */
+		defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
+		location = get_defcfg_location(defcfg);
+		spec->multiout.num_dacs = 1;
+		num_pins = alc_auto_fill_multi_ios(codec, location, 1);
+		if (num_pins > 0) {
+			spec->multi_ios = num_pins;
+			spec->ext_channel_count = 2;
+			spec->multiout.num_dacs = num_pins + 1;
+		}
+	/* an ugly hack to add side as multi io even side does not support input
+	 * set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT
+	 */
+		if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]))) {
+			spec->private_dac_nids[3] = alc_auto_look_for_dac(codec, cfg->line_out_pins[0]);
+			spec->multi_io[2].dac = spec->private_dac_nids[3];
+			spec->multi_io[2].pin = cfg->line_out_pins[0];
+			snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
+				AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
+			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;
+	}
+
 	/* fill hard-wired DACs first */
 	if (!redone) {
 		for (i = 0; i < cfg->line_outs; i++)
@@ -3126,6 +3158,7 @@ static int alc_auto_fill_dac_nids(struct
 		}
 	}
 
+	spec->alt_dac_nid = spec->private_dac_nids[3];
 	return 0;
 }
 
@@ -3255,7 +3288,12 @@ static int alc_auto_create_multi_out_ctl
 		if (i >= cfg->line_outs)
 			pin = spec->multi_io[i - 1].pin;
 		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];
 
 		sw = alc_look_for_out_mute_nid(codec, pin, dac);
 		vol = alc_look_for_out_vol_nid(codec, pin, dac);
@@ -3275,9 +3313,11 @@ static int alc_auto_create_multi_out_ctl
 			if (err < 0)
 				return err;
 		} else {
+			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;
@@ -3617,12 +3657,16 @@ static int alc_set_multi_io(struct hda_c
 						 HDA_AMP_MUTE, 0);
 		alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac);
 	} else {
-		if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
+		if ( idx < 2 ) {
 			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);
+		}
 	}
 	return 0;
 }
@@ -3645,6 +3689,19 @@ static int alc_auto_ch_mode_put(struct s
 	spec->multiout.max_channels = spec->ext_channel_count;
 	if (spec->need_dac_fix && !spec->const_channel_count)
 		spec->multiout.num_dacs = spec->multiout.max_channels / 2;
+
+	printk(KERN_INFO "ch = %d\n",ch);
+	printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
+	for (i=0; i<spec->autocfg.hp_outs; i++)
+		printk(KERN_INFO "hp dac(%d) %x pin %x\n", i, spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
+	for (i=0; i<spec->multiout.num_dacs; i++)
+		printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
+	for (i=0; i<spec->autocfg.line_outs; i++)
+		printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
+	for (i=0; i<spec->multiout.num_dacs-1; i++)
+		printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i, spec->multi_io[i].dac, spec->multi_io[i].pin);
+	for (i=0; i<spec->autocfg.speaker_outs; i++)
+		printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i, spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
 	return 1;
 }
 
@@ -5850,6 +5907,7 @@ enum {
 	ALC662_FIXUP_ASUS_MODE6,
 	ALC662_FIXUP_ASUS_MODE7,
 	ALC662_FIXUP_ASUS_MODE8,
+	ALC892_FIXUP_CLEVO_4ST_8CH,
 };
 
 static const struct alc_fixup alc662_fixups[] = {
@@ -5995,6 +6053,20 @@ static const struct alc_fixup alc662_fix
 		.chained = true,
 		.chain_id = ALC662_FIXUP_SKU_IGNORE
 	},
+	[ALC892_FIXUP_CLEVO_4ST_8CH] = {
+		.type = ALC_FIXUP_PINS,
+		.v.pins = (const struct alc_pincfg[]) {
+/*
+  need to be same location as the other jack
+  may need to change the default association and sequence since
+  Lower Default Association values would be higher in priority for resources
+  such as processing nodes or Input and Output Converters.
+  A value of 0000b is reserved and should not be used
+*/
+			{ 0x17, 0x01011013 }, /* Side */
+			{ }
+		},
+	},
 };
 
 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -6008,6 +6080,8 @@ static const struct snd_pci_quirk alc662
 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
+	SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
+	SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
 
 #if 0
 	/* Below is a quirk table taken from the old code.



[-- Attachment #3: clevo-0x17-rawhide-versionb.patch --]
[-- Type: text/x-patch, Size: 5455 bytes --]

diff -up ./sound/pci/hda/patch_realtek.c.clevo ./sound/pci/hda/patch_realtek.c
--- ./sound/pci/hda/patch_realtek.c.clevo	2011-11-28 12:48:50.083700918 +0100
+++ ./sound/pci/hda/patch_realtek.c	2011-11-28 12:50:49.175466448 +0100
@@ -3053,6 +3053,38 @@ static int alc_auto_fill_dac_nids(struct
 	memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
 	spec->multiout.dac_nids = spec->private_dac_nids;
 
+	if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
+		cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
+	/* assign 0x02 as Front DAC by using speaker or hp pins */
+		spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec, cfg->speaker_pins[0]);
+	/* hp , mic and line-in at the same location
+	 * use alc_auto_fill_multi_ios() to assign surround and clfe dacs
+	 */
+		defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
+		location = get_defcfg_location(defcfg);
+		spec->multiout.num_dacs = 1;
+		num_pins = alc_auto_fill_multi_ios(codec, location, 1);
+		if (num_pins > 0) {
+			spec->multi_ios = num_pins;
+			spec->ext_channel_count = 2;
+			spec->multiout.num_dacs = num_pins + 1;
+		}
+	/* an ugly hack to add side as multi io even side does not support input
+	 * set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT
+	 */
+		if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]))) {
+			spec->private_dac_nids[3] = alc_auto_look_for_dac(codec, cfg->line_out_pins[0]);
+			spec->multi_io[2].dac = spec->private_dac_nids[3];
+			spec->multi_io[2].pin = cfg->line_out_pins[0];
+			snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
+				AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
+			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;
+	}
+
 	/* fill hard-wired DACs first */
 	if (!redone) {
 		for (i = 0; i < cfg->line_outs; i++)
@@ -3126,6 +3158,7 @@ static int alc_auto_fill_dac_nids(struct
 		}
 	}
 
+	spec->alt_dac_nid = spec->multiout.hp_out_nid[0];
 	return 0;
 }
 
@@ -3255,7 +3288,12 @@ static int alc_auto_create_multi_out_ctl
 		if (i >= cfg->line_outs)
 			pin = spec->multi_io[i - 1].pin;
 		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];
 
 		sw = alc_look_for_out_mute_nid(codec, pin, dac);
 		vol = alc_look_for_out_vol_nid(codec, pin, dac);
@@ -3275,9 +3313,11 @@ static int alc_auto_create_multi_out_ctl
 			if (err < 0)
 				return err;
 		} else {
+			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;
@@ -3645,6 +3685,19 @@ static int alc_auto_ch_mode_put(struct s
 	spec->multiout.max_channels = spec->ext_channel_count;
 	if (spec->need_dac_fix && !spec->const_channel_count)
 		spec->multiout.num_dacs = spec->multiout.max_channels / 2;
+
+	printk(KERN_INFO "ch = %d\n",ch);
+	printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
+	for (i=0; i<spec->autocfg.hp_outs; i++)
+		printk(KERN_INFO "hp dac(%d) %x pin %x\n", i, spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
+	for (i=0; i<spec->multiout.num_dacs; i++)
+		printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
+	for (i=0; i<spec->autocfg.line_outs; i++)
+		printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
+	for (i=0; i<spec->multiout.num_dacs-1; i++)
+		printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i, spec->multi_io[i].dac, spec->multi_io[i].pin);
+	for (i=0; i<spec->autocfg.speaker_outs; i++)
+		printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i, spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
 	return 1;
 }
 
@@ -5850,6 +5903,7 @@ enum {
 	ALC662_FIXUP_ASUS_MODE6,
 	ALC662_FIXUP_ASUS_MODE7,
 	ALC662_FIXUP_ASUS_MODE8,
+	ALC892_FIXUP_CLEVO_4ST_8CH,
 };
 
 static const struct alc_fixup alc662_fixups[] = {
@@ -5995,6 +6049,20 @@ static const struct alc_fixup alc662_fix
 		.chained = true,
 		.chain_id = ALC662_FIXUP_SKU_IGNORE
 	},
+	[ALC892_FIXUP_CLEVO_4ST_8CH] = {
+		.type = ALC_FIXUP_PINS,
+		.v.pins = (const struct alc_pincfg[]) {
+/*
+  need to be same location as the other jack
+  may need to change the default association and sequence since
+  Lower Default Association values would be higher in priority for resources
+  such as processing nodes or Input and Output Converters.
+  A value of 0000b is reserved and should not be used
+*/
+			{ 0x17, 0x01011013 }, /* Side */
+			{ }
+		},
+	},
 };
 
 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -6008,6 +6076,8 @@ static const struct snd_pci_quirk alc662
 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
+	SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
+	SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
 
 #if 0
 	/* Below is a quirk table taken from the old code.



[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-28 12:34                               ` Julian Sikorski
@ 2011-11-28 23:45                                 ` Raymond Yau
  2011-11-29 10:25                                   ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Raymond Yau @ 2011-11-28 23:45 UTC (permalink / raw)
  To: ALSA Development Mailing List

2011/11/28 Julian Sikorski <belegdol@gmail.com>:
> W dniu 28.11.2011 01:42, Raymond Yau pisze:
>> 2011/11/25 Julian Sikorski <belegdol@gmail.com>:
>>> W dniu 25.11.2011 07:39, Raymond Yau pisze:
>>>> 2011/11/22 Julian Sikorski <belegdol@gmail.com>:
>>>>
>>>> Don't have any realtek codec, not sure why hda-jack-sense-test.py
>>>> locked up when you use user_pin_configs
>>>>
>>>>>>> I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
>>>>>>> attached). After reboot:
>>>>>>> * hda-jack-sense-test.py was still working, without lockups this time
>>>>>>> * alsamixer -c0 revealed a new "Front" slider, which was controlling the
>>>>>>> volume on 0x17
>>>>>>> * there was still no 8-channel mode (probably related to what you wrote
>>>>>>> below)
>>>>>>> * there were more options for auto mute (Disabled, Speaker Only, Line
>>>>>>> Out+Speaker)
>>>>>>> * here is the new alsa-info.sh:
>>>>>>> http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052
>>>>>>>
>>>>>>
>>>>>>
>>>>>>>>
>>>>>>>> To add the missing pin default of side jack 0x17
>>>>>>>>
>>>>>>>>       ALC662_FIXUP_ASUS_MODE8,
>>>>>>>> +     ALC892_FIXUP_CLEVO_4ST_8CH,
>>>>>>>> };
>>>>>>>>
>>>>>>>> static const struct alc_fixup alc662_fixups[] = {
>>>>>>>>
>>>>>>>>
>>>>>>>> +     [ALC892_FIXUP_CLEVO_4ST_8CH] = {
>>>>>>>> +             .type = ALC_FIXUP_PINS,
>>>>>>>> +             .v.pins = (const struct alc_pincfg[]) {
>>>>>>>> +/*
>>>>>>>> +  need to be same location as the other jack
>>>>>>>> +  may need to change the default association and sequence since
>>>>>>>> +  Lower Default Association values would be higher in priority for resources
>>>>>>>> +  such as processing nodes or Input and Output Converters.
>>>>>>>> +  A value of 0000b is reserved and should not be used
>>>>>>>> +*/
>>>>>>>> +                     { 0x17, 0x01011013 }, /* Side */
>>>>>>>> +                     { }
>>>>>>>> +             },
>>>>>>>> +     },
>>>>>>>>
>>>>>>>>
>>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>>>
>>>>>>>> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
>>>>>>>> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
>>>>>>>> out(grey) at same location (ext rear)   for surround71 (and also 1
>>>>>>>> speakers, 1 int mic)
>>>>>>>>
>>>>>>>>
>>>>>>>> hda_codec: ALC1200: BIOS auto-probing.
>>>>>>>> hda_codec: ALC1200: SKU not ready 0x598301f0
>>>>>>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>>>>>>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>>>>>>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>>>>>>>>    mono: mono_out=0x0
>>>>>>>>    dig-out=0x1e/0x0
>>>>>>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>>>>>>
>>>>>>>>
>>>>>>>> CTRL: add: Line-Out Jack:0
>>>>>>>> CTRL: add: Headphone Jack:0
>>>>>>>> CTRL: add: Mic Jack:0
>>>>>>>> CTRL: add: Line Jack:0
>>>>>>>>
>>>>>>>>> get 1
>>>>>>>> 1 Channel Mode:0
>>>>>>>> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
>>>>>>>>
>>>>
>>>> After the pin fixup, your notebook is almost like alc1200 msi gx460
>>>> except speaker and hp are swapped, this mean that those volume
>>>> controls and switches are similar to targa_mixer , targa_8ch_mixer of
>>>> model="targa-8ch-dig"
>>>>
>>>>>>>>
>>>>>>>> This mean that when switch to 6/8 channel mode, it will conflict with
>>>>>>>> automic detection since the pin cap alc892 's mic jack does not
>>>>>>>> support impedance sense and the driver does not know the plug is mic
>>>>>>>> or speaker by measuring the impedance
>>>>>>>>
>>>>>>>> The driver have to disable automic detection when user switch "channel
>>>>>>>> mode" to 6ch/8ch as the user should still able to use the internal mic
>>>>>>>> when the external mic jack is retasked as output
>>>>>>>>
>>>>
>>>> The are some difference between p170hm and your p150hm if p170hm has
>>>> 5.1 speakers which still can have auto mic detection enabled.
>>>>
>>>>
>>>> you can add the following code in alc_auto_ch_mode_put() for debugging
>>>> and need to switch "auto mute mode" to "speaker" for 8 channels
>>>>
>>>>
>>>>       if (spec->need_dac_fix && !spec->const_channel_count)
>>>>               spec->multiout.num_dacs = spec->multiout.max_channels / 2;
>>>>
>>>> +     printk(KERN_INFO "ch = %d\n",ch);
>>>> +     printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
>>>> +     for (i=0; i<spec->autocfg.hp_outs; i++)
>>>> +             printk(KERN_INFO "hp dac(%d) %x pin %x\n", i,
>>>> spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
>>>> +     for (i=0; i<spec->multiout.num_dacs; i++)
>>>> +             printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
>>>> +     for (i=0; i<spec->autocfg.line_outs; i++)
>>>> +             printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
>>>> +     for (i=0; i<spec->multiout.num_dacs-1; i++)
>>>> +             printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i,
>>>> spec->multi_io[i].dac, spec->multi_io[i].pin);
>>>> +     for (i=0; i<spec->autocfg.speaker_outs; i++)
>>>> +             printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i,
>>>> spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
>>>>                return 1
>>>
>>> This is what appears in /var/log/messages if you go from 8 to 2 channels
>>> and back:
>>>
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853640] ch = 2
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853642] max channel 6
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853643] hp dac(0) 0 pin 1b
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853644] private_dac(0) 2
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853645] private_dac(1) 3
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853646] private_dac(2) 4
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853647] private_dac(3) 5
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853648] line_out(0) pin 17
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853649] multi_io(0) dac 3 pin 1a
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853650] multi_io(1) dac 4 pin 18
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853651] multi_io(2) dac 5 pin 17
>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853652] extra_out(0) dac 0 pin 14
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952829] ch = 1
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952835] max channel 4
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952840] hp dac(0) 0 pin 1b
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952843] private_dac(0) 2
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952846] private_dac(1) 3
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952849] private_dac(2) 4
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952852] private_dac(3) 5
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952855] line_out(0) pin 17
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952859] multi_io(0) dac 3 pin 1a
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952863] multi_io(1) dac 4 pin 18
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952866] multi_io(2) dac 5 pin 17
>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952870] extra_out(0) dac 0 pin 14
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378952] ch = 0
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378958] max channel 2
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378963] hp dac(0) 0 pin 1b
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378966] private_dac(0) 2
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378969] private_dac(1) 3
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378972] private_dac(2) 4
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378975] private_dac(3) 5
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378978] line_out(0) pin 17
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378982] multi_io(0) dac 3 pin 1a
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379002] multi_io(1) dac 4 pin 18
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379006] multi_io(2) dac 5 pin 17
>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379010] extra_out(0) dac 0 pin 14
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746269] ch = 1
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746275] max channel 4
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746279] hp dac(0) 0 pin 1b
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746283] private_dac(0) 2
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746286] private_dac(1) 3
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746289] private_dac(2) 4
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746291] private_dac(3) 5
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746295] line_out(0) pin 17
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746298] multi_io(0) dac 3 pin 1a
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746302] multi_io(1) dac 4 pin 18
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746306] multi_io(2) dac 5 pin 17
>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746310] extra_out(0) dac 0 pin 14
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174127] ch = 2
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174133] max channel 6
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174195] hp dac(0) 0 pin 1b
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174199] private_dac(0) 2
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174202] private_dac(1) 3
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174205] private_dac(2) 4
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174208] private_dac(3) 5
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174211] line_out(0) pin 17
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174215] multi_io(0) dac 3 pin 1a
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174219] multi_io(1) dac 4 pin 18
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174223] multi_io(2) dac 5 pin 17
>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174226] extra_out(0) dac 0 pin 14
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111893] ch = 3
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111900] max channel 8
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111904] hp dac(0) 0 pin 1b
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111908] private_dac(0) 2
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111911] private_dac(1) 3
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111914] private_dac(2) 4
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111917] private_dac(3) 5
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111920] line_out(0) pin 17
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111924] multi_io(0) dac 3 pin 1a
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111927] multi_io(1) dac 4 pin 18
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111931] multi_io(2) dac 5 pin 17
>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111935] extra_out(0) dac 0 pin 14
>>>
>>>>
>>>> Try the following code  which try to assign dac 02, 03, 04, and 05 to
>>>> spec->private_dac front, surround, clfe and side.
>>>>
>>>> static int alc_auto_fill_dac_nids(struct hda_codec *codec)
>>>> {
>>>> ...
>>>>  again:
>>>>       /* set num_dacs once to full for alc_auto_look_for_dac() */
>>>>       spec->multiout.num_dacs = cfg->line_outs;
>>>>       spec->multiout.hp_out_nid[0] = 0;
>>>>       spec->multiout.extra_out_nid[0] = 0;
>>>>       memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
>>>>       spec->multiout.dac_nids = spec->private_dac_nids;
>>>>
>>>> +     if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
>>>> +             cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
>>>> +/* assign 0x02 as Front DAC by using speaker or hp pins*/
>>>> +             spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec,
>>>> cfg->speaker_pins[0]);
>>>> +/* hp , mic and line-in at the same location
>>>> +   use alc_auto_fill_multi_ios() to assign surround and clfe dacs
>>>> +*/
>>>> +             defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
>>>> +             location = get_defcfg_location(defcfg);
>>>> +             spec->multiout.num_dacs = 1;
>>>> +             num_pins = alc_auto_fill_multi_ios(codec, location, 1);
>>>> +             if (num_pins > 0) {
>>>> +                     spec->multi_ios = num_pins;
>>>> +                     spec->ext_channel_count = 2;
>>>> +                     spec->multiout.num_dacs = num_pins + 1;
>>>> +             }
>>>> +/* an ugly hack to add side as multi io even side does not support input
>>>> +   set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT */
>>>> +             if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec,
>>>> cfg->line_out_pins[0]))) {
>>>> +                     spec->private_dac_nids[3] = alc_auto_look_for_dac(codec,
>>>> cfg->line_out_pins[0]);
>>>> +                     spec->multi_io[2].dac = spec->private_dac_nids[3];
>>>> +                     spec->multi_io[2].pin = cfg->line_out_pins[0];
>>>> +                     snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
>>>>                               AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
>>>> +                     spec->multi_ios++;
>>>> +                     spec->multiout.num_dacs++;
>>>> +             }
>>>> +             return 0;
>>>> +     }
>>>
>>> It is much better now. I applied the attached patch and 2, 4, 6 and 8
>>> channel sound is working, enabling outputs incrementally as I change the
>>> number of channels in alsamixer. Observations:
>>
>>
>>> * there is no mute for side channel
>>
>>> * no matter if Auto-Mute is set to Speaker or Line Out+Speaker, speakers
>>> will mute upon plugging a jack into either headphone or side/spdif socket
>>> * there is a "front" slider which controls internal speakers and HP
>>> jack, but the mute control under it does nothing. There are separate
>>> mute controls for HP and Speakers, which work as advertised.
>>> This is the alsa-info.sh output:
>>> http://www.alsa-project.org/db/?f=7df8ccac0a5ae751110f7b7e56f9e0ba5cc3b302
>>> Looks like we are almost there, thanks for all the input so far!
>>
>>
>> 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
> 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
>
>>
>>>>>>>>>> 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:

There was a patch which add "Independent hp" swtich and create device
2 for alc892 desktop with 6 jacks at rear panel

http://thread.gmane.org/gmane.linux.alsa.devel/84653/focus=84695

APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 2: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 3: ALC892 Digital [ALC892 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

you can change "independent_hp" to "alt playback" in that patch

	hda_nid_t alt_dac_nid;
+	int alt_playback;
+	int alt_playback_max;


static int alc_alt_playback_info(struct snd_kcontrol *kcontrol,
				   struct snd_ctl_elem_info *uinfo)
{
	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
	struct alc_spec *spec = codec->spec;
	static const char * const texts[] = { "OFF", "Headphone", "Side", NULL};
	int index;
	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
	uinfo->count = 1;
	uinfo->value.enumerated.items = spec->alt_playback_max;
	index = uinfo->value.enumerated.item;
	if (index >= spec->alt_playback_max)
		index = 1;
	strcpy(uinfo->value.enumerated.name, texts[index]);
	return 0;
}

static int alc_alt_playback_get(struct snd_kcontrol *kcontrol,
				  struct snd_ctl_elem_value *ucontrol)
{
	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
	struct alc_spec *spec = codec->spec;
	ucontrol->value.enumerated.item[0] = spec->alt_playback;
	return 0;
}

static int alc_alt_playback_put(struct snd_kcontrol *kcontrol,
				  struct snd_ctl_elem_value *ucontrol)
{
	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
	struct alc_spec *spec = codec->spec;
	unsigned int select = ucontrol->value.enumerated.item[0];
	if (spec->alt_playback != select) {
	        spec->alt_playback = select;
		switch(spec->alt_playback) {
			spec->multiout.hp_out_nid[0] = 0;
			break;
		case 1:
			spec->multiout.hp_out_nid[0] = spec->alt_dac_nid;
			break;
		case 2:
			break;
		}
		return 1;
	}
	return 0;
}

static const struct snd_kcontrol_new alc_alt_playback_switch[] = {
	{
		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
		.name = "Alternate Playback Switch",
		.info = alc_alt_playback_info,
		.get = alc_alt_playback_get,
		.put = alc_alt_playback_put,
	},
	{ } /* end */
};

>
> $ 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
>
> 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.
> 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 ?

> Once again, thank you for all the input so far.
>
> Best regards,
> Julian
>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-28 23:45                                 ` Raymond Yau
@ 2011-11-29 10:25                                   ` Julian Sikorski
  2011-12-01 16:35                                     ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-11-29 10:25 UTC (permalink / raw)
  To: alsa-devel

W dniu 29.11.2011 00:45, Raymond Yau pisze:
> 2011/11/28 Julian Sikorski <belegdol@gmail.com>:
>> W dniu 28.11.2011 01:42, Raymond Yau pisze:
>>> 2011/11/25 Julian Sikorski <belegdol@gmail.com>:
>>>> W dniu 25.11.2011 07:39, Raymond Yau pisze:
>>>>> 2011/11/22 Julian Sikorski <belegdol@gmail.com>:
>>>>>
>>>>> Don't have any realtek codec, not sure why hda-jack-sense-test.py
>>>>> locked up when you use user_pin_configs
>>>>>
>>>>>>>> I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
>>>>>>>> attached). After reboot:
>>>>>>>> * hda-jack-sense-test.py was still working, without lockups this time
>>>>>>>> * alsamixer -c0 revealed a new "Front" slider, which was controlling the
>>>>>>>> volume on 0x17
>>>>>>>> * there was still no 8-channel mode (probably related to what you wrote
>>>>>>>> below)
>>>>>>>> * there were more options for auto mute (Disabled, Speaker Only, Line
>>>>>>>> Out+Speaker)
>>>>>>>> * here is the new alsa-info.sh:
>>>>>>>> http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>>
>>>>>>>>> To add the missing pin default of side jack 0x17
>>>>>>>>>
>>>>>>>>>       ALC662_FIXUP_ASUS_MODE8,
>>>>>>>>> +     ALC892_FIXUP_CLEVO_4ST_8CH,
>>>>>>>>> };
>>>>>>>>>
>>>>>>>>> static const struct alc_fixup alc662_fixups[] = {
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> +     [ALC892_FIXUP_CLEVO_4ST_8CH] = {
>>>>>>>>> +             .type = ALC_FIXUP_PINS,
>>>>>>>>> +             .v.pins = (const struct alc_pincfg[]) {
>>>>>>>>> +/*
>>>>>>>>> +  need to be same location as the other jack
>>>>>>>>> +  may need to change the default association and sequence since
>>>>>>>>> +  Lower Default Association values would be higher in priority for resources
>>>>>>>>> +  such as processing nodes or Input and Output Converters.
>>>>>>>>> +  A value of 0000b is reserved and should not be used
>>>>>>>>> +*/
>>>>>>>>> +                     { 0x17, 0x01011013 }, /* Side */
>>>>>>>>> +                     { }
>>>>>>>>> +             },
>>>>>>>>> +     },
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>>>>
>>>>>>>>> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
>>>>>>>>> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
>>>>>>>>> out(grey) at same location (ext rear)   for surround71 (and also 1
>>>>>>>>> speakers, 1 int mic)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> hda_codec: ALC1200: BIOS auto-probing.
>>>>>>>>> hda_codec: ALC1200: SKU not ready 0x598301f0
>>>>>>>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>>>>>>>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>>>>>>>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>>>>>>>>>    mono: mono_out=0x0
>>>>>>>>>    dig-out=0x1e/0x0
>>>>>>>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> CTRL: add: Line-Out Jack:0
>>>>>>>>> CTRL: add: Headphone Jack:0
>>>>>>>>> CTRL: add: Mic Jack:0
>>>>>>>>> CTRL: add: Line Jack:0
>>>>>>>>>
>>>>>>>>>> get 1
>>>>>>>>> 1 Channel Mode:0
>>>>>>>>> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
>>>>>>>>>
>>>>>
>>>>> After the pin fixup, your notebook is almost like alc1200 msi gx460
>>>>> except speaker and hp are swapped, this mean that those volume
>>>>> controls and switches are similar to targa_mixer , targa_8ch_mixer of
>>>>> model="targa-8ch-dig"
>>>>>
>>>>>>>>>
>>>>>>>>> This mean that when switch to 6/8 channel mode, it will conflict with
>>>>>>>>> automic detection since the pin cap alc892 's mic jack does not
>>>>>>>>> support impedance sense and the driver does not know the plug is mic
>>>>>>>>> or speaker by measuring the impedance
>>>>>>>>>
>>>>>>>>> The driver have to disable automic detection when user switch "channel
>>>>>>>>> mode" to 6ch/8ch as the user should still able to use the internal mic
>>>>>>>>> when the external mic jack is retasked as output
>>>>>>>>>
>>>>>
>>>>> The are some difference between p170hm and your p150hm if p170hm has
>>>>> 5.1 speakers which still can have auto mic detection enabled.
>>>>>
>>>>>
>>>>> you can add the following code in alc_auto_ch_mode_put() for debugging
>>>>> and need to switch "auto mute mode" to "speaker" for 8 channels
>>>>>
>>>>>
>>>>>       if (spec->need_dac_fix && !spec->const_channel_count)
>>>>>               spec->multiout.num_dacs = spec->multiout.max_channels / 2;
>>>>>
>>>>> +     printk(KERN_INFO "ch = %d\n",ch);
>>>>> +     printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
>>>>> +     for (i=0; i<spec->autocfg.hp_outs; i++)
>>>>> +             printk(KERN_INFO "hp dac(%d) %x pin %x\n", i,
>>>>> spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
>>>>> +     for (i=0; i<spec->multiout.num_dacs; i++)
>>>>> +             printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
>>>>> +     for (i=0; i<spec->autocfg.line_outs; i++)
>>>>> +             printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
>>>>> +     for (i=0; i<spec->multiout.num_dacs-1; i++)
>>>>> +             printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i,
>>>>> spec->multi_io[i].dac, spec->multi_io[i].pin);
>>>>> +     for (i=0; i<spec->autocfg.speaker_outs; i++)
>>>>> +             printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i,
>>>>> spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
>>>>>                return 1
>>>>
>>>> This is what appears in /var/log/messages if you go from 8 to 2 channels
>>>> and back:
>>>>
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853640] ch = 2
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853642] max channel 6
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853643] hp dac(0) 0 pin 1b
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853644] private_dac(0) 2
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853645] private_dac(1) 3
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853646] private_dac(2) 4
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853647] private_dac(3) 5
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853648] line_out(0) pin 17
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853649] multi_io(0) dac 3 pin 1a
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853650] multi_io(1) dac 4 pin 18
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853651] multi_io(2) dac 5 pin 17
>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853652] extra_out(0) dac 0 pin 14
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952829] ch = 1
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952835] max channel 4
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952840] hp dac(0) 0 pin 1b
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952843] private_dac(0) 2
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952846] private_dac(1) 3
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952849] private_dac(2) 4
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952852] private_dac(3) 5
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952855] line_out(0) pin 17
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952859] multi_io(0) dac 3 pin 1a
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952863] multi_io(1) dac 4 pin 18
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952866] multi_io(2) dac 5 pin 17
>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952870] extra_out(0) dac 0 pin 14
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378952] ch = 0
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378958] max channel 2
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378963] hp dac(0) 0 pin 1b
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378966] private_dac(0) 2
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378969] private_dac(1) 3
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378972] private_dac(2) 4
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378975] private_dac(3) 5
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378978] line_out(0) pin 17
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378982] multi_io(0) dac 3 pin 1a
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379002] multi_io(1) dac 4 pin 18
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379006] multi_io(2) dac 5 pin 17
>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379010] extra_out(0) dac 0 pin 14
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746269] ch = 1
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746275] max channel 4
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746279] hp dac(0) 0 pin 1b
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746283] private_dac(0) 2
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746286] private_dac(1) 3
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746289] private_dac(2) 4
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746291] private_dac(3) 5
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746295] line_out(0) pin 17
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746298] multi_io(0) dac 3 pin 1a
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746302] multi_io(1) dac 4 pin 18
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746306] multi_io(2) dac 5 pin 17
>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746310] extra_out(0) dac 0 pin 14
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174127] ch = 2
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174133] max channel 6
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174195] hp dac(0) 0 pin 1b
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174199] private_dac(0) 2
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174202] private_dac(1) 3
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174205] private_dac(2) 4
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174208] private_dac(3) 5
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174211] line_out(0) pin 17
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174215] multi_io(0) dac 3 pin 1a
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174219] multi_io(1) dac 4 pin 18
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174223] multi_io(2) dac 5 pin 17
>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174226] extra_out(0) dac 0 pin 14
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111893] ch = 3
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111900] max channel 8
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111904] hp dac(0) 0 pin 1b
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111908] private_dac(0) 2
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111911] private_dac(1) 3
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111914] private_dac(2) 4
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111917] private_dac(3) 5
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111920] line_out(0) pin 17
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111924] multi_io(0) dac 3 pin 1a
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111927] multi_io(1) dac 4 pin 18
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111931] multi_io(2) dac 5 pin 17
>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111935] extra_out(0) dac 0 pin 14
>>>>
>>>>>
>>>>> Try the following code  which try to assign dac 02, 03, 04, and 05 to
>>>>> spec->private_dac front, surround, clfe and side.
>>>>>
>>>>> static int alc_auto_fill_dac_nids(struct hda_codec *codec)
>>>>> {
>>>>> ...
>>>>>  again:
>>>>>       /* set num_dacs once to full for alc_auto_look_for_dac() */
>>>>>       spec->multiout.num_dacs = cfg->line_outs;
>>>>>       spec->multiout.hp_out_nid[0] = 0;
>>>>>       spec->multiout.extra_out_nid[0] = 0;
>>>>>       memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
>>>>>       spec->multiout.dac_nids = spec->private_dac_nids;
>>>>>
>>>>> +     if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
>>>>> +             cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
>>>>> +/* assign 0x02 as Front DAC by using speaker or hp pins*/
>>>>> +             spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec,
>>>>> cfg->speaker_pins[0]);
>>>>> +/* hp , mic and line-in at the same location
>>>>> +   use alc_auto_fill_multi_ios() to assign surround and clfe dacs
>>>>> +*/
>>>>> +             defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
>>>>> +             location = get_defcfg_location(defcfg);
>>>>> +             spec->multiout.num_dacs = 1;
>>>>> +             num_pins = alc_auto_fill_multi_ios(codec, location, 1);
>>>>> +             if (num_pins > 0) {
>>>>> +                     spec->multi_ios = num_pins;
>>>>> +                     spec->ext_channel_count = 2;
>>>>> +                     spec->multiout.num_dacs = num_pins + 1;
>>>>> +             }
>>>>> +/* an ugly hack to add side as multi io even side does not support input
>>>>> +   set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT */
>>>>> +             if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec,
>>>>> cfg->line_out_pins[0]))) {
>>>>> +                     spec->private_dac_nids[3] = alc_auto_look_for_dac(codec,
>>>>> cfg->line_out_pins[0]);
>>>>> +                     spec->multi_io[2].dac = spec->private_dac_nids[3];
>>>>> +                     spec->multi_io[2].pin = cfg->line_out_pins[0];
>>>>> +                     snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
>>>>>                               AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
>>>>> +                     spec->multi_ios++;
>>>>> +                     spec->multiout.num_dacs++;
>>>>> +             }
>>>>> +             return 0;
>>>>> +     }
>>>>
>>>> It is much better now. I applied the attached patch and 2, 4, 6 and 8
>>>> channel sound is working, enabling outputs incrementally as I change the
>>>> number of channels in alsamixer. Observations:
>>>
>>>
>>>> * there is no mute for side channel
>>>
>>>> * no matter if Auto-Mute is set to Speaker or Line Out+Speaker, speakers
>>>> will mute upon plugging a jack into either headphone or side/spdif socket
>>>> * there is a "front" slider which controls internal speakers and HP
>>>> jack, but the mute control under it does nothing. There are separate
>>>> mute controls for HP and Speakers, which work as advertised.
>>>> This is the alsa-info.sh output:
>>>> http://www.alsa-project.org/db/?f=7df8ccac0a5ae751110f7b7e56f9e0ba5cc3b302
>>>> Looks like we are almost there, thanks for all the input so far!
>>>
>>>
>>> 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
>> 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
>>
>>>
>>>>>>>>>>> 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:
> 
> There was a patch which add "Independent hp" swtich and create device
> 2 for alc892 desktop with 6 jacks at rear panel
> 
> http://thread.gmane.org/gmane.linux.alsa.devel/84653/focus=84695
> 
> APLAY
> 
> **** List of PLAYBACK Hardware Devices ****
> card 0: Intel [HDA Intel], device 0: ALC892 Analog [ALC892 Analog]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> card 0: Intel [HDA Intel], device 2: ALC892 Analog [ALC892 Analog]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> card 0: Intel [HDA Intel], device 3: ALC892 Digital [ALC892 Digital]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> 
> you can change "independent_hp" to "alt playback" in that patch
> 
> 	hda_nid_t alt_dac_nid;
> +	int alt_playback;
> +	int alt_playback_max;
> 
> 
> static int alc_alt_playback_info(struct snd_kcontrol *kcontrol,
> 				   struct snd_ctl_elem_info *uinfo)
> {
> 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
> 	struct alc_spec *spec = codec->spec;
> 	static const char * const texts[] = { "OFF", "Headphone", "Side", NULL};
> 	int index;
> 	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
> 	uinfo->count = 1;
> 	uinfo->value.enumerated.items = spec->alt_playback_max;
> 	index = uinfo->value.enumerated.item;
> 	if (index >= spec->alt_playback_max)
> 		index = 1;
> 	strcpy(uinfo->value.enumerated.name, texts[index]);
> 	return 0;
> }
> 
> static int alc_alt_playback_get(struct snd_kcontrol *kcontrol,
> 				  struct snd_ctl_elem_value *ucontrol)
> {
> 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
> 	struct alc_spec *spec = codec->spec;
> 	ucontrol->value.enumerated.item[0] = spec->alt_playback;
> 	return 0;
> }
> 
> static int alc_alt_playback_put(struct snd_kcontrol *kcontrol,
> 				  struct snd_ctl_elem_value *ucontrol)
> {
> 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
> 	struct alc_spec *spec = codec->spec;
> 	unsigned int select = ucontrol->value.enumerated.item[0];
> 	if (spec->alt_playback != select) {
> 	        spec->alt_playback = select;
> 		switch(spec->alt_playback) {
> 			spec->multiout.hp_out_nid[0] = 0;
> 			break;
> 		case 1:
> 			spec->multiout.hp_out_nid[0] = spec->alt_dac_nid;
> 			break;
> 		case 2:
> 			break;
> 		}
> 		return 1;
> 	}
> 	return 0;
> }
> 
> static const struct snd_kcontrol_new alc_alt_playback_switch[] = {
> 	{
> 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
> 		.name = "Alternate Playback Switch",
> 		.info = alc_alt_playback_info,
> 		.get = alc_alt_playback_get,
> 		.put = alc_alt_playback_put,
> 	},
> 	{ } /* end */
> };
> 

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.

>>
>> $ 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
>>
>> 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.
>> 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.

> 
>> Once again, thank you for all the input so far.
>>
>> Best regards,
>> Julian
>>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-11-29 10:25                                   ` Julian Sikorski
@ 2011-12-01 16:35                                     ` Julian Sikorski
  2011-12-02  0:52                                       ` Raymond Yau
  0 siblings, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-12-01 16:35 UTC (permalink / raw)
  To: alsa-devel

W dniu 29.11.2011 11:25, Julian Sikorski pisze:
> W dniu 29.11.2011 00:45, Raymond Yau pisze:
>> 2011/11/28 Julian Sikorski <belegdol@gmail.com>:
>>> W dniu 28.11.2011 01:42, Raymond Yau pisze:
>>>> 2011/11/25 Julian Sikorski <belegdol@gmail.com>:
>>>>> W dniu 25.11.2011 07:39, Raymond Yau pisze:
>>>>>> 2011/11/22 Julian Sikorski <belegdol@gmail.com>:
>>>>>>
>>>>>> Don't have any realtek codec, not sure why hda-jack-sense-test.py
>>>>>> locked up when you use user_pin_configs
>>>>>>
>>>>>>>>> I then applied your patch on top of Fedora 3.1.1 kernel (crude patch
>>>>>>>>> attached). After reboot:
>>>>>>>>> * hda-jack-sense-test.py was still working, without lockups this time
>>>>>>>>> * alsamixer -c0 revealed a new "Front" slider, which was controlling the
>>>>>>>>> volume on 0x17
>>>>>>>>> * there was still no 8-channel mode (probably related to what you wrote
>>>>>>>>> below)
>>>>>>>>> * there were more options for auto mute (Disabled, Speaker Only, Line
>>>>>>>>> Out+Speaker)
>>>>>>>>> * here is the new alsa-info.sh:
>>>>>>>>> http://www.alsa-project.org/db/?f=923b75ad3997dc8f5878852e327f9b999a196052
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> To add the missing pin default of side jack 0x17
>>>>>>>>>>
>>>>>>>>>>       ALC662_FIXUP_ASUS_MODE8,
>>>>>>>>>> +     ALC892_FIXUP_CLEVO_4ST_8CH,
>>>>>>>>>> };
>>>>>>>>>>
>>>>>>>>>> static const struct alc_fixup alc662_fixups[] = {
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> +     [ALC892_FIXUP_CLEVO_4ST_8CH] = {
>>>>>>>>>> +             .type = ALC_FIXUP_PINS,
>>>>>>>>>> +             .v.pins = (const struct alc_pincfg[]) {
>>>>>>>>>> +/*
>>>>>>>>>> +  need to be same location as the other jack
>>>>>>>>>> +  may need to change the default association and sequence since
>>>>>>>>>> +  Lower Default Association values would be higher in priority for resources
>>>>>>>>>> +  such as processing nodes or Input and Output Converters.
>>>>>>>>>> +  A value of 0000b is reserved and should not be used
>>>>>>>>>> +*/
>>>>>>>>>> +                     { 0x17, 0x01011013 }, /* Side */
>>>>>>>>>> +                     { }
>>>>>>>>>> +             },
>>>>>>>>>> +     },
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x5102, "Clevo P150HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>>>>> +     SND_PCI_QUIRK(0x1558, 0x7100, "Clevo P170HM", ALC892_FIXUP_CLEVO_4ST_8CH),
>>>>>>>>>>
>>>>>>>>>> SImilar case are those notebooks  hda-emu/codecs/alc1200-msi-gx620
>>>>>>>>>> which has 1 hp(green), 1 line-in(blue), 1 ext-mic(pink) and 1 line
>>>>>>>>>> out(grey) at same location (ext rear)   for surround71 (and also 1
>>>>>>>>>> speakers, 1 int mic)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> hda_codec: ALC1200: BIOS auto-probing.
>>>>>>>>>> hda_codec: ALC1200: SKU not ready 0x598301f0
>>>>>>>>>> autoconfig: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
>>>>>>>>>>    speaker_outs=1 (0x1b/0x0/0x0/0x0/0x0)
>>>>>>>>>>    hp_outs=1 (0x14/0x0/0x0/0x0/0x0)
>>>>>>>>>>    mono: mono_out=0x0
>>>>>>>>>>    dig-out=0x1e/0x0
>>>>>>>>>>    inputs: Mic=0x18 Internal Mic=0x19 Line=0x1a
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> CTRL: add: Line-Out Jack:0
>>>>>>>>>> CTRL: add: Headphone Jack:0
>>>>>>>>>> CTRL: add: Mic Jack:0
>>>>>>>>>> CTRL: add: Line Jack:0
>>>>>>>>>>
>>>>>>>>>>> get 1
>>>>>>>>>> 1 Channel Mode:0
>>>>>>>>>> ITEM: 0:2ch, 1:4ch, 2:6ch, VAL: [2ch]
>>>>>>>>>>
>>>>>>
>>>>>> After the pin fixup, your notebook is almost like alc1200 msi gx460
>>>>>> except speaker and hp are swapped, this mean that those volume
>>>>>> controls and switches are similar to targa_mixer , targa_8ch_mixer of
>>>>>> model="targa-8ch-dig"
>>>>>>
>>>>>>>>>>
>>>>>>>>>> This mean that when switch to 6/8 channel mode, it will conflict with
>>>>>>>>>> automic detection since the pin cap alc892 's mic jack does not
>>>>>>>>>> support impedance sense and the driver does not know the plug is mic
>>>>>>>>>> or speaker by measuring the impedance
>>>>>>>>>>
>>>>>>>>>> The driver have to disable automic detection when user switch "channel
>>>>>>>>>> mode" to 6ch/8ch as the user should still able to use the internal mic
>>>>>>>>>> when the external mic jack is retasked as output
>>>>>>>>>>
>>>>>>
>>>>>> The are some difference between p170hm and your p150hm if p170hm has
>>>>>> 5.1 speakers which still can have auto mic detection enabled.
>>>>>>
>>>>>>
>>>>>> you can add the following code in alc_auto_ch_mode_put() for debugging
>>>>>> and need to switch "auto mute mode" to "speaker" for 8 channels
>>>>>>
>>>>>>
>>>>>>       if (spec->need_dac_fix && !spec->const_channel_count)
>>>>>>               spec->multiout.num_dacs = spec->multiout.max_channels / 2;
>>>>>>
>>>>>> +     printk(KERN_INFO "ch = %d\n",ch);
>>>>>> +     printk(KERN_INFO "max channel %d\n",spec->multiout.max_channels);
>>>>>> +     for (i=0; i<spec->autocfg.hp_outs; i++)
>>>>>> +             printk(KERN_INFO "hp dac(%d) %x pin %x\n", i,
>>>>>> spec->multiout.hp_out_nid[i], spec->autocfg.hp_pins[i]);
>>>>>> +     for (i=0; i<spec->multiout.num_dacs; i++)
>>>>>> +             printk(KERN_INFO "private_dac(%d) %x\n", i, spec->private_dac_nids[i]);
>>>>>> +     for (i=0; i<spec->autocfg.line_outs; i++)
>>>>>> +             printk(KERN_INFO "line_out(%d) pin %x\n", i, spec->autocfg.line_out_pins[i]);
>>>>>> +     for (i=0; i<spec->multiout.num_dacs-1; i++)
>>>>>> +             printk(KERN_INFO "multi_io(%d) dac %x pin %x\n", i,
>>>>>> spec->multi_io[i].dac, spec->multi_io[i].pin);
>>>>>> +     for (i=0; i<spec->autocfg.speaker_outs; i++)
>>>>>> +             printk(KERN_INFO "extra_out(%d) dac %x pin %x\n", i,
>>>>>> spec->multiout.extra_out_nid[i], spec->autocfg.speaker_pins[i]);
>>>>>>                return 1
>>>>>
>>>>> This is what appears in /var/log/messages if you go from 8 to 2 channels
>>>>> and back:
>>>>>
>>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853640] ch = 2
>>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853642] max channel 6
>>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853643] hp dac(0) 0 pin 1b
>>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853644] private_dac(0) 2
>>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853645] private_dac(1) 3
>>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853646] private_dac(2) 4
>>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853647] private_dac(3) 5
>>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853648] line_out(0) pin 17
>>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853649] multi_io(0) dac 3 pin 1a
>>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853650] multi_io(1) dac 4 pin 18
>>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853651] multi_io(2) dac 5 pin 17
>>>>> Nov 25 13:05:11 snowball2 kernel: [ 1515.853652] extra_out(0) dac 0 pin 14
>>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952829] ch = 1
>>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952835] max channel 4
>>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952840] hp dac(0) 0 pin 1b
>>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952843] private_dac(0) 2
>>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952846] private_dac(1) 3
>>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952849] private_dac(2) 4
>>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952852] private_dac(3) 5
>>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952855] line_out(0) pin 17
>>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952859] multi_io(0) dac 3 pin 1a
>>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952863] multi_io(1) dac 4 pin 18
>>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952866] multi_io(2) dac 5 pin 17
>>>>> Nov 25 13:05:24 snowball2 kernel: [ 1528.952870] extra_out(0) dac 0 pin 14
>>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378952] ch = 0
>>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378958] max channel 2
>>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378963] hp dac(0) 0 pin 1b
>>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378966] private_dac(0) 2
>>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378969] private_dac(1) 3
>>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378972] private_dac(2) 4
>>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378975] private_dac(3) 5
>>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378978] line_out(0) pin 17
>>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.378982] multi_io(0) dac 3 pin 1a
>>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379002] multi_io(1) dac 4 pin 18
>>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379006] multi_io(2) dac 5 pin 17
>>>>> Nov 25 13:05:26 snowball2 kernel: [ 1531.379010] extra_out(0) dac 0 pin 14
>>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746269] ch = 1
>>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746275] max channel 4
>>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746279] hp dac(0) 0 pin 1b
>>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746283] private_dac(0) 2
>>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746286] private_dac(1) 3
>>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746289] private_dac(2) 4
>>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746291] private_dac(3) 5
>>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746295] line_out(0) pin 17
>>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746298] multi_io(0) dac 3 pin 1a
>>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746302] multi_io(1) dac 4 pin 18
>>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746306] multi_io(2) dac 5 pin 17
>>>>> Nov 25 13:06:29 snowball2 kernel: [ 1593.746310] extra_out(0) dac 0 pin 14
>>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174127] ch = 2
>>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174133] max channel 6
>>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174195] hp dac(0) 0 pin 1b
>>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174199] private_dac(0) 2
>>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174202] private_dac(1) 3
>>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174205] private_dac(2) 4
>>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174208] private_dac(3) 5
>>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174211] line_out(0) pin 17
>>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174215] multi_io(0) dac 3 pin 1a
>>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174219] multi_io(1) dac 4 pin 18
>>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174223] multi_io(2) dac 5 pin 17
>>>>> Nov 25 13:06:31 snowball2 kernel: [ 1596.174226] extra_out(0) dac 0 pin 14
>>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111893] ch = 3
>>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111900] max channel 8
>>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111904] hp dac(0) 0 pin 1b
>>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111908] private_dac(0) 2
>>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111911] private_dac(1) 3
>>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111914] private_dac(2) 4
>>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111917] private_dac(3) 5
>>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111920] line_out(0) pin 17
>>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111924] multi_io(0) dac 3 pin 1a
>>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111927] multi_io(1) dac 4 pin 18
>>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111931] multi_io(2) dac 5 pin 17
>>>>> Nov 25 13:06:33 snowball2 kernel: [ 1598.111935] extra_out(0) dac 0 pin 14
>>>>>
>>>>>>
>>>>>> Try the following code  which try to assign dac 02, 03, 04, and 05 to
>>>>>> spec->private_dac front, surround, clfe and side.
>>>>>>
>>>>>> static int alc_auto_fill_dac_nids(struct hda_codec *codec)
>>>>>> {
>>>>>> ...
>>>>>>  again:
>>>>>>       /* set num_dacs once to full for alc_auto_look_for_dac() */
>>>>>>       spec->multiout.num_dacs = cfg->line_outs;
>>>>>>       spec->multiout.hp_out_nid[0] = 0;
>>>>>>       spec->multiout.extra_out_nid[0] = 0;
>>>>>>       memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
>>>>>>       spec->multiout.dac_nids = spec->private_dac_nids;
>>>>>>
>>>>>> +     if (cfg->hp_outs == 1 && cfg->line_outs == 1 &&
>>>>>> +             cfg->num_inputs >= 3 && cfg->speaker_outs >= 1) {
>>>>>> +/* assign 0x02 as Front DAC by using speaker or hp pins*/
>>>>>> +             spec->private_dac_nids[0]  = alc_auto_look_for_dac(codec,
>>>>>> cfg->speaker_pins[0]);
>>>>>> +/* hp , mic and line-in at the same location
>>>>>> +   use alc_auto_fill_multi_ios() to assign surround and clfe dacs
>>>>>> +*/
>>>>>> +             defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
>>>>>> +             location = get_defcfg_location(defcfg);
>>>>>> +             spec->multiout.num_dacs = 1;
>>>>>> +             num_pins = alc_auto_fill_multi_ios(codec, location, 1);
>>>>>> +             if (num_pins > 0) {
>>>>>> +                     spec->multi_ios = num_pins;
>>>>>> +                     spec->ext_channel_count = 2;
>>>>>> +                     spec->multiout.num_dacs = num_pins + 1;
>>>>>> +             }
>>>>>> +/* an ugly hack to add side as multi io even side does not support input
>>>>>> +   set pin ctl to PIN_OUT to set multi_io[2].ctl_in to PIN_OUT */
>>>>>> +             if (location == get_defcfg_location(snd_hda_codec_get_pincfg(codec,
>>>>>> cfg->line_out_pins[0]))) {
>>>>>> +                     spec->private_dac_nids[3] = alc_auto_look_for_dac(codec,
>>>>>> cfg->line_out_pins[0]);
>>>>>> +                     spec->multi_io[2].dac = spec->private_dac_nids[3];
>>>>>> +                     spec->multi_io[2].pin = cfg->line_out_pins[0];
>>>>>> +                     snd_hda_codec_write(codec, cfg->line_out_pins[0], 0,
>>>>>>                               AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
>>>>>> +                     spec->multi_ios++;
>>>>>> +                     spec->multiout.num_dacs++;
>>>>>> +             }
>>>>>> +             return 0;
>>>>>> +     }
>>>>>
>>>>> It is much better now. I applied the attached patch and 2, 4, 6 and 8
>>>>> channel sound is working, enabling outputs incrementally as I change the
>>>>> number of channels in alsamixer. Observations:
>>>>
>>>>
>>>>> * there is no mute for side channel
>>>>
>>>>> * no matter if Auto-Mute is set to Speaker or Line Out+Speaker, speakers
>>>>> will mute upon plugging a jack into either headphone or side/spdif socket
>>>>> * there is a "front" slider which controls internal speakers and HP
>>>>> jack, but the mute control under it does nothing. There are separate
>>>>> mute controls for HP and Speakers, which work as advertised.
>>>>> This is the alsa-info.sh output:
>>>>> http://www.alsa-project.org/db/?f=7df8ccac0a5ae751110f7b7e56f9e0ba5cc3b302
>>>>> Looks like we are almost there, thanks for all the input so far!
>>>>
>>>>
>>>> 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
>>> 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
>>>
>>>>
>>>>>>>>>>>> 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:
>>
>> There was a patch which add "Independent hp" swtich and create device
>> 2 for alc892 desktop with 6 jacks at rear panel
>>
>> http://thread.gmane.org/gmane.linux.alsa.devel/84653/focus=84695
>>
>> APLAY
>>
>> **** List of PLAYBACK Hardware Devices ****
>> card 0: Intel [HDA Intel], device 0: ALC892 Analog [ALC892 Analog]
>>   Subdevices: 1/1
>>   Subdevice #0: subdevice #0
>> card 0: Intel [HDA Intel], device 2: ALC892 Analog [ALC892 Analog]
>>   Subdevices: 1/1
>>   Subdevice #0: subdevice #0
>> card 0: Intel [HDA Intel], device 3: ALC892 Digital [ALC892 Digital]
>>   Subdevices: 1/1
>>   Subdevice #0: subdevice #0
>>
>> you can change "independent_hp" to "alt playback" in that patch
>>
>> 	hda_nid_t alt_dac_nid;
>> +	int alt_playback;
>> +	int alt_playback_max;
>>
>>
>> static int alc_alt_playback_info(struct snd_kcontrol *kcontrol,
>> 				   struct snd_ctl_elem_info *uinfo)
>> {
>> 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
>> 	struct alc_spec *spec = codec->spec;
>> 	static const char * const texts[] = { "OFF", "Headphone", "Side", NULL};
>> 	int index;
>> 	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
>> 	uinfo->count = 1;
>> 	uinfo->value.enumerated.items = spec->alt_playback_max;
>> 	index = uinfo->value.enumerated.item;
>> 	if (index >= spec->alt_playback_max)
>> 		index = 1;
>> 	strcpy(uinfo->value.enumerated.name, texts[index]);
>> 	return 0;
>> }
>>
>> static int alc_alt_playback_get(struct snd_kcontrol *kcontrol,
>> 				  struct snd_ctl_elem_value *ucontrol)
>> {
>> 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
>> 	struct alc_spec *spec = codec->spec;
>> 	ucontrol->value.enumerated.item[0] = spec->alt_playback;
>> 	return 0;
>> }
>>
>> static int alc_alt_playback_put(struct snd_kcontrol *kcontrol,
>> 				  struct snd_ctl_elem_value *ucontrol)
>> {
>> 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
>> 	struct alc_spec *spec = codec->spec;
>> 	unsigned int select = ucontrol->value.enumerated.item[0];
>> 	if (spec->alt_playback != select) {
>> 	        spec->alt_playback = select;
>> 		switch(spec->alt_playback) {
>> 			spec->multiout.hp_out_nid[0] = 0;
>> 			break;
>> 		case 1:
>> 			spec->multiout.hp_out_nid[0] = spec->alt_dac_nid;
>> 			break;
>> 		case 2:
>> 			break;
>> 		}
>> 		return 1;
>> 	}
>> 	return 0;
>> }
>>
>> static const struct snd_kcontrol_new alc_alt_playback_switch[] = {
>> 	{
>> 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
>> 		.name = "Alternate Playback Switch",
>> 		.info = alc_alt_playback_info,
>> 		.get = alc_alt_playback_get,
>> 		.put = alc_alt_playback_put,
>> 	},
>> 	{ } /* end */
>> };
>>
> 
> 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.
> 
>>>
>>> $ 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
>>>
>>> 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.
>>> 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?

> 
>>
>>> Once again, thank you for all the input so far.
>>>
>>> Best regards,
>>> Julian
>>>
> 
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-12-01 16:35                                     ` Julian Sikorski
@ 2011-12-02  0:52                                       ` Raymond Yau
  2011-12-02 15:41                                         ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Raymond Yau @ 2011-12-02  0:52 UTC (permalink / raw)
  To: ALSA Development Mailing List

2011/12/2 Julian Sikorski <belegdol@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


>>>> 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.

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


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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-12-02  0:52                                       ` Raymond Yau
@ 2011-12-02 15:41                                         ` Julian Sikorski
  2011-12-03 23:59                                           ` Raymond Yau
  0 siblings, 1 reply; 30+ messages in thread
From: Julian Sikorski @ 2011-12-02 15:41 UTC (permalink / raw)
  To: alsa-devel

W dniu 02.12.2011 01:52, Raymond Yau pisze:
> 2011/12/2 Julian Sikorski <belegdol@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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-12-02 15:41                                         ` Julian Sikorski
@ 2011-12-03 23:59                                           ` Raymond Yau
  2011-12-04 12:41                                             ` Julian Sikorski
  0 siblings, 1 reply; 30+ messages in thread
From: Raymond Yau @ 2011-12-03 23:59 UTC (permalink / raw)
  To: ALSA Development Mailing List

2011/12/2 Julian Sikorski <belegdol@gmail.com>:
> W dniu 02.12.2011 01:52, Raymond Yau pisze:
>>>>>>
>>>>>> $ 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.
>

http://thread.gmane.org/gmane.linux.alsa.devel/92097

>>
>>
>> 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
>>

configure --with-debug=verbose

In theory, , the driver can automatically mute IEC958 Playback Switch
(turn off the red light for power saving) when you plug/unplug the
side jack which share with spdif

>> 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
>

speaker test or pulseaudio expect the "front volume" control the front
jack (i.e. your HP jack) in surround 40 , 51 or 71


>>
>>
>> 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
>

change one of the unused pin to  speaker pin by hda-jack-retask

http://thread.gmane.org/gmane.linux.alsa.devel/92229

assign hp to get dac 0x02 instead of speaker_pins[0]

you have to assign your 0x14 speaker and one of the unused pin of  to
spec->extra_out
and increase spec->speaker_outs from 1 to 2


8fa7ab48acb636d24669dab291807b487dfb2804

ALSA: hda - Fix surround/CLFE headphone and speaker pins order

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Clevo P170HM / Sager NP8170 audio
  2011-12-03 23:59                                           ` Raymond Yau
@ 2011-12-04 12:41                                             ` Julian Sikorski
  0 siblings, 0 replies; 30+ messages in thread
From: Julian Sikorski @ 2011-12-04 12:41 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 7545 bytes --]

W dniu 04.12.2011 00:59, Raymond Yau pisze:
> 2011/12/2 Julian Sikorski <belegdol@gmail.com>:
>> W dniu 02.12.2011 01:52, Raymond Yau pisze:
>>>>>>>
>>>>>>> $ 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.
>>
> 
> http://thread.gmane.org/gmane.linux.alsa.devel/92097

It seems like this patch requires hda-jack branch. Is there anything
particular I should keep in mind?

> 
>>>
>>>
>>> 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
>>>
> 
> configure --with-debug=verbose
> 
> In theory, , the driver can automatically mute IEC958 Playback Switch
> (turn off the red light for power saving) when you plug/unplug the
> side jack which share with spdif

There is no alsa-driver package in Fedora. As such, I have checked
configure.ac to see what config options are getting changed. It turns
out that CONFIG_SND_DEBUG, CONFIG_SND_DEBUG_VERBOSE and
CONFIG_SND_DEBUG_MEM are changed to y. Since I could not find
CONFIG_SND_DEBUG_MEM anywhere in 3.2 kernel, I only changed the other two:

[   10.631612] ALSA sound/pci/hda/patch_realtek.c:1504 hda_codec:
ALC892: Apply pincfg for Clevo P150HM
[   10.631631] ALSA sound/pci/hda/hda_codec.c:4957 autoconfig:
line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
[   10.631638] ALSA sound/pci/hda/hda_codec.c:4961    speaker_outs=1
(0x14/0x0/0x0/0x0/0x0)
[   10.631644] ALSA sound/pci/hda/hda_codec.c:4965    hp_outs=1
(0x1b/0x0/0x0/0x0/0x0)
[   10.631648] ALSA sound/pci/hda/hda_codec.c:4966    mono: mono_out=0x0
[   10.631652] ALSA sound/pci/hda/hda_codec.c:4969    dig-out=0x1e/0x0
[   10.631656] ALSA sound/pci/hda/hda_codec.c:4970    inputs:
[   10.631662] ALSA sound/pci/hda/hda_codec.c:4974  Mic=0x18
[   10.631667] ALSA sound/pci/hda/hda_codec.c:4974  Internal Mic=0x19
[   10.631671] ALSA sound/pci/hda/hda_codec.c:4974  Line=0x1a
[   10.631675] ALSA sound/pci/hda/hda_codec.c:4976
[   10.632857] Front playback volume 2 pin 14
[   10.632859] Front playback switch 14
[   10.632942] Surround playback volume 3 pin 1a
[   10.632944] Surround playback switch 1a
[   10.633111] Side playback volume 5 pin 17
[   10.633112] Side playback switch 17
[   10.633983] ALSA sound/pci/hda/patch_realtek.c:1342 realtek: No valid
SSID, checking pincfg 0x598301f0 for NID 0x1d
[   10.633985] ALSA sound/pci/hda/patch_realtek.c:1425 realtek: Enable
default setup for auto mode as fallback
[   10.634027] ALSA sound/pci/hda/patch_realtek.c:971 realtek: Enable HP
auto-muting on NID 0x1b
[   10.634081] ALSA sound/pci/hda/patch_realtek.c:985 realtek: Enable
Line-Out auto-muting on NID 0x17

Still, it is either all or nothing setting despite what alsamixer says.

> 
>>> 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
>>
> 
> speaker test or pulseaudio expect the "front volume" control the front
> jack (i.e. your HP jack) in surround 40 , 51 or 71
> 
> 

I see.

>>>
>>>
>>> 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
>>
> 
> change one of the unused pin to  speaker pin by hda-jack-retask
> 
> http://thread.gmane.org/gmane.linux.alsa.devel/92229

This program does not work on Fedora due to lack of gksu, so I think I
am limited to plain hda-analyer.

> 
> assign hp to get dac 0x02 instead of speaker_pins[0]
> 
> you have to assign your 0x14 speaker and one of the unused pin of  to
> spec->extra_out
> and increase spec->speaker_outs from 1 to 2
> 
> 
> 8fa7ab48acb636d24669dab291807b487dfb2804
> 
> ALSA: hda - Fix surround/CLFE headphone and speaker pins order

This requires code changes, right? I am afraid this is beyond my
skillset, I am a biologist, after all.

Julian

[-- Attachment #2: dmesg.txt.xz --]
[-- Type: application/x-xz, Size: 12236 bytes --]

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2011-12-04 12:41 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-20  7:33 Clevo P170HM / Sager NP8170 audio Andrew Mahone
2011-11-08  5:42 ` Julian Sikorski
2011-11-16 13:08   ` Raymond Yau
2011-11-16 15:15     ` Julian Sikorski
2011-11-17  2:08       ` Raymond Yau
2011-11-17  8:46         ` Julian Sikorski
2011-11-17  8:55           ` Julian Sikorski
2011-11-19  2:31             ` Raymond Yau
2011-11-19  9:11               ` Julian Sikorski
2011-11-21  6:47                 ` Raymond Yau
2011-11-21 11:39                   ` Julian Sikorski
2011-11-22  5:17                     ` Raymond Yau
2011-11-22 12:45                       ` Julian Sikorski
2011-11-25  6:39                         ` Raymond Yau
2011-11-25 12:10                           ` Julian Sikorski
2011-11-28  0:42                             ` Raymond Yau
2011-11-28 10:27                               ` Julian Sikorski
2011-11-28 11:46                                 ` Raymond Yau
2011-11-28 12:02                                   ` Julian Sikorski
2011-11-28 12:34                               ` Julian Sikorski
2011-11-28 23:45                                 ` Raymond Yau
2011-11-29 10:25                                   ` Julian Sikorski
2011-12-01 16:35                                     ` Julian Sikorski
2011-12-02  0:52                                       ` Raymond Yau
2011-12-02 15:41                                         ` Julian Sikorski
2011-12-03 23:59                                           ` Raymond Yau
2011-12-04 12:41                                             ` Julian Sikorski
2011-11-24  9:20 ` Julian Sikorski
2011-11-24 10:03   ` Julian Sikorski
2011-11-24 10:30     ` Julian Sikorski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.