diff options
Diffstat (limited to 'sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c')
-rw-r--r-- | sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c b/sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c new file mode 100644 index 000000000000..25797e096175 --- /dev/null +++ b/sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c | |||
@@ -0,0 +1,137 @@ | |||
1 | /* sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.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> | ||
17 | #include <sound/soc-dapm.h> | ||
18 | |||
19 | #include <plat/audio-simtec.h> | ||
20 | |||
21 | #include "s3c24xx-pcm.h" | ||
22 | #include "s3c24xx-i2s.h" | ||
23 | #include "s3c24xx_simtec.h" | ||
24 | |||
25 | #include "../codecs/tlv320aic23.h" | ||
26 | |||
27 | /* supported machines: | ||
28 | * | ||
29 | * Machine Connections AMP | ||
30 | * ------- ----------- --- | ||
31 | * BAST MIC, HPOUT, LOUT, LIN TPA2001D1 (HPOUTL,R) (gain hardwired) | ||
32 | * VR1000 HPOUT, LIN None | ||
33 | * VR2000 LIN, LOUT, MIC, HP LM4871 (HPOUTL,R) | ||
34 | * DePicture LIN, LOUT, MIC, HP LM4871 (HPOUTL,R) | ||
35 | * Anubis LIN, LOUT, MIC, HP TPA2001D1 (HPOUTL,R) | ||
36 | */ | ||
37 | |||
38 | static const struct snd_soc_dapm_widget dapm_widgets[] = { | ||
39 | SND_SOC_DAPM_HP("Headphone Jack", NULL), | ||
40 | SND_SOC_DAPM_LINE("Line In", NULL), | ||
41 | SND_SOC_DAPM_LINE("Line Out", NULL), | ||
42 | SND_SOC_DAPM_MIC("Mic Jack", NULL), | ||
43 | }; | ||
44 | |||
45 | static const struct snd_soc_dapm_route base_map[] = { | ||
46 | { "Headphone Jack", NULL, "LHPOUT"}, | ||
47 | { "Headphone Jack", NULL, "RHPOUT"}, | ||
48 | |||
49 | { "Line Out", NULL, "LOUT" }, | ||
50 | { "Line Out", NULL, "ROUT" }, | ||
51 | |||
52 | { "LLINEIN", NULL, "Line In"}, | ||
53 | { "RLINEIN", NULL, "Line In"}, | ||
54 | |||
55 | { "MICIN", NULL, "Mic Jack"}, | ||
56 | }; | ||
57 | |||
58 | /** | ||
59 | * simtec_tlv320aic23_init - initialise and add controls | ||
60 | * @codec; The codec instance to attach to. | ||
61 | * | ||
62 | * Attach our controls and configure the necessary codec | ||
63 | * mappings for our sound card instance. | ||
64 | */ | ||
65 | static int simtec_tlv320aic23_init(struct snd_soc_codec *codec) | ||
66 | { | ||
67 | snd_soc_dapm_new_controls(codec, dapm_widgets, | ||
68 | ARRAY_SIZE(dapm_widgets)); | ||
69 | |||
70 | snd_soc_dapm_add_routes(codec, base_map, ARRAY_SIZE(base_map)); | ||
71 | |||
72 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | ||
73 | snd_soc_dapm_enable_pin(codec, "Line In"); | ||
74 | snd_soc_dapm_enable_pin(codec, "Line Out"); | ||
75 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | ||
76 | |||
77 | simtec_audio_init(codec); | ||
78 | snd_soc_dapm_sync(codec); | ||
79 | |||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static struct snd_soc_dai_link simtec_dai_aic23 = { | ||
84 | .name = "tlv320aic23", | ||
85 | .stream_name = "TLV320AIC23", | ||
86 | .cpu_dai = &s3c24xx_i2s_dai, | ||
87 | .codec_dai = &tlv320aic23_dai, | ||
88 | .init = simtec_tlv320aic23_init, | ||
89 | }; | ||
90 | |||
91 | /* simtec audio machine driver */ | ||
92 | static struct snd_soc_card snd_soc_machine_simtec_aic23 = { | ||
93 | .name = "Simtec", | ||
94 | .platform = &s3c24xx_soc_platform, | ||
95 | .dai_link = &simtec_dai_aic23, | ||
96 | .num_links = 1, | ||
97 | }; | ||
98 | |||
99 | /* simtec audio subsystem */ | ||
100 | static struct snd_soc_device simtec_snd_devdata_aic23 = { | ||
101 | .card = &snd_soc_machine_simtec_aic23, | ||
102 | .codec_dev = &soc_codec_dev_tlv320aic23, | ||
103 | }; | ||
104 | |||
105 | static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd) | ||
106 | { | ||
107 | return simtec_audio_core_probe(pd, &simtec_snd_devdata_aic23); | ||
108 | } | ||
109 | |||
110 | static struct platform_driver simtec_audio_tlv320aic23_platdrv = { | ||
111 | .driver = { | ||
112 | .owner = THIS_MODULE, | ||
113 | .name = "s3c24xx-simtec-tlv320aic23", | ||
114 | .pm = simtec_audio_pm, | ||
115 | }, | ||
116 | .probe = simtec_audio_tlv320aic23_probe, | ||
117 | .remove = __devexit_p(simtec_audio_remove), | ||
118 | }; | ||
119 | |||
120 | MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23"); | ||
121 | |||
122 | static int __init simtec_tlv320aic23_modinit(void) | ||
123 | { | ||
124 | return platform_driver_register(&simtec_audio_tlv320aic23_platdrv); | ||
125 | } | ||
126 | |||
127 | static void __exit simtec_tlv320aic23_modexit(void) | ||
128 | { | ||
129 | platform_driver_unregister(&simtec_audio_tlv320aic23_platdrv); | ||
130 | } | ||
131 | |||
132 | module_init(simtec_tlv320aic23_modinit); | ||
133 | module_exit(simtec_tlv320aic23_modexit); | ||
134 | |||
135 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | ||
136 | MODULE_DESCRIPTION("ALSA SoC Simtec Audio support"); | ||
137 | MODULE_LICENSE("GPL"); | ||