On 9/9/24 12:55, Mohammad Rafi Shaik wrote: > Add static channel map support between soundwire master and slave. > This patch series will resolve channel mask mismatch between master and slave. > > Scenario: wcd937x AMIC2 usecase > > Master Slave (wcd937x) > +--------------+ +--------------+ > | +--------+ | | +--------+ | > AMIC1 ----->| | PORT1 | | | | TX1 | |<-----------AMIC1 > AMIC2 ----->| | | | | | | | > | +--------+ | | +--------+ | > | | | | > AMIC3 ----->| +--------+ | | +--------+ | > | | PORT2 | | | | TX2 | |<-----------AMIC2 > | | | | | | | |<-----------AMIC3 > | +--------+ | | +--------+ | > | | | | > | +--------+ | | +--------+ | > DMIC0...DMIC3------>| | PORT3 | | | | TX3 | |<-----------DMIC0...DMIC3 > | | | | | | | |<-----------MBHC > | +--------+ | | +--------+ | > | | | | > | +--------+ | | +--------+ | > DMIC4...DMIC37----->| | PORT4 | | | | TX4 | |<-----------DMIC4...DMIC7 > | | | | | | | | > | +--------+ | | +--------+ | > | | | | > +------------- + +--------------+ > > For AMIC2 usecase, The Slave need to configure TX2 Port with channel mask 1 and > for Master required PORT1 with channel mask 2, > > In existing design master and slave configured with same channel mask, it will fail > AMIC2 usecase. > > The New design will help to configure channel mapping between master and slave from > device tree. That's rather controversial... In theory you already have the means to deal with a different channel mapping in the hw_params callback for your manager and peripheral devices. That's how we e.g. send a 2ch stream on the manager to two separate amplifiers and program which channel is used by what amplifier. The common part between manager and peripheral is the notion of 'stream', and you can add a different port/stream configuration for manager and peripheral with sdw_stream_add_master() and sdw_stream_add_slave() respectively. Port1 and TX2 can be used by just setting the relevant port_config.num value. Likewise the port_config.ch_mask can be programmed at will to select the relevant mappings. See e.g. rt1308_sdw_hw_params() in rt1308-sdw.c, the mapping were handled with a set_tdm_slot() callback before. In short, please re-visit your hw_params() implementation first and use the existing 'stream' APIs.