Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions drivers/soundwire/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,7 @@ static int sdw_slave_set_frequency(struct sdw_slave *slave)
dev_err(&slave->dev,
"SDW_SCP_BUSCLOCK_SCALE_B1 write failed:%d\n", ret);

slave->scale_index = scale_index;
return ret;
}

Expand Down
10 changes: 10 additions & 0 deletions drivers/soundwire/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,21 @@ static int sdw_program_params(struct sdw_bus *bus, bool prepare)
if (scale_index < 0)
return scale_index;

if (scale_index == slave->scale_index)
continue;

/* Skip the unattached Peripherals */
if (!completion_done(&slave->enumeration_complete)) {
dev_warn(&slave->dev,
"Not enumerated, skip programing BUSCLOCK_SCALE\n");
continue;
}
ret = sdw_write_no_pm(slave, addr1, scale_index);
if (ret < 0) {
dev_err(&slave->dev, "SDW_SCP_BUSCLOCK_SCALE register write failed\n");
return ret;
}
slave->scale_index = scale_index;
}

manager_runtime:
Expand Down
2 changes: 2 additions & 0 deletions include/linux/soundwire/sdw.h
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ struct sdw_slave_ops {
* protocol for SoundWire mockup devices
* @sdw_dev_lock: mutex used to protect callbacks/remove races
* @sdca_data: structure containing all device data for SDCA helpers
* @scale_index: current bus clock scaling index
*/
struct sdw_slave {
struct sdw_slave_id id;
Expand All @@ -686,6 +687,7 @@ struct sdw_slave {
bool is_mockup_device;
struct mutex sdw_dev_lock; /* protect callbacks/remove races */
struct sdca_device_data sdca_data;
unsigned int scale_index;
};

#define dev_to_sdw_dev(_dev) container_of(_dev, struct sdw_slave, dev)
Expand Down
Loading