[alsa-devel] 5.1 surround on 3 jacks (retasking)
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
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:
- 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).
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
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".
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
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
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
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.
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
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
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
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
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
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:
- 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
participants (4)
-
David Henningsson
-
Keith Chew
-
Raymond Yau
-
Takashi Iwai