1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#include <linux/init.h>
19#include <linux/slab.h>
20#include <linux/module.h>
21#include <linux/kernel.h>
22#include <linux/device.h>
23#include <sound/core.h>
24#include <sound/pcm.h>
25#include <sound/ac97_codec.h>
26#include <sound/initval.h>
27#include <sound/soc.h>
28
29static const struct snd_soc_dapm_widget wm8782_dapm_widgets[] = {
30SND_SOC_DAPM_INPUT("AINL"),
31SND_SOC_DAPM_INPUT("AINR"),
32};
33
34static const struct snd_soc_dapm_route wm8782_dapm_routes[] = {
35 { "Capture", NULL, "AINL" },
36 { "Capture", NULL, "AINR" },
37};
38
39static struct snd_soc_dai_driver wm8782_dai = {
40 .name = "wm8782",
41 .capture = {
42 .stream_name = "Capture",
43 .channels_min = 2,
44 .channels_max = 2,
45
46 .rates = SNDRV_PCM_RATE_8000_48000,
47 .formats = SNDRV_PCM_FMTBIT_S16_LE |
48 SNDRV_PCM_FMTBIT_S20_3LE |
49 SNDRV_PCM_FMTBIT_S24_LE,
50 },
51};
52
53static struct snd_soc_codec_driver soc_codec_dev_wm8782 = {
54 .dapm_widgets = wm8782_dapm_widgets,
55 .num_dapm_widgets = ARRAY_SIZE(wm8782_dapm_widgets),
56 .dapm_routes = wm8782_dapm_routes,
57 .num_dapm_routes = ARRAY_SIZE(wm8782_dapm_routes),
58};
59
60static int wm8782_probe(struct platform_device *pdev)
61{
62 return snd_soc_register_codec(&pdev->dev,
63 &soc_codec_dev_wm8782, &wm8782_dai, 1);
64}
65
66static int wm8782_remove(struct platform_device *pdev)
67{
68 snd_soc_unregister_codec(&pdev->dev);
69 return 0;
70}
71
72static struct platform_driver wm8782_codec_driver = {
73 .driver = {
74 .name = "wm8782",
75 },
76 .probe = wm8782_probe,
77 .remove = wm8782_remove,
78};
79
80module_platform_driver(wm8782_codec_driver);
81
82MODULE_DESCRIPTION("ASoC WM8782 driver");
83MODULE_AUTHOR("Johannes Stezenbach <js@sig21.net>");
84MODULE_LICENSE("GPL");
85