mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	ASoC: add for_each_card_prelinks() macro
To be more readable code, this patch adds new for_each_card_prelinks() macro, and replace existing code to it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
		
							parent
							
								
									6d11b12879
								
							
						
					
					
						commit
						7fe072b4df
					
				
					 16 changed files with 73 additions and 66 deletions
				
			
		| 
						 | 
					@ -1120,6 +1120,10 @@ struct snd_soc_card {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void *drvdata;
 | 
						void *drvdata;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					#define for_each_card_prelinks(card, i, link)				\
 | 
				
			||||||
 | 
						for ((i) = 0;							\
 | 
				
			||||||
 | 
						     ((i) < (card)->num_links) && ((link) = &(card)->dai_link[i]); \
 | 
				
			||||||
 | 
						     (i)++)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* SoC machine DAI configuration, glues a codec and cpu DAI together */
 | 
					/* SoC machine DAI configuration, glues a codec and cpu DAI together */
 | 
				
			||||||
struct snd_soc_pcm_runtime {
 | 
					struct snd_soc_pcm_runtime {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,6 +57,7 @@ static int pcm030_fabric_probe(struct platform_device *op)
 | 
				
			||||||
	struct device_node *platform_np;
 | 
						struct device_node *platform_np;
 | 
				
			||||||
	struct snd_soc_card *card = &pcm030_card;
 | 
						struct snd_soc_card *card = &pcm030_card;
 | 
				
			||||||
	struct pcm030_audio_data *pdata;
 | 
						struct pcm030_audio_data *pdata;
 | 
				
			||||||
 | 
						struct snd_soc_dai_link *dai_link;
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,8 +79,8 @@ static int pcm030_fabric_probe(struct platform_device *op)
 | 
				
			||||||
		return -ENODEV;
 | 
							return -ENODEV;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++)
 | 
						for_each_card_prelinks(card, i, dai_link)
 | 
				
			||||||
		card->dai_link[i].platform_of_node = platform_np;
 | 
							dai_link->platform_of_node = platform_np;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = request_module("snd-soc-wm9712");
 | 
						ret = request_module("snd-soc-wm9712");
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -404,11 +404,9 @@ EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_cpu);
 | 
				
			||||||
int asoc_simple_card_clean_reference(struct snd_soc_card *card)
 | 
					int asoc_simple_card_clean_reference(struct snd_soc_card *card)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct snd_soc_dai_link *dai_link;
 | 
						struct snd_soc_dai_link *dai_link;
 | 
				
			||||||
	int num_links;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (num_links = 0, dai_link = card->dai_link;
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
	     num_links < card->num_links;
 | 
					 | 
				
			||||||
	     num_links++, dai_link++) {
 | 
					 | 
				
			||||||
		of_node_put(dai_link->cpu_of_node);
 | 
							of_node_put(dai_link->cpu_of_node);
 | 
				
			||||||
		of_node_put(dai_link->codecs->of_node);
 | 
							of_node_put(dai_link->codecs->of_node);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -104,6 +104,7 @@ static struct snd_soc_card hda_soc_card = {
 | 
				
			||||||
static int skl_hda_fill_card_info(struct skl_machine_pdata *pdata)
 | 
					static int skl_hda_fill_card_info(struct skl_machine_pdata *pdata)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct snd_soc_card *card = &hda_soc_card;
 | 
						struct snd_soc_card *card = &hda_soc_card;
 | 
				
			||||||
 | 
						struct snd_soc_dai_link *dai_link;
 | 
				
			||||||
	u32 codec_count, codec_mask;
 | 
						u32 codec_count, codec_mask;
 | 
				
			||||||
	int i, num_links, num_route;
 | 
						int i, num_links, num_route;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,8 +126,8 @@ static int skl_hda_fill_card_info(struct skl_machine_pdata *pdata)
 | 
				
			||||||
	card->num_links = num_links;
 | 
						card->num_links = num_links;
 | 
				
			||||||
	card->num_dapm_routes = num_route;
 | 
						card->num_dapm_routes = num_route;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < num_links; i++)
 | 
						for_each_card_prelinks(card, i, dai_link)
 | 
				
			||||||
		skl_hda_be_dai_links[i].platform_name = pdata->platform;
 | 
							dai_link->platform_name = pdata->platform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -299,6 +299,7 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev)
 | 
				
			||||||
		devm_kzalloc(&pdev->dev, sizeof(struct mt2701_cs42448_private),
 | 
							devm_kzalloc(&pdev->dev, sizeof(struct mt2701_cs42448_private),
 | 
				
			||||||
			     GFP_KERNEL);
 | 
								     GFP_KERNEL);
 | 
				
			||||||
	struct device *dev = &pdev->dev;
 | 
						struct device *dev = &pdev->dev;
 | 
				
			||||||
 | 
						struct snd_soc_dai_link *dai_link;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!priv)
 | 
						if (!priv)
 | 
				
			||||||
		return -ENOMEM;
 | 
							return -ENOMEM;
 | 
				
			||||||
| 
						 | 
					@ -309,10 +310,10 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev)
 | 
				
			||||||
		dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
 | 
							dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		if (mt2701_cs42448_dai_links[i].platform_name)
 | 
							if (dai_links->platform_name)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		mt2701_cs42448_dai_links[i].platform_of_node = platform_node;
 | 
							dai_links->platform_of_node = platform_node;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	card->dev = dev;
 | 
						card->dev = dev;
 | 
				
			||||||
| 
						 | 
					@ -324,10 +325,10 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev)
 | 
				
			||||||
			"Property 'audio-codec' missing or invalid\n");
 | 
								"Property 'audio-codec' missing or invalid\n");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		if (mt2701_cs42448_dai_links[i].codec_name)
 | 
							if (dai_links->codec_name)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		mt2701_cs42448_dai_links[i].codec_of_node = codec_node;
 | 
							dai_links->codec_of_node = codec_node;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	codec_node_bt_mrg = of_parse_phandle(pdev->dev.of_node,
 | 
						codec_node_bt_mrg = of_parse_phandle(pdev->dev.of_node,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -97,6 +97,7 @@ static int mt2701_wm8960_machine_probe(struct platform_device *pdev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct snd_soc_card *card = &mt2701_wm8960_card;
 | 
						struct snd_soc_card *card = &mt2701_wm8960_card;
 | 
				
			||||||
	struct device_node *platform_node, *codec_node;
 | 
						struct device_node *platform_node, *codec_node;
 | 
				
			||||||
 | 
						struct snd_soc_dai_link *dai_link;
 | 
				
			||||||
	int ret, i;
 | 
						int ret, i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	platform_node = of_parse_phandle(pdev->dev.of_node,
 | 
						platform_node = of_parse_phandle(pdev->dev.of_node,
 | 
				
			||||||
| 
						 | 
					@ -105,10 +106,10 @@ static int mt2701_wm8960_machine_probe(struct platform_device *pdev)
 | 
				
			||||||
		dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
 | 
							dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		if (mt2701_wm8960_dai_links[i].platform_name)
 | 
							if (dai_links->platform_name)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		mt2701_wm8960_dai_links[i].platform_of_node = platform_node;
 | 
							dai_links->platform_of_node = platform_node;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	card->dev = &pdev->dev;
 | 
						card->dev = &pdev->dev;
 | 
				
			||||||
| 
						 | 
					@ -120,10 +121,10 @@ static int mt2701_wm8960_machine_probe(struct platform_device *pdev)
 | 
				
			||||||
			"Property 'audio-codec' missing or invalid\n");
 | 
								"Property 'audio-codec' missing or invalid\n");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		if (mt2701_wm8960_dai_links[i].codec_name)
 | 
							if (dai_links->codec_name)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		mt2701_wm8960_dai_links[i].codec_of_node = codec_node;
 | 
							dai_links->codec_of_node = codec_node;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
 | 
						ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,6 +158,7 @@ static int mt6797_mt6351_dev_probe(struct platform_device *pdev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct snd_soc_card *card = &mt6797_mt6351_card;
 | 
						struct snd_soc_card *card = &mt6797_mt6351_card;
 | 
				
			||||||
	struct device_node *platform_node, *codec_node;
 | 
						struct device_node *platform_node, *codec_node;
 | 
				
			||||||
 | 
						struct snd_soc_dai_link *dai_link;
 | 
				
			||||||
	int ret, i;
 | 
						int ret, i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	card->dev = &pdev->dev;
 | 
						card->dev = &pdev->dev;
 | 
				
			||||||
| 
						 | 
					@ -168,10 +169,10 @@ static int mt6797_mt6351_dev_probe(struct platform_device *pdev)
 | 
				
			||||||
		dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
 | 
							dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		if (mt6797_mt6351_dai_links[i].platform_name)
 | 
							if (dai_link->platform_name)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		mt6797_mt6351_dai_links[i].platform_of_node = platform_node;
 | 
							dai_links->platform_of_node = platform_node;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	codec_node = of_parse_phandle(pdev->dev.of_node,
 | 
						codec_node = of_parse_phandle(pdev->dev.of_node,
 | 
				
			||||||
| 
						 | 
					@ -181,10 +182,10 @@ static int mt6797_mt6351_dev_probe(struct platform_device *pdev)
 | 
				
			||||||
			"Property 'audio-codec' missing or invalid\n");
 | 
								"Property 'audio-codec' missing or invalid\n");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		if (mt6797_mt6351_dai_links[i].codec_name)
 | 
							if (dai_links->codec_name)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		mt6797_mt6351_dai_links[i].codec_of_node = codec_node;
 | 
							dai_links->codec_of_node = codec_node;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = devm_snd_soc_register_card(&pdev->dev, card);
 | 
						ret = devm_snd_soc_register_card(&pdev->dev, card);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -137,6 +137,7 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct snd_soc_card *card = &mt8173_max98090_card;
 | 
						struct snd_soc_card *card = &mt8173_max98090_card;
 | 
				
			||||||
	struct device_node *codec_node, *platform_node;
 | 
						struct device_node *codec_node, *platform_node;
 | 
				
			||||||
 | 
						struct snd_soc_dai_link *dai_link;
 | 
				
			||||||
	int ret, i;
 | 
						int ret, i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	platform_node = of_parse_phandle(pdev->dev.of_node,
 | 
						platform_node = of_parse_phandle(pdev->dev.of_node,
 | 
				
			||||||
| 
						 | 
					@ -145,10 +146,10 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev)
 | 
				
			||||||
		dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
 | 
							dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		if (mt8173_max98090_dais[i].platform_name)
 | 
							if (dai_link->platform_name)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		mt8173_max98090_dais[i].platform_of_node = platform_node;
 | 
							dai_link->platform_of_node = platform_node;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	codec_node = of_parse_phandle(pdev->dev.of_node,
 | 
						codec_node = of_parse_phandle(pdev->dev.of_node,
 | 
				
			||||||
| 
						 | 
					@ -158,10 +159,10 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev)
 | 
				
			||||||
			"Property 'audio-codec' missing or invalid\n");
 | 
								"Property 'audio-codec' missing or invalid\n");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		if (mt8173_max98090_dais[i].codec_name)
 | 
							if (dai_link->codec_name)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		mt8173_max98090_dais[i].codec_of_node = codec_node;
 | 
							dai_link->codec_of_node = codec_node;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	card->dev = &pdev->dev;
 | 
						card->dev = &pdev->dev;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -178,6 +178,7 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct snd_soc_card *card = &mt8173_rt5650_rt5514_card;
 | 
						struct snd_soc_card *card = &mt8173_rt5650_rt5514_card;
 | 
				
			||||||
	struct device_node *platform_node;
 | 
						struct device_node *platform_node;
 | 
				
			||||||
 | 
						struct snd_soc_dai_link *dai_link;
 | 
				
			||||||
	int i, ret;
 | 
						int i, ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	platform_node = of_parse_phandle(pdev->dev.of_node,
 | 
						platform_node = of_parse_phandle(pdev->dev.of_node,
 | 
				
			||||||
| 
						 | 
					@ -187,10 +188,10 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		if (mt8173_rt5650_rt5514_dais[i].platform_name)
 | 
							if (dai_link->platform_name)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		mt8173_rt5650_rt5514_dais[i].platform_of_node = platform_node;
 | 
							dai_link->platform_of_node = platform_node;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mt8173_rt5650_rt5514_codecs[0].of_node =
 | 
						mt8173_rt5650_rt5514_codecs[0].of_node =
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -224,6 +224,7 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct snd_soc_card *card = &mt8173_rt5650_rt5676_card;
 | 
						struct snd_soc_card *card = &mt8173_rt5650_rt5676_card;
 | 
				
			||||||
	struct device_node *platform_node;
 | 
						struct device_node *platform_node;
 | 
				
			||||||
 | 
						struct snd_soc_dai_link *dai_link;
 | 
				
			||||||
	int i, ret;
 | 
						int i, ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	platform_node = of_parse_phandle(pdev->dev.of_node,
 | 
						platform_node = of_parse_phandle(pdev->dev.of_node,
 | 
				
			||||||
| 
						 | 
					@ -233,10 +234,10 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		if (mt8173_rt5650_rt5676_dais[i].platform_name)
 | 
							if (dai_link->platform_name)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		mt8173_rt5650_rt5676_dais[i].platform_of_node = platform_node;
 | 
							dai_link->platform_of_node = platform_node;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mt8173_rt5650_rt5676_codecs[0].of_node =
 | 
						mt8173_rt5650_rt5676_codecs[0].of_node =
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -239,6 +239,7 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev)
 | 
				
			||||||
	struct device_node *platform_node;
 | 
						struct device_node *platform_node;
 | 
				
			||||||
	struct device_node *np;
 | 
						struct device_node *np;
 | 
				
			||||||
	const char *codec_capture_dai;
 | 
						const char *codec_capture_dai;
 | 
				
			||||||
 | 
						struct snd_soc_dai_link *dai_link;
 | 
				
			||||||
	int i, ret;
 | 
						int i, ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	platform_node = of_parse_phandle(pdev->dev.of_node,
 | 
						platform_node = of_parse_phandle(pdev->dev.of_node,
 | 
				
			||||||
| 
						 | 
					@ -248,10 +249,10 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		if (mt8173_rt5650_dais[i].platform_name)
 | 
							if (dai_link->platform_name)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		mt8173_rt5650_dais[i].platform_of_node = platform_node;
 | 
							dai_link->platform_of_node = platform_node;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mt8173_rt5650_codecs[0].of_node =
 | 
						mt8173_rt5650_codecs[0].of_node =
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -101,8 +101,7 @@ static void axg_card_clean_references(struct axg_card *priv)
 | 
				
			||||||
	int i, j;
 | 
						int i, j;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (card->dai_link) {
 | 
						if (card->dai_link) {
 | 
				
			||||||
		for (i = 0; i < card->num_links; i++) {
 | 
							for_each_card_prelinks(card, i, link) {
 | 
				
			||||||
			link = &card->dai_link[i];
 | 
					 | 
				
			||||||
			of_node_put(link->cpu_of_node);
 | 
								of_node_put(link->cpu_of_node);
 | 
				
			||||||
			for_each_link_codecs(link, j, codec)
 | 
								for_each_link_codecs(link, j, codec)
 | 
				
			||||||
				of_node_put(codec->of_node);
 | 
									of_node_put(codec->of_node);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,13 +25,12 @@ static int apq8096_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void apq8096_add_be_ops(struct snd_soc_card *card)
 | 
					static void apq8096_add_be_ops(struct snd_soc_card *card)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct snd_soc_dai_link *link = card->dai_link;
 | 
						struct snd_soc_dai_link *link;
 | 
				
			||||||
	int i, num_links = card->num_links;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < num_links; i++) {
 | 
						for_each_card_prelinks(card, i, link) {
 | 
				
			||||||
		if (link->no_pcm == 1)
 | 
							if (link->no_pcm == 1)
 | 
				
			||||||
			link->be_hw_params_fixup = apq8096_be_hw_params_fixup;
 | 
								link->be_hw_params_fixup = apq8096_be_hw_params_fixup;
 | 
				
			||||||
		link++;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -195,15 +195,14 @@ static int sdm845_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void sdm845_add_be_ops(struct snd_soc_card *card)
 | 
					static void sdm845_add_be_ops(struct snd_soc_card *card)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct snd_soc_dai_link *link = card->dai_link;
 | 
						struct snd_soc_dai_link *link;
 | 
				
			||||||
	int i, num_links = card->num_links;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < num_links; i++) {
 | 
						for_each_card_prelinks(card, i, link) {
 | 
				
			||||||
		if (link->no_pcm == 1) {
 | 
							if (link->no_pcm == 1) {
 | 
				
			||||||
			link->ops = &sdm845_be_ops;
 | 
								link->ops = &sdm845_be_ops;
 | 
				
			||||||
			link->be_hw_params_fixup = sdm845_be_hw_params_fixup;
 | 
								link->be_hw_params_fixup = sdm845_be_hw_params_fixup;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		link++;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -491,6 +491,7 @@ static int tm2_probe(struct platform_device *pdev)
 | 
				
			||||||
	struct snd_soc_card *card = &tm2_card;
 | 
						struct snd_soc_card *card = &tm2_card;
 | 
				
			||||||
	struct tm2_machine_priv *priv;
 | 
						struct tm2_machine_priv *priv;
 | 
				
			||||||
	struct of_phandle_args args;
 | 
						struct of_phandle_args args;
 | 
				
			||||||
 | 
						struct snd_soc_dai_link *dai_link;
 | 
				
			||||||
	int num_codecs, ret, i;
 | 
						int num_codecs, ret, i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 | 
						priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 | 
				
			||||||
| 
						 | 
					@ -558,18 +559,18 @@ static int tm2_probe(struct platform_device *pdev)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Initialize WM5110 - I2S and HDMI - I2S1 DAI links */
 | 
						/* Initialize WM5110 - I2S and HDMI - I2S1 DAI links */
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		unsigned int dai_index = 0; /* WM5110 */
 | 
							unsigned int dai_index = 0; /* WM5110 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		card->dai_link[i].cpu_name = NULL;
 | 
							dai_link->cpu_name = NULL;
 | 
				
			||||||
		card->dai_link[i].platform_name = NULL;
 | 
							dai_link->platform_name = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (num_codecs > 1 && i == card->num_links - 1)
 | 
							if (num_codecs > 1 && i == card->num_links - 1)
 | 
				
			||||||
			dai_index = 1; /* HDMI */
 | 
								dai_index = 1; /* HDMI */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		card->dai_link[i].codec_of_node = codec_dai_node[dai_index];
 | 
							dai_link->codec_of_node = codec_dai_node[dai_index];
 | 
				
			||||||
		card->dai_link[i].cpu_of_node = cpu_dai_node[dai_index];
 | 
							dai_link->cpu_of_node = cpu_dai_node[dai_index];
 | 
				
			||||||
		card->dai_link[i].platform_of_node = cpu_dai_node[dai_index];
 | 
							dai_link->platform_of_node = cpu_dai_node[dai_index];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (num_codecs > 1) {
 | 
						if (num_codecs > 1) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1889,9 +1889,7 @@ static void soc_check_tplg_fes(struct snd_soc_card *card)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* machine matches, so override the rtd data */
 | 
							/* machine matches, so override the rtd data */
 | 
				
			||||||
		for (i = 0; i < card->num_links; i++) {
 | 
							for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
			dai_link = &card->dai_link[i];
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* ignore this FE */
 | 
								/* ignore this FE */
 | 
				
			||||||
			if (dai_link->dynamic) {
 | 
								if (dai_link->dynamic) {
 | 
				
			||||||
| 
						 | 
					@ -1955,8 +1953,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
 | 
				
			||||||
	soc_check_tplg_fes(card);
 | 
						soc_check_tplg_fes(card);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* bind DAIs */
 | 
						/* bind DAIs */
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, dai_link) {
 | 
				
			||||||
		ret = soc_bind_dai_link(card, &card->dai_link[i]);
 | 
							ret = soc_bind_dai_link(card, dai_link);
 | 
				
			||||||
		if (ret != 0)
 | 
							if (ret != 0)
 | 
				
			||||||
			goto base_error;
 | 
								goto base_error;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1969,8 +1967,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* add predefined DAI links to the list */
 | 
						/* add predefined DAI links to the list */
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++)
 | 
						for_each_card_prelinks(card, i, dai_link)
 | 
				
			||||||
		snd_soc_add_dai_link(card, card->dai_link+i);
 | 
							snd_soc_add_dai_link(card, dai_link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* card bind complete so register a sound card */
 | 
						/* card bind complete so register a sound card */
 | 
				
			||||||
	ret = snd_card_new(card->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
 | 
						ret = snd_card_new(card->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
 | 
				
			||||||
| 
						 | 
					@ -2714,12 +2712,12 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
 | 
				
			||||||
int snd_soc_register_card(struct snd_soc_card *card)
 | 
					int snd_soc_register_card(struct snd_soc_card *card)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i, ret;
 | 
						int i, ret;
 | 
				
			||||||
 | 
						struct snd_soc_dai_link *link;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!card->name || !card->dev)
 | 
						if (!card->name || !card->dev)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < card->num_links; i++) {
 | 
						for_each_card_prelinks(card, i, link) {
 | 
				
			||||||
		struct snd_soc_dai_link *link = &card->dai_link[i];
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ret = soc_init_dai_link(card, link);
 | 
							ret = soc_init_dai_link(card, link);
 | 
				
			||||||
		if (ret) {
 | 
							if (ret) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue