forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 146
[RFC] soundwire: add runtime BPT support #5604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
bardliao
wants to merge
8
commits into
thesofproject:topic/sof-dev
Choose a base branch
from
bardliao:runtime-bra
base: topic/sof-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+121
−32
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b6e691c
soundwire: use maximum sdw bus rate when BPT stream is running
bardliao f556a1e
soundwire: generic_bandwidth_allocation: don't deal with BPT stream
bardliao 9a3d244
soundwire: don't count BPT bandwidth
bardliao 0371546
soundwire: generic_bandwidth_allocation: check bandwidth with real
bardliao cd4fb77
soundwire: add bpt_hstop in struct sdw_bus
bardliao 619b6ae
soundwire: generic_bandwidth_allocation: update bpt_hstop
bardliao fead37c
soundwire: subtract BPT columns in bandwidth calculation
bardliao 6272c83
soundwire: allow BPT and audio stream run simultaneously
bardliao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1250,18 +1250,10 @@ static struct sdw_master_runtime | |
| struct sdw_master_runtime *m_rt, *walk_m_rt; | ||
| struct list_head *insert_after; | ||
|
|
||
| if (stream->type == SDW_STREAM_BPT) { | ||
| if (bus->stream_refcount > 0 || bus->bpt_stream_refcount > 0) { | ||
| dev_err(bus->dev, "%s: %d/%d audio/BPT stream already allocated\n", | ||
| __func__, bus->stream_refcount, bus->bpt_stream_refcount); | ||
| return ERR_PTR(-EBUSY); | ||
| } | ||
| } else { | ||
| if (bus->bpt_stream_refcount > 0) { | ||
| dev_err(bus->dev, "%s: BPT stream already allocated\n", | ||
| __func__); | ||
| return ERR_PTR(-EAGAIN); | ||
| } | ||
| if (stream->type == SDW_STREAM_BPT && bus->bpt_stream_refcount > 0) { | ||
| dev_err(bus->dev, "%s: BPT stream already allocated\n", | ||
| __func__); | ||
| return ERR_PTR(-EAGAIN); | ||
| } | ||
|
|
||
| m_rt = kzalloc_obj(*m_rt); | ||
|
|
@@ -1480,13 +1472,15 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream, | |
| struct sdw_bus *bus; | ||
| struct sdw_master_prop *prop; | ||
| struct sdw_bus_params params; | ||
| int prev_bpt_hstop; | ||
| int ret; | ||
|
|
||
| /* Prepare Master(s) and Slave(s) port(s) associated with stream */ | ||
| list_for_each_entry(m_rt, &stream->master_list, stream_node) { | ||
| bus = m_rt->bus; | ||
| prop = &bus->prop; | ||
| memcpy(¶ms, &bus->params, sizeof(params)); | ||
| prev_bpt_hstop = bus->bpt_hstop; | ||
|
|
||
| /* TODO: Support Asynchronous mode */ | ||
| if ((prop->max_clk_freq % stream->params.rate) != 0) { | ||
|
|
@@ -1497,8 +1491,11 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream, | |
| if (update_params) { | ||
| /* Increment cumulative bus bandwidth */ | ||
| /* TODO: Update this during Device-Device support */ | ||
| bus->params.bandwidth += m_rt->stream->params.rate * | ||
| m_rt->ch_count * m_rt->stream->params.bps; | ||
| /* Don't count BPT stream bandwidth, it will use the remaining bandwidth */ | ||
| if (m_rt->stream->type != SDW_STREAM_BPT) { | ||
| bus->params.bandwidth += m_rt->stream->params.rate * | ||
| m_rt->ch_count * m_rt->stream->params.bps; | ||
| } | ||
|
bardliao marked this conversation as resolved.
|
||
|
|
||
| /* Compute params */ | ||
| if (bus->compute_params) { | ||
|
|
@@ -1543,6 +1540,7 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream, | |
|
|
||
| restore_params: | ||
| memcpy(&bus->params, ¶ms, sizeof(params)); | ||
| bus->bpt_hstop = prev_bpt_hstop; | ||
| return ret; | ||
|
Comment on lines
1541
to
1544
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should belong to another PR. I will fix it later. |
||
| } | ||
|
|
||
|
|
@@ -1787,6 +1785,10 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream) | |
|
|
||
| multi_lane_bandwidth = 0; | ||
|
|
||
| /* Don't count BPT stream bandwidth, it will use the remaining bandwidth */ | ||
| if (m_rt->stream->type == SDW_STREAM_BPT) | ||
| goto skip_bpt_stream; | ||
|
|
||
| list_for_each_entry(p_rt, &m_rt->port_list, port_node) { | ||
| if (!p_rt->lane) | ||
| continue; | ||
|
|
@@ -1802,6 +1804,7 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream) | |
| bandwidth = m_rt->stream->params.rate * m_rt->ch_count * m_rt->stream->params.bps; | ||
| bus->params.bandwidth -= bandwidth - multi_lane_bandwidth; | ||
|
|
||
| skip_bpt_stream: | ||
| /* Compute params */ | ||
| if (bus->compute_params) { | ||
| ret = bus->compute_params(bus, stream); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.