Skip to content

soundwire: only compute port params in specific stream states#5393

Merged
bardliao merged 1 commit intothesofproject:topic/sof-devfrom
bardliao:fix-sdw-bandwidth
May 8, 2025
Merged

soundwire: only compute port params in specific stream states#5393
bardliao merged 1 commit intothesofproject:topic/sof-devfrom
bardliao:fix-sdw-bandwidth

Conversation

@bardliao
Copy link
Copy Markdown
Collaborator

Currently, sdw_compute_master_ports() is blindly called for every single Manager runtime. However, we should not take in count the stream's bandwidth if the stream is just allocated or already deprepared.

Fixes: 25befdf ("soundwire: generic_bandwidth_allocation: count the bandwidth of active streams only")

Copy link
Copy Markdown

Copilot AI left a comment

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 refines the bandwidth allocation logic by ensuring that only runtime streams in specific states (CONFIGURED, PREPARED, ENABLED, and DISABLED) are processed.

  • Introduces a state check before calling sdw_compute_master_ports.
  • Limits bandwidth calculation to active stream states.
Comments suppressed due to low confidence (1)

drivers/soundwire/generic_bandwidth_allocation.c:213

  • [nitpick] Consider refactoring the state eligibility check into a helper function for improved readability and easier maintenance of allowed states.
if (m_rt->stream->state != SDW_STREAM_CONFIGURED &&

@bardliao bardliao force-pushed the fix-sdw-bandwidth branch 3 times, most recently from 37af8df to 542304e Compare April 29, 2025 09:32
*/
if (m_rt->stream->state > SDW_STREAM_DISABLED ||
m_rt->stream->state < SDW_STREAM_CONFIGURED)
continue;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

commit message: s/we should not take in count/we should not take into account/
?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

commit message: s/we should not take in count/we should not take into account/ ?

fixed

Currently, sdw_compute_master_ports() is blindly called for every single
Manager runtime. However, we should not take into account the stream's
bandwidth if the stream is just allocated or already deprepared.

Fixes: 25befdf ("soundwire: generic_bandwidth_allocation: count the bandwidth of active streams only")
Link: thesofproject#5398
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@bardliao bardliao force-pushed the fix-sdw-bandwidth branch from 542304e to 6a08906 Compare May 6, 2025 07:02
@bardliao bardliao requested a review from ujfalusi May 6, 2025 12:03
@bardliao bardliao merged commit 6be7751 into thesofproject:topic/sof-dev May 8, 2025
9 of 16 checks passed
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.

4 participants