add snd_soc_{of_}get_dlc()
Subsystems (10)
Kuninori Morimoto
maintainercover add snd_soc_{of_}get_dlc()
Hi Mark
Current soc-core.c has snd_soc_{of_}get_dai_name() to get DAI name for dlc (snd_soc_dai_link_component). It gets .dai_name, but we need .of_node too. Therefor user need to arrange.
It will be more useful if it gets both .dai_name and .of_node. This patch adds snd_soc_{of_}get_dlc() for it, and convert to use it.
Kuninori Morimoto (8):
ASoC: soc-core.c: add snd_soc_{of_}get_dlc()
ASoC: soc-core.c: add index on snd_soc_of_get_dai_name()
ASoC: fsl: use snd_soc_{of_}get_dlc()
ASoC: qcom: use snd_soc_{of_}get_dlc()
ASoC: meson: use snd_soc_{of_}get_dlc()
ASoC: samsung: use snd_soc_{of_}get_dlc()
ASoC: soc-core.c: use snd_soc_{of_}get_dlc()
ASoC: simple-card.c: use snd_soc_{of_}get_dlc()
include/sound/soc.h | 8 ++- sound/soc/fsl/imx-card.c | 14 +---- sound/soc/fsl/imx-rpmsg.c | 3 +- sound/soc/generic/simple-card-utils.c | 4 +- sound/soc/generic/simple-card.c | 4 +- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 2 +- sound/soc/meson/axg-card.c | 3 +- sound/soc/meson/gx-card.c | 3 +- sound/soc/meson/meson-card-utils.c | 16 ++--- sound/soc/meson/meson-card.h | 3 +- sound/soc/qcom/common.c | 13 +--- sound/soc/samsung/odroid.c | 16 +---- sound/soc/soc-core.c | 77 ++++++++++++----------- 13 files changed, 68 insertions(+), 98 deletions(-)
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH 1/8 ASoC: soc-core.c: add snd_soc_{of_}get_dlc()
Current soc-core.c has snd_soc_{of_}get_dai_name() to get DAI name for dlc (snd_soc_dai_link_component). It gets .dai_name, but we need .of_node too. Therefor user need to arrange.
It will be more useful if it gets both .dai_name and .of_node. This patch adds snd_soc_{of_}get_dlc() for it, and convert to use it.
--- include/sound/soc.h | 6 +++++ sound/soc/soc-core.c | 53 +++++++++++++++++++++++++++++++++----------- 2 files changed, 46 insertions(+), 13 deletions(-)
include/sound/soc.h +6 -0
@@ -1309,6 +1309,12 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np, snd_soc_daifmt_parse_clock_provider_as_bitmap(np, prefix))int snd_soc_get_stream_cpu (struct snd_soc_dai_link *dai_link,int stream); +int snd_soc_get_dlc (const struct of_phandle_args *args, +struct snd_soc_dai_link_component *dlc); +int snd_soc_of_get_dlc (struct device_node *of_node, +struct of_phandle_args *args, +struct snd_soc_dai_link_component *dlc, +int index);int snd_soc_get_dai_id (struct device_node *ep);int snd_soc_get_dai_name (const struct of_phandle_args *args,const char **dai_name);
sound/soc/soc-core.c +40 -13
86 lines not on this page · raw message
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH 2/8 ASoC: soc-core.c: add index on snd_soc_of_get_dai_name()
In reply to Kuninori MorimotoCurrent snd_soc_of_get_dai_name() doesn't accept index for #sound-dai-cells. It is not useful for user. This patch adds it.
--- include/sound/soc.h | 2 +- sound/soc/fsl/imx-card.c | 2 +- sound/soc/generic/simple-card.c | 2 +- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 2 +- sound/soc/qcom/common.c | 2 +- sound/soc/soc-core.c | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-)
include/sound/soc.h +1 -1
@@ -1319,7 +1319,7 @@ int snd_soc_get_dai_id(struct device_node *ep);int snd_soc_get_dai_name (const struct of_phandle_args *args,const char **dai_name);int snd_soc_of_get_dai_name (struct device_node *of_node, -const char **dai_name); +const char **dai_name,int index);int snd_soc_of_get_dai_link_codecs (struct device *dev,struct device_node *of_node,struct snd_soc_dai_link *dai_link);
sound/soc/fsl/imx-card.c +1 -1
@@ -586,7 +586,7 @@ static int imx_card_parse_of(struct imx_card_data *data) link->platforms->of_node = link->cpus->of_node; link->id = args.args[0 ]; - ret =snd_soc_of_get_dai_name (cpu, &link->cpus->dai_name); + ret =snd_soc_of_get_dai_name (cpu, &link->cpus->dai_name,0 );if (ret) {dev_err_probe (card->dev, ret,"%s: error getting cpu dai name\n" , link->name);
sound/soc/generic/simple-card.c +1 -1
@@ -89,7 +89,7 @@ static int asoc_simple_parse_dai(struct device_node *node,* 2) user need to rebind Sound Card everytime * if he unbinded CPU or Codec. */ - ret =snd_soc_of_get_dai_name (node, &dlc->dai_name); + ret =snd_soc_of_get_dai_name (node, &dlc->dai_name,0 );if (ret <0 )return ret;
sound/soc/mediatek/mt8173/mt8173-rt5650.c +1 -1
@@ -288,7 +288,7 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) np =of_get_child_by_name (pdev->dev.of_node,"codec-capture" );if (np) { - ret =snd_soc_of_get_dai_name (np, &codec_capture_dai); + ret =snd_soc_of_get_dai_name (np, &codec_capture_dai,0 );of_node_put (np);if (ret <0 ) { dev_err(&pdev->dev,
sound/soc/qcom/common.c +1 -1
@@ -105,7 +105,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card) link->cpus->of_node = args.np; link->id = args.args[0 ]; - ret =snd_soc_of_get_dai_name (cpu, &link->cpus->dai_name); + ret =snd_soc_of_get_dai_name (cpu, &link->cpus->dai_name,0 );if (ret) {dev_err_probe (card->dev, ret,"%s: error getting cpu dai name\n" , link->name);
sound/soc/soc-core.c +2 -2
@@ -3355,10 +3355,10 @@ int snd_soc_get_dai_name(const struct of_phandle_args *args,EXPORT_SYMBOL_GPL (snd_soc_get_dai_name);int snd_soc_of_get_dai_name (struct device_node *of_node, -const char **dai_name) +const char **dai_name,int index) {struct snd_soc_dai_link_component dlc; -int ret =snd_soc_of_get_dlc (of_node,NULL , &dlc,0 ); +int ret =snd_soc_of_get_dlc (of_node,NULL , &dlc, index);if (ret ==0 ) *dai_name = dlc.dai_name;
Signature · 1 line
2.25.1
Mark Brown
maintainerRe: [PATCH 2/8] ASoC: soc-core.c: add index on snd_soc_of_get_dai_name()
Quoted 5 lines · Kuninori Morimoto
Current
snd_soc_of_get_dai_name()doesn't accept index for #sound-dai-cells. It is not useful for user. This patch adds it.Signed-off-by Kuninori Morimoto <[email protected]>
Quoted 8 lines
--- include/sound/soc.h | 2 +- sound/soc/fsl/imx-card.c | 2 +- sound/soc/generic/simple-card.c | 2 +- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 2 +- sound/soc/qcom/common.c | 2 +- sound/soc/soc-core.c | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-)
This series all looks good but unfortunately the recently added Longsoon driver added a new user of snd_soc_of_get_dai_name() - could you rebase against for-6.5 to take account of the new driver please?
Kuninori Morimoto
maintainerPATCH 3/8 ASoC: fsl: use snd_soc_{of_}get_dlc()
In reply to Kuninori MorimotoCurrent ASoC has snd_soc_{of_}get_dai_name() to get DAI name for dlc (snd_soc_dai_link_component).
But we now can use snd_soc_{of_}get_dlc() for it. Let's use it.
--- sound/soc/fsl/imx-card.c | 14 +++----------- sound/soc/fsl/imx-rpmsg.c | 3 +-- 2 files changed, 4 insertions(+), 13 deletions(-)
sound/soc/fsl/imx-card.c +3 -11
@@ -551,10 +551,10 @@ static int imx_card_parse_of(struct imx_card_data *data) goto err; } - ret =of_parse_phandle_with_args (cpu,"sound-dai" , -"#sound-dai-cells" ,0 , &args); + ret =snd_soc_of_get_dlc (cpu, &args, link->cpus,0 );if (ret) { -dev_err (card->dev,"%s: error getting cpu phandle\n" , link->name); +dev_err_probe (card->dev, ret, +"%s: error getting cpu dai info\n" , link->name); goto err; }
@@ -582,17 +582,9 @@ static int imx_card_parse_of(struct imx_card_data *data) } } - link->cpus->of_node = args.np; link->platforms->of_node = link->cpus->of_node; link->id = args.args[0 ]; - ret =snd_soc_of_get_dai_name (cpu, &link->cpus->dai_name,0 ); -if (ret) { -dev_err_probe (card->dev, ret, -"%s: error getting cpu dai name\n" , link->name); - goto err; - } - codec =of_get_child_by_name (np,"codec" );if (codec) { ret =snd_soc_of_get_dai_link_codecs (dev, codec, link);
sound/soc/fsl/imx-rpmsg.c +1 -2
@@ -96,8 +96,7 @@ static int imx_rpmsg_probe(struct platform_device *pdev) }else {struct clk *clk; - data->dai.codecs->of_node = args.np; - ret =snd_soc_get_dai_name (&args, &data->dai.codecs->dai_name); + ret =snd_soc_get_dlc (&args, data->dai.codecs);if (ret) {dev_err (&pdev->dev,"Unable to get codec_dai_name\n" ); goto fail;
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH 4/8 ASoC: qcom: use snd_soc_{of_}get_dlc()
In reply to Kuninori MorimotoCurrent ASoC has snd_soc_{of_}get_dai_name() to get DAI name for dlc (snd_soc_dai_link_component).
But we now can use snd_soc_{of_}get_dlc() for it. Let's use it.
--- sound/soc/qcom/common.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
sound/soc/qcom/common.c +3 -10
@@ -96,22 +96,15 @@ int qcom_snd_parse_of(struct snd_soc_card *card) goto err; } - ret =of_parse_phandle_with_args (cpu,"sound-dai" , -"#sound-dai-cells" ,0 , &args); -if (ret) { -dev_err (card->dev,"%s: error getting cpu phandle\n" , link->name); - goto err; - } - link->cpus->of_node = args.np; - link->id = args.args[0 ]; - - ret =snd_soc_of_get_dai_name (cpu, &link->cpus->dai_name,0 ); + ret =snd_soc_of_get_dlc (cpu, &args, link->cpus,0 );if (ret) {dev_err_probe (card->dev, ret,"%s: error getting cpu dai name\n" , link->name); goto err; } + link->id = args.args[0 ]; +if (platform) { link->platforms->of_node = of_parse_phandle(platform, "sound-dai",
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH 5/8 ASoC: meson: use snd_soc_{of_}get_dlc()
In reply to Kuninori MorimotoCurrent ASoC has snd_soc_{of_}get_dai_name() to get DAI name for dlc (snd_soc_dai_link_component).
But we now can use snd_soc_{of_}get_dlc() for it. Let's use it.
--- sound/soc/meson/axg-card.c | 3 +-- sound/soc/meson/gx-card.c | 3 +-- sound/soc/meson/meson-card-utils.c | 16 +++++----------- sound/soc/meson/meson-card.h | 3 +-- 4 files changed, 8 insertions(+), 17 deletions(-)
sound/soc/meson/axg-card.c +1 -2
@@ -319,8 +319,7 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np, dai_link->cpus = cpu; dai_link->num_cpus =1 ; - ret =meson_card_parse_dai (card, np, &dai_link->cpus->of_node, - &dai_link->cpus->dai_name); + ret =meson_card_parse_dai (card, np, dai_link->cpus);if (ret)return ret;
sound/soc/meson/gx-card.c +1 -2
@@ -90,8 +90,7 @@ static int gx_card_add_link(struct snd_soc_card *card, struct device_node *np, dai_link->cpus = cpu; dai_link->num_cpus =1 ; - ret =meson_card_parse_dai (card, np, &dai_link->cpus->of_node, - &dai_link->cpus->dai_name); + ret =meson_card_parse_dai (card, np, dai_link->cpus);if (ret)return ret;
sound/soc/meson/meson-card-utils.c +5 -11
@@ -74,23 +74,18 @@ EXPORT_SYMBOL_GPL(meson_card_reallocate_links);int meson_card_parse_dai (struct snd_soc_card *card,struct device_node *node, -struct device_node **dai_of_node, -const char **dai_name) +struct snd_soc_dai_link_component *dlc) { -struct of_phandle_args args;int ret; -if (!dai_name || !dai_of_node || !node) +if (!dlc || !node)return -EINVAL ; - ret =of_parse_phandle_with_args (node,"sound-dai" , -"#sound-dai-cells" ,0 , &args); + ret =snd_soc_of_get_dlc (node,NULL , dlc,0 );if (ret)return dev_err_probe (card->dev, ret,"can't parse dai\n" ); - *dai_of_node = args.np; - -return snd_soc_get_dai_name (&args, dai_name); +return ret; }EXPORT_SYMBOL_GPL (meson_card_parse_dai);
@@ -160,8 +155,7 @@ int meson_card_set_be_link(struct snd_soc_card *card, link->num_codecs = num_codecs;for_each_child_of_node (node, np) { - ret =meson_card_parse_dai (card, np, &codec->of_node, - &codec->dai_name); + ret =meson_card_parse_dai (card, np, codec);if (ret) {of_node_put (np);return ret;
sound/soc/meson/meson-card.h +1 -2
@@ -39,8 +39,7 @@ int meson_card_reallocate_links(struct snd_soc_card *card, unsigned int num_links);int meson_card_parse_dai (struct snd_soc_card *card,struct device_node *node, -struct device_node **dai_of_node, -const char **dai_name); +struct snd_soc_dai_link_component *dlc);int meson_card_set_be_link (struct snd_soc_card *card,struct snd_soc_dai_link *link,struct device_node *node);
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH 6/8 ASoC: samsung: use snd_soc_{of_}get_dlc()
In reply to Kuninori MorimotoCurrent ASoC has snd_soc_{of_}get_dai_name() to get DAI name for dlc (snd_soc_dai_link_component).
But we now can use snd_soc_{of_}get_dlc() for it. Let's use it.
- note: need deep check
--- sound/soc/samsung/odroid.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-)
sound/soc/samsung/odroid.c +1 -15
@@ -205,7 +205,6 @@ static int odroid_audio_probe(struct platform_device *pdev)struct snd_soc_card *card;struct snd_soc_dai_link *link, *codec_link;int num_pcms, ret, i; -struct of_phandle_args args = {}; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)
@@ -260,20 +259,7 @@ static int odroid_audio_probe(struct platform_device *pdev) }for (i =0 ; i < num_pcms; i++, link +=2 ) { - ret =of_parse_phandle_with_args (cpu,"sound-dai" , -"#sound-dai-cells" , i, &args); -if (ret <0 ) -break ; - -if (!args.np) { -dev_err (dev,"sound-dai property parse error: %d\n" , ret); - ret = -EINVAL ; -break ; - } - - ret =snd_soc_get_dai_name (&args, &link->cpus->dai_name); -of_node_put (args.np); - + ret =snd_soc_of_get_dai_name (cpu, &link->cpus->dai_name, i);if (ret <0 )break ; }
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH 7/8 ASoC: soc-core.c: use snd_soc_{of_}get_dlc()
In reply to Kuninori MorimotoCurrent ASoC has snd_soc_{of_}get_dai_name() to get DAI name for dlc (snd_soc_dai_link_component).
But we now can use snd_soc_{of_}get_dlc() for it. Let's use it.
--- sound/soc/soc-core.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-)
sound/soc/soc-core.c +2 -22
@@ -3402,26 +3402,6 @@ static int __snd_soc_of_get_dai_link_component_alloc(return 0 ; } -static int __snd_soc_of_get_dai_link_component_parse ( -struct device_node *of_node, -struct snd_soc_dai_link_component *component,int index) -{ -struct of_phandle_args args; -int ret; - - ret =of_parse_phandle_with_args (of_node,"sound-dai" ,"#sound-dai-cells" , - index, &args); -if (ret) -return ret; - - ret =snd_soc_get_dai_name (&args, &component->dai_name); -if (ret <0 ) -return ret; - - component->of_node = args.np; -return 0 ; -} -/* * snd_soc_of_put_dai_link_codecs - Dereference device nodes in the codecs array * @dai_link: DAI link
@@ -3466,7 +3446,7 @@ int snd_soc_of_get_dai_link_codecs(struct device *dev,/* Parse the list */ for_each_link_codecs (dai_link, index, component) { - ret =__snd_soc_of_get_dai_link_component_parse (of_node, component, index); + ret =snd_soc_of_get_dlc (of_node,NULL , component, index);if (ret) goto err; }
@@ -3521,7 +3501,7 @@ int snd_soc_of_get_dai_link_cpus(struct device *dev,/* Parse the list */ for_each_link_cpus (dai_link, index, component) { - ret =__snd_soc_of_get_dai_link_component_parse (of_node, component, index); + ret =snd_soc_of_get_dlc (of_node,NULL , component, index);if (ret) goto err; }
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH 8/8 ASoC: simple-card.c: use snd_soc_{of_}get_dlc()
In reply to Kuninori MorimotoCurrent ASoC has snd_soc_{of_}get_dai_name() to get DAI name for dlc (snd_soc_dai_link_component).
But we now can use snd_soc_{of_}get_dlc() for it. Let's use it.
--- sound/soc/generic/simple-card-utils.c | 4 +--- sound/soc/generic/simple-card.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-)
sound/soc/generic/simple-card-utils.c +1 -3
@@ -1109,14 +1109,12 @@ int asoc_graph_parse_dai(struct device_node *ep,* 2) user need to rebind Sound Card everytime * if he unbinded CPU or Codec. */ - ret =snd_soc_get_dai_name (&args, &dlc->dai_name); + ret =snd_soc_get_dlc (&args, dlc);if (ret <0 ) {of_node_put (node);return ret; } - dlc->of_node = node; -if (is_single_link) *is_single_link =of_graph_get_endpoint_count (node) ==1 ;
sound/soc/generic/simple-card.c +1 -3
@@ -89,12 +89,10 @@ static int asoc_simple_parse_dai(struct device_node *node,* 2) user need to rebind Sound Card everytime * if he unbinded CPU or Codec. */ - ret =snd_soc_of_get_dai_name (node, &dlc->dai_name,0 ); + ret =snd_soc_get_dlc (&args, dlc);if (ret <0 )return ret; - dlc->of_node = args.np; -if (is_single_link) *is_single_link = !args.args_count;
Signature · 1 line
2.25.1
Mark Brown
maintainerQuoted 8 lines · Kuninori Morimoto
Current
soc-core.chas snd_soc_{of_}get_dai_name() to get DAI name for dlc (snd_soc_dai_link_component). It gets .dai_name, but we need .of_node too. Therefor user need to arrange.It will be more useful if it gets both .dai_name and .of_node. This patch adds snd_soc_{of_}get_dlc() for it, and convert to use it.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/8] ASoC: soc-core.c: add snd_soc_{of_}get_dlc()
commit: 05722a0ce6fbd1c603ec0f0ecb5ed839dd561ac7
[2/8] ASoC: soc-core.c: add index on snd_soc_of_get_dai_name()
commit: 3c8b5861850c734add65233e538d4a8c2dff95d9
[3/8] ASoC: fsl: use snd_soc_{of_}get_dlc()
commit: aa560f5e796ce63074942251197c7161db2392d3
[4/8] ASoC: qcom: use snd_soc_{of_}get_dlc()
commit: 6cf881b7f1608fd5625d916380ed57d45c2879e9
[5/8] ASoC: meson: use snd_soc_{of_}get_dlc()
commit: 2e1dbea1f8a3584399ff15b1f1773dbbb1f0d10f
[6/8] ASoC: samsung: use snd_soc_{of_}get_dlc()
commit: 50233f28f9a2c06140a7bf539ef569ba1ad58ff6
[7/8] ASoC: soc-core.c: use snd_soc_{of_}get_dlc()
commit: 14c9b25f632b561be33af99942833a618811ac3d
[8/8] ASoC: simple-card.c: use snd_soc_{of_}get_dlc()
commit: 0baa2c3abc525c79c21ce64a1722f4034d042ac9All 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