OSDN Git Service

ASoC: sgtl5000: add multi endpoint support
authorMarek Vasut <marex@denx.de>
Thu, 19 Dec 2019 21:32:19 +0000 (22:32 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 14 Jan 2020 16:20:33 +0000 (16:20 +0000)
commit06bf8ea4f8ae34f91e60d27c8065f55d7a88c682
tree528d7d97ee7cc64ed14b7cc489ea863922ebbc10
parentc05f10f28ef697aae8f1d82012d660af3cfc8cf9
ASoC: sgtl5000: add multi endpoint support

Support multiple endpoints on SGTL5000 codec port when used in
of_graph context.

This patch allows to share the codec port between two CPU DAIs.

Example:

Custom STM32MP157C board uses SGTL5000 audio codec. This codec is
connected to two serial audio interfaces, which are configured
either as rx or tx.

From AsoC point of view the topolgy is the following:
// 2 CPU DAIs (SAI2A/B), 1 Codec (SGTL5000)
Playback: CPU-A-DAI(slave) -> (master)CODEC-DAI/port0
Record:   CPU-B-DAI(slave) <- (master)CODEC-DAI/port0

In the DT two endpoints have to be associated to the codec port:
sgtl5000_port: port {
    sgtl5000_tx_endpoint: endpoint@0 {
    remote-endpoint = <&sai2a_endpoint>;
    };
    sgtl5000_rx_endpoint: endpoint@1 {
    remote-endpoint = <&sai2b_endpoint>;
    };
};

However, when the audio graph card parses the codec nodes, it expects
to find DAI interface indexes matching the endpoints indexes.

The current patch forces the use of DAI id 0 for both endpoints,
which allows to share the codec DAI between the two CPU DAIs
for playback and capture streams respectively.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20191219213219.366073-1-marex@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/sgtl5000.c