Hardware Mod - Add Optical Output to Realtek HD Audio Codec (Acer R3600)
#1
Hardware Mod - Add Optical Output to Realtek HD Audio Codec (Acer R3600)

An optical output connector (aka TOSLINK or optical S/PDIF output) is useful even with HDMI and the advanced bitstream audio formats. Some platforms don't have this output option and I figured out how to add one. I hope the following might be useful to someone else or inspire some other projects.

The Project:
I have been using a system running XBMC and running HDMI to a display that has an optical output. Unfortunately the optical output on the TV does not support decoding (or pass-through) of DTS or DD. The system itself has a stereo analog audio output jack but no optical S/PDIF output so I cannot plug it directly into my receiver. I wanted to see if it is possible to make the modification. It turns out that it is definitely possible. Some photos of the work done on the R3600 are at the end of this post.

The main 'tasks' are:
A) Determine which audio chipset is used in the system and look up the data.
B) Determine if it is possible and how to add the S/PDIF optical output.
C) Add the hardware.
D) Configure software.

NOTE: While likely to work, it is entirely possible that the system will be damaged by trying to apply this modification. I've done this once on the specific system listed here. Any changes like this will make the manufacturer's warranty will be void. I want to provide this information for the curious and DIY-type folks but want to make you aware that it may not be complete or accurate for all scenarios and it is possible to follow exactly and still cause problems. For this reason I cannot be responsible for any issues, damage, etc that might arise. This mod does require some disassembly, assembly, soldering skills and a steady hand. If you do not feel comfortable with this then maybe you'll want to find someone to help.


A) Determining which audio chipset is used in the system (and looking up the data)
The easiest way to determine this information is to look at the operating system installed (Linux, Windows, etc) and determine which chipset is built into the system. Most systems will carry a Realtek HDA codec of some sort. In the case of the R3600 this is a Realtek RLC662.

An alternate method is to find the chipset on the board and read the part number. You'll need to know what circuitry (if any) is connected to the pin before being able to know for sure you can add a S/PDIF output so this is my preferred method.

Once the chipset is determined, go find the datasheet. In this case I found the datasheet and reference design schematic on Realtek's website (link) by navigating 'Downloads' --> 'Computer Peripheral ICs' --> 'Reference Designs'. This is the manufacturer's recommendation of how to use their chipset so, barring any errors, it should be reasonably sane. The reference design indicates that the optical transmitter can be added without any additional components. Fortunately Realtek chips are used in many on-board sound implementations so this will probably nail most.


B) How to add the optical output?
Optical output transmitters are three-pin devices. One pin is connected to Vcc (typically +5VDC), one pin is Ground, one pin is TxData. The TxData pin accepts a logic-level bitstream. Old/Broken DVD players are a good source for these devices.

Depending on the board design it might be possible to add the optical output easily. For example, there might be an empty location for the transmitter on the board somewhere. Sometimes manufacturers have more than one model of a given board and they add/remove features. Note that there might be other components missing even if there is a location to install the connector so it makes sense to trace the circuit back to the HD audio codec.

If you have not already looked at the board you plan on modifying, now would be a good time to do so. Find the audio codec and note the following:
- if there is any circuitry connected to the pin already.
- if the pin is accessible.
- if the pin is pulled or tied low or high - if so, you might need to change this.
- if there might be any other challenges doing the modification.

Based on these answers you may find that it will be more difficult to add the output than it was in my case. For example, if there is already circuitry on the pin then I strongly suggest doing some research and finding a reference design if at all possible. No sense is moving forward if the plan might fail.

Sources of +5VDC and ground should be fairly easy to find. The best source is a USB port - or the solder points on the USB port connector. I chose to pull this from one of the USB ports because it is easy to access, is fused (if the board is designed properly), and the optical transmitter consumes so little power that it should not affect the current available for a USB device connected to the port. Find a location that is close to where you plan on installing the optical output connector.

In the case of the R3600 adding the optical output hardware is as simple as finding the output of the HD audio codec, finding +5VDC and GROUND and connecting these three signals to the optical transmitter. Conveniently there was a USB port in the location I decided to install the new connector so I pulled out the USB and reused the power supply there. This may or may not work for you.


C) Perform the hardware modification to add the optical output
1) Unplug the system. Open the system. For the R3600:
- Remove WLAN antennas,
- Remove USB/power LED board
- Remove 3 screws from cooling fan,
- Remove 4 screws and springs from heatsink assembly, set aside.
- Remove 4 screws from mainboard.
- Lift out mainboard.

2) Find the HD Audio codec (Realtek audio chip)

3) Determine which pin is S/PDIF output based on the datasheet.

4) Solder a length of fine wire (suggest using wire wrap wire) to the pin and tack down with hot glue to ensure the wire stays in place.

5) Connect a wire for +5VDC and ground to power the optical transmitter.

6) Connect the optical transmitter. Verify the pinout against the datasheet for the transmitter to ensure proper polarity.

7) Do any necessary chassis mods to physically install the optical transmitter. I reused one of the USB port locations on the R3600 because it was the only place that I could find to expose the connector without interfering with other cables.

8) Reassemble the system.


D) Software Changes
There is great information available online regarding HD audio and configuring the devices. I've included some interesting links to information I read to understand how things worked (thank you!)

Intel HD Audio Specification (google)
ALSA HD-Audio.txt
hda-jack-retask README
A Smackerel of Opinion: Poking around the HD-Audio Configuration
http://voices.canonical.com/david.hennin...echniques/

At a very high level view:
The system BIOS configures the input/output pins of the HD audio codec during POST. The pin configuration 'verbs' contain information such as pin type (headphone, mic in, rear surround, etc), colour, location (front, rear), and so forth. These configurations can be read by audio drivers in the operating system to determine what the codec supports and make the necessary changes to the GUI, mixer controls, etc.
It follows that, if a mainboard is designed without a S/PDIF connector, then it the BIOS will configure this pin to be 'not connected' and therefore the audio driver will not expose this functionality as was the case with the R3600. This means the software side of things can be a bit of a research project.

Here is how I determined what was needed to make the new optical output connector function:

First I determined which HDA codec is the Realtek audio device in the following location. The HDA codecs are enumerated here.
Code:
/sys/class/sound/hwC0Dx
      where 'x' is the number on the codec bus.

In the case of R3600, the Realtek 662 is on 'hwC0D0'. An example output from my system is as follows:
Code:
tv@XBMC-REVO:/sys/class/sound/hwC0D0$ cat {vendor_name,chip_name,vendor_id}
Realtek
ALC662 rev1
0x10ec0662

Inside the '/sys/class/sound/hwC0D0' folder you can view specific files to determine the current pin configuration information.
Code:
cat init_pin_configs  will show the BIOS default pin configurations
cat user_pin_configs  will show pin configs that over-ride the driver and BIOS.
'user_pin_configs' will be blank by default - obviously nothing applied.. yet. The original configuration from the BIOS is:

Code:
0x14 0x01214010
0x15 0x99130120
0x16 0x411111f0
0x18 0x01a19830
0x19 0x411111f0
0x1a 0x411111f0
0x1b 0x411111f0
0x1c 0x411111f0
0x1d 0x40020601
0x1e 0x411111f0

The 'hda-jack-retask' tool can be used to play with the pin configurations, including enabling and configuring pins that are listed as 'not connected' by the BIOS. It makes changes to 'user_pin_configs' which can be viewed with the command above.

I used a Ubuntu Live USB to boot the system, grabbed the tool with apt, and ran the tool to determine if/what the updated pin_config needed to be to get audio over the optical output. Note that you'll need to add a new repository to install 'hda-jack-retask':

Code:
apt-add-repository ppa:diwic/hda
apt-update

When the tool runs it presents a list of codecs and the enabled/presented pins. Make sure the correct codec is selected and enable display of 'not connected' pins. In the case of R3600 there are a number of pins that are listed as not connected but only one reports the option of S/PDIF output. Make note of the node value (Ex: 0x1e). Make changes to the configuration to enable the pin and then 'Apply Now'.

Once applied you can use 'amixer scontrols' to view the "simple" controls available to ALSA. In theory you should see a new control relating to the optical output. In the case of R3600, this was "IEC958,1". It may be best to compare before and after enabling the pin in hda-jack-retask.

If the new mixer control is present, ensure it is un-muted using 'amixer' or 'alsamixer'. If un-muted, the optical output should light up, be active, and play audio if configured. You can (and should) test this now. If it does not light up, time to troubleshoot and experiment to determine the cause.

Once the output is confirmed to be working, look at the 'user_pin_configs' via terminal and see what was written for the node.

Based on the results from the R3600, here is what 'user_pin_configs' reported:
Code:
0x14 0x01214010
0x15 0x99130120
0x16 0x411111f0
0x18 0x01a19830
0x19 0x411111f0
0x1a 0x411111f0
0x1b 0x411111f0
0x1c 0x411111f0
0x1d 0x40020601
0x1e 0x014b1180

Therefore we have determined pin config verb is '0x1e' and the value '0x014b1180' can be used to enable S/PDIF output. The ALSA documentation states that this change can be made by using echo to update 'user_pin_configs' followed by echoing some value to 'reconfig'. In my example:

Code:
# echo 0x1e 0x014b1180 > /sys/class/sound/hwC0Dx/user_pin_configs
# echo 1 > /sys/class/sound/hwC0Dx/reconfig

In addition you'll need to make sure the S/PDIF output is unmuted. The following command un-mutes the appropriate output on R3600 (based on the 'simple' mixer control listed eariler):

Code:
$ amixer set 'IEC958',1 unmute

These changes are volatile and therefore will not persist after a reboot. I added a script to rc2.d on my system to reinitialize the HDA codec automatically:

Code:
$ cat /etc/init.d/RealtekSPDIFConfig.sh
#! /bin/sh

echo 0x14 0x01214010 > /sys/class/sound/hwC0D0/user_pin_configs
echo 0x15 0x99130120 > /sys/class/sound/hwC0D0/user_pin_configs
echo 0x16 0x411111f0 > /sys/class/sound/hwC0D0/user_pin_configs
echo 0x18 0x01a19830 > /sys/class/sound/hwC0D0/user_pin_configs
echo 0x19 0x411111f0 > /sys/class/sound/hwC0D0/user_pin_configs
echo 0x1a 0x411111f0 > /sys/class/sound/hwC0D0/user_pin_configs
echo 0x1b 0x411111f0 > /sys/class/sound/hwC0D0/user_pin_configs
echo 0x1c 0x411111f0 > /sys/class/sound/hwC0D0/user_pin_configs
echo 0x1d 0x40020601 > /sys/class/sound/hwC0D0/user_pin_configs
echo 0x1e 0x014b1180 > /sys/class/sound/hwC0D0/user_pin_configs

echo 1 > /sys/class/sound/hwC0D0/reconfig

amixer set 'IEC958',1 unmute

and adding a link as follows:
Code:
$ sudo ln -s /etc/init.d/RealtekSPDIFConfig.sh ./S21RealtekConfig

If all goes well you should have an optical output configured on every boot. In XBMC you will need to configure the audio output device as the optical output in the method as any other system.


Photos of Hardware Modification:
watch gallery
Reply
#2
(2013-04-02, 02:31)lostmandan Wrote: Hardware Mod - Add Optical Output to Realtek HD Audio Codec (Acer R3600)
Your post is great! unfortunely i foun it too late...
But...maybe someone else read this olt thread too.

Can you or someone else help with same thing but for Windows?
Or maybe Bios mod?
Reply
#3
talk about necro posting, this one's mummified it's so old....
Quote:Can you or someone else help with same thing but for Windows?
this person did a hardware hack and used custom drivers for linux along with alsamixer neither of which work on windows and i dont know how you expect to hardware hack windows either
not to mention sp/dif doesnt support modern formats plus the ones it didnt support 10 years ago
youre better off with hdmi passthrough for dts/dtshd/dd/truehd/dolby atmos because the only thing left is aac+ac3 which isnt a benefit from all this work
Reply
#4
(2023-03-04, 02:38)jepsizofye Wrote: talk about necro posting, this one's mummified it's so old....
Quote:Can you or someone else help with same thing but for Windows?
this person did a hardware hack and used custom drivers for linux along with alsamixer neither of which work on windows and i dont know how you expect to hardware hack windows either
not to mention sp/dif doesnt support modern formats plus the ones it didnt support 10 years ago
youre better off with hdmi passthrough for dts/dtshd/dd/truehd/dolby atmos because the only thing left is aac+ac3 which isnt a benefit from all this work

No and no, actualy.
First.
Please do not combine hardware and software hack.Harware. It is simplest. You just need solder few wired. ALL chip with old an new MoBo have requred PINout. Thats All!
Second.
They dont use patched driver exactly. He used JackRetaskTool. Same features have all windows driver and control panel. But they dont have option to activate some Disabled JAck.

Also about HDMI.
HDMI have some problem. And i also cant find DTS Interactive for it. only Dolby Digital Live.
If you have some usefull information a glad to lisent!

and at last....some post
Some topics do not lose their relevance even after 10 years. It's strange to me that no one feedbacked. Apparently because it was about Linux.
Reply
#5
nah youre asking a generic question how to apply an entire post that includes hardware hacks "to windows" which i find rather meh
i might have received it better had you showed your work and asked how to apply a particular section to windows <version x>

this post is in regards to sp/dif which has lost its relevance and being 10 years old who knows what irrelevant version of linux and versions of utilities

so while this archived post is intriguing, unless youre using irrelevant hardware and software, it is actually irrelevant in 2023
Reply
#6
(2023-03-04, 17:36)jepsizofye Wrote: so while this archived post is intriguing, unless youre using irrelevant hardware and software, it is actually irrelevant in 2023

Do you have any technical answer, raised by me? Because if not, then it looks like this. You do not need it and are not interested, and for some reason you are trying to say that no one needs it. Do not do it this way.
Reply
#7
(2013-04-02, 02:31)lostmandan Wrote: Hardware Mod - Add Optical Output to Realtek HD Audio Codec
I made my own hack and it WORK.
But... ist strange... ONLY 44.1 HZ PCM work. No one else just not passtrouhg.... and unfortunaly DTS and Dolby Digital (wich is actualy necessery for me) does't work...
Author not described his expericne detalied...
Litle chance that he answer to me... However i ask. Also maybe someone made  same.
Reply

Logout Mark Read Team Forum Stats Members Help
Hardware Mod - Add Optical Output to Realtek HD Audio Codec (Acer R3600)0