aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorMisael Lopez Cruz <mesak82@gmail.com>2008-11-24 23:21:23 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2008-11-25 10:28:57 -0500
commit4451582f7e9fc2860b289aca60a6065286439bb8 (patch)
tree0b67367830713f1180a6ad1d5177bc15328bc1c2 /sound/soc
parent9c8f1a0e6ed48f2ecf08ac0fb7fb043f8c34dc63 (diff)
ASoC: Add support for TI SDP3430
This patch add ASoC support for TI SDP3430. It's based on Gumstix Overo SoC code by Steve Sakoman. Signed-off-by: Misael Lopez Cruz <mesak82@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/omap/Kconfig7
-rw-r--r--sound/soc/omap/Makefile3
-rw-r--r--sound/soc/omap/sdp3430.c152
3 files changed, 161 insertions, 1 deletions
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 090043702e80..1cd0176811c5 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -38,5 +38,12 @@ config SND_OMAP_SOC_OMAP2EVM
38 help 38 help
39 Say Y if you want to add support for SoC audio on the omap2evm board. 39 Say Y if you want to add support for SoC audio on the omap2evm board.
40 40
41config SND_OMAP_SOC_SDP3430
42 tristate "SoC Audio support for Texas Instruments SDP3430"
43 depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_3430SDP
44 select SND_OMAP_SOC_MCBSP
45 select SND_SOC_TWL4030
46 help
47 Say Y if you want to add support for SoC audio on Texas Instruments SDP3430.
41 48
42 49
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index f5da3cc764ae..29cf3a856c89 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -10,9 +10,10 @@ 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-sdp3430-objs := sdp3430.o
13 14
14obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o 15obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
15obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o 16obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
16obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o 17obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
17obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o 18obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o
18 19obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
new file mode 100644
index 000000000000..85fd160bca17
--- /dev/null
+++ b/sound/soc/omap/sdp3430.c
@@ -0,0 +1,152 @@
1/*
2 * sdp3430.c -- SoC audio for TI OMAP3430 SDP
3 *
4 * Author: Misael Lopez Cruz <x0052729@ti.com>
5 *
6 * Based on:
7 * Author: Steve Sakoman <steve@sakoman.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25#include <linux/clk.h>
26#include <linux/platform_device.h>
27#include <sound/core.h>
28#include <sound/pcm.h>
29#include <sound/soc.h>
30#include <sound/soc-dapm.h>
31
32#include <asm/mach-types.h>
33#include <mach/hardware.h>
34#include <mach/gpio.h>
35#include <mach/mcbsp.h>
36
37#include "omap-mcbsp.h"
38#include "omap-pcm.h"
39#include "../codecs/twl4030.h"
40
41static int sdp3430_hw_params(struct snd_pcm_substream *substream,
42 struct snd_pcm_hw_params *params)
43{
44 struct snd_soc_pcm_runtime *rtd = substream->private_data;
45 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
46 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
47 int ret;
48
49 /* Set codec DAI configuration */
50 ret = snd_soc_dai_set_fmt(codec_dai,
51 SND_SOC_DAIFMT_I2S |
52 SND_SOC_DAIFMT_NB_NF |
53 SND_SOC_DAIFMT_CBM_CFM);
54 if (ret < 0) {
55 printk(KERN_ERR "can't set codec DAI configuration\n");
56 return ret;
57 }
58
59 /* Set cpu DAI configuration */
60 ret = snd_soc_dai_set_fmt(cpu_dai,
61 SND_SOC_DAIFMT_I2S |
62 SND_SOC_DAIFMT_NB_NF |
63 SND_SOC_DAIFMT_CBM_CFM);
64 if (ret < 0) {
65 printk(KERN_ERR "can't set cpu DAI configuration\n");
66 return ret;
67 }
68
69 /* Set the codec system clock for DAC and ADC */
70 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
71 SND_SOC_CLOCK_IN);
72 if (ret < 0) {
73 printk(KERN_ERR "can't set codec system clock\n");
74 return ret;
75 }
76
77 return 0;
78}
79
80static struct snd_soc_ops sdp3430_ops = {
81 .hw_params = sdp3430_hw_params,
82};
83
84/* Digital audio interface glue - connects codec <--> CPU */
85static struct snd_soc_dai_link sdp3430_dai = {
86 .name = "TWL4030",
87 .stream_name = "TWL4030",
88 .cpu_dai = &omap_mcbsp_dai[0],
89 .codec_dai = &twl4030_dai,
90 .ops = &sdp3430_ops,
91};
92
93/* Audio machine driver */
94static struct snd_soc_machine snd_soc_machine_sdp3430 = {
95 .name = "SDP3430",
96 .dai_link = &sdp3430_dai,
97 .num_links = 1,
98};
99
100/* Audio subsystem */
101static struct snd_soc_device sdp3430_snd_devdata = {
102 .machine = &snd_soc_machine_sdp3430,
103 .platform = &omap_soc_platform,
104 .codec_dev = &soc_codec_dev_twl4030,
105};
106
107static struct platform_device *sdp3430_snd_device;
108
109static int __init sdp3430_soc_init(void)
110{
111 int ret;
112
113 if (!machine_is_omap_3430sdp()) {
114 pr_debug("Not SDP3430!\n");
115 return -ENODEV;
116 }
117 printk(KERN_INFO "SDP3430 SoC init\n");
118
119 sdp3430_snd_device = platform_device_alloc("soc-audio", -1);
120 if (!sdp3430_snd_device) {
121 printk(KERN_ERR "Platform device allocation failed\n");
122 return -ENOMEM;
123 }
124
125 platform_set_drvdata(sdp3430_snd_device, &sdp3430_snd_devdata);
126 sdp3430_snd_devdata.dev = &sdp3430_snd_device->dev;
127 *(unsigned int *)sdp3430_dai.cpu_dai->private_data = 1; /* McBSP2 */
128
129 ret = platform_device_add(sdp3430_snd_device);
130 if (ret)
131 goto err1;
132
133 return 0;
134
135err1:
136 printk(KERN_ERR "Unable to add platform device\n");
137 platform_device_put(sdp3430_snd_device);
138
139 return ret;
140}
141module_init(sdp3430_soc_init);
142
143static void __exit sdp3430_soc_exit(void)
144{
145 platform_device_unregister(sdp3430_snd_device);
146}
147module_exit(sdp3430_soc_exit);
148
149MODULE_AUTHOR("Misael Lopez Cruz <x0052729@ti.com>");
150MODULE_DESCRIPTION("ALSA SoC SDP3430");
151MODULE_LICENSE("GPL");
152