This is to run stock 4.2.2/.33 or lower radio and not have audio issues.
Well after working a 10 hour day at a start-up, I came home and spent another 6 hours debugging our no in-call audio issue. This issue is specific to T-mobile USA customers with a certain N4 configuration. I'll explain it, only because some people will stumble upon this post and won't use the SEARCH!
You'll experience no audio during a call. No audio in the earpiece and no audio going in the mic. This is when you have:
Stock 4.2.2 (It's possible that it works on other roms that have this issue as well. Not sure.)
Either RIL file that is available. (doesn't matter)
Either bootloader (also doesn't matter)
.33 radio or lower
As I mentioned in a prior post, Google changed the sound table file for 4.2.2. This may have been to anger us but I feel like they were trying to enable an audio channel for the new HD calling or whatever. Not sure. Anyway, I verified that these entries are not in AOKP roms and that must be our issue. 4.2.2 radio has some kind of symbolic linking that matches that file and when we install .33, the rom expects that TMUS audio entry to be there and it's not. Any attempt to edit out those entries or use a straight AOKP file would cause a stuck boot animation and I'd have to do a restore...
I spent the last 6 hours tracing where each audio address was hooking too. As well as running logs to see what was going on. In a nutshell, all the audio triggers were reversed because of bad addressing. When you made a call, it would actually DISABLE mic and ear speaker audio! I didn't know how to remedy this as I didn't understand the audio "calibration database" system. So I studied it a bit and I wished I had earlier. The pattern I saw was that the main entity in a group has a set address. Something like 3:1. If any others fit in that main group, they also get 3:1. In the case of audio, think loudspeaker or loudspeaker with "dolby". Both are basically the same, so they can share the upper ranks. So imagine a loudspeaker that is much smaller and takes a different voltage, etc. That would be labeled in the next group of 6:1. So from what I saw, they basically doubled like that pretty often.
Without any further interruptions. The fix!
Your gonna need a root file manager. I like ES file explorer. It'll need to have root access enabled in the settings. You'll also need a text editor. You can use ES built in one but it really sucks. I use 920 text editor. Both those are free apps people. Do a backup before you start this as I had lots of booting issues trying to work this one out.
Now open ES (or other file manager) and navigate to root "/" on your phone. Click on the etc folder and then the snd_soc-msm folder. There will only be one file in there, snd_soc_msm_2x_Fusion3. Do whatever you have to do to change file permissions on that file. In ES, you hold down on file and go down until it brings up a box. Scroll down to the bottom and go to properties. It'll bring up the permissions. Click on the "change" box. Note it's default properties. Write them down if you have to! Now click all the check boxes. Make it a really open file! Then hit OK and go back to the directory. Click on file to open. An "Open As" box will pop up. Open as text in your 920 or whatever your app is.
You'll see the long ass Fusion3 file outlining all sound properties of your device. Were interested in changing line 1804 and 2736. If you have a good text editor, these will be listed on the left. Scroll down to line 1804 and you'll see the ACDBID or audio calibration database ID. Like this...
Modify /snd_soc_msm_2x_Fusion3 diff
1778 1778 ACDBID 7:1
1780 + EndSection
1782 + SectionDevice
1783 + Name "Voice Earpiece TMUS"
1784 + Comment "Handset Rx device"
1786 + EnableSequence
1787 + 'SLIM_0_RX Channels':0:eek:ne
1788 + 'RX1 MIX1 INP1':0:RX1
1789 + 'RX1 MIX1 INP2':0:RX6
1790 + 'RX1 Digital Volume':1:68
1791 + 'EAR PA Gain':0:POS_6_DB
1792 + 'DAC1 Switch':1:1
1793 + 'SLIM TX3 MUX':0:RMIX1
1794 + EndSequence
1796 + DisableSequence
1797 + 'RX1 MIX1 INP1':0:ZERO
1798 + 'RX1 MIX1 INP2':0:ZERO
1799 + 'RX1 Digital Volume':1:68
1800 + 'DAC1 Switch':1:0
1801 + 'SLIM TX3 MUX':0:ZERO
1802 + EndSequence
1804 + ACDBID 81:1
1780 1806 EndSection
1782 1808 SectionDevice
2320 2346 EffectsMixerCTL "SRS TruMedia"
2322 2348 EndSection
2323 2350 SectionDevice
2324 2351 Name "HeadsetVM Tx"
2325 2352 Comment "Headset Tx device"
2669 2696 ACDBID 6:2
2670 2697 EffectsMixerCTL "SRS TruMedia"
2699 + EndSection
2701 + SectionDevice
2702 + Name "DMIC Endfire TMUS"
2703 + Comment "Dual MIC Endfire Tx device"
2705 + EnableSequence
2706 + 'SLIM TX7 MUX':0:DEC7
2707 + 'DEC7 MUX':0:ADC1
2708 + 'SLIM TX8 MUX':0:DEC9
2709 + 'DEC9 MUX':0:ADC3
2710 + 'DEC7 Volume':1:66
2711 + 'ADC1 Volume':1:100
2712 + 'DEC9 Volume':1:66
2713 + 'ADC3 Volume':1:100
2714 + 'SLIM_0_TX Channels':0:Two
2715 + 'MICBIAS1 CAPLESS Switch':1:0
2716 + 'RX1 MIX2 INP1':0:IIR1
2717 + 'RX2 MIX2 INP1':0:IIR1
2718 + 'IIR1 INP1 Volume':1:51
2719 + 'IIR1 INP1 MUX':0:DEC7
2720 + EndSequence
2722 + DisableSequence
2723 + 'DEC7 Volume':1:60
2724 + 'DEC9 Volume':1:60
2725 + 'SLIM TX7 MUX':0:ZERO
2726 + 'DEC7 MUX':0:ZERO
2727 + 'SLIM TX8 MUX':0:ZERO
2728 + 'DEC9 MUX':0:ZERO
2729 + 'MICBIAS1 CAPLESS Switch':1:1
2730 + 'RX1 MIX2 INP1':0:ZERO
2731 + 'RX2 MIX2 INP1':0:ZERO
2732 + 'IIR1 INP1 Volume':1:0
2733 + 'IIR1 INP1 MUX':0:ZERO
2734 + EndSequence
2736 + ACDBID 91:2
2737 + EffectsMixerCTL "SRS TruMedia"
2672 2739 EndSection
2674 2741 SectionDevice
Now go to the properties of your new file and change the permissions back to the original default settings. This is very important. If left unprotected, someone could control any audio settings at will. This includes your microphone. Not cool.
Last but not least, reboot.
Don't forget to backup before starting procedure.
I'm not responsible for dead puppies or bricked phones.
etc. etc. etc.
Forgive any 3am grammar mistakes and enjoy your stock/TM-US/LTE! =)