Commit | Line | Data |
---|---|---|
2dcf9fb9 GG |
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> | |
5a0e3ad6 | 14 | #include <linux/slab.h> |
2dcf9fb9 GG |
15 | #include <linux/init.h> |
16 | #include <linux/device.h> | |
17 | #include <sound/core.h> | |
18 | #include <sound/pcm.h> | |
19 | #include <sound/initval.h> | |
20 | #include <sound/soc.h> | |
21 | ||
2dcf9fb9 | 22 | #define ADS117X_RATES (SNDRV_PCM_RATE_8000_48000) |
2dcf9fb9 GG |
23 | #define ADS117X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE) |
24 | ||
f0fba2ad | 25 | static struct snd_soc_dai_driver ads117x_dai = { |
2dcf9fb9 | 26 | /* ADC */ |
f0fba2ad | 27 | .name = "ads117x-hifi", |
2dcf9fb9 GG |
28 | .capture = { |
29 | .stream_name = "Capture", | |
30 | .channels_min = 1, | |
31 | .channels_max = 32, | |
32 | .rates = ADS117X_RATES, | |
33 | .formats = ADS117X_FORMATS,}, | |
34 | }; | |
2dcf9fb9 | 35 | |
f0fba2ad | 36 | static struct snd_soc_codec_driver soc_codec_dev_ads117x; |
2dcf9fb9 | 37 | |
f0fba2ad | 38 | static __devinit int ads117x_probe(struct platform_device *pdev) |
2dcf9fb9 | 39 | { |
f0fba2ad LG |
40 | return snd_soc_register_codec(&pdev->dev, |
41 | &soc_codec_dev_ads117x, &ads117x_dai, 1); | |
2dcf9fb9 | 42 | } |
2dcf9fb9 | 43 | |
f0fba2ad | 44 | static int __devexit ads117x_remove(struct platform_device *pdev) |
2dcf9fb9 | 45 | { |
f0fba2ad | 46 | snd_soc_unregister_codec(&pdev->dev); |
f3d0e82f MB |
47 | return 0; |
48 | } | |
49 | ||
50 | static struct platform_driver ads117x_codec_driver = { | |
51 | .driver = { | |
f0fba2ad | 52 | .name = "ads117x-codec", |
f3d0e82f MB |
53 | .owner = THIS_MODULE, |
54 | }, | |
55 | ||
f0fba2ad LG |
56 | .probe = ads117x_probe, |
57 | .remove = __devexit_p(ads117x_remove), | |
f3d0e82f MB |
58 | }; |
59 | ||
60 | static int __init ads117x_init(void) | |
61 | { | |
62 | return platform_driver_register(&ads117x_codec_driver); | |
63 | } | |
64 | module_init(ads117x_init); | |
65 | ||
66 | static void __exit ads117x_exit(void) | |
67 | { | |
68 | platform_driver_unregister(&ads117x_codec_driver); | |
2dcf9fb9 GG |
69 | } |
70 | module_exit(ads117x_exit); | |
71 | ||
72 | MODULE_DESCRIPTION("ASoC ads117x driver"); | |
73 | MODULE_AUTHOR("Graeme Gregory"); | |
74 | MODULE_LICENSE("GPL"); |