[alsa-devel] Template Based Coefficients Setting for Filters
Hi, 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?
Thanks,
-- Ashish
On Tue, Aug 09, 2011 at 06:03:56PM +0530, Ashish Chavan wrote:
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.
Use _BYTES controls for this. There are no existing users in ASoC, though there should be shortly and there are generic ALSA examples.
On 08/09/11 08:16, Mark Brown wrote:
On Tue, Aug 09, 2011 at 06:03:56PM +0530, Ashish Chavan wrote:
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.
Use _BYTES controls for this. There are no existing users in ASoC, though there should be shortly and there are generic ALSA examples.
Hi Mark,
Could you expand on this. Neither google or lxr found anything about _BYTES controls. Where is it defined in the source?
Regards, Steve
(add back Cc:s)
Hi Steve,
On Tue, Aug 09, 2011 at 10:19:27AM -0700, Steve Calfee wrote:
On 08/09/11 08:16, Mark Brown wrote:
On Tue, Aug 09, 2011 at 06:03:56PM +0530, Ashish Chavan wrote:
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.
Use _BYTES controls for this. There are no existing users in ASoC, though there should be shortly and there are generic ALSA examples.
Hi Mark,
Could you expand on this. Neither google or lxr found anything about _BYTES controls. Where is it defined in the source?
I've written a driver for ST32x, it will be in 3.1. My patch to use _BYTES controls were posted here not long ago, see http://thread.gmane.org/gmane.linux.alsa.devel/87063
HTH Johannes
On Tue, Aug 09, 2011 at 11:28:24PM +0200, Johannes Stezenbach wrote:
On Tue, Aug 09, 2011 at 10:19:27AM -0700, Steve Calfee wrote:
Could you expand on this. Neither google or lxr found anything about _BYTES controls. Where is it defined in the source?
I've written a driver for ST32x, it will be in 3.1. My patch to use _BYTES controls were posted here not long ago, see http://thread.gmane.org/gmane.linux.alsa.devel/87063
$ grep _BYTES include/sound/*.h sound/core/*.c
At Wed, 10 Aug 2011 08:33:58 +0900, Mark Brown wrote:
On Tue, Aug 09, 2011 at 11:28:24PM +0200, Johannes Stezenbach wrote:
On Tue, Aug 09, 2011 at 10:19:27AM -0700, Steve Calfee wrote:
Could you expand on this. Neither google or lxr found anything about _BYTES controls. Where is it defined in the source?
I've written a driver for ST32x, it will be in 3.1. My patch to use _BYTES controls were posted here not long ago, see http://thread.gmane.org/gmane.linux.alsa.devel/87063
$ grep _BYTES include/sound/*.h sound/core/*.c
Better use the power of git :)
% git grep SNDRV_CTL_ELEM_TYPE_BYTES include/sound/asound.h:#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ct sound/core/control.c: case SNDRV_CTL_ELEM_TYPE_BYTES: sound/core/control_compat.c: case SNDRV_CTL_ELEM_TYPE_BYTES: sound/i2c/cs8427.c: uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; sound/i2c/other/ak4113.c: uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; sound/i2c/other/ak4114.c: uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; sound/i2c/other/ak4117.c: uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; sound/pci/ice1712/aureon.c: uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; sound/pci/ice1712/ice1712.c: uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; sound/pci/ice1712/ice1724.c: uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; sound/soc/codecs/sta32x.c: uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
Takashi
On Tue, 2011-08-09 at 23:28 +0200, Johannes Stezenbach wrote:
I've written a driver for ST32x, it will be in 3.1. My patch to use _BYTES controls were posted here not long ago, see http://thread.gmane.org/gmane.linux.alsa.devel/87063
Thanks for point the patch. It really helped.
Any idea about how this type of controls are used-via/represented-in alsamixer?
-- Ashish
participants (5)
-
Ashish Chavan
-
Johannes Stezenbach
-
Mark Brown
-
Steve Calfee
-
Takashi Iwai