Skip to content

Commit

Permalink
Soundwire: stream: program BUSCLOCK_SCALE
Browse files Browse the repository at this point in the history
We need to program bus clock scale to adjust the bus clock if current
bus clock doesn't fit the bandwidth.

Signed-off-by: Bard Liao <[email protected]>
  • Loading branch information
bardliao committed Aug 29, 2024
1 parent 14b0bb2 commit 86a0798
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions drivers/soundwire/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,32 @@ static int sdw_notify_config(struct sdw_master_runtime *m_rt)
static int sdw_program_params(struct sdw_bus *bus, bool prepare)
{
struct sdw_master_runtime *m_rt;
struct sdw_slave *slave;
int ret = 0;

list_for_each_entry(slave, &bus->slaves, node) {
u32 scale_index;
u32 addr1;
u8 base;

scale_index = sdw_slave_get_scale_index(slave, &base);
if (scale_index < 0)
return scale_index;

if (bus->params.next_bank) {
addr1 = SDW_SCP_BUSCLOCK_SCALE_B1;
} else {
addr1 = SDW_SCP_BUSCLOCK_SCALE_B0;
}
/* Program SDW_SCP_BUSCLOCK_SCALE */
ret = sdw_write_no_pm(slave, addr1, scale_index);
if (ret < 0) {
dev_err(bus->dev, "SDW_SCP_BUSCLOCK_SCALE register write failed\n");
return ret;
}
}


list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {

/*
Expand Down

0 comments on commit 86a0798

Please sign in to comment.