From: Lars-Peter Clausen <lars@metafoo.de>
To: Songhee Baek <sbaek@nvidia.com>
Cc: Arun Shamanna Lakshmi <aruns@nvidia.com>,
"'lgirdwood@gmail.com'" <lgirdwood@gmail.com>,
"'broonie@kernel.org'" <broonie@kernel.org>,
"'swarren@wwwdotorg.org'" <swarren@wwwdotorg.org>,
"'alsa-devel@alsa-project.org'" <alsa-devel@alsa-project.org>,
"'tiwai@suse.de'" <tiwai@suse.de>,
"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>
Subject: Re: [alsa-devel] [PATCH] ASoC: Add support for multi register mux
Date: Sat, 29 Mar 2014 11:53:13 +0100 [thread overview]
Message-ID: <5336A619.5030007@metafoo.de> (raw)
In-Reply-To: <D6C615D3E4730340AE82D5BD856631C0A26CB31F48@HQMAIL02.nvidia.com>
On 03/29/2014 03:30 AM, Songhee Baek wrote:
>> -----Original Message-----
>> From: Songhee Baek
>> Sent: Friday, March 28, 2014 11:10 AM
>> To: 'Lars-Peter Clausen'
>> Cc: Arun Shamanna Lakshmi; 'lgirdwood@gmail.com'; 'broonie@kernel.org';
>> 'swarren@wwwdotorg.org'; '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
>>
>>
>>>> On 03/26/2014 11:41 PM, Songhee Baek 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?
>>>>>
>>>>> If we store the index of the bit, the value will be duplicated for
>>>>> each
>>>> registers inputs since register has 0 to 31bits to shift, then we
>>>> need to decode the index to interpret value for which registers to
>>>> set. If we need to interpret the decoded value of index, it is
>>>> better to have custom put/get function in our driver, isn't it?
>>>>>
>>>>
>>>> I'm not sure I understand. If you use (val / 32) to pick the
>>>> register and (val %
>>>> 32) to pick the bit in the register this should work just fine.
>>>> Maybe I'm missing something. Do you have a real world code example
>>>> of of the this type of enum is used?
>>>>
>>>
>>> I can use val/32 and val%32 for this multi register mux.
>>
> With this logic, put function would be easy however get function becomes tedious due to looping on each bit per register for 3 of them in our case. Rather, it would be easy to identify a unique MUX_OFFSET to distinguish between the 3
> registers as shown in the code below.
I'm not sure I understand how that MUX_OFFSET would work. To get the
selected mux output you can use the ffs instruction.
foreach(reg) {
reg_val = read(reg) & mask;
if (reg_val != 0) {
val = __ffs(reg_val);
break;
}
}
- Lars
next prev parent reply other threads:[~2014-03-29 10:52 UTC|newest]
Thread overview: 19+ 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 ` Songhee Baek
[not found] ` <5571431004A69147BCABABE4E097D66BA3EFF70CFC@HQMAIL02.nvidia.com>
2014-03-28 18:10 ` Songhee Baek
2014-03-29 2:30 ` Songhee Baek
2014-03-29 10:53 ` Lars-Peter Clausen [this message]
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 ` Arun Shamanna Lakshmi
2014-03-27 1:08 ` Mark Brown
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 ` 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=5336A619.5030007@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=aruns@nvidia.com \
--cc=broonie@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).