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>