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
Quoted 4 lines · Ashish Chavan
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.
Quoted 9 lines · Mark Brown
Quoted 4 lines · Ashish Chavan
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
_BYTEScontrols 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,
Quoted 8 lines · Steve Calfee
Quoted 7 lines · Mark Brown
Quoted 4 lines · Ashish Chavan
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.
Quoted 7 lines
Quoted 2 lines
Use
_BYTEScontrols 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
_BYTEScontrols. 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
Quoted 8 lines · Johannes Stezenbach
Quoted 2 lines · Steve Calfee
Could you expand on this. Neither google or lxr found anything about
_BYTEScontrols. Where is it defined in the source?I've written a driver for ST32x, it will be in 3.1. My patch to use
_BYTEScontrols 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,
Quoted 4 lines · Mark Brown
Quoted 1 line · Johannes Stezenbach
On Tue, Aug 09, 2011 at 10:19:27AM -0700, Steve Calfee wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Could you expand on this. Neither google or lxr found anything about
_BYTEScontrols. Where is it defined in the source?I've written a driver for ST32x, it will be in 3.1. My patch to use
_BYTEScontrols 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
Quoted 4 lines · Johannes Stezenbach
I've written a driver for ST32x, it will be in 3.1. My patch to use
_BYTEScontrols 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