aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/blackfin/bf5xx-ad1836.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/blackfin/bf5xx-ad1836.c')
-rw-r--r--sound/soc/blackfin/bf5xx-ad1836.c73
1 files changed, 37 insertions, 36 deletions
diff --git a/sound/soc/blackfin/bf5xx-ad1836.c b/sound/soc/blackfin/bf5xx-ad1836.c
index d542d4063771..16b9c9efd19a 100644
--- a/sound/soc/blackfin/bf5xx-ad1836.c
+++ b/sound/soc/blackfin/bf5xx-ad1836.c
@@ -59,62 +59,63 @@ static struct snd_soc_ops bf5xx_ad1836_ops = {
59#define BF5XX_AD1836_DAIFMT (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_IF | \ 59#define BF5XX_AD1836_DAIFMT (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_IF | \
60 SND_SOC_DAIFMT_CBM_CFM) 60 SND_SOC_DAIFMT_CBM_CFM)
61 61
62static struct snd_soc_dai_link bf5xx_ad1836_dai[] = { 62static struct snd_soc_dai_link bf5xx_ad1836_dai = {
63 { 63 .name = "ad1836",
64 .name = "ad1836", 64 .stream_name = "AD1836",
65 .stream_name = "AD1836", 65 .codec_dai_name = "ad1836-hifi",
66 .cpu_dai_name = "bfin-tdm.0", 66 .platform_name = "bfin-tdm-pcm-audio",
67 .codec_dai_name = "ad1836-hifi", 67 .ops = &bf5xx_ad1836_ops,
68 .platform_name = "bfin-tdm-pcm-audio", 68 .dai_fmt = BF5XX_AD1836_DAIFMT,
69 .codec_name = "spi0.4",
70 .ops = &bf5xx_ad1836_ops,
71 .dai_fmt = BF5XX_AD1836_DAIFMT,
72 },
73 {
74 .name = "ad1836",
75 .stream_name = "AD1836",
76 .cpu_dai_name = "bfin-tdm.1",
77 .codec_dai_name = "ad1836-hifi",
78 .platform_name = "bfin-tdm-pcm-audio",
79 .codec_name = "spi0.4",
80 .ops = &bf5xx_ad1836_ops,
81 .dai_fmt = BF5XX_AD1836_DAIFMT,
82 },
83}; 69};
84 70
85static struct snd_soc_card bf5xx_ad1836 = { 71static struct snd_soc_card bf5xx_ad1836 = {
86 .name = "bfin-ad1836", 72 .name = "bfin-ad1836",
87 .owner = THIS_MODULE, 73 .owner = THIS_MODULE,
88 .dai_link = &bf5xx_ad1836_dai[CONFIG_SND_BF5XX_SPORT_NUM], 74 .dai_link = &bf5xx_ad1836_dai,
89 .num_links = 1, 75 .num_links = 1,
90}; 76};
91 77
92static struct platform_device *bfxx_ad1836_snd_device; 78static __devinit int bf5xx_ad1836_driver_probe(struct platform_device *pdev)
93
94static int __init bf5xx_ad1836_init(void)
95{ 79{
80 struct snd_soc_card *card = &bf5xx_ad1836;
81 const char **link_name;
96 int ret; 82 int ret;
97 83
98 bfxx_ad1836_snd_device = platform_device_alloc("soc-audio", -1); 84 link_name = pdev->dev.platform_data;
99 if (!bfxx_ad1836_snd_device) 85 if (!link_name) {
100 return -ENOMEM; 86 dev_err(&pdev->dev, "No platform data supplied\n");
87 return -EINVAL;
88 }
89 bf5xx_ad1836_dai.cpu_dai_name = link_name[0];
90 bf5xx_ad1836_dai.codec_name = link_name[1];
101 91
102 platform_set_drvdata(bfxx_ad1836_snd_device, &bf5xx_ad1836); 92 card->dev = &pdev->dev;
103 ret = platform_device_add(bfxx_ad1836_snd_device); 93 platform_set_drvdata(pdev, card);
104 94
95 ret = snd_soc_register_card(card);
105 if (ret) 96 if (ret)
106 platform_device_put(bfxx_ad1836_snd_device); 97 dev_err(&pdev->dev, "Failed to register card\n");
107
108 return ret; 98 return ret;
109} 99}
110 100
111static void __exit bf5xx_ad1836_exit(void) 101static int __devexit bf5xx_ad1836_driver_remove(struct platform_device *pdev)
112{ 102{
113 platform_device_unregister(bfxx_ad1836_snd_device); 103 struct snd_soc_card *card = platform_get_drvdata(pdev);
104
105 snd_soc_unregister_card(card);
106 return 0;
114} 107}
115 108
116module_init(bf5xx_ad1836_init); 109static struct platform_driver bf5xx_ad1836_driver = {
117module_exit(bf5xx_ad1836_exit); 110 .driver = {
111 .name = "bfin-snd-ad1836",
112 .owner = THIS_MODULE,
113 .pm = &snd_soc_pm_ops,
114 },
115 .probe = bf5xx_ad1836_driver_probe,
116 .remove = __devexit_p(bf5xx_ad1836_driver_remove),
117};
118module_platform_driver(bf5xx_ad1836_driver);
118 119
119/* Module information */ 120/* Module information */
120MODULE_AUTHOR("Barry Song"); 121MODULE_AUTHOR("Barry Song");