From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org,
gregkh@linuxfoundation.org,
Bard liao <yung-chuan.liao@linux.intel.com>,
Rander Wang <rander.wang@linux.intel.com>,
Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Sanyog Kale <sanyog.r.kale@intel.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] soundwire: SDCA: add helper macro to access controls
Date: Fri, 11 Sep 2020 09:50:54 -0500 [thread overview]
Message-ID: <21606609-8aaf-c7b2-ffaf-c7d37de1fa3f@linux.intel.com> (raw)
In-Reply-To: <20200911070649.GU77521@vkoul-mobl>
Hi Vinod,
>>>>>>>> + * 25 0 (Reserved)
>>>>>>>> + * 24:22 Function Number [2:0]
>>>>>>>> + * 21 Entity[6]
>>>>>>>> + * 20:19 Control Selector[5:4]
>>>>>>>> + * 18 0 (Reserved)
>>>>>>>> + * 17:15 Control Number[5:3]
>>>>>>>> + * 14 Next
>>>>>>>> + * 13 MBQ
>>>>>>>> + * 12:7 Entity[5:0]
>>>>>>>> + * 6:3 Control Selector[3:0]
>>>>>>>> + * 2:0 Control Number[2:0]
[...]
>>>>
>>>> #define SDCA_CONTROL_DEST_MASK1 GENMASK(20, 19)
>>>> #define SDCA_CONTROL_ORIG_MASK1 GENMASK(5, 4)
>>>> #define SDCA_CONTROL_DEST_MASK2 GENMASK(6, 3)
>>>> #define SDCA_CONTROL_ORIG_MASK2 GENMASK(3, 0)
>
> I think I missed ORIG and DEST stuff, what does this mean here?
If you missed this, it means my explanations are not good enough and I
need to make it clearer in the commit log/documentation. Point taken,
I'll improve this for the next version.
> Relooking at the bit definition, for example 'Control Number' is defined
> in both 17:15 as well as 2:0, why is that. Is it split?
>
> How does one program a control number into this?
A Control Number is represented on 6 bits.
See the documentation above.
17:15 Control Selector[5:3]
2:0 Control Selector[2:0]
The 3 MSBs for into bits 17:15 of the address, and the 3 LSBs into bits
2:0 of the address. The second part is simpler for Control Number but
for entities and control selectors the LSB positions don't match.
Yes it's convoluted but it was well-intended: in most cases, there is a
limited number of entities, control selectors, channel numbers, and
putting the LSBs together in the 16-LSB of the address helps avoid
reprogramming paging registers: all the addresses for a given function
typically map into the same page.
That said, I am not sure the optimization is that great in the end,
because we end-up having to play with bits for each address. Fewer
changes of the paging registers but tons of operations in the core.
I wasn't around when this mapping was defined, and it is what is is now.
There's hardware built based on this formula so we have to make it work.
Does this clarify the usage?
If you have a better suggestion that the FIELD_PREP/FIELD_GET use, I am
all ears. At the end of the day, the mapping is pre-defined and we don't
have any degree of freedom. What I do want is that this macro/inline
function is shared by all codec drivers so that we don't have different
interpretations of how the address is constructed.
Thanks,
-Pierre
next prev parent reply other threads:[~2020-09-11 16:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200901162225.33343-1-pierre-louis.bossart@linux.intel.com>
2020-09-01 16:22 ` [PATCH v2 1/3] regmap: sdw: add required header files Pierre-Louis Bossart
2020-09-01 16:22 ` [PATCH v2 2/3] soundwire: SDCA: add helper macro to access controls Pierre-Louis Bossart
2020-09-04 5:02 ` Vinod Koul
2020-09-08 13:33 ` Pierre-Louis Bossart
2020-09-09 7:55 ` Vinod Koul
[not found] ` <184867c2-9f0c-bffe-2eb7-e9c5735614b0@linux.intel.com>
2020-09-10 6:22 ` Vinod Koul
[not found] ` <adf51127-2813-cdf0-e5a6-f5ec3b0d33fa@linux.intel.com>
2020-09-11 7:06 ` Vinod Koul
2020-09-11 14:50 ` Pierre-Louis Bossart [this message]
2020-09-14 5:08 ` Vinod Koul
2020-09-14 14:44 ` Pierre-Louis Bossart
2020-09-16 12:35 ` Vinod Koul
2020-09-16 13:11 ` Pierre-Louis Bossart
2020-09-01 16:22 ` [PATCH v2 3/3] regmap: sdw: add support for SoundWire 1.2 MBQ Pierre-Louis Bossart
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=21606609-8aaf-c7b2-ffaf-c7d37de1fa3f@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=guennadi.liakhovetski@linux.intel.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rander.wang@linux.intel.com \
--cc=sanyog.r.kale@intel.com \
--cc=tiwai@suse.de \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.intel.com \
/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