Hello!
I have been working on getting the Sidetone (loopback) working for the APQ8016. I started by using a patch that I found on this forum. Then I looked through the actual android source, I moved all the code over and the code did not work as expected. I had a ton of issues with setting the IIR coefficients so I simplified the code using what I had from the android source. Using the Processor register description document, I found the register values that the registers needed to be I set to and set them.
After doing this the sidetone worked… for about four seconds after every time you do play an audio file. I read through the Processor register description document and read about some digital mute stuff and I played with that. That still did not give me the results I expected.
I created a patch with all the ported and changed code that I use to get the 4 second loop. My application does not use the ADV7533 HDMI chip so the patch also removed all of that in the device tree.
To repeat my results you need to:
Set up alsa and you do so with these instructions:
amixer -c 0 cset iface=MIXER,name=‘RX1 MIX1 INP1’ ‘RX1’
amixer -c 0 cset iface=MIXER,name=‘RX1 MIX2 INP1’ ‘IIR1’
amixer -c 0 cset iface=MIXER,name=‘RX2 MIX1 INP1’ ‘RX2’
amixer -c 0 cset iface=MIXER,name=‘RX2 MIX2 INP1’ ‘IIR1’
amixer -c 0 cset iface=MIXER,name=‘RDAC2 MUX’ ‘RX2’
amixer -c 0 cset iface=MIXER,name=‘HPHL’ 1
amixer -c 0 cset iface=MIXER,name=‘HPHR’ 1
amixer -c 0 cset iface=MIXER,name=‘RX1 Digital Volume’ 100
amixer -c 0 cset iface=MIXER,name=‘RX2 Digital Volume’ 100
amixer -c 0 cset iface=MIXER,name=‘DEC1 MUX’ ‘ADC2’
amixer -c 0 cset iface=MIXER,name=‘ADC2 Volume’ 70
amixer -c 0 cset iface=MIXER,name=‘ADC2 MUX’ ‘INP2’
amixer -c 0 cset iface=MIXER,name=‘RX1 MIX1 INP1’ ‘RX1’
amixer -c 0 cset iface=MIXER,name=‘IIR1 INP1 MUX’ ‘DEC1’
amixer -c 0 cset iface=MIXER,name=‘IIR2 INP1 MUX’ ‘DEC1’
amixer -c 0 cset iface=MIXER,name=‘SIDETONE Set’ 1
Then you will have to record an audio file:
arecord -D plughw:0,1 -r 16000 -f S16_LE test.wav
followed by playing a file:
aplay test.wav
Then you will hear the sidetone on this record:
arecord -D plughw:0,1 -r 16000 -f S16_LE test.wav
At this point I am a little lost and anything will help! I linked the patch (https://github.com/jessiepullaro414/SidetonePatch4.14). It is not that best code but its just to see the feature work. Thank you for your help and time!