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