Merge tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb...
[linux-2.6.git] / sound / soc / blackfin / bfin-eval-adau1701.c
blob3b55081a96c0f83bf63b10e031964ff42e644734
1 /*
2 * Machine driver for EVAL-ADAU1701MINIZ on Analog Devices bfin
3 * evaluation boards.
5 * Copyright 2011 Analog Devices Inc.
6 * Author: Lars-Peter Clausen <lars@metafoo.de>
8 * Licensed under the GPL-2 or later.
9 */
11 #include <linux/module.h>
12 #include <linux/device.h>
13 #include <sound/core.h>
14 #include <sound/pcm.h>
15 #include <sound/soc.h>
16 #include <sound/pcm_params.h>
18 #include "../codecs/adau1701.h"
20 static const struct snd_soc_dapm_widget bfin_eval_adau1701_dapm_widgets[] = {
21 SND_SOC_DAPM_SPK("Speaker", NULL),
22 SND_SOC_DAPM_LINE("Line Out", NULL),
23 SND_SOC_DAPM_LINE("Line In", NULL),
26 static const struct snd_soc_dapm_route bfin_eval_adau1701_dapm_routes[] = {
27 { "Speaker", NULL, "OUT0" },
28 { "Speaker", NULL, "OUT1" },
29 { "Line Out", NULL, "OUT2" },
30 { "Line Out", NULL, "OUT3" },
32 { "IN0", NULL, "Line In" },
33 { "IN1", NULL, "Line In" },
36 static int bfin_eval_adau1701_hw_params(struct snd_pcm_substream *substream,
37 struct snd_pcm_hw_params *params)
39 struct snd_soc_pcm_runtime *rtd = substream->private_data;
40 struct snd_soc_dai *codec_dai = rtd->codec_dai;
41 int ret;
43 ret = snd_soc_dai_set_sysclk(codec_dai, ADAU1701_CLK_SRC_OSC, 12288000,
44 SND_SOC_CLOCK_IN);
46 return ret;
49 static struct snd_soc_ops bfin_eval_adau1701_ops = {
50 .hw_params = bfin_eval_adau1701_hw_params,
53 #define BFIN_EVAL_ADAU1701_DAI_FMT (SND_SOC_DAIFMT_I2S | \
54 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM)
56 static struct snd_soc_dai_link bfin_eval_adau1701_dai[] = {
58 .name = "adau1701",
59 .stream_name = "adau1701",
60 .cpu_dai_name = "bfin-i2s.0",
61 .codec_dai_name = "adau1701",
62 .platform_name = "bfin-i2s-pcm-audio",
63 .codec_name = "adau1701.0-0034",
64 .ops = &bfin_eval_adau1701_ops,
65 .dai_fmt = BFIN_EVAL_ADAU1701_DAI_FMT,
68 .name = "adau1701",
69 .stream_name = "adau1701",
70 .cpu_dai_name = "bfin-i2s.1",
71 .codec_dai_name = "adau1701",
72 .platform_name = "bfin-i2s-pcm-audio",
73 .codec_name = "adau1701.0-0034",
74 .ops = &bfin_eval_adau1701_ops,
75 .dai_fmt = BFIN_EVAL_ADAU1701_DAI_FMT,
79 static struct snd_soc_card bfin_eval_adau1701 = {
80 .name = "bfin-eval-adau1701",
81 .owner = THIS_MODULE,
82 .dai_link = &bfin_eval_adau1701_dai[CONFIG_SND_BF5XX_SPORT_NUM],
83 .num_links = 1,
85 .dapm_widgets = bfin_eval_adau1701_dapm_widgets,
86 .num_dapm_widgets = ARRAY_SIZE(bfin_eval_adau1701_dapm_widgets),
87 .dapm_routes = bfin_eval_adau1701_dapm_routes,
88 .num_dapm_routes = ARRAY_SIZE(bfin_eval_adau1701_dapm_routes),
91 static int bfin_eval_adau1701_probe(struct platform_device *pdev)
93 struct snd_soc_card *card = &bfin_eval_adau1701;
95 card->dev = &pdev->dev;
97 return snd_soc_register_card(&bfin_eval_adau1701);
100 static int bfin_eval_adau1701_remove(struct platform_device *pdev)
102 struct snd_soc_card *card = platform_get_drvdata(pdev);
104 snd_soc_unregister_card(card);
106 return 0;
109 static struct platform_driver bfin_eval_adau1701_driver = {
110 .driver = {
111 .name = "bfin-eval-adau1701",
112 .owner = THIS_MODULE,
113 .pm = &snd_soc_pm_ops,
115 .probe = bfin_eval_adau1701_probe,
116 .remove = bfin_eval_adau1701_remove,
119 module_platform_driver(bfin_eval_adau1701_driver);
121 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
122 MODULE_DESCRIPTION("ALSA SoC bfin ADAU1701 driver");
123 MODULE_LICENSE("GPL");
124 MODULE_ALIAS("platform:bfin-eval-adau1701");