Commit d14a13d3 authored by Scott Jiang's avatar Scott Jiang Committed by Mark Brown

ASoC: bf5xx-ad1836: convert to use snd_soc_register_card

Cpu dai and codec name are passed in through platform data.
Signed-off-by: default avatarScott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent d9875690
......@@ -59,62 +59,63 @@ static struct snd_soc_ops bf5xx_ad1836_ops = {
#define BF5XX_AD1836_DAIFMT (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_IF | \
SND_SOC_DAIFMT_CBM_CFM)
static struct snd_soc_dai_link bf5xx_ad1836_dai[] = {
{
.name = "ad1836",
.stream_name = "AD1836",
.cpu_dai_name = "bfin-tdm.0",
.codec_dai_name = "ad1836-hifi",
.platform_name = "bfin-tdm-pcm-audio",
.codec_name = "spi0.4",
.ops = &bf5xx_ad1836_ops,
.dai_fmt = BF5XX_AD1836_DAIFMT,
},
{
.name = "ad1836",
.stream_name = "AD1836",
.cpu_dai_name = "bfin-tdm.1",
.codec_dai_name = "ad1836-hifi",
.platform_name = "bfin-tdm-pcm-audio",
.codec_name = "spi0.4",
.ops = &bf5xx_ad1836_ops,
.dai_fmt = BF5XX_AD1836_DAIFMT,
},
static struct snd_soc_dai_link bf5xx_ad1836_dai = {
.name = "ad1836",
.stream_name = "AD1836",
.codec_dai_name = "ad1836-hifi",
.platform_name = "bfin-tdm-pcm-audio",
.ops = &bf5xx_ad1836_ops,
.dai_fmt = BF5XX_AD1836_DAIFMT,
};
static struct snd_soc_card bf5xx_ad1836 = {
.name = "bfin-ad1836",
.owner = THIS_MODULE,
.dai_link = &bf5xx_ad1836_dai[CONFIG_SND_BF5XX_SPORT_NUM],
.dai_link = &bf5xx_ad1836_dai,
.num_links = 1,
};
static struct platform_device *bfxx_ad1836_snd_device;
static int __init bf5xx_ad1836_init(void)
static __devinit int bf5xx_ad1836_driver_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &bf5xx_ad1836;
const char **link_name;
int ret;
bfxx_ad1836_snd_device = platform_device_alloc("soc-audio", -1);
if (!bfxx_ad1836_snd_device)
return -ENOMEM;
link_name = pdev->dev.platform_data;
if (!link_name) {
dev_err(&pdev->dev, "No platform data supplied\n");
return -EINVAL;
}
bf5xx_ad1836_dai.cpu_dai_name = link_name[0];
bf5xx_ad1836_dai.codec_name = link_name[1];
platform_set_drvdata(bfxx_ad1836_snd_device, &bf5xx_ad1836);
ret = platform_device_add(bfxx_ad1836_snd_device);
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
ret = snd_soc_register_card(card);
if (ret)
platform_device_put(bfxx_ad1836_snd_device);
dev_err(&pdev->dev, "Failed to register card\n");
return ret;
}
static void __exit bf5xx_ad1836_exit(void)
static int __devexit bf5xx_ad1836_driver_remove(struct platform_device *pdev)
{
platform_device_unregister(bfxx_ad1836_snd_device);
struct snd_soc_card *card = platform_get_drvdata(pdev);
snd_soc_unregister_card(card);
return 0;
}
module_init(bf5xx_ad1836_init);
module_exit(bf5xx_ad1836_exit);
static struct platform_driver bf5xx_ad1836_driver = {
.driver = {
.name = "bfin-snd-ad1836",
.owner = THIS_MODULE,
.pm = &snd_soc_pm_ops,
},
.probe = bf5xx_ad1836_driver_probe,
.remove = __devexit_p(bf5xx_ad1836_driver_remove),
};
module_platform_driver(bf5xx_ad1836_driver);
/* Module information */
MODULE_AUTHOR("Barry Song");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment