Skip to content

Commit

Permalink
ASoC: meson: axg-card: add basic codec-to-codec link support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jbrun3t authored and broonie committed May 16, 2019
1 parent e35f5ad commit 0a8f111
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sound/soc/meson/axg-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
}
Expand Down

0 comments on commit 0a8f111

Please sign in to comment.