[PATCH v1 0/4] Add static channel mapping between soundwire master and slave

Mohammad Rafi Shaik posted 4 patches 2 months, 3 weeks ago
There is a newer version of this series
.../bindings/sound/qcom,wcd937x-sdw.yaml      | 28 ++++++++++
drivers/soundwire/qcom.c                      | 18 +++++++
drivers/soundwire/stream.c                    | 16 ++++++
include/linux/soundwire/sdw.h                 |  5 ++
sound/soc/codecs/wcd937x-sdw.c                | 52 ++++++++++++++++---
sound/soc/codecs/wcd937x.c                    | 12 ++++-
sound/soc/codecs/wcd937x.h                    |  6 ++-
7 files changed, 126 insertions(+), 11 deletions(-)
[PATCH v1 0/4] Add static channel mapping between soundwire master and slave
Posted by Mohammad Rafi Shaik 2 months, 3 weeks ago
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.

Mohammad Rafi Shaik (4):
  ASoC: dt-bindings: wcd938x-sdw: Add static channel mapping support
  soundwire: stream: Add set_master_channel_map() to set static channel
    mapping
  soundwire: qcom: Add static channel mapping support in soundwire
    master
  ASoC: codecs: wcd937x: Add static channel mapping support in
    wcd937x-sdw

 .../bindings/sound/qcom,wcd937x-sdw.yaml      | 28 ++++++++++
 drivers/soundwire/qcom.c                      | 18 +++++++
 drivers/soundwire/stream.c                    | 16 ++++++
 include/linux/soundwire/sdw.h                 |  5 ++
 sound/soc/codecs/wcd937x-sdw.c                | 52 ++++++++++++++++---
 sound/soc/codecs/wcd937x.c                    | 12 ++++-
 sound/soc/codecs/wcd937x.h                    |  6 ++-
 7 files changed, 126 insertions(+), 11 deletions(-)


base-commit: 9aaeb87ce1e966169a57f53a02ba05b30880ffb8
-- 
2.25.1
Re: [PATCH v1 0/4] Add static channel mapping between soundwire master and slave
Posted by Pierre-Louis Bossart 2 months, 3 weeks ago

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.
Re: [PATCH v1 0/4] Add static channel mapping between soundwire master and slave
Posted by Charles Keepax 2 months, 3 weeks ago
On Mon, Sep 09, 2024 at 04:25:43PM +0530, 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.

Apologies but I am not really following what exactly the issue is
here? How do these ports map to DAI links? It looks like you are
attempting to have AMIC2 produced by one DAI link, but consumed
by another?

Thanks,
Charles
Re: [PATCH v1 0/4] Add static channel mapping between soundwire master and slave
Posted by Mark Brown 2 months, 3 weeks ago
On Mon, Sep 09, 2024 at 03:49:47PM +0100, Charles Keepax wrote:
> On Mon, Sep 09, 2024 at 04:25:43PM +0530, 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.

...

> > 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.

> Apologies but I am not really following what exactly the issue is
> here? How do these ports map to DAI links? It looks like you are
> attempting to have AMIC2 produced by one DAI link, but consumed
> by another?

Yes, and it's also not clear to me why this is device specific.