ASoC: cs4349: Constify cs4349_regmap
[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
45a14a8b
MB
26static const struct snd_soc_dapm_widget ads117x_dapm_widgets[] = {
27SND_SOC_DAPM_INPUT("Input1"),
28SND_SOC_DAPM_INPUT("Input2"),
29SND_SOC_DAPM_INPUT("Input3"),
30SND_SOC_DAPM_INPUT("Input4"),
31SND_SOC_DAPM_INPUT("Input5"),
32SND_SOC_DAPM_INPUT("Input6"),
33SND_SOC_DAPM_INPUT("Input7"),
34SND_SOC_DAPM_INPUT("Input8"),
35};
36
37static const struct snd_soc_dapm_route ads117x_dapm_routes[] = {
38 { "Capture", NULL, "Input1" },
39 { "Capture", NULL, "Input2" },
40 { "Capture", NULL, "Input3" },
41 { "Capture", NULL, "Input4" },
42 { "Capture", NULL, "Input5" },
43 { "Capture", NULL, "Input6" },
44 { "Capture", NULL, "Input7" },
45 { "Capture", NULL, "Input8" },
46};
47
f0fba2ad 48static struct snd_soc_dai_driver ads117x_dai = {
2dcf9fb9 49/* ADC */
f0fba2ad 50 .name = "ads117x-hifi",
2dcf9fb9
GG
51 .capture = {
52 .stream_name = "Capture",
53 .channels_min = 1,
54 .channels_max = 32,
55 .rates = ADS117X_RATES,
56 .formats = ADS117X_FORMATS,},
57};
2dcf9fb9 58
45a14a8b
MB
59static struct snd_soc_codec_driver soc_codec_dev_ads117x = {
60 .dapm_widgets = ads117x_dapm_widgets,
61 .num_dapm_widgets = ARRAY_SIZE(ads117x_dapm_widgets),
62 .dapm_routes = ads117x_dapm_routes,
63 .num_dapm_routes = ARRAY_SIZE(ads117x_dapm_routes),
64};
2dcf9fb9 65
7a79e94e 66static int ads117x_probe(struct platform_device *pdev)
2dcf9fb9 67{
f0fba2ad
LG
68 return snd_soc_register_codec(&pdev->dev,
69 &soc_codec_dev_ads117x, &ads117x_dai, 1);
2dcf9fb9 70}
2dcf9fb9 71
7a79e94e 72static int ads117x_remove(struct platform_device *pdev)
2dcf9fb9 73{
f0fba2ad 74 snd_soc_unregister_codec(&pdev->dev);
f3d0e82f
MB
75 return 0;
76}
77
78static struct platform_driver ads117x_codec_driver = {
79 .driver = {
f0fba2ad 80 .name = "ads117x-codec",
f3d0e82f
MB
81 },
82
f0fba2ad 83 .probe = ads117x_probe,
7a79e94e 84 .remove = ads117x_remove,
f3d0e82f
MB
85};
86
5bbcc3c0 87module_platform_driver(ads117x_codec_driver);
2dcf9fb9
GG
88
89MODULE_DESCRIPTION("ASoC ads117x driver");
90MODULE_AUTHOR("Graeme Gregory");
91MODULE_LICENSE("GPL");
This page took 0.282539 seconds and 5 git commands to generate.