[alsa-devel] Template Based Coefficients Setting for Filters

Ashish Chavan ashish.chavan at kpitcummins.com
Tue Aug 9 14:33:56 CEST 2011

   I am working on updating ASoC codec driver for Dialog's DA7210 codec
(sound/soc/codec/da7210.c). This update would be a major functionality
update in nature. Currently, I am implementing support for GP (general
purpose) filters of this codec and need some opinions/comments.

Brief info about GP filters:

The additional general purpose (GP) filter engine offers up
to eight 2nd order biquad filter stages with freely
configurable 16 bit coefficients and supports flexible
digital audio routing and mixing arrangements.

This engine implements transfer function to derive Hz which uses five
coefficients, a1, a1, a2, b1 and b2. The coefficients are specified
as 16 bit twos-complement numbers. There are total eight blocks which
can be interconnected as per requirement. 

Total number of registers to configure = (5 * 2 * 8) = 80

The GP filters are mainly designed to be used for following modes,

(1) Stereo Playback
(2) Stereo Capture
(3) Capture with monitoring
(4) Spatializer mode
(5) Left-Sidetone filtering
(6) Right-Sidetone filtering
(7) Left-Right Sidetone filtering

Each of this mode requires different set of coefficients to be
programmed in to those 80 registers.

My idea of implementation:

I believe that it would be quite non practical(because of number of
controls required to do that) to provide individual control to set each
coefficient independently. What I am thinking is a virtual control named
something like, "GP Filter Mode Selection". It would offer above seven
options to user. On selection of any option, driver will populate that
set of 80 registers with predefined coefficients. It would be like
selecting one out of seven predefined templates.

(Apart from the coefficients part, some interconnections between these
blocks and IOs need to be done to achieve desired mode.)

Is this a good/valid way to handle this? Is there any alternative?


-- Ashish

More information about the Alsa-devel mailing list