diff options
author | David Lambert <dlambert@ti.com> | 2011-01-06 09:00:37 -0500 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-01-11 19:48:45 -0500 |
commit | a710770e05563fd5add9af686569ee9fa56bbd65 (patch) | |
tree | d77c641e3021e9d5e5a476f87b3ad879d216c3c0 /sound | |
parent | 0d99d2b036974ed1160f9d10457b6054646fb7d6 (diff) |
ASoC: DMIC codec: Adding a generic DMIC codec
This codec is to be used by the DMIC driver to
control the DMIC codec. This driver will be used on future
implementations of the DMIC driver to support codec specific
features.
At this time, the codec driver just registers the codec DAI.
Signed-off-by: David Lambert <dlambert@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/Kconfig | 3 | ||||
-rw-r--r-- | sound/soc/codecs/Makefile | 2 | ||||
-rw-r--r-- | sound/soc/codecs/dmic.c | 81 |
3 files changed, 86 insertions, 0 deletions
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 0f33db2be25..f6c6d316ac6 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -166,6 +166,9 @@ config SND_SOC_L3 | |||
166 | config SND_SOC_DA7210 | 166 | config SND_SOC_DA7210 |
167 | tristate | 167 | tristate |
168 | 168 | ||
169 | config SND_SOC_DMIC | ||
170 | tristate | ||
171 | |||
169 | config SND_SOC_MAX98088 | 172 | config SND_SOC_MAX98088 |
170 | tristate | 173 | tristate |
171 | 174 | ||
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 10e5e099334..9139cf95ff7 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile | |||
@@ -14,6 +14,7 @@ snd-soc-cs42l51-objs := cs42l51.o | |||
14 | snd-soc-cs4270-objs := cs4270.o | 14 | snd-soc-cs4270-objs := cs4270.o |
15 | snd-soc-cx20442-objs := cx20442.o | 15 | snd-soc-cx20442-objs := cx20442.o |
16 | snd-soc-da7210-objs := da7210.o | 16 | snd-soc-da7210-objs := da7210.o |
17 | snd-soc-dmic-objs := dmic.o | ||
17 | snd-soc-l3-objs := l3.o | 18 | snd-soc-l3-objs := l3.o |
18 | snd-soc-max98088-objs := max98088.o | 19 | snd-soc-max98088-objs := max98088.o |
19 | snd-soc-pcm3008-objs := pcm3008.o | 20 | snd-soc-pcm3008-objs := pcm3008.o |
@@ -91,6 +92,7 @@ obj-$(CONFIG_SND_SOC_CS42L51) += snd-soc-cs42l51.o | |||
91 | obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o | 92 | obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o |
92 | obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o | 93 | obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o |
93 | obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o | 94 | obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o |
95 | obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o | ||
94 | obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o | 96 | obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o |
95 | obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o | 97 | obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o |
96 | obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o | 98 | obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o |
diff --git a/sound/soc/codecs/dmic.c b/sound/soc/codecs/dmic.c new file mode 100644 index 00000000000..57e9dac88d3 --- /dev/null +++ b/sound/soc/codecs/dmic.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | * dmic.c -- SoC audio for Generic Digital MICs | ||
3 | * | ||
4 | * Author: Liam Girdwood <lrg@slimlogic.co.uk> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * version 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | * General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
18 | * 02110-1301 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <sound/core.h> | ||
25 | #include <sound/pcm.h> | ||
26 | #include <sound/soc.h> | ||
27 | #include <sound/soc-dapm.h> | ||
28 | |||
29 | static struct snd_soc_dai_driver dmic_dai = { | ||
30 | .name = "dmic-hifi", | ||
31 | .capture = { | ||
32 | .stream_name = "Capture", | ||
33 | .channels_min = 1, | ||
34 | .channels_max = 8, | ||
35 | .rates = SNDRV_PCM_RATE_CONTINUOUS, | ||
36 | .formats = SNDRV_PCM_FMTBIT_S32_LE | ||
37 | | SNDRV_PCM_FMTBIT_S24_LE | ||
38 | | SNDRV_PCM_FMTBIT_S16_LE, | ||
39 | }, | ||
40 | }; | ||
41 | |||
42 | static struct snd_soc_codec_driver soc_dmic = {}; | ||
43 | |||
44 | static int __devinit dmic_dev_probe(struct platform_device *pdev) | ||
45 | { | ||
46 | return snd_soc_register_codec(&pdev->dev, | ||
47 | &soc_dmic, &dmic_dai, 1); | ||
48 | } | ||
49 | |||
50 | static int __devexit dmic_dev_remove(struct platform_device *pdev) | ||
51 | { | ||
52 | snd_soc_unregister_codec(&pdev->dev); | ||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | MODULE_ALIAS("platform:dmic-codec"); | ||
57 | |||
58 | static struct platform_driver dmic_driver = { | ||
59 | .driver = { | ||
60 | .name = "dmic-codec", | ||
61 | .owner = THIS_MODULE, | ||
62 | }, | ||
63 | .probe = dmic_dev_probe, | ||
64 | .remove = __devexit_p(dmic_dev_remove), | ||
65 | }; | ||
66 | |||
67 | static int __init dmic_init(void) | ||
68 | { | ||
69 | return platform_driver_register(&dmic_driver); | ||
70 | } | ||
71 | module_init(dmic_init); | ||
72 | |||
73 | static void __exit dmic_exit(void) | ||
74 | { | ||
75 | platform_driver_unregister(&dmic_driver); | ||
76 | } | ||
77 | module_exit(dmic_exit); | ||
78 | |||
79 | MODULE_DESCRIPTION("Generic DMIC driver"); | ||
80 | MODULE_AUTHOR("Liam Girdwood <lrg@slimlogic.co.uk>"); | ||
81 | MODULE_LICENSE("GPL"); | ||