]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitbfdfb742d229a98ecab3a73633874d3fc29c78c1
tree528d7d97ee7cc64ed14b7cc489ea863922ebbc10
parent473f62d5c03527b3f3dc44c634644886443a8de3
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