2 * omap3evm.c -- ALSA SoC support for OMAP3 EVM
4 * Author: Anuj Aggarwal <anuj.aggarwal@ti.com>
6 * Based on sound/soc/omap/beagle.c by Steve Sakoman
8 * Copyright (C) 2008 Texas Instruments, Incorporated
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.
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.
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>
26 #include <asm/mach-types.h>
27 #include <mach/hardware.h>
28 #include <mach/gpio.h>
29 #include <plat/mcbsp.h>
31 #include "omap-mcbsp.h"
34 static int omap3evm_hw_params(struct snd_pcm_substream
*substream
,
35 struct snd_pcm_hw_params
*params
)
37 struct snd_soc_pcm_runtime
*rtd
= substream
->private_data
;
38 struct snd_soc_dai
*codec_dai
= rtd
->codec_dai
;
41 /* Set the codec system clock for DAC and ADC */
42 ret
= snd_soc_dai_set_sysclk(codec_dai
, 0, 26000000,
45 printk(KERN_ERR
"Can't set codec system clock\n");
52 static struct snd_soc_ops omap3evm_ops
= {
53 .hw_params
= omap3evm_hw_params
,
56 /* Digital audio interface glue - connects codec <--> CPU */
57 static struct snd_soc_dai_link omap3evm_dai
= {
59 .stream_name
= "TWL4030",
60 .cpu_dai_name
= "omap-mcbsp-dai.1",
61 .codec_dai_name
= "twl4030-hifi",
62 .platform_name
= "omap-pcm-audio",
63 .codec_name
= "twl4030-codec",
64 .dai_fmt
= SND_SOC_DAIFMT_I2S
| SND_SOC_DAIFMT_NB_NF
|
65 SND_SOC_DAIFMT_CBM_CFM
,
69 /* Audio machine driver */
70 static struct snd_soc_card snd_soc_omap3evm
= {
72 .dai_link
= &omap3evm_dai
,
76 static struct platform_device
*omap3evm_snd_device
;
78 static int __init
omap3evm_soc_init(void)
82 if (!machine_is_omap3evm())
84 pr_info("OMAP3 EVM SoC init\n");
86 omap3evm_snd_device
= platform_device_alloc("soc-audio", -1);
87 if (!omap3evm_snd_device
) {
88 printk(KERN_ERR
"Platform device allocation failed\n");
92 platform_set_drvdata(omap3evm_snd_device
, &snd_soc_omap3evm
);
93 ret
= platform_device_add(omap3evm_snd_device
);
100 printk(KERN_ERR
"Unable to add platform device\n");
101 platform_device_put(omap3evm_snd_device
);
106 static void __exit
omap3evm_soc_exit(void)
108 platform_device_unregister(omap3evm_snd_device
);
111 module_init(omap3evm_soc_init
);
112 module_exit(omap3evm_soc_exit
);
114 MODULE_AUTHOR("Anuj Aggarwal <anuj.aggarwal@ti.com>");
115 MODULE_DESCRIPTION("ALSA SoC OMAP3 EVM");
116 MODULE_LICENSE("GPL v2");