Add set_master_channel_map() to set the static channel map between master and slave. Patch change will resolve the channel mask mismatch between the master and slave. The sdw_set_channel_map_stream() will triggered by a slave with active port number and channel mask. Signed-off-by: Mohammad Rafi Shaik <quic_mohs@xxxxxxxxxxx> --- drivers/soundwire/stream.c | 16 ++++++++++++++++ include/linux/soundwire/sdw.h | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index f275143d7b18..8cfea2ccb5bd 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -1972,6 +1972,22 @@ int sdw_stream_remove_master(struct sdw_bus *bus, } EXPORT_SYMBOL(sdw_stream_remove_master); +int sdw_set_channel_map_stream(struct sdw_stream_runtime *stream, + int *ch_mask, unsigned int active_port_num) +{ + struct sdw_master_runtime *m_rt; + struct sdw_bus *bus; + + list_for_each_entry(m_rt, &stream->master_list, stream_node) { + bus = m_rt->bus; + if (bus->ops->set_master_channel_map) + bus->ops->set_master_channel_map(bus, ch_mask, active_port_num); + } + + return 0; +} +EXPORT_SYMBOL(sdw_set_channel_map_stream); + /** * sdw_stream_add_slave() - Allocate and add master/slave runtime to a stream * diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 5e0dd47a0412..264450763bab 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -857,6 +857,8 @@ struct sdw_master_ops { (struct sdw_bus *bus); int (*set_bus_conf)(struct sdw_bus *bus, struct sdw_bus_params *params); + int (*set_master_channel_map)(struct sdw_bus *bus, int *ch_mask, + unsigned int port_num); int (*pre_bank_switch)(struct sdw_bus *bus); int (*post_bank_switch)(struct sdw_bus *bus); u32 (*read_ping_status)(struct sdw_bus *bus); @@ -1049,6 +1051,9 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus); int sdw_compare_devid(struct sdw_slave *slave, struct sdw_slave_id id); void sdw_extract_slave_id(struct sdw_bus *bus, u64 addr, struct sdw_slave_id *id); +int sdw_set_channel_map_stream(struct sdw_stream_runtime *stream, + int *ch_mask, unsigned int active_port_num); + #if IS_ENABLED(CONFIG_SOUNDWIRE) int sdw_stream_add_slave(struct sdw_slave *slave, -- 2.25.1