Skip to content

Commit 86c4ff7

Browse files
committed
soundwire: don't count BPT bandwidth
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>
1 parent a899661 commit 86c4ff7

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

drivers/soundwire/generic_bandwidth_allocation.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,9 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
597597
break;
598598

599599
list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
600+
/* BPT stream always uses lane 0 */
601+
if (m_rt->stream->type == SDW_STREAM_BPT)
602+
continue;
600603
/*
601604
* Get the first s_rt that will be used to find the available lane that
602605
* can be used. No need to check all Peripherals because we can't use

drivers/soundwire/stream.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,8 +1497,11 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream,
14971497
if (update_params) {
14981498
/* Increment cumulative bus bandwidth */
14991499
/* TODO: Update this during Device-Device support */
1500-
bus->params.bandwidth += m_rt->stream->params.rate *
1501-
m_rt->ch_count * m_rt->stream->params.bps;
1500+
/* Don't count BPT stream bandwidth, it will use the remaining bandwidth */
1501+
if (m_rt->stream->type != SDW_STREAM_BPT) {
1502+
bus->params.bandwidth += m_rt->stream->params.rate *
1503+
m_rt->ch_count * m_rt->stream->params.bps;
1504+
}
15021505

15031506
/* Compute params */
15041507
if (bus->compute_params) {
@@ -1787,6 +1790,10 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream)
17871790

17881791
multi_lane_bandwidth = 0;
17891792

1793+
/* Don't count BPT stream bandwidth, it will use the remaining bandwidth */
1794+
if (m_rt->stream->type == SDW_STREAM_BPT)
1795+
goto skip_bpt_stream;
1796+
17901797
list_for_each_entry(p_rt, &m_rt->port_list, port_node) {
17911798
if (!p_rt->lane)
17921799
continue;
@@ -1802,6 +1809,7 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream)
18021809
bandwidth = m_rt->stream->params.rate * m_rt->ch_count * m_rt->stream->params.bps;
18031810
bus->params.bandwidth -= bandwidth - multi_lane_bandwidth;
18041811

1812+
skip_bpt_stream:
18051813
/* Compute params */
18061814
if (bus->compute_params) {
18071815
ret = bus->compute_params(bus, stream);

0 commit comments

Comments
 (0)