Skip to content

Commit 382b10f

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

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

drivers/soundwire/generic_bandwidth_allocation.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,10 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
565565
struct sdw_master_runtime *m_rt;
566566
struct sdw_slave_runtime *s_rt;
567567
unsigned int curr_dr_freq = 0;
568+
bool is_bpt_running = false;
568569
int i, l, clk_values, ret;
569570
bool is_gear = false;
571+
int available_col;
570572
int m_lane = 0;
571573
u32 *clk_buf;
572574

@@ -591,6 +593,7 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
591593
m_rt->stream->state < SDW_STREAM_DEPREPARED) {
592594
clk_values = 1;
593595
clk_buf = NULL;
596+
is_bpt_running = true;
594597
}
595598
}
596599

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

614617
total_col = curr_dr_freq / mstr_prop->default_frame_rate / mstr_prop->default_row;
615618

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

0 commit comments

Comments
 (0)