1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
/*
* ALSA SoC dummy codec driver
*
* This driver provides two dummy dais.
*
* Copyright (c) 2013 Samsung Electronics
* http://www.samsungsemi.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <sound/soc.h>
#include <sound/pcm.h>
#include <sound/initval.h>
#define DRV_NAME "dummy-codec"
#define RATES SNDRV_PCM_RATE_8000_192000
#define FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
static struct snd_soc_codec_driver soc_codec_dummy;
static struct snd_soc_dai_driver dummy_codec_dai[] = {
{
.name = "dummy-aif1",
.playback = {
.stream_name = "AIF1 Playback",
.channels_min = 1,
.channels_max = 384,
.rates = RATES,
.formats = FORMATS,
},
.capture = {
.stream_name = "AIF1 Capture",
.channels_min = 1,
.channels_max = 384,
.rates = RATES,
.formats = FORMATS,
},
}, {
.name = "dummy-aif2",
.playback = {
.stream_name = "AIF2 Playback",
.channels_min = 1,
.channels_max = 384,
.rates = RATES,
.formats = FORMATS,
},
.capture = {
.stream_name = "AIF2 Capture",
.channels_min = 1,
.channels_max = 384,
.rates = RATES,
.formats = FORMATS,
},
}, {
.name = "dummy-aif3",
.playback = {
.stream_name = "AIF3 Playback",
.channels_min = 1,
.channels_max = 384,
.rates = RATES,
.formats = FORMATS,
},
.capture = {
.stream_name = "AIF3 Capture",
.channels_min = 1,
.channels_max = 384,
.rates = RATES,
.formats = FORMATS,
},
}, {
.name = "dummy-aif4",
.playback = {
.stream_name = "AIF4 Playback",
.channels_min = 1,
.channels_max = 384,
.rates = RATES,
.formats = FORMATS,
},
.capture = {
.stream_name = "AIF4 Capture",
.channels_min = 1,
.channels_max = 384,
.rates = RATES,
.formats = FORMATS,
},
}
};
static int dummy_codec_probe(struct platform_device *pdev)
{
return snd_soc_register_codec(&pdev->dev, &soc_codec_dummy,
dummy_codec_dai, ARRAY_SIZE(dummy_codec_dai));
}
static int dummy_codec_remove(struct platform_device *pdev)
{
snd_soc_unregister_codec(&pdev->dev);
return 0;
}
#ifdef CONFIG_OF
static const struct of_device_id dummy_codec_of_match[] = {
{ .compatible = "samsung,dummy-codec", },
{},
};
MODULE_DEVICE_TABLE(of, dummy_codec_of_match);
#endif /* CONFIG_OF */
static struct platform_driver dummy_codec_driver = {
.probe = dummy_codec_probe,
.remove = dummy_codec_remove,
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(dummy_codec_of_match),
},
};
module_platform_driver(dummy_codec_driver);
MODULE_AUTHOR("Yeongman Seo <yman.seo@samsung.com>");
MODULE_DESCRIPTION("Dummy codec driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:" DRV_NAME);
|