Skip to content

Commit

Permalink
ASoC: audio-graph-card: add asoc_graph_card_get_conversion()
Browse files Browse the repository at this point in the history
audio-graph-card is now supporting normal sound and DPCM sound.
For DPCM sound, original sound card (= audio-graph-scu) had been
supported 1 CPU : 1 Codec connection which uses hw_params_fixup()
for convert-rate/channel.
But, merged audio-graph-card is completely forgeting about it.

To re-support 1 CPU : 1 Codec DPCM for hw_params_fixup(),
it need to judge whether it is DPCM by checking convert-rate/channel.
For this purpose, this patch adds asoc_graph_card_get_conversion()
as preparation

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Kuninori Morimoto authored and Mark Brown committed Jan 3, 2019
1 parent a0c426f commit 40dfae1
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions sound/soc/generic/audio-graph-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,22 @@ static int asoc_graph_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
return 0;
}

static void asoc_graph_card_get_conversion(struct device *dev,
struct device_node *ep,
struct asoc_simple_card_data *adata)
{
struct device_node *top = dev->of_node;
struct device_node *port = of_get_parent(ep);
struct device_node *ports = of_get_parent(port);
struct device_node *node = of_graph_get_port_parent(ep);

asoc_simple_card_parse_convert(dev, top, NULL, adata);
asoc_simple_card_parse_convert(dev, node, PREFIX, adata);
asoc_simple_card_parse_convert(dev, ports, NULL, adata);
asoc_simple_card_parse_convert(dev, port, NULL, adata);
asoc_simple_card_parse_convert(dev, ep, NULL, adata);
}

static int asoc_graph_card_dai_link_of_dpcm(struct device_node *top,
struct device_node *cpu_ep,
struct device_node *codec_ep,
Expand All @@ -194,11 +210,7 @@ static int asoc_graph_card_dai_link_of_dpcm(struct device_node *top,
of_property_read_u32(port, "mclk-fs", &dai_props->mclk_fs);
of_property_read_u32(ep, "mclk-fs", &dai_props->mclk_fs);

asoc_simple_card_parse_convert(dev, top, NULL, &dai_props->adata);
asoc_simple_card_parse_convert(dev, node, PREFIX, &dai_props->adata);
asoc_simple_card_parse_convert(dev, ports, NULL, &dai_props->adata);
asoc_simple_card_parse_convert(dev, port, NULL, &dai_props->adata);
asoc_simple_card_parse_convert(dev, ep, NULL, &dai_props->adata);
asoc_graph_card_get_conversion(dev, ep, &dai_props->adata);

of_node_put(ports);
of_node_put(port);
Expand Down

0 comments on commit 40dfae1

Please sign in to comment.