aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/blackfin/Kconfig13
-rw-r--r--sound/soc/blackfin/Makefile2
-rw-r--r--sound/soc/blackfin/bfin-eval-adau1x81.c130
3 files changed, 145 insertions, 0 deletions
diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig
index 8c3a87bb96dc..6410aa2cc2cf 100644
--- a/sound/soc/blackfin/Kconfig
+++ b/sound/soc/blackfin/Kconfig
@@ -56,6 +56,19 @@ config SND_SOC_BFIN_EVAL_ADAU1X61
56 Note: This driver assumes that the ADAU1X61 is connected to the 56 Note: This driver assumes that the ADAU1X61 is connected to the
57 first SPORT port on the BF5XX board. 57 first SPORT port on the BF5XX board.
58 58
59config SND_SOC_BFIN_EVAL_ADAU1X81
60 tristate "Support for the EVAL-ADAU1X81 boards on Blackfin eval boards"
61 depends on SND_BF5XX_I2S && I2C
62 select SND_BF5XX_SOC_I2S
63 select SND_SOC_ADAU1781_I2C
64 help
65 Say Y if you want to add support for the Analog Devices EVAL-ADAU1X81
66 board connected to one of the Blackfin evaluation boards like the
67 BF5XX-STAMP or BF5XX-EZKIT.
68
69 Note: This driver assumes that the ADAU1X81 is connected to the
70 first SPORT port on the BF5XX board.
71
59config SND_SOC_BFIN_EVAL_ADAV80X 72config SND_SOC_BFIN_EVAL_ADAV80X
60 tristate "Support for the EVAL-ADAV80X boards on Blackfin eval boards" 73 tristate "Support for the EVAL-ADAV80X boards on Blackfin eval boards"
61 depends on SND_BF5XX_I2S && SND_SOC_I2C_AND_SPI 74 depends on SND_BF5XX_I2S && SND_SOC_I2C_AND_SPI
diff --git a/sound/soc/blackfin/Makefile b/sound/soc/blackfin/Makefile
index 91eb0e7edff5..f21e948b2e9b 100644
--- a/sound/soc/blackfin/Makefile
+++ b/sound/soc/blackfin/Makefile
@@ -23,6 +23,7 @@ snd-ad73311-objs := bf5xx-ad73311.o
23snd-ad193x-objs := bf5xx-ad193x.o 23snd-ad193x-objs := bf5xx-ad193x.o
24snd-soc-bfin-eval-adau1373-objs := bfin-eval-adau1373.o 24snd-soc-bfin-eval-adau1373-objs := bfin-eval-adau1373.o
25snd-soc-bfin-eval-adau1x61-objs := bfin-eval-adau1x61.o 25snd-soc-bfin-eval-adau1x61-objs := bfin-eval-adau1x61.o
26snd-soc-bfin-eval-adau1x81-objs := bfin-eval-adau1x81.o
26snd-soc-bfin-eval-adau1701-objs := bfin-eval-adau1701.o 27snd-soc-bfin-eval-adau1701-objs := bfin-eval-adau1701.o
27snd-soc-bfin-eval-adav80x-objs := bfin-eval-adav80x.o 28snd-soc-bfin-eval-adav80x-objs := bfin-eval-adav80x.o
28 29
@@ -33,5 +34,6 @@ obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o
33obj-$(CONFIG_SND_BF5XX_SOC_AD193X) += snd-ad193x.o 34obj-$(CONFIG_SND_BF5XX_SOC_AD193X) += snd-ad193x.o
34obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1373) += snd-soc-bfin-eval-adau1373.o 35obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1373) += snd-soc-bfin-eval-adau1373.o
35obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) += snd-soc-bfin-eval-adau1x61.o 36obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) += snd-soc-bfin-eval-adau1x61.o
37obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X81) += snd-soc-bfin-eval-adau1x81.o
36obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1701) += snd-soc-bfin-eval-adau1701.o 38obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1701) += snd-soc-bfin-eval-adau1701.o
37obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X) += snd-soc-bfin-eval-adav80x.o 39obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X) += snd-soc-bfin-eval-adav80x.o
diff --git a/sound/soc/blackfin/bfin-eval-adau1x81.c b/sound/soc/blackfin/bfin-eval-adau1x81.c
new file mode 100644
index 000000000000..5c380f6aed1a
--- /dev/null
+++ b/sound/soc/blackfin/bfin-eval-adau1x81.c
@@ -0,0 +1,130 @@
1/*
2 * Machine driver for EVAL-ADAU1x81 on Analog Devices bfin
3 * evaluation boards.
4 *
5 * Copyright 2011-2014 Analog Devices Inc.
6 * Author: Lars-Peter Clausen <lars@metafoo.de>
7 *
8 * Licensed under the GPL-2 or later.
9 */
10
11#include <linux/module.h>
12#include <linux/device.h>
13#include <linux/slab.h>
14#include <sound/core.h>
15#include <sound/pcm.h>
16#include <sound/soc.h>
17#include <sound/pcm_params.h>
18
19#include "../codecs/adau17x1.h"
20
21static const struct snd_soc_dapm_widget bfin_eval_adau1x81_dapm_widgets[] = {
22 SND_SOC_DAPM_LINE("Stereo In", NULL),
23 SND_SOC_DAPM_LINE("Beep", NULL),
24
25 SND_SOC_DAPM_SPK("Speaker", NULL),
26 SND_SOC_DAPM_HP("Headphone", NULL),
27};
28
29static const struct snd_soc_dapm_route bfin_eval_adau1x81_dapm_routes[] = {
30 { "BEEP", NULL, "Beep" },
31 { "LMIC", NULL, "Stereo In" },
32 { "LMIC", NULL, "Stereo In" },
33
34 { "Headphone", NULL, "AOUTL" },
35 { "Headphone", NULL, "AOUTR" },
36 { "Speaker", NULL, "SP" },
37};
38
39static int bfin_eval_adau1x81_hw_params(struct snd_pcm_substream *substream,
40 struct snd_pcm_hw_params *params)
41{
42 struct snd_soc_pcm_runtime *rtd = substream->private_data;
43 struct snd_soc_dai *codec_dai = rtd->codec_dai;
44 int pll_rate;
45 int ret;
46
47 switch (params_rate(params)) {
48 case 48000:
49 case 8000:
50 case 12000:
51 case 16000:
52 case 24000:
53 case 32000:
54 case 96000:
55 pll_rate = 48000 * 1024;
56 break;
57 case 44100:
58 case 7350:
59 case 11025:
60 case 14700:
61 case 22050:
62 case 29400:
63 case 88200:
64 pll_rate = 44100 * 1024;
65 break;
66 default:
67 return -EINVAL;
68 }
69
70 ret = snd_soc_dai_set_pll(codec_dai, ADAU17X1_PLL,
71 ADAU17X1_PLL_SRC_MCLK, 12288000, pll_rate);
72 if (ret)
73 return ret;
74
75 ret = snd_soc_dai_set_sysclk(codec_dai, ADAU17X1_CLK_SRC_PLL, pll_rate,
76 SND_SOC_CLOCK_IN);
77
78 return ret;
79}
80
81static const struct snd_soc_ops bfin_eval_adau1x81_ops = {
82 .hw_params = bfin_eval_adau1x81_hw_params,
83};
84
85static struct snd_soc_dai_link bfin_eval_adau1x81_dai = {
86 .name = "adau1x81",
87 .stream_name = "adau1x81",
88 .cpu_dai_name = "bfin-i2s.0",
89 .codec_dai_name = "adau-hifi",
90 .platform_name = "bfin-i2s-pcm-audio",
91 .codec_name = "adau1781.0-0038",
92 .ops = &bfin_eval_adau1x81_ops,
93 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
94 SND_SOC_DAIFMT_CBM_CFM,
95};
96
97static struct snd_soc_card bfin_eval_adau1x81 = {
98 .name = "bfin-eval-adau1x81",
99 .driver_name = "eval-adau1x81",
100 .dai_link = &bfin_eval_adau1x81_dai,
101 .num_links = 1,
102
103 .dapm_widgets = bfin_eval_adau1x81_dapm_widgets,
104 .num_dapm_widgets = ARRAY_SIZE(bfin_eval_adau1x81_dapm_widgets),
105 .dapm_routes = bfin_eval_adau1x81_dapm_routes,
106 .num_dapm_routes = ARRAY_SIZE(bfin_eval_adau1x81_dapm_routes),
107 .fully_routed = true,
108};
109
110static int bfin_eval_adau1x81_probe(struct platform_device *pdev)
111{
112 bfin_eval_adau1x81.dev = &pdev->dev;
113
114 return devm_snd_soc_register_card(&pdev->dev, &bfin_eval_adau1x81);
115}
116
117static struct platform_driver bfin_eval_adau1x81_driver = {
118 .driver = {
119 .name = "bfin-eval-adau1x81",
120 .owner = THIS_MODULE,
121 .pm = &snd_soc_pm_ops,
122 },
123 .probe = bfin_eval_adau1x81_probe,
124};
125module_platform_driver(bfin_eval_adau1x81_driver);
126
127MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
128MODULE_DESCRIPTION("ALSA SoC bfin adau1x81 driver");
129MODULE_LICENSE("GPL");
130MODULE_ALIAS("platform:bfin-eval-adau1x81");