APQ8016 IIR Filter Configuration



“Stereo Connector and Audio Routing on DragonBoard 410c Application Note” (September 2016) lists, on page 16, two IIR filter blocks in a filter signal chain which take in {DEC1 DEC2 Rx1 Rx2 Rx3} into a mux, and outputs IIR1 or IIR2. These can then be routed through to the output signal path.

I have successfully used AlsaMixer to configure the signal routing and gain staging. I am unable to figure out how to configure the IIR filters.

I have three questions

  • What is the default configuration for the IIR filter block?
  • Where can i manipulate these filters?
  • Where does this processing take place (DSP or processor)?


for anyone interested, more info on this was found via IRC:

[11:09] dav: mainline wcd codec for 8016 does not support IIR filter configuration yet.
[11:10] dav: mainline codec does support the mux for this setup, Only thing that is missing is the mixer control for configuring the iir parameters
[11:11] dav: AFAIU it should be trivial to add IIR BAND setup mixers to the existing codec.
[11:12] how can i do that?
[11:12] dav: are you planning to use these filters or are you trying to just test audio?
[11:12] srinik: i am planning to use these filters to condition audio before it reaches our speakers
[11:14] dav: you would need to port this https://git.linaro.org/landing-teams/working/qualcomm/kernel.git/tree/sound/soc/codecs/msm8x16-wcd.c?h=caf/msm-3.18/LA.HB.1.1.1_rb4.5#n2329 to https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/codecs/msm8916-wcd-digital.c?h=v4.16-rc3


Hi @davabrams:

Sorry about the delay replying, I have been away for a week, although I did see this and I have asked the internal experts about the IIR filters, I don’t have a full response yet.

The IIR filters are dedicated hardware pipelines, they are not software running on the main processor, or on the DSP.

Other little tidbits I have found are

  1. The filters are 5 stage IIR filters
  2. the filters are intended for sidetone equalization.

The consequence of 1) is you probably couldn’t do a lot of equalization for your application since there is only 5 stages, but if you are doing a very simple equalization it may be enough.

I haven’t figured out all of the consequences if 2), but I fear that you may not be able to route anything other than the MIC into the IIR filters and the output can only be routed to the speakers.

Of course I am not 100% sure about any of this, I will keep you updated as I discover more about the IIR filters.

Other related news is we are really close to enabling user programs on the DSP. When this becomes available you will be able to write your own filtering, run it on the DSP, and do any equalization your desire.

Full disclosure: I am an employee of Qualcomm Canada, any opinions I have expressed in this or any other post may not reflect the opinions of my employer.


So I gave porting the IIR code from 3.18 to 4.14 a shot, and using the patch below populates mixer controls for both IIR1 and IIR2. However, I cannot tell if the levels applied to either of the IIR filters are actually doing anything.

Link to patch - https://gist.githubusercontent.com/RobGries/da32d3bddca5a5b3092f84a885435e55/raw/7b85f4dd4723046dfa26f5f269d619f9ee890545/0001-ported-iir-filters-from-3.18-kernel.-not-sure-if-thi.patch

I saw ljking’s post on the subject, and I was wondering how we should be routing the mic audio to the speakers? I was just wondering because I’d like to see it working since I think that I’ve ported it properly with this patch.