ASoC: Samsung: Rename DMA device
[deliverable/linux.git] / sound / soc / s3c24xx / s3c24xx_simtec_hermes.c
CommitLineData
b2ec22e2
BD
1/* sound/soc/s3c24xx/s3c24xx_simtec_hermes.c
2 *
3 * Copyright 2009 Simtec Electronics
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8*/
9
10#include <linux/module.h>
11#include <linux/clk.h>
12#include <linux/platform_device.h>
13
14#include <sound/core.h>
15#include <sound/pcm.h>
16#include <sound/soc.h>
b2ec22e2
BD
17
18#include <plat/audio-simtec.h>
19
d3ff5a3e 20#include "s3c-dma.h"
b2ec22e2
BD
21#include "s3c24xx-i2s.h"
22#include "s3c24xx_simtec.h"
23
24#include "../codecs/tlv320aic3x.h"
25
26static const struct snd_soc_dapm_widget dapm_widgets[] = {
27 SND_SOC_DAPM_LINE("GSM Out", NULL),
28 SND_SOC_DAPM_LINE("GSM In", NULL),
29 SND_SOC_DAPM_LINE("Line In", NULL),
30 SND_SOC_DAPM_LINE("Line Out", NULL),
31 SND_SOC_DAPM_LINE("ZV", NULL),
32 SND_SOC_DAPM_MIC("Mic Jack", NULL),
33 SND_SOC_DAPM_HP("Headphone Jack", NULL),
34};
35
36static const struct snd_soc_dapm_route base_map[] = {
37 /* Headphone connected to HP{L,R}OUT and HP{L,R}COM */
38
39 { "Headphone Jack", NULL, "HPLOUT" },
40 { "Headphone Jack", NULL, "HPLCOM" },
41 { "Headphone Jack", NULL, "HPROUT" },
42 { "Headphone Jack", NULL, "HPRCOM" },
43
44 /* ZV connected to Line1 */
45
46 { "LINE1L", NULL, "ZV" },
47 { "LINE1R", NULL, "ZV" },
48
49 /* Line In connected to Line2 */
50
51 { "LINE2L", NULL, "Line In" },
52 { "LINE2R", NULL, "Line In" },
53
54 /* Microphone connected to MIC3R and MIC_BIAS */
55
56 { "MIC3L", NULL, "Mic Jack" },
57
58 /* GSM connected to MONO_LOUT and MIC3L (in) */
59
60 { "GSM Out", NULL, "MONO_LOUT" },
61 { "MIC3L", NULL, "GSM In" },
62
63 /* Speaker is connected to LINEOUT{LN,LP,RN,RP}, however we are
64 * not using the DAPM to power it up and down as there it makes
65 * a click when powering up. */
66};
67
68/**
69 * simtec_hermes_init - initialise and add controls
70 * @codec; The codec instance to attach to.
71 *
72 * Attach our controls and configure the necessary codec
73 * mappings for our sound card instance.
74*/
f0fba2ad 75static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd)
b2ec22e2 76{
f0fba2ad 77 struct snd_soc_codec *codec = rtd->codec;
ce6120cc 78 struct snd_soc_dapm_context *dapm = &codec->dapm;
f0fba2ad 79
ce6120cc 80 snd_soc_dapm_new_controls(dapm, dapm_widgets,
b2ec22e2
BD
81 ARRAY_SIZE(dapm_widgets));
82
ce6120cc 83 snd_soc_dapm_add_routes(dapm, base_map, ARRAY_SIZE(base_map));
b2ec22e2 84
ce6120cc
LG
85 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
86 snd_soc_dapm_enable_pin(dapm, "Line In");
87 snd_soc_dapm_enable_pin(dapm, "Line Out");
88 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
b2ec22e2 89
f0fba2ad 90 simtec_audio_init(rtd);
ce6120cc 91 snd_soc_dapm_sync(dapm);
b2ec22e2
BD
92
93 return 0;
94}
95
b2ec22e2
BD
96static struct snd_soc_dai_link simtec_dai_aic33 = {
97 .name = "tlv320aic33",
98 .stream_name = "TLV320AIC33",
f0fba2ad
LG
99 .codec_name = "tlv320aic3x-codec.0-0x1a",
100 .cpu_dai_name = "s3c24xx-i2s",
101 .codec_dai_name = "tlv320aic3x-hifi",
58bb4072 102 .platform_name = "samsung-audio",
b2ec22e2
BD
103 .init = simtec_hermes_init,
104};
105
106/* simtec audio machine driver */
107static struct snd_soc_card snd_soc_machine_simtec_aic33 = {
108 .name = "Simtec-Hermes",
b2ec22e2
BD
109 .dai_link = &simtec_dai_aic33,
110 .num_links = 1,
111};
112
b2ec22e2
BD
113static int __devinit simtec_audio_hermes_probe(struct platform_device *pd)
114{
115 dev_info(&pd->dev, "probing....\n");
f0fba2ad 116 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33);
b2ec22e2
BD
117}
118
119static struct platform_driver simtec_audio_hermes_platdrv = {
120 .driver = {
121 .owner = THIS_MODULE,
122 .name = "s3c24xx-simtec-hermes-snd",
123 .pm = simtec_audio_pm,
124 },
125 .probe = simtec_audio_hermes_probe,
126 .remove = __devexit_p(simtec_audio_remove),
127};
128
129MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd");
130
131static int __init simtec_hermes_modinit(void)
132{
133 return platform_driver_register(&simtec_audio_hermes_platdrv);
134}
135
136static void __exit simtec_hermes_modexit(void)
137{
138 platform_driver_unregister(&simtec_audio_hermes_platdrv);
139}
140
141module_init(simtec_hermes_modinit);
142module_exit(simtec_hermes_modexit);
143
144MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
145MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
146MODULE_LICENSE("GPL");
This page took 0.08005 seconds and 5 git commands to generate.