aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/blackfin
diff options
context:
space:
mode:
authorBarry Song <21cnbao@gmail.com>2009-09-01 00:45:14 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-09-01 06:36:13 -0400
commitdce944dbb2d0046628bcdba882e8edc2c1d93200 (patch)
tree967293efe44fe832646f59eebe9c5bc08b243ebb /sound/soc/blackfin
parentd2c0bdaa9362c4b2ab7416420d034a0a2d1ec979 (diff)
ASoC: new board driver to connect bfin-5xx with ad1836 codec
As discussed, the patch uses the original TDM order without rewriting. For the match between TDM slot number and audio channel number, a new API need be added. Signed-off-by: Barry Song <21cnbao@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/blackfin')
-rw-r--r--sound/soc/blackfin/Kconfig8
-rw-r--r--sound/soc/blackfin/Makefile2
-rw-r--r--sound/soc/blackfin/bf5xx-ad1836.c128
3 files changed, 138 insertions, 0 deletions
diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig
index 8a4de4de30f2..ac927ffdc961 100644
--- a/sound/soc/blackfin/Kconfig
+++ b/sound/soc/blackfin/Kconfig
@@ -88,6 +88,14 @@ config SND_BF5XX_SOC_AC97
88 select SND_SOC_AC97_BUS 88 select SND_SOC_AC97_BUS
89 select SND_BF5XX_SOC_SPORT 89 select SND_BF5XX_SOC_SPORT
90 90
91config SND_BF5XX_SOC_AD1836
92 tristate "SoC AD1836 Audio support for BF5xx"
93 depends on SND_BF5XX_TDM
94 select SND_BF5XX_SOC_TDM
95 select SND_SOC_AD1836
96 help
97 Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT.
98
91config SND_BF5XX_SOC_AD1980 99config SND_BF5XX_SOC_AD1980
92 tristate "SoC AD1980/1 Audio support for BF5xx" 100 tristate "SoC AD1980/1 Audio support for BF5xx"
93 depends on SND_BF5XX_AC97 101 depends on SND_BF5XX_AC97
diff --git a/sound/soc/blackfin/Makefile b/sound/soc/blackfin/Makefile
index f4d760741fab..87e30423912f 100644
--- a/sound/soc/blackfin/Makefile
+++ b/sound/soc/blackfin/Makefile
@@ -16,11 +16,13 @@ obj-$(CONFIG_SND_BF5XX_SOC_I2S) += snd-soc-bf5xx-i2s.o
16obj-$(CONFIG_SND_BF5XX_SOC_TDM) += snd-soc-bf5xx-tdm.o 16obj-$(CONFIG_SND_BF5XX_SOC_TDM) += snd-soc-bf5xx-tdm.o
17 17
18# Blackfin Machine Support 18# Blackfin Machine Support
19snd-ad1836-objs := bf5xx-ad1836.o
19snd-ad1980-objs := bf5xx-ad1980.o 20snd-ad1980-objs := bf5xx-ad1980.o
20snd-ssm2602-objs := bf5xx-ssm2602.o 21snd-ssm2602-objs := bf5xx-ssm2602.o
21snd-ad73311-objs := bf5xx-ad73311.o 22snd-ad73311-objs := bf5xx-ad73311.o
22snd-ad1938-objs := bf5xx-ad1938.o 23snd-ad1938-objs := bf5xx-ad1938.o
23 24
25obj-$(CONFIG_SND_BF5XX_SOC_AD1836) += snd-ad1836.o
24obj-$(CONFIG_SND_BF5XX_SOC_AD1980) += snd-ad1980.o 26obj-$(CONFIG_SND_BF5XX_SOC_AD1980) += snd-ad1980.o
25obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o 27obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o
26obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o 28obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o
diff --git a/sound/soc/blackfin/bf5xx-ad1836.c b/sound/soc/blackfin/bf5xx-ad1836.c
new file mode 100644
index 000000000000..cd361e304b0f
--- /dev/null
+++ b/sound/soc/blackfin/bf5xx-ad1836.c
@@ -0,0 +1,128 @@
1/*
2 * File: sound/soc/blackfin/bf5xx-ad1836.c
3 * Author: Barry Song <Barry.Song@analog.com>
4 *
5 * Created: Aug 4 2009
6 * Description: Board driver for ad1836 sound chip
7 *
8 * Bugs: Enter bugs at http://blackfin.uclinux.org/
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 */
16
17#include <linux/module.h>
18#include <linux/moduleparam.h>
19#include <linux/device.h>
20#include <sound/core.h>
21#include <sound/pcm.h>
22#include <sound/soc.h>
23#include <sound/soc-dapm.h>
24#include <sound/pcm_params.h>
25
26#include <asm/blackfin.h>
27#include <asm/cacheflush.h>
28#include <asm/irq.h>
29#include <asm/dma.h>
30#include <asm/portmux.h>
31
32#include "../codecs/ad1836.h"
33#include "bf5xx-sport.h"
34
35#include "bf5xx-tdm-pcm.h"
36#include "bf5xx-tdm.h"
37
38static struct snd_soc_card bf5xx_ad1836;
39
40static int bf5xx_ad1836_startup(struct snd_pcm_substream *substream)
41{
42 struct snd_soc_pcm_runtime *rtd = substream->private_data;
43 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
44
45 cpu_dai->private_data = sport_handle;
46 return 0;
47}
48
49static int bf5xx_ad1836_hw_params(struct snd_pcm_substream *substream,
50 struct snd_pcm_hw_params *params)
51{
52 struct snd_soc_pcm_runtime *rtd = substream->private_data;
53 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
54 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
55 int ret = 0;
56 /* set cpu DAI configuration */
57 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_A |
58 SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
59 if (ret < 0)
60 return ret;
61
62 /* set codec DAI configuration */
63 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |
64 SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
65 if (ret < 0)
66 return ret;
67
68 return 0;
69}
70
71static struct snd_soc_ops bf5xx_ad1836_ops = {
72 .startup = bf5xx_ad1836_startup,
73 .hw_params = bf5xx_ad1836_hw_params,
74};
75
76static struct snd_soc_dai_link bf5xx_ad1836_dai = {
77 .name = "ad1836",
78 .stream_name = "AD1836",
79 .cpu_dai = &bf5xx_tdm_dai,
80 .codec_dai = &ad1836_dai,
81 .ops = &bf5xx_ad1836_ops,
82};
83
84static struct snd_soc_card bf5xx_ad1836 = {
85 .name = "bf5xx_ad1836",
86 .platform = &bf5xx_tdm_soc_platform,
87 .dai_link = &bf5xx_ad1836_dai,
88 .num_links = 1,
89};
90
91static struct snd_soc_device bf5xx_ad1836_snd_devdata = {
92 .card = &bf5xx_ad1836,
93 .codec_dev = &soc_codec_dev_ad1836,
94};
95
96static struct platform_device *bfxx_ad1836_snd_device;
97
98static int __init bf5xx_ad1836_init(void)
99{
100 int ret;
101
102 bfxx_ad1836_snd_device = platform_device_alloc("soc-audio", -1);
103 if (!bfxx_ad1836_snd_device)
104 return -ENOMEM;
105
106 platform_set_drvdata(bfxx_ad1836_snd_device, &bf5xx_ad1836_snd_devdata);
107 bf5xx_ad1836_snd_devdata.dev = &bfxx_ad1836_snd_device->dev;
108 ret = platform_device_add(bfxx_ad1836_snd_device);
109
110 if (ret)
111 platform_device_put(bfxx_ad1836_snd_device);
112
113 return ret;
114}
115
116static void __exit bf5xx_ad1836_exit(void)
117{
118 platform_device_unregister(bfxx_ad1836_snd_device);
119}
120
121module_init(bf5xx_ad1836_init);
122module_exit(bf5xx_ad1836_exit);
123
124/* Module information */
125MODULE_AUTHOR("Barry Song");
126MODULE_DESCRIPTION("ALSA SoC AD1836 board driver");
127MODULE_LICENSE("GPL");
128