ASoC: 88pm860x-codec - reset the codec correctly
[deliverable/linux.git] / sound / soc / samsung / s3c24xx_simtec_tlv320aic23.c
CommitLineData
5033f43c 1/* sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c
14412acd
BD
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
14412acd 10#include <sound/soc.h>
14412acd 11
14412acd
BD
12#include "s3c24xx_simtec.h"
13
14412acd
BD
14/* supported machines:
15 *
16 * Machine Connections AMP
17 * ------- ----------- ---
18 * BAST MIC, HPOUT, LOUT, LIN TPA2001D1 (HPOUTL,R) (gain hardwired)
19 * VR1000 HPOUT, LIN None
20 * VR2000 LIN, LOUT, MIC, HP LM4871 (HPOUTL,R)
21 * DePicture LIN, LOUT, MIC, HP LM4871 (HPOUTL,R)
22 * Anubis LIN, LOUT, MIC, HP TPA2001D1 (HPOUTL,R)
23 */
24
25static const struct snd_soc_dapm_widget dapm_widgets[] = {
26 SND_SOC_DAPM_HP("Headphone Jack", NULL),
27 SND_SOC_DAPM_LINE("Line In", NULL),
28 SND_SOC_DAPM_LINE("Line Out", NULL),
29 SND_SOC_DAPM_MIC("Mic Jack", NULL),
30};
31
32static const struct snd_soc_dapm_route base_map[] = {
33 { "Headphone Jack", NULL, "LHPOUT"},
34 { "Headphone Jack", NULL, "RHPOUT"},
35
36 { "Line Out", NULL, "LOUT" },
37 { "Line Out", NULL, "ROUT" },
38
39 { "LLINEIN", NULL, "Line In"},
40 { "RLINEIN", NULL, "Line In"},
41
42 { "MICIN", NULL, "Mic Jack"},
43};
44
45/**
46 * simtec_tlv320aic23_init - initialise and add controls
47 * @codec; The codec instance to attach to.
48 *
49 * Attach our controls and configure the necessary codec
50 * mappings for our sound card instance.
51*/
f0fba2ad 52static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
14412acd 53{
f0fba2ad 54 struct snd_soc_codec *codec = rtd->codec;
ce6120cc 55 struct snd_soc_dapm_context *dapm = &codec->dapm;
f0fba2ad 56
ce6120cc 57 snd_soc_dapm_new_controls(dapm, dapm_widgets,
14412acd
BD
58 ARRAY_SIZE(dapm_widgets));
59
ce6120cc 60 snd_soc_dapm_add_routes(dapm, base_map, ARRAY_SIZE(base_map));
14412acd 61
ce6120cc
LG
62 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
63 snd_soc_dapm_enable_pin(dapm, "Line In");
64 snd_soc_dapm_enable_pin(dapm, "Line Out");
65 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
14412acd 66
f0fba2ad 67 simtec_audio_init(rtd);
ce6120cc 68 snd_soc_dapm_sync(dapm);
14412acd
BD
69
70 return 0;
71}
72
73static struct snd_soc_dai_link simtec_dai_aic23 = {
74 .name = "tlv320aic23",
75 .stream_name = "TLV320AIC23",
81d7da54 76 .codec_name = "tlv320aic3x-codec.0-001a",
518aa59f 77 .cpu_dai_name = "s3c24xx-iis",
f0fba2ad 78 .codec_dai_name = "tlv320aic3x-hifi",
58bb4072 79 .platform_name = "samsung-audio",
14412acd
BD
80 .init = simtec_tlv320aic23_init,
81};
82
83/* simtec audio machine driver */
84static struct snd_soc_card snd_soc_machine_simtec_aic23 = {
85 .name = "Simtec",
14412acd
BD
86 .dai_link = &simtec_dai_aic23,
87 .num_links = 1,
88};
89
14412acd
BD
90static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd)
91{
f0fba2ad 92 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23);
14412acd
BD
93}
94
95static struct platform_driver simtec_audio_tlv320aic23_platdrv = {
96 .driver = {
97 .owner = THIS_MODULE,
98 .name = "s3c24xx-simtec-tlv320aic23",
99 .pm = simtec_audio_pm,
100 },
101 .probe = simtec_audio_tlv320aic23_probe,
102 .remove = __devexit_p(simtec_audio_remove),
103};
104
105MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23");
106
107static int __init simtec_tlv320aic23_modinit(void)
108{
109 return platform_driver_register(&simtec_audio_tlv320aic23_platdrv);
110}
111
112static void __exit simtec_tlv320aic23_modexit(void)
113{
114 platform_driver_unregister(&simtec_audio_tlv320aic23_platdrv);
115}
116
117module_init(simtec_tlv320aic23_modinit);
118module_exit(simtec_tlv320aic23_modexit);
119
120MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
121MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
122MODULE_LICENSE("GPL");
This page took 0.097104 seconds and 5 git commands to generate.