blob: 7ac924c595bf9afa557d3a7f2f870918cdffbb33 [file] [log] [blame]
Jassi Brar5033f432010-11-22 15:37:25 +09001/* sound/soc/samsung/s3c24xx_simtec_hermes.c
Ben Dooksb2ec22e2009-08-20 22:50:43 +01002 *
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
Paul Gortmakerda155d52011-07-15 12:38:28 -040010#include <linux/module.h>
Ben Dooksb2ec22e2009-08-20 22:50:43 +010011#include <sound/soc.h>
Ben Dooksb2ec22e2009-08-20 22:50:43 +010012
Ben Dooksb2ec22e2009-08-20 22:50:43 +010013#include "s3c24xx_simtec.h"
14
Ben Dooksb2ec22e2009-08-20 22:50:43 +010015static const struct snd_soc_dapm_widget dapm_widgets[] = {
16 SND_SOC_DAPM_LINE("GSM Out", NULL),
17 SND_SOC_DAPM_LINE("GSM In", NULL),
18 SND_SOC_DAPM_LINE("Line In", NULL),
19 SND_SOC_DAPM_LINE("Line Out", NULL),
20 SND_SOC_DAPM_LINE("ZV", NULL),
21 SND_SOC_DAPM_MIC("Mic Jack", NULL),
22 SND_SOC_DAPM_HP("Headphone Jack", NULL),
23};
24
25static const struct snd_soc_dapm_route base_map[] = {
26 /* Headphone connected to HP{L,R}OUT and HP{L,R}COM */
27
28 { "Headphone Jack", NULL, "HPLOUT" },
29 { "Headphone Jack", NULL, "HPLCOM" },
30 { "Headphone Jack", NULL, "HPROUT" },
31 { "Headphone Jack", NULL, "HPRCOM" },
32
33 /* ZV connected to Line1 */
34
35 { "LINE1L", NULL, "ZV" },
36 { "LINE1R", NULL, "ZV" },
37
38 /* Line In connected to Line2 */
39
40 { "LINE2L", NULL, "Line In" },
41 { "LINE2R", NULL, "Line In" },
42
43 /* Microphone connected to MIC3R and MIC_BIAS */
44
45 { "MIC3L", NULL, "Mic Jack" },
46
47 /* GSM connected to MONO_LOUT and MIC3L (in) */
48
49 { "GSM Out", NULL, "MONO_LOUT" },
50 { "MIC3L", NULL, "GSM In" },
51
52 /* Speaker is connected to LINEOUT{LN,LP,RN,RP}, however we are
53 * not using the DAPM to power it up and down as there it makes
54 * a click when powering up. */
55};
56
57/**
58 * simtec_hermes_init - initialise and add controls
59 * @codec; The codec instance to attach to.
60 *
61 * Attach our controls and configure the necessary codec
62 * mappings for our sound card instance.
63*/
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000064static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd)
Ben Dooksb2ec22e2009-08-20 22:50:43 +010065{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000066 simtec_audio_init(rtd);
Ben Dooksb2ec22e2009-08-20 22:50:43 +010067
68 return 0;
69}
70
Ben Dooksb2ec22e2009-08-20 22:50:43 +010071static struct snd_soc_dai_link simtec_dai_aic33 = {
72 .name = "tlv320aic33",
73 .stream_name = "TLV320AIC33",
Lars-Peter Clausen81d7da52011-01-24 22:09:22 +010074 .codec_name = "tlv320aic3x-codec.0-001a",
Lars-Peter Clausen518aa592011-01-24 22:12:42 +010075 .cpu_dai_name = "s3c24xx-iis",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000076 .codec_dai_name = "tlv320aic3x-hifi",
Padmavathi Vennaa08485d2012-12-07 13:59:21 +053077 .platform_name = "s3c24xx-iis",
Ben Dooksb2ec22e2009-08-20 22:50:43 +010078 .init = simtec_hermes_init,
79};
80
81/* simtec audio machine driver */
82static struct snd_soc_card snd_soc_machine_simtec_aic33 = {
83 .name = "Simtec-Hermes",
Axel Lin095d79d2011-12-22 10:53:15 +080084 .owner = THIS_MODULE,
Ben Dooksb2ec22e2009-08-20 22:50:43 +010085 .dai_link = &simtec_dai_aic33,
86 .num_links = 1,
Mark Brown4f5448a2011-10-08 12:19:12 +010087
88 .dapm_widgets = dapm_widgets,
89 .num_dapm_widgets = ARRAY_SIZE(dapm_widgets),
90 .dapm_routes = base_map,
91 .num_dapm_routes = ARRAY_SIZE(base_map),
Ben Dooksb2ec22e2009-08-20 22:50:43 +010092};
93
Bill Pembertonfdca21a2012-12-07 09:26:15 -050094static int simtec_audio_hermes_probe(struct platform_device *pd)
Ben Dooksb2ec22e2009-08-20 22:50:43 +010095{
96 dev_info(&pd->dev, "probing....\n");
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000097 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33);
Ben Dooksb2ec22e2009-08-20 22:50:43 +010098}
99
100static struct platform_driver simtec_audio_hermes_platdrv = {
101 .driver = {
Ben Dooksb2ec22e2009-08-20 22:50:43 +0100102 .name = "s3c24xx-simtec-hermes-snd",
103 .pm = simtec_audio_pm,
104 },
105 .probe = simtec_audio_hermes_probe,
Bill Pembertonfdca21a2012-12-07 09:26:15 -0500106 .remove = simtec_audio_remove,
Ben Dooksb2ec22e2009-08-20 22:50:43 +0100107};
108
Mark Browne00c3f52011-11-23 15:20:13 +0000109module_platform_driver(simtec_audio_hermes_platdrv);
110
Ben Dooksb2ec22e2009-08-20 22:50:43 +0100111MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd");
Ben Dooksb2ec22e2009-08-20 22:50:43 +0100112MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
113MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
114MODULE_LICENSE("GPL");