2 #include <linux/module.h>
5 #include <asm/mach-types.h>
7 #include "../codecs/wm8940.h"
8 #include "pxa2xx-i2s.h"
10 static int imote2_asoc_hw_params(struct snd_pcm_substream *substream,
11 struct snd_pcm_hw_params *params)
13 struct snd_soc_pcm_runtime *rtd = substream->private_data;
14 struct snd_soc_dai *codec_dai = rtd->codec_dai;
15 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
19 switch (params_rate(params)) {
33 ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk,
38 /* set the I2S system clock as input (unused) */
39 ret = snd_soc_dai_set_sysclk(cpu_dai, PXA2XX_I2S_SYSCLK, clk,
45 static const struct snd_soc_ops imote2_asoc_ops = {
46 .hw_params = imote2_asoc_hw_params,
49 SND_SOC_DAILINK_DEFS(wm8940,
50 DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-i2s")),
51 DAILINK_COMP_ARRAY(COMP_CODEC("wm8940-codec.0-0034",
53 DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio")));
55 static struct snd_soc_dai_link imote2_dai = {
57 .stream_name = "WM8940",
58 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
59 SND_SOC_DAIFMT_CBS_CFS,
60 .ops = &imote2_asoc_ops,
61 SND_SOC_DAILINK_REG(wm8940),
64 static struct snd_soc_card imote2 = {
67 .dai_link = &imote2_dai,
71 static int imote2_probe(struct platform_device *pdev)
73 struct snd_soc_card *card = &imote2;
76 card->dev = &pdev->dev;
78 ret = devm_snd_soc_register_card(&pdev->dev, card);
80 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
85 static struct platform_driver imote2_driver = {
87 .name = "imote2-audio",
88 .pm = &snd_soc_pm_ops,
90 .probe = imote2_probe,
93 module_platform_driver(imote2_driver);
95 MODULE_AUTHOR("Jonathan Cameron");
96 MODULE_DESCRIPTION("ALSA SoC Imote 2");
97 MODULE_LICENSE("GPL");
98 MODULE_ALIAS("platform:imote2-audio");