28
28
1 - Codec DAI and PCM configuration
29
29
-----------------------------------
30
Each codec driver must have a struct snd_soc_codec_dai to define its DAI and
30
Each codec driver must have a struct snd_soc_dai_driver to define its DAI and
31
31
PCM capabilities and operations. This struct is exported so that it can be
32
32
registered with the core by your machine driver.
36
struct snd_soc_codec_dai wm8731_dai = {
38
/* playback capabilities */
36
static struct snd_soc_dai_ops wm8731_dai_ops = {
37
.prepare = wm8731_pcm_prepare,
38
.hw_params = wm8731_hw_params,
39
.shutdown = wm8731_shutdown,
40
.digital_mute = wm8731_mute,
41
.set_sysclk = wm8731_set_dai_sysclk,
42
.set_fmt = wm8731_set_dai_fmt,
45
struct snd_soc_dai_driver wm8731_dai = {
46
.name = "wm8731-hifi",
40
48
.stream_name = "Playback",
43
51
.rates = WM8731_RATES,
44
52
.formats = WM8731_FORMATS,},
45
/* capture capabilities */
47
54
.stream_name = "Capture",
50
57
.rates = WM8731_RATES,
51
58
.formats = WM8731_FORMATS,},
52
/* pcm operations - see section 4 below */
54
.prepare = wm8731_pcm_prepare,
55
.hw_params = wm8731_hw_params,
56
.shutdown = wm8731_shutdown,
58
/* DAI operations - see DAI.txt */
60
.digital_mute = wm8731_mute,
61
.set_sysclk = wm8731_set_dai_sysclk,
62
.set_fmt = wm8731_set_dai_fmt,
59
.ops = &wm8731_dai_ops,
65
EXPORT_SYMBOL_GPL(wm8731_dai);
68
64
2 - Codec control IO
189
static int wm8974_mute(struct snd_soc_codec *codec,
190
struct snd_soc_codec_dai *dai, int mute)
185
static int wm8974_mute(struct snd_soc_dai *dai, int mute)
192
u16 mute_reg = wm8974_read_reg_cache(codec, WM8974_DAC) & 0xffbf;
194
wm8974_write(codec, WM8974_DAC, mute_reg | 0x40);
187
struct snd_soc_codec *codec = dai->codec;
188
u16 mute_reg = snd_soc_read(codec, WM8974_DAC) & 0xffbf;
191
snd_soc_write(codec, WM8974_DAC, mute_reg | 0x40);
196
wm8974_write(codec, WM8974_DAC, mute_reg);
193
snd_soc_write(codec, WM8974_DAC, mute_reg);