[alsa-devel] [PATCH 0/6] ASoC: simple-card: add init_dai / canonicalize_dailink
Hi Mark
These add init_dai / canonicalize_dailink to simple utiles. These are part of simple-card cleanup
Kuninori Morimoto (6): ASoC: simple-card-utils: add asoc_simple_card_init_dai() ASoC: simple-card: use asoc_simple_card_init_dai() ASoC: rsrc-card: use asoc_simple_card_init_dai() ASoC: simple-card-utils: add asoc_simple_card_canonicalize_dailink() ASoC: simple-card: use asoc_simple_card_canonicalize_dailink() ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink()
include/sound/simple_card_utils.h | 5 +++++ sound/soc/generic/simple-card-utils.c | 42 ++++++++++++++++++++++++++++++++++++++++++ sound/soc/generic/simple-card.c | 47 +++++------------------------------------------ sound/soc/sh/rcar/rsrc-card.c | 32 +++++--------------------------- 4 files changed, 57 insertions(+), 69 deletions(-)
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
simple-card is supporting clock/tdm slot initialization. This patch makes this method simple style standard.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+)
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 62b3926..13168e0 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -58,4 +58,6 @@ int asoc_simple_card_parse_dai(struct device_node *node, const char *cells_name, int *is_single_links);
+int asoc_simple_card_init_dai(struct snd_soc_dai *dai, + struct asoc_simple_dai *simple_dai); #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 27e6d03..33abe1f 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -164,6 +164,35 @@ int asoc_simple_card_parse_dai(struct device_node *node, } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dai);
+int asoc_simple_card_init_dai(struct snd_soc_dai *dai, + struct asoc_simple_dai *simple_dai) +{ + int ret; + + if (simple_dai->sysclk) { + ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk, 0); + if (ret && ret != -ENOTSUPP) { + dev_err(dai->dev, "simple-card: set_sysclk error\n"); + return ret; + } + } + + if (simple_dai->slots) { + ret = snd_soc_dai_set_tdm_slot(dai, + simple_dai->tx_slot_mask, + simple_dai->rx_slot_mask, + simple_dai->slots, + simple_dai->slot_width); + if (ret && ret != -ENOTSUPP) { + dev_err(dai->dev, "simple-card: set_tdm_slot error\n"); + return ret; + } + } + + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai); + /* Module information */ MODULE_AUTHOR("Kuninori Morimoto kuninori.morimoto.gx@renesas.com"); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");
The patch
ASoC: simple-card-utils: add asoc_simple_card_init_dai()
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 21ba62f849a20accf7d41e3056ea8913bc23cfb1 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Tue, 9 Aug 2016 05:48:30 +0000 Subject: [PATCH] ASoC: simple-card-utils: add asoc_simple_card_init_dai()
simple-card is supporting clock/tdm slot initialization. This patch makes this method simple style standard.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+)
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 62b392695d2d..13168e029232 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -58,4 +58,6 @@ int asoc_simple_card_parse_dai(struct device_node *node, const char *cells_name, int *is_single_links);
+int asoc_simple_card_init_dai(struct snd_soc_dai *dai, + struct asoc_simple_dai *simple_dai); #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 27e6d038a902..33abe1f7014e 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -164,6 +164,35 @@ int asoc_simple_card_parse_dai(struct device_node *node, } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dai);
+int asoc_simple_card_init_dai(struct snd_soc_dai *dai, + struct asoc_simple_dai *simple_dai) +{ + int ret; + + if (simple_dai->sysclk) { + ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk, 0); + if (ret && ret != -ENOTSUPP) { + dev_err(dai->dev, "simple-card: set_sysclk error\n"); + return ret; + } + } + + if (simple_dai->slots) { + ret = snd_soc_dai_set_tdm_slot(dai, + simple_dai->tx_slot_mask, + simple_dai->rx_slot_mask, + simple_dai->slots, + simple_dai->slot_width); + if (ret && ret != -ENOTSUPP) { + dev_err(dai->dev, "simple-card: set_tdm_slot error\n"); + return ret; + } + } + + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai); + /* Module information */ MODULE_AUTHOR("Kuninori Morimoto kuninori.morimoto.gx@renesas.com"); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/generic/simple-card.c | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-)
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 99028c1..03ecca8 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -179,51 +179,19 @@ static struct snd_soc_ops asoc_simple_card_ops = { .hw_params = asoc_simple_card_hw_params, };
-static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, - struct asoc_simple_dai *set) -{ - int ret; - - if (set->sysclk) { - ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0); - if (ret && ret != -ENOTSUPP) { - dev_err(dai->dev, "simple-card: set_sysclk error\n"); - goto err; - } - } - - if (set->slots) { - ret = snd_soc_dai_set_tdm_slot(dai, - set->tx_slot_mask, - set->rx_slot_mask, - set->slots, - set->slot_width); - if (ret && ret != -ENOTSUPP) { - dev_err(dai->dev, "simple-card: set_tdm_slot error\n"); - goto err; - } - } - - ret = 0; - -err: - return ret; -} - static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) { struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); struct snd_soc_dai *codec = rtd->codec_dai; struct snd_soc_dai *cpu = rtd->cpu_dai; - struct simple_dai_props *dai_props; + struct simple_dai_props *dai_props = &priv->dai_props[rtd->num]; int ret;
- dai_props = &priv->dai_props[rtd->num]; - ret = __asoc_simple_card_dai_init(codec, &dai_props->codec_dai); + ret = asoc_simple_card_init_dai(codec, &dai_props->codec_dai); if (ret < 0) return ret;
- ret = __asoc_simple_card_dai_init(cpu, &dai_props->cpu_dai); + ret = asoc_simple_card_init_dai(cpu, &dai_props->cpu_dai); if (ret < 0) return ret;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/sh/rcar/rsrc-card.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-)
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index 82187e0..1bf3563 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -97,7 +97,6 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dai_link *dai_link; struct asoc_simple_dai *dai_props; int num = rtd->num; - int ret;
dai_link = rsrc_priv_to_link(priv, num); dai_props = rsrc_priv_to_props(priv, num); @@ -105,30 +104,7 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd) rtd->cpu_dai : rtd->codec_dai;
- if (dai_props->sysclk) { - ret = snd_soc_dai_set_sysclk(dai, 0, dai_props->sysclk, 0); - if (ret && ret != -ENOTSUPP) { - dev_err(dai->dev, "set_sysclk error\n"); - goto err; - } - } - - if (dai_props->slots) { - ret = snd_soc_dai_set_tdm_slot(dai, - dai_props->tx_slot_mask, - dai_props->rx_slot_mask, - dai_props->slots, - dai_props->slot_width); - if (ret && ret != -ENOTSUPP) { - dev_err(dai->dev, "set_tdm_slot error\n"); - goto err; - } - } - - ret = 0; - -err: - return ret; + return asoc_simple_card_init_dai(dai, dai_props); }
static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
simple-card is assuming that sometimes platform and cpu are same. This patch makes this method simple style standard.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/simple_card_utils.h | 3 +++ sound/soc/generic/simple-card-utils.c | 13 +++++++++++++ 2 files changed, 16 insertions(+)
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 13168e0..a71d46a 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -60,4 +60,7 @@ int asoc_simple_card_parse_dai(struct device_node *node,
int asoc_simple_card_init_dai(struct snd_soc_dai *dai, struct asoc_simple_dai *simple_dai); + +int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link); + #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 33abe1f..189eadd 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -193,6 +193,19 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai, } EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai);
+int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link) +{ + if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) + return -EINVAL; + + /* Assumes platform == cpu */ + if (!dai_link->platform_of_node) + dai_link->platform_of_node = dai_link->cpu_of_node; + + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_dailink); + /* Module information */ MODULE_AUTHOR("Kuninori Morimoto kuninori.morimoto.gx@renesas.com"); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");
The patch
ASoC: simple-card-utils: add asoc_simple_card_canonicalize_dailink()
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From c262c9ab7a956b15c4c12b81472502a587d0dfcd Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Tue, 9 Aug 2016 05:49:41 +0000 Subject: [PATCH] ASoC: simple-card-utils: add asoc_simple_card_canonicalize_dailink()
simple-card is assuming that sometimes platform and cpu are same. This patch makes this method simple style standard.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- include/sound/simple_card_utils.h | 3 +++ sound/soc/generic/simple-card-utils.c | 13 +++++++++++++ 2 files changed, 16 insertions(+)
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 13168e029232..a71d46a95ca8 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -60,4 +60,7 @@ int asoc_simple_card_parse_dai(struct device_node *node,
int asoc_simple_card_init_dai(struct snd_soc_dai *dai, struct asoc_simple_dai *simple_dai); + +int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link); + #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 33abe1f7014e..189eadddfad3 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -193,6 +193,19 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai, } EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai);
+int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link) +{ + if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) + return -EINVAL; + + /* Assumes platform == cpu */ + if (!dai_link->platform_of_node) + dai_link->platform_of_node = dai_link->cpu_of_node; + + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_dailink); + /* Module information */ MODULE_AUTHOR("Kuninori Morimoto kuninori.morimoto.gx@renesas.com"); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/generic/simple-card.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 03ecca8..8b1efdd 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -286,14 +286,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, if (ret < 0) goto dai_link_of_err;
- if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) { - ret = -EINVAL; + ret = asoc_simple_card_canonicalize_dailink(dai_link); + if (ret < 0) goto dai_link_of_err; - } - - /* Assumes platform == cpu */ - if (!dai_link->platform_of_node) - dai_link->platform_of_node = dai_link->cpu_of_node;
ret = asoc_simple_card_set_dailink_name(dev, dai_link, "%s-%s",
The patch
ASoC: simple-card: use asoc_simple_card_canonicalize_dailink()
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From c958374f1cd22ec87f210985f9f9e1ba8b3df30b Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Tue, 9 Aug 2016 05:50:02 +0000 Subject: [PATCH] ASoC: simple-card: use asoc_simple_card_canonicalize_dailink()
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/generic/simple-card.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 03ecca85a724..8b1efdd2b115 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -286,14 +286,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, if (ret < 0) goto dai_link_of_err;
- if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) { - ret = -EINVAL; + ret = asoc_simple_card_canonicalize_dailink(dai_link); + if (ret < 0) goto dai_link_of_err; - } - - /* Assumes platform == cpu */ - if (!dai_link->platform_of_node) - dai_link->platform_of_node = dai_link->cpu_of_node;
ret = asoc_simple_card_set_dailink_name(dev, dai_link, "%s-%s",
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/sh/rcar/rsrc-card.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index 1bf3563..0bf17dae 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -222,8 +222,10 @@ static int rsrc_card_parse_links(struct device_node *np, } }
- /* Simple Card assumes platform == cpu */ - dai_link->platform_of_node = dai_link->cpu_of_node; + ret = asoc_simple_card_canonicalize_dailink(dai_link); + if (ret < 0) + return ret; + dai_link->dpcm_playback = 1; dai_link->dpcm_capture = 1; dai_link->ops = &rsrc_card_ops;
The patch
ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink()
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From a09f383ef72947b7d59fc7fe50fe332ab5c35dca Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Tue, 9 Aug 2016 05:50:19 +0000 Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink()
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/sh/rcar/rsrc-card.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index 1bf35634ebba..0bf17dae2b64 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -222,8 +222,10 @@ static int rsrc_card_parse_links(struct device_node *np, } }
- /* Simple Card assumes platform == cpu */ - dai_link->platform_of_node = dai_link->cpu_of_node; + ret = asoc_simple_card_canonicalize_dailink(dai_link); + if (ret < 0) + return ret; + dai_link->dpcm_playback = 1; dai_link->dpcm_capture = 1; dai_link->ops = &rsrc_card_ops;
participants (2)
-
Kuninori Morimoto
-
Mark Brown