diff options
Diffstat (limited to 'sound/soc/pxa/imote2.c')
-rw-r--r-- | sound/soc/pxa/imote2.c | 58 |
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 | ||
73 | static struct snd_soc_card snd_soc_imote2 = { | 61 | static 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 | ||
79 | static struct platform_device *imote2_snd_device; | 68 | static int __devinit imote2_probe(struct platform_device *pdev) |
80 | |||
81 | static 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 | } |
98 | module_init(imote2_asoc_init); | ||
99 | 81 | ||
100 | static void __exit imote2_asoc_exit(void) | 82 | static 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 | } |
104 | module_exit(imote2_asoc_exit); | 89 | |
90 | static 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 | |||
99 | module_platform_driver(imote2_driver); | ||
105 | 100 | ||
106 | MODULE_AUTHOR("Jonathan Cameron"); | 101 | MODULE_AUTHOR("Jonathan Cameron"); |
107 | MODULE_DESCRIPTION("ALSA SoC Imote 2"); | 102 | MODULE_DESCRIPTION("ALSA SoC Imote 2"); |
108 | MODULE_LICENSE("GPL"); | 103 | MODULE_LICENSE("GPL"); |
104 | MODULE_ALIAS("platform:imote2-audio"); | ||