diff mbox

[RFC,1/2] ALSA: hda - Fix "PCM" name being used on one DAC when there are two DACs

Message ID 1413466426-2672-1-git-send-email-david.henningsson@canonical.com (mailing list archive)
State Accepted
Delegated to: Takashi Iwai
Headers show

Commit Message

David Henningsson Oct. 16, 2014, 1:33 p.m. UTC
In the scenario where there is one "Line Out", one "Speaker" and one
"Headphone", and there are only two DACs, two outputs will share a DAC.
Currently any mixer on such a DAC will get the "PCM" name, which is
misleading. Instead use "Headphone+LO" or "Speaker+LO" to better
specify what the volume actually controls.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 sound/pci/hda/hda_generic.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Takashi Iwai Oct. 16, 2014, 2:54 p.m. UTC | #1
At Thu, 16 Oct 2014 15:33:45 +0200,
David Henningsson wrote:
> 
> In the scenario where there is one "Line Out", one "Speaker" and one
> "Headphone", and there are only two DACs, two outputs will share a DAC.
> Currently any mixer on such a DAC will get the "PCM" name, which is
> misleading. Instead use "Headphone+LO" or "Speaker+LO" to better
> specify what the volume actually controls.
> 
> Signed-off-by: David Henningsson <david.henningsson@canonical.com>

The changes look good.  If this passes the tests and is confirmed to
work with the real machine, let's merge them.  As this is rather a
fix, we can merge them to 3.18, too, IMO.


thanks,

Takashi

> ---
>  sound/pci/hda/hda_generic.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
> index 64220c0..1d742ea 100644
> --- a/sound/pci/hda/hda_generic.c
> +++ b/sound/pci/hda/hda_generic.c
> @@ -1038,6 +1038,19 @@ static const char *get_line_out_pfx(struct hda_codec *codec, int ch,
>  			break;
>  		*index = ch;
>  		return "Headphone";
> +	case AUTO_PIN_LINE_OUT:
> +		/* This deals with the case where we have two DACs and 
> +		 * one LO, one HP and one Speaker */
> +		if (!ch && cfg->speaker_outs && cfg->hp_outs) {
> +			bool hp_lo_shared = !path_has_mixer(codec, spec->hp_paths[0], ctl_type);
> +			bool spk_lo_shared = !path_has_mixer(codec, spec->speaker_paths[0], ctl_type);
> +			if (hp_lo_shared && spk_lo_shared) 
> +				return spec->vmaster_mute.hook ? "PCM" : "Master";
> +			if (hp_lo_shared)
> +				return "Headphone+LO";
> +			if (spk_lo_shared)
> +				return "Speaker+LO";
> +		}
>  	}
>  
>  	/* for a single channel output, we don't have to name the channel */
> -- 
> 1.9.1
>
Raymond Yau Oct. 16, 2014, 3:02 p.m. UTC | #2
>
> In the scenario where there is one "Line Out", one "Speaker" and one
> "Headphone", and there are only two DACs, two outputs will share a DAC.
> Currently any mixer on such a DAC will get the "PCM" name, which is
> misleading. Instead use "Headphone+LO" or "Speaker+LO" to better
> specify what the volume actually controls.

Are there any examples ?

seem there are two cases

1) business desktop with internal speaker
2) notebook with dock line out

https://launchpadlibrarian.net/186782123/AlsaInfo.txt

>
David Henningsson Oct. 16, 2014, 3:10 p.m. UTC | #3
On 2014-10-16 17:02, Raymond Yau wrote:
>
>
> >
> > In the scenario where there is one "Line Out", one "Speaker" and one
> > "Headphone", and there are only two DACs, two outputs will share a DAC.
> > Currently any mixer on such a DAC will get the "PCM" name, which is
> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to better
> > specify what the volume actually controls.
>
> Are there any examples ?
>

I used "hda-emu 
codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i 1" 
when developing the patches.

I don't have any hardware available myself that exposes this behavior, 
but I can maybe fake one with hdajackretask, if that counts...

// David
Raymond Yau Oct. 18, 2014, 12:33 p.m. UTC | #4
>> >
>> > In the scenario where there is one "Line Out", one "Speaker" and one
>> > "Headphone", and there are only two DACs, two outputs will share a DAC.
>> > Currently any mixer on such a DAC will get the "PCM" name, which is
>> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to better
>> > specify what the volume actually controls.
>>
>> Are there any examples ?
>>
>
> I used "hda-emu
codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i 1" when
developing the patches.
>
> I don't have any hardware available myself that exposes this behavior,
but I can maybe fake one with hdajackretask, if that counts...
>

How about adding these names to slaves of virtual master volume/switch ?

hdajackretask won't help if the topology of the codecs are  different

Seem the badness still prevent the driver to support surround 5.1 with
three rear panel jacks, internal speaker and front panel headphone for
Thinkcenter A58 using alc662

https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html

Why 3stack desktops with 6 channels codecs not using  "Headphone+LO"  or
"Speaker+LO" ?
Takashi Iwai Oct. 18, 2014, 6:28 p.m. UTC | #5
At Sat, 18 Oct 2014 20:33:49 +0800,
Raymond Yau wrote:
> 
> >> >
> >> > In the scenario where there is one "Line Out", one "Speaker" and one
> >> > "Headphone", and there are only two DACs, two outputs will share a DAC.
> >> > Currently any mixer on such a DAC will get the "PCM" name, which is
> >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to better
> >> > specify what the volume actually controls.
> >>
> >> Are there any examples ?
> >>
> >
> > I used "hda-emu
> codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i 1" when
> developing the patches.
> >
> > I don't have any hardware available myself that exposes this behavior,
> but I can maybe fake one with hdajackretask, if that counts...
> >
> 
> How about adding these names to slaves of virtual master volume/switch ?
> 
> hdajackretask won't help if the topology of the codecs are  different
> 
> Seem the badness still prevent the driver to support surround 5.1 with
> three rear panel jacks, internal speaker and front panel headphone for
> Thinkcenter A58 using alc662
> 
> https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> 
> Why 3stack desktops with 6 channels codecs not using  "Headphone+LO"  or
> "Speaker+LO" ?

The problem is just the lack of DACs, so it cannot cover all three
outputs, no matter how the pins are chosen.  That is, it's no 6
channels at all but 4 channels at most.


Takashi
Raymond Yau Oct. 18, 2014, 11:02 p.m. UTC | #6
> >
> > >> >
> > >> > In the scenario where there is one "Line Out", one "Speaker" and
one
> > >> > "Headphone", and there are only two DACs, two outputs will share a
DAC.
> > >> > Currently any mixer on such a DAC will get the "PCM" name, which is
> > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to better
> > >> > specify what the volume actually controls.
> > >>
> > >> Are there any examples ?
> > >>
> > >
> > > I used "hda-emu
> > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i 1"
when
> > developing the patches.
> > >
> > > I don't have any hardware available myself that exposes this behavior,
> > but I can maybe fake one with hdajackretask, if that counts...
> > >
> >
> > How about adding these names to slaves of virtual master volume/switch ?
> >
> > hdajackretask won't help if the topology of the codecs are  different
> >
> > Seem the badness still prevent the driver to support surround 5.1 with
> > three rear panel jacks, internal speaker and front panel headphone for
> > Thinkcenter A58 using alc662
> >
> >
https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> >
> > Why 3stack desktops with 6 channels codecs not using  "Headphone+LO"  or
> > "Speaker+LO" ?
>
> The problem is just the lack of DACs, so it cannot cover all three
> outputs, no matter how the pins are chosen.  That is, it's no 6
> channels at all but 4 channels at most.
>
>

http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/

The technical specification of a58

2 pin internal speaker connector
Alc662 5.1

https://bbs.archlinux.org/viewtopic.php?id=156433

Seem windows support surround 5.1
Takashi Iwai Oct. 19, 2014, 9:02 a.m. UTC | #7
At Sun, 19 Oct 2014 07:02:07 +0800,
Raymond Yau wrote:
> 
> > >
> > > >> >
> > > >> > In the scenario where there is one "Line Out", one "Speaker" and
> one
> > > >> > "Headphone", and there are only two DACs, two outputs will share a
> DAC.
> > > >> > Currently any mixer on such a DAC will get the "PCM" name, which is
> > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to better
> > > >> > specify what the volume actually controls.
> > > >>
> > > >> Are there any examples ?
> > > >>
> > > >
> > > > I used "hda-emu
> > > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i 1"
> when
> > > developing the patches.
> > > >
> > > > I don't have any hardware available myself that exposes this behavior,
> > > but I can maybe fake one with hdajackretask, if that counts...
> > > >
> > >
> > > How about adding these names to slaves of virtual master volume/switch ?
> > >
> > > hdajackretask won't help if the topology of the codecs are  different
> > >
> > > Seem the badness still prevent the driver to support surround 5.1 with
> > > three rear panel jacks, internal speaker and front panel headphone for
> > > Thinkcenter A58 using alc662
> > >
> > >
> https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> > >
> > > Why 3stack desktops with 6 channels codecs not using  "Headphone+LO"  or
> > > "Speaker+LO" ?
> >
> > The problem is just the lack of DACs, so it cannot cover all three
> > outputs, no matter how the pins are chosen.  That is, it's no 6
> > channels at all but 4 channels at most.
> >
> >
> 
> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> 
> The technical specification of a58
> 
> 2 pin internal speaker connector
> Alc662 5.1
> 
> https://bbs.archlinux.org/viewtopic.php?id=156433
> 
> Seem windows support surround 5.1

ALC662 has three DACs, so it's a different problem, if any.
ALC269 and its variants have only two DACs.


Takashi
Raymond Yau Oct. 20, 2014, 1:10 a.m. UTC | #8
> >
> > > >
> > > > >> >
> > > > >> > In the scenario where there is one "Line Out", one "Speaker"
and
> > one
> > > > >> > "Headphone", and there are only two DACs, two outputs will
share a
> > DAC.
> > > > >> > Currently any mixer on such a DAC will get the "PCM" name,
which is
> > > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to
better
> > > > >> > specify what the volume actually controls.
> > > > >>
> > > > >> Are there any examples ?
> > > > >>
> > > > >
> > > > > I used "hda-emu
> > > > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
1"
> > when
> > > > developing the patches.
> > > > >
> > > > > I don't have any hardware available myself that exposes this
behavior,
> > > > but I can maybe fake one with hdajackretask, if that counts...
> > > > >
> > > >
> > > > How about adding these names to slaves of virtual master
volume/switch ?
> > > >
> > > > hdajackretask won't help if the topology of the codecs are
different
> > > >
> > > > Seem the badness still prevent the driver to support surround 5.1
with
> > > > three rear panel jacks, internal speaker and front panel headphone
for
> > > > Thinkcenter A58 using alc662
> > > >
> > > >
> >
https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> > > >
> > > > Why 3stack desktops with 6 channels codecs not using
"Headphone+LO"  or
> > > > "Speaker+LO" ?
> > >
> > > The problem is just the lack of DACs, so it cannot cover all three
> > > outputs, no matter how the pins are chosen.  That is, it's no 6
> > > channels at all but 4 channels at most.
> > >
> > >
> >
> >http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> >
> > The technical specification of a58
> >
> > 2 pin internal speaker connector
> > Alc662 5.1
> >
> >https://bbs.archlinux.org/viewtopic.php?id=156433
> >
> > Seem windows support surround 5.1
>
> ALC662 has three DACs, so it's a different problem, if any.
> ALC269 and its variants have only two DACs.
>
>

These two patches not only affect those four channels hda codecs notebook
with dock station or desktop with internal speaker, it also affect some
codecs in hda-emu/codecs

1) two channels hda codec such as stac9200 (e.g Dell precision 490
workstation)
2) 8 channels codecs such as stac9228, cmi9880 (e.g. lg-lw60 and dell xps)

The proposed patches still not able to handle the case when line out ,
headphone and speaker share the same volume control

Refer to hardware mainteance manual of a58, there is only one internal
speaker , it is most likely a mono speaker if it use a two pin internal
speaker connector

http://www.desktopreview.com/default.asp?newsID=760&Review+Lenovo+ThinkCentre+A58

Here you can see the built-in speaker in the lower right

It is unlikely for  stereo speaker to use two pin connector

Other Thinkcenter with 6 channels ad1986a has enough volume controls for
line out, headphone and speaker

https://answers.launchpad.net/ubuntu/+source/alsa-driver/+question/146830
Takashi Iwai Oct. 20, 2014, 5:54 a.m. UTC | #9
At Mon, 20 Oct 2014 09:10:05 +0800,
Raymond Yau wrote:
> 
> > >
> > > > >
> > > > > >> >
> > > > > >> > In the scenario where there is one "Line Out", one "Speaker"
> and
> > > one
> > > > > >> > "Headphone", and there are only two DACs, two outputs will
> share a
> > > DAC.
> > > > > >> > Currently any mixer on such a DAC will get the "PCM" name,
> which is
> > > > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to
> better
> > > > > >> > specify what the volume actually controls.
> > > > > >>
> > > > > >> Are there any examples ?
> > > > > >>
> > > > > >
> > > > > > I used "hda-emu
> > > > > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> 1"
> > > when
> > > > > developing the patches.
> > > > > >
> > > > > > I don't have any hardware available myself that exposes this
> behavior,
> > > > > but I can maybe fake one with hdajackretask, if that counts...
> > > > > >
> > > > >
> > > > > How about adding these names to slaves of virtual master
> volume/switch ?
> > > > >
> > > > > hdajackretask won't help if the topology of the codecs are
> different
> > > > >
> > > > > Seem the badness still prevent the driver to support surround 5.1
> with
> > > > > three rear panel jacks, internal speaker and front panel headphone
> for
> > > > > Thinkcenter A58 using alc662
> > > > >
> > > > >
> > >
> https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> > > > >
> > > > > Why 3stack desktops with 6 channels codecs not using
> "Headphone+LO"  or
> > > > > "Speaker+LO" ?
> > > >
> > > > The problem is just the lack of DACs, so it cannot cover all three
> > > > outputs, no matter how the pins are chosen.  That is, it's no 6
> > > > channels at all but 4 channels at most.
> > > >
> > > >
> > >
> > >http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> > >
> > > The technical specification of a58
> > >
> > > 2 pin internal speaker connector
> > > Alc662 5.1
> > >
> > >https://bbs.archlinux.org/viewtopic.php?id=156433
> > >
> > > Seem windows support surround 5.1
> >
> > ALC662 has three DACs, so it's a different problem, if any.
> > ALC269 and its variants have only two DACs.
> >
> >
> 
> These two patches not only affect those four channels hda codecs notebook
> with dock station or desktop with internal speaker, it also affect some
> codecs in hda-emu/codecs
> 
> 1) two channels hda codec such as stac9200 (e.g Dell precision 490
> workstation)
> 2) 8 channels codecs such as stac9228, cmi9880 (e.g. lg-lw60 and dell xps)
> 
> The proposed patches still not able to handle the case when line out ,
> headphone and speaker share the same volume control

We need to test through all codecs and configs, but I thought the case
1 won't hit.  This should still result in "PCM" volume.

Which problem does the latter case have?  Do they have also shared
volumes although they have more number of DACs than pins?

> Refer to hardware mainteance manual of a58, there is only one internal
> speaker , it is most likely a mono speaker if it use a two pin internal
> speaker connector
> 
> http://www.desktopreview.com/default.asp?newsID=760&Review+Lenovo+ThinkCentre+A58
> 
> Here you can see the built-in speaker in the lower right
> 
> It is unlikely for  stereo speaker to use two pin connector

Raymond, this is utterly irrelevant with the volume control
assignment.  Just open up a different discussion thread.


Takashi
David Henningsson Oct. 20, 2014, 6:29 a.m. UTC | #10
On 2014-10-19 01:02, Raymond Yau wrote:
>
>  > >
>  > > >> >
>  > > >> > In the scenario where there is one "Line Out", one "Speaker"
> and one
>  > > >> > "Headphone", and there are only two DACs, two outputs will
> share a DAC.
>  > > >> > Currently any mixer on such a DAC will get the "PCM" name,
> which is
>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to better
>  > > >> > specify what the volume actually controls.
>  > > >>
>  > > >> Are there any examples ?
>  > > >>
>  > > >
>  > > > I used "hda-emu
>  > > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> 1" when
>  > > developing the patches.
>  > > >
>  > > > I don't have any hardware available myself that exposes this
> behavior,
>  > > but I can maybe fake one with hdajackretask, if that counts...
>  > > >
>  > >
>  > > How about adding these names to slaves of virtual master
> volume/switch ?
>  > >
>  > > hdajackretask won't help if the topology of the codecs are  different
>  > >
>  > > Seem the badness still prevent the driver to support surround 5.1 with
>  > > three rear panel jacks, internal speaker and front panel headphone for
>  > > Thinkcenter A58 using alc662
>  > >
>  > >
> https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
>  > >
>  > > Why 3stack desktops with 6 channels codecs not using
> "Headphone+LO"  or
>  > > "Speaker+LO" ?
>  >
>  > The problem is just the lack of DACs, so it cannot cover all three
>  > outputs, no matter how the pins are chosen.  That is, it's no 6
>  > channels at all but 4 channels at most.
>  >
>  >
>
> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
>
> The technical specification of a58
>
> 2 pin internal speaker connector
> Alc662 5.1
>
> https://bbs.archlinux.org/viewtopic.php?id=156433
>
> Seem windows support surround 5.1

Raymond, there can certainly be cases which this patch does not cover - 
after all, it's mostly a band aid given the lack of topology information 
- but do you see cases where this patch actually causes a *regression*? 
If so, could you point me to alsa-info for the machine where this patch 
causes a regression?
Raymond Yau Oct. 20, 2014, 9:55 a.m. UTC | #11
>>
>>
>>  > >
>>  > > >> >
>>  > > >> > In the scenario where there is one "Line Out", one "Speaker"
>> and one
>>  > > >> > "Headphone", and there are only two DACs, two outputs will
>> share a DAC.
>>  > > >> > Currently any mixer on such a DAC will get the "PCM" name,
>> which is
>>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to
better
>>  > > >> > specify what the volume actually controls.
>>  > > >>
>>  > > >> Are there any examples ?
>>  > > >>
>>  > > >
>>  > > > I used "hda-emu
>>  > > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
>> 1" when
>>  > > developing the patches.
>>  > > >
>>  > > > I don't have any hardware available myself that exposes this
>> behavior,
>>  > > but I can maybe fake one with hdajackretask, if that counts...
>>  > > >
>>  > >
>>  > > How about adding these names to slaves of virtual master
>> volume/switch ?
>>  > >
>>  > > hdajackretask won't help if the topology of the codecs are
different
>>  > >
>>  > > Seem the badness still prevent the driver to support surround 5.1
with
>>  > > three rear panel jacks, internal speaker and front panel headphone
for
>>  > > Thinkcenter A58 using alc662
>>  > >
>>  > >
>>
https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
>>  > >
>>  > > Why 3stack desktops with 6 channels codecs not using
>> "Headphone+LO"  or
>>  > > "Speaker+LO" ?
>>  >
>>  > The problem is just the lack of DACs, so it cannot cover all three
>>  > outputs, no matter how the pins are chosen.  That is, it's no 6
>>  > channels at all but 4 channels at most.
>>  >
>>  >
>>
>> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
>>
>> The technical specification of a58
>>
>> 2 pin internal speaker connector
>> Alc662 5.1
>>
>> https://bbs.archlinux.org/viewtopic.php?id=156433
>>
>> Seem windows support surround 5.1
>
>
> Raymond, there can certainly be cases which this patch does not cover -
after all, it's mostly a band aid given the lack of topology information -
but do you see cases where this patch actually causes a *regression*? If
so, could you point me to alsa-info for the machine where this patch causes
a regression?
>

www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4

I expect those desktop with 2+2 HD Audio codec support independent headphone

This mean the driver should not create "Lineout+HP" Playback volume

Line out and headphone cannot share same DAC
Takashi Iwai Oct. 20, 2014, 9:58 a.m. UTC | #12
At Mon, 20 Oct 2014 17:55:23 +0800,
Raymond Yau wrote:
> 
> >>
> >>
> >>  > >
> >>  > > >> >
> >>  > > >> > In the scenario where there is one "Line Out", one "Speaker"
> >> and one
> >>  > > >> > "Headphone", and there are only two DACs, two outputs will
> >> share a DAC.
> >>  > > >> > Currently any mixer on such a DAC will get the "PCM" name,
> >> which is
> >>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to
> better
> >>  > > >> > specify what the volume actually controls.
> >>  > > >>
> >>  > > >> Are there any examples ?
> >>  > > >>
> >>  > > >
> >>  > > > I used "hda-emu
> >>  > > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> >> 1" when
> >>  > > developing the patches.
> >>  > > >
> >>  > > > I don't have any hardware available myself that exposes this
> >> behavior,
> >>  > > but I can maybe fake one with hdajackretask, if that counts...
> >>  > > >
> >>  > >
> >>  > > How about adding these names to slaves of virtual master
> >> volume/switch ?
> >>  > >
> >>  > > hdajackretask won't help if the topology of the codecs are
> different
> >>  > >
> >>  > > Seem the badness still prevent the driver to support surround 5.1
> with
> >>  > > three rear panel jacks, internal speaker and front panel headphone
> for
> >>  > > Thinkcenter A58 using alc662
> >>  > >
> >>  > >
> >>
> https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> >>  > >
> >>  > > Why 3stack desktops with 6 channels codecs not using
> >> "Headphone+LO"  or
> >>  > > "Speaker+LO" ?
> >>  >
> >>  > The problem is just the lack of DACs, so it cannot cover all three
> >>  > outputs, no matter how the pins are chosen.  That is, it's no 6
> >>  > channels at all but 4 channels at most.
> >>  >
> >>  >
> >>
> >> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> >>
> >> The technical specification of a58
> >>
> >> 2 pin internal speaker connector
> >> Alc662 5.1
> >>
> >> https://bbs.archlinux.org/viewtopic.php?id=156433
> >>
> >> Seem windows support surround 5.1
> >
> >
> > Raymond, there can certainly be cases which this patch does not cover -
> after all, it's mostly a band aid given the lack of topology information -
> but do you see cases where this patch actually causes a *regression*? If
> so, could you point me to alsa-info for the machine where this patch causes
> a regression?
> >
> 
> www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
> 
> I expect those desktop with 2+2 HD Audio codec support independent headphone
> 
> This mean the driver should not create "Lineout+HP" Playback volume
> 
> Line out and headphone cannot share same DAC

Do you have a pincfg representing this?  Then we can check it easily
via hda-emu.


Takashi
David Henningsson Oct. 20, 2014, 9:59 a.m. UTC | #13
On 2014-10-20 11:55, Raymond Yau wrote:
>
>  >>
>  >>
>  >>  > >
>  >>  > > >> >
>  >>  > > >> > In the scenario where there is one "Line Out", one "Speaker"
>  >> and one
>  >>  > > >> > "Headphone", and there are only two DACs, two outputs will
>  >> share a DAC.
>  >>  > > >> > Currently any mixer on such a DAC will get the "PCM" name,
>  >> which is
>  >>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to
> better
>  >>  > > >> > specify what the volume actually controls.
>  >>  > > >>
>  >>  > > >> Are there any examples ?
>  >>  > > >>
>  >>  > > >
>  >>  > > > I used "hda-emu
>  >>  > > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
>  >> 1" when
>  >>  > > developing the patches.
>  >>  > > >
>  >>  > > > I don't have any hardware available myself that exposes this
>  >> behavior,
>  >>  > > but I can maybe fake one with hdajackretask, if that counts...
>  >>  > > >
>  >>  > >
>  >>  > > How about adding these names to slaves of virtual master
>  >> volume/switch ?
>  >>  > >
>  >>  > > hdajackretask won't help if the topology of the codecs are
> different
>  >>  > >
>  >>  > > Seem the badness still prevent the driver to support surround
> 5.1 with
>  >>  > > three rear panel jacks, internal speaker and front panel
> headphone for
>  >>  > > Thinkcenter A58 using alc662
>  >>  > >
>  >>  > >
>  >>
> https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
>  >>  > >
>  >>  > > Why 3stack desktops with 6 channels codecs not using
>  >> "Headphone+LO"  or
>  >>  > > "Speaker+LO" ?
>  >>  >
>  >>  > The problem is just the lack of DACs, so it cannot cover all three
>  >>  > outputs, no matter how the pins are chosen.  That is, it's no 6
>  >>  > channels at all but 4 channels at most.
>  >>  >
>  >>  >
>  >>
>  >> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
>  >>
>  >> The technical specification of a58
>  >>
>  >> 2 pin internal speaker connector
>  >> Alc662 5.1
>  >>
>  >> https://bbs.archlinux.org/viewtopic.php?id=156433
>  >>
>  >> Seem windows support surround 5.1
>  >
>  >
>  > Raymond, there can certainly be cases which this patch does not cover
> - after all, it's mostly a band aid given the lack of topology
> information - but do you see cases where this patch actually causes a
> *regression*? If so, could you point me to alsa-info for the machine
> where this patch causes a regression?
>  >
>
> www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
> <http://www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4>
>
> I expect those desktop with 2+2 HD Audio codec support independent headphone
>
> This mean the driver should not create "Lineout+HP" Playback volume
>
> Line out and headphone cannot share same DAC

I doubt that, but if they cannot share the same DAC, that needs to be 
addressed in a separate patch. This patch just deals with the naming, 
given that the previous logic has determined that headphone and Line out 
should share the same DAC.

Takashi, are you planning to apply this patch? Or are you looking for 
more testing first?
Takashi Iwai Oct. 20, 2014, 10:02 a.m. UTC | #14
At Mon, 20 Oct 2014 11:59:30 +0200,
David Henningsson wrote:
> 
> 
> 
> On 2014-10-20 11:55, Raymond Yau wrote:
> >
> >  >>
> >  >>
> >  >>  > >
> >  >>  > > >> >
> >  >>  > > >> > In the scenario where there is one "Line Out", one "Speaker"
> >  >> and one
> >  >>  > > >> > "Headphone", and there are only two DACs, two outputs will
> >  >> share a DAC.
> >  >>  > > >> > Currently any mixer on such a DAC will get the "PCM" name,
> >  >> which is
> >  >>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to
> > better
> >  >>  > > >> > specify what the volume actually controls.
> >  >>  > > >>
> >  >>  > > >> Are there any examples ?
> >  >>  > > >>
> >  >>  > > >
> >  >>  > > > I used "hda-emu
> >  >>  > > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> >  >> 1" when
> >  >>  > > developing the patches.
> >  >>  > > >
> >  >>  > > > I don't have any hardware available myself that exposes this
> >  >> behavior,
> >  >>  > > but I can maybe fake one with hdajackretask, if that counts...
> >  >>  > > >
> >  >>  > >
> >  >>  > > How about adding these names to slaves of virtual master
> >  >> volume/switch ?
> >  >>  > >
> >  >>  > > hdajackretask won't help if the topology of the codecs are
> > different
> >  >>  > >
> >  >>  > > Seem the badness still prevent the driver to support surround
> > 5.1 with
> >  >>  > > three rear panel jacks, internal speaker and front panel
> > headphone for
> >  >>  > > Thinkcenter A58 using alc662
> >  >>  > >
> >  >>  > >
> >  >>
> > https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> >  >>  > >
> >  >>  > > Why 3stack desktops with 6 channels codecs not using
> >  >> "Headphone+LO"  or
> >  >>  > > "Speaker+LO" ?
> >  >>  >
> >  >>  > The problem is just the lack of DACs, so it cannot cover all three
> >  >>  > outputs, no matter how the pins are chosen.  That is, it's no 6
> >  >>  > channels at all but 4 channels at most.
> >  >>  >
> >  >>  >
> >  >>
> >  >> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> >  >>
> >  >> The technical specification of a58
> >  >>
> >  >> 2 pin internal speaker connector
> >  >> Alc662 5.1
> >  >>
> >  >> https://bbs.archlinux.org/viewtopic.php?id=156433
> >  >>
> >  >> Seem windows support surround 5.1
> >  >
> >  >
> >  > Raymond, there can certainly be cases which this patch does not cover
> > - after all, it's mostly a band aid given the lack of topology
> > information - but do you see cases where this patch actually causes a
> > *regression*? If so, could you point me to alsa-info for the machine
> > where this patch causes a regression?
> >  >
> >
> > www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
> > <http://www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4>
> >
> > I expect those desktop with 2+2 HD Audio codec support independent headphone
> >
> > This mean the driver should not create "Lineout+HP" Playback volume
> >
> > Line out and headphone cannot share same DAC
> 
> I doubt that, but if they cannot share the same DAC, that needs to be 
> addressed in a separate patch. This patch just deals with the naming, 
> given that the previous logic has determined that headphone and Line out 
> should share the same DAC.
> 
> Takashi, are you planning to apply this patch? Or are you looking for 
> more testing first?

I'll test a bit more.  I have a machine that is affected by this
issue, so I can test on a real machine.

How about the changes in PA side, BTW?  Is it ready?


Takashi
Raymond Yau Oct. 20, 2014, 11:31 a.m. UTC | #15
> >
> > >>
> > >>
> > >>  > >
> > >>  > > >> >
> > >>  > > >> > In the scenario where there is one "Line Out", one
"Speaker"
> > >> and one
> > >>  > > >> > "Headphone", and there are only two DACs, two outputs will
> > >> share a DAC.
> > >>  > > >> > Currently any mixer on such a DAC will get the "PCM" name,
> > >> which is
> > >>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to
> > better
> > >>  > > >> > specify what the volume actually controls.
> > >>  > > >>
> > >>  > > >> Are there any examples ?
> > >>  > > >>
> > >>  > > >
> > >>  > > > I used "hda-emu
> > >>  > >
codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> > >> 1" when
> > >>  > > developing the patches.
> > >>  > > >
> > >>  > > > I don't have any hardware available myself that exposes this
> > >> behavior,
> > >>  > > but I can maybe fake one with hdajackretask, if that counts...
> > >>  > > >
> > >>  > >
> > >>  > > How about adding these names to slaves of virtual master
> > >> volume/switch ?
> > >>  > >
> > >>  > > hdajackretask won't help if the topology of the codecs are
> > different
> > >>  > >
> > >>  > > Seem the badness still prevent the driver to support surround
5.1
> > with
> > >>  > > three rear panel jacks, internal speaker and front panel
headphone
> > for
> > >>  > > Thinkcenter A58 using alc662
> > >>  > >
> > >>  > >
> > >>
> >
https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> > >>  > >
> > >>  > > Why 3stack desktops with 6 channels codecs not using
> > >> "Headphone+LO"  or
> > >>  > > "Speaker+LO" ?
> > >>  >
> > >>  > The problem is just the lack of DACs, so it cannot cover all three
> > >>  > outputs, no matter how the pins are chosen.  That is, it's no 6
> > >>  > channels at all but 4 channels at most.
> > >>  >
> > >>  >
> > >>
> > >> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> > >>
> > >> The technical specification of a58
> > >>
> > >> 2 pin internal speaker connector
> > >> Alc662 5.1
> > >>
> > >> https://bbs.archlinux.org/viewtopic.php?id=156433
> > >>
> > >> Seem windows support surround 5.1
> > >
> > >
> > > Raymond, there can certainly be cases which this patch does not cover
-
> > after all, it's mostly a band aid given the lack of topology
information -
> > but do you see cases where this patch actually causes a *regression*? If
> > so, could you point me to alsa-info for the machine where this patch
causes
> > a regression?
> > >
> >
> >
www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
> >
> > I expect those desktop with 2+2 HD Audio codec support independent
headphone
> >
> > This mean the driver should not create "Lineout+HP" Playback volume
> >
> > Line out and headphone cannot share same DAC
>
> Do you have a pincfg representing this?  Then we can check it easily
> via hda-emu.
>

http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/canonical/alc221--hp-prodesk-400-g1-sff-ccert-201408-15383?id=HEAD

Refer to user manual

Multi-streaming can be enabled in the Realtek control panel to allow
independent audio streams to be sent to/from the front and rear jacks
Takashi Iwai Oct. 20, 2014, 11:48 a.m. UTC | #16
At Mon, 20 Oct 2014 19:31:59 +0800,
Raymond Yau wrote:
> 
> > >
> > > >>
> > > >>
> > > >>  > >
> > > >>  > > >> >
> > > >>  > > >> > In the scenario where there is one "Line Out", one
> "Speaker"
> > > >> and one
> > > >>  > > >> > "Headphone", and there are only two DACs, two outputs will
> > > >> share a DAC.
> > > >>  > > >> > Currently any mixer on such a DAC will get the "PCM" name,
> > > >> which is
> > > >>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to
> > > better
> > > >>  > > >> > specify what the volume actually controls.
> > > >>  > > >>
> > > >>  > > >> Are there any examples ?
> > > >>  > > >>
> > > >>  > > >
> > > >>  > > > I used "hda-emu
> > > >>  > >
> codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> > > >> 1" when
> > > >>  > > developing the patches.
> > > >>  > > >
> > > >>  > > > I don't have any hardware available myself that exposes this
> > > >> behavior,
> > > >>  > > but I can maybe fake one with hdajackretask, if that counts...
> > > >>  > > >
> > > >>  > >
> > > >>  > > How about adding these names to slaves of virtual master
> > > >> volume/switch ?
> > > >>  > >
> > > >>  > > hdajackretask won't help if the topology of the codecs are
> > > different
> > > >>  > >
> > > >>  > > Seem the badness still prevent the driver to support surround
> 5.1
> > > with
> > > >>  > > three rear panel jacks, internal speaker and front panel
> headphone
> > > for
> > > >>  > > Thinkcenter A58 using alc662
> > > >>  > >
> > > >>  > >
> > > >>
> > >
> https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> > > >>  > >
> > > >>  > > Why 3stack desktops with 6 channels codecs not using
> > > >> "Headphone+LO"  or
> > > >>  > > "Speaker+LO" ?
> > > >>  >
> > > >>  > The problem is just the lack of DACs, so it cannot cover all three
> > > >>  > outputs, no matter how the pins are chosen.  That is, it's no 6
> > > >>  > channels at all but 4 channels at most.
> > > >>  >
> > > >>  >
> > > >>
> > > >> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> > > >>
> > > >> The technical specification of a58
> > > >>
> > > >> 2 pin internal speaker connector
> > > >> Alc662 5.1
> > > >>
> > > >> https://bbs.archlinux.org/viewtopic.php?id=156433
> > > >>
> > > >> Seem windows support surround 5.1
> > > >
> > > >
> > > > Raymond, there can certainly be cases which this patch does not cover
> -
> > > after all, it's mostly a band aid given the lack of topology
> information -
> > > but do you see cases where this patch actually causes a *regression*? If
> > > so, could you point me to alsa-info for the machine where this patch
> causes
> > > a regression?
> > > >
> > >
> > >
> www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
> > >
> > > I expect those desktop with 2+2 HD Audio codec support independent
> headphone
> > >
> > > This mean the driver should not create "Lineout+HP" Playback volume
> > >
> > > Line out and headphone cannot share same DAC
> >
> > Do you have a pincfg representing this?  Then we can check it easily
> > via hda-emu.
> >
> 
> http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/canonical/alc221--hp-prodesk-400-g1-sff-ccert-201408-15383?id=HEAD

Both HP (0x21) and LO (0x14) can share the same DAC (0x03) over mixer
(0x0d).  So the statement above "Line out and headphone cannot share
same DAC" isn't correct.

> Refer to user manual
> 
> Multi-streaming can be enabled in the Realtek control panel to allow
> independent audio streams to be sent to/from the front and rear jacks

This is the implementation detail and it's a matter of taste which
should be dependent and which not.  There is no bible here.

You can forcibly do that by a fixed DAC assignment (or add some
badness) if you want, too...


Takashi
Raymond Yau Oct. 20, 2014, 2:24 p.m. UTC | #17
> > > >
> > > > >>
> > > > >>
> > > > >>  > >
> > > > >>  > > >> >
> > > > >>  > > >> > In the scenario where there is one "Line Out", one
> > "Speaker"
> > > > >> and one
> > > > >>  > > >> > "Headphone", and there are only two DACs, two outputs
will
> > > > >> share a DAC.
> > > > >>  > > >> > Currently any mixer on such a DAC will get the "PCM"
name,
> > > > >> which is
> > > > >>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO"
to
> > > > better
> > > > >>  > > >> > specify what the volume actually controls.
> > > > >>  > > >>
> > > > >>  > > >> Are there any examples ?
> > > > >>  > > >>
> > > > >>  > > >
> > > > >>  > > > I used "hda-emu
> > > > >>  > >
> > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> > > > >> 1" when
> > > > >>  > > developing the patches.
> > > > >>  > > >
> > > > >>  > > > I don't have any hardware available myself that exposes
this
> > > > >> behavior,
> > > > >>  > > but I can maybe fake one with hdajackretask, if that
counts...
> > > > >>  > > >
> > > > >>  > >
> > > > >>  > > How about adding these names to slaves of virtual master
> > > > >> volume/switch ?
> > > > >>  > >
> > > > >>  > > hdajackretask won't help if the topology of the codecs are
> > > > different
> > > > >>  > >
> > > > >>  > > Seem the badness still prevent the driver to support
surround
> > 5.1
> > > > with
> > > > >>  > > three rear panel jacks, internal speaker and front panel
> > headphone
> > > > for
> > > > >>  > > Thinkcenter A58 using alc662
> > > > >>  > >
> > > > >>  > >
> > > > >>
> > > >
> >
https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> > > > >>  > >
> > > > >>  > > Why 3stack desktops with 6 channels codecs not using
> > > > >> "Headphone+LO"  or
> > > > >>  > > "Speaker+LO" ?
> > > > >>  >
> > > > >>  > The problem is just the lack of DACs, so it cannot cover all
three
> > > > >>  > outputs, no matter how the pins are chosen.  That is, it's no
6
> > > > >>  > channels at all but 4 channels at most.
> > > > >>  >
> > > > >>  >
> > > > >>
> > > > >> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> > > > >>
> > > > >> The technical specification of a58
> > > > >>
> > > > >> 2 pin internal speaker connector
> > > > >> Alc662 5.1
> > > > >>
> > > > >> https://bbs.archlinux.org/viewtopic.php?id=156433
> > > > >>
> > > > >> Seem windows support surround 5.1
> > > > >
> > > > >
> > > > > Raymond, there can certainly be cases which this patch does not
cover
> > -
> > > > after all, it's mostly a band aid given the lack of topology
> > information -
> > > > but do you see cases where this patch actually causes a
*regression*? If
> > > > so, could you point me to alsa-info for the machine where this patch
> > causes
> > > > a regression?
> > > > >
> > > >
> > > >
> >
www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
> > > >
> > > > I expect those desktop with 2+2 HD Audio codec support independent
> > headphone
> > > >
> > > > This mean the driver should not create "Lineout+HP" Playback volume
> > > >
> > > > Line out and headphone cannot share same DAC
> > >
> > > Do you have a pincfg representing this?  Then we can check it easily
> > > via hda-emu.
> > >
> >
> >
http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/canonical/alc221--hp-prodesk-400-g1-sff-ccert-201408-15383?id=HEAD
>
> Both HP (0x21) and LO (0x14) can share the same DAC (0x03) over mixer
> (0x0d).  So the statement above "Line out and headphone cannot share
> same DAC" isn't correct.
>
> > Refer to user manual
> >
> > Multi-streaming can be enabled in the Realtek control panel to allow
> > independent audio streams to be sent to/from the front and rear jacks
>
> This is the implementation detail and it's a matter of taste which
> should be dependent and which not.  There is no bible here.
>
> You can forcibly do that by a fixed DAC assignment (or add some
> badness) if you want, too...
>
>

http://mailman.alsa-project.org/pipermail/alsa-devel/2014-February/072775.html


Seem headphone not working properly on hp prodesk 600 g1
Takashi Iwai Oct. 20, 2014, 2:33 p.m. UTC | #18
At Mon, 20 Oct 2014 22:24:40 +0800,
Raymond Yau wrote:
> 
> > > > >
> > > > > >>
> > > > > >>
> > > > > >>  > >
> > > > > >>  > > >> >
> > > > > >>  > > >> > In the scenario where there is one "Line Out", one
> > > "Speaker"
> > > > > >> and one
> > > > > >>  > > >> > "Headphone", and there are only two DACs, two outputs
> will
> > > > > >> share a DAC.
> > > > > >>  > > >> > Currently any mixer on such a DAC will get the "PCM"
> name,
> > > > > >> which is
> > > > > >>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO"
> to
> > > > > better
> > > > > >>  > > >> > specify what the volume actually controls.
> > > > > >>  > > >>
> > > > > >>  > > >> Are there any examples ?
> > > > > >>  > > >>
> > > > > >>  > > >
> > > > > >>  > > > I used "hda-emu
> > > > > >>  > >
> > > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> > > > > >> 1" when
> > > > > >>  > > developing the patches.
> > > > > >>  > > >
> > > > > >>  > > > I don't have any hardware available myself that exposes
> this
> > > > > >> behavior,
> > > > > >>  > > but I can maybe fake one with hdajackretask, if that
> counts...
> > > > > >>  > > >
> > > > > >>  > >
> > > > > >>  > > How about adding these names to slaves of virtual master
> > > > > >> volume/switch ?
> > > > > >>  > >
> > > > > >>  > > hdajackretask won't help if the topology of the codecs are
> > > > > different
> > > > > >>  > >
> > > > > >>  > > Seem the badness still prevent the driver to support
> surround
> > > 5.1
> > > > > with
> > > > > >>  > > three rear panel jacks, internal speaker and front panel
> > > headphone
> > > > > for
> > > > > >>  > > Thinkcenter A58 using alc662
> > > > > >>  > >
> > > > > >>  > >
> > > > > >>
> > > > >
> > >
> https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> > > > > >>  > >
> > > > > >>  > > Why 3stack desktops with 6 channels codecs not using
> > > > > >> "Headphone+LO"  or
> > > > > >>  > > "Speaker+LO" ?
> > > > > >>  >
> > > > > >>  > The problem is just the lack of DACs, so it cannot cover all
> three
> > > > > >>  > outputs, no matter how the pins are chosen.  That is, it's no
> 6
> > > > > >>  > channels at all but 4 channels at most.
> > > > > >>  >
> > > > > >>  >
> > > > > >>
> > > > > >> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> > > > > >>
> > > > > >> The technical specification of a58
> > > > > >>
> > > > > >> 2 pin internal speaker connector
> > > > > >> Alc662 5.1
> > > > > >>
> > > > > >> https://bbs.archlinux.org/viewtopic.php?id=156433
> > > > > >>
> > > > > >> Seem windows support surround 5.1
> > > > > >
> > > > > >
> > > > > > Raymond, there can certainly be cases which this patch does not
> cover
> > > -
> > > > > after all, it's mostly a band aid given the lack of topology
> > > information -
> > > > > but do you see cases where this patch actually causes a
> *regression*? If
> > > > > so, could you point me to alsa-info for the machine where this patch
> > > causes
> > > > > a regression?
> > > > > >
> > > > >
> > > > >
> > >
> www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
> > > > >
> > > > > I expect those desktop with 2+2 HD Audio codec support independent
> > > headphone
> > > > >
> > > > > This mean the driver should not create "Lineout+HP" Playback volume
> > > > >
> > > > > Line out and headphone cannot share same DAC
> > > >
> > > > Do you have a pincfg representing this?  Then we can check it easily
> > > > via hda-emu.
> > > >
> > >
> > >
> http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/canonical/alc221--hp-prodesk-400-g1-sff-ccert-201408-15383?id=HEAD
> >
> > Both HP (0x21) and LO (0x14) can share the same DAC (0x03) over mixer
> > (0x0d).  So the statement above "Line out and headphone cannot share
> > same DAC" isn't correct.
> >
> > > Refer to user manual
> > >
> > > Multi-streaming can be enabled in the Realtek control panel to allow
> > > independent audio streams to be sent to/from the front and rear jacks
> >
> > This is the implementation detail and it's a matter of taste which
> > should be dependent and which not.  There is no bible here.
> >
> > You can forcibly do that by a fixed DAC assignment (or add some
> > badness) if you want, too...
> >
> >
> 
> http://mailman.alsa-project.org/pipermail/alsa-devel/2014-February/072775.html
> 
> 
> Seem headphone not working properly on hp prodesk 600 g1

I thought it's a jack retask issue?  You commented so in kernel
bugzilla:
  https://bugzilla.kernel.org/show_bug.cgi?id=70791


Takashi
Raymond Yau Oct. 20, 2014, 2:38 p.m. UTC | #19
>>  >>
>>  >>
>>  >>  > >
>>  >>  > > >> >
>>  >>  > > >> > In the scenario where there is one "Line Out", one
"Speaker"
>>  >> and one
>>  >>  > > >> > "Headphone", and there are only two DACs, two outputs will
>>  >> share a DAC.
>>  >>  > > >> > Currently any mixer on such a DAC will get the "PCM" name,
>>  >> which is
>>  >>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to
>> better
>>  >>  > > >> > specify what the volume actually controls.
>>  >>  > > >>
>>  >>  > > >> Are there any examples ?
>>  >>  > > >>
>>  >>  > > >
>>  >>  > > > I used "hda-emu
>>  >>  > >
codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
>>  >> 1" when
>>  >>  > > developing the patches.
>>  >>  > > >
>>  >>  > > > I don't have any hardware available myself that exposes this
>>  >> behavior,
>>  >>  > > but I can maybe fake one with hdajackretask, if that counts...
>>  >>  > > >
>>  >>  > >
>>  >>  > > How about adding these names to slaves of virtual master
>>  >> volume/switch ?
>>  >>  > >
>>  >>  > > hdajackretask won't help if the topology of the codecs are
>> different
>>  >>  > >
>>  >>  > > Seem the badness still prevent the driver to support surround
>> 5.1 with
>>  >>  > > three rear panel jacks, internal speaker and front panel
>> headphone for
>>  >>  > > Thinkcenter A58 using alc662
>>  >>  > >
>>  >>  > >
>>  >>
>>
https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
>>  >>  > >
>>  >>  > > Why 3stack desktops with 6 channels codecs not using
>>  >> "Headphone+LO"  or
>>  >>  > > "Speaker+LO" ?
>>  >>  >
>>  >>  > The problem is just the lack of DACs, so it cannot cover all three
>>  >>  > outputs, no matter how the pins are chosen.  That is, it's no 6
>>  >>  > channels at all but 4 channels at most.
>>  >>  >
>>  >>  >
>>  >>
>>  >> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
>>  >>
>>  >> The technical specification of a58
>>  >>
>>  >> 2 pin internal speaker connector
>>  >> Alc662 5.1
>>  >>
>>  >> https://bbs.archlinux.org/viewtopic.php?id=156433
>>  >>
>>  >> Seem windows support surround 5.1
>>  >
>>  >
>>  > Raymond, there can certainly be cases which this patch does not cover
>> - after all, it's mostly a band aid given the lack of topology
>> information - but do you see cases where this patch actually causes a
>> *regression*? If so, could you point me to alsa-info for the machine
>> where this patch causes a regression?
>>  >
>>
>>
www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
>> <
http://www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
>
>>
>>
>> I expect those desktop with 2+2 HD Audio codec support independent
headphone
>>
>> This mean the driver should not create "Lineout+HP" Playback volume
>>
>> Line out and headphone cannot share same DAC
>
>
> I doubt that, but if they cannot share the same DAC, that needs to be
addressed in a separate patch. This patch just deals with the naming, given
that the previous logic has determined that headphone and Line out should
share the same DAC.
>
> Takashi, are you planning to apply this patch? Or are you looking for
more testing first?
>
>

Do you have the machine which  has "Headphone+LO" ?

There is no headphone playback volume

speaker is muted when either headphone or line out is plugged and unmuted
when both jacks are unplugged
Raymond Yau Oct. 20, 2014, 11:37 p.m. UTC | #20
> >
> > > > > >
> > > > > > >>
> > > > > > >>
> > > > > > >>  > >
> > > > > > >>  > > >> >
> > > > > > >>  > > >> > In the scenario where there is one "Line Out", one
> > > > "Speaker"
> > > > > > >> and one
> > > > > > >>  > > >> > "Headphone", and there are only two DACs, two
outputs
> > will
> > > > > > >> share a DAC.
> > > > > > >>  > > >> > Currently any mixer on such a DAC will get the
"PCM"
> > name,
> > > > > > >> which is
> > > > > > >>  > > >> > misleading. Instead use "Headphone+LO" or
"Speaker+LO"
> > to
> > > > > > better
> > > > > > >>  > > >> > specify what the volume actually controls.
> > > > > > >>  > > >>
> > > > > > >>  > > >> Are there any examples ?
> > > > > > >>  > > >>
> > > > > > >>  > > >
> > > > > > >>  > > > I used "hda-emu
> > > > > > >>  > >
> > > > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> > > > > > >> 1" when
> > > > > > >>  > > developing the patches.
> > > > > > >>  > > >
> > > > > > >>  > > > I don't have any hardware available myself that
exposes
> > this
> > > > > > >> behavior,
> > > > > > >>  > > but I can maybe fake one with hdajackretask, if that
> > counts...
> > > > > > >>  > > >
> > > > > > >>  > >
> > > > > > >>  > > How about adding these names to slaves of virtual master
> > > > > > >> volume/switch ?
> > > > > > >>  > >
> > > > > > >>  > > hdajackretask won't help if the topology of the codecs
are
> > > > > > different
> > > > > > >>  > >
> > > > > > >>  > > Seem the badness still prevent the driver to support
> > surround
> > > > 5.1
> > > > > > with
> > > > > > >>  > > three rear panel jacks, internal speaker and front panel
> > > > headphone
> > > > > > for
> > > > > > >>  > > Thinkcenter A58 using alc662
> > > > > > >>  > >
> > > > > > >>  > >
> > > > > > >>
> > > > > >
> > > >
> >
https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> > > > > > >>  > >
> > > > > > >>  > > Why 3stack desktops with 6 channels codecs not using
> > > > > > >> "Headphone+LO"  or
> > > > > > >>  > > "Speaker+LO" ?
> > > > > > >>  >
> > > > > > >>  > The problem is just the lack of DACs, so it cannot cover
all
> > three
> > > > > > >>  > outputs, no matter how the pins are chosen.  That is,
it's no
> > 6
> > > > > > >>  > channels at all but 4 channels at most.
> > > > > > >>  >
> > > > > > >>  >
> > > > > > >>
> > > > > > >>
http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> > > > > > >>
> > > > > > >> The technical specification of a58
> > > > > > >>
> > > > > > >> 2 pin internal speaker connector
> > > > > > >> Alc662 5.1
> > > > > > >>
> > > > > > >> https://bbs.archlinux.org/viewtopic.php?id=156433
> > > > > > >>
> > > > > > >> Seem windows support surround 5.1
> > > > > > >
> > > > > > >
> > > > > > > Raymond, there can certainly be cases which this patch does
not
> > cover
> > > > -
> > > > > > after all, it's mostly a band aid given the lack of topology
> > > > information -
> > > > > > but do you see cases where this patch actually causes a
> > *regression*? If
> > > > > > so, could you point me to alsa-info for the machine where this
patch
> > > > causes
> > > > > > a regression?
> > > > > > >
> > > > > >
> > > > > >
> > > >
> >
www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
> > > > > >
> > > > > > I expect those desktop with 2+2 HD Audio codec support
independent
> > > > headphone
> > > > > >
> > > > > > This mean the driver should not create "Lineout+HP" Playback
volume
> > > > > >
> > > > > > Line out and headphone cannot share same DAC
> > > > >
> > > > > Do you have a pincfg representing this?  Then we can check it
easily
> > > > > via hda-emu.
> > > > >
> > > >
> > > >
> >
http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/canonical/alc221--hp-prodesk-400-g1-sff-ccert-201408-15383?id=HEAD
> > >
> > > Both HP (0x21) and LO (0x14) can share the same DAC (0x03) over mixer
> > > (0x0d).  So the statement above "Line out and headphone cannot share
> > > same DAC" isn't correct.
> > >
> > > > Refer to user manual
> > > >
> > > > Multi-streaming can be enabled in the Realtek control panel to allow
> > > > independent audio streams to be sent to/from the front and rear
jacks
> > >
> > > This is the implementation detail and it's a matter of taste which
> > > should be dependent and which not.  There is no bible here.
> > >
> > > You can forcibly do that by a fixed DAC assignment (or add some
> > > badness) if you want, too...
> > >
> > >
> >
> >
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-February/072775.html
> >
> >
> > Seem headphone not working properly on hp prodesk 600 g1
>
> I thought it's a jack retask issue?  You commented so in kernel
> bugzilla:
>   https://bugzilla.kernel.org/show_bug.cgi?id=70791
>
>

The other cases which may also need share volume control when the jacks are
retasked

1) The driver hack the pin default of those Dell xps series notebooks to
support dual headphone , the original pin defaults are  line out, hp, mic
at same location for external 5.1  speaker and with internal speaker with
stac9228

2) those notebook with four jacks ( headphone, line out , mic and line in )
external 7.1 and internal speaker i.e. previous model "targa8ch"

3) Dell Alienware 14,17 and 18 have three jacks : headset, headphone and
mic jack and support ext 5.1 speakers and internal 2.1 speaker with alc668
Robert Hancock Oct. 21, 2014, 2:29 a.m. UTC | #21
On Mon, Oct 20, 2014 at 8:24 AM, Raymond Yau
<superquad.vortex2@gmail.com> wrote:
>
>> > > >
>> > > > >>
>> > > > >>
>> > > > >>  > >
>> > > > >>  > > >> >
>> > > > >>  > > >> > In the scenario where there is one "Line Out", one
>> > "Speaker"
>> > > > >> and one
>> > > > >>  > > >> > "Headphone", and there are only two DACs, two outputs
>> > > > >> will
>> > > > >> share a DAC.
>> > > > >>  > > >> > Currently any mixer on such a DAC will get the "PCM"
>> > > > >> name,
>> > > > >> which is
>> > > > >>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO"
>> > > > >> to
>> > > > better
>> > > > >>  > > >> > specify what the volume actually controls.
>> > > > >>  > > >>
>> > > > >>  > > >> Are there any examples ?
>> > > > >>  > > >>
>> > > > >>  > > >
>> > > > >>  > > > I used "hda-emu
>> > > > >>  > >
>> > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
>> > > > >> 1" when
>> > > > >>  > > developing the patches.
>> > > > >>  > > >
>> > > > >>  > > > I don't have any hardware available myself that exposes
>> > > > >> this
>> > > > >> behavior,
>> > > > >>  > > but I can maybe fake one with hdajackretask, if that
>> > > > >> counts...
>> > > > >>  > > >
>> > > > >>  > >
>> > > > >>  > > How about adding these names to slaves of virtual master
>> > > > >> volume/switch ?
>> > > > >>  > >
>> > > > >>  > > hdajackretask won't help if the topology of the codecs are
>> > > > different
>> > > > >>  > >
>> > > > >>  > > Seem the badness still prevent the driver to support
>> > > > >> surround
>> > 5.1
>> > > > with
>> > > > >>  > > three rear panel jacks, internal speaker and front panel
>> > headphone
>> > > > for
>> > > > >>  > > Thinkcenter A58 using alc662
>> > > > >>  > >
>> > > > >>  > >
>> > > > >>
>> > > >
>> >
>> > https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
>> > > > >>  > >
>> > > > >>  > > Why 3stack desktops with 6 channels codecs not using
>> > > > >> "Headphone+LO"  or
>> > > > >>  > > "Speaker+LO" ?
>> > > > >>  >
>> > > > >>  > The problem is just the lack of DACs, so it cannot cover all
>> > > > >> three
>> > > > >>  > outputs, no matter how the pins are chosen.  That is, it's no
>> > > > >> 6
>> > > > >>  > channels at all but 4 channels at most.
>> > > > >>  >
>> > > > >>  >
>> > > > >>
>> > > > >> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
>> > > > >>
>> > > > >> The technical specification of a58
>> > > > >>
>> > > > >> 2 pin internal speaker connector
>> > > > >> Alc662 5.1
>> > > > >>
>> > > > >> https://bbs.archlinux.org/viewtopic.php?id=156433
>> > > > >>
>> > > > >> Seem windows support surround 5.1
>> > > > >
>> > > > >
>> > > > > Raymond, there can certainly be cases which this patch does not
>> > > > > cover
>> > -
>> > > > after all, it's mostly a band aid given the lack of topology
>> > information -
>> > > > but do you see cases where this patch actually causes a
>> > > > *regression*? If
>> > > > so, could you point me to alsa-info for the machine where this patch
>> > causes
>> > > > a regression?
>> > > > >
>> > > >
>> > > >
>> >
>> > www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
>> > > >
>> > > > I expect those desktop with 2+2 HD Audio codec support independent
>> > headphone
>> > > >
>> > > > This mean the driver should not create "Lineout+HP" Playback volume
>> > > >
>> > > > Line out and headphone cannot share same DAC
>> > >
>> > > Do you have a pincfg representing this?  Then we can check it easily
>> > > via hda-emu.
>> > >
>> >
>> >
>> > http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/canonical/alc221--hp-prodesk-400-g1-sff-ccert-201408-15383?id=HEAD
>>
>> Both HP (0x21) and LO (0x14) can share the same DAC (0x03) over mixer
>> (0x0d).  So the statement above "Line out and headphone cannot share
>> same DAC" isn't correct.
>>
>> > Refer to user manual
>> >
>> > Multi-streaming can be enabled in the Realtek control panel to allow
>> > independent audio streams to be sent to/from the front and rear jacks
>>
>> This is the implementation detail and it's a matter of taste which
>> should be dependent and which not.  There is no bible here.
>>
>> You can forcibly do that by a fixed DAC assignment (or add some
>> badness) if you want, too...
>>
>>
>
> http://mailman.alsa-project.org/pipermail/alsa-devel/2014-February/072775.html
>
>
> Seem headphone not working properly on hp prodesk 600 g1

As I mentioned on Bugzilla, that problem ended up being due to some
kind of motherboard defect in the particular machine. On the
replacement 800 G1 machine, the headphone jack works fine. I can't
really say whether or not dual independent audio streams work, though.
Raymond Yau Oct. 21, 2014, 7:55 a.m. UTC | #22
> >> > > > >>
> >> > > > >>
> >> > > > >>  > >
> >> > > > >>  > > >> >
> >> > > > >>  > > >> > In the scenario where there is one "Line Out", one
> >> > "Speaker"
> >> > > > >> and one
> >> > > > >>  > > >> > "Headphone", and there are only two DACs, two
outputs
> >> > > > >> will
> >> > > > >> share a DAC.
> >> > > > >>  > > >> > Currently any mixer on such a DAC will get the "PCM"
> >> > > > >> name,
> >> > > > >> which is
> >> > > > >>  > > >> > misleading. Instead use "Headphone+LO" or
"Speaker+LO"
> >> > > > >> to
> >> > > > better
> >> > > > >>  > > >> > specify what the volume actually controls.
> >> > > > >>  > > >>
> >> > > > >>  > > >> Are there any examples ?
> >> > > > >>  > > >>
> >> > > > >>  > > >
> >> > > > >>  > > > I used "hda-emu
> >> > > > >>  > >
> >> > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> >> > > > >> 1" when
> >> > > > >>  > > developing the patches.
> >> > > > >>  > > >
> >> > > > >>  > > > I don't have any hardware available myself that exposes
> >> > > > >> this
> >> > > > >> behavior,
> >> > > > >>  > > but I can maybe fake one with hdajackretask, if that
> >> > > > >> counts...
> >> > > > >>  > > >
> >> > > > >>  > >
> >> > > > >>  > > How about adding these names to slaves of virtual master
> >> > > > >> volume/switch ?
> >> > > > >>  > >
> >> > > > >>  > > hdajackretask won't help if the topology of the codecs
are
> >> > > > different
> >> > > > >>  > >
> >> > > > >>  > > Seem the badness still prevent the driver to support
> >> > > > >> surround
> >> > 5.1
> >> > > > with
> >> > > > >>  > > three rear panel jacks, internal speaker and front panel
> >> > headphone
> >> > > > for
> >> > > > >>  > > Thinkcenter A58 using alc662
> >> > > > >>  > >
> >> > > > >>  > >
> >> > > > >>
> >> > > >
> >> >
> >> >
https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> >> > > > >>  > >
> >> > > > >>  > > Why 3stack desktops with 6 channels codecs not using
> >> > > > >> "Headphone+LO"  or
> >> > > > >>  > > "Speaker+LO" ?
> >> > > > >>  >
> >> > > > >>  > The problem is just the lack of DACs, so it cannot cover
all
> >> > > > >> three
> >> > > > >>  > outputs, no matter how the pins are chosen.  That is, it's
no
> >> > > > >> 6
> >> > > > >>  > channels at all but 4 channels at most.
> >> > > > >>  >
> >> > > > >>  >
> >> > > > >>
> >> > > > >>
http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> >> > > > >>
> >> > > > >> The technical specification of a58
> >> > > > >>
> >> > > > >> 2 pin internal speaker connector
> >> > > > >> Alc662 5.1
> >> > > > >>
> >> > > > >> https://bbs.archlinux.org/viewtopic.php?id=156433
> >> > > > >>
> >> > > > >> Seem windows support surround 5.1
> >> > > > >
> >> > > > >
> >> > > > > Raymond, there can certainly be cases which this patch does not
> >> > > > > cover
> >> > -
> >> > > > after all, it's mostly a band aid given the lack of topology
> >> > information -
> >> > > > but do you see cases where this patch actually causes a
> >> > > > *regression*? If
> >> > > > so, could you point me to alsa-info for the machine where this
patch
> >> > causes
> >> > > > a regression?
> >> > > > >
> >> > > >
> >> > > >
> >> >
> >> >
www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
> >> > > >
> >> > > > I expect those desktop with 2+2 HD Audio codec support
independent
> >> > headphone
> >> > > >
> >> > > > This mean the driver should not create "Lineout+HP" Playback
volume
> >> > > >
> >> > > > Line out and headphone cannot share same DAC
> >> > >
> >> > > Do you have a pincfg representing this?  Then we can check it
easily
> >> > > via hda-emu.
> >> > >
> >> >
> >> >
> >> >
http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/canonical/alc221--hp-prodesk-400-g1-sff-ccert-201408-15383?id=HEAD
> >>
> >> Both HP (0x21) and LO (0x14) can share the same DAC (0x03) over mixer
> >> (0x0d).  So the statement above "Line out and headphone cannot share
> >> same DAC" isn't correct.
> >>
> >> > Refer to user manual
> >> >
> >> > Multi-streaming can be enabled in the Realtek control panel to allow
> >> > independent audio streams to be sent to/from the front and rear jacks
> >>
> >> This is the implementation detail and it's a matter of taste which
> >> should be dependent and which not.  There is no bible here.
> >>
> >> You can forcibly do that by a fixed DAC assignment (or add some
> >> badness) if you want, too...
> >>
> >>
> >
> >
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-February/072775.html
> >
> >
> > Seem headphone not working properly on hp prodesk 600 g1
>
> As I mentioned on Bugzilla, that problem ended up being due to some
> kind of motherboard defect in the particular machine. On the
> replacement 800 G1 machine, the headphone jack works fine. I can't
> really say whether or not dual independent audio streams work, though.

If your prodesk 800 g1 are still using alc221, you can disable the speaker
node 0x17 by hda-jack-retask and add hint indep_hp=1 to hda-jack-retask.fw

[Hint]
indep_hp=1

or

in hda/hda_generic.c

Force the driver to add badness when assign dac to speaker first by

    if (spec-indep_hp && !indep_hp_possible(codec))
         badness += BAD_NO_INDEP_HP;
+  if (cfg->hp_outs > 0 && cfg->line_outs > 0)
+      if (get_defcfg_location(snd_hda_codec_get_pincfg(codec,
cfg->line_out_pins[0])) == AC_JACK_LOC_REAR)
+              if (fill_hardwired)
+                      badness += BAD_NO_INDEP_HP;

Driver create volume control for line out instead of speaker first

Driver create "Speaker+LO" instead of "Headphone+LO"  when you apply
david's patch

and add the following to patch_alc269 in patch_realtek.c

spec->gen.indep_hp=1;

The driver will create

device 2 alt analog

and independent hp switch

You can play another audio stream to device 2 while playing stereo stream
to line out through device 0 at the same time when independent hp switch is
"ON"

Assume alc221 is at card 1

speaker-test -c2 -D hw:1,0 -t wav

aplay -v -D hw:1,2  stereo.wav
Raymond Yau Oct. 21, 2014, 1:06 p.m. UTC | #23
> > >> > > > >>  > >
> > >> > > > >>  > > >> >
> > >> > > > >>  > > >> > In the scenario where there is one "Line Out", one
> > >> > "Speaker"
> > >> > > > >> and one
> > >> > > > >>  > > >> > "Headphone", and there are only two DACs, two
outputs
> > >> > > > >> will
> > >> > > > >> share a DAC.
> > >> > > > >>  > > >> > Currently any mixer on such a DAC will get the
"PCM"
> > >> > > > >> name,
> > >> > > > >> which is
> > >> > > > >>  > > >> > misleading. Instead use "Headphone+LO" or
"Speaker+LO"
> > >> > > > >> to
> > >> > > > better
> > >> > > > >>  > > >> > specify what the volume actually controls.
> > >> > > > >>  > > >>
> > >> > > > >>  > > >> Are there any examples ?
> > >> > > > >>  > > >>
> > >> > > > >>  > > >
> > >> > > > >>  > > > I used "hda-emu
> > >> > > > >>  > >
> > >> > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> > >> > > > >> 1" when
> > >> > > > >>  > > developing the patches.
> > >> > > > >>  > > >
> > >> > > > >>  > > > I don't have any hardware available myself that
exposes
> > >> > > > >> this
> > >> > > > >> behavior,
> > >> > > > >>  > > but I can maybe fake one with hdajackretask, if that
> > >> > > > >> counts...
> > >> > > > >>  > > >
> > >> > > > >>  > >
> > >> > > > >>  > > How about adding these names to slaves of virtual
master
> > >> > > > >> volume/switch ?
> > >> > > > >>  > >
> > >> > > > >>  > > hdajackretask won't help if the topology of the codecs
are
> > >> > > > different
> > >> > > > >>  > >
> > >> > > > >>  > > Seem the badness still prevent the driver to support
> > >> > > > >> surround
> > >> > 5.1
> > >> > > > with
> > >> > > > >>  > > three rear panel jacks, internal speaker and front
panel
> > >> > headphone
> > >> > > > for
> > >> > > > >>  > > Thinkcenter A58 using alc662
> > >> > > > >>  > >
> > >> > > > >>  > >
> > >> > > > >>
> > >> > > >
> > >> >
> > >> >
https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> > >> > > > >>  > >
> > >> > > > >>  > > Why 3stack desktops with 6 channels codecs not using
> > >> > > > >> "Headphone+LO"  or
> > >> > > > >>  > > "Speaker+LO" ?
> > >> > > > >>  >
> > >> > > > >>  > The problem is just the lack of DACs, so it cannot cover
all
> > >> > > > >> three
> > >> > > > >>  > outputs, no matter how the pins are chosen.  That is,
it's no
> > >> > > > >> 6
> > >> > > > >>  > channels at all but 4 channels at most.
> > >> > > > >>  >
> > >> > > > >>  >
> > >> > > > >>
> > >> > > > >>
http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> > >> > > > >>
> > >> > > > >> The technical specification of a58
> > >> > > > >>
> > >> > > > >> 2 pin internal speaker connector
> > >> > > > >> Alc662 5.1
> > >> > > > >>
> > >> > > > >> https://bbs.archlinux.org/viewtopic.php?id=156433
> > >> > > > >>
> > >> > > > >> Seem windows support surround 5.1
> > >> > > > >
> > >> > > > >
> > >> > > > > Raymond, there can certainly be cases which this patch does
not
> > >> > > > > cover
> > >> > -
> > >> > > > after all, it's mostly a band aid given the lack of topology
> > >> > information -
> > >> > > > but do you see cases where this patch actually causes a
> > >> > > > *regression*? If
> > >> > > > so, could you point me to alsa-info for the machine where this
patch
> > >> > causes
> > >> > > > a regression?
> > >> > > > >
> > >> > > >
> > >> > > >
> > >> >
> > >> >
www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
> > >> > > >
> > >> > > > I expect those desktop with 2+2 HD Audio codec support
independent
> > >> > headphone
> > >> > > >
> > >> > > > This mean the driver should not create "Lineout+HP" Playback
volume
> > >> > > >
> > >> > > > Line out and headphone cannot share same DAC
> > >> > >
> > >> > > Do you have a pincfg representing this?  Then we can check it
easily
> > >> > > via hda-emu.
> > >> > >
> > >> >
> > >> >
> > >> >
http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/canonical/alc221--hp-prodesk-400-g1-sff-ccert-201408-15383?id=HEAD
> > >>
> > >> Both HP (0x21) and LO (0x14) can share the same DAC (0x03) over mixer
> > >> (0x0d).  So the statement above "Line out and headphone cannot share
> > >> same DAC" isn't correct.
> > >>
> > >> > Refer to user manual
> > >> >
> > >> > Multi-streaming can be enabled in the Realtek control panel to
allow
> > >> > independent audio streams to be sent to/from the front and rear
jacks
> > >>
> > >> This is the implementation detail and it's a matter of taste which
> > >> should be dependent and which not.  There is no bible here.
> > >>
> > >> You can forcibly do that by a fixed DAC assignment (or add some
> > >> badness) if you want, too...
> > >>
> > >>
> > >
> > >
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-February/072775.html
> > >
> > >
> > > Seem headphone not working properly on hp prodesk 600 g1
> >
> > As I mentioned on Bugzilla, that problem ended up being due to some
> > kind of motherboard defect in the particular machine. On the
> > replacement 800 G1 machine, the headphone jack works fine. I can't
> > really say whether or not dual independent audio streams work, though.
>
> If your prodesk 800 g1 are still using alc221, you can disable the
speaker node 0x17 by hda-jack-retask and add hint indep_hp=1 to
hda-jack-retask.fw
>
> [Hint]
> indep_hp=1
>
> or
>
> in hda/hda_generic.c
>
> Force the driver to add badness when assign dac to speaker first by
>
>     if (spec-indep_hp && !indep_hp_possible(codec))
>          badness += BAD_NO_INDEP_HP;
> +  if (cfg->hp_outs > 0 && cfg->line_outs > 0)
> +      if (get_defcfg_location(snd_hda_codec_get_pincfg(codec,
cfg->line_out_pins[0])) == AC_JACK_LOC_REAR)
> +              if (fill_hardwired)
> +                      badness += BAD_NO_INDEP_HP;
>
> Driver create volume control for line out instead of speaker first
>
> Driver create "Speaker+LO" instead of "Headphone+LO"  when you apply
david's patch
>
> and add the following to patch_alc269 in patch_realtek.c
>
> spec->gen.indep_hp=1;
>
> The driver will create
>
> device 2 alt analog
>
> and independent hp switch
>
> You can play another audio stream to device 2 while playing stereo stream
to line out through device 0 at the same time when independent hp switch is
"ON"
>
> Assume alc221 is at card 1
>
> speaker-test -c2 -D hw:1,0 -t wav
>
> aplay -v -D hw:1,2  stereo.wav

To ensure independent hp control not add to those notebooks with dock line
out

codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986

static bool indep_hp_possible(struct hda_codec *codec)

+ if (get_defcfg_location(snd_hda_codec_get_pincfg(codec,
cfg->line_out_pins[0])) != AC_JACK_LOC_REAR)
+               return false;
Takashi Iwai Oct. 22, 2014, 7:29 a.m. UTC | #24
At Mon, 20 Oct 2014 12:02:04 +0200,
Takashi Iwai wrote:
> 
> At Mon, 20 Oct 2014 11:59:30 +0200,
> David Henningsson wrote:
> > 
> > 
> > 
> > On 2014-10-20 11:55, Raymond Yau wrote:
> > >
> > >  >>
> > >  >>
> > >  >>  > >
> > >  >>  > > >> >
> > >  >>  > > >> > In the scenario where there is one "Line Out", one "Speaker"
> > >  >> and one
> > >  >>  > > >> > "Headphone", and there are only two DACs, two outputs will
> > >  >> share a DAC.
> > >  >>  > > >> > Currently any mixer on such a DAC will get the "PCM" name,
> > >  >> which is
> > >  >>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO" to
> > > better
> > >  >>  > > >> > specify what the volume actually controls.
> > >  >>  > > >>
> > >  >>  > > >> Are there any examples ?
> > >  >>  > > >>
> > >  >>  > > >
> > >  >>  > > > I used "hda-emu
> > >  >>  > > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> > >  >> 1" when
> > >  >>  > > developing the patches.
> > >  >>  > > >
> > >  >>  > > > I don't have any hardware available myself that exposes this
> > >  >> behavior,
> > >  >>  > > but I can maybe fake one with hdajackretask, if that counts...
> > >  >>  > > >
> > >  >>  > >
> > >  >>  > > How about adding these names to slaves of virtual master
> > >  >> volume/switch ?
> > >  >>  > >
> > >  >>  > > hdajackretask won't help if the topology of the codecs are
> > > different
> > >  >>  > >
> > >  >>  > > Seem the badness still prevent the driver to support surround
> > > 5.1 with
> > >  >>  > > three rear panel jacks, internal speaker and front panel
> > > headphone for
> > >  >>  > > Thinkcenter A58 using alc662
> > >  >>  > >
> > >  >>  > >
> > >  >>
> > > https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> > >  >>  > >
> > >  >>  > > Why 3stack desktops with 6 channels codecs not using
> > >  >> "Headphone+LO"  or
> > >  >>  > > "Speaker+LO" ?
> > >  >>  >
> > >  >>  > The problem is just the lack of DACs, so it cannot cover all three
> > >  >>  > outputs, no matter how the pins are chosen.  That is, it's no 6
> > >  >>  > channels at all but 4 channels at most.
> > >  >>  >
> > >  >>  >
> > >  >>
> > >  >> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> > >  >>
> > >  >> The technical specification of a58
> > >  >>
> > >  >> 2 pin internal speaker connector
> > >  >> Alc662 5.1
> > >  >>
> > >  >> https://bbs.archlinux.org/viewtopic.php?id=156433
> > >  >>
> > >  >> Seem windows support surround 5.1
> > >  >
> > >  >
> > >  > Raymond, there can certainly be cases which this patch does not cover
> > > - after all, it's mostly a band aid given the lack of topology
> > > information - but do you see cases where this patch actually causes a
> > > *regression*? If so, could you point me to alsa-info for the machine
> > > where this patch causes a regression?
> > >  >
> > >
> > > www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
> > > <http://www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4>
> > >
> > > I expect those desktop with 2+2 HD Audio codec support independent headphone
> > >
> > > This mean the driver should not create "Lineout+HP" Playback volume
> > >
> > > Line out and headphone cannot share same DAC
> > 
> > I doubt that, but if they cannot share the same DAC, that needs to be 
> > addressed in a separate patch. This patch just deals with the naming, 
> > given that the previous logic has determined that headphone and Line out 
> > should share the same DAC.
> > 
> > Takashi, are you planning to apply this patch? Or are you looking for 
> > more testing first?
> 
> I'll test a bit more.  I have a machine that is affected by this
> issue, so I can test on a real machine.

FYI, the patches are merged now to for-next branch and pushed out.


Takashi
Raymond Yau Oct. 22, 2014, 7:43 a.m. UTC | #25
> >
> > > >
> > > > >>
> > > > >>
> > > > >>  > >
> > > > >>  > > >> >
> > > > >>  > > >> > In the scenario where there is one "Line Out", one
> > "Speaker"
> > > > >> and one
> > > > >>  > > >> > "Headphone", and there are only two DACs, two outputs
will
> > > > >> share a DAC.
> > > > >>  > > >> > Currently any mixer on such a DAC will get the "PCM"
name,
> > > > >> which is
> > > > >>  > > >> > misleading. Instead use "Headphone+LO" or "Speaker+LO"
to
> > > > better
> > > > >>  > > >> > specify what the volume actually controls.
> > > > >>  > > >>
> > > > >>  > > >> Are there any examples ?
> > > > >>  > > >>
> > > > >>  > > >
> > > > >>  > > > I used "hda-emu
> > > > >>  > >
> > codecs/canonical/alc3226-dell-precision-m2800-ccert-201404-14986 -i
> > > > >> 1" when
> > > > >>  > > developing the patches.
> > > > >>  > > >
> > > > >>  > > > I don't have any hardware available myself that exposes
this
> > > > >> behavior,
> > > > >>  > > but I can maybe fake one with hdajackretask, if that
counts...
> > > > >>  > > >
> > > > >>  > >
> > > > >>  > > How about adding these names to slaves of virtual master
> > > > >> volume/switch ?
> > > > >>  > >
> > > > >>  > > hdajackretask won't help if the topology of the codecs are
> > > > different
> > > > >>  > >
> > > > >>  > > Seem the badness still prevent the driver to support
surround
> > 5.1
> > > > with
> > > > >>  > > three rear panel jacks, internal speaker and front panel
> > headphone
> > > > for
> > > > >>  > > Thinkcenter A58 using alc662
> > > > >>  > >
> > > > >>  > >
> > > > >>
> > > >
> >
https://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg29203.html
> > > > >>  > >
> > > > >>  > > Why 3stack desktops with 6 channels codecs not using
> > > > >> "Headphone+LO"  or
> > > > >>  > > "Speaker+LO" ?
> > > > >>  >
> > > > >>  > The problem is just the lack of DACs, so it cannot cover all
three
> > > > >>  > outputs, no matter how the pins are chosen.  That is, it's no
6
> > > > >>  > channels at all but 4 channels at most.
> > > > >>  >
> > > > >>  >
> > > > >>
> > > > >> http://shop.lenovo.com/us/en/desktops/thinkcentre/a-series/a58/
> > > > >>
> > > > >> The technical specification of a58
> > > > >>
> > > > >> 2 pin internal speaker connector
> > > > >> Alc662 5.1
> > > > >>
> > > > >> https://bbs.archlinux.org/viewtopic.php?id=156433
> > > > >>
> > > > >> Seem windows support surround 5.1
> > > > >
> > > > >
> > > > > Raymond, there can certainly be cases which this patch does not
cover
> > -
> > > > after all, it's mostly a band aid given the lack of topology
> > information -
> > > > but do you see cases where this patch actually causes a
*regression*? If
> > > > so, could you point me to alsa-info for the machine where this patch
> > causes
> > > > a regression?
> > > > >
> > > >
> > > >
> >
www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=24&PFid=27&Level=5&Conn=4
> > > >
> > > > I expect those desktop with 2+2 HD Audio codec support independent
> > headphone
> > > >
> > > > This mean the driver should not create "Lineout+HP" Playback volume
> > > >
> > > > Line out and headphone cannot share same DAC
> > >
> > > Do you have a pincfg representing this?  Then we can check it easily
> > > via hda-emu.
> > >
> >
> >
http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/canonical/alc221--hp-prodesk-400-g1-sff-ccert-201408-15383?id=HEAD
>
> Both HP (0x21) and LO (0x14) can share the same DAC (0x03) over mixer
> (0x0d).  So the statement above "Line out and headphone cannot share
> same DAC" isn't correct.
>
> > Refer to user manual
> >
> > Multi-streaming can be enabled in the Realtek control panel to allow
> > independent audio streams to be sent to/from the front and rear jacks
>

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_via.c?id=2525050518496dfd6905abfa8d6d34288eed36d7

Do it mean that the volume control should be named as "Headphone+Side" ?
diff mbox

Patch

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 64220c0..1d742ea 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -1038,6 +1038,19 @@  static const char *get_line_out_pfx(struct hda_codec *codec, int ch,
 			break;
 		*index = ch;
 		return "Headphone";
+	case AUTO_PIN_LINE_OUT:
+		/* This deals with the case where we have two DACs and 
+		 * one LO, one HP and one Speaker */
+		if (!ch && cfg->speaker_outs && cfg->hp_outs) {
+			bool hp_lo_shared = !path_has_mixer(codec, spec->hp_paths[0], ctl_type);
+			bool spk_lo_shared = !path_has_mixer(codec, spec->speaker_paths[0], ctl_type);
+			if (hp_lo_shared && spk_lo_shared) 
+				return spec->vmaster_mute.hook ? "PCM" : "Master";
+			if (hp_lo_shared)
+				return "Headphone+LO";
+			if (spk_lo_shared)
+				return "Speaker+LO";
+		}
 	}
 
 	/* for a single channel output, we don't have to name the channel */