]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
soundwire: generic_bandwidth_allocation: correct clk_freq check in sdw_select_row_col
authorBard Liao <yung-chuan.liao@linux.intel.com>
Wed, 18 Dec 2024 08:01:50 +0000 (16:01 +0800)
committerVinod Koul <vkoul@kernel.org>
Mon, 23 Dec 2024 06:30:33 +0000 (12:00 +0530)
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>
drivers/soundwire/generic_bandwidth_allocation.c

index d847413141d392c05bbd614197c236372f03d5da..5c4dac36ad1a79b355a211d95acb8ba1a96c9744 100644 (file)
@@ -302,7 +302,6 @@ out:
 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++) {
@@ -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];