1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#include <linux/init.h>
16#include <linux/slab.h>
17#include <linux/module.h>
18#include <linux/kernel.h>
19#include <linux/device.h>
20#include <sound/core.h>
21#include <sound/pcm.h>
22#include <sound/ac97_codec.h>
23#include <sound/initval.h>
24#include <sound/soc.h>
25
26static const struct snd_soc_dapm_widget wm8727_dapm_widgets[] = {
27SND_SOC_DAPM_OUTPUT("VOUTL"),
28SND_SOC_DAPM_OUTPUT("VOUTR"),
29};
30
31static const struct snd_soc_dapm_route wm8727_dapm_routes[] = {
32 { "VOUTL", NULL, "Playback" },
33 { "VOUTR", NULL, "Playback" },
34};
35
36
37
38
39
40#define WM8727_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
41 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |\
42 SNDRV_PCM_RATE_192000)
43
44
45static struct snd_soc_dai_driver wm8727_dai = {
46 .name = "wm8727-hifi",
47 .playback = {
48 .stream_name = "Playback",
49 .channels_min = 2,
50 .channels_max = 2,
51 .rates = WM8727_RATES,
52 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
53 },
54};
55
56static const struct snd_soc_codec_driver soc_codec_dev_wm8727 = {
57 .component_driver = {
58 .dapm_widgets = wm8727_dapm_widgets,
59 .num_dapm_widgets = ARRAY_SIZE(wm8727_dapm_widgets),
60 .dapm_routes = wm8727_dapm_routes,
61 .num_dapm_routes = ARRAY_SIZE(wm8727_dapm_routes),
62 },
63};
64
65static int wm8727_probe(struct platform_device *pdev)
66{
67 return snd_soc_register_codec(&pdev->dev,
68 &soc_codec_dev_wm8727, &wm8727_dai, 1);
69}
70
71static int wm8727_remove(struct platform_device *pdev)
72{
73 snd_soc_unregister_codec(&pdev->dev);
74 return 0;
75}
76
77static struct platform_driver wm8727_codec_driver = {
78 .driver = {
79 .name = "wm8727",
80 },
81
82 .probe = wm8727_probe,
83 .remove = wm8727_remove,
84};
85
86module_platform_driver(wm8727_codec_driver);
87
88MODULE_DESCRIPTION("ASoC wm8727 driver");
89MODULE_AUTHOR("Neil Jones");
90MODULE_LICENSE("GPL");
91