Skip to content

Commit 4b71ffd

Browse files
committed
soundwire: subtract BRA columns in bandwidth calculation
When a BRA stream is running, we should subtract the columns that is used by the BRA stream in bandwidth calculation. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent 15cca8e commit 4b71ffd

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

drivers/soundwire/generic_bandwidth_allocation.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
567567
unsigned int curr_dr_freq = 0;
568568
int i, l, clk_values, ret;
569569
bool is_gear = false;
570+
int available_col;
570571
int m_lane = 0;
571572
u32 *clk_buf;
572573

@@ -613,7 +614,21 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
613614

614615
total_col = curr_dr_freq / mstr_prop->default_frame_rate / mstr_prop->default_row;
615616

616-
if (curr_dr_freq * (total_col - 1) >=
617+
/*
618+
* available payload columns on lane 0:
619+
* - exclude control column 0
620+
* - if BPT is active, also exclude columns 1..bpt_hstop used by DP0
621+
*/
622+
if (bus->bpt_stream_refcount)
623+
available_col = total_col - bus->bpt_hstop - 1;
624+
else
625+
available_col = total_col - 1;
626+
627+
if (available_col <= 0)
628+
continue;
629+
630+
/* Keep formula consistent with sdw_select_row_col() */
631+
if (curr_dr_freq * available_col >=
617632
bus->params.bandwidth * total_col)
618633
break;
619634

0 commit comments

Comments
 (0)