diff options
Diffstat (limited to 'Documentation/sound/alsa/soc/codec.txt')
| -rw-r--r-- | Documentation/sound/alsa/soc/codec.txt | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/Documentation/sound/alsa/soc/codec.txt b/Documentation/sound/alsa/soc/codec.txt index 37ba3a72cb76..bce23a4a7875 100644 --- a/Documentation/sound/alsa/soc/codec.txt +++ b/Documentation/sound/alsa/soc/codec.txt | |||
| @@ -27,42 +27,38 @@ ASoC Codec driver breakdown | |||
| 27 | 27 | ||
| 28 | 1 - Codec DAI and PCM configuration | 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 | PCM capabilities and operations. This struct is exported so that it can be | 31 | PCM capabilities and operations. This struct is exported so that it can be |
| 32 | registered with the core by your machine driver. | 32 | registered with the core by your machine driver. |
| 33 | 33 | ||
| 34 | e.g. | 34 | e.g. |
| 35 | 35 | ||
| 36 | struct snd_soc_codec_dai wm8731_dai = { | 36 | static struct snd_soc_dai_ops wm8731_dai_ops = { |
| 37 | .name = "WM8731", | 37 | .prepare = wm8731_pcm_prepare, |
| 38 | /* playback capabilities */ | 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, | ||
| 43 | }; | ||
| 44 | |||
| 45 | struct snd_soc_dai_driver wm8731_dai = { | ||
| 46 | .name = "wm8731-hifi", | ||
| 39 | .playback = { | 47 | .playback = { |
| 40 | .stream_name = "Playback", | 48 | .stream_name = "Playback", |
| 41 | .channels_min = 1, | 49 | .channels_min = 1, |
| 42 | .channels_max = 2, | 50 | .channels_max = 2, |
| 43 | .rates = WM8731_RATES, | 51 | .rates = WM8731_RATES, |
| 44 | .formats = WM8731_FORMATS,}, | 52 | .formats = WM8731_FORMATS,}, |
| 45 | /* capture capabilities */ | ||
| 46 | .capture = { | 53 | .capture = { |
| 47 | .stream_name = "Capture", | 54 | .stream_name = "Capture", |
| 48 | .channels_min = 1, | 55 | .channels_min = 1, |
| 49 | .channels_max = 2, | 56 | .channels_max = 2, |
| 50 | .rates = WM8731_RATES, | 57 | .rates = WM8731_RATES, |
| 51 | .formats = WM8731_FORMATS,}, | 58 | .formats = WM8731_FORMATS,}, |
| 52 | /* pcm operations - see section 4 below */ | 59 | .ops = &wm8731_dai_ops, |
| 53 | .ops = { | 60 | .symmetric_rates = 1, |
| 54 | .prepare = wm8731_pcm_prepare, | ||
| 55 | .hw_params = wm8731_hw_params, | ||
| 56 | .shutdown = wm8731_shutdown, | ||
| 57 | }, | ||
| 58 | /* DAI operations - see DAI.txt */ | ||
| 59 | .dai_ops = { | ||
| 60 | .digital_mute = wm8731_mute, | ||
| 61 | .set_sysclk = wm8731_set_dai_sysclk, | ||
| 62 | .set_fmt = wm8731_set_dai_fmt, | ||
| 63 | } | ||
| 64 | }; | 61 | }; |
| 65 | EXPORT_SYMBOL_GPL(wm8731_dai); | ||
| 66 | 62 | ||
| 67 | 63 | ||
| 68 | 2 - Codec control IO | 64 | 2 - Codec control IO |
| @@ -186,13 +182,14 @@ when the mute is applied or freed. | |||
| 186 | 182 | ||
| 187 | i.e. | 183 | i.e. |
| 188 | 184 | ||
| 189 | static int wm8974_mute(struct snd_soc_codec *codec, | 185 | static int wm8974_mute(struct snd_soc_dai *dai, int mute) |
| 190 | struct snd_soc_codec_dai *dai, int mute) | ||
| 191 | { | 186 | { |
| 192 | u16 mute_reg = wm8974_read_reg_cache(codec, WM8974_DAC) & 0xffbf; | 187 | struct snd_soc_codec *codec = dai->codec; |
| 193 | if(mute) | 188 | u16 mute_reg = snd_soc_read(codec, WM8974_DAC) & 0xffbf; |
| 194 | wm8974_write(codec, WM8974_DAC, mute_reg | 0x40); | 189 | |
| 190 | if (mute) | ||
| 191 | snd_soc_write(codec, WM8974_DAC, mute_reg | 0x40); | ||
| 195 | else | 192 | else |
| 196 | wm8974_write(codec, WM8974_DAC, mute_reg); | 193 | snd_soc_write(codec, WM8974_DAC, mute_reg); |
| 197 | return 0; | 194 | return 0; |
| 198 | } | 195 | } |
