Skip to content

Commit

Permalink
soundwire: generic_bandwidth_allocation: count the bandwidth of activ…
Browse files Browse the repository at this point in the history
…e streams only

sdw_compute_group_params() should only count payload bandwidth of the
active streams which is in the ENABLED and DISABLED state in the bus.
And add the payload bandwidth of the stream that calls
sdw_compute_group_params() in sdw_prepare_stream().

Signed-off-by: Bard Liao <[email protected]>
  • Loading branch information
bardliao committed Nov 25, 2024
1 parent 698d86d commit 5075d87
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/soundwire/generic_bandwidth_allocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,21 @@ static int sdw_compute_group_params(struct sdw_bus *bus,
}

list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
/*
* sdw_compute_group_params could be called in the deprepared case, skip the
* m_rt in that case.
*/
if (m_rt->stream == stream)
if (stream->state != SDW_STREAM_CONFIGURED)
continue;
/*
* Stream stage ENABLED and DISABLED are between PREPARED and DEPREPARED,
* We should count the bandwidth only for ENABLED and DISABLED stages.
*/
if (m_rt->stream->state != SDW_STREAM_ENABLED &&
m_rt->stream->state != SDW_STREAM_DISABLED)
continue;

list_for_each_entry(p_rt, &m_rt->port_list, port_node) {
rate = m_rt->stream->params.rate;
bps = m_rt->stream->params.bps;
Expand Down

0 comments on commit 5075d87

Please sign in to comment.