aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorQiao Zhou <zhouqiao@marvell.com>2012-06-11 06:04:41 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-13 08:16:14 -0400
commitb883f363495f3d2e237170f6b8814869a3dd16fe (patch)
tree1b3460ca5858f4659abe60ddbf13fb0c759492d6 /sound
parent5ebf20ae286a7d2b02551757166247a901d705e5 (diff)
ASoC: add ttc-dkb machine support
add ttc-dkb machine support for pxa910. It uses 88pm8607 as codec dai, mmp-pcm as platform and pxa-ssp as cpu dai. Signed-off-by: Qiao Zhou <zhouqiao@marvell.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/pxa/Kconfig20
-rw-r--r--sound/soc/pxa/Makefile2
-rw-r--r--sound/soc/pxa/ttc-dkb.c173
3 files changed, 195 insertions, 0 deletions
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index d389fd574efe..4d2e46fae77c 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -150,6 +150,26 @@ config SND_SOC_TAVOREVB3
150 Say Y if you want to add support for SoC audio on the 150 Say Y if you want to add support for SoC audio on the
151 Marvell Saarb reference platform. 151 Marvell Saarb reference platform.
152 152
153config SND_PXA910_SOC
154 tristate "SoC Audio for Marvell PXA910 chip"
155 depends on ARCH_MMP && SND
156 select SND_PCM
157 help
158 Say Y if you want to add support for SoC audio on the
159 Marvell PXA910 reference platform.
160
161config SND_SOC_TTC_DKB
162 bool "SoC Audio support for TTC DKB"
163 depends on SND_PXA910_SOC && MACH_TTC_DKB
164 select PXA_SSP
165 select SND_PXA_SOC_SSP
166 select SND_MMP_SOC
167 select MFD_88PM860X
168 select SND_SOC_88PM860X
169 help
170 Say Y if you want to add support for SoC audio on TTC DKB
171
172
153config SND_SOC_ZYLONITE 173config SND_SOC_ZYLONITE
154 tristate "SoC Audio support for Marvell Zylonite" 174 tristate "SoC Audio support for Marvell Zylonite"
155 depends on SND_PXA2XX_SOC && MACH_ZYLONITE 175 depends on SND_PXA2XX_SOC && MACH_ZYLONITE
diff --git a/sound/soc/pxa/Makefile b/sound/soc/pxa/Makefile
index c12aa2a9bf74..d8a265d2d5d7 100644
--- a/sound/soc/pxa/Makefile
+++ b/sound/soc/pxa/Makefile
@@ -33,6 +33,7 @@ snd-soc-z2-objs := z2.o
33snd-soc-imote2-objs := imote2.o 33snd-soc-imote2-objs := imote2.o
34snd-soc-raumfeld-objs := raumfeld.o 34snd-soc-raumfeld-objs := raumfeld.o
35snd-soc-brownstone-objs := brownstone.o 35snd-soc-brownstone-objs := brownstone.o
36snd-soc-ttc-dkb-objs := ttc-dkb.o
36 37
37obj-$(CONFIG_SND_PXA2XX_SOC_CORGI) += snd-soc-corgi.o 38obj-$(CONFIG_SND_PXA2XX_SOC_CORGI) += snd-soc-corgi.o
38obj-$(CONFIG_SND_PXA2XX_SOC_POODLE) += snd-soc-poodle.o 39obj-$(CONFIG_SND_PXA2XX_SOC_POODLE) += snd-soc-poodle.o
@@ -53,3 +54,4 @@ obj-$(CONFIG_SND_SOC_ZYLONITE) += snd-soc-zylonite.o
53obj-$(CONFIG_SND_PXA2XX_SOC_IMOTE2) += snd-soc-imote2.o 54obj-$(CONFIG_SND_PXA2XX_SOC_IMOTE2) += snd-soc-imote2.o
54obj-$(CONFIG_SND_SOC_RAUMFELD) += snd-soc-raumfeld.o 55obj-$(CONFIG_SND_SOC_RAUMFELD) += snd-soc-raumfeld.o
55obj-$(CONFIG_SND_MMP_SOC_BROWNSTONE) += snd-soc-brownstone.o 56obj-$(CONFIG_SND_MMP_SOC_BROWNSTONE) += snd-soc-brownstone.o
57obj-$(CONFIG_SND_SOC_TTC_DKB) += snd-soc-ttc-dkb.o
diff --git a/sound/soc/pxa/ttc-dkb.c b/sound/soc/pxa/ttc-dkb.c
new file mode 100644
index 000000000000..935491a8a770
--- /dev/null
+++ b/sound/soc/pxa/ttc-dkb.c
@@ -0,0 +1,173 @@
1/*
2 * linux/sound/soc/pxa/ttc_dkb.c
3 *
4 * Copyright (C) 2012 Marvell International Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21#include <linux/module.h>
22#include <linux/moduleparam.h>
23#include <sound/core.h>
24#include <sound/pcm.h>
25#include <sound/soc.h>
26#include <sound/jack.h>
27#include <asm/mach-types.h>
28#include <sound/pcm_params.h>
29#include "../codecs/88pm860x-codec.h"
30
31static struct snd_soc_jack hs_jack, mic_jack;
32
33static struct snd_soc_jack_pin hs_jack_pins[] = {
34 { .pin = "Headset Stereophone", .mask = SND_JACK_HEADPHONE, },
35};
36
37static struct snd_soc_jack_pin mic_jack_pins[] = {
38 { .pin = "Headset Mic 2", .mask = SND_JACK_MICROPHONE, },
39};
40
41/* ttc machine dapm widgets */
42static const struct snd_soc_dapm_widget ttc_dapm_widgets[] = {
43 SND_SOC_DAPM_HP("Headset Stereophone", NULL),
44 SND_SOC_DAPM_LINE("Lineout Out 1", NULL),
45 SND_SOC_DAPM_LINE("Lineout Out 2", NULL),
46 SND_SOC_DAPM_SPK("Ext Speaker", NULL),
47 SND_SOC_DAPM_MIC("Ext Mic 1", NULL),
48 SND_SOC_DAPM_MIC("Headset Mic 2", NULL),
49 SND_SOC_DAPM_MIC("Ext Mic 3", NULL),
50};
51
52/* ttc machine audio map */
53static const struct snd_soc_dapm_route ttc_audio_map[] = {
54 {"Headset Stereophone", NULL, "HS1"},
55 {"Headset Stereophone", NULL, "HS2"},
56
57 {"Ext Speaker", NULL, "LSP"},
58 {"Ext Speaker", NULL, "LSN"},
59
60 {"Lineout Out 1", NULL, "LINEOUT1"},
61 {"Lineout Out 2", NULL, "LINEOUT2"},
62
63 {"MIC1P", NULL, "Mic1 Bias"},
64 {"MIC1N", NULL, "Mic1 Bias"},
65 {"Mic1 Bias", NULL, "Ext Mic 1"},
66
67 {"MIC2P", NULL, "Mic1 Bias"},
68 {"MIC2N", NULL, "Mic1 Bias"},
69 {"Mic1 Bias", NULL, "Headset Mic 2"},
70
71 {"MIC3P", NULL, "Mic3 Bias"},
72 {"MIC3N", NULL, "Mic3 Bias"},
73 {"Mic3 Bias", NULL, "Ext Mic 3"},
74};
75
76static int ttc_pm860x_init(struct snd_soc_pcm_runtime *rtd)
77{
78 struct snd_soc_codec *codec = rtd->codec;
79 struct snd_soc_dapm_context *dapm = &codec->dapm;
80
81 /* connected pins */
82 snd_soc_dapm_enable_pin(dapm, "Ext Speaker");
83 snd_soc_dapm_enable_pin(dapm, "Ext Mic 1");
84 snd_soc_dapm_enable_pin(dapm, "Ext Mic 3");
85 snd_soc_dapm_disable_pin(dapm, "Headset Mic 2");
86 snd_soc_dapm_disable_pin(dapm, "Headset Stereophone");
87
88 /* Headset jack detection */
89 snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE
90 | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2,
91 &hs_jack);
92 snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
93 hs_jack_pins);
94 snd_soc_jack_new(codec, "Microphone Jack", SND_JACK_MICROPHONE,
95 &mic_jack);
96 snd_soc_jack_add_pins(&mic_jack, ARRAY_SIZE(mic_jack_pins),
97 mic_jack_pins);
98
99 /* headphone, microphone detection & headset short detection */
100 pm860x_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADPHONE,
101 SND_JACK_BTN_0, SND_JACK_BTN_1, SND_JACK_BTN_2);
102 pm860x_mic_jack_detect(codec, &hs_jack, SND_JACK_MICROPHONE);
103
104 return 0;
105}
106
107/* ttc/td-dkb digital audio interface glue - connects codec <--> CPU */
108static struct snd_soc_dai_link ttc_pm860x_hifi_dai[] = {
109{
110 .name = "88pm860x i2s",
111 .stream_name = "audio playback",
112 .codec_name = "88pm860x-codec",
113 .platform_name = "mmp-pcm-audio",
114 .cpu_dai_name = "pxa-ssp-dai.1",
115 .codec_dai_name = "88pm860x-i2s",
116 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
117 SND_SOC_DAIFMT_CBM_CFM,
118 .init = ttc_pm860x_init,
119},
120};
121
122/* ttc/td audio machine driver */
123static struct snd_soc_card ttc_dkb_card = {
124 .name = "ttc-dkb-hifi",
125 .dai_link = ttc_pm860x_hifi_dai,
126 .num_links = ARRAY_SIZE(ttc_pm860x_hifi_dai),
127
128 .dapm_widgets = ttc_dapm_widgets,
129 .num_dapm_widgets = ARRAY_SIZE(ttc_dapm_widgets),
130 .dapm_routes = ttc_audio_map,
131 .num_dapm_routes = ARRAY_SIZE(ttc_audio_map),
132};
133
134static int __devinit ttc_dkb_probe(struct platform_device *pdev)
135{
136 struct snd_soc_card *card = &ttc_dkb_card;
137 int ret;
138
139 card->dev = &pdev->dev;
140
141 ret = snd_soc_register_card(card);
142 if (ret)
143 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
144 ret);
145
146 return ret;
147}
148
149static int __devexit ttc_dkb_remove(struct platform_device *pdev)
150{
151 struct snd_soc_card *card = platform_get_drvdata(pdev);
152
153 snd_soc_unregister_card(card);
154
155 return 0;
156}
157
158static struct platform_driver ttc_dkb_driver = {
159 .driver = {
160 .name = "ttc-dkb-audio",
161 .owner = THIS_MODULE,
162 },
163 .probe = ttc_dkb_probe,
164 .remove = __devexit_p(ttc_dkb_remove),
165};
166
167module_platform_driver(ttc_dkb_driver);
168
169/* Module information */
170MODULE_AUTHOR("Qiao Zhou, <zhouqiao@marvell.com>");
171MODULE_DESCRIPTION("ALSA SoC TTC DKB");
172MODULE_LICENSE("GPL");
173MODULE_ALIAS("platform:ttc-dkb-audio");