]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
soundwire: generic_bandwidth_allocation: check required freq accurately
authorBard Liao <yung-chuan.liao@linux.intel.com>
Wed, 18 Dec 2024 08:01:51 +0000 (16:01 +0800)
committerVinod Koul <vkoul@kernel.org>
Mon, 23 Dec 2024 06:30:33 +0000 (12:00 +0530)
Currently, we check curr_dr_freq roughly by "if (curr_dr_freq <=
bus->params.bandwidth)" in sdw_compute_bus_params() and check it
accurately in sdw_select_row_col(). It works if we only support one
freq. But, we need to check it accurately in sdw_select_row_col() to
give it a chance to use a higher freq or use multi-lane.

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-11-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/generic_bandwidth_allocation.c

index 5c4dac36ad1a79b355a211d95acb8ba1a96c9744..d2632af9c8af6c0490fd039704830d75b94ada9e 100644 (file)
@@ -373,7 +373,8 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
                                (bus->params.max_dr_freq >>  clk_buf[i]) :
                                clk_buf[i] * SDW_DOUBLE_RATE_FACTOR;
 
-               if (curr_dr_freq <= bus->params.bandwidth)
+               if (curr_dr_freq * (mstr_prop->default_col - 1) <
+                   bus->params.bandwidth * mstr_prop->default_col)
                        continue;
 
                break;