| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1 | /* | 
|  | 2 | * wm9713.c  --  ALSA Soc WM9713 codec support | 
|  | 3 | * | 
|  | 4 | * Copyright 2006 Wolfson Microelectronics PLC. | 
| Liam Girdwood | d331124 | 2008-10-12 13:17:36 +0100 | [diff] [blame] | 5 | * Author: Liam Girdwood <lrg@slimlogic.co.uk> | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 6 | * | 
|  | 7 | *  This program is free software; you can redistribute  it and/or modify it | 
|  | 8 | *  under  the terms of  the GNU General  Public License as published by the | 
|  | 9 | *  Free Software Foundation;  either version 2 of the  License, or (at your | 
|  | 10 | *  option) any later version. | 
|  | 11 | * | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 12 | *  Features:- | 
|  | 13 | * | 
|  | 14 | *   o Support for AC97 Codec, Voice DAC and Aux DAC | 
|  | 15 | *   o Support for DAPM | 
|  | 16 | */ | 
|  | 17 |  | 
|  | 18 | #include <linux/init.h> | 
|  | 19 | #include <linux/module.h> | 
|  | 20 | #include <linux/device.h> | 
|  | 21 | #include <sound/core.h> | 
|  | 22 | #include <sound/pcm.h> | 
|  | 23 | #include <sound/ac97_codec.h> | 
|  | 24 | #include <sound/initval.h> | 
|  | 25 | #include <sound/pcm_params.h> | 
|  | 26 | #include <sound/soc.h> | 
|  | 27 | #include <sound/soc-dapm.h> | 
|  | 28 |  | 
|  | 29 | #include "wm9713.h" | 
|  | 30 |  | 
|  | 31 | #define WM9713_VERSION "0.15" | 
|  | 32 |  | 
|  | 33 | struct wm9713_priv { | 
|  | 34 | u32 pll_in; /* PLL input frequency */ | 
|  | 35 | u32 pll_out; /* PLL output frequency */ | 
|  | 36 | }; | 
|  | 37 |  | 
|  | 38 | static unsigned int ac97_read(struct snd_soc_codec *codec, | 
|  | 39 | unsigned int reg); | 
|  | 40 | static int ac97_write(struct snd_soc_codec *codec, | 
|  | 41 | unsigned int reg, unsigned int val); | 
|  | 42 |  | 
|  | 43 | /* | 
|  | 44 | * WM9713 register cache | 
|  | 45 | * Reg 0x3c bit 15 is used by touch driver. | 
|  | 46 | */ | 
|  | 47 | static const u16 wm9713_reg[] = { | 
|  | 48 | 0x6174, 0x8080, 0x8080, 0x8080, | 
|  | 49 | 0xc880, 0xe808, 0xe808, 0x0808, | 
|  | 50 | 0x00da, 0x8000, 0xd600, 0xaaa0, | 
|  | 51 | 0xaaa0, 0xaaa0, 0x0000, 0x0000, | 
|  | 52 | 0x0f0f, 0x0040, 0x0000, 0x7f00, | 
|  | 53 | 0x0405, 0x0410, 0xbb80, 0xbb80, | 
|  | 54 | 0x0000, 0xbb80, 0x0000, 0x4523, | 
|  | 55 | 0x0000, 0x2000, 0x7eff, 0xffff, | 
|  | 56 | 0x0000, 0x0000, 0x0080, 0x0000, | 
|  | 57 | 0x0000, 0x0000, 0xfffe, 0xffff, | 
|  | 58 | 0x0000, 0x0000, 0x0000, 0xfffe, | 
|  | 59 | 0x4000, 0x0000, 0x0000, 0x0000, | 
|  | 60 | 0xb032, 0x3e00, 0x0000, 0x0000, | 
|  | 61 | 0x0000, 0x0000, 0x0000, 0x0000, | 
|  | 62 | 0x0000, 0x0000, 0x0000, 0x0006, | 
|  | 63 | 0x0001, 0x0000, 0x574d, 0x4c13, | 
|  | 64 | 0x0000, 0x0000, 0x0000 | 
|  | 65 | }; | 
|  | 66 |  | 
|  | 67 | /* virtual HP mixers regs */ | 
|  | 68 | #define HPL_MIXER	0x80 | 
|  | 69 | #define HPR_MIXER	0x82 | 
|  | 70 | #define MICB_MUX	0x82 | 
|  | 71 |  | 
|  | 72 | static const char *wm9713_mic_mixer[] = {"Stereo", "Mic 1", "Mic 2", "Mute"}; | 
|  | 73 | static const char *wm9713_rec_mux[] = {"Stereo", "Left", "Right", "Mute"}; | 
|  | 74 | static const char *wm9713_rec_src[] = | 
|  | 75 | {"Mic 1", "Mic 2", "Line", "Mono In", "Headphone", "Speaker", | 
|  | 76 | "Mono Out", "Zh"}; | 
|  | 77 | static const char *wm9713_rec_gain[] = {"+1.5dB Steps", "+0.75dB Steps"}; | 
|  | 78 | static const char *wm9713_alc_select[] = {"None", "Left", "Right", "Stereo"}; | 
|  | 79 | static const char *wm9713_mono_pga[] = {"Vmid", "Zh", "Mono", "Inv", | 
|  | 80 | "Mono Vmid", "Inv Vmid"}; | 
|  | 81 | static const char *wm9713_spk_pga[] = | 
|  | 82 | {"Vmid", "Zh", "Headphone", "Speaker", "Inv", "Headphone Vmid", | 
|  | 83 | "Speaker Vmid", "Inv Vmid"}; | 
|  | 84 | static const char *wm9713_hp_pga[] = {"Vmid", "Zh", "Headphone", | 
|  | 85 | "Headphone Vmid"}; | 
|  | 86 | static const char *wm9713_out3_pga[] = {"Vmid", "Zh", "Inv 1", "Inv 1 Vmid"}; | 
|  | 87 | static const char *wm9713_out4_pga[] = {"Vmid", "Zh", "Inv 2", "Inv 2 Vmid"}; | 
|  | 88 | static const char *wm9713_dac_inv[] = | 
|  | 89 | {"Off", "Mono", "Speaker", "Left Headphone", "Right Headphone", | 
|  | 90 | "Headphone Mono", "NC", "Vmid"}; | 
|  | 91 | static const char *wm9713_bass[] = {"Linear Control", "Adaptive Boost"}; | 
|  | 92 | static const char *wm9713_ng_type[] = {"Constant Gain", "Mute"}; | 
|  | 93 | static const char *wm9713_mic_select[] = {"Mic 1", "Mic 2 A", "Mic 2 B"}; | 
|  | 94 | static const char *wm9713_micb_select[] = {"MPB", "MPA"}; | 
|  | 95 |  | 
|  | 96 | static const struct soc_enum wm9713_enum[] = { | 
|  | 97 | SOC_ENUM_SINGLE(AC97_LINE, 3, 4, wm9713_mic_mixer), /* record mic mixer 0 */ | 
|  | 98 | SOC_ENUM_SINGLE(AC97_VIDEO, 14, 4, wm9713_rec_mux), /* record mux hp 1 */ | 
|  | 99 | SOC_ENUM_SINGLE(AC97_VIDEO, 9, 4, wm9713_rec_mux),  /* record mux mono 2 */ | 
|  | 100 | SOC_ENUM_SINGLE(AC97_VIDEO, 3, 8, wm9713_rec_src),  /* record mux left 3 */ | 
|  | 101 | SOC_ENUM_SINGLE(AC97_VIDEO, 0, 8, wm9713_rec_src),  /* record mux right 4*/ | 
|  | 102 | SOC_ENUM_DOUBLE(AC97_CD, 14, 6, 2, wm9713_rec_gain), /* record step size 5 */ | 
|  | 103 | SOC_ENUM_SINGLE(AC97_PCI_SVID, 14, 4, wm9713_alc_select), /* alc source select 6*/ | 
|  | 104 | SOC_ENUM_SINGLE(AC97_REC_GAIN, 14, 4, wm9713_mono_pga), /* mono input select 7 */ | 
|  | 105 | SOC_ENUM_SINGLE(AC97_REC_GAIN, 11, 8, wm9713_spk_pga), /* speaker left input select 8 */ | 
|  | 106 | SOC_ENUM_SINGLE(AC97_REC_GAIN, 8, 8, wm9713_spk_pga), /* speaker right input select 9 */ | 
|  | 107 | SOC_ENUM_SINGLE(AC97_REC_GAIN, 6, 3, wm9713_hp_pga), /* headphone left input 10 */ | 
|  | 108 | SOC_ENUM_SINGLE(AC97_REC_GAIN, 4, 3, wm9713_hp_pga), /* headphone right input 11 */ | 
|  | 109 | SOC_ENUM_SINGLE(AC97_REC_GAIN, 2, 4, wm9713_out3_pga), /* out 3 source 12 */ | 
|  | 110 | SOC_ENUM_SINGLE(AC97_REC_GAIN, 0, 4, wm9713_out4_pga), /* out 4 source 13 */ | 
|  | 111 | SOC_ENUM_SINGLE(AC97_REC_GAIN_MIC, 13, 8, wm9713_dac_inv), /* dac invert 1 14 */ | 
|  | 112 | SOC_ENUM_SINGLE(AC97_REC_GAIN_MIC, 10, 8, wm9713_dac_inv), /* dac invert 2 15 */ | 
|  | 113 | SOC_ENUM_SINGLE(AC97_GENERAL_PURPOSE, 15, 2, wm9713_bass), /* bass control 16 */ | 
|  | 114 | SOC_ENUM_SINGLE(AC97_PCI_SVID, 5, 2, wm9713_ng_type), /* noise gate type 17 */ | 
|  | 115 | SOC_ENUM_SINGLE(AC97_3D_CONTROL, 12, 3, wm9713_mic_select), /* mic selection 18 */ | 
|  | 116 | SOC_ENUM_SINGLE(MICB_MUX, 0, 2, wm9713_micb_select), /* mic selection 19 */ | 
|  | 117 | }; | 
|  | 118 |  | 
|  | 119 | static const struct snd_kcontrol_new wm9713_snd_ac97_controls[] = { | 
|  | 120 | SOC_DOUBLE("Speaker Playback Volume", AC97_MASTER, 8, 0, 31, 1), | 
|  | 121 | SOC_DOUBLE("Speaker Playback Switch", AC97_MASTER, 15, 7, 1, 1), | 
|  | 122 | SOC_DOUBLE("Headphone Playback Volume", AC97_HEADPHONE, 8, 0, 31, 1), | 
|  | 123 | SOC_DOUBLE("Headphone Playback Switch", AC97_HEADPHONE, 15, 7, 1, 1), | 
|  | 124 | SOC_DOUBLE("Line In Volume", AC97_PC_BEEP, 8, 0, 31, 1), | 
|  | 125 | SOC_DOUBLE("PCM Playback Volume", AC97_PHONE, 8, 0, 31, 1), | 
|  | 126 | SOC_SINGLE("Mic 1 Volume", AC97_MIC, 8, 31, 1), | 
|  | 127 | SOC_SINGLE("Mic 2 Volume", AC97_MIC, 0, 31, 1), | 
|  | 128 |  | 
|  | 129 | SOC_SINGLE("Mic Boost (+20dB) Switch", AC97_LINE, 5, 1, 0), | 
|  | 130 | SOC_SINGLE("Mic Headphone Mixer Volume", AC97_LINE, 0, 7, 1), | 
|  | 131 |  | 
|  | 132 | SOC_SINGLE("Capture Switch", AC97_CD, 15, 1, 1), | 
|  | 133 | SOC_ENUM("Capture Volume Steps", wm9713_enum[5]), | 
|  | 134 | SOC_DOUBLE("Capture Volume", AC97_CD, 8, 0, 31, 0), | 
|  | 135 | SOC_SINGLE("Capture ZC Switch", AC97_CD, 7, 1, 0), | 
|  | 136 |  | 
|  | 137 | SOC_SINGLE("Capture to Headphone Volume", AC97_VIDEO, 11, 7, 1), | 
|  | 138 | SOC_SINGLE("Capture to Mono Boost (+20dB) Switch", AC97_VIDEO, 8, 1, 0), | 
|  | 139 | SOC_SINGLE("Capture ADC Boost (+20dB) Switch", AC97_VIDEO, 6, 1, 0), | 
|  | 140 |  | 
|  | 141 | SOC_SINGLE("ALC Target Volume", AC97_CODEC_CLASS_REV, 12, 15, 0), | 
|  | 142 | SOC_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0), | 
|  | 143 | SOC_SINGLE("ALC Decay Time ", AC97_CODEC_CLASS_REV, 4, 15, 0), | 
|  | 144 | SOC_SINGLE("ALC Attack Time", AC97_CODEC_CLASS_REV, 0, 15, 0), | 
|  | 145 | SOC_ENUM("ALC Function", wm9713_enum[6]), | 
|  | 146 | SOC_SINGLE("ALC Max Volume", AC97_PCI_SVID, 11, 7, 0), | 
|  | 147 | SOC_SINGLE("ALC ZC Timeout", AC97_PCI_SVID, 9, 3, 0), | 
|  | 148 | SOC_SINGLE("ALC ZC Switch", AC97_PCI_SVID, 8, 1, 0), | 
|  | 149 | SOC_SINGLE("ALC NG Switch", AC97_PCI_SVID, 7, 1, 0), | 
|  | 150 | SOC_ENUM("ALC NG Type", wm9713_enum[17]), | 
|  | 151 | SOC_SINGLE("ALC NG Threshold", AC97_PCI_SVID, 0, 31, 0), | 
|  | 152 |  | 
|  | 153 | SOC_DOUBLE("Speaker Playback ZC Switch", AC97_MASTER, 14, 6, 1, 0), | 
|  | 154 | SOC_DOUBLE("Headphone Playback ZC Switch", AC97_HEADPHONE, 14, 6, 1, 0), | 
|  | 155 |  | 
|  | 156 | SOC_SINGLE("Out4 Playback Switch", AC97_MASTER_MONO, 15, 1, 1), | 
|  | 157 | SOC_SINGLE("Out4 Playback ZC Switch", AC97_MASTER_MONO, 14, 1, 0), | 
|  | 158 | SOC_SINGLE("Out4 Playback Volume", AC97_MASTER_MONO, 8, 63, 1), | 
|  | 159 |  | 
|  | 160 | SOC_SINGLE("Out3 Playback Switch", AC97_MASTER_MONO, 7, 1, 1), | 
|  | 161 | SOC_SINGLE("Out3 Playback ZC Switch", AC97_MASTER_MONO, 6, 1, 0), | 
|  | 162 | SOC_SINGLE("Out3 Playback Volume", AC97_MASTER_MONO, 0, 63, 1), | 
|  | 163 |  | 
|  | 164 | SOC_SINGLE("Mono Capture Volume", AC97_MASTER_TONE, 8, 31, 1), | 
|  | 165 | SOC_SINGLE("Mono Playback Switch", AC97_MASTER_TONE, 7, 1, 1), | 
|  | 166 | SOC_SINGLE("Mono Playback ZC Switch", AC97_MASTER_TONE, 6, 1, 0), | 
|  | 167 | SOC_SINGLE("Mono Playback Volume", AC97_MASTER_TONE, 0, 31, 1), | 
|  | 168 |  | 
|  | 169 | SOC_SINGLE("PC Beep Playback Headphone Volume", AC97_AUX, 12, 7, 1), | 
|  | 170 | SOC_SINGLE("PC Beep Playback Speaker Volume", AC97_AUX, 8, 7, 1), | 
|  | 171 | SOC_SINGLE("PC Beep Playback Mono Volume", AC97_AUX, 4, 7, 1), | 
|  | 172 |  | 
|  | 173 | SOC_SINGLE("Voice Playback Headphone Volume", AC97_PCM, 12, 7, 1), | 
|  | 174 | SOC_SINGLE("Voice Playback Master Volume", AC97_PCM, 8, 7, 1), | 
|  | 175 | SOC_SINGLE("Voice Playback Mono Volume", AC97_PCM, 4, 7, 1), | 
|  | 176 |  | 
|  | 177 | SOC_SINGLE("Aux Playback Headphone Volume", AC97_REC_SEL, 12, 7, 1), | 
|  | 178 | SOC_SINGLE("Aux Playback Master Volume", AC97_REC_SEL, 8, 7, 1), | 
|  | 179 | SOC_SINGLE("Aux Playback Mono Volume", AC97_REC_SEL, 4, 7, 1), | 
|  | 180 |  | 
|  | 181 | SOC_ENUM("Bass Control", wm9713_enum[16]), | 
|  | 182 | SOC_SINGLE("Bass Cut-off Switch", AC97_GENERAL_PURPOSE, 12, 1, 1), | 
|  | 183 | SOC_SINGLE("Tone Cut-off Switch", AC97_GENERAL_PURPOSE, 4, 1, 1), | 
|  | 184 | SOC_SINGLE("Playback Attenuate (-6dB) Switch", AC97_GENERAL_PURPOSE, 6, 1, 0), | 
|  | 185 | SOC_SINGLE("Bass Volume", AC97_GENERAL_PURPOSE, 8, 15, 1), | 
|  | 186 | SOC_SINGLE("Tone Volume", AC97_GENERAL_PURPOSE, 0, 15, 1), | 
|  | 187 |  | 
|  | 188 | SOC_SINGLE("3D Upper Cut-off Switch", AC97_REC_GAIN_MIC, 5, 1, 0), | 
|  | 189 | SOC_SINGLE("3D Lower Cut-off Switch", AC97_REC_GAIN_MIC, 4, 1, 0), | 
|  | 190 | SOC_SINGLE("3D Depth", AC97_REC_GAIN_MIC, 0, 15, 1), | 
|  | 191 | }; | 
|  | 192 |  | 
|  | 193 | /* add non dapm controls */ | 
|  | 194 | static int wm9713_add_controls(struct snd_soc_codec *codec) | 
|  | 195 | { | 
|  | 196 | int err, i; | 
|  | 197 |  | 
|  | 198 | for (i = 0; i < ARRAY_SIZE(wm9713_snd_ac97_controls); i++) { | 
|  | 199 | err = snd_ctl_add(codec->card, | 
|  | 200 | snd_soc_cnew(&wm9713_snd_ac97_controls[i], | 
|  | 201 | codec, NULL)); | 
|  | 202 | if (err < 0) | 
|  | 203 | return err; | 
|  | 204 | } | 
|  | 205 | return 0; | 
|  | 206 | } | 
|  | 207 |  | 
|  | 208 | /* We have to create a fake left and right HP mixers because | 
|  | 209 | * the codec only has a single control that is shared by both channels. | 
|  | 210 | * This makes it impossible to determine the audio path using the current | 
|  | 211 | * register map, thus we add a new (virtual) register to help determine the | 
|  | 212 | * audio route within the device. | 
|  | 213 | */ | 
|  | 214 | static int mixer_event(struct snd_soc_dapm_widget *w, | 
|  | 215 | struct snd_kcontrol *kcontrol, int event) | 
|  | 216 | { | 
|  | 217 | u16 l, r, beep, tone, phone, rec, pcm, aux; | 
|  | 218 |  | 
|  | 219 | l = ac97_read(w->codec, HPL_MIXER); | 
|  | 220 | r = ac97_read(w->codec, HPR_MIXER); | 
|  | 221 | beep = ac97_read(w->codec, AC97_PC_BEEP); | 
|  | 222 | tone = ac97_read(w->codec, AC97_MASTER_TONE); | 
|  | 223 | phone = ac97_read(w->codec, AC97_PHONE); | 
|  | 224 | rec = ac97_read(w->codec, AC97_REC_SEL); | 
|  | 225 | pcm = ac97_read(w->codec, AC97_PCM); | 
|  | 226 | aux = ac97_read(w->codec, AC97_AUX); | 
|  | 227 |  | 
|  | 228 | if (event & SND_SOC_DAPM_PRE_REG) | 
|  | 229 | return 0; | 
|  | 230 | if ((l & 0x1) || (r & 0x1)) | 
|  | 231 | ac97_write(w->codec, AC97_PC_BEEP, beep & 0x7fff); | 
|  | 232 | else | 
|  | 233 | ac97_write(w->codec, AC97_PC_BEEP, beep | 0x8000); | 
|  | 234 |  | 
|  | 235 | if ((l & 0x2) || (r & 0x2)) | 
|  | 236 | ac97_write(w->codec, AC97_MASTER_TONE, tone & 0x7fff); | 
|  | 237 | else | 
|  | 238 | ac97_write(w->codec, AC97_MASTER_TONE, tone | 0x8000); | 
|  | 239 |  | 
|  | 240 | if ((l & 0x4) || (r & 0x4)) | 
|  | 241 | ac97_write(w->codec, AC97_PHONE, phone & 0x7fff); | 
|  | 242 | else | 
|  | 243 | ac97_write(w->codec, AC97_PHONE, phone | 0x8000); | 
|  | 244 |  | 
|  | 245 | if ((l & 0x8) || (r & 0x8)) | 
|  | 246 | ac97_write(w->codec, AC97_REC_SEL, rec & 0x7fff); | 
|  | 247 | else | 
|  | 248 | ac97_write(w->codec, AC97_REC_SEL, rec | 0x8000); | 
|  | 249 |  | 
|  | 250 | if ((l & 0x10) || (r & 0x10)) | 
|  | 251 | ac97_write(w->codec, AC97_PCM, pcm & 0x7fff); | 
|  | 252 | else | 
|  | 253 | ac97_write(w->codec, AC97_PCM, pcm | 0x8000); | 
|  | 254 |  | 
|  | 255 | if ((l & 0x20) || (r & 0x20)) | 
|  | 256 | ac97_write(w->codec, AC97_AUX, aux & 0x7fff); | 
|  | 257 | else | 
|  | 258 | ac97_write(w->codec, AC97_AUX, aux | 0x8000); | 
|  | 259 |  | 
|  | 260 | return 0; | 
|  | 261 | } | 
|  | 262 |  | 
|  | 263 | /* Left Headphone Mixers */ | 
|  | 264 | static const struct snd_kcontrol_new wm9713_hpl_mixer_controls[] = { | 
|  | 265 | SOC_DAPM_SINGLE("PC Beep Playback Switch", HPL_MIXER, 5, 1, 0), | 
|  | 266 | SOC_DAPM_SINGLE("Voice Playback Switch", HPL_MIXER, 4, 1, 0), | 
|  | 267 | SOC_DAPM_SINGLE("Aux Playback Switch", HPL_MIXER, 3, 1, 0), | 
|  | 268 | SOC_DAPM_SINGLE("PCM Playback Switch", HPL_MIXER, 2, 1, 0), | 
|  | 269 | SOC_DAPM_SINGLE("MonoIn Playback Switch", HPL_MIXER, 1, 1, 0), | 
|  | 270 | SOC_DAPM_SINGLE("Bypass Playback Switch", HPL_MIXER, 0, 1, 0), | 
|  | 271 | }; | 
|  | 272 |  | 
|  | 273 | /* Right Headphone Mixers */ | 
|  | 274 | static const struct snd_kcontrol_new wm9713_hpr_mixer_controls[] = { | 
|  | 275 | SOC_DAPM_SINGLE("PC Beep Playback Switch", HPR_MIXER, 5, 1, 0), | 
|  | 276 | SOC_DAPM_SINGLE("Voice Playback Switch", HPR_MIXER, 4, 1, 0), | 
|  | 277 | SOC_DAPM_SINGLE("Aux Playback Switch", HPR_MIXER, 3, 1, 0), | 
|  | 278 | SOC_DAPM_SINGLE("PCM Playback Switch", HPR_MIXER, 2, 1, 0), | 
|  | 279 | SOC_DAPM_SINGLE("MonoIn Playback Switch", HPR_MIXER, 1, 1, 0), | 
|  | 280 | SOC_DAPM_SINGLE("Bypass Playback Switch", HPR_MIXER, 0, 1, 0), | 
|  | 281 | }; | 
|  | 282 |  | 
|  | 283 | /* headphone capture mux */ | 
|  | 284 | static const struct snd_kcontrol_new wm9713_hp_rec_mux_controls = | 
|  | 285 | SOC_DAPM_ENUM("Route", wm9713_enum[1]); | 
|  | 286 |  | 
|  | 287 | /* headphone mic mux */ | 
|  | 288 | static const struct snd_kcontrol_new wm9713_hp_mic_mux_controls = | 
|  | 289 | SOC_DAPM_ENUM("Route", wm9713_enum[0]); | 
|  | 290 |  | 
|  | 291 | /* Speaker Mixer */ | 
|  | 292 | static const struct snd_kcontrol_new wm9713_speaker_mixer_controls[] = { | 
|  | 293 | SOC_DAPM_SINGLE("PC Beep Playback Switch", AC97_AUX, 11, 1, 1), | 
|  | 294 | SOC_DAPM_SINGLE("Voice Playback Switch", AC97_PCM, 11, 1, 1), | 
|  | 295 | SOC_DAPM_SINGLE("Aux Playback Switch", AC97_REC_SEL, 11, 1, 1), | 
|  | 296 | SOC_DAPM_SINGLE("PCM Playback Switch", AC97_PHONE, 14, 1, 1), | 
|  | 297 | SOC_DAPM_SINGLE("MonoIn Playback Switch", AC97_MASTER_TONE, 14, 1, 1), | 
|  | 298 | SOC_DAPM_SINGLE("Bypass Playback Switch", AC97_PC_BEEP, 14, 1, 1), | 
|  | 299 | }; | 
|  | 300 |  | 
|  | 301 | /* Mono Mixer */ | 
|  | 302 | static const struct snd_kcontrol_new wm9713_mono_mixer_controls[] = { | 
|  | 303 | SOC_DAPM_SINGLE("PC Beep Playback Switch", AC97_AUX, 7, 1, 1), | 
|  | 304 | SOC_DAPM_SINGLE("Voice Playback Switch", AC97_PCM, 7, 1, 1), | 
|  | 305 | SOC_DAPM_SINGLE("Aux Playback Switch", AC97_REC_SEL, 7, 1, 1), | 
|  | 306 | SOC_DAPM_SINGLE("PCM Playback Switch", AC97_PHONE, 13, 1, 1), | 
|  | 307 | SOC_DAPM_SINGLE("MonoIn Playback Switch", AC97_MASTER_TONE, 13, 1, 1), | 
|  | 308 | SOC_DAPM_SINGLE("Bypass Playback Switch", AC97_PC_BEEP, 13, 1, 1), | 
|  | 309 | SOC_DAPM_SINGLE("Mic 1 Sidetone Switch", AC97_LINE, 7, 1, 1), | 
|  | 310 | SOC_DAPM_SINGLE("Mic 2 Sidetone Switch", AC97_LINE, 6, 1, 1), | 
|  | 311 | }; | 
|  | 312 |  | 
|  | 313 | /* mono mic mux */ | 
|  | 314 | static const struct snd_kcontrol_new wm9713_mono_mic_mux_controls = | 
|  | 315 | SOC_DAPM_ENUM("Route", wm9713_enum[2]); | 
|  | 316 |  | 
|  | 317 | /* mono output mux */ | 
|  | 318 | static const struct snd_kcontrol_new wm9713_mono_mux_controls = | 
|  | 319 | SOC_DAPM_ENUM("Route", wm9713_enum[7]); | 
|  | 320 |  | 
|  | 321 | /* speaker left output mux */ | 
|  | 322 | static const struct snd_kcontrol_new wm9713_hp_spkl_mux_controls = | 
|  | 323 | SOC_DAPM_ENUM("Route", wm9713_enum[8]); | 
|  | 324 |  | 
|  | 325 | /* speaker right output mux */ | 
|  | 326 | static const struct snd_kcontrol_new wm9713_hp_spkr_mux_controls = | 
|  | 327 | SOC_DAPM_ENUM("Route", wm9713_enum[9]); | 
|  | 328 |  | 
|  | 329 | /* headphone left output mux */ | 
|  | 330 | static const struct snd_kcontrol_new wm9713_hpl_out_mux_controls = | 
|  | 331 | SOC_DAPM_ENUM("Route", wm9713_enum[10]); | 
|  | 332 |  | 
|  | 333 | /* headphone right output mux */ | 
|  | 334 | static const struct snd_kcontrol_new wm9713_hpr_out_mux_controls = | 
|  | 335 | SOC_DAPM_ENUM("Route", wm9713_enum[11]); | 
|  | 336 |  | 
|  | 337 | /* Out3 mux */ | 
|  | 338 | static const struct snd_kcontrol_new wm9713_out3_mux_controls = | 
|  | 339 | SOC_DAPM_ENUM("Route", wm9713_enum[12]); | 
|  | 340 |  | 
|  | 341 | /* Out4 mux */ | 
|  | 342 | static const struct snd_kcontrol_new wm9713_out4_mux_controls = | 
|  | 343 | SOC_DAPM_ENUM("Route", wm9713_enum[13]); | 
|  | 344 |  | 
|  | 345 | /* DAC inv mux 1 */ | 
|  | 346 | static const struct snd_kcontrol_new wm9713_dac_inv1_mux_controls = | 
|  | 347 | SOC_DAPM_ENUM("Route", wm9713_enum[14]); | 
|  | 348 |  | 
|  | 349 | /* DAC inv mux 2 */ | 
|  | 350 | static const struct snd_kcontrol_new wm9713_dac_inv2_mux_controls = | 
|  | 351 | SOC_DAPM_ENUM("Route", wm9713_enum[15]); | 
|  | 352 |  | 
|  | 353 | /* Capture source left */ | 
|  | 354 | static const struct snd_kcontrol_new wm9713_rec_srcl_mux_controls = | 
|  | 355 | SOC_DAPM_ENUM("Route", wm9713_enum[3]); | 
|  | 356 |  | 
|  | 357 | /* Capture source right */ | 
|  | 358 | static const struct snd_kcontrol_new wm9713_rec_srcr_mux_controls = | 
|  | 359 | SOC_DAPM_ENUM("Route", wm9713_enum[4]); | 
|  | 360 |  | 
|  | 361 | /* mic source */ | 
|  | 362 | static const struct snd_kcontrol_new wm9713_mic_sel_mux_controls = | 
|  | 363 | SOC_DAPM_ENUM("Route", wm9713_enum[18]); | 
|  | 364 |  | 
|  | 365 | /* mic source B virtual control */ | 
|  | 366 | static const struct snd_kcontrol_new wm9713_micb_sel_mux_controls = | 
|  | 367 | SOC_DAPM_ENUM("Route", wm9713_enum[19]); | 
|  | 368 |  | 
|  | 369 | static const struct snd_soc_dapm_widget wm9713_dapm_widgets[] = { | 
|  | 370 | SND_SOC_DAPM_MUX("Capture Headphone Mux", SND_SOC_NOPM, 0, 0, | 
|  | 371 | &wm9713_hp_rec_mux_controls), | 
|  | 372 | SND_SOC_DAPM_MUX("Sidetone Mux", SND_SOC_NOPM, 0, 0, | 
|  | 373 | &wm9713_hp_mic_mux_controls), | 
|  | 374 | SND_SOC_DAPM_MUX("Capture Mono Mux", SND_SOC_NOPM, 0, 0, | 
|  | 375 | &wm9713_mono_mic_mux_controls), | 
|  | 376 | SND_SOC_DAPM_MUX("Mono Out Mux", SND_SOC_NOPM, 0, 0, | 
|  | 377 | &wm9713_mono_mux_controls), | 
|  | 378 | SND_SOC_DAPM_MUX("Left Speaker Out Mux", SND_SOC_NOPM, 0, 0, | 
|  | 379 | &wm9713_hp_spkl_mux_controls), | 
|  | 380 | SND_SOC_DAPM_MUX("Right Speaker Out Mux", SND_SOC_NOPM, 0, 0, | 
|  | 381 | &wm9713_hp_spkr_mux_controls), | 
|  | 382 | SND_SOC_DAPM_MUX("Left Headphone Out Mux", SND_SOC_NOPM, 0, 0, | 
|  | 383 | &wm9713_hpl_out_mux_controls), | 
|  | 384 | SND_SOC_DAPM_MUX("Right Headphone Out Mux", SND_SOC_NOPM, 0, 0, | 
|  | 385 | &wm9713_hpr_out_mux_controls), | 
|  | 386 | SND_SOC_DAPM_MUX("Out 3 Mux", SND_SOC_NOPM, 0, 0, | 
|  | 387 | &wm9713_out3_mux_controls), | 
|  | 388 | SND_SOC_DAPM_MUX("Out 4 Mux", SND_SOC_NOPM, 0, 0, | 
|  | 389 | &wm9713_out4_mux_controls), | 
|  | 390 | SND_SOC_DAPM_MUX("DAC Inv Mux 1", SND_SOC_NOPM, 0, 0, | 
|  | 391 | &wm9713_dac_inv1_mux_controls), | 
|  | 392 | SND_SOC_DAPM_MUX("DAC Inv Mux 2", SND_SOC_NOPM, 0, 0, | 
|  | 393 | &wm9713_dac_inv2_mux_controls), | 
|  | 394 | SND_SOC_DAPM_MUX("Left Capture Source", SND_SOC_NOPM, 0, 0, | 
|  | 395 | &wm9713_rec_srcl_mux_controls), | 
|  | 396 | SND_SOC_DAPM_MUX("Right Capture Source", SND_SOC_NOPM, 0, 0, | 
|  | 397 | &wm9713_rec_srcr_mux_controls), | 
|  | 398 | SND_SOC_DAPM_MUX("Mic A Source", SND_SOC_NOPM, 0, 0, | 
|  | 399 | &wm9713_mic_sel_mux_controls), | 
|  | 400 | SND_SOC_DAPM_MUX("Mic B Source", SND_SOC_NOPM, 0, 0, | 
|  | 401 | &wm9713_micb_sel_mux_controls), | 
|  | 402 | SND_SOC_DAPM_MIXER_E("Left HP Mixer", AC97_EXTENDED_MID, 3, 1, | 
|  | 403 | &wm9713_hpl_mixer_controls[0], ARRAY_SIZE(wm9713_hpl_mixer_controls), | 
|  | 404 | mixer_event, SND_SOC_DAPM_POST_REG), | 
|  | 405 | SND_SOC_DAPM_MIXER_E("Right HP Mixer", AC97_EXTENDED_MID, 2, 1, | 
|  | 406 | &wm9713_hpr_mixer_controls[0], ARRAY_SIZE(wm9713_hpr_mixer_controls), | 
|  | 407 | mixer_event, SND_SOC_DAPM_POST_REG), | 
|  | 408 | SND_SOC_DAPM_MIXER("Mono Mixer", AC97_EXTENDED_MID, 0, 1, | 
|  | 409 | &wm9713_mono_mixer_controls[0], ARRAY_SIZE(wm9713_mono_mixer_controls)), | 
|  | 410 | SND_SOC_DAPM_MIXER("Speaker Mixer", AC97_EXTENDED_MID, 1, 1, | 
|  | 411 | &wm9713_speaker_mixer_controls[0], | 
|  | 412 | ARRAY_SIZE(wm9713_speaker_mixer_controls)), | 
|  | 413 | SND_SOC_DAPM_DAC("Left DAC", "Left HiFi Playback", AC97_EXTENDED_MID, 7, 1), | 
|  | 414 | SND_SOC_DAPM_DAC("Right DAC", "Right HiFi Playback", AC97_EXTENDED_MID, 6, 1), | 
|  | 415 | SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), | 
|  | 416 | SND_SOC_DAPM_MIXER("HP Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), | 
|  | 417 | SND_SOC_DAPM_MIXER("Line Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), | 
|  | 418 | SND_SOC_DAPM_MIXER("Capture Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), | 
|  | 419 | SND_SOC_DAPM_DAC("Voice DAC", "Voice Playback", AC97_EXTENDED_MID, 12, 1), | 
|  | 420 | SND_SOC_DAPM_DAC("Aux DAC", "Aux Playback", AC97_EXTENDED_MID, 11, 1), | 
| Mark Brown | ccbc301 | 2008-09-15 15:51:13 +0100 | [diff] [blame] | 421 | SND_SOC_DAPM_PGA("Left ADC", AC97_EXTENDED_MID, 5, 1, NULL, 0), | 
|  | 422 | SND_SOC_DAPM_PGA("Right ADC", AC97_EXTENDED_MID, 4, 1, NULL, 0), | 
|  | 423 | SND_SOC_DAPM_ADC("Left HiFi ADC", "Left HiFi Capture", SND_SOC_NOPM, 0, 0), | 
|  | 424 | SND_SOC_DAPM_ADC("Right HiFi ADC", "Right HiFi Capture", SND_SOC_NOPM, 0, 0), | 
|  | 425 | SND_SOC_DAPM_ADC("Left Voice ADC", "Left Voice Capture", SND_SOC_NOPM, 0, 0), | 
|  | 426 | SND_SOC_DAPM_ADC("Right Voice ADC", "Right Voice Capture", SND_SOC_NOPM, 0, 0), | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 427 | SND_SOC_DAPM_PGA("Left Headphone", AC97_EXTENDED_MSTATUS, 10, 1, NULL, 0), | 
|  | 428 | SND_SOC_DAPM_PGA("Right Headphone", AC97_EXTENDED_MSTATUS, 9, 1, NULL, 0), | 
|  | 429 | SND_SOC_DAPM_PGA("Left Speaker", AC97_EXTENDED_MSTATUS, 8, 1, NULL, 0), | 
|  | 430 | SND_SOC_DAPM_PGA("Right Speaker", AC97_EXTENDED_MSTATUS, 7, 1, NULL, 0), | 
|  | 431 | SND_SOC_DAPM_PGA("Out 3", AC97_EXTENDED_MSTATUS, 11, 1, NULL, 0), | 
|  | 432 | SND_SOC_DAPM_PGA("Out 4", AC97_EXTENDED_MSTATUS, 12, 1, NULL, 0), | 
|  | 433 | SND_SOC_DAPM_PGA("Mono Out", AC97_EXTENDED_MSTATUS, 13, 1, NULL, 0), | 
|  | 434 | SND_SOC_DAPM_PGA("Left Line In", AC97_EXTENDED_MSTATUS, 6, 1, NULL, 0), | 
|  | 435 | SND_SOC_DAPM_PGA("Right Line In", AC97_EXTENDED_MSTATUS, 5, 1, NULL, 0), | 
|  | 436 | SND_SOC_DAPM_PGA("Mono In", AC97_EXTENDED_MSTATUS, 4, 1, NULL, 0), | 
|  | 437 | SND_SOC_DAPM_PGA("Mic A PGA", AC97_EXTENDED_MSTATUS, 3, 1, NULL, 0), | 
|  | 438 | SND_SOC_DAPM_PGA("Mic B PGA", AC97_EXTENDED_MSTATUS, 2, 1, NULL, 0), | 
|  | 439 | SND_SOC_DAPM_PGA("Mic A Pre Amp", AC97_EXTENDED_MSTATUS, 1, 1, NULL, 0), | 
|  | 440 | SND_SOC_DAPM_PGA("Mic B Pre Amp", AC97_EXTENDED_MSTATUS, 0, 1, NULL, 0), | 
|  | 441 | SND_SOC_DAPM_MICBIAS("Mic Bias", AC97_EXTENDED_MSTATUS, 14, 1), | 
|  | 442 | SND_SOC_DAPM_OUTPUT("MONO"), | 
|  | 443 | SND_SOC_DAPM_OUTPUT("HPL"), | 
|  | 444 | SND_SOC_DAPM_OUTPUT("HPR"), | 
|  | 445 | SND_SOC_DAPM_OUTPUT("SPKL"), | 
|  | 446 | SND_SOC_DAPM_OUTPUT("SPKR"), | 
|  | 447 | SND_SOC_DAPM_OUTPUT("OUT3"), | 
|  | 448 | SND_SOC_DAPM_OUTPUT("OUT4"), | 
|  | 449 | SND_SOC_DAPM_INPUT("LINEL"), | 
|  | 450 | SND_SOC_DAPM_INPUT("LINER"), | 
|  | 451 | SND_SOC_DAPM_INPUT("MONOIN"), | 
|  | 452 | SND_SOC_DAPM_INPUT("PCBEEP"), | 
|  | 453 | SND_SOC_DAPM_INPUT("MIC1"), | 
|  | 454 | SND_SOC_DAPM_INPUT("MIC2A"), | 
|  | 455 | SND_SOC_DAPM_INPUT("MIC2B"), | 
|  | 456 | SND_SOC_DAPM_VMID("VMID"), | 
|  | 457 | }; | 
|  | 458 |  | 
| Mark Brown | a65f056 | 2008-05-13 14:54:43 +0200 | [diff] [blame] | 459 | static const struct snd_soc_dapm_route audio_map[] = { | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 460 | /* left HP mixer */ | 
|  | 461 | {"Left HP Mixer", "PC Beep Playback Switch", "PCBEEP"}, | 
|  | 462 | {"Left HP Mixer", "Voice Playback Switch",   "Voice DAC"}, | 
|  | 463 | {"Left HP Mixer", "Aux Playback Switch",     "Aux DAC"}, | 
|  | 464 | {"Left HP Mixer", "Bypass Playback Switch",  "Left Line In"}, | 
|  | 465 | {"Left HP Mixer", "PCM Playback Switch",     "Left DAC"}, | 
|  | 466 | {"Left HP Mixer", "MonoIn Playback Switch",  "Mono In"}, | 
|  | 467 | {"Left HP Mixer", NULL,  "Capture Headphone Mux"}, | 
|  | 468 |  | 
|  | 469 | /* right HP mixer */ | 
|  | 470 | {"Right HP Mixer", "PC Beep Playback Switch", "PCBEEP"}, | 
|  | 471 | {"Right HP Mixer", "Voice Playback Switch",   "Voice DAC"}, | 
|  | 472 | {"Right HP Mixer", "Aux Playback Switch",     "Aux DAC"}, | 
|  | 473 | {"Right HP Mixer", "Bypass Playback Switch",  "Right Line In"}, | 
|  | 474 | {"Right HP Mixer", "PCM Playback Switch",     "Right DAC"}, | 
|  | 475 | {"Right HP Mixer", "MonoIn Playback Switch",  "Mono In"}, | 
|  | 476 | {"Right HP Mixer", NULL,  "Capture Headphone Mux"}, | 
|  | 477 |  | 
|  | 478 | /* virtual mixer - mixes left & right channels for spk and mono */ | 
|  | 479 | {"AC97 Mixer", NULL, "Left DAC"}, | 
|  | 480 | {"AC97 Mixer", NULL, "Right DAC"}, | 
|  | 481 | {"Line Mixer", NULL, "Right Line In"}, | 
|  | 482 | {"Line Mixer", NULL, "Left Line In"}, | 
|  | 483 | {"HP Mixer", NULL, "Left HP Mixer"}, | 
|  | 484 | {"HP Mixer", NULL, "Right HP Mixer"}, | 
|  | 485 | {"Capture Mixer", NULL, "Left Capture Source"}, | 
|  | 486 | {"Capture Mixer", NULL, "Right Capture Source"}, | 
|  | 487 |  | 
|  | 488 | /* speaker mixer */ | 
|  | 489 | {"Speaker Mixer", "PC Beep Playback Switch", "PCBEEP"}, | 
|  | 490 | {"Speaker Mixer", "Voice Playback Switch",   "Voice DAC"}, | 
|  | 491 | {"Speaker Mixer", "Aux Playback Switch",     "Aux DAC"}, | 
|  | 492 | {"Speaker Mixer", "Bypass Playback Switch",  "Line Mixer"}, | 
|  | 493 | {"Speaker Mixer", "PCM Playback Switch",     "AC97 Mixer"}, | 
|  | 494 | {"Speaker Mixer", "MonoIn Playback Switch",  "Mono In"}, | 
|  | 495 |  | 
|  | 496 | /* mono mixer */ | 
|  | 497 | {"Mono Mixer", "PC Beep Playback Switch", "PCBEEP"}, | 
|  | 498 | {"Mono Mixer", "Voice Playback Switch",   "Voice DAC"}, | 
|  | 499 | {"Mono Mixer", "Aux Playback Switch",     "Aux DAC"}, | 
|  | 500 | {"Mono Mixer", "Bypass Playback Switch",  "Line Mixer"}, | 
|  | 501 | {"Mono Mixer", "PCM Playback Switch",     "AC97 Mixer"}, | 
| Robert Jarzmik | c0bbf48 | 2008-03-18 12:08:35 +0100 | [diff] [blame] | 502 | {"Mono Mixer", "Mic 1 Sidetone Switch", "Mic A PGA"}, | 
|  | 503 | {"Mono Mixer", "Mic 2 Sidetone Switch", "Mic B PGA"}, | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 504 | {"Mono Mixer", NULL,  "Capture Mono Mux"}, | 
|  | 505 |  | 
|  | 506 | /* DAC inv mux 1 */ | 
|  | 507 | {"DAC Inv Mux 1", "Mono", "Mono Mixer"}, | 
|  | 508 | {"DAC Inv Mux 1", "Speaker", "Speaker Mixer"}, | 
|  | 509 | {"DAC Inv Mux 1", "Left Headphone", "Left HP Mixer"}, | 
|  | 510 | {"DAC Inv Mux 1", "Right Headphone", "Right HP Mixer"}, | 
|  | 511 | {"DAC Inv Mux 1", "Headphone Mono", "HP Mixer"}, | 
|  | 512 |  | 
|  | 513 | /* DAC inv mux 2 */ | 
|  | 514 | {"DAC Inv Mux 2", "Mono", "Mono Mixer"}, | 
|  | 515 | {"DAC Inv Mux 2", "Speaker", "Speaker Mixer"}, | 
|  | 516 | {"DAC Inv Mux 2", "Left Headphone", "Left HP Mixer"}, | 
|  | 517 | {"DAC Inv Mux 2", "Right Headphone", "Right HP Mixer"}, | 
|  | 518 | {"DAC Inv Mux 2", "Headphone Mono", "HP Mixer"}, | 
|  | 519 |  | 
|  | 520 | /* headphone left mux */ | 
|  | 521 | {"Left Headphone Out Mux", "Headphone", "Left HP Mixer"}, | 
|  | 522 |  | 
|  | 523 | /* headphone right mux */ | 
|  | 524 | {"Right Headphone Out Mux", "Headphone", "Right HP Mixer"}, | 
|  | 525 |  | 
|  | 526 | /* speaker left mux */ | 
|  | 527 | {"Left Speaker Out Mux", "Headphone", "Left HP Mixer"}, | 
|  | 528 | {"Left Speaker Out Mux", "Speaker", "Speaker Mixer"}, | 
|  | 529 | {"Left Speaker Out Mux", "Inv", "DAC Inv Mux 1"}, | 
|  | 530 |  | 
|  | 531 | /* speaker right mux */ | 
|  | 532 | {"Right Speaker Out Mux", "Headphone", "Right HP Mixer"}, | 
|  | 533 | {"Right Speaker Out Mux", "Speaker", "Speaker Mixer"}, | 
|  | 534 | {"Right Speaker Out Mux", "Inv", "DAC Inv Mux 2"}, | 
|  | 535 |  | 
|  | 536 | /* mono mux */ | 
|  | 537 | {"Mono Out Mux", "Mono", "Mono Mixer"}, | 
|  | 538 | {"Mono Out Mux", "Inv", "DAC Inv Mux 1"}, | 
|  | 539 |  | 
|  | 540 | /* out 3 mux */ | 
|  | 541 | {"Out 3 Mux", "Inv 1", "DAC Inv Mux 1"}, | 
|  | 542 |  | 
|  | 543 | /* out 4 mux */ | 
|  | 544 | {"Out 4 Mux", "Inv 2", "DAC Inv Mux 2"}, | 
|  | 545 |  | 
|  | 546 | /* output pga */ | 
|  | 547 | {"HPL", NULL, "Left Headphone"}, | 
|  | 548 | {"Left Headphone", NULL, "Left Headphone Out Mux"}, | 
|  | 549 | {"HPR", NULL, "Right Headphone"}, | 
|  | 550 | {"Right Headphone", NULL, "Right Headphone Out Mux"}, | 
|  | 551 | {"OUT3", NULL, "Out 3"}, | 
|  | 552 | {"Out 3", NULL, "Out 3 Mux"}, | 
|  | 553 | {"OUT4", NULL, "Out 4"}, | 
|  | 554 | {"Out 4", NULL, "Out 4 Mux"}, | 
|  | 555 | {"SPKL", NULL, "Left Speaker"}, | 
|  | 556 | {"Left Speaker", NULL, "Left Speaker Out Mux"}, | 
|  | 557 | {"SPKR", NULL, "Right Speaker"}, | 
|  | 558 | {"Right Speaker", NULL, "Right Speaker Out Mux"}, | 
|  | 559 | {"MONO", NULL, "Mono Out"}, | 
|  | 560 | {"Mono Out", NULL, "Mono Out Mux"}, | 
|  | 561 |  | 
|  | 562 | /* input pga */ | 
|  | 563 | {"Left Line In", NULL, "LINEL"}, | 
|  | 564 | {"Right Line In", NULL, "LINER"}, | 
|  | 565 | {"Mono In", NULL, "MONOIN"}, | 
|  | 566 | {"Mic A PGA", NULL, "Mic A Pre Amp"}, | 
|  | 567 | {"Mic B PGA", NULL, "Mic B Pre Amp"}, | 
|  | 568 |  | 
|  | 569 | /* left capture select */ | 
|  | 570 | {"Left Capture Source", "Mic 1", "Mic A Pre Amp"}, | 
|  | 571 | {"Left Capture Source", "Mic 2", "Mic B Pre Amp"}, | 
|  | 572 | {"Left Capture Source", "Line", "LINEL"}, | 
|  | 573 | {"Left Capture Source", "Mono In", "MONOIN"}, | 
|  | 574 | {"Left Capture Source", "Headphone", "Left HP Mixer"}, | 
|  | 575 | {"Left Capture Source", "Speaker", "Speaker Mixer"}, | 
|  | 576 | {"Left Capture Source", "Mono Out", "Mono Mixer"}, | 
|  | 577 |  | 
|  | 578 | /* right capture select */ | 
|  | 579 | {"Right Capture Source", "Mic 1", "Mic A Pre Amp"}, | 
|  | 580 | {"Right Capture Source", "Mic 2", "Mic B Pre Amp"}, | 
|  | 581 | {"Right Capture Source", "Line", "LINER"}, | 
|  | 582 | {"Right Capture Source", "Mono In", "MONOIN"}, | 
|  | 583 | {"Right Capture Source", "Headphone", "Right HP Mixer"}, | 
|  | 584 | {"Right Capture Source", "Speaker", "Speaker Mixer"}, | 
|  | 585 | {"Right Capture Source", "Mono Out", "Mono Mixer"}, | 
|  | 586 |  | 
|  | 587 | /* left ADC */ | 
|  | 588 | {"Left ADC", NULL, "Left Capture Source"}, | 
| Mark Brown | ccbc301 | 2008-09-15 15:51:13 +0100 | [diff] [blame] | 589 | {"Left Voice ADC", NULL, "Left ADC"}, | 
|  | 590 | {"Left HiFi ADC", NULL, "Left ADC"}, | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 591 |  | 
|  | 592 | /* right ADC */ | 
|  | 593 | {"Right ADC", NULL, "Right Capture Source"}, | 
| Mark Brown | ccbc301 | 2008-09-15 15:51:13 +0100 | [diff] [blame] | 594 | {"Right Voice ADC", NULL, "Right ADC"}, | 
|  | 595 | {"Right HiFi ADC", NULL, "Right ADC"}, | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 596 |  | 
|  | 597 | /* mic */ | 
|  | 598 | {"Mic A Pre Amp", NULL, "Mic A Source"}, | 
|  | 599 | {"Mic A Source", "Mic 1", "MIC1"}, | 
|  | 600 | {"Mic A Source", "Mic 2 A", "MIC2A"}, | 
|  | 601 | {"Mic A Source", "Mic 2 B", "Mic B Source"}, | 
|  | 602 | {"Mic B Pre Amp", "MPB", "Mic B Source"}, | 
|  | 603 | {"Mic B Source", NULL, "MIC2B"}, | 
|  | 604 |  | 
|  | 605 | /* headphone capture */ | 
|  | 606 | {"Capture Headphone Mux", "Stereo", "Capture Mixer"}, | 
|  | 607 | {"Capture Headphone Mux", "Left", "Left Capture Source"}, | 
|  | 608 | {"Capture Headphone Mux", "Right", "Right Capture Source"}, | 
|  | 609 |  | 
|  | 610 | /* mono capture */ | 
|  | 611 | {"Capture Mono Mux", "Stereo", "Capture Mixer"}, | 
|  | 612 | {"Capture Mono Mux", "Left", "Left Capture Source"}, | 
|  | 613 | {"Capture Mono Mux", "Right", "Right Capture Source"}, | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 614 | }; | 
|  | 615 |  | 
|  | 616 | static int wm9713_add_widgets(struct snd_soc_codec *codec) | 
|  | 617 | { | 
| Mark Brown | a65f056 | 2008-05-13 14:54:43 +0200 | [diff] [blame] | 618 | snd_soc_dapm_new_controls(codec, wm9713_dapm_widgets, | 
|  | 619 | ARRAY_SIZE(wm9713_dapm_widgets)); | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 620 |  | 
| Mark Brown | a65f056 | 2008-05-13 14:54:43 +0200 | [diff] [blame] | 621 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 622 |  | 
|  | 623 | snd_soc_dapm_new_widgets(codec); | 
|  | 624 | return 0; | 
|  | 625 | } | 
|  | 626 |  | 
|  | 627 | static unsigned int ac97_read(struct snd_soc_codec *codec, | 
|  | 628 | unsigned int reg) | 
|  | 629 | { | 
|  | 630 | u16 *cache = codec->reg_cache; | 
|  | 631 |  | 
|  | 632 | if (reg == AC97_RESET || reg == AC97_GPIO_STATUS || | 
|  | 633 | reg == AC97_VENDOR_ID1 || reg == AC97_VENDOR_ID2 || | 
|  | 634 | reg == AC97_CD) | 
|  | 635 | return soc_ac97_ops.read(codec->ac97, reg); | 
|  | 636 | else { | 
|  | 637 | reg = reg >> 1; | 
|  | 638 |  | 
|  | 639 | if (reg > (ARRAY_SIZE(wm9713_reg))) | 
|  | 640 | return -EIO; | 
|  | 641 |  | 
|  | 642 | return cache[reg]; | 
|  | 643 | } | 
|  | 644 | } | 
|  | 645 |  | 
|  | 646 | static int ac97_write(struct snd_soc_codec *codec, unsigned int reg, | 
|  | 647 | unsigned int val) | 
|  | 648 | { | 
|  | 649 | u16 *cache = codec->reg_cache; | 
|  | 650 | if (reg < 0x7c) | 
|  | 651 | soc_ac97_ops.write(codec->ac97, reg, val); | 
|  | 652 | reg = reg >> 1; | 
|  | 653 | if (reg <= (ARRAY_SIZE(wm9713_reg))) | 
|  | 654 | cache[reg] = val; | 
|  | 655 |  | 
|  | 656 | return 0; | 
|  | 657 | } | 
|  | 658 |  | 
|  | 659 | /* PLL divisors */ | 
|  | 660 | struct _pll_div { | 
|  | 661 | u32 divsel:1; | 
|  | 662 | u32 divctl:1; | 
|  | 663 | u32 lf:1; | 
|  | 664 | u32 n:4; | 
|  | 665 | u32 k:24; | 
|  | 666 | }; | 
|  | 667 |  | 
|  | 668 | /* The size in bits of the PLL divide multiplied by 10 | 
|  | 669 | * to allow rounding later */ | 
|  | 670 | #define FIXED_PLL_SIZE ((1 << 22) * 10) | 
|  | 671 |  | 
|  | 672 | static void pll_factors(struct _pll_div *pll_div, unsigned int source) | 
|  | 673 | { | 
|  | 674 | u64 Kpart; | 
|  | 675 | unsigned int K, Ndiv, Nmod, target; | 
|  | 676 |  | 
|  | 677 | /* The the PLL output is always 98.304MHz. */ | 
|  | 678 | target = 98304000; | 
|  | 679 |  | 
|  | 680 | /* If the input frequency is over 14.4MHz then scale it down. */ | 
|  | 681 | if (source > 14400000) { | 
|  | 682 | source >>= 1; | 
|  | 683 | pll_div->divsel = 1; | 
|  | 684 |  | 
|  | 685 | if (source > 14400000) { | 
|  | 686 | source >>= 1; | 
|  | 687 | pll_div->divctl = 1; | 
|  | 688 | } else | 
|  | 689 | pll_div->divctl = 0; | 
|  | 690 |  | 
|  | 691 | } else { | 
|  | 692 | pll_div->divsel = 0; | 
|  | 693 | pll_div->divctl = 0; | 
|  | 694 | } | 
|  | 695 |  | 
|  | 696 | /* Low frequency sources require an additional divide in the | 
|  | 697 | * loop. | 
|  | 698 | */ | 
|  | 699 | if (source < 8192000) { | 
|  | 700 | pll_div->lf = 1; | 
|  | 701 | target >>= 2; | 
|  | 702 | } else | 
|  | 703 | pll_div->lf = 0; | 
|  | 704 |  | 
|  | 705 | Ndiv = target / source; | 
|  | 706 | if ((Ndiv < 5) || (Ndiv > 12)) | 
|  | 707 | printk(KERN_WARNING | 
|  | 708 | "WM9713 PLL N value %d out of recommended range!\n", | 
|  | 709 | Ndiv); | 
|  | 710 |  | 
|  | 711 | pll_div->n = Ndiv; | 
|  | 712 | Nmod = target % source; | 
|  | 713 | Kpart = FIXED_PLL_SIZE * (long long)Nmod; | 
|  | 714 |  | 
|  | 715 | do_div(Kpart, source); | 
|  | 716 |  | 
|  | 717 | K = Kpart & 0xFFFFFFFF; | 
|  | 718 |  | 
|  | 719 | /* Check if we need to round */ | 
|  | 720 | if ((K % 10) >= 5) | 
|  | 721 | K += 5; | 
|  | 722 |  | 
|  | 723 | /* Move down to proper range now rounding is done */ | 
|  | 724 | K /= 10; | 
|  | 725 |  | 
|  | 726 | pll_div->k = K; | 
|  | 727 | } | 
|  | 728 |  | 
|  | 729 | /** | 
|  | 730 | * Please note that changing the PLL input frequency may require | 
|  | 731 | * resynchronisation with the AC97 controller. | 
|  | 732 | */ | 
|  | 733 | static int wm9713_set_pll(struct snd_soc_codec *codec, | 
|  | 734 | int pll_id, unsigned int freq_in, unsigned int freq_out) | 
|  | 735 | { | 
|  | 736 | struct wm9713_priv *wm9713 = codec->private_data; | 
|  | 737 | u16 reg, reg2; | 
|  | 738 | struct _pll_div pll_div; | 
|  | 739 |  | 
|  | 740 | /* turn PLL off ? */ | 
|  | 741 | if (freq_in == 0 || freq_out == 0) { | 
|  | 742 | /* disable PLL power and select ext source */ | 
|  | 743 | reg = ac97_read(codec, AC97_HANDSET_RATE); | 
|  | 744 | ac97_write(codec, AC97_HANDSET_RATE, reg | 0x0080); | 
|  | 745 | reg = ac97_read(codec, AC97_EXTENDED_MID); | 
|  | 746 | ac97_write(codec, AC97_EXTENDED_MID, reg | 0x0200); | 
|  | 747 | wm9713->pll_out = 0; | 
|  | 748 | return 0; | 
|  | 749 | } | 
|  | 750 |  | 
|  | 751 | pll_factors(&pll_div, freq_in); | 
|  | 752 |  | 
|  | 753 | if (pll_div.k == 0) { | 
|  | 754 | reg = (pll_div.n << 12) | (pll_div.lf << 11) | | 
|  | 755 | (pll_div.divsel << 9) | (pll_div.divctl << 8); | 
|  | 756 | ac97_write(codec, AC97_LINE1_LEVEL, reg); | 
|  | 757 | } else { | 
|  | 758 | /* write the fractional k to the reg 0x46 pages */ | 
|  | 759 | reg2 = (pll_div.n << 12) | (pll_div.lf << 11) | (1 << 10) | | 
|  | 760 | (pll_div.divsel << 9) | (pll_div.divctl << 8); | 
|  | 761 |  | 
|  | 762 | /* K [21:20] */ | 
|  | 763 | reg = reg2 | (0x5 << 4) | (pll_div.k >> 20); | 
|  | 764 | ac97_write(codec, AC97_LINE1_LEVEL, reg); | 
|  | 765 |  | 
|  | 766 | /* K [19:16] */ | 
|  | 767 | reg = reg2 | (0x4 << 4) | ((pll_div.k >> 16) & 0xf); | 
|  | 768 | ac97_write(codec, AC97_LINE1_LEVEL, reg); | 
|  | 769 |  | 
|  | 770 | /* K [15:12] */ | 
|  | 771 | reg = reg2 | (0x3 << 4) | ((pll_div.k >> 12) & 0xf); | 
|  | 772 | ac97_write(codec, AC97_LINE1_LEVEL, reg); | 
|  | 773 |  | 
|  | 774 | /* K [11:8] */ | 
|  | 775 | reg = reg2 | (0x2 << 4) | ((pll_div.k >> 8) & 0xf); | 
|  | 776 | ac97_write(codec, AC97_LINE1_LEVEL, reg); | 
|  | 777 |  | 
|  | 778 | /* K [7:4] */ | 
|  | 779 | reg = reg2 | (0x1 << 4) | ((pll_div.k >> 4) & 0xf); | 
|  | 780 | ac97_write(codec, AC97_LINE1_LEVEL, reg); | 
|  | 781 |  | 
|  | 782 | reg = reg2 | (0x0 << 4) | (pll_div.k & 0xf); /* K [3:0] */ | 
|  | 783 | ac97_write(codec, AC97_LINE1_LEVEL, reg); | 
|  | 784 | } | 
|  | 785 |  | 
|  | 786 | /* turn PLL on and select as source */ | 
|  | 787 | reg = ac97_read(codec, AC97_EXTENDED_MID); | 
|  | 788 | ac97_write(codec, AC97_EXTENDED_MID, reg & 0xfdff); | 
|  | 789 | reg = ac97_read(codec, AC97_HANDSET_RATE); | 
|  | 790 | ac97_write(codec, AC97_HANDSET_RATE, reg & 0xff7f); | 
|  | 791 | wm9713->pll_out = freq_out; | 
|  | 792 | wm9713->pll_in = freq_in; | 
|  | 793 |  | 
|  | 794 | /* wait 10ms AC97 link frames for the link to stabilise */ | 
|  | 795 | schedule_timeout_interruptible(msecs_to_jiffies(10)); | 
|  | 796 | return 0; | 
|  | 797 | } | 
|  | 798 |  | 
| Liam Girdwood | e550e17 | 2008-07-07 16:07:52 +0100 | [diff] [blame] | 799 | static int wm9713_set_dai_pll(struct snd_soc_dai *codec_dai, | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 800 | int pll_id, unsigned int freq_in, unsigned int freq_out) | 
|  | 801 | { | 
|  | 802 | struct snd_soc_codec *codec = codec_dai->codec; | 
|  | 803 | return wm9713_set_pll(codec, pll_id, freq_in, freq_out); | 
|  | 804 | } | 
|  | 805 |  | 
|  | 806 | /* | 
|  | 807 | * Tristate the PCM DAI lines, tristate can be disabled by calling | 
|  | 808 | * wm9713_set_dai_fmt() | 
|  | 809 | */ | 
| Liam Girdwood | e550e17 | 2008-07-07 16:07:52 +0100 | [diff] [blame] | 810 | static int wm9713_set_dai_tristate(struct snd_soc_dai *codec_dai, | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 811 | int tristate) | 
|  | 812 | { | 
|  | 813 | struct snd_soc_codec *codec = codec_dai->codec; | 
|  | 814 | u16 reg = ac97_read(codec, AC97_CENTER_LFE_MASTER) & 0x9fff; | 
|  | 815 |  | 
|  | 816 | if (tristate) | 
|  | 817 | ac97_write(codec, AC97_CENTER_LFE_MASTER, reg); | 
|  | 818 |  | 
|  | 819 | return 0; | 
|  | 820 | } | 
|  | 821 |  | 
|  | 822 | /* | 
|  | 823 | * Configure WM9713 clock dividers. | 
|  | 824 | * Voice DAC needs 256 FS | 
|  | 825 | */ | 
| Liam Girdwood | e550e17 | 2008-07-07 16:07:52 +0100 | [diff] [blame] | 826 | static int wm9713_set_dai_clkdiv(struct snd_soc_dai *codec_dai, | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 827 | int div_id, int div) | 
|  | 828 | { | 
|  | 829 | struct snd_soc_codec *codec = codec_dai->codec; | 
|  | 830 | u16 reg; | 
|  | 831 |  | 
|  | 832 | switch (div_id) { | 
|  | 833 | case WM9713_PCMCLK_DIV: | 
|  | 834 | reg = ac97_read(codec, AC97_HANDSET_RATE) & 0xf0ff; | 
|  | 835 | ac97_write(codec, AC97_HANDSET_RATE, reg | div); | 
|  | 836 | break; | 
|  | 837 | case WM9713_CLKA_MULT: | 
|  | 838 | reg = ac97_read(codec, AC97_HANDSET_RATE) & 0xfffd; | 
|  | 839 | ac97_write(codec, AC97_HANDSET_RATE, reg | div); | 
|  | 840 | break; | 
|  | 841 | case WM9713_CLKB_MULT: | 
|  | 842 | reg = ac97_read(codec, AC97_HANDSET_RATE) & 0xfffb; | 
|  | 843 | ac97_write(codec, AC97_HANDSET_RATE, reg | div); | 
|  | 844 | break; | 
|  | 845 | case WM9713_HIFI_DIV: | 
|  | 846 | reg = ac97_read(codec, AC97_HANDSET_RATE) & 0x8fff; | 
|  | 847 | ac97_write(codec, AC97_HANDSET_RATE, reg | div); | 
|  | 848 | break; | 
|  | 849 | case WM9713_PCMBCLK_DIV: | 
|  | 850 | reg = ac97_read(codec, AC97_CENTER_LFE_MASTER) & 0xf1ff; | 
|  | 851 | ac97_write(codec, AC97_CENTER_LFE_MASTER, reg | div); | 
|  | 852 | break; | 
|  | 853 | case WM9713_PCMCLK_PLL_DIV: | 
|  | 854 | reg = ac97_read(codec, AC97_LINE1_LEVEL) & 0xff80; | 
|  | 855 | ac97_write(codec, AC97_LINE1_LEVEL, reg | 0x60 | div); | 
|  | 856 | break; | 
|  | 857 | case WM9713_HIFI_PLL_DIV: | 
|  | 858 | reg = ac97_read(codec, AC97_LINE1_LEVEL) & 0xff80; | 
|  | 859 | ac97_write(codec, AC97_LINE1_LEVEL, reg | 0x70 | div); | 
|  | 860 | break; | 
|  | 861 | default: | 
|  | 862 | return -EINVAL; | 
|  | 863 | } | 
|  | 864 |  | 
|  | 865 | return 0; | 
|  | 866 | } | 
|  | 867 |  | 
| Liam Girdwood | e550e17 | 2008-07-07 16:07:52 +0100 | [diff] [blame] | 868 | static int wm9713_set_dai_fmt(struct snd_soc_dai *codec_dai, | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 869 | unsigned int fmt) | 
|  | 870 | { | 
|  | 871 | struct snd_soc_codec *codec = codec_dai->codec; | 
|  | 872 | u16 gpio = ac97_read(codec, AC97_GPIO_CFG) & 0xffc5; | 
|  | 873 | u16 reg = 0x8000; | 
|  | 874 |  | 
|  | 875 | /* clock masters */ | 
|  | 876 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 
|  | 877 | case SND_SOC_DAIFMT_CBM_CFM: | 
|  | 878 | reg |= 0x4000; | 
|  | 879 | gpio |= 0x0010; | 
|  | 880 | break; | 
|  | 881 | case SND_SOC_DAIFMT_CBM_CFS: | 
|  | 882 | reg |= 0x6000; | 
|  | 883 | gpio |= 0x0018; | 
|  | 884 | break; | 
|  | 885 | case SND_SOC_DAIFMT_CBS_CFS: | 
| Mark Brown | d133b0c | 2008-06-11 13:47:11 +0100 | [diff] [blame] | 886 | reg |= 0x2000; | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 887 | gpio |= 0x001a; | 
|  | 888 | break; | 
|  | 889 | case SND_SOC_DAIFMT_CBS_CFM: | 
|  | 890 | gpio |= 0x0012; | 
|  | 891 | break; | 
|  | 892 | } | 
|  | 893 |  | 
|  | 894 | /* clock inversion */ | 
|  | 895 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | 
|  | 896 | case SND_SOC_DAIFMT_IB_IF: | 
|  | 897 | reg |= 0x00c0; | 
|  | 898 | break; | 
|  | 899 | case SND_SOC_DAIFMT_IB_NF: | 
|  | 900 | reg |= 0x0080; | 
|  | 901 | break; | 
|  | 902 | case SND_SOC_DAIFMT_NB_IF: | 
|  | 903 | reg |= 0x0040; | 
|  | 904 | break; | 
|  | 905 | } | 
|  | 906 |  | 
|  | 907 | /* DAI format */ | 
|  | 908 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 
|  | 909 | case SND_SOC_DAIFMT_I2S: | 
|  | 910 | reg |= 0x0002; | 
|  | 911 | break; | 
|  | 912 | case SND_SOC_DAIFMT_RIGHT_J: | 
|  | 913 | break; | 
|  | 914 | case SND_SOC_DAIFMT_LEFT_J: | 
|  | 915 | reg |= 0x0001; | 
|  | 916 | break; | 
|  | 917 | case SND_SOC_DAIFMT_DSP_A: | 
|  | 918 | reg |= 0x0003; | 
|  | 919 | break; | 
|  | 920 | case SND_SOC_DAIFMT_DSP_B: | 
|  | 921 | reg |= 0x0043; | 
|  | 922 | break; | 
|  | 923 | } | 
|  | 924 |  | 
|  | 925 | ac97_write(codec, AC97_GPIO_CFG, gpio); | 
|  | 926 | ac97_write(codec, AC97_CENTER_LFE_MASTER, reg); | 
|  | 927 | return 0; | 
|  | 928 | } | 
|  | 929 |  | 
|  | 930 | static int wm9713_pcm_hw_params(struct snd_pcm_substream *substream, | 
|  | 931 | struct snd_pcm_hw_params *params) | 
|  | 932 | { | 
|  | 933 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 
|  | 934 | struct snd_soc_device *socdev = rtd->socdev; | 
|  | 935 | struct snd_soc_codec *codec = socdev->codec; | 
|  | 936 | u16 reg = ac97_read(codec, AC97_CENTER_LFE_MASTER) & 0xfff3; | 
|  | 937 |  | 
|  | 938 | switch (params_format(params)) { | 
|  | 939 | case SNDRV_PCM_FORMAT_S16_LE: | 
|  | 940 | break; | 
|  | 941 | case SNDRV_PCM_FORMAT_S20_3LE: | 
|  | 942 | reg |= 0x0004; | 
|  | 943 | break; | 
|  | 944 | case SNDRV_PCM_FORMAT_S24_LE: | 
|  | 945 | reg |= 0x0008; | 
|  | 946 | break; | 
|  | 947 | case SNDRV_PCM_FORMAT_S32_LE: | 
|  | 948 | reg |= 0x000c; | 
|  | 949 | break; | 
|  | 950 | } | 
|  | 951 |  | 
|  | 952 | /* enable PCM interface in master mode */ | 
|  | 953 | ac97_write(codec, AC97_CENTER_LFE_MASTER, reg); | 
|  | 954 | return 0; | 
|  | 955 | } | 
|  | 956 |  | 
|  | 957 | static void wm9713_voiceshutdown(struct snd_pcm_substream *substream) | 
|  | 958 | { | 
| Mark Brown | d540de4 | 2008-09-05 22:40:49 +0100 | [diff] [blame] | 959 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 
|  | 960 | struct snd_soc_device *socdev = rtd->socdev; | 
|  | 961 | struct snd_soc_codec *codec = socdev->codec; | 
|  | 962 | u16 status; | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 963 |  | 
| Mark Brown | d540de4 | 2008-09-05 22:40:49 +0100 | [diff] [blame] | 964 | /* Gracefully shut down the voice interface. */ | 
|  | 965 | status = ac97_read(codec, AC97_EXTENDED_STATUS) | 0x1000; | 
|  | 966 | ac97_write(codec, AC97_HANDSET_RATE, 0x0280); | 
|  | 967 | schedule_timeout_interruptible(msecs_to_jiffies(1)); | 
|  | 968 | ac97_write(codec, AC97_HANDSET_RATE, 0x0F80); | 
|  | 969 | ac97_write(codec, AC97_EXTENDED_MID, status); | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 970 | } | 
|  | 971 |  | 
|  | 972 | static int ac97_hifi_prepare(struct snd_pcm_substream *substream) | 
|  | 973 | { | 
|  | 974 | struct snd_pcm_runtime *runtime = substream->runtime; | 
|  | 975 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 
|  | 976 | struct snd_soc_device *socdev = rtd->socdev; | 
|  | 977 | struct snd_soc_codec *codec = socdev->codec; | 
|  | 978 | int reg; | 
|  | 979 | u16 vra; | 
|  | 980 |  | 
|  | 981 | vra = ac97_read(codec, AC97_EXTENDED_STATUS); | 
|  | 982 | ac97_write(codec, AC97_EXTENDED_STATUS, vra | 0x1); | 
|  | 983 |  | 
|  | 984 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 
|  | 985 | reg = AC97_PCM_FRONT_DAC_RATE; | 
|  | 986 | else | 
|  | 987 | reg = AC97_PCM_LR_ADC_RATE; | 
|  | 988 |  | 
|  | 989 | return ac97_write(codec, reg, runtime->rate); | 
|  | 990 | } | 
|  | 991 |  | 
|  | 992 | static int ac97_aux_prepare(struct snd_pcm_substream *substream) | 
|  | 993 | { | 
|  | 994 | struct snd_pcm_runtime *runtime = substream->runtime; | 
|  | 995 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 
|  | 996 | struct snd_soc_device *socdev = rtd->socdev; | 
|  | 997 | struct snd_soc_codec *codec = socdev->codec; | 
|  | 998 | u16 vra, xsle; | 
|  | 999 |  | 
|  | 1000 | vra = ac97_read(codec, AC97_EXTENDED_STATUS); | 
|  | 1001 | ac97_write(codec, AC97_EXTENDED_STATUS, vra | 0x1); | 
|  | 1002 | xsle = ac97_read(codec, AC97_PCI_SID); | 
|  | 1003 | ac97_write(codec, AC97_PCI_SID, xsle | 0x8000); | 
|  | 1004 |  | 
|  | 1005 | if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) | 
|  | 1006 | return -ENODEV; | 
|  | 1007 |  | 
|  | 1008 | return ac97_write(codec, AC97_PCM_SURR_DAC_RATE, runtime->rate); | 
|  | 1009 | } | 
|  | 1010 |  | 
| Mark Brown | 5415552 | 2008-07-02 11:51:19 +0100 | [diff] [blame] | 1011 | #define WM9713_RATES (SNDRV_PCM_RATE_8000  |	\ | 
|  | 1012 | SNDRV_PCM_RATE_11025 |	\ | 
|  | 1013 | SNDRV_PCM_RATE_22050 |	\ | 
|  | 1014 | SNDRV_PCM_RATE_44100 |	\ | 
|  | 1015 | SNDRV_PCM_RATE_48000) | 
|  | 1016 |  | 
|  | 1017 | #define WM9713_PCM_RATES (SNDRV_PCM_RATE_8000  |	\ | 
|  | 1018 | SNDRV_PCM_RATE_11025 |	\ | 
|  | 1019 | SNDRV_PCM_RATE_16000 |	\ | 
|  | 1020 | SNDRV_PCM_RATE_22050 |	\ | 
|  | 1021 | SNDRV_PCM_RATE_44100 |	\ | 
|  | 1022 | SNDRV_PCM_RATE_48000) | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1023 |  | 
|  | 1024 | #define WM9713_PCM_FORMATS \ | 
|  | 1025 | (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \ | 
|  | 1026 | SNDRV_PCM_FORMAT_S24_LE) | 
|  | 1027 |  | 
| Liam Girdwood | e550e17 | 2008-07-07 16:07:52 +0100 | [diff] [blame] | 1028 | struct snd_soc_dai wm9713_dai[] = { | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1029 | { | 
|  | 1030 | .name = "AC97 HiFi", | 
|  | 1031 | .type = SND_SOC_DAI_AC97_BUS, | 
|  | 1032 | .playback = { | 
|  | 1033 | .stream_name = "HiFi Playback", | 
|  | 1034 | .channels_min = 1, | 
|  | 1035 | .channels_max = 2, | 
|  | 1036 | .rates = WM9713_RATES, | 
|  | 1037 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | 
|  | 1038 | .capture = { | 
|  | 1039 | .stream_name = "HiFi Capture", | 
|  | 1040 | .channels_min = 1, | 
|  | 1041 | .channels_max = 2, | 
|  | 1042 | .rates = WM9713_RATES, | 
|  | 1043 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | 
|  | 1044 | .ops = { | 
|  | 1045 | .prepare = ac97_hifi_prepare,}, | 
|  | 1046 | .dai_ops = { | 
|  | 1047 | .set_clkdiv = wm9713_set_dai_clkdiv, | 
|  | 1048 | .set_pll = wm9713_set_dai_pll,}, | 
|  | 1049 | }, | 
|  | 1050 | { | 
|  | 1051 | .name = "AC97 Aux", | 
|  | 1052 | .playback = { | 
|  | 1053 | .stream_name = "Aux Playback", | 
|  | 1054 | .channels_min = 1, | 
|  | 1055 | .channels_max = 1, | 
|  | 1056 | .rates = WM9713_RATES, | 
|  | 1057 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | 
|  | 1058 | .ops = { | 
|  | 1059 | .prepare = ac97_aux_prepare,}, | 
|  | 1060 | .dai_ops = { | 
|  | 1061 | .set_clkdiv = wm9713_set_dai_clkdiv, | 
|  | 1062 | .set_pll = wm9713_set_dai_pll,}, | 
|  | 1063 | }, | 
|  | 1064 | { | 
|  | 1065 | .name = "WM9713 Voice", | 
|  | 1066 | .playback = { | 
|  | 1067 | .stream_name = "Voice Playback", | 
|  | 1068 | .channels_min = 1, | 
|  | 1069 | .channels_max = 1, | 
| Mark Brown | 5415552 | 2008-07-02 11:51:19 +0100 | [diff] [blame] | 1070 | .rates = WM9713_PCM_RATES, | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1071 | .formats = WM9713_PCM_FORMATS,}, | 
|  | 1072 | .capture = { | 
|  | 1073 | .stream_name = "Voice Capture", | 
|  | 1074 | .channels_min = 1, | 
|  | 1075 | .channels_max = 2, | 
| Mark Brown | 5415552 | 2008-07-02 11:51:19 +0100 | [diff] [blame] | 1076 | .rates = WM9713_PCM_RATES, | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1077 | .formats = WM9713_PCM_FORMATS,}, | 
|  | 1078 | .ops = { | 
|  | 1079 | .hw_params = wm9713_pcm_hw_params, | 
|  | 1080 | .shutdown = wm9713_voiceshutdown,}, | 
|  | 1081 | .dai_ops = { | 
|  | 1082 | .set_clkdiv = wm9713_set_dai_clkdiv, | 
|  | 1083 | .set_pll = wm9713_set_dai_pll, | 
|  | 1084 | .set_fmt = wm9713_set_dai_fmt, | 
|  | 1085 | .set_tristate = wm9713_set_dai_tristate, | 
|  | 1086 | }, | 
|  | 1087 | }, | 
|  | 1088 | }; | 
|  | 1089 | EXPORT_SYMBOL_GPL(wm9713_dai); | 
|  | 1090 |  | 
|  | 1091 | int wm9713_reset(struct snd_soc_codec *codec, int try_warm) | 
|  | 1092 | { | 
|  | 1093 | if (try_warm && soc_ac97_ops.warm_reset) { | 
|  | 1094 | soc_ac97_ops.warm_reset(codec->ac97); | 
| Mark Brown | abb68c2 | 2008-06-13 16:24:04 +0100 | [diff] [blame] | 1095 | if (ac97_read(codec, 0) == wm9713_reg[0]) | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1096 | return 1; | 
|  | 1097 | } | 
|  | 1098 |  | 
|  | 1099 | soc_ac97_ops.reset(codec->ac97); | 
| Mark Brown | abb68c2 | 2008-06-13 16:24:04 +0100 | [diff] [blame] | 1100 | if (ac97_read(codec, 0) != wm9713_reg[0]) | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1101 | return -EIO; | 
|  | 1102 | return 0; | 
|  | 1103 | } | 
|  | 1104 | EXPORT_SYMBOL_GPL(wm9713_reset); | 
|  | 1105 |  | 
| Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1106 | static int wm9713_set_bias_level(struct snd_soc_codec *codec, | 
|  | 1107 | enum snd_soc_bias_level level) | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1108 | { | 
|  | 1109 | u16 reg; | 
|  | 1110 |  | 
| Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1111 | switch (level) { | 
|  | 1112 | case SND_SOC_BIAS_ON: | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1113 | /* enable thermal shutdown */ | 
|  | 1114 | reg = ac97_read(codec, AC97_EXTENDED_MID) & 0x1bff; | 
|  | 1115 | ac97_write(codec, AC97_EXTENDED_MID, reg); | 
|  | 1116 | break; | 
| Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1117 | case SND_SOC_BIAS_PREPARE: | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1118 | break; | 
| Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1119 | case SND_SOC_BIAS_STANDBY: | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1120 | /* enable master bias and vmid */ | 
|  | 1121 | reg = ac97_read(codec, AC97_EXTENDED_MID) & 0x3bff; | 
|  | 1122 | ac97_write(codec, AC97_EXTENDED_MID, reg); | 
|  | 1123 | ac97_write(codec, AC97_POWERDOWN, 0x0000); | 
|  | 1124 | break; | 
| Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1125 | case SND_SOC_BIAS_OFF: | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1126 | /* disable everything including AC link */ | 
|  | 1127 | ac97_write(codec, AC97_EXTENDED_MID, 0xffff); | 
|  | 1128 | ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); | 
|  | 1129 | ac97_write(codec, AC97_POWERDOWN, 0xffff); | 
|  | 1130 | break; | 
|  | 1131 | } | 
| Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1132 | codec->bias_level = level; | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1133 | return 0; | 
|  | 1134 | } | 
|  | 1135 |  | 
|  | 1136 | static int wm9713_soc_suspend(struct platform_device *pdev, | 
|  | 1137 | pm_message_t state) | 
|  | 1138 | { | 
|  | 1139 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 
|  | 1140 | struct snd_soc_codec *codec = socdev->codec; | 
| Mark Brown | 87b57fe | 2008-04-14 15:27:30 +0200 | [diff] [blame] | 1141 | u16 reg; | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1142 |  | 
| Mark Brown | 87b57fe | 2008-04-14 15:27:30 +0200 | [diff] [blame] | 1143 | /* Disable everything except touchpanel - that will be handled | 
|  | 1144 | * by the touch driver and left disabled if touch is not in | 
|  | 1145 | * use. */ | 
|  | 1146 | reg = ac97_read(codec, AC97_EXTENDED_MID); | 
|  | 1147 | ac97_write(codec, AC97_EXTENDED_MID, reg | 0x7fff); | 
|  | 1148 | ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); | 
|  | 1149 | ac97_write(codec, AC97_POWERDOWN, 0x6f00); | 
|  | 1150 | ac97_write(codec, AC97_POWERDOWN, 0xffff); | 
|  | 1151 |  | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1152 | return 0; | 
|  | 1153 | } | 
|  | 1154 |  | 
|  | 1155 | static int wm9713_soc_resume(struct platform_device *pdev) | 
|  | 1156 | { | 
|  | 1157 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 
|  | 1158 | struct snd_soc_codec *codec = socdev->codec; | 
|  | 1159 | struct wm9713_priv *wm9713 = codec->private_data; | 
|  | 1160 | int i, ret; | 
|  | 1161 | u16 *cache = codec->reg_cache; | 
|  | 1162 |  | 
|  | 1163 | ret = wm9713_reset(codec, 1); | 
|  | 1164 | if (ret < 0) { | 
|  | 1165 | printk(KERN_ERR "could not reset AC97 codec\n"); | 
|  | 1166 | return ret; | 
|  | 1167 | } | 
|  | 1168 |  | 
| Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1169 | wm9713_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1170 |  | 
|  | 1171 | /* do we need to re-start the PLL ? */ | 
|  | 1172 | if (wm9713->pll_out) | 
|  | 1173 | wm9713_set_pll(codec, 0, wm9713->pll_in, wm9713->pll_out); | 
|  | 1174 |  | 
|  | 1175 | /* only synchronise the codec if warm reset failed */ | 
|  | 1176 | if (ret == 0) { | 
|  | 1177 | for (i = 2; i < ARRAY_SIZE(wm9713_reg) << 1; i += 2) { | 
|  | 1178 | if (i == AC97_POWERDOWN || i == AC97_EXTENDED_MID || | 
|  | 1179 | i == AC97_EXTENDED_MSTATUS || i > 0x66) | 
|  | 1180 | continue; | 
|  | 1181 | soc_ac97_ops.write(codec->ac97, i, cache[i>>1]); | 
|  | 1182 | } | 
|  | 1183 | } | 
|  | 1184 |  | 
| Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1185 | if (codec->suspend_bias_level == SND_SOC_BIAS_ON) | 
|  | 1186 | wm9713_set_bias_level(codec, SND_SOC_BIAS_ON); | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1187 |  | 
|  | 1188 | return ret; | 
|  | 1189 | } | 
|  | 1190 |  | 
|  | 1191 | static int wm9713_soc_probe(struct platform_device *pdev) | 
|  | 1192 | { | 
|  | 1193 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 
|  | 1194 | struct snd_soc_codec *codec; | 
|  | 1195 | int ret = 0, reg; | 
|  | 1196 |  | 
|  | 1197 | printk(KERN_INFO "WM9713/WM9714 SoC Audio Codec %s\n", WM9713_VERSION); | 
|  | 1198 |  | 
|  | 1199 | socdev->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); | 
|  | 1200 | if (socdev->codec == NULL) | 
|  | 1201 | return -ENOMEM; | 
|  | 1202 | codec = socdev->codec; | 
|  | 1203 | mutex_init(&codec->mutex); | 
|  | 1204 |  | 
|  | 1205 | codec->reg_cache = kmemdup(wm9713_reg, sizeof(wm9713_reg), GFP_KERNEL); | 
|  | 1206 | if (codec->reg_cache == NULL) { | 
|  | 1207 | ret = -ENOMEM; | 
|  | 1208 | goto cache_err; | 
|  | 1209 | } | 
|  | 1210 | codec->reg_cache_size = sizeof(wm9713_reg); | 
|  | 1211 | codec->reg_cache_step = 2; | 
|  | 1212 |  | 
|  | 1213 | codec->private_data = kzalloc(sizeof(struct wm9713_priv), GFP_KERNEL); | 
|  | 1214 | if (codec->private_data == NULL) { | 
|  | 1215 | ret = -ENOMEM; | 
|  | 1216 | goto priv_err; | 
|  | 1217 | } | 
|  | 1218 |  | 
|  | 1219 | codec->name = "WM9713"; | 
|  | 1220 | codec->owner = THIS_MODULE; | 
|  | 1221 | codec->dai = wm9713_dai; | 
|  | 1222 | codec->num_dai = ARRAY_SIZE(wm9713_dai); | 
|  | 1223 | codec->write = ac97_write; | 
|  | 1224 | codec->read = ac97_read; | 
| Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1225 | codec->set_bias_level = wm9713_set_bias_level; | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1226 | INIT_LIST_HEAD(&codec->dapm_widgets); | 
|  | 1227 | INIT_LIST_HEAD(&codec->dapm_paths); | 
|  | 1228 |  | 
|  | 1229 | ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); | 
|  | 1230 | if (ret < 0) | 
|  | 1231 | goto codec_err; | 
|  | 1232 |  | 
|  | 1233 | /* register pcms */ | 
|  | 1234 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); | 
|  | 1235 | if (ret < 0) | 
|  | 1236 | goto pcm_err; | 
|  | 1237 |  | 
|  | 1238 | /* do a cold reset for the controller and then try | 
|  | 1239 | * a warm reset followed by an optional cold reset for codec */ | 
|  | 1240 | wm9713_reset(codec, 0); | 
|  | 1241 | ret = wm9713_reset(codec, 1); | 
|  | 1242 | if (ret < 0) { | 
|  | 1243 | printk(KERN_ERR "AC97 link error\n"); | 
|  | 1244 | goto reset_err; | 
|  | 1245 | } | 
|  | 1246 |  | 
| Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1247 | wm9713_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 
| Liam Girdwood | 83ac08c | 2008-02-15 16:43:11 +0100 | [diff] [blame] | 1248 |  | 
|  | 1249 | /* unmute the adc - move to kcontrol */ | 
|  | 1250 | reg = ac97_read(codec, AC97_CD) & 0x7fff; | 
|  | 1251 | ac97_write(codec, AC97_CD, reg); | 
|  | 1252 |  | 
|  | 1253 | wm9713_add_controls(codec); | 
|  | 1254 | wm9713_add_widgets(codec); | 
|  | 1255 | ret = snd_soc_register_card(socdev); | 
|  | 1256 | if (ret < 0) | 
|  | 1257 | goto reset_err; | 
|  | 1258 | return 0; | 
|  | 1259 |  | 
|  | 1260 | reset_err: | 
|  | 1261 | snd_soc_free_pcms(socdev); | 
|  | 1262 |  | 
|  | 1263 | pcm_err: | 
|  | 1264 | snd_soc_free_ac97_codec(codec); | 
|  | 1265 |  | 
|  | 1266 | codec_err: | 
|  | 1267 | kfree(codec->private_data); | 
|  | 1268 |  | 
|  | 1269 | priv_err: | 
|  | 1270 | kfree(codec->reg_cache); | 
|  | 1271 |  | 
|  | 1272 | cache_err: | 
|  | 1273 | kfree(socdev->codec); | 
|  | 1274 | socdev->codec = NULL; | 
|  | 1275 | return ret; | 
|  | 1276 | } | 
|  | 1277 |  | 
|  | 1278 | static int wm9713_soc_remove(struct platform_device *pdev) | 
|  | 1279 | { | 
|  | 1280 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 
|  | 1281 | struct snd_soc_codec *codec = socdev->codec; | 
|  | 1282 |  | 
|  | 1283 | if (codec == NULL) | 
|  | 1284 | return 0; | 
|  | 1285 |  | 
|  | 1286 | snd_soc_dapm_free(socdev); | 
|  | 1287 | snd_soc_free_pcms(socdev); | 
|  | 1288 | snd_soc_free_ac97_codec(codec); | 
|  | 1289 | kfree(codec->private_data); | 
|  | 1290 | kfree(codec->reg_cache); | 
|  | 1291 | kfree(codec->dai); | 
|  | 1292 | kfree(codec); | 
|  | 1293 | return 0; | 
|  | 1294 | } | 
|  | 1295 |  | 
|  | 1296 | struct snd_soc_codec_device soc_codec_dev_wm9713 = { | 
|  | 1297 | .probe = 	wm9713_soc_probe, | 
|  | 1298 | .remove = 	wm9713_soc_remove, | 
|  | 1299 | .suspend =	wm9713_soc_suspend, | 
|  | 1300 | .resume = 	wm9713_soc_resume, | 
|  | 1301 | }; | 
|  | 1302 | EXPORT_SYMBOL_GPL(soc_codec_dev_wm9713); | 
|  | 1303 |  | 
|  | 1304 | MODULE_DESCRIPTION("ASoC WM9713/WM9714 driver"); | 
|  | 1305 | MODULE_AUTHOR("Liam Girdwood"); | 
|  | 1306 | MODULE_LICENSE("GPL"); |