Skip to content

Commit

Permalink
soundwire: generic_bandwidth_allocation: correct clk_freq check in sd…
Browse files Browse the repository at this point in the history
…w_select_row_col

The bits in Column 0 of Rows 0 to 47 are for control word and cannot be
used for audio. In practice, entire Column 0 is skipped.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20241218080155.102405-10-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
  • Loading branch information
Bard Liao authored and Vinod Koul committed Dec 23, 2024
1 parent 3ddd303 commit cf44ae3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/soundwire/generic_bandwidth_allocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ static int sdw_compute_port_params(struct sdw_bus *bus)
static int sdw_select_row_col(struct sdw_bus *bus, int clk_freq)
{
struct sdw_master_prop *prop = &bus->prop;
int frame_int, frame_freq;
int r, c;

for (c = 0; c < SDW_FRAME_COLS; c++) {
Expand All @@ -311,11 +310,8 @@ static int sdw_select_row_col(struct sdw_bus *bus, int clk_freq)
sdw_cols[c] != prop->default_col)
continue;

frame_int = sdw_rows[r] * sdw_cols[c];
frame_freq = clk_freq / frame_int;

if ((clk_freq - (frame_freq * SDW_FRAME_CTRL_BITS)) <
bus->params.bandwidth)
if (clk_freq * (sdw_cols[c] - 1) <
bus->params.bandwidth * sdw_cols[c])
continue;

bus->params.row = sdw_rows[r];
Expand Down

0 comments on commit cf44ae3

Please sign in to comment.