Skip to content

Commit

Permalink
soundwire: generic_bandwidth_allocation use bus->params.max_dr_freq
Browse files Browse the repository at this point in the history
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: Bard Liao <[email protected]>
  • Loading branch information
bardliao authored and plbossart committed Nov 10, 2023
1 parent b2acf31 commit 9eafbd6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/soundwire/generic_bandwidth_allocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
unsigned int max_dr_freq, curr_dr_freq = 0;
unsigned int curr_dr_freq = 0;
struct sdw_master_prop *mstr_prop = &bus->prop;
int i, clk_values, ret;
bool is_gear = false;
Expand All @@ -351,14 +351,12 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
clk_buf = NULL;
}

max_dr_freq = mstr_prop->max_clk_freq * SDW_DOUBLE_RATE_FACTOR;

for (i = 0; i < clk_values; i++) {
if (!clk_buf)
curr_dr_freq = max_dr_freq;
curr_dr_freq = bus->params.max_dr_freq;
else
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;

if (curr_dr_freq <= bus->params.bandwidth)
Expand Down

0 comments on commit 9eafbd6

Please sign in to comment.