[alsa-devel] [PATCH 0/9] ASoC: cleanup for ASoC
Hi Mark
I'm tring to "no categorize DAI" now, but it will takes more time. Then, I noticed some current code is not good balance for it. It is small issue. But it is very helpful if it had been already solved before posting such patch-set.
Kuninori Morimoto (9): ASoC: soc-core: use i on snd_soc_resume() ASoC: soc-core: don't use codec_dais on soc_bind_dai_link() ASoC: soc-core: tidyup soc_bind_dai_link() comment balance ASoC: soc-core: add soc_component_to_node() ASoC: soc-core: use soc_find_component() at snd_soc_get_dai_id() ASoC: soc.h: fe_compr can be bit field ASoC: soc-pcm: do cpu_dai related operation at same place ASoC: soc-pcm: add missing cpu_dai->rate = 0 ASoC: soc-pcm: add soc_pcm_components_open()
include/sound/soc.h | 2 +- sound/soc/soc-core.c | 75 ++++++++++++++++++++---------------------------- sound/soc/soc-pcm.c | 80 ++++++++++++++++++++++++++++++++-------------------- 3 files changed, 81 insertions(+), 76 deletions(-)
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch uses "int i" instead of "int j" on snd_soc_resume(), and moves struct snd_soc_dai *codec_dai to top of this function. This is cleanup and prepare for Multi CPU support
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 2403bec..0d9b020 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -687,6 +687,8 @@ int snd_soc_resume(struct device *dev) struct snd_soc_card *card = dev_get_drvdata(dev); bool bus_control = false; struct snd_soc_pcm_runtime *rtd; + struct snd_soc_dai *codec_dai; + int i;
/* If the card is not initialized yet there is nothing to do */ if (!card->instantiated) @@ -694,14 +696,12 @@ int snd_soc_resume(struct device *dev)
/* activate pins from sleep state */ for_each_card_rtds(card, rtd) { - struct snd_soc_dai *codec_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; - int j;
if (cpu_dai->active) pinctrl_pm_select_default_state(cpu_dai->dev);
- for_each_rtd_codec_dai(rtd, j, codec_dai) { + for_each_rtd_codec_dai(rtd, i, codec_dai) { if (codec_dai->active) pinctrl_pm_select_default_state(codec_dai->dev); }
The patch
ASoC: soc-core: use i on snd_soc_resume()
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3
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 22d251a5964780452aed378a143816fbf2d4201d Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Mon, 13 May 2019 16:06:07 +0900 Subject: [PATCH] ASoC: soc-core: use i on snd_soc_resume()
This patch uses "int i" instead of "int j" on snd_soc_resume(), and moves struct snd_soc_dai *codec_dai to top of this function. This is cleanup and prepare for Multi CPU support
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 2403bec2fccf..0d9b02075050 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -687,6 +687,8 @@ int snd_soc_resume(struct device *dev) struct snd_soc_card *card = dev_get_drvdata(dev); bool bus_control = false; struct snd_soc_pcm_runtime *rtd; + struct snd_soc_dai *codec_dai; + int i;
/* If the card is not initialized yet there is nothing to do */ if (!card->instantiated) @@ -694,14 +696,12 @@ int snd_soc_resume(struct device *dev)
/* activate pins from sleep state */ for_each_card_rtds(card, rtd) { - struct snd_soc_dai *codec_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; - int j;
if (cpu_dai->active) pinctrl_pm_select_default_state(cpu_dai->dev);
- for_each_rtd_codec_dai(rtd, j, codec_dai) { + for_each_rtd_codec_dai(rtd, i, codec_dai) { if (codec_dai->active) pinctrl_pm_select_default_state(codec_dai->dev); }
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Current soc_bind_dai_link() is substituting rtd->codec_dais to codec_dais, and sets found DAI into it. But, it is a little bit un-readable / un-understandable to know detail of rtd, and it will make difficult to understand rtd->cpu_dais if Multi CPU was supported. This patch cleanup it and prepare for Multi CPU support.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 0d9b020..2ceca7f 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -878,7 +878,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link_component *codecs; struct snd_soc_dai_link_component cpu_dai_component; struct snd_soc_component *component; - struct snd_soc_dai **codec_dais; int i;
if (dai_link->ignore) @@ -910,19 +909,18 @@ static int soc_bind_dai_link(struct snd_soc_card *card, rtd->num_codecs = dai_link->num_codecs;
/* Find CODEC from registered CODECs */ - codec_dais = rtd->codec_dais; for_each_link_codecs(dai_link, i, codecs) { - codec_dais[i] = snd_soc_find_dai(codecs); - if (!codec_dais[i]) { + rtd->codec_dais[i] = snd_soc_find_dai(codecs); + if (!rtd->codec_dais[i]) { dev_info(card->dev, "ASoC: CODEC DAI %s not registered\n", codecs->dai_name); goto _err_defer; } - snd_soc_rtdcom_add(rtd, codec_dais[i]->component); + snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component); }
/* Single codec links expect codec and codec_dai in runtime data */ - rtd->codec_dai = codec_dais[0]; + rtd->codec_dai = rtd->codec_dais[0];
/* find one from the set of registered platforms */ for_each_component(component) {
The patch
ASoC: soc-core: don't use codec_dais on soc_bind_dai_link()
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3
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 0a2cfcd998e3503c20be497cadb0ef23edb984be Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Mon, 13 May 2019 16:06:30 +0900 Subject: [PATCH] ASoC: soc-core: don't use codec_dais on soc_bind_dai_link()
Current soc_bind_dai_link() is substituting rtd->codec_dais to codec_dais, and sets found DAI into it. But, it is a little bit un-readable / un-understandable to know detail of rtd, and it will make difficult to understand rtd->cpu_dais if Multi CPU was supported. This patch cleanup it and prepare for Multi CPU support.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 0d9b02075050..2ceca7fdf622 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -878,7 +878,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link_component *codecs; struct snd_soc_dai_link_component cpu_dai_component; struct snd_soc_component *component; - struct snd_soc_dai **codec_dais; int i;
if (dai_link->ignore) @@ -910,19 +909,18 @@ static int soc_bind_dai_link(struct snd_soc_card *card, rtd->num_codecs = dai_link->num_codecs;
/* Find CODEC from registered CODECs */ - codec_dais = rtd->codec_dais; for_each_link_codecs(dai_link, i, codecs) { - codec_dais[i] = snd_soc_find_dai(codecs); - if (!codec_dais[i]) { + rtd->codec_dais[i] = snd_soc_find_dai(codecs); + if (!rtd->codec_dais[i]) { dev_info(card->dev, "ASoC: CODEC DAI %s not registered\n", codecs->dai_name); goto _err_defer; } - snd_soc_rtdcom_add(rtd, codec_dais[i]->component); + snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component); }
/* Single codec links expect codec and codec_dai in runtime data */ - rtd->codec_dai = codec_dais[0]; + rtd->codec_dai = rtd->codec_dais[0];
/* find one from the set of registered platforms */ for_each_component(component) {
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Many code at soc_bind_dai_link() was changed, and its comment is now a little bit anbalanced. This patch tidyup these.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 2ceca7f..c80e7df 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -906,9 +906,8 @@ static int soc_bind_dai_link(struct snd_soc_card *card, } snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
- rtd->num_codecs = dai_link->num_codecs; - /* Find CODEC from registered CODECs */ + rtd->num_codecs = dai_link->num_codecs; for_each_link_codecs(dai_link, i, codecs) { rtd->codec_dais[i] = snd_soc_find_dai(codecs); if (!rtd->codec_dais[i]) { @@ -922,7 +921,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, /* Single codec links expect codec and codec_dai in runtime data */ rtd->codec_dai = rtd->codec_dais[0];
- /* find one from the set of registered platforms */ + /* Find PLATFORM from registered PLATFORMs */ for_each_component(component) { if (!snd_soc_is_matching_component(dai_link->platforms, component))
The patch
ASoC: soc-core: tidyup soc_bind_dai_link() comment balance
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3
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 e2b30edfb9435879dc68cdb7ce20299492012101 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Mon, 13 May 2019 16:06:44 +0900 Subject: [PATCH] ASoC: soc-core: tidyup soc_bind_dai_link() comment balance
Many code at soc_bind_dai_link() was changed, and its comment is now a little bit anbalanced. This patch tidyup these.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 2ceca7fdf622..c80e7df3b20b 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -906,9 +906,8 @@ static int soc_bind_dai_link(struct snd_soc_card *card, } snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
- rtd->num_codecs = dai_link->num_codecs; - /* Find CODEC from registered CODECs */ + rtd->num_codecs = dai_link->num_codecs; for_each_link_codecs(dai_link, i, codecs) { rtd->codec_dais[i] = snd_soc_find_dai(codecs); if (!rtd->codec_dais[i]) { @@ -922,7 +921,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, /* Single codec links expect codec and codec_dai in runtime data */ rtd->codec_dai = rtd->codec_dais[0];
- /* find one from the set of registered platforms */ + /* Find PLATFORM from registered PLATFORMs */ for_each_component(component) { if (!snd_soc_is_matching_component(dai_link->platforms, component))
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Many function are getting device_node from component with caring its parent component. This patch adds new soc_component_to_node() and share same code.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-core.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c80e7df..e55170c 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -738,6 +738,18 @@ EXPORT_SYMBOL_GPL(snd_soc_resume); static const struct snd_soc_dai_ops null_dai_ops = { };
+static struct device_node +*soc_component_to_node(struct snd_soc_component *component) +{ + struct device_node *of_node; + + of_node = component->dev->of_node; + if (!of_node && component->dev->parent) + of_node = component->dev->parent->of_node; + + return of_node; +} + static struct snd_soc_component *soc_find_component( const struct device_node *of_node, const char *name) { @@ -748,9 +760,7 @@ static struct snd_soc_component *soc_find_component(
for_each_component(component) { if (of_node) { - component_of_node = component->dev->of_node; - if (!component_of_node && component->dev->parent) - component_of_node = component->dev->parent->of_node; + component_of_node = soc_component_to_node(component);
if (component_of_node == of_node) return component; @@ -768,9 +778,7 @@ static int snd_soc_is_matching_component( { struct device_node *component_of_node;
- component_of_node = component->dev->of_node; - if (!component_of_node && component->dev->parent) - component_of_node = component->dev->parent->of_node; + component_of_node = soc_component_to_node(component);
if (dlc->of_node && component_of_node != dlc->of_node) return 0; @@ -1317,13 +1325,10 @@ EXPORT_SYMBOL_GPL(snd_soc_remove_dai_link);
static void soc_set_of_name_prefix(struct snd_soc_component *component) { - struct device_node *component_of_node = component->dev->of_node; + struct device_node *component_of_node = soc_component_to_node(component); const char *str; int ret;
- if (!component_of_node && component->dev->parent) - component_of_node = component->dev->parent->of_node; - ret = of_property_read_string(component_of_node, "sound-name-prefix", &str); if (!ret) @@ -1337,10 +1342,7 @@ static void soc_set_name_prefix(struct snd_soc_card *card,
for (i = 0; i < card->num_configs && card->codec_conf; i++) { struct snd_soc_codec_conf *map = &card->codec_conf[i]; - struct device_node *component_of_node = component->dev->of_node; - - if (!component_of_node && component->dev->parent) - component_of_node = component->dev->parent->of_node; + struct device_node *component_of_node = soc_component_to_node(component);
if (map->of_node && component_of_node != map->of_node) continue; @@ -3764,10 +3766,7 @@ int snd_soc_get_dai_id(struct device_node *ep) ret = -ENOTSUPP; mutex_lock(&client_mutex); for_each_component(pos) { - struct device_node *component_of_node = pos->dev->of_node; - - if (!component_of_node && pos->dev->parent) - component_of_node = pos->dev->parent->of_node; + struct device_node *component_of_node = soc_component_to_node(pos);
if (component_of_node != node) continue; @@ -3794,9 +3793,7 @@ int snd_soc_get_dai_name(struct of_phandle_args *args,
mutex_lock(&client_mutex); for_each_component(pos) { - component_of_node = pos->dev->of_node; - if (!component_of_node && pos->dev->parent) - component_of_node = pos->dev->parent->of_node; + component_of_node = soc_component_to_node(pos);
if (component_of_node != args->np) continue;
The patch
ASoC: soc-core: add soc_component_to_node()
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3
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 c083444061ada428af71809cc12fd8f06dd2be19 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Mon, 13 May 2019 16:06:59 +0900 Subject: [PATCH] ASoC: soc-core: add soc_component_to_node()
Many function are getting device_node from component with caring its parent component. This patch adds new soc_component_to_node() and share same code.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-core.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c80e7df3b20b..e55170ce6d3e 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -738,6 +738,18 @@ EXPORT_SYMBOL_GPL(snd_soc_resume); static const struct snd_soc_dai_ops null_dai_ops = { };
+static struct device_node +*soc_component_to_node(struct snd_soc_component *component) +{ + struct device_node *of_node; + + of_node = component->dev->of_node; + if (!of_node && component->dev->parent) + of_node = component->dev->parent->of_node; + + return of_node; +} + static struct snd_soc_component *soc_find_component( const struct device_node *of_node, const char *name) { @@ -748,9 +760,7 @@ static struct snd_soc_component *soc_find_component(
for_each_component(component) { if (of_node) { - component_of_node = component->dev->of_node; - if (!component_of_node && component->dev->parent) - component_of_node = component->dev->parent->of_node; + component_of_node = soc_component_to_node(component);
if (component_of_node == of_node) return component; @@ -768,9 +778,7 @@ static int snd_soc_is_matching_component( { struct device_node *component_of_node;
- component_of_node = component->dev->of_node; - if (!component_of_node && component->dev->parent) - component_of_node = component->dev->parent->of_node; + component_of_node = soc_component_to_node(component);
if (dlc->of_node && component_of_node != dlc->of_node) return 0; @@ -1317,13 +1325,10 @@ EXPORT_SYMBOL_GPL(snd_soc_remove_dai_link);
static void soc_set_of_name_prefix(struct snd_soc_component *component) { - struct device_node *component_of_node = component->dev->of_node; + struct device_node *component_of_node = soc_component_to_node(component); const char *str; int ret;
- if (!component_of_node && component->dev->parent) - component_of_node = component->dev->parent->of_node; - ret = of_property_read_string(component_of_node, "sound-name-prefix", &str); if (!ret) @@ -1337,10 +1342,7 @@ static void soc_set_name_prefix(struct snd_soc_card *card,
for (i = 0; i < card->num_configs && card->codec_conf; i++) { struct snd_soc_codec_conf *map = &card->codec_conf[i]; - struct device_node *component_of_node = component->dev->of_node; - - if (!component_of_node && component->dev->parent) - component_of_node = component->dev->parent->of_node; + struct device_node *component_of_node = soc_component_to_node(component);
if (map->of_node && component_of_node != map->of_node) continue; @@ -3764,10 +3766,7 @@ int snd_soc_get_dai_id(struct device_node *ep) ret = -ENOTSUPP; mutex_lock(&client_mutex); for_each_component(pos) { - struct device_node *component_of_node = pos->dev->of_node; - - if (!component_of_node && pos->dev->parent) - component_of_node = pos->dev->parent->of_node; + struct device_node *component_of_node = soc_component_to_node(pos);
if (component_of_node != node) continue; @@ -3794,9 +3793,7 @@ int snd_soc_get_dai_name(struct of_phandle_args *args,
mutex_lock(&client_mutex); for_each_component(pos) { - component_of_node = pos->dev->of_node; - if (!component_of_node && pos->dev->parent) - component_of_node = pos->dev->parent->of_node; + component_of_node = soc_component_to_node(pos);
if (component_of_node != args->np) continue;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
soc-core core already has soc_find_component() which find component from device node. Let's use existing function to find component.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-core.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e55170c..e83edbe 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3751,7 +3751,7 @@ EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt);
int snd_soc_get_dai_id(struct device_node *ep) { - struct snd_soc_component *pos; + struct snd_soc_component *component; struct device_node *node; int ret;
@@ -3765,17 +3765,10 @@ int snd_soc_get_dai_id(struct device_node *ep) */ ret = -ENOTSUPP; mutex_lock(&client_mutex); - for_each_component(pos) { - struct device_node *component_of_node = soc_component_to_node(pos); - - if (component_of_node != node) - continue; - - if (pos->driver->of_xlate_dai_id) - ret = pos->driver->of_xlate_dai_id(pos, ep); - - break; - } + component = soc_find_component(node, NULL); + if (component && + component->driver->of_xlate_dai_id) + ret = component->driver->of_xlate_dai_id(component, ep); mutex_unlock(&client_mutex);
of_node_put(node);
The patch
ASoC: soc-core: use soc_find_component() at snd_soc_get_dai_id()
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3
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 09d4cc03ff77790872b8b9e51b6d7b5863686fc5 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Mon, 13 May 2019 16:07:20 +0900 Subject: [PATCH] ASoC: soc-core: use soc_find_component() at snd_soc_get_dai_id()
soc-core core already has soc_find_component() which find component from device node. Let's use existing function to find component.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-core.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e55170ce6d3e..e83edbe27041 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3751,7 +3751,7 @@ EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt);
int snd_soc_get_dai_id(struct device_node *ep) { - struct snd_soc_component *pos; + struct snd_soc_component *component; struct device_node *node; int ret;
@@ -3765,17 +3765,10 @@ int snd_soc_get_dai_id(struct device_node *ep) */ ret = -ENOTSUPP; mutex_lock(&client_mutex); - for_each_component(pos) { - struct device_node *component_of_node = soc_component_to_node(pos); - - if (component_of_node != node) - continue; - - if (pos->driver->of_xlate_dai_id) - ret = pos->driver->of_xlate_dai_id(pos, ep); - - break; - } + component = soc_find_component(node, NULL); + if (component && + component->driver->of_xlate_dai_id) + ret = component->driver->of_xlate_dai_id(component, ep); mutex_unlock(&client_mutex);
of_node_put(node);
13.05.2019 10:07, Kuninori Morimoto пишет:
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
soc-core core already has soc_find_component() which find component from device node. Let's use existing function to find component.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
sound/soc/soc-core.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e55170c..e83edbe 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3751,7 +3751,7 @@ EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt);
int snd_soc_get_dai_id(struct device_node *ep) {
- struct snd_soc_component *pos;
- struct snd_soc_component *component; struct device_node *node; int ret;
@@ -3765,17 +3765,10 @@ int snd_soc_get_dai_id(struct device_node *ep) */ ret = -ENOTSUPP; mutex_lock(&client_mutex);
- for_each_component(pos) {
struct device_node *component_of_node = soc_component_to_node(pos);
if (component_of_node != node)
continue;
if (pos->driver->of_xlate_dai_id)
ret = pos->driver->of_xlate_dai_id(pos, ep);
break;
- }
component = soc_find_component(node, NULL);
if (component &&
component->driver->of_xlate_dai_id)
ret = component->driver->of_xlate_dai_id(component, ep);
mutex_unlock(&client_mutex);
of_node_put(node);
Hi,
This patch causes crash on today's linux-next apparently because "CPU DAI" is not registered now, any ideas?
8.176319] tegra-snd-wm8903 sound: ASoC: CPU DAI (null) not registered [ 8.176549] 8<--- cut here --- [ 8.176763] Unable to handle kernel NULL pointer dereference at virtual address 00000570 [ 8.176939] pgd = ef4b4af8 [ 8.177004] [00000570] *pgd=00000000 [ 8.177091] Internal error: Oops: 5 [#1] PREEMPT SMP THUMB2 [ 8.177212] Modules linked in: snd_soc_tegra_wm8903(+) snd_soc_tegra_utils snd_soc_tegra20_i2s snd_soc_tegra20_das snd_soc_tegra_pcm [ 8.177467] CPU: 0 PID: 177 Comm: systemd-udevd Tainted: G W 5.2.0-rc6-next-20190625-00149-g10005a9c4812 #1068 [ 8.177708] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree) [ 8.177869] PC is at tegra_wm8903_remove+0x18/0x28 [snd_soc_tegra_wm8903] [ 8.178019] LR is at tegra_wm8903_remove+0x13/0x28 [snd_soc_tegra_wm8903] [ 8.178160] pc : [<bf8171d8>] lr : [<bf8171d3>] psr: 60010133 [ 8.178294] sp : d5979c18 ip : 60010113 fp : c11acef8 [ 8.178406] r10: 00000100 r9 : 00000122 r8 : bf8191a4 [ 8.178520] r7 : 00000003 r6 : bf819180 r5 : bf819180 r4 : bf819090 [ 8.178662] r3 : 00000000 r2 : 00000000 r1 : 00000000 r0 : 00000000 [ 8.178804] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA Thumb Segment none [ 8.178956] Control: 50c5387d Table: 159f404a DAC: 00000051 [ 8.179205] Process systemd-udevd (pid: 177, stack limit = 0x1322d18f) [ 8.179451] Stack: (0xd5979c18 to 0xd597a000) [ 8.179654] 9c00: bf8171c1 c06df1dd [ 8.179833] 9c20: bf819090 00000000 00000078 c0bce380 c11acf1c fffffdfb 00000001 c06df597 [ 8.180006] 9c40: c0445029 d6e2c9c0 00000000 bf819118 d5978000 c0e33d08 c0e6d2b0 c0e6d2d0 [ 8.180177] 9c60: 00000001 00000000 60010113 f7ca2504 00000000 bf819090 00000000 d7334624 [ 8.180348] 9c80: d64e1e10 bf819000 bf819664 0000000d d5978000 c06dfc13 d7324834 00000000 [ 8.180520] 9ca0: d5916bd4 bf8173ed bf8171e9 00000000 d64e1e10 bf819304 c121ff64 00000000 [ 8.180691] 9cc0: bf819304 c04ea02b c04e9ff9 d64e1e10 c121ff60 00000000 c121ff64 c04e8929 [ 8.180862] 9ce0: d64e1e10 bf819304 bf819304 d5978000 00000002 00000000 bf819380 c04e8b8f [ 8.181033] 9d00: d7334624 00000000 bf819380 c090a7b7 bf81803c d64e1e10 00000000 bf819304 [ 8.181204] 9d20: d5978000 00000002 00000000 bf819380 d5978000 c04e8d7d 00000000 bf819304 [ 8.181375] 9d40: d64e1e10 c04e8db7 00000000 bf819304 c04e8d81 c04e75bb d5979d80 d6e50558 [ 8.181546] 9d60: d64ce134 f7ca2504 00000000 bf819304 d5916180 00000000 c11841c8 c04e80fb [ 8.181717] 9d80: bf818670 bf819304 c11d6c00 bf819304 c11d6c00 bf81c001 ffffe000 c04e9559 [ 8.181889] 9da0: 00000000 d5978000 c11d6c00 bf81c017 00000000 c0102c81 d5aba5c0 fffffff4 [ 8.182060] 9dc0: d5f58cc0 c08fc129 bf8193c8 c0216dc7 d59a1600 f0957fff 8040003f d6c01e40 [ 8.182231] 9de0: 00000cc0 c018ef7d 00000008 c0216cf1 d75ea740 d5aba5c0 d6c01e40 c019087d [ 8.182402] 9e00: d5978000 f7ca2504 d5fbf940 bf819380 d5ecbb40 00000002 d5fbf980 00000002 [ 8.182572] 9e20: d5fbf980 c018efa9 00000002 d5fbf980 d5979f38 d5fbf940 00000002 c0190891 [ 8.182744] 9e40: bf81938c 00007fff bf819380 c018e401 d5fd9300 bf819494 bf8193c8 c0db4fdc [ 8.182914] 9e60: bf819580 c0a074e4 bf81938c bf81e0ae c0db491c d5978000 c0db4f34 00000000 [ 8.183085] 9e80: 00000cc0 ffffe000 d5978000 bf000000 00000000 d5978000 00000000 00000000 [ 8.183255] 9ea0: 00000000 00000000 00000000 00000000 6e72656b 00006c65 00000000 00000000 [ 8.183425] 9ec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 8.183596] 9ee0: 00000000 00000000 00000000 f7ca2504 7fffffff d5978000 00000000 b6d25188 [ 8.188471] 9f00: f091f000 c01011e4 d5978000 0000017b 0048db58 c0190d2f 7fffffff 00000000 [ 8.193359] 9f20: 00000003 00037b74 00000001 f091f000 00037b74 00000000 f091fcbe f09200c0 [ 8.198255] 9f40: f091f000 00037b74 f095637c f0956190 f0949d90 00003000 000034a0 00002038 [ 8.203221] 9f60: 000037b8 00000000 00000000 00000000 00002028 00000031 00000032 00000018 [ 8.208131] 9f80: 00000000 00000012 00000000 f7ca2504 00000000 00000000 00000000 69ea3300 [ 8.212949] 9fa0: 0000017b c0101001 00000000 00000000 0000000e b6d25188 00000000 00000000 [ 8.217719] 9fc0: 00000000 00000000 69ea3300 0000017b 0048f290 00000000 00486698 0048db58 [ 8.222444] 9fe0: bef98c70 bef98c60 b6d1c5c8 b6bff320 600d0010 0000000e 00000000 00000000 [ 8.227183] [<bf8171d8>] (tegra_wm8903_remove [snd_soc_tegra_wm8903]) from [<c06df1dd>] (soc_cleanup_card_resources+0x1e1/0x1f8) [ 8.232037] [<c06df1dd>] (soc_cleanup_card_resources) from [<c06df597>] (snd_soc_instantiate_card+0x3a3/0x958) [ 8.236980] [<c06df597>] (snd_soc_instantiate_card) from [<c06dfc13>] (snd_soc_register_card+0xc7/0xe0) [ 8.241975] [<c06dfc13>] (snd_soc_register_card) from [<bf8173ed>] (tegra_wm8903_driver_probe+0x205/0x26c [snd_soc_tegra_wm8903]) [ 8.246991] [<bf8173ed>] (tegra_wm8903_driver_probe [snd_soc_tegra_wm8903]) from [<c04ea02b>] (platform_drv_probe+0x33/0x68) [ 8.251974] [<c04ea02b>] (platform_drv_probe) from [<c04e8929>] (really_probe+0xa9/0x1ec) [ 8.256900] [<c04e8929>] (really_probe) from [<c04e8b8f>] (driver_probe_device+0x43/0x124) [ 8.261836] [<c04e8b8f>] (driver_probe_device) from [<c04e8d7d>] (device_driver_attach+0x3d/0x40) [ 8.266885] [<c04e8d7d>] (device_driver_attach) from [<c04e8db7>] (__driver_attach+0x37/0x78) [ 8.271950] [<c04e8db7>] (__driver_attach) from [<c04e75bb>] (bus_for_each_dev+0x43/0x6c) [ 8.277037] [<c04e75bb>] (bus_for_each_dev) from [<c04e80fb>] (bus_add_driver+0xe3/0x148) [ 8.282175] [<c04e80fb>] (bus_add_driver) from [<c04e9559>] (driver_register+0x39/0xa0) [ 8.287373] [<c04e9559>] (driver_register) from [<bf81c017>] (tegra_wm8903_driver_init+0x17/0x1000 [snd_soc_tegra_wm8903]) [ 8.292731] [<bf81c017>] (tegra_wm8903_driver_init [snd_soc_tegra_wm8903]) from [<c0102c81>] (do_one_initcall+0x45/0x1e4) [ 8.298144] [<c0102c81>] (do_one_initcall) from [<c018efa9>] (do_init_module+0x4d/0x1a0) [ 8.303555] [<c018efa9>] (do_init_module) from [<c0190891>] (load_module+0x1739/0x1a28) [ 8.308974] [<c0190891>] (load_module) from [<c0190d2f>] (sys_finit_module+0x7b/0x8c) [ 8.314404] [<c0190d2f>] (sys_finit_module) from [<c0101001>] (ret_fast_syscall+0x1/0x28) [ 8.319854] Exception stack(0xd5979fa8 to 0xd5979ff0) [ 8.325265] 9fa0: 00000000 00000000 0000000e b6d25188 00000000 00000000 [ 8.330758] 9fc0: 00000000 00000000 69ea3300 0000017b 0048f290 00000000 00486698 0048db58 [ 8.336643] 9fe0: bef98c70 bef98c60 b6d1c5c8 b6bff320 [ 8.342097] Code: d6cf 2300 461a 4619 (f8d0) 0570 [ 8.351857] ---[ end trace e373bedb5e9591a6 ]---
On 25/06/2019 21:47, Dmitry Osipenko wrote:
13.05.2019 10:07, Kuninori Morimoto пишет:
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
soc-core core already has soc_find_component() which find component from device node. Let's use existing function to find component.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
sound/soc/soc-core.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e55170c..e83edbe 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3751,7 +3751,7 @@ EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt);
int snd_soc_get_dai_id(struct device_node *ep) {
- struct snd_soc_component *pos;
- struct snd_soc_component *component; struct device_node *node; int ret;
@@ -3765,17 +3765,10 @@ int snd_soc_get_dai_id(struct device_node *ep) */ ret = -ENOTSUPP; mutex_lock(&client_mutex);
- for_each_component(pos) {
struct device_node *component_of_node = soc_component_to_node(pos);
if (component_of_node != node)
continue;
if (pos->driver->of_xlate_dai_id)
ret = pos->driver->of_xlate_dai_id(pos, ep);
break;
- }
component = soc_find_component(node, NULL);
if (component &&
component->driver->of_xlate_dai_id)
ret = component->driver->of_xlate_dai_id(component, ep);
mutex_unlock(&client_mutex);
of_node_put(node);
Hi,
This patch causes crash on today's linux-next apparently because "CPU DAI" is not registered now, any ideas?
FWIW I am seeing the same crash/regression, however, the bisect is pointing to commit b9f2e25c599bbbf0646957e07ebb72b942c286cc ("ASoC: soc-core: use soc_find_component() at snd_soc_find_dai()") and reverting this commit fixes the problem for me.
Dmitry, are you sure it is this commit? They do have a similar name.
Cheers Jon
26.06.2019 1:38, Jon Hunter пишет:
On 25/06/2019 21:47, Dmitry Osipenko wrote:
13.05.2019 10:07, Kuninori Morimoto пишет:
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
soc-core core already has soc_find_component() which find component from device node. Let's use existing function to find component.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
sound/soc/soc-core.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e55170c..e83edbe 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3751,7 +3751,7 @@ EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt);
int snd_soc_get_dai_id(struct device_node *ep) {
- struct snd_soc_component *pos;
- struct snd_soc_component *component; struct device_node *node; int ret;
@@ -3765,17 +3765,10 @@ int snd_soc_get_dai_id(struct device_node *ep) */ ret = -ENOTSUPP; mutex_lock(&client_mutex);
- for_each_component(pos) {
struct device_node *component_of_node = soc_component_to_node(pos);
if (component_of_node != node)
continue;
if (pos->driver->of_xlate_dai_id)
ret = pos->driver->of_xlate_dai_id(pos, ep);
break;
- }
component = soc_find_component(node, NULL);
if (component &&
component->driver->of_xlate_dai_id)
ret = component->driver->of_xlate_dai_id(component, ep);
mutex_unlock(&client_mutex);
of_node_put(node);
Hi,
This patch causes crash on today's linux-next apparently because "CPU DAI" is not registered now, any ideas?
FWIW I am seeing the same crash/regression, however, the bisect is pointing to commit b9f2e25c599bbbf0646957e07ebb72b942c286cc ("ASoC: soc-core: use soc_find_component() at snd_soc_find_dai()") and reverting this commit fixes the problem for me.
Dmitry, are you sure it is this commit? They do have a similar name.
Indeed! I accidentally replied to a wrong email, thank you very much for the clarification. And good to know that it's a global problem and not my local setup issue.
Hi Dmitry, Jon
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
soc-core core already has soc_find_component() which find component from device node. Let's use existing function to find component.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
(snip)
This patch causes crash on today's linux-next apparently because "CPU DAI" is not registered now, any ideas?
FWIW I am seeing the same crash/regression, however, the bisect is pointing to commit b9f2e25c599bbbf0646957e07ebb72b942c286cc ("ASoC: soc-core: use soc_find_component() at snd_soc_find_dai()") and reverting this commit fixes the problem for me.
Dmitry, are you sure it is this commit? They do have a similar name.
Indeed! I accidentally replied to a wrong email, thank you very much for the clarification. And good to know that it's a global problem and not my local setup issue.
Thank you for pointing it. I'm so sorry, it was my fault. I think this and Marek issue are same issue which I didn't notice. I will fixup (or negotiate to Mark) to solve this issue.
Thank you for your help !! Best regards --- Kuninori Morimoto
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
fe_compr is used at soc-compress, it can be bit field. This patch move it from int to bit field.
grep fe_compr -r sound/soc/*
sound/soc/soc-compress.c: rtd->fe_compr = 1; sound/soc/soc-pcm.c: if (!fe->dpcm[stream].runtime && !fe->fe_compr)
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/soc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h index 482b4ea..f20785a 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1214,7 +1214,6 @@ struct snd_soc_pcm_runtime {
/* Dynamic PCM BE runtime data */ struct snd_soc_dpcm_runtime dpcm[2]; - int fe_compr;
long pmdown_time;
@@ -1239,6 +1238,7 @@ struct snd_soc_pcm_runtime { /* bit field */ unsigned int dev_registered:1; unsigned int pop_wait:1; + unsigned int fe_compr:1; /* for Dynamic PCM */ }; #define for_each_rtd_codec_dai(rtd, i, dai)\ for ((i) = 0; \
The patch
ASoC: soc.h: fe_compr can be bit field
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3
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 7426af5010d1b4a109e5d7ee639f3c3e0e5b3cdd Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Mon, 13 May 2019 16:07:27 +0900 Subject: [PATCH] ASoC: soc.h: fe_compr can be bit field
fe_compr is used at soc-compress, it can be bit field. This patch move it from int to bit field.
grep fe_compr -r sound/soc/*
sound/soc/soc-compress.c: rtd->fe_compr = 1; sound/soc/soc-pcm.c: if (!fe->dpcm[stream].runtime && !fe->fe_compr)
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- include/sound/soc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h index 482b4ea87c3c..f20785aa7b4a 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1214,7 +1214,6 @@ struct snd_soc_pcm_runtime {
/* Dynamic PCM BE runtime data */ struct snd_soc_dpcm_runtime dpcm[2]; - int fe_compr;
long pmdown_time;
@@ -1239,6 +1238,7 @@ struct snd_soc_pcm_runtime { /* bit field */ unsigned int dev_registered:1; unsigned int pop_wait:1; + unsigned int fe_compr:1; /* for Dynamic PCM */ }; #define for_each_rtd_codec_dai(rtd, i, dai)\ for ((i) = 0; \
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
cpu_dai related operation is separated by component operation at soc_pcm_hw_params() somehow. It is not readable, let's do it at same place
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-pcm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 0d50a44..ea3f915 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -990,6 +990,14 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, if (ret < 0) goto interface_err;
+ /* store the parameters for each DAIs */ + cpu_dai->rate = params_rate(params); + cpu_dai->channels = params_channels(params); + cpu_dai->sample_bits = + snd_pcm_format_physical_width(params_format(params)); + + snd_soc_dapm_update_dai(substream, params, cpu_dai); + for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component;
@@ -1007,14 +1015,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, } component = NULL;
- /* store the parameters for each DAIs */ - cpu_dai->rate = params_rate(params); - cpu_dai->channels = params_channels(params); - cpu_dai->sample_bits = - snd_pcm_format_physical_width(params_format(params)); - - snd_soc_dapm_update_dai(substream, params, cpu_dai); - ret = soc_pcm_params_symmetry(substream, params); if (ret) goto component_err;
The patch
ASoC: soc-pcm: do cpu_dai related operation at same place
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3
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 ca58221d2212aff4f41d05b99b1e2ed288b24ccc Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Mon, 13 May 2019 16:07:43 +0900 Subject: [PATCH] ASoC: soc-pcm: do cpu_dai related operation at same place
cpu_dai related operation is separated by component operation at soc_pcm_hw_params() somehow. It is not readable, let's do it at same place
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-pcm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 0a4f60c7a188..ad560d9bf06a 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -990,6 +990,14 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, if (ret < 0) goto interface_err;
+ /* store the parameters for each DAIs */ + cpu_dai->rate = params_rate(params); + cpu_dai->channels = params_channels(params); + cpu_dai->sample_bits = + snd_pcm_format_physical_width(params_format(params)); + + snd_soc_dapm_update_dai(substream, params, cpu_dai); + for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component;
@@ -1007,14 +1015,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, } component = NULL;
- /* store the parameters for each DAIs */ - cpu_dai->rate = params_rate(params); - cpu_dai->channels = params_channels(params); - cpu_dai->sample_bits = - snd_pcm_format_physical_width(params_format(params)); - - snd_soc_dapm_update_dai(substream, params, cpu_dai); - ret = soc_pcm_params_symmetry(substream, params); if (ret) goto component_err;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Codec side is setting codec_dai->rate = 0 when error case at soc_pcm_hw_params(), but there is not such setting for CPU side. This patch adds it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-pcm.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index ea3f915..15067c5b 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1027,6 +1027,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if (cpu_dai->driver->ops->hw_free) cpu_dai->driver->ops->hw_free(substream, cpu_dai); + cpu_dai->rate = 0;
interface_err: i = rtd->num_codecs;
The patch
ASoC: soc-pcm: add missing cpu_dai->rate = 0
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3
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 2371abdc08e491f6f540c3971bdfa8c90f3329fb Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Mon, 13 May 2019 16:07:52 +0900 Subject: [PATCH] ASoC: soc-pcm: add missing cpu_dai->rate = 0
Codec side is setting codec_dai->rate = 0 when error case at soc_pcm_hw_params(), but there is not such setting for CPU side. This patch adds it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-pcm.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index ad560d9bf06a..2dcc44c73f6c 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1027,6 +1027,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if (cpu_dai->driver->ops->hw_free) cpu_dai->driver->ops->hw_free(substream, cpu_dai); + cpu_dai->rate = 0;
interface_err: i = rtd->num_codecs;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
soc-pcm.c has soc_pcm_components_close() but not have its open() side function. This kind of unbalance function is very unreadable.
And, current error handling is not correct. Because it is using for_each_rtdcom() loop, we need to call soc_pcm_components_close() anyway even though CPU DAI .startup() failed.
This patch adds soc_pcm_components_open(), and fixup error handling issue.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-pcm.c | 63 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 23 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 15067c5b..b8ce99e 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -446,6 +446,42 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream) hw->rate_max = min_not_zero(hw->rate_max, rate_max); }
+static int soc_pcm_components_open(struct snd_pcm_substream *substream, + struct snd_soc_component **last) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_rtdcom_list *rtdcom; + struct snd_soc_component *component; + int ret = 0; + + for_each_rtdcom(rtd, rtdcom) { + component = rtdcom->component; + *last = component; + + if (!component->driver->ops || + !component->driver->ops->open) + continue; + + if (component->driver->module_get_upon_open && + !try_module_get(component->dev->driver->owner)) { + dev_err(component->dev, + "ASoC: can't get module %s\n", + component->name); + return -ENODEV; + } + + ret = component->driver->ops->open(substream); + if (ret < 0) { + dev_err(component->dev, + "ASoC: can't open component %s: %d\n", + component->name, ret); + return ret; + } + } + *last = NULL; + return 0; +} + static int soc_pcm_components_close(struct snd_pcm_substream *substream, struct snd_soc_component *last) { @@ -510,28 +546,9 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) } }
- for_each_rtdcom(rtd, rtdcom) { - component = rtdcom->component; - - if (!component->driver->ops || - !component->driver->ops->open) - continue; - - if (component->driver->module_get_upon_open && - !try_module_get(component->dev->driver->owner)) { - ret = -ENODEV; - goto module_err; - } - - ret = component->driver->ops->open(substream); - if (ret < 0) { - dev_err(component->dev, - "ASoC: can't open component %s: %d\n", - component->name, ret); - goto component_err; - } - } - component = NULL; + ret = soc_pcm_components_open(substream, &component); + if (ret < 0) + goto component_err;
for_each_rtd_codec_dai(rtd, i, codec_dai) { if (codec_dai->driver->ops->startup) { @@ -638,7 +655,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
component_err: soc_pcm_components_close(substream, component); -module_err: + if (cpu_dai->driver->ops->shutdown) cpu_dai->driver->ops->shutdown(substream, cpu_dai); out:
The patch
ASoC: soc-pcm: add soc_pcm_components_open()
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3
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 e7ecfdb794fef1f6c91f62a40fd6aa3d4d8d2471 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Mon, 13 May 2019 16:08:33 +0900 Subject: [PATCH] ASoC: soc-pcm: add soc_pcm_components_open()
soc-pcm.c has soc_pcm_components_close() but not have its open() side function. This kind of unbalance function is very unreadable.
And, current error handling is not correct. Because it is using for_each_rtdcom() loop, we need to call soc_pcm_components_close() anyway even though CPU DAI .startup() failed.
This patch adds soc_pcm_components_open(), and fixup error handling issue.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-pcm.c | 63 ++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 23 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 2dcc44c73f6c..74c7d38af2c6 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -446,6 +446,42 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream) hw->rate_max = min_not_zero(hw->rate_max, rate_max); }
+static int soc_pcm_components_open(struct snd_pcm_substream *substream, + struct snd_soc_component **last) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_rtdcom_list *rtdcom; + struct snd_soc_component *component; + int ret = 0; + + for_each_rtdcom(rtd, rtdcom) { + component = rtdcom->component; + *last = component; + + if (!component->driver->ops || + !component->driver->ops->open) + continue; + + if (component->driver->module_get_upon_open && + !try_module_get(component->dev->driver->owner)) { + dev_err(component->dev, + "ASoC: can't get module %s\n", + component->name); + return -ENODEV; + } + + ret = component->driver->ops->open(substream); + if (ret < 0) { + dev_err(component->dev, + "ASoC: can't open component %s: %d\n", + component->name, ret); + return ret; + } + } + *last = NULL; + return 0; +} + static int soc_pcm_components_close(struct snd_pcm_substream *substream, struct snd_soc_component *last) { @@ -510,28 +546,9 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) } }
- for_each_rtdcom(rtd, rtdcom) { - component = rtdcom->component; - - if (!component->driver->ops || - !component->driver->ops->open) - continue; - - if (component->driver->module_get_upon_open && - !try_module_get(component->dev->driver->owner)) { - ret = -ENODEV; - goto module_err; - } - - ret = component->driver->ops->open(substream); - if (ret < 0) { - dev_err(component->dev, - "ASoC: can't open component %s: %d\n", - component->name, ret); - goto component_err; - } - } - component = NULL; + ret = soc_pcm_components_open(substream, &component); + if (ret < 0) + goto component_err;
for_each_rtd_codec_dai(rtd, i, codec_dai) { if (codec_dai->driver->ops->startup) { @@ -638,7 +655,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
component_err: soc_pcm_components_close(substream, component); -module_err: + if (cpu_dai->driver->ops->shutdown) cpu_dai->driver->ops->shutdown(substream, cpu_dai); out:
participants (4)
-
Dmitry Osipenko
-
Jon Hunter
-
Kuninori Morimoto
-
Mark Brown