copy asoc_simple_card_parse_dai() from v5.4:sound/soc/generic/simple-card.c

Towards the end of the series in asoc-v5.2:

commit 8f7f298a333761a528e103cda3b42f3a416ad1ee
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Wed Mar 20 13:56:36 2019 +0900

    ASoC: simple-card-utils: separate asoc_simple_card_parse_dai()

    The difference between simple-card / audio-graph are just using
    OF graph style, or not. In other words, other things should be same.
    This means, simple-card/audio-graph common functions should be
    implemented at simple-card-utils, and its own functions should be
    implemented at each files.

    Current simple-card / audio-graph are using
    asoc_simple_card_parse_dai() which is different implementation.
    But, these are implemanted at simple-card-utils.
    It should be implemanted at each files.
    This patch separate these into each files.

$ git log --format=oneline 0580dde59438686d60762b6da9229ebec693b94f^..ad11e59f52d6fc75037ac3cb66dc711b83c1bbf8
ad11e59f52d6fc75037ac3cb66dc711b83c1bbf8 ASoC: simple-card-utils: rename asoc_simple_card_xxx() to asoc_simple_()
8f7f298a333761a528e103cda3b42f3a416ad1ee ASoC: simple-card-utils: separate asoc_simple_card_parse_dai()
65a5056b21202eff7f54243e587183f4bb6ed352 ASoC: simple-card-utils: share asoc_simple_card_init_priv()
629f75440a68220a78aef9d8569831824890c47d ASoC: simple-card-utils: share asoc_simple_be_hw_params_fixup()
ad934ca8010843482d61fda46786449a9bc99e10 ASoC: simple-card-utils: share asoc_simple_dai_init()
f48dcbb6d47d870cf3a03f453c923dd262158c66 ASoC: simple-card-utils: share asoc_simple_hw_param()
686911b46fb5a08df142fe22b6c06dc6fbd3ba65 ASoC: simple-card-utils: share asoc_simple_shutdown()
f38df5bf0c9cb905fa9d5abc86c3a00128cdbba5 ASoC: simple-card-utils: share asoc_simple_startup()
e59289cda8dec0153fa396864c8ba8092ec3b80d ASoC: simple_card_utils: share common priv for simple-card/audio-graph
0580dde59438686d60762b6da9229ebec693b94f ASoC: simple-card-utils: add asoc_simple_debug_info()
This commit is contained in:
Hin-Tak Leung 2020-04-26 22:48:50 +01:00
parent cb9bf1c913
commit 4c15036368

View file

@ -252,6 +252,55 @@ static struct snd_soc_ops seeed_voice_card_ops = {
.trigger = seeed_voice_card_trigger,
};
static int asoc_simple_parse_dai(struct device_node *node,
struct snd_soc_dai_link_component *dlc,
int *is_single_link)
{
struct of_phandle_args args;
int ret;
if (!node)
return 0;
/*
* Get node via "sound-dai = <&phandle port>"
* it will be used as xxx_of_node on soc_bind_dai_link()
*/
ret = of_parse_phandle_with_args(node, DAI, CELL, 0, &args);
if (ret)
return ret;
/*
* FIXME
*
* Here, dlc->dai_name is pointer to CPU/Codec DAI name.
* If user unbinded CPU or Codec driver, but not for Sound Card,
* dlc->dai_name is keeping unbinded CPU or Codec
* driver's pointer.
*
* If user re-bind CPU or Codec driver again, ALSA SoC will try
* to rebind Card via snd_soc_try_rebind_card(), but because of
* above reason, it might can't bind Sound Card.
* Because Sound Card is pointing to released dai_name pointer.
*
* To avoid this rebind Card issue,
* 1) It needs to alloc memory to keep dai_name eventhough
* CPU or Codec driver was unbinded, or
* 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);
if (ret < 0)
return ret;
dlc->of_node = args.np;
if (is_single_link)
*is_single_link = !args.args_count;
return 0;
}
static int seeed_voice_card_dai_link_of(struct device_node *node,
struct seeed_card_data *priv,
int idx,