Unverified Commit 3067e020 authored by Mark Brown's avatar Mark Brown
Browse files

add snd_soc_{of_}get_dlc()

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

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.
parents 0a087781 0baa2c3a
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1309,11 +1309,17 @@ 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);
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);
+3 −11
Original line number Diff line number Diff line
@@ -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);
		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);
+1 −2
Original line number Diff line number Diff line
@@ -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;
+1 −3
Original line number Diff line number Diff line
@@ -1103,14 +1103,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;

+1 −3
Original line number Diff line number Diff line
@@ -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);
	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;

Loading