Skip to content

Commit e7e095e

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 619b6ae commit e7e095e

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
@@ -567,8 +567,10 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
567567
struct sdw_master_runtime *m_rt;
568568
struct sdw_slave_runtime *s_rt;
569569
unsigned int curr_dr_freq = 0;
570+
bool is_bpt_running = false;
570571
int i, l, clk_values, ret;
571572
bool is_gear = false;
573+
int available_col;
572574
int m_lane = 0;
573575
u32 *clk_buf;
574576

@@ -593,6 +595,7 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
593595
m_rt->stream->state < SDW_STREAM_DEPREPARED) {
594596
clk_values = 1;
595597
clk_buf = NULL;
598+
is_bpt_running = true;
596599
}
597600
}
598601

@@ -615,7 +618,21 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
615618

616619
total_col = curr_dr_freq / mstr_prop->default_frame_rate / mstr_prop->default_row;
617620

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

0 commit comments

Comments
 (0)