aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa/imote2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/pxa/imote2.c')
-rw-r--r--sound/soc/pxa/imote2.c58
1 files changed, 27 insertions, 31 deletions
diff --git a/sound/soc/pxa/imote2.c b/sound/soc/pxa/imote2.c
index 154fc6f23438..b93dafd32b80 100644
--- a/sound/soc/pxa/imote2.c
+++ b/sound/soc/pxa/imote2.c
@@ -30,20 +30,6 @@ static int imote2_asoc_hw_params(struct snd_pcm_substream *substream,
30 break; 30 break;
31 } 31 }
32 32
33 /* set codec DAI configuration */
34 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
35 | SND_SOC_DAIFMT_NB_NF
36 | SND_SOC_DAIFMT_CBS_CFS);
37 if (ret < 0)
38 return ret;
39
40 /* CPU should be clock master */
41 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
42 | SND_SOC_DAIFMT_NB_NF
43 | SND_SOC_DAIFMT_CBS_CFS);
44 if (ret < 0)
45 return ret;
46
47 ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk, 33 ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk,
48 SND_SOC_CLOCK_IN); 34 SND_SOC_CLOCK_IN);
49 if (ret < 0) 35 if (ret < 0)
@@ -67,42 +53,52 @@ static struct snd_soc_dai_link imote2_dai = {
67 .codec_dai_name = "wm8940-hifi", 53 .codec_dai_name = "wm8940-hifi",
68 .platform_name = "pxa-pcm-audio", 54 .platform_name = "pxa-pcm-audio",
69 .codec_name = "wm8940-codec.0-0034", 55 .codec_name = "wm8940-codec.0-0034",
56 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
57 SND_SOC_DAIFMT_CBS_CFS,
70 .ops = &imote2_asoc_ops, 58 .ops = &imote2_asoc_ops,
71}; 59};
72 60
73static struct snd_soc_card snd_soc_imote2 = { 61static struct snd_soc_card imote2 = {
74 .name = "Imote2", 62 .name = "Imote2",
63 .owner = THIS_MODULE,
75 .dai_link = &imote2_dai, 64 .dai_link = &imote2_dai,
76 .num_links = 1, 65 .num_links = 1,
77}; 66};
78 67
79static struct platform_device *imote2_snd_device; 68static int __devinit imote2_probe(struct platform_device *pdev)
80
81static int __init imote2_asoc_init(void)
82{ 69{
70 struct snd_soc_card *card = &imote2;
83 int ret; 71 int ret;
84 72
85 if (!machine_is_intelmote2()) 73 card->dev = &pdev->dev;
86 return -ENODEV;
87 imote2_snd_device = platform_device_alloc("soc-audio", -1);
88 if (!imote2_snd_device)
89 return -ENOMEM;
90 74
91 platform_set_drvdata(imote2_snd_device, &snd_soc_imote2); 75 ret = snd_soc_register_card(card);
92 ret = platform_device_add(imote2_snd_device);
93 if (ret) 76 if (ret)
94 platform_device_put(imote2_snd_device); 77 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
95 78 ret);
96 return ret; 79 return ret;
97} 80}
98module_init(imote2_asoc_init);
99 81
100static void __exit imote2_asoc_exit(void) 82static int __devexit imote2_remove(struct platform_device *pdev)
101{ 83{
102 platform_device_unregister(imote2_snd_device); 84 struct snd_soc_card *card = platform_get_drvdata(pdev);
85
86 snd_soc_unregister_card(card);
87 return 0;
103} 88}
104module_exit(imote2_asoc_exit); 89
90static struct platform_driver imote2_driver = {
91 .driver = {
92 .name = "imote2-audio",
93 .owner = THIS_MODULE,
94 },
95 .probe = imote2_probe,
96 .remove = __devexit_p(imote2_remove),
97};
98
99module_platform_driver(imote2_driver);
105 100
106MODULE_AUTHOR("Jonathan Cameron"); 101MODULE_AUTHOR("Jonathan Cameron");
107MODULE_DESCRIPTION("ALSA SoC Imote 2"); 102MODULE_DESCRIPTION("ALSA SoC Imote 2");
108MODULE_LICENSE("GPL"); 103MODULE_LICENSE("GPL");
104MODULE_ALIAS("platform:imote2-audio");