From: "Simon Trimmer" <simont@opensource.cirrus.com>
To: "'Syed Saba Kareem'" <syed.sabakareem@amd.com>, <vkoul@kernel.org>
Cc: broonie@kernel.org, Sunil-kumar.Dommati@amd.com,
Mario.Limonciello@amd.com, venkataprasad.potturu@amd.com,
yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.dev,
"'Vijendar Mukunda'" <Vijendar.Mukunda@amd.com>,
"'Liam Girdwood'" <lgirdwood@gmail.com>,
"'Jaroslav Kysela'" <perex@perex.cz>,
"'Takashi Iwai'" <tiwai@suse.com>,
"'Peter Ujfalusi'" <peter.ujfalusi@linux.intel.com>,
"'Daniel Baluta'" <daniel.baluta@nxp.com>,
"'Kai Vehmanen'" <kai.vehmanen@linux.intel.com>,
"'Sumit Semwal'" <sumit.semwal@linaro.org>,
"'Christian König'" <christian.koenig@amd.com>,
"'Mario Limonciello (AMD)'" <superm1@kernel.org>,
"'Mario Limonciello'" <mario.limonciello@amd.com>,
"'open list:SOUNDWIRE SUBSYSTEM'" <linux-sound@vger.kernel.org>,
"'open list'" <linux-kernel@vger.kernel.org>,
"'moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS'"
<sound-open-firmware@alsa-project.org>,
"'open list:BPF [MISC]:Keyword:(?:\\b|_)bpf(?:\\b|_)'"
<bpf@vger.kernel.org>,
"'open list:DMA BUFFER SHARING
FRAMEWORK:Keyword:\\bdma_(?:buf|fence|resv)\\b'"
<linux-media@vger.kernel.org>,
"'open list:DMA BUFFER SHARING
FRAMEWORK:Keyword:\\bdma_(?:buf|fence|resv)\\b'"
<dri-devel@lists.freedesktop.org>,
"'moderated list:DMA BUFFER SHARING
FRAMEWORK:Keyword:\\bdma_(?:buf|fence|resv)\\b'"
<linaro-mm-sig@lists.linaro.org>
Subject: RE: [PATCH 4/4] soundwire: amd: Add BRA/BPT firmware download support
Date: Wed, 9 Sep 2026 17:37:50 +0100 [thread overview]
Message-ID: <005f01dd4079$8eb797c0$ac26c740$@opensource.cirrus.com> (raw)
In-Reply-To: <20260909125605.280973-5-syed.sabakareem@amd.com>
Hi Syed,
I'll look to try this out this week!
The code has changed a bit since I last looked at it properly, I had a query in amd_sdw_bpt_wait() and I think this may be missing bra_block_alignment support that recently entered the tree in https://lore.kernel.org/all/20260728124639.1484973-3-yung-chuan.liao@linux.intel.com/
commit c0840f8be5d59071096b8e6b42693a0d912b7cba
Author: Richard Fitzgerald <rf@opensource.cirrus.com>
Date: Tue Jul 28 20:46:36 2026 +0800
soundwire: Add bra_block_alignment property support
Add a property to struct sdw_slave_prop equivalent to the Disco
property "mipi-sdw-bra-mode-block-alignment".
The SoundWire Disco specification defines this as:
"The data payload size for this BRA Mode shall be an integer
multiple of the value of this Property."
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Co-developed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Link: https://patch.msgid.link/20260728124639.1484973-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Thanks,
-Simon
On 9/9/26 13:56, Syed Saba Kareem wrote:
> ...
> - Non-contiguous firmware sections are handled by iterating
> per-section: large sections use BRA DMA, small sections
> (< one BRA frame) fall back to sdw_nwrite/sdw_nread.
Query about handling of contiguous small sections
> ...
> --- a/drivers/soundwire/amd_manager.c
> +++ b/drivers/soundwire/amd_manager.c
> .....
> +static int amd_sdw_bpt_wait(struct sdw_bus *bus,
> + struct sdw_slave *slave,
> + struct sdw_bpt_msg *msg)
> +{
> ...
> + * Prepare DP0 via SoundWire framework so the core programs the
> + * peripheral DP0 transport/port registers and issues PREPARECTRL.
> + * This is invoked from the BPT transfer context (firmware callback)
> + * and not from update_status(), so it is safe w.r.t. sdw_dev_lock.
> + */
> + ret = sdw_prepare_stream(bus->bpt_stream);
> + if (ret < 0) {
> + dev_err(amd_manager->dev,
> + "BPT: sdw_prepare_stream failed: %d\n", ret);
> + goto deconfigure_pte;
> + }
> + dev_dbg(amd_manager->dev,
> + "BPT: stream prepared, curr_bank=%u next_bank=%u
> state=%d\n",
> + bus->params.curr_bank, bus->params.next_bank,
> + bus->bpt_stream->state);
> +
> + if (amd_sdw_sections_are_contiguous(msg)) {
Have we dropped handling of when a contiguous transfer is less than bytes_per_frame like in the non-contiguous case?
> + /*
> + * All sections are contiguous in peripheral address space.
> + * A single BRA call covers the entire firmware image.
> + */
> + ret = amd_sdw_bra_transfer(amd_manager, slave,
> + msg->sec[0].addr,
> + acp_sys_addr,
> + total_len, is_write,
> + &dma_unsafe);
> + if (ret < 0) {
> + dev_err(amd_manager->dev,
> + "BPT contiguous transfer failed: addr=0x%x
> len=%zu ret=%d\n",
> + msg->sec[0].addr, total_len, ret);
> + /*
> + * Skip the read-back copy below so a failed read
> + * cannot return stale DMA buffer contents to the
> + * caller as if the transfer had succeeded.
> + */
> + goto deconfigure_pte;
> + }
> + } else {
> + /*
> + * Non-contiguous sections: each section targets a different
> + * peripheral address range. The ACP BRA DMA engine is
> + * triggered by sdw_enable_stream() (bank switch +
> CHANNELEN), so
> + * each section needs its own full config -> activate ->
> + * run_dma -> deactivate -> deconfig cycle.
> + *
> + * Sections smaller than one BRA frame (bytes_per_frame)
> + * cannot be transferred via DMA because the engine never
> + * starts for sub-frame payloads. Use regular SDW register
> + * read/write commands for those tiny sections instead.
> + */
> + offset = 0;
> + for (i = 0; i < msg->sections; i++) {
> + if (i < 3 || i == msg->sections - 1)
> + dev_dbg(amd_manager->dev,
> + "BPT nc sec[%d/%d]: periph=0x%08x
> len=%u acp=0x%08x\n",
> + i, msg->sections, msg->sec[i].addr,
> + msg->sec[i].len,
> + acp_sys_addr + (u32)offset);
> + if (msg->sec[i].len < prep_params.bytes_per_frame) {
> + /*
> + * Section too small for BRA DMA -- use
> + * regular SDW byte-level commands instead.
> + */
> + if (is_write)
> + ret = sdw_nwrite_no_pm(slave,
> + msg->sec[i].addr,
> + msg->sec[i].len,
> + dma_buf +
> offset);
> + else
> + ret = sdw_nread_no_pm(slave,
> + msg->sec[i].addr,
> + msg->sec[i].len,
> + dma_buf + offset);
> + if (ret < 0)
> ...
prev parent reply other threads:[~2026-09-09 16:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260909125605.280973-1-syed.sabakareem@amd.com>
2026-09-09 12:55 ` [PATCH 1/4] soundwire: intel_ace2x: free master runtime on BPT open error path Syed Saba Kareem
2026-09-09 12:55 ` [PATCH 2/4] soundwire: intel_ace2x: order bpt_stream publish/clear against refcount Syed Saba Kareem
2026-09-09 12:55 ` [PATCH 3/4] soundwire: stream: allow flagged BPT firmware download while streams are idle Syed Saba Kareem
2026-09-09 12:55 ` [PATCH 4/4] soundwire: amd: Add BRA/BPT firmware download support Syed Saba Kareem
2026-09-09 16:37 ` Simon Trimmer [this message]
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='005f01dd4079$8eb797c0$ac26c740$@opensource.cirrus.com' \
--to=simont@opensource.cirrus.com \
--cc=Mario.Limonciello@amd.com \
--cc=Sunil-kumar.Dommati@amd.com \
--cc=Vijendar.Mukunda@amd.com \
--cc=bpf@vger.kernel.org \
--cc=broonie@kernel.org \
--cc=christian.koenig@amd.com \
--cc=daniel.baluta@nxp.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=sound-open-firmware@alsa-project.org \
--cc=sumit.semwal@linaro.org \
--cc=superm1@kernel.org \
--cc=syed.sabakareem@amd.com \
--cc=tiwai@suse.com \
--cc=venkataprasad.potturu@amd.com \
--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
all inboxes | Powered by JetHome®