Commit 55d50ace authored by Bard Liao's avatar Bard Liao Committed by Vinod Koul

soundwire: generic_bandwidth_allocation use bus->params.max_dr_freq

bus->params.max_dr_freq is calculated and set in sdw_bus_master_add().
We can use it directly instead of calculating it again.
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20231127124405.2080431-1-yung-chuan.liao@linux.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent a7ae05ef
...@@ -333,7 +333,7 @@ static int sdw_select_row_col(struct sdw_bus *bus, int clk_freq) ...@@ -333,7 +333,7 @@ static int sdw_select_row_col(struct sdw_bus *bus, int clk_freq)
*/ */
static int sdw_compute_bus_params(struct sdw_bus *bus) static int sdw_compute_bus_params(struct sdw_bus *bus)
{ {
unsigned int max_dr_freq, curr_dr_freq = 0; unsigned int curr_dr_freq = 0;
struct sdw_master_prop *mstr_prop = &bus->prop; struct sdw_master_prop *mstr_prop = &bus->prop;
int i, clk_values, ret; int i, clk_values, ret;
bool is_gear = false; bool is_gear = false;
...@@ -351,14 +351,12 @@ static int sdw_compute_bus_params(struct sdw_bus *bus) ...@@ -351,14 +351,12 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
clk_buf = NULL; clk_buf = NULL;
} }
max_dr_freq = mstr_prop->max_clk_freq * SDW_DOUBLE_RATE_FACTOR;
for (i = 0; i < clk_values; i++) { for (i = 0; i < clk_values; i++) {
if (!clk_buf) if (!clk_buf)
curr_dr_freq = max_dr_freq; curr_dr_freq = bus->params.max_dr_freq;
else else
curr_dr_freq = (is_gear) ? curr_dr_freq = (is_gear) ?
(max_dr_freq >> clk_buf[i]) : (bus->params.max_dr_freq >> clk_buf[i]) :
clk_buf[i] * SDW_DOUBLE_RATE_FACTOR; clk_buf[i] * SDW_DOUBLE_RATE_FACTOR;
if (curr_dr_freq <= bus->params.bandwidth) if (curr_dr_freq <= bus->params.bandwidth)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment