public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
* Template Based Coefficients Setting for Filters
@ 2011-08-09 12:33 Ashish Chavan
  2011-08-09 15:16 ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Ashish Chavan @ 2011-08-09 12:33 UTC (permalink / raw)
  To: alsa-devel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Template Based Coefficients Setting for Filters
  2011-08-09 12:33 Template Based Coefficients Setting for Filters Ashish Chavan
@ 2011-08-09 15:16 ` Mark Brown
  2011-08-09 17:19   ` Steve Calfee
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2011-08-09 15:16 UTC (permalink / raw)
  To: Ashish Chavan; +Cc: alsa-devel

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Template Based Coefficients Setting for Filters
  2011-08-09 15:16 ` Mark Brown
@ 2011-08-09 17:19   ` Steve Calfee
  2011-08-09 21:28     ` Johannes Stezenbach
  0 siblings, 1 reply; 7+ messages in thread
From: Steve Calfee @ 2011-08-09 17:19 UTC (permalink / raw)
  To: alsa-devel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Template Based Coefficients Setting for Filters
  2011-08-09 17:19   ` Steve Calfee
@ 2011-08-09 21:28     ` Johannes Stezenbach
  2011-08-09 23:33       ` Mark Brown
  2011-08-12  8:19       ` Ashish Chavan
  0 siblings, 2 replies; 7+ messages in thread
From: Johannes Stezenbach @ 2011-08-09 21:28 UTC (permalink / raw)
  To: Steve Calfee; +Cc: alsa-devel, Mark Brown, Ashish Chavan

(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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Template Based Coefficients Setting for Filters
  2011-08-09 21:28     ` Johannes Stezenbach
@ 2011-08-09 23:33       ` Mark Brown
  2011-08-10  6:17         ` Takashi Iwai
  2011-08-12  8:19       ` Ashish Chavan
  1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2011-08-09 23:33 UTC (permalink / raw)
  To: Johannes Stezenbach; +Cc: alsa-devel, Steve Calfee, Ashish Chavan

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Template Based Coefficients Setting for Filters
  2011-08-09 23:33       ` Mark Brown
@ 2011-08-10  6:17         ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2011-08-10  6:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Steve Calfee, alsa-devel, Ashish Chavan

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Template Based Coefficients Setting for Filters
  2011-08-09 21:28     ` Johannes Stezenbach
  2011-08-09 23:33       ` Mark Brown
@ 2011-08-12  8:19       ` Ashish Chavan
  1 sibling, 0 replies; 7+ messages in thread
From: Ashish Chavan @ 2011-08-12  8:19 UTC (permalink / raw)
  To: Johannes Stezenbach; +Cc: alsa-devel, Steve Calfee, Brown, Mark

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-12  8:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-09 12:33 Template Based Coefficients Setting for Filters Ashish Chavan
2011-08-09 15:16 ` Mark Brown
2011-08-09 17:19   ` Steve Calfee
2011-08-09 21:28     ` Johannes Stezenbach
2011-08-09 23:33       ` Mark Brown
2011-08-10  6:17         ` Takashi Iwai
2011-08-12  8:19       ` Ashish Chavan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox