ASoC: simple-card: simplify code
The DT values are copied to the non-DT structure before being moved to the card structure. Set directly the DT values in the card and move the non-DT copy to the non-DT sequence. Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
7722f830a4
commit
2bee991460
|
@ -169,12 +169,13 @@ static int asoc_simple_card_parse_of(struct device_node *node,
|
||||||
strlen(info->codec_dai.name) + 2,
|
strlen(info->codec_dai.name) + 2,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
sprintf(name, "%s-%s", info->cpu_dai.name, info->codec_dai.name);
|
sprintf(name, "%s-%s", info->cpu_dai.name, info->codec_dai.name);
|
||||||
info->name = info->card = name;
|
info->snd_card.name = name;
|
||||||
|
info->snd_link.name = info->snd_link.stream_name = name;
|
||||||
|
|
||||||
/* simple-card assumes platform == cpu */
|
/* simple-card assumes platform == cpu */
|
||||||
*of_platform = *of_cpu;
|
*of_platform = *of_cpu;
|
||||||
|
|
||||||
dev_dbg(dev, "card-name : %s\n", info->card);
|
dev_dbg(dev, "card-name : %s\n", name);
|
||||||
dev_dbg(dev, "platform : %04x\n", info->daifmt);
|
dev_dbg(dev, "platform : %04x\n", info->daifmt);
|
||||||
dev_dbg(dev, "cpu : %s / %04x / %d\n",
|
dev_dbg(dev, "cpu : %s / %04x / %d\n",
|
||||||
info->cpu_dai.name,
|
info->cpu_dai.name,
|
||||||
|
@ -217,6 +218,9 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
|
||||||
dev_err(dev, "parse error %d\n", ret);
|
dev_err(dev, "parse error %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
cinfo->snd_link.cpu_of_node = of_cpu;
|
||||||
|
cinfo->snd_link.codec_of_node = of_codec;
|
||||||
|
cinfo->snd_link.platform_of_node = of_platform;
|
||||||
} else {
|
} else {
|
||||||
if (!dev->platform_data) {
|
if (!dev->platform_data) {
|
||||||
dev_err(dev, "no info for asoc-simple-card\n");
|
dev_err(dev, "no info for asoc-simple-card\n");
|
||||||
|
@ -235,26 +239,24 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
|
||||||
dev_err(dev, "insufficient asoc_simple_card_info settings\n");
|
dev_err(dev, "insufficient asoc_simple_card_info settings\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cinfo->snd_card.name = cinfo->card;
|
||||||
|
cinfo->snd_link.name = cinfo->name;
|
||||||
|
cinfo->snd_link.stream_name = cinfo->name;
|
||||||
|
cinfo->snd_link.platform_name = cinfo->platform;
|
||||||
|
cinfo->snd_link.codec_name = cinfo->codec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* init snd_soc_dai_link
|
* init snd_soc_dai_link
|
||||||
*/
|
*/
|
||||||
cinfo->snd_link.name = cinfo->name;
|
|
||||||
cinfo->snd_link.stream_name = cinfo->name;
|
|
||||||
cinfo->snd_link.cpu_dai_name = cinfo->cpu_dai.name;
|
cinfo->snd_link.cpu_dai_name = cinfo->cpu_dai.name;
|
||||||
cinfo->snd_link.platform_name = cinfo->platform;
|
|
||||||
cinfo->snd_link.codec_name = cinfo->codec;
|
|
||||||
cinfo->snd_link.codec_dai_name = cinfo->codec_dai.name;
|
cinfo->snd_link.codec_dai_name = cinfo->codec_dai.name;
|
||||||
cinfo->snd_link.cpu_of_node = of_cpu;
|
|
||||||
cinfo->snd_link.codec_of_node = of_codec;
|
|
||||||
cinfo->snd_link.platform_of_node = of_platform;
|
|
||||||
cinfo->snd_link.init = asoc_simple_card_dai_init;
|
cinfo->snd_link.init = asoc_simple_card_dai_init;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* init snd_soc_card
|
* init snd_soc_card
|
||||||
*/
|
*/
|
||||||
cinfo->snd_card.name = cinfo->card;
|
|
||||||
cinfo->snd_card.owner = THIS_MODULE;
|
cinfo->snd_card.owner = THIS_MODULE;
|
||||||
cinfo->snd_card.dai_link = &cinfo->snd_link;
|
cinfo->snd_card.dai_link = &cinfo->snd_link;
|
||||||
cinfo->snd_card.num_links = 1;
|
cinfo->snd_card.num_links = 1;
|
||||||
|
|
Loading…
Reference in New Issue