Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux...
[deliverable/linux.git] / sound / soc / codecs / ads117x.c
CommitLineData
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>
da155d5b 17#include <linux/module.h>
2dcf9fb9
GG
18#include <sound/core.h>
19#include <sound/pcm.h>
20#include <sound/initval.h>
21#include <sound/soc.h>
22
2dcf9fb9 23#define ADS117X_RATES (SNDRV_PCM_RATE_8000_48000)
2dcf9fb9
GG
24#define ADS117X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE)
25
f0fba2ad 26static struct snd_soc_dai_driver ads117x_dai = {
2dcf9fb9 27/* ADC */
f0fba2ad 28 .name = "ads117x-hifi",
2dcf9fb9
GG
29 .capture = {
30 .stream_name = "Capture",
31 .channels_min = 1,
32 .channels_max = 32,
33 .rates = ADS117X_RATES,
34 .formats = ADS117X_FORMATS,},
35};
2dcf9fb9 36
f0fba2ad 37static struct snd_soc_codec_driver soc_codec_dev_ads117x;
2dcf9fb9 38
f0fba2ad 39static __devinit int ads117x_probe(struct platform_device *pdev)
2dcf9fb9 40{
f0fba2ad
LG
41 return snd_soc_register_codec(&pdev->dev,
42 &soc_codec_dev_ads117x, &ads117x_dai, 1);
2dcf9fb9 43}
2dcf9fb9 44
f0fba2ad 45static int __devexit ads117x_remove(struct platform_device *pdev)
2dcf9fb9 46{
f0fba2ad 47 snd_soc_unregister_codec(&pdev->dev);
f3d0e82f
MB
48 return 0;
49}
50
51static struct platform_driver ads117x_codec_driver = {
52 .driver = {
f0fba2ad 53 .name = "ads117x-codec",
f3d0e82f
MB
54 .owner = THIS_MODULE,
55 },
56
f0fba2ad
LG
57 .probe = ads117x_probe,
58 .remove = __devexit_p(ads117x_remove),
f3d0e82f
MB
59};
60
61static int __init ads117x_init(void)
62{
63 return platform_driver_register(&ads117x_codec_driver);
64}
65module_init(ads117x_init);
66
67static void __exit ads117x_exit(void)
68{
69 platform_driver_unregister(&ads117x_codec_driver);
2dcf9fb9
GG
70}
71module_exit(ads117x_exit);
72
73MODULE_DESCRIPTION("ASoC ads117x driver");
74MODULE_AUTHOR("Graeme Gregory");
75MODULE_LICENSE("GPL");
This page took 0.187406 seconds and 5 git commands to generate.