Skip to content

Commit

Permalink
soundwire: stream: calculatethe bandwidth of active streams only
Browse files Browse the repository at this point in the history
sdw_compute_group_params() will count payload bandwidth and it count all
m_rt in the bus. The m_rt will be added to the bus by
sdw_stream_add_master(). If 2 streams are opened simultaneously, the
m_rt of the second stream will be counted when
sdw_compute_group_params() is counting the payload bandwidth of the
first stream. Which is incorrect.
sdw_compute_group_params() should only calculate the bandwidth of the
active streams and the newly preparing stream.

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

list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
if (m_rt->stream == stream) {
if (stream->state != SDW_STREAM_CONFIGURED)
continue;
} else {
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 6628b7a

Please sign in to comment.