]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ASoC: meson: axg-card: add basic codec-to-codec link support
authorJerome Brunet <jbrunet@baylibre.com>
Wed, 15 May 2019 13:18:57 +0000 (15:18 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 16 May 2019 11:13:30 +0000 (12:13 +0100)
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>
sound/soc/meson/axg-card.c

index 5c8deee8d512d2d9bf70f9ced42bae88403e034a..db0a7fc18928dbe183b06e0d97243939fa635bd0 100644 (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;
 }