Skip to content

Commit c8b36b8

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 534ecb4 commit c8b36b8

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

drivers/soundwire/generic_bandwidth_allocation.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,11 @@ static int sdw_compute_group_params(struct sdw_bus *bus,
260260
m_rt->stream->state != SDW_STREAM_DISABLED)
261261
continue;
262262
}
263+
264+
/* Don't count BPT stream bandwidth, it will use the remaining bandwidth */
265+
if (m_rt->stream->type == SDW_STREAM_BPT)
266+
continue;
267+
263268
list_for_each_entry(p_rt, &m_rt->port_list, port_node) {
264269
rate = m_rt->stream->params.rate;
265270
bps = m_rt->stream->params.bps;
@@ -601,6 +606,9 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
601606
break;
602607

603608
list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
609+
/* BPT stream always uses lane 0 */
610+
if (m_rt->stream->type == SDW_STREAM_BPT)
611+
continue;
604612
/*
605613
* Get the first s_rt that will be used to find the available lane that
606614
* 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
@@ -1515,8 +1515,11 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream,
15151515
if (update_params) {
15161516
/* Increment cumulative bus bandwidth */
15171517
/* TODO: Update this during Device-Device support */
1518-
bus->params.bandwidth += m_rt->stream->params.rate *
1519-
m_rt->ch_count * m_rt->stream->params.bps;
1518+
/* Don't count BPT stream bandwidth, it will use the remaining bandwidth */
1519+
if (m_rt->stream->type != SDW_STREAM_BPT) {
1520+
bus->params.bandwidth += m_rt->stream->params.rate *
1521+
m_rt->ch_count * m_rt->stream->params.bps;
1522+
}
15201523

15211524
/* Compute params */
15221525
if (bus->compute_params) {
@@ -1821,6 +1824,10 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream)
18211824

18221825
multi_lane_bandwidth = 0;
18231826

1827+
/* Don't count BPT stream bandwidth, it will use the remaining bandwidth */
1828+
if (m_rt->stream->type == SDW_STREAM_BPT)
1829+
goto skip_bpt_stream;
1830+
18241831
list_for_each_entry(p_rt, &m_rt->port_list, port_node) {
18251832
if (!p_rt->lane)
18261833
continue;
@@ -1836,6 +1843,7 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream)
18361843
bandwidth = m_rt->stream->params.rate * m_rt->ch_count * m_rt->stream->params.bps;
18371844
bus->params.bandwidth -= bandwidth - multi_lane_bandwidth;
18381845

1846+
skip_bpt_stream:
18391847
/* Compute params */
18401848
if (bus->compute_params) {
18411849
ret = bus->compute_params(bus, stream);

0 commit comments

Comments
 (0)