Skip to content

[RFC] soundwire: add runtime BPT support#5604

Draft
bardliao wants to merge 8 commits into
thesofproject:topic/sof-devfrom
bardliao:runtime-bra
Draft

[RFC] soundwire: add runtime BPT support#5604
bardliao wants to merge 8 commits into
thesofproject:topic/sof-devfrom
bardliao:runtime-bra

Conversation

@bardliao

Copy link
Copy Markdown
Collaborator

The driver may want to use BPT stream to download the firmware while an audio stream is running. This series calculates the available columns in a SoundWire frame and use them for the BPT stream. The streams are on on a first-come, first-served basis but will reserve 2 columns for the audio stream if possible. That should apply to most cases.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements runtime BPT (Bulk Point-to-Point) stream support for SoundWire, enabling firmware downloads while audio streams are active. The changes calculate available columns in SoundWire frames and allocate them to BPT streams on a first-come, first-served basis, with a reservation of 2 columns for audio streams when possible.

Key changes:

  • Modified bandwidth calculation to exclude BPT streams and use remaining available bandwidth
  • Added bpt_hstop field to track BPT stream column allocation
  • Updated frame column allocation logic to dynamically reserve space for audio streams

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
include/linux/soundwire/sdw.h Added bpt_hstop field to track BPT stream column boundaries
drivers/soundwire/stream.c Excluded BPT streams from bandwidth calculations during prepare/deprepare
drivers/soundwire/intel_ace2x.c Updated to use bpt_hstop instead of total columns for BPT buffer calculations
drivers/soundwire/generic_bandwidth_allocation.c Implemented dynamic column allocation logic with BPT stream filtering and reservation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread include/linux/soundwire/sdw.h
Comment thread drivers/soundwire/generic_bandwidth_allocation.c Outdated
Comment thread drivers/soundwire/generic_bandwidth_allocation.c
Comment thread drivers/soundwire/generic_bandwidth_allocation.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread drivers/soundwire/generic_bandwidth_allocation.c
Comment thread drivers/soundwire/generic_bandwidth_allocation.c
Comment thread drivers/soundwire/generic_bandwidth_allocation.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

Comment thread drivers/soundwire/generic_bandwidth_allocation.c
return ret;
}

if (stream->type == SDW_STREAM_BPT) {
Comment on lines +588 to 592
* Use the maximum freq to get maximum bandwidth and no need to try another freq
* if BPT stream is running
*/
if (!is_clock_scaling_supported(bus) || bus->bpt_stream_refcount)
clk_values = 1;
Comment thread drivers/soundwire/stream.c
bardliao added 8 commits June 26, 2026 16:04
We should get as much as bandwidth for the BPT stream.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
The DP0 (BPT) params are computed in sdw_compute_dp0_port_params(). We
should exclude the BPT stream when calculating the audio streams.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
We just need to conunt the audio stream bandwidth and BRA stream will
use the remaining bandwidth.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
colume

The existing code assumes the column number will not change, but it
could change if curr_dr_freq changes. Calculate the new column number
before checking the bandwidth to make the checking be more accurate.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
To allow BPT and audio stream work simultaneously, we need to record the
hstop of the BPT stream. And use column bpt_hstop + 1 to the last column
for audio streams.
No function changed since bus->bpt_hstop is set to bus->params.col - 1
for now. Will update bus->audio_stream_hstart in the follow up commit.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Update bus->bpt_hstop to record the hstop of the BPT stream.
And return -EAGAIN when there is no bandwidth for the BPT stream.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
When a BRA stream is running, we should subtract the columns that is
used by the BRA stream in bandwidth calculation.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Now the SoundWire BPT stream and the audio stream can share the
SoundWire bus bandwidth. However, it is still not allowed to have more
than 1 BPT stream running simultaneously.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment on lines +622 to +625
if (bus->bpt_stream_refcount)
available_col = total_col - bus->bpt_hstop - 1;
else
available_col = total_col - 1;
Comment on lines 1541 to 1544
restore_params:
memcpy(&bus->params, &params, sizeof(params));
bus->bpt_hstop = prev_bpt_hstop;
return ret;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants