ASoC: meson: axg-card: add basic codec-to-codec link support

Add basic support for codec-to-codec link in the axg sound card.
The cpu side of these links is expected to properly set the hw_params
and format of the link.

ATM, only the tohdmitx glue is supported but others (like the
internal DAC glue) should follow.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Jerome Brunet 2019-05-15 15:18:57 +02:00 committed by Mark Brown
parent e35f5ad6a9
commit 0a8f1117a6
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -29,6 +29,18 @@ struct axg_dai_link_tdm_data {
struct axg_dai_link_tdm_mask *codec_masks;
};
/*
* Base params for the codec to codec links
* Those will be over-written by the CPU side of the link
*/
static const struct snd_soc_pcm_stream codec_params = {
.formats = SNDRV_PCM_FMTBIT_S24_LE,
.rate_min = 5525,
.rate_max = 192000,
.channels_min = 1,
.channels_max = 8,
};
#define PREFIX "amlogic,"
static int axg_card_reallocate_links(struct axg_card *priv,
@ -517,6 +529,11 @@ static int axg_card_cpu_is_tdm_iface(struct device_node *np)
return of_device_is_compatible(np, PREFIX "axg-tdm-iface");
}
static int axg_card_cpu_is_codec(struct device_node *np)
{
return of_device_is_compatible(np, PREFIX "g12a-tohdmitx");
}
static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np,
int *index)
{
@ -540,6 +557,8 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np,
if (axg_card_cpu_is_tdm_iface(dai_link->cpu_of_node))
ret = axg_card_parse_tdm(card, np, index);
else if (axg_card_cpu_is_codec(dai_link->cpu_of_node))
dai_link->params = &codec_params;
return ret;
}