From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: linux-sound@vger.kernel.org, alsa-devel@alsa-project.org,
tiwai@suse.de, broonie@kernel.org, vinod.koul@intel.com,
Bard liao <yung-chuan.liao@linux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
srinivas.kandagatla@linaro.org,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
vijendar.mukunda@amd.com,
Richard Fitzgerald <rf@opensource.cirrus.com>,
Shuming Fan <shumingf@realtek.com>, Jack Yu <jack.yu@realtek.com>,
Oder Chiou <oder_chiou@realtek.com>
Subject: Re: [RFC PATCH 07/16] soundwire: bus: add API for BPT protocol
Date: Mon, 18 Dec 2023 11:38:37 +0100 [thread overview]
Message-ID: <0511b851-52e3-4e0d-bca1-552b7c79e889@linux.intel.com> (raw)
In-Reply-To: <20231212121931.GX14858@ediswmail.ad.cirrus.com>
On 12/12/23 06:19, Charles Keepax wrote:
> On Thu, Dec 07, 2023 at 04:29:35PM -0600, Pierre-Louis Bossart wrote:
>> This patch suggests a minimum bound of 64 bytes, for smaller transfers
>
> 128 in the code.
indeed, that's a left-over from an earlier trial. Will fix.
>> +int sdw_bpt_close_stream(struct sdw_bus *bus,
>> + struct sdw_slave *slave,
>> + enum sdw_bpt_type mode,
>> + struct sdw_bpt_msg *msg)
>> +{
>
> Seems weird to pass the message to close?
It's not necessary in my current solution, but I opted to keep the
arguments aligned.
>> +int sdw_bpt_open_stream(struct sdw_bus *bus,
>> + struct sdw_slave *slave,
>> + enum sdw_bpt_type mode,
>> + struct sdw_bpt_msg *msg)
>
> Ditto, here does it make sense to pass the msg to open? I guess
> the idea is that one only sends a single message in one
> open->send->wait->close cycle? Would be much nicer if multiple
> send/waits could be done in a single open/close, or if the
> limitation is unavoidable why split out open/send into separate
> calls at all? Just have send and wait and wrap open/close into
> them.
it's needed for the Intel solution, the open() will allocate the
required DMA buffers and copy the data from the messsage into the DMA
buffers with the required formatting expected by the IP.
An alternative would be to simplify open/close but then we have to add a
hw_params/prepare and hw_free steps. I didn't see a need for such a
split, unlike for audio the arguments are not going to be variable.
But yes it's a good question, what exactly is an open/startup callback
supposed to do in ALSA/ASoC?
>
>> + if (msg->len % SDW_BPT_MSG_BYTE_ALIGNMENT) {
>> + dev_err(bus->dev, "BPT message length %d is not a multiple of %d bytes\n",
>> + msg->len, SDW_BPT_MSG_BYTE_ALIGNMENT);
>> + return -EINVAL;
>> + }
>
> Should this really be here? My understanding is this alignment is
> a limitation of specific hardware so should this check not be in
> the Cadence master code.
As discussed earlier, we *could* move this to host-specific parts, but
then the codec driver would need to know about host alignment
requirements. One of those 'be careful what you ask for' things where
you may have more work to do on the codec driver side...
>> +int sdw_bpt_send_async(struct sdw_bus *bus,
>> + struct sdw_slave *slave,
>> + struct sdw_bpt_msg *msg)
>> +{
>> + if (msg->len > SDW_BPT_MSG_MAX_BYTES)
>> + return -EINVAL;
>
> Does this check make sense since this was already checked in
> open? I guess the user could pass in a different message at this
> stage, but that I guess is part of what feels weird about passing
> the message into open.
The error check is a big open, we could assume that all the previous
steps were done the right way and skip tests, or we would add a set of
paranoia checks.
The primary intent of those checks is to help the integration of codec
drivers, it's better to get an error code and a clear error message than
a kernel oops because the expected sequence is not followed. Once the
integration is done, those tests are probably not very useful indeed.
>> +/**
>> + * struct sdw_btp_msg - Message structure
>> + * @addr: Start Register address accessed in the Slave
>> + * @len: number of bytes to transfer. More than 64Kb can be transferred
>> + * but a practical limit of SDW_BPT_MSG_MAX_BYTES is enforced.
>
> Where is the 64kb coming from here?
Ah, this is a reference to the 16 bit address limitation in the regular
read/write commands.
>> +/*
>> + * Add a minimum number of bytes for BPT transfer sizes. BPT has a lot of
>> + * overhead, enabling/disabling a stream costs 6 write commands, plus the bank
>> + * switch that could be delayed in time. In addition, transferring very small
>> + * data sets over DMA is known to be problematic on multiple platforms.
>> + */
>> +#define SDW_BPT_MSG_MIN_BYTES 128
>> +
>
> Is it really necessary for the core to enforce a minimum transfer
> size (well except for the required alignment thing)? Yes small
> transfers don't obviously make sense, but there is nothing inherently
> wrong with doing one, which makes me feel it is excessive for the
> core to block more than it has to here.
I think it's really better to have a clear design intent that BRA is not
meant for small transfers. It would be opening a can of worms if we
start seeing uses of this protocol beyond the intended firmware/table
download and history buffer retrieval.
> I would be of the opinion its up to driver writers if they have
> some reason to do small BRA transfers. Firstly, since we are so
> keen on allowing BRA and normal writes to overlap, one could see
> use-cases when you want to do something through BRA such that it
> doesn't block the normal command stream. Also there is already 1
> feature on cs42l43 that can only be accessed through BRA, yes that
> is a heroically questionable hardware design choice. Whilst we are
> mostly ignoring that for now, I can see this being something some
> other hardware teams decide to heroically do at some point as well.
To be clear, I would like to allow BRA in parallel with normal writes
*to a different set of registers* to deal with alerts, etc.
A set of registers only accessible through BRA is a very questionable
design indeed. That's not what the SoundWire spec intended and it's not
what this patchset had in mind. You'll have to tell us more on what
exactly the hardware is and does, and how strongly you want this
capability supported...
next prev parent reply other threads:[~2023-12-18 10:46 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-07 22:29 [RFC PATCH 00/16] soundwire/ASoC: speed-up downloads with BTP/BRA protocol Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 01/16] Documentation: driver: add SoundWire BRA description Pierre-Louis Bossart
2023-12-07 23:29 ` Mark Brown
2023-12-08 0:56 ` Pierre-Louis Bossart
2023-12-08 21:49 ` Mark Brown
2023-12-19 16:50 ` Pierre-Louis Bossart
2023-12-19 16:53 ` Mark Brown
2023-12-19 17:08 ` Pierre-Louis Bossart
2023-12-20 15:16 ` Charles Keepax
2023-12-20 18:26 ` Pierre-Louis Bossart
2023-12-20 18:28 ` Mark Brown
2023-12-21 9:46 ` Charles Keepax
2024-08-20 7:48 ` Pierre-Louis Bossart
2024-08-20 11:53 ` Mark Brown
2024-08-20 14:58 ` Pierre-Louis Bossart
2024-08-20 15:09 ` Mark Brown
2023-12-08 16:27 ` Charles Keepax
2023-12-08 18:45 ` Pierre-Louis Bossart
2023-12-08 18:55 ` Mark Brown
2023-12-18 11:40 ` Vinod Koul
2023-12-18 12:58 ` Pierre-Louis Bossart
2023-12-18 14:29 ` Charles Keepax
2023-12-18 16:33 ` Pierre-Louis Bossart
2023-12-21 14:45 ` Vinod Koul
2023-12-21 14:44 ` Vinod Koul
2023-12-21 14:44 ` Vinod Koul
2023-12-07 22:29 ` [RFC PATCH 02/16] soundwire: cadence: add BTP support for DP0 Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 03/16] soundwire: stream: extend sdw_alloc_stream() to take 'type' parameter Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 04/16] soundwire: extend sdw_stream_type to BPT Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 05/16] soundwire: stream: special-case the bus compute_params() routine Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 06/16] soundwire: stream: reuse existing code for BPT stream Pierre-Louis Bossart
2023-12-12 12:30 ` Charles Keepax
2023-12-18 10:45 ` Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 07/16] soundwire: bus: add API for BPT protocol Pierre-Louis Bossart
2023-12-12 12:19 ` Charles Keepax
2023-12-18 10:38 ` Pierre-Louis Bossart [this message]
2023-12-18 11:54 ` Vinod Koul
2023-12-18 13:12 ` Pierre-Louis Bossart
2023-12-18 14:57 ` Charles Keepax
2023-12-18 16:44 ` Pierre-Louis Bossart
2023-12-21 14:49 ` Vinod Koul
2023-12-07 22:29 ` [RFC PATCH 08/16] soundwire: bus: add bpt_stream pointer Pierre-Louis Bossart
2023-12-18 11:55 ` Vinod Koul
2023-12-18 13:20 ` Pierre-Louis Bossart
2023-12-21 14:39 ` Vinod Koul
2023-12-21 17:09 ` Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 09/16] soundwire: crc8: add constant table Pierre-Louis Bossart
2023-12-18 12:01 ` Vinod Koul
2023-12-18 13:26 ` Pierre-Louis Bossart
2023-12-21 14:42 ` Vinod Koul
2023-12-21 17:15 ` Pierre-Louis Bossart
2023-12-21 17:21 ` Vinod Koul
2023-12-07 22:29 ` [RFC PATCH 10/16] soundwire: cadence: add BTP/BRA helpers to format data Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 11/16] soundwire: intel_auxdevice: add indirection for BPT open/close/send_async/wait Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 12/16] ASoC: SOF: Intel: hda-sdw-bpt: add helpers for SoundWire BPT DMA Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 13/16] soundwire: intel: add BPT context definition Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 14/16] soundwire: intel_ace2x: add BPT open/close/send_async/wait Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 15/16] soundwire: debugfs: add interface for BPT/BRA transfers Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 16/16] ASoC: rt711-sdca: add DP0 support Pierre-Louis Bossart
2023-12-07 22:56 ` [RFC PATCH 00/16] soundwire/ASoC: speed-up downloads with BTP/BRA protocol Mark Brown
2023-12-07 23:06 ` 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=0511b851-52e3-4e0d-bca1-552b7c79e889@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=jack.yu@realtek.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-sound@vger.kernel.org \
--cc=oder_chiou@realtek.com \
--cc=peter.ujfalusi@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=rf@opensource.cirrus.com \
--cc=shumingf@realtek.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.de \
--cc=vijendar.mukunda@amd.com \
--cc=vinod.koul@intel.com \
--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