alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* 5.1 surround on 3 jacks (retasking)
@ 2010-08-25 19:45 Keith Chew
  2010-08-25 23:31 ` David Henningsson
  2010-08-26  7:03 ` Raymond Yau
  0 siblings, 2 replies; 15+ messages in thread
From: Keith Chew @ 2010-08-25 19:45 UTC (permalink / raw)
  To: alsa-devel

Hi

I have a small-form factor PC (KingYoung brand, model S645), which has
3 jacks connected to a Realtek ALC888 chipset. I have confirmed with
the manufacturers the pin outs:
1) The front panel left side phone jack : Codec Line2-L & Line2-R (pin
14 & pin 15)
2) The front panel right side phone jack : Codec Mic2-L & Mic2-R (pin
16 & pin 17)
3) The back panel phone jack : Codec Front-L & Front-R (pin 35 & pin 36)

I would like to update patch_realtek.c in alsa-drivers, to output 5.1
surround using these 3 jacks.

Can someone give me some guidance on how I can do this? I have looked
and studied patch_realtek as much as I can, I just need some help in
getting started.

Regards
Keith

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-25 19:45 5.1 surround on 3 jacks (retasking) Keith Chew
@ 2010-08-25 23:31 ` David Henningsson
  2010-08-26  6:35   ` Keith Chew
  2010-08-26  7:03 ` Raymond Yau
  1 sibling, 1 reply; 15+ messages in thread
From: David Henningsson @ 2010-08-25 23:31 UTC (permalink / raw)
  To: Keith Chew; +Cc: alsa-devel

2010-08-25 21:45, Keith Chew skrev:
> Hi
> 
> I have a small-form factor PC (KingYoung brand, model S645), which has
> 3 jacks connected to a Realtek ALC888 chipset. I have confirmed with
> the manufacturers the pin outs:
> 1) The front panel left side phone jack : Codec Line2-L & Line2-R (pin
> 14 & pin 15)
> 2) The front panel right side phone jack : Codec Mic2-L & Mic2-R (pin
> 16 & pin 17)
> 3) The back panel phone jack : Codec Front-L & Front-R (pin 35 & pin 36)
> 
> I would like to update patch_realtek.c in alsa-drivers, to output 5.1
> surround using these 3 jacks.
> 
> Can someone give me some guidance on how I can do this? I have looked
> and studied patch_realtek as much as I can, I just need some help in
> getting started.

My first approach to that problem would be to try to tweak
user_pin_configs, assuming that the generic parser (model=auto) is used.
See sections 4.3 and 4.4 on this document for how to do that:

http://mirror.leaseweb.com/kernel/people/tiwai/docs/HD-Audio.html

That way you won't have to update the kernel code at all.

To figure out the values of user_pin_configs, you'll need to know the
pin widget NIDs (see your /proc/asound/card*/codec* file for that) and
pin values (see official Intel HDA documentation, or read hda_proc.c).

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-25 23:31 ` David Henningsson
@ 2010-08-26  6:35   ` Keith Chew
  2010-08-26  6:56     ` David Henningsson
  0 siblings, 1 reply; 15+ messages in thread
From: Keith Chew @ 2010-08-26  6:35 UTC (permalink / raw)
  To: David Henningsson; +Cc: alsa-devel

> My first approach to that problem would be to try to tweak
> user_pin_configs, assuming that the generic parser (model=auto) is used.
> See sections 4.3 and 4.4 on this document for how to do that:
>
> http://mirror.leaseweb.com/kernel/people/tiwai/docs/HD-Audio.html
>
> That way you won't have to update the kernel code at all.
>
> To figure out the values of user_pin_configs, you'll need to know the
> pin widget NIDs (see your /proc/asound/card*/codec* file for that) and
> pin values (see official Intel HDA documentation, or read hda_proc.c).
>
Hi David

Thank you very much for your guidance, I have gotten a bit further,
and this is very exciting!

After reading HD-Audio.html, I used the hda-analyzer to configure NIDs
0x14, 0x19 and 0x1b to become outputs, and when I execute:

speaker-test -Dplug:surround51 -c6

I can hear sound on all 3 jacks, but only for Front left/right
channels. In other words, all 3 jacks are being treated as Front. To
confirm this, in alsamixer, the mute on Front (0x14) does mute all 3
jacks.

I guess I am missing the relationship between alsamixer and the codec.
How can I get aplay and speaker-test (with plug:surround51) to map to
Front/Mic2/Line2, now that I have configured them as outputs?

Regards
Keith

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-26  6:35   ` Keith Chew
@ 2010-08-26  6:56     ` David Henningsson
  2010-08-26  7:16       ` Keith Chew
  2010-08-26 23:19       ` Keith Chew
  0 siblings, 2 replies; 15+ messages in thread
From: David Henningsson @ 2010-08-26  6:56 UTC (permalink / raw)
  To: Keith Chew; +Cc: alsa-devel

2010-08-26 08:35, Keith Chew skrev:
>> My first approach to that problem would be to try to tweak
>> user_pin_configs, assuming that the generic parser (model=auto) is used.
>> See sections 4.3 and 4.4 on this document for how to do that:
>>
>> http://mirror.leaseweb.com/kernel/people/tiwai/docs/HD-Audio.html
>>
>> That way you won't have to update the kernel code at all.
>>
>> To figure out the values of user_pin_configs, you'll need to know the
>> pin widget NIDs (see your /proc/asound/card*/codec* file for that) and
>> pin values (see official Intel HDA documentation, or read hda_proc.c).
>>
> Hi David
> 
> Thank you very much for your guidance, I have gotten a bit further,
> and this is very exciting!
> 
> After reading HD-Audio.html, I used the hda-analyzer to configure NIDs
> 0x14, 0x19 and 0x1b to become outputs, and when I execute:
> 
> speaker-test -Dplug:surround51 -c6
> 
> I can hear sound on all 3 jacks, but only for Front left/right
> channels. In other words, all 3 jacks are being treated as Front. To
> confirm this, in alsamixer, the mute on Front (0x14) does mute all 3
> jacks.
> 
> I guess I am missing the relationship between alsamixer and the codec.
> How can I get aplay and speaker-test (with plug:surround51) to map to
> Front/Mic2/Line2, now that I have configured them as outputs?

I'm not 100% sure, but I think that HDA-analyzer approach will probably
not work here as you'll need a complete codec reconfig. After the
reconfig, you shouldn't even have a "Line in" in alsamixer, instead you
should have volume controls for "rear" and "center/lfe".
Also make sure that the pin configs are configured as "front", "rear",
and "center/lfe".


-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-25 19:45 5.1 surround on 3 jacks (retasking) Keith Chew
  2010-08-25 23:31 ` David Henningsson
@ 2010-08-26  7:03 ` Raymond Yau
  2010-08-26  7:22   ` Keith Chew
  1 sibling, 1 reply; 15+ messages in thread
From: Raymond Yau @ 2010-08-26  7:03 UTC (permalink / raw)
  To: ALSA Development Mailing List

2010/8/26 Keith Chew <keith.chew@gmail.com>

> Hi
>
> I have a small-form factor PC (KingYoung brand, model S645), which has
> 3 jacks connected to a Realtek ALC888 chipset. I have confirmed with
> the manufacturers the pin outs:
> 1) The front panel left side phone jack : Codec Line2-L & Line2-R (pin
> 14 & pin 15)
> 2) The front panel right side phone jack : Codec Mic2-L & Mic2-R (pin
> 16 & pin 17)
> 3) The back panel phone jack : Codec Front-L & Front-R (pin 35 & pin 36)
>
> I would like to update patch_realtek.c in alsa-drivers, to output 5.1
> surround using these 3 jacks.
>
> Can someone give me some guidance on how I can do this? I have looked
> and studied patch_realtek as much as I can, I just need some help in
> getting started.
>
> Regards
> Keith
>

The easy way is try those [ALC888_xxx] models with alc88x_3st_6ch_mixer

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-26  6:56     ` David Henningsson
@ 2010-08-26  7:16       ` Keith Chew
  2010-08-26 23:19       ` Keith Chew
  1 sibling, 0 replies; 15+ messages in thread
From: Keith Chew @ 2010-08-26  7:16 UTC (permalink / raw)
  To: David Henningsson; +Cc: alsa-devel@alsa-project.org

> I'm not 100% sure, but I think that HDA-analyzer approach will probably
> not work here as you'll need a complete codec reconfig. After the
> reconfig, you shouldn't even have a "Line in" in alsamixer, instead you
> should have volume controls for "rear" and "center/lfe".
> Also make sure that the pin configs are configured as "front", "rear",
> and "center/lfe"

Thanks David, I understand your approach now.  I will try to figure
out how to get the correct hex values for the user configs,
documentation is quite sparse. Will report back soon.

Regards
Keith

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-26  7:03 ` Raymond Yau
@ 2010-08-26  7:22   ` Keith Chew
  0 siblings, 0 replies; 15+ messages in thread
From: Keith Chew @ 2010-08-26  7:22 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

>
> The easy way is try those [ALC888_xxx]
> models with alc88x_3st_6ch_mixer

Hi Raymond

I have gone through patch_realtek and none of them are retasking the
mic2 and line2 to get 5.1 surround sound. Will try David's suggestion,
I think that will work.

Regards
Keith

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-26  6:56     ` David Henningsson
  2010-08-26  7:16       ` Keith Chew
@ 2010-08-26 23:19       ` Keith Chew
  2010-08-28 14:11         ` Keith Chew
  1 sibling, 1 reply; 15+ messages in thread
From: Keith Chew @ 2010-08-26 23:19 UTC (permalink / raw)
  To: David Henningsson; +Cc: alsa-devel

> I'm not 100% sure, but I think that HDA-analyzer approach will probably
> not work here as you'll need a complete codec reconfig. After the
> reconfig, you shouldn't even have a "Line in" in alsamixer, instead you
> should have volume controls for "rear" and "center/lfe".
> Also make sure that the pin configs are configured as "front", "rear",
> and "center/lfe".
>

Hi David

It is now working! I couldn't find documentation on how to determine
the correct pin config values, but found in patch_realtek.c the values
for rear, clfe and front. So, I executed this:

echo 0x14 0x01014510 > /sys/class/sound/hwC0D2/user_pin_configs
echo 0x19 0x01011012 > /sys/class/sound/hwC0D2/user_pin_configs
echo 0x1b 0x01016011 > /sys/class/sound/hwC0D2/user_pin_configs
echo 1 > /sys/class/sound/hwC0D2/reconfig

And 6 channels is now working perfectly. I have also tried the early
patch method, and that works too!

Thanks again for all your help.

Regards
Keith

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-26 23:19       ` Keith Chew
@ 2010-08-28 14:11         ` Keith Chew
  2010-08-28 14:55           ` David Henningsson
  0 siblings, 1 reply; 15+ messages in thread
From: Keith Chew @ 2010-08-28 14:11 UTC (permalink / raw)
  To: David Henningsson; +Cc: alsa-devel

> And 6 channels is now working perfectly. I have also tried the early
> patch method, and that works too!
>
> Thanks again for all your help.
>

Hi David

Just a quick follow up on this. I have found the volume on the output
jacks to be quite soft. 100% (master, front, clfe, surround) volume in
alsamixer gives the same volume as 60% percent using a soundblaster
card (driver CA0106). Is it a known issue with realtek ALC888 hardware
that the output volume is generally lower? Or perhaps there is some
"gain" setting I can use for the pin config?

Regards
Keith

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-28 14:11         ` Keith Chew
@ 2010-08-28 14:55           ` David Henningsson
  2010-08-28 15:08             ` Keith Chew
  0 siblings, 1 reply; 15+ messages in thread
From: David Henningsson @ 2010-08-28 14:55 UTC (permalink / raw)
  To: Keith Chew; +Cc: alsa-devel

2010-08-28 16:11, Keith Chew skrev:
>> And 6 channels is now working perfectly. I have also tried the early
>> patch method, and that works too!
>>
>> Thanks again for all your help.
>>
> 
> Hi David
> 
> Just a quick follow up on this. I have found the volume on the output
> jacks to be quite soft. 100% (master, front, clfe, surround) volume in
> alsamixer gives the same volume as 60% percent using a soundblaster
> card (driver CA0106). Is it a known issue with realtek ALC888 hardware
> that the output volume is generally lower? Or perhaps there is some
> "gain" setting I can use for the pin config?

Answering as a layman - make sure there are no other volume controls you
need turn up. There is also the -10 dBv <=> +4 dBu difference, could be
that your old card had the other voltage reference. Other than that, I
don't know.

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-28 14:55           ` David Henningsson
@ 2010-08-28 15:08             ` Keith Chew
  2010-08-30  7:51               ` Takashi Iwai
  0 siblings, 1 reply; 15+ messages in thread
From: Keith Chew @ 2010-08-28 15:08 UTC (permalink / raw)
  To: David Henningsson; +Cc: alsa-devel

> Answering as a layman - make sure there are no other volume controls you
> need turn up. There is also the -10 dBv <=> +4 dBu difference, could be
> that your old card had the other voltage reference. Other than that, I
> don't know.

Thank you very much for your quick response. I have actually made
progress. Using hda_analyzer, I have changed the pin ctls to be OUT
and HP, instead of just OUT. I read from the Intel doc that setting a
pin to HP will enable an output amplifier. True enough, this gave a
boost to the volume, it is close enough to the soundblaster's volume.

Now I am back to trying to figure out how to set the HP in the
user_pin_configs hex value. Do you have any documentation references
on how to set the hex value for user_pin_configs? I have tried to
Google for it, and also tried to find it from Intel's website, but to
no avail.

Regards
Keith

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-28 15:08             ` Keith Chew
@ 2010-08-30  7:51               ` Takashi Iwai
  2010-08-30 19:45                 ` Keith Chew
  0 siblings, 1 reply; 15+ messages in thread
From: Takashi Iwai @ 2010-08-30  7:51 UTC (permalink / raw)
  To: Keith Chew; +Cc: alsa-devel, David Henningsson

At Sun, 29 Aug 2010 03:08:36 +1200,
Keith Chew wrote:
> 
> > Answering as a layman - make sure there are no other volume controls you
> > need turn up. There is also the -10 dBv <=> +4 dBu difference, could be
> > that your old card had the other voltage reference. Other than that, I
> > don't know.
> 
> Thank you very much for your quick response. I have actually made
> progress. Using hda_analyzer, I have changed the pin ctls to be OUT
> and HP, instead of just OUT. I read from the Intel doc that setting a
> pin to HP will enable an output amplifier. True enough, this gave a
> boost to the volume, it is close enough to the soundblaster's volume.
> 
> Now I am back to trying to figure out how to set the HP in the
> user_pin_configs hex value. Do you have any documentation references
> on how to set the hex value for user_pin_configs? I have tried to
> Google for it, and also tried to find it from Intel's website, but to
> no avail.

This is nothing but the raw 32 bit values the codec chip will take.
Refer to "default pin configuration" in HD-audio specification.
Definitions can be found in hda_codec.h, too (AC_DEFCFG_*).


Takashi

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-30  7:51               ` Takashi Iwai
@ 2010-08-30 19:45                 ` Keith Chew
  2010-08-30 20:23                   ` Takashi Iwai
  0 siblings, 1 reply; 15+ messages in thread
From: Keith Chew @ 2010-08-30 19:45 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, David Henningsson

Hi Takashi

> This is nothing but the raw 32 bit values the codec chip will take.
> Refer to "default pin configuration" in HD-audio specification.
> Definitions can be found in hda_codec.h, too (AC_DEFCFG_*).
>

Thank you very much for this, I have managed to find it in both Intel
doc, and the hda_codec.h you mentioned. Interestingly, when I
configure all 3 jacks (via user_pin_configs) to be of type HP_OUT,
only 1 of them will be configured as that, the other 2 will not. There
must be something in the generic code that prevents more than 1 jack
being configured as HP_OUT. Looking at patch_realtek.c it appears the
norm is to set only 1 jack to be HP.

So, I ended up using the hda-verb program and set the HP_OUT on
startup, it works out well.

PS: Now I am getting static interference on one of the ports, but I
believe this is a hardware issue. In HP_OUT mode, the rear jack is
picking up static noise from the power source close by (ie noise only
comes in when keyboard is pressed repeatly or when CPU is in use).
Solved one problem, out comes another. More hardware debugging to do,
thanks again for all your help!

Regards
Keith

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-30 19:45                 ` Keith Chew
@ 2010-08-30 20:23                   ` Takashi Iwai
  2010-08-30 20:58                     ` Keith Chew
  0 siblings, 1 reply; 15+ messages in thread
From: Takashi Iwai @ 2010-08-30 20:23 UTC (permalink / raw)
  To: Keith Chew; +Cc: alsa-devel, David Henningsson

At Tue, 31 Aug 2010 07:45:09 +1200,
Keith Chew wrote:
> 
> Hi Takashi
> 
> > This is nothing but the raw 32 bit values the codec chip will take.
> > Refer to "default pin configuration" in HD-audio specification.
> > Definitions can be found in hda_codec.h, too (AC_DEFCFG_*).
> >
> 
> Thank you very much for this, I have managed to find it in both Intel
> doc, and the hda_codec.h you mentioned. Interestingly, when I
> configure all 3 jacks (via user_pin_configs) to be of type HP_OUT,
> only 1 of them will be configured as that, the other 2 will not. There
> must be something in the generic code that prevents more than 1 jack
> being configured as HP_OUT. Looking at patch_realtek.c it appears the
> norm is to set only 1 jack to be HP.

There are some restrictions for automatic parser.  The STAC/IDT
parser supports dual headphones, but realtek one doesn't, so far.
But, anyway 3 headphones are wrong.

Note that by setting the pins to HP, you get the amp boost in the
codec chip, but it doesn't mean it's better audio quality.  For
line-outs, you shouldn't put such an amp usually.


Takashi

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

* Re: 5.1 surround on 3 jacks (retasking)
  2010-08-30 20:23                   ` Takashi Iwai
@ 2010-08-30 20:58                     ` Keith Chew
  0 siblings, 0 replies; 15+ messages in thread
From: Keith Chew @ 2010-08-30 20:58 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, David Henningsson

>
> There are some restrictions for automatic parser.  The STAC/IDT
> parser supports dual headphones, but realtek one doesn't, so far.
> But, anyway 3 headphones are wrong.
>
> Note that by setting the pins to HP, you get the amp boost in the
> codec chip, but it doesn't mean it's better audio quality.  For
> line-outs, you shouldn't put such an amp usually.
>

I agree, the audio quality does sound a bit coarse compared to the
soundblaster's one. I have read the datasheet for both Realtek and SB,
and found the Realtek's maximum output voltage to be only 1.2Vrms,
where as the SB's one is 2Vrms. This explains why approx 60% of the SB
volume is the same as 100% volume on the ALC888. From the datasheet,
it also states the HP amp boost gives an extra 1Vrms, which also
confirms when I enable this, the volume is close to the SB's volume
(but the quality is not as good).

Thanks again for your input. I guess if I need to interface this
hardware with external speakers, I will need a better external
amplifier since the output voltage is lower.

Regards
Keith

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

end of thread, other threads:[~2010-08-30 20:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-25 19:45 5.1 surround on 3 jacks (retasking) Keith Chew
2010-08-25 23:31 ` David Henningsson
2010-08-26  6:35   ` Keith Chew
2010-08-26  6:56     ` David Henningsson
2010-08-26  7:16       ` Keith Chew
2010-08-26 23:19       ` Keith Chew
2010-08-28 14:11         ` Keith Chew
2010-08-28 14:55           ` David Henningsson
2010-08-28 15:08             ` Keith Chew
2010-08-30  7:51               ` Takashi Iwai
2010-08-30 19:45                 ` Keith Chew
2010-08-30 20:23                   ` Takashi Iwai
2010-08-30 20:58                     ` Keith Chew
2010-08-26  7:03 ` Raymond Yau
2010-08-26  7:22   ` Keith Chew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).