[alsa-devel] [PATCH 0/2] ASoC: simple-card-utils: add asoc_simple_card_of_parse_widgets()
Hi Mark
Simple/OF-Audio card are using same DT properties, but not using same functions for it. Now, simple-card is only supporting "widgets" feature. I hope it will be supported on simple-scu/of-audio/of-audio-scu card too (I'm not widgets user, thus, I can't test). Then, DT properties needs to be shared with all Simple/OF-Audio cards. This means if needs common function on simple-card-utils.
Currently only 1 user exist, thus, this is a little bit aggressive, but encapsulation is one of simple card util's purpose. This patches adds common widgets function on utils, and use it from simple-card.
Kuninori Morimoto (2): ASoC: simple-card-utils: add asoc_simple_card_of_parse_widgets() ASoC: simple-card: use asoc_simple_card_of_parse_widgets()
include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 19 +++++++++++++++++++ sound/soc/generic/simple-card.c | 10 +++------- 3 files changed, 24 insertions(+), 7 deletions(-)
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Current simple card drivers are parsing widgets on each own driver (only simple-card at this point, but will be supported on all drivers) Encapsulation is one of simple card util's purpose. Let's add asoc_simple_card_of_parse_widgets for it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+)
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 889c8ff..42c6a6a 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -103,5 +103,7 @@ void asoc_simple_card_parse_convert(struct device *dev, char *prefix, int asoc_simple_card_of_parse_routing(struct snd_soc_card *card, char *prefix, int optional); +int asoc_simple_card_of_parse_widgets(struct snd_soc_card *card, + char *prefix);
#endif /* __SIMPLE_CARD_UTILS_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index a2b6d95..26d64fa 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -397,6 +397,25 @@ int asoc_simple_card_of_parse_routing(struct snd_soc_card *card, } EXPORT_SYMBOL_GPL(asoc_simple_card_of_parse_routing);
+int asoc_simple_card_of_parse_widgets(struct snd_soc_card *card, + char *prefix) +{ + struct device_node *node = card->dev->of_node; + char prop[128]; + + if (!prefix) + prefix = ""; + + snprintf(prop, sizeof(prop), "%s%s", prefix, "widgets"); + + if (of_property_read_bool(node, prop)) + return snd_soc_of_parse_audio_simple_widgets(card, prop); + + /* no widgets is not error */ + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_of_parse_widgets); + /* 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_of_parse_widgets()
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 b31f11d036e689ba9e60d581ffe8e032a6305da9 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Fri, 16 Jun 2017 01:38:50 +0000 Subject: [PATCH] ASoC: simple-card-utils: add asoc_simple_card_of_parse_widgets()
Current simple card drivers are parsing widgets on each own driver (only simple-card at this point, but will be supported on all drivers) Encapsulation is one of simple card util's purpose. Let's add asoc_simple_card_of_parse_widgets for it.
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 | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+)
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 889c8ff86369..42c6a6ac3ce6 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -103,5 +103,7 @@ void asoc_simple_card_parse_convert(struct device *dev, char *prefix, int asoc_simple_card_of_parse_routing(struct snd_soc_card *card, char *prefix, int optional); +int asoc_simple_card_of_parse_widgets(struct snd_soc_card *card, + char *prefix);
#endif /* __SIMPLE_CARD_UTILS_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index a2b6d95bc2f9..26d64fa40c9c 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -397,6 +397,25 @@ int asoc_simple_card_of_parse_routing(struct snd_soc_card *card, } EXPORT_SYMBOL_GPL(asoc_simple_card_of_parse_routing);
+int asoc_simple_card_of_parse_widgets(struct snd_soc_card *card, + char *prefix) +{ + struct device_node *node = card->dev->of_node; + char prop[128]; + + if (!prefix) + prefix = ""; + + snprintf(prop, sizeof(prop), "%s%s", prefix, "widgets"); + + if (of_property_read_bool(node, prop)) + return snd_soc_of_parse_audio_simple_widgets(card, prop); + + /* no widgets is not error */ + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_of_parse_widgets); + /* 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
Current simple card driver is supporting widgets on DT, other simple/audio card drivers will support it. Encapsulation is one of simple card util's purpose. Let's use asoc_simple_card_of_parse_widgets
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/generic/simple-card.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 75b0c22..dfaf48f 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -354,13 +354,9 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
dai_link = of_get_child_by_name(node, PREFIX "dai-link");
- /* The off-codec widgets */ - if (of_property_read_bool(node, PREFIX "widgets")) { - ret = snd_soc_of_parse_audio_simple_widgets(card, - PREFIX "widgets"); - if (ret) - goto card_parse_end; - } + ret = asoc_simple_card_of_parse_widgets(card, PREFIX); + if (ret < 0) + goto card_parse_end;
ret = asoc_simple_card_of_parse_routing(card, PREFIX, 1); if (ret < 0)
The patch
ASoC: simple-card: use asoc_simple_card_of_parse_widgets()
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 fa2760dd366c735637504d1d7efab7688391c6b4 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Fri, 16 Jun 2017 01:39:11 +0000 Subject: [PATCH] ASoC: simple-card: use asoc_simple_card_of_parse_widgets()
Current simple card driver is supporting widgets on DT, other simple/audio card drivers will support it. Encapsulation is one of simple card util's purpose. Let's use asoc_simple_card_of_parse_widgets
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/generic/simple-card.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 7b2533c7f82e..8b7b47251fe1 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -354,13 +354,9 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
dai_link = of_get_child_by_name(node, PREFIX "dai-link");
- /* The off-codec widgets */ - if (of_property_read_bool(node, PREFIX "widgets")) { - ret = snd_soc_of_parse_audio_simple_widgets(card, - PREFIX "widgets"); - if (ret) - goto card_parse_end; - } + ret = asoc_simple_card_of_parse_widgets(card, PREFIX); + if (ret < 0) + goto card_parse_end;
ret = asoc_simple_card_of_parse_routing(card, PREFIX, 1); if (ret < 0)
participants (2)
-
Kuninori Morimoto
-
Mark Brown