Skip to content

Commit 06cf176

Browse files
committed
soundwire: generic_bandwidth_allocation: check bandwidth with real
colume The existing code assumes the column number will not change, but it could change if curr_dr_freq changes. Calculate the new column number before checking the bandwidth to make the checking be more accurate. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent 1d62423 commit 06cf176

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

drivers/soundwire/generic_bandwidth_allocation.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,12 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
584584
if (!is_clock_scaling_supported(bus) || bus->bpt_stream_refcount)
585585
clk_values = 1;
586586

587+
if (!mstr_prop->default_frame_rate || !mstr_prop->default_row)
588+
return -EINVAL;
589+
587590
for (i = 0; i < clk_values; i++) {
591+
int total_col;
592+
588593
if (!clk_buf)
589594
curr_dr_freq = bus->params.max_dr_freq;
590595
else
@@ -596,8 +601,10 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
596601
if (bus->bpt_stream_refcount)
597602
curr_dr_freq = bus->params.max_dr_freq;
598603

599-
if (curr_dr_freq * (mstr_prop->default_col - 1) >=
600-
bus->params.bandwidth * mstr_prop->default_col)
604+
total_col = curr_dr_freq / mstr_prop->default_frame_rate / mstr_prop->default_row;
605+
606+
if (curr_dr_freq * (total_col - 1) >=
607+
bus->params.bandwidth * total_col)
601608
break;
602609

603610
list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
@@ -659,9 +666,6 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
659666
}
660667
}
661668

662-
if (!mstr_prop->default_frame_rate || !mstr_prop->default_row)
663-
return -EINVAL;
664-
665669
mstr_prop->default_col = curr_dr_freq / mstr_prop->default_frame_rate /
666670
mstr_prop->default_row;
667671

0 commit comments

Comments
 (0)