aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/omap/Kconfig8
-rw-r--r--sound/soc/omap/Makefile2
-rw-r--r--sound/soc/omap/omap3evm.c147
3 files changed, 157 insertions, 0 deletions
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 675732e724d5..b771238662b6 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -39,6 +39,14 @@ config SND_OMAP_SOC_OMAP2EVM
39 help 39 help
40 Say Y if you want to add support for SoC audio on the omap2evm board. 40 Say Y if you want to add support for SoC audio on the omap2evm board.
41 41
42config SND_OMAP_SOC_OMAP3EVM
43 tristate "SoC Audio support for OMAP3EVM board"
44 depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3EVM
45 select SND_OMAP_SOC_MCBSP
46 select SND_SOC_TWL4030
47 help
48 Say Y if you want to add support for SoC audio on the omap3evm board.
49
42config SND_OMAP_SOC_SDP3430 50config SND_OMAP_SOC_SDP3430
43 tristate "SoC Audio support for Texas Instruments SDP3430" 51 tristate "SoC Audio support for Texas Instruments SDP3430"
44 depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_3430SDP 52 depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_3430SDP
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 0c9e4ac37660..a37f49862389 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -10,6 +10,7 @@ snd-soc-n810-objs := n810.o
10snd-soc-osk5912-objs := osk5912.o 10snd-soc-osk5912-objs := osk5912.o
11snd-soc-overo-objs := overo.o 11snd-soc-overo-objs := overo.o
12snd-soc-omap2evm-objs := omap2evm.o 12snd-soc-omap2evm-objs := omap2evm.o
13snd-soc-omap3evm-objs := omap3evm.o
13snd-soc-sdp3430-objs := sdp3430.o 14snd-soc-sdp3430-objs := sdp3430.o
14snd-soc-omap3pandora-objs := omap3pandora.o 15snd-soc-omap3pandora-objs := omap3pandora.o
15snd-soc-omap3beagle-objs := omap3beagle.o 16snd-soc-omap3beagle-objs := omap3beagle.o
@@ -18,6 +19,7 @@ obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
18obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o 19obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
19obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o 20obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
20obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o 21obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o
22obj-$(CONFIG_MACH_OMAP3EVM) += snd-soc-omap3evm.o
21obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o 23obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
22obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o 24obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
23obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o 25obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
new file mode 100644
index 000000000000..9114c263077b
--- /dev/null
+++ b/sound/soc/omap/omap3evm.c
@@ -0,0 +1,147 @@
1/*
2 * omap3evm.c -- ALSA SoC support for OMAP3 EVM
3 *
4 * Author: Anuj Aggarwal <anuj.aggarwal@ti.com>
5 *
6 * Based on sound/soc/omap/beagle.c by Steve Sakoman
7 *
8 * Copyright (C) 2008 Texas Instruments, Incorporated
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation version 2.
13 *
14 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
15 * whether express or implied; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 */
19
20#include <linux/clk.h>
21#include <linux/platform_device.h>
22#include <sound/core.h>
23#include <sound/pcm.h>
24#include <sound/soc.h>
25#include <sound/soc-dapm.h>
26
27#include <asm/mach-types.h>
28#include <mach/hardware.h>
29#include <mach/gpio.h>
30#include <mach/mcbsp.h>
31
32#include "omap-mcbsp.h"
33#include "omap-pcm.h"
34#include "../codecs/twl4030.h"
35
36static int omap3evm_hw_params(struct snd_pcm_substream *substream,
37 struct snd_pcm_hw_params *params)
38{
39 struct snd_soc_pcm_runtime *rtd = substream->private_data;
40 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
41 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
42 int ret;
43
44 /* Set codec DAI configuration */
45 ret = snd_soc_dai_set_fmt(codec_dai,
46 SND_SOC_DAIFMT_I2S |
47 SND_SOC_DAIFMT_NB_NF |
48 SND_SOC_DAIFMT_CBM_CFM);
49 if (ret < 0) {
50 printk(KERN_ERR "Can't set codec DAI configuration\n");
51 return ret;
52 }
53
54 /* Set cpu DAI configuration */
55 ret = snd_soc_dai_set_fmt(cpu_dai,
56 SND_SOC_DAIFMT_I2S |
57 SND_SOC_DAIFMT_NB_NF |
58 SND_SOC_DAIFMT_CBM_CFM);
59 if (ret < 0) {
60 printk(KERN_ERR "Can't set cpu DAI configuration\n");
61 return ret;
62 }
63
64 /* Set the codec system clock for DAC and ADC */
65 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
66 SND_SOC_CLOCK_IN);
67 if (ret < 0) {
68 printk(KERN_ERR "Can't set codec system clock\n");
69 return ret;
70 }
71
72 return 0;
73}
74
75static struct snd_soc_ops omap3evm_ops = {
76 .hw_params = omap3evm_hw_params,
77};
78
79/* Digital audio interface glue - connects codec <--> CPU */
80static struct snd_soc_dai_link omap3evm_dai = {
81 .name = "TWL4030",
82 .stream_name = "TWL4030",
83 .cpu_dai = &omap_mcbsp_dai[0],
84 .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI],
85 .ops = &omap3evm_ops,
86};
87
88/* Audio machine driver */
89static struct snd_soc_card snd_soc_omap3evm = {
90 .name = "omap3evm",
91 .platform = &omap_soc_platform,
92 .dai_link = &omap3evm_dai,
93 .num_links = 1,
94};
95
96/* Audio subsystem */
97static struct snd_soc_device omap3evm_snd_devdata = {
98 .card = &snd_soc_omap3evm,
99 .codec_dev = &soc_codec_dev_twl4030,
100};
101
102static struct platform_device *omap3evm_snd_device;
103
104static int __init omap3evm_soc_init(void)
105{
106 int ret;
107
108 if (!machine_is_omap3evm()) {
109 pr_err("Not OMAP3 EVM!\n");
110 return -ENODEV;
111 }
112 pr_info("OMAP3 EVM SoC init\n");
113
114 omap3evm_snd_device = platform_device_alloc("soc-audio", -1);
115 if (!omap3evm_snd_device) {
116 printk(KERN_ERR "Platform device allocation failed\n");
117 return -ENOMEM;
118 }
119
120 platform_set_drvdata(omap3evm_snd_device, &omap3evm_snd_devdata);
121 omap3evm_snd_devdata.dev = &omap3evm_snd_device->dev;
122 *(unsigned int *)omap3evm_dai.cpu_dai->private_data = 1;
123
124 ret = platform_device_add(omap3evm_snd_device);
125 if (ret)
126 goto err1;
127
128 return 0;
129
130err1:
131 printk(KERN_ERR "Unable to add platform device\n");
132 platform_device_put(omap3evm_snd_device);
133
134 return ret;
135}
136
137static void __exit omap3evm_soc_exit(void)
138{
139 platform_device_unregister(omap3evm_snd_device);
140}
141
142module_init(omap3evm_soc_init);
143module_exit(omap3evm_soc_exit);
144
145MODULE_AUTHOR("Anuj Aggarwal <anuj.aggarwal@ti.com>");
146MODULE_DESCRIPTION("ALSA SoC OMAP3 EVM");
147MODULE_LICENSE("GPLv2");