Commit 62bc79d3 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc.h: add explanation of legacy/modern style of dai_link

Current ALSA SoC is assuming 1 CPU 1 Platform (= DMA) style system.
Because of this background, it is directly using
xxx_name / xxx_of_node / xxx_dai_name on dai_link.
Let's call it as legacy style here.

More complex style system like multi CPU multi Platform (= DMA) will
coming. To supporting it, we can use snd_soc_dai_link_component on
dai_link. Let's call it as modern style here.
But current ALSA SoC can't support it so far. Thus, we need to have
multi CPU / multi Codec / multi Platform style in the future on ALSA SoC.

Currently we already have multi Codec support. Platform is starting to
use modern style on dai_link, but still style only. Multi Platform is
not yet implemented. And we still don't have multi CPU support on ALSA
SoC, and not have modern style either.

Currently, if driver is using legacy style Codec/Platform, it will be
converted to modern style on soc-core. This means, we are using glue code
for legacy vs modern style so far on ALSA SoC.
We can fully switch to modern style on all drivers if ALSA SoC supported
modern style for CPU, and then, legacy style code will be removed from
ALSA SoC.
Untile then, we need to keep both legacy/modern style and its glue code.
This patch adds such future plan and background on soc.h
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f557d39a
...@@ -891,6 +891,18 @@ struct snd_soc_dai_link { ...@@ -891,6 +891,18 @@ struct snd_soc_dai_link {
/* config - must be set by machine driver */ /* config - must be set by machine driver */
const char *name; /* Codec name */ const char *name; /* Codec name */
const char *stream_name; /* Stream name */ const char *stream_name; /* Stream name */
/*
* cpu_name
* cpu_of_node
* cpu_dai_name
*
* These are legacy style, and will be replaced to
* modern style (= snd_soc_dai_link_component) in the future,
* but, not yet supported so far.
* If modern style was supported for CPU, all driver will switch
* to use it, and, legacy style code will be removed from ALSA SoC.
*/
/* /*
* You MAY specify the link's CPU-side device, either by device name, * You MAY specify the link's CPU-side device, either by device name,
* or by DT/OF node, but not both. If this information is omitted, * or by DT/OF node, but not both. If this information is omitted,
...@@ -906,6 +918,19 @@ struct snd_soc_dai_link { ...@@ -906,6 +918,19 @@ struct snd_soc_dai_link {
* only, which only works well when that device exposes a single DAI. * only, which only works well when that device exposes a single DAI.
*/ */
const char *cpu_dai_name; const char *cpu_dai_name;
/*
* codec_name
* codec_of_node
* codec_dai_name
*
* These are legacy style, it will be converted to modern style
* (= snd_soc_dai_link_component) automatically in soc-core
* if driver is using legacy style.
* Driver shouldn't use both legacy and modern style in the same time.
* If modern style was supported for CPU, all driver will switch
* to use it, and, legacy style code will be removed from ALSA SoC.
*/
/* /*
* You MUST specify the link's codec, either by device name, or by * You MUST specify the link's codec, either by device name, or by
* DT/OF node, but not both. * DT/OF node, but not both.
...@@ -918,6 +943,17 @@ struct snd_soc_dai_link { ...@@ -918,6 +943,17 @@ struct snd_soc_dai_link {
struct snd_soc_dai_link_component *codecs; struct snd_soc_dai_link_component *codecs;
unsigned int num_codecs; unsigned int num_codecs;
/*
* platform_name
* platform_of_node
*
* These are legacy style, it will be converted to modern style
* (= snd_soc_dai_link_component) automatically in soc-core
* if driver is using legacy style.
* Driver shouldn't use both legacy and modern style in the same time.
* If modern style was supported for CPU, all driver will switch
* to use it, and, legacy style code will be removed from ALSA SoC.
*/
/* /*
* You MAY specify the link's platform/PCM/DMA driver, either by * You MAY specify the link's platform/PCM/DMA driver, either by
* device name, or by DT/OF node, but not both. Some forms of link * device name, or by DT/OF node, but not both. Some forms of link
......
...@@ -1029,9 +1029,14 @@ static int snd_soc_init_platform(struct snd_soc_card *card, ...@@ -1029,9 +1029,14 @@ static int snd_soc_init_platform(struct snd_soc_card *card,
struct snd_soc_dai_link_component *platform = dai_link->platform; struct snd_soc_dai_link_component *platform = dai_link->platform;
/* /*
* FIXME * REMOVE ME
* *
* this function should be removed in the future * This is glue code for Legacy vs Modern dai_link.
* This function will be removed if all derivers are switched to
* modern style dai_link.
* Driver shouldn't use both legacy and modern style in the same time.
* see
* soc.h :: struct snd_soc_dai_link
*/ */
/* convert Legacy platform link */ /* convert Legacy platform link */
if (!platform || dai_link->legacy_platform) { if (!platform || dai_link->legacy_platform) {
...@@ -1059,6 +1064,17 @@ static int snd_soc_init_platform(struct snd_soc_card *card, ...@@ -1059,6 +1064,17 @@ static int snd_soc_init_platform(struct snd_soc_card *card,
static int snd_soc_init_multicodec(struct snd_soc_card *card, static int snd_soc_init_multicodec(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_link) struct snd_soc_dai_link *dai_link)
{ {
/*
* REMOVE ME
*
* This is glue code for Legacy vs Modern dai_link.
* This function will be removed if all derivers are switched to
* modern style dai_link.
* Driver shouldn't use both legacy and modern style in the same time.
* see
* soc.h :: struct snd_soc_dai_link
*/
/* Legacy codec/codec_dai link is a single entry in multicodec */ /* Legacy codec/codec_dai link is a single entry in multicodec */
if (dai_link->codec_name || dai_link->codec_of_node || if (dai_link->codec_name || dai_link->codec_of_node ||
dai_link->codec_dai_name) { dai_link->codec_dai_name) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment