Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Arun Shamanna Lakshmi <aruns@nvidia.com>,
	lgirdwood@gmail.com, swarren@wwwdotorg.org,
	Songhee Baek <sbaek@nvidia.com>,
	alsa-devel@alsa-project.org, tiwai@suse.de,
	linux-kernel@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH] ASoC: Add support for multi register mux
Date: Thu, 27 Mar 2014 01:08:52 +0000	[thread overview]
Message-ID: <20140327010852.GA30768@sirena.org.uk> (raw)
In-Reply-To: <53332CC7.6060800@metafoo.de>

[-- Attachment #1: Type: text/plain, Size: 2261 bytes --]

On Wed, Mar 26, 2014 at 08:38:47PM +0100, Lars-Peter Clausen wrote:
> On 03/26/2014 01:02 AM, Arun Shamanna Lakshmi wrote:

> The way you describe this it seems to me that a value array for this kind of
> mux would look like.

> 0x00000000, 0x00000000, 0x00000001
> 0x00000000, 0x00000000, 0x00000002
> 0x00000000, 0x00000000, 0x00000003
> 0x00000000, 0x00000000, 0x00000004
> 0x00000000, 0x00000000, 0x00000008

> That seems to be extremely tedious. If the MUX uses a one hot encoding how
> about storing the index of the bit in the values array and use (1 << value)
> when writing the value to the register?

Or hide it behind utility macros at any rate; I've got this horrible
feeling that as soon as we have this people will notice that they have
more standard enums that are splatted over multiple registers (I think
from memory I've seen them but they got fudged).

> [...]
> >  /* enumerated kcontrol */
> >  struct soc_enum {

> There doesn't actually be any code that is shared between normal enums and
> wide enums. This patch doubles the size of the soc_enum struct, how about
> having a separate struct for wide enums?

Or if they are going to share the same struct then they shouldn't be
duplicating the code and instead keying off num_regs (which was my first
thought earlier on when I saw the separate functions).  We definitely
shouldn't be sharing the data without also sharing the code I think.

> >-	int reg;
> >+	int reg[SOC_ENUM_MAX_REGS];
> >  	unsigned char shift_l;
> >  	unsigned char shift_r;
> >  	unsigned int items;
> >-	unsigned int mask;
> >+	unsigned int mask[SOC_ENUM_MAX_REGS];

> If you make mask and reg pointers instead of arrays this should be much more
> flexible and not be limited to 3 registers.

Right, which pushes towards not sharing.  Though with an arrayified mask
the specification by shift syntax would get to be slightly obscure (is
it relative to the enums or the registers?) so perhaps we don't want to
do that at all if we've got specification by shift.  If we do that then
we could get away with a variable length array at the end of the struct
though I think that may be painful for the static declarations.  Someone
would need to look to see what works

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2014-03-27  1:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26  0:02 [PATCH] ASoC: Add support for multi register mux Arun Shamanna Lakshmi
2014-03-26 19:38 ` [alsa-devel] " Lars-Peter Clausen
2014-03-26 22:41   ` Songhee Baek
2014-03-27  9:19     ` Lars-Peter Clausen
2014-03-27 18:24       ` [alsa-devel] " Songhee Baek
     [not found]       ` <5571431004A69147BCABABE4E097D66BA3EFF70CFC@HQMAIL02.nvidia.com>
2014-03-28 18:10         ` Songhee Baek
2014-03-29  2:30         ` [alsa-devel] " Songhee Baek
2014-03-29 10:53           ` Lars-Peter Clausen
2014-03-30  6:12             ` Arun Shamanna Lakshmi
2014-03-31 11:21               ` Mark Brown
2014-03-31 11:55                 ` Lars-Peter Clausen
2014-03-31 12:07                   ` Mark Brown
2014-04-01  6:08                     ` [alsa-devel] " Arun Shamanna Lakshmi
2014-03-27  1:08   ` Mark Brown [this message]
2014-03-27  4:33     ` Songhee Baek
2014-03-27  1:29 ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2014-03-18 23:51 Arun Shamanna Lakshmi
2014-03-18 23:59 ` Mark Brown
2014-03-19 23:44   ` Arun Shamanna Lakshmi
2014-03-20 11:48     ` Mark Brown
2014-03-20 18:20       ` Stephen Warren
2014-03-20 18:36         ` Mark Brown
2014-03-20 19:05           ` [alsa-devel] " Lars-Peter Clausen
2014-03-20 19:40             ` Lars-Peter Clausen
2014-03-21 11:37               ` [alsa-devel] " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140327010852.GA30768@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=aruns@nvidia.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sbaek@nvidia.com \
    --cc=swarren@wwwdotorg.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox