diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-11-20 11:37:10 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-11-20 11:37:10 -0500 |
commit | dcdec639ad74f20427df82284f98b68f6ac7c0ae (patch) | |
tree | 7483dae1fcf6623a412938092f2ad7245e8686c3 | |
parent | b2a2236d1f5e7c09c8e74b61f13d8ba3fe82f7be (diff) | |
parent | f3d0e82fe3cce0dd3ffcd9c59e6caa671a30f929 (diff) |
Merge branch 'ads117x' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6 into for-2.6.33
-rw-r--r-- | sound/soc/codecs/Kconfig | 4 | ||||
-rw-r--r-- | sound/soc/codecs/Makefile | 2 | ||||
-rw-r--r-- | sound/soc/codecs/ads117x.c | 123 | ||||
-rw-r--r-- | sound/soc/codecs/ads117x.h | 13 |
4 files changed, 142 insertions, 0 deletions
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 4a3e8dcf24d9..52b005f8fed4 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -15,6 +15,7 @@ config SND_SOC_ALL_CODECS | |||
15 | select SND_SOC_AD1836 if SPI_MASTER | 15 | select SND_SOC_AD1836 if SPI_MASTER |
16 | select SND_SOC_AD1938 if SPI_MASTER | 16 | select SND_SOC_AD1938 if SPI_MASTER |
17 | select SND_SOC_AD1980 if SND_SOC_AC97_BUS | 17 | select SND_SOC_AD1980 if SND_SOC_AC97_BUS |
18 | select SND_SOC_ADS117X | ||
18 | select SND_SOC_AD73311 if I2C | 19 | select SND_SOC_AD73311 if I2C |
19 | select SND_SOC_AK4104 if SPI_MASTER | 20 | select SND_SOC_AK4104 if SPI_MASTER |
20 | select SND_SOC_AK4535 if I2C | 21 | select SND_SOC_AK4535 if I2C |
@@ -91,6 +92,9 @@ config SND_SOC_AD1980 | |||
91 | 92 | ||
92 | config SND_SOC_AD73311 | 93 | config SND_SOC_AD73311 |
93 | tristate | 94 | tristate |
95 | |||
96 | config SND_SOC_ADS117X | ||
97 | tristate | ||
94 | 98 | ||
95 | config SND_SOC_AK4104 | 99 | config SND_SOC_AK4104 |
96 | tristate | 100 | tristate |
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index cacfc7692d7f..dbaecb133ac7 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile | |||
@@ -3,6 +3,7 @@ snd-soc-ad1836-objs := ad1836.o | |||
3 | snd-soc-ad1938-objs := ad1938.o | 3 | snd-soc-ad1938-objs := ad1938.o |
4 | snd-soc-ad1980-objs := ad1980.o | 4 | snd-soc-ad1980-objs := ad1980.o |
5 | snd-soc-ad73311-objs := ad73311.o | 5 | snd-soc-ad73311-objs := ad73311.o |
6 | snd-soc-ads117x-objs := ads117x.o | ||
6 | snd-soc-ak4104-objs := ak4104.o | 7 | snd-soc-ak4104-objs := ak4104.o |
7 | snd-soc-ak4535-objs := ak4535.o | 8 | snd-soc-ak4535-objs := ak4535.o |
8 | snd-soc-ak4642-objs := ak4642.o | 9 | snd-soc-ak4642-objs := ak4642.o |
@@ -58,6 +59,7 @@ obj-$(CONFIG_SND_SOC_AD1836) += snd-soc-ad1836.o | |||
58 | obj-$(CONFIG_SND_SOC_AD1938) += snd-soc-ad1938.o | 59 | obj-$(CONFIG_SND_SOC_AD1938) += snd-soc-ad1938.o |
59 | obj-$(CONFIG_SND_SOC_AD1980) += snd-soc-ad1980.o | 60 | obj-$(CONFIG_SND_SOC_AD1980) += snd-soc-ad1980.o |
60 | obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o | 61 | obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o |
62 | obj-$(CONFIG_SND_SOC_ADS117X) += snd-soc-ads117x.o | ||
61 | obj-$(CONFIG_SND_SOC_AK4104) += snd-soc-ak4104.o | 63 | obj-$(CONFIG_SND_SOC_AK4104) += snd-soc-ak4104.o |
62 | obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o | 64 | obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o |
63 | obj-$(CONFIG_SND_SOC_AK4642) += snd-soc-ak4642.o | 65 | obj-$(CONFIG_SND_SOC_AK4642) += snd-soc-ak4642.o |
diff --git a/sound/soc/codecs/ads117x.c b/sound/soc/codecs/ads117x.c new file mode 100644 index 000000000000..cc96411ca3e6 --- /dev/null +++ b/sound/soc/codecs/ads117x.c | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * ads117x.c -- Driver for ads1174/8 ADC chips | ||
3 | * | ||
4 | * Copyright 2009 ShotSpotter Inc. | ||
5 | * Author: Graeme Gregory <gg@slimlogic.co.uk> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/device.h> | ||
16 | #include <sound/core.h> | ||
17 | #include <sound/pcm.h> | ||
18 | #include <sound/initval.h> | ||
19 | #include <sound/soc.h> | ||
20 | |||
21 | #include "ads117x.h" | ||
22 | |||
23 | #define ADS117X_RATES (SNDRV_PCM_RATE_8000_48000) | ||
24 | |||
25 | #define ADS117X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE) | ||
26 | |||
27 | struct snd_soc_dai ads117x_dai = { | ||
28 | /* ADC */ | ||
29 | .name = "ADS117X ADC", | ||
30 | .id = 1, | ||
31 | .capture = { | ||
32 | .stream_name = "Capture", | ||
33 | .channels_min = 1, | ||
34 | .channels_max = 32, | ||
35 | .rates = ADS117X_RATES, | ||
36 | .formats = ADS117X_FORMATS,}, | ||
37 | }; | ||
38 | EXPORT_SYMBOL_GPL(ads117x_dai); | ||
39 | |||
40 | static int ads117x_probe(struct platform_device *pdev) | ||
41 | { | ||
42 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | ||
43 | struct snd_soc_codec *codec; | ||
44 | int ret; | ||
45 | |||
46 | codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); | ||
47 | if (codec == NULL) | ||
48 | return -ENOMEM; | ||
49 | |||
50 | socdev->card->codec = codec; | ||
51 | mutex_init(&codec->mutex); | ||
52 | INIT_LIST_HEAD(&codec->dapm_widgets); | ||
53 | INIT_LIST_HEAD(&codec->dapm_paths); | ||
54 | codec->name = "ADS117X"; | ||
55 | codec->owner = THIS_MODULE; | ||
56 | codec->dai = &ads117x_dai; | ||
57 | codec->num_dai = 1; | ||
58 | |||
59 | /* register pcms */ | ||
60 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); | ||
61 | if (ret < 0) { | ||
62 | printk(KERN_ERR "ads117x: failed to create pcms\n"); | ||
63 | kfree(codec); | ||
64 | return ret; | ||
65 | } | ||
66 | |||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static int ads117x_remove(struct platform_device *pdev) | ||
71 | { | ||
72 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | ||
73 | struct snd_soc_codec *codec = socdev->card->codec; | ||
74 | |||
75 | snd_soc_free_pcms(socdev); | ||
76 | kfree(codec); | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | struct snd_soc_codec_device soc_codec_dev_ads117x = { | ||
82 | .probe = ads117x_probe, | ||
83 | .remove = ads117x_remove, | ||
84 | }; | ||
85 | EXPORT_SYMBOL_GPL(soc_codec_dev_ads117x); | ||
86 | |||
87 | static __devinit int ads117x_platform_probe(struct platform_device *pdev) | ||
88 | { | ||
89 | ads117x_dai.dev = &pdev->dev; | ||
90 | return snd_soc_register_dai(&ads117x_dai); | ||
91 | } | ||
92 | |||
93 | static int __devexit ads117x_platform_remove(struct platform_device *pdev) | ||
94 | { | ||
95 | snd_soc_unregister_dai(&ads117x_dai); | ||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | static struct platform_driver ads117x_codec_driver = { | ||
100 | .driver = { | ||
101 | .name = "ads117x", | ||
102 | .owner = THIS_MODULE, | ||
103 | }, | ||
104 | |||
105 | .probe = ads117x_platform_probe, | ||
106 | .remove = __devexit_p(ads117x_platform_remove), | ||
107 | }; | ||
108 | |||
109 | static int __init ads117x_init(void) | ||
110 | { | ||
111 | return platform_driver_register(&ads117x_codec_driver); | ||
112 | } | ||
113 | module_init(ads117x_init); | ||
114 | |||
115 | static void __exit ads117x_exit(void) | ||
116 | { | ||
117 | platform_driver_unregister(&ads117x_codec_driver); | ||
118 | } | ||
119 | module_exit(ads117x_exit); | ||
120 | |||
121 | MODULE_DESCRIPTION("ASoC ads117x driver"); | ||
122 | MODULE_AUTHOR("Graeme Gregory"); | ||
123 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/codecs/ads117x.h b/sound/soc/codecs/ads117x.h new file mode 100644 index 000000000000..dbcf50ec9bd1 --- /dev/null +++ b/sound/soc/codecs/ads117x.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* | ||
2 | * ads117x.h -- Driver for ads1174/8 ADC chips | ||
3 | * | ||
4 | * Copyright 2009 ShotSpotter Inc. | ||
5 | * Author: Graeme Gregory <gg@slimlogic.co.uk> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | extern struct snd_soc_dai ads117x_dai; | ||
13 | extern struct snd_soc_codec_device soc_codec_dev_ads117x; | ||