wm8988.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069
  1. /*
  2. * wm8988.c -- WM8988 ALSA SoC audio driver
  3. *
  4. * Copyright 2009 Wolfson Microelectronics plc
  5. * Copyright 2005 Openedhand Ltd.
  6. *
  7. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/module.h>
  14. #include <linux/moduleparam.h>
  15. #include <linux/init.h>
  16. #include <linux/delay.h>
  17. #include <linux/pm.h>
  18. #include <linux/i2c.h>
  19. #include <linux/spi/spi.h>
  20. #include <linux/platform_device.h>
  21. #include <sound/core.h>
  22. #include <sound/pcm.h>
  23. #include <sound/pcm_params.h>
  24. #include <sound/tlv.h>
  25. #include <sound/soc.h>
  26. #include <sound/soc-dapm.h>
  27. #include <sound/initval.h>
  28. #include "wm8988.h"
  29. /*
  30. * wm8988 register cache
  31. * We can't read the WM8988 register space when we
  32. * are using 2 wire for device control, so we cache them instead.
  33. */
  34. static const u16 wm8988_reg[] = {
  35. 0x0097, 0x0097, 0x0079, 0x0079, /* 0 */
  36. 0x0000, 0x0008, 0x0000, 0x000a, /* 4 */
  37. 0x0000, 0x0000, 0x00ff, 0x00ff, /* 8 */
  38. 0x000f, 0x000f, 0x0000, 0x0000, /* 12 */
  39. 0x0000, 0x007b, 0x0000, 0x0032, /* 16 */
  40. 0x0000, 0x00c3, 0x00c3, 0x00c0, /* 20 */
  41. 0x0000, 0x0000, 0x0000, 0x0000, /* 24 */
  42. 0x0000, 0x0000, 0x0000, 0x0000, /* 28 */
  43. 0x0000, 0x0000, 0x0050, 0x0050, /* 32 */
  44. 0x0050, 0x0050, 0x0050, 0x0050, /* 36 */
  45. 0x0079, 0x0079, 0x0079, /* 40 */
  46. };
  47. /* codec private data */
  48. struct wm8988_priv {
  49. unsigned int sysclk;
  50. struct snd_soc_codec codec;
  51. struct snd_pcm_hw_constraint_list *sysclk_constraints;
  52. u16 reg_cache[WM8988_NUM_REG];
  53. };
  54. #define wm8988_reset(c) snd_soc_write(c, WM8988_RESET, 0)
  55. /*
  56. * WM8988 Controls
  57. */
  58. static const char *bass_boost_txt[] = {"Linear Control", "Adaptive Boost"};
  59. static const struct soc_enum bass_boost =
  60. SOC_ENUM_SINGLE(WM8988_BASS, 7, 2, bass_boost_txt);
  61. static const char *bass_filter_txt[] = { "130Hz @ 48kHz", "200Hz @ 48kHz" };
  62. static const struct soc_enum bass_filter =
  63. SOC_ENUM_SINGLE(WM8988_BASS, 6, 2, bass_filter_txt);
  64. static const char *treble_txt[] = {"8kHz", "4kHz"};
  65. static const struct soc_enum treble =
  66. SOC_ENUM_SINGLE(WM8988_TREBLE, 6, 2, treble_txt);
  67. static const char *stereo_3d_lc_txt[] = {"200Hz", "500Hz"};
  68. static const struct soc_enum stereo_3d_lc =
  69. SOC_ENUM_SINGLE(WM8988_3D, 5, 2, stereo_3d_lc_txt);
  70. static const char *stereo_3d_uc_txt[] = {"2.2kHz", "1.5kHz"};
  71. static const struct soc_enum stereo_3d_uc =
  72. SOC_ENUM_SINGLE(WM8988_3D, 6, 2, stereo_3d_uc_txt);
  73. static const char *stereo_3d_func_txt[] = {"Capture", "Playback"};
  74. static const struct soc_enum stereo_3d_func =
  75. SOC_ENUM_SINGLE(WM8988_3D, 7, 2, stereo_3d_func_txt);
  76. static const char *alc_func_txt[] = {"Off", "Right", "Left", "Stereo"};
  77. static const struct soc_enum alc_func =
  78. SOC_ENUM_SINGLE(WM8988_ALC1, 7, 4, alc_func_txt);
  79. static const char *ng_type_txt[] = {"Constant PGA Gain",
  80. "Mute ADC Output"};
  81. static const struct soc_enum ng_type =
  82. SOC_ENUM_SINGLE(WM8988_NGATE, 1, 2, ng_type_txt);
  83. static const char *deemph_txt[] = {"None", "32Khz", "44.1Khz", "48Khz"};
  84. static const struct soc_enum deemph =
  85. SOC_ENUM_SINGLE(WM8988_ADCDAC, 1, 4, deemph_txt);
  86. static const char *adcpol_txt[] = {"Normal", "L Invert", "R Invert",
  87. "L + R Invert"};
  88. static const struct soc_enum adcpol =
  89. SOC_ENUM_SINGLE(WM8988_ADCDAC, 5, 4, adcpol_txt);
  90. static const DECLARE_TLV_DB_SCALE(pga_tlv, -1725, 75, 0);
  91. static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
  92. static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
  93. static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
  94. static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0);
  95. static const struct snd_kcontrol_new wm8988_snd_controls[] = {
  96. SOC_ENUM("Bass Boost", bass_boost),
  97. SOC_ENUM("Bass Filter", bass_filter),
  98. SOC_SINGLE("Bass Volume", WM8988_BASS, 0, 15, 1),
  99. SOC_SINGLE("Treble Volume", WM8988_TREBLE, 0, 15, 0),
  100. SOC_ENUM("Treble Cut-off", treble),
  101. SOC_SINGLE("3D Switch", WM8988_3D, 0, 1, 0),
  102. SOC_SINGLE("3D Volume", WM8988_3D, 1, 15, 0),
  103. SOC_ENUM("3D Lower Cut-off", stereo_3d_lc),
  104. SOC_ENUM("3D Upper Cut-off", stereo_3d_uc),
  105. SOC_ENUM("3D Mode", stereo_3d_func),
  106. SOC_SINGLE("ALC Capture Target Volume", WM8988_ALC1, 0, 7, 0),
  107. SOC_SINGLE("ALC Capture Max Volume", WM8988_ALC1, 4, 7, 0),
  108. SOC_ENUM("ALC Capture Function", alc_func),
  109. SOC_SINGLE("ALC Capture ZC Switch", WM8988_ALC2, 7, 1, 0),
  110. SOC_SINGLE("ALC Capture Hold Time", WM8988_ALC2, 0, 15, 0),
  111. SOC_SINGLE("ALC Capture Decay Time", WM8988_ALC3, 4, 15, 0),
  112. SOC_SINGLE("ALC Capture Attack Time", WM8988_ALC3, 0, 15, 0),
  113. SOC_SINGLE("ALC Capture NG Threshold", WM8988_NGATE, 3, 31, 0),
  114. SOC_ENUM("ALC Capture NG Type", ng_type),
  115. SOC_SINGLE("ALC Capture NG Switch", WM8988_NGATE, 0, 1, 0),
  116. SOC_SINGLE("ZC Timeout Switch", WM8988_ADCTL1, 0, 1, 0),
  117. SOC_DOUBLE_R_TLV("Capture Digital Volume", WM8988_LADC, WM8988_RADC,
  118. 0, 255, 0, adc_tlv),
  119. SOC_DOUBLE_R_TLV("Capture Volume", WM8988_LINVOL, WM8988_RINVOL,
  120. 0, 63, 0, pga_tlv),
  121. SOC_DOUBLE_R("Capture ZC Switch", WM8988_LINVOL, WM8988_RINVOL, 6, 1, 0),
  122. SOC_DOUBLE_R("Capture Switch", WM8988_LINVOL, WM8988_RINVOL, 7, 1, 1),
  123. SOC_ENUM("Playback De-emphasis", deemph),
  124. SOC_ENUM("Capture Polarity", adcpol),
  125. SOC_SINGLE("Playback 6dB Attenuate", WM8988_ADCDAC, 7, 1, 0),
  126. SOC_SINGLE("Capture 6dB Attenuate", WM8988_ADCDAC, 8, 1, 0),
  127. SOC_DOUBLE_R_TLV("PCM Volume", WM8988_LDAC, WM8988_RDAC, 0, 255, 0, dac_tlv),
  128. SOC_SINGLE_TLV("Left Mixer Left Bypass Volume", WM8988_LOUTM1, 4, 7, 1,
  129. bypass_tlv),
  130. SOC_SINGLE_TLV("Left Mixer Right Bypass Volume", WM8988_LOUTM2, 4, 7, 1,
  131. bypass_tlv),
  132. SOC_SINGLE_TLV("Right Mixer Left Bypass Volume", WM8988_ROUTM1, 4, 7, 1,
  133. bypass_tlv),
  134. SOC_SINGLE_TLV("Right Mixer Right Bypass Volume", WM8988_ROUTM2, 4, 7, 1,
  135. bypass_tlv),
  136. SOC_DOUBLE_R("Output 1 Playback ZC Switch", WM8988_LOUT1V,
  137. WM8988_ROUT1V, 7, 1, 0),
  138. SOC_DOUBLE_R_TLV("Output 1 Playback Volume", WM8988_LOUT1V, WM8988_ROUT1V,
  139. 0, 127, 0, out_tlv),
  140. SOC_DOUBLE_R("Output 2 Playback ZC Switch", WM8988_LOUT2V,
  141. WM8988_ROUT2V, 7, 1, 0),
  142. SOC_DOUBLE_R_TLV("Output 2 Playback Volume", WM8988_LOUT2V, WM8988_ROUT2V,
  143. 0, 127, 0, out_tlv),
  144. };
  145. /*
  146. * DAPM Controls
  147. */
  148. static int wm8988_lrc_control(struct snd_soc_dapm_widget *w,
  149. struct snd_kcontrol *kcontrol, int event)
  150. {
  151. struct snd_soc_codec *codec = w->codec;
  152. u16 adctl2 = snd_soc_read(codec, WM8988_ADCTL2);
  153. /* Use the DAC to gate LRC if active, otherwise use ADC */
  154. if (snd_soc_read(codec, WM8988_PWR2) & 0x180)
  155. adctl2 &= ~0x4;
  156. else
  157. adctl2 |= 0x4;
  158. return snd_soc_write(codec, WM8988_ADCTL2, adctl2);
  159. }
  160. static const char *wm8988_line_texts[] = {
  161. "Line 1", "Line 2", "PGA", "Differential"};
  162. static const unsigned int wm8988_line_values[] = {
  163. 0, 1, 3, 4};
  164. static const struct soc_enum wm8988_lline_enum =
  165. SOC_VALUE_ENUM_SINGLE(WM8988_LOUTM1, 0, 7,
  166. ARRAY_SIZE(wm8988_line_texts),
  167. wm8988_line_texts,
  168. wm8988_line_values);
  169. static const struct snd_kcontrol_new wm8988_left_line_controls =
  170. SOC_DAPM_VALUE_ENUM("Route", wm8988_lline_enum);
  171. static const struct soc_enum wm8988_rline_enum =
  172. SOC_VALUE_ENUM_SINGLE(WM8988_ROUTM1, 0, 7,
  173. ARRAY_SIZE(wm8988_line_texts),
  174. wm8988_line_texts,
  175. wm8988_line_values);
  176. static const struct snd_kcontrol_new wm8988_right_line_controls =
  177. SOC_DAPM_VALUE_ENUM("Route", wm8988_lline_enum);
  178. /* Left Mixer */
  179. static const struct snd_kcontrol_new wm8988_left_mixer_controls[] = {
  180. SOC_DAPM_SINGLE("Playback Switch", WM8988_LOUTM1, 8, 1, 0),
  181. SOC_DAPM_SINGLE("Left Bypass Switch", WM8988_LOUTM1, 7, 1, 0),
  182. SOC_DAPM_SINGLE("Right Playback Switch", WM8988_LOUTM2, 8, 1, 0),
  183. SOC_DAPM_SINGLE("Right Bypass Switch", WM8988_LOUTM2, 7, 1, 0),
  184. };
  185. /* Right Mixer */
  186. static const struct snd_kcontrol_new wm8988_right_mixer_controls[] = {
  187. SOC_DAPM_SINGLE("Left Playback Switch", WM8988_ROUTM1, 8, 1, 0),
  188. SOC_DAPM_SINGLE("Left Bypass Switch", WM8988_ROUTM1, 7, 1, 0),
  189. SOC_DAPM_SINGLE("Playback Switch", WM8988_ROUTM2, 8, 1, 0),
  190. SOC_DAPM_SINGLE("Right Bypass Switch", WM8988_ROUTM2, 7, 1, 0),
  191. };
  192. static const char *wm8988_pga_sel[] = {"Line 1", "Line 2", "Differential"};
  193. static const unsigned int wm8988_pga_val[] = { 0, 1, 3 };
  194. /* Left PGA Mux */
  195. static const struct soc_enum wm8988_lpga_enum =
  196. SOC_VALUE_ENUM_SINGLE(WM8988_LADCIN, 6, 3,
  197. ARRAY_SIZE(wm8988_pga_sel),
  198. wm8988_pga_sel,
  199. wm8988_pga_val);
  200. static const struct snd_kcontrol_new wm8988_left_pga_controls =
  201. SOC_DAPM_VALUE_ENUM("Route", wm8988_lpga_enum);
  202. /* Right PGA Mux */
  203. static const struct soc_enum wm8988_rpga_enum =
  204. SOC_VALUE_ENUM_SINGLE(WM8988_RADCIN, 6, 3,
  205. ARRAY_SIZE(wm8988_pga_sel),
  206. wm8988_pga_sel,
  207. wm8988_pga_val);
  208. static const struct snd_kcontrol_new wm8988_right_pga_controls =
  209. SOC_DAPM_VALUE_ENUM("Route", wm8988_rpga_enum);
  210. /* Differential Mux */
  211. static const char *wm8988_diff_sel[] = {"Line 1", "Line 2"};
  212. static const struct soc_enum diffmux =
  213. SOC_ENUM_SINGLE(WM8988_ADCIN, 8, 2, wm8988_diff_sel);
  214. static const struct snd_kcontrol_new wm8988_diffmux_controls =
  215. SOC_DAPM_ENUM("Route", diffmux);
  216. /* Mono ADC Mux */
  217. static const char *wm8988_mono_mux[] = {"Stereo", "Mono (Left)",
  218. "Mono (Right)", "Digital Mono"};
  219. static const struct soc_enum monomux =
  220. SOC_ENUM_SINGLE(WM8988_ADCIN, 6, 4, wm8988_mono_mux);
  221. static const struct snd_kcontrol_new wm8988_monomux_controls =
  222. SOC_DAPM_ENUM("Route", monomux);
  223. static const struct snd_soc_dapm_widget wm8988_dapm_widgets[] = {
  224. SND_SOC_DAPM_MICBIAS("Mic Bias", WM8988_PWR1, 1, 0),
  225. SND_SOC_DAPM_MUX("Differential Mux", SND_SOC_NOPM, 0, 0,
  226. &wm8988_diffmux_controls),
  227. SND_SOC_DAPM_MUX("Left ADC Mux", SND_SOC_NOPM, 0, 0,
  228. &wm8988_monomux_controls),
  229. SND_SOC_DAPM_MUX("Right ADC Mux", SND_SOC_NOPM, 0, 0,
  230. &wm8988_monomux_controls),
  231. SND_SOC_DAPM_MUX("Left PGA Mux", WM8988_PWR1, 5, 0,
  232. &wm8988_left_pga_controls),
  233. SND_SOC_DAPM_MUX("Right PGA Mux", WM8988_PWR1, 4, 0,
  234. &wm8988_right_pga_controls),
  235. SND_SOC_DAPM_MUX("Left Line Mux", SND_SOC_NOPM, 0, 0,
  236. &wm8988_left_line_controls),
  237. SND_SOC_DAPM_MUX("Right Line Mux", SND_SOC_NOPM, 0, 0,
  238. &wm8988_right_line_controls),
  239. SND_SOC_DAPM_ADC("Right ADC", "Right Capture", WM8988_PWR1, 2, 0),
  240. SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8988_PWR1, 3, 0),
  241. SND_SOC_DAPM_DAC("Right DAC", "Right Playback", WM8988_PWR2, 7, 0),
  242. SND_SOC_DAPM_DAC("Left DAC", "Left Playback", WM8988_PWR2, 8, 0),
  243. SND_SOC_DAPM_MIXER("Left Mixer", SND_SOC_NOPM, 0, 0,
  244. &wm8988_left_mixer_controls[0],
  245. ARRAY_SIZE(wm8988_left_mixer_controls)),
  246. SND_SOC_DAPM_MIXER("Right Mixer", SND_SOC_NOPM, 0, 0,
  247. &wm8988_right_mixer_controls[0],
  248. ARRAY_SIZE(wm8988_right_mixer_controls)),
  249. SND_SOC_DAPM_PGA("Right Out 2", WM8988_PWR2, 3, 0, NULL, 0),
  250. SND_SOC_DAPM_PGA("Left Out 2", WM8988_PWR2, 4, 0, NULL, 0),
  251. SND_SOC_DAPM_PGA("Right Out 1", WM8988_PWR2, 5, 0, NULL, 0),
  252. SND_SOC_DAPM_PGA("Left Out 1", WM8988_PWR2, 6, 0, NULL, 0),
  253. SND_SOC_DAPM_POST("LRC control", wm8988_lrc_control),
  254. SND_SOC_DAPM_OUTPUT("LOUT1"),
  255. SND_SOC_DAPM_OUTPUT("ROUT1"),
  256. SND_SOC_DAPM_OUTPUT("LOUT2"),
  257. SND_SOC_DAPM_OUTPUT("ROUT2"),
  258. SND_SOC_DAPM_OUTPUT("VREF"),
  259. SND_SOC_DAPM_INPUT("LINPUT1"),
  260. SND_SOC_DAPM_INPUT("LINPUT2"),
  261. SND_SOC_DAPM_INPUT("RINPUT1"),
  262. SND_SOC_DAPM_INPUT("RINPUT2"),
  263. };
  264. static const struct snd_soc_dapm_route audio_map[] = {
  265. { "Left Line Mux", "Line 1", "LINPUT1" },
  266. { "Left Line Mux", "Line 2", "LINPUT2" },
  267. { "Left Line Mux", "PGA", "Left PGA Mux" },
  268. { "Left Line Mux", "Differential", "Differential Mux" },
  269. { "Right Line Mux", "Line 1", "RINPUT1" },
  270. { "Right Line Mux", "Line 2", "RINPUT2" },
  271. { "Right Line Mux", "PGA", "Right PGA Mux" },
  272. { "Right Line Mux", "Differential", "Differential Mux" },
  273. { "Left PGA Mux", "Line 1", "LINPUT1" },
  274. { "Left PGA Mux", "Line 2", "LINPUT2" },
  275. { "Left PGA Mux", "Differential", "Differential Mux" },
  276. { "Right PGA Mux", "Line 1", "RINPUT1" },
  277. { "Right PGA Mux", "Line 2", "RINPUT2" },
  278. { "Right PGA Mux", "Differential", "Differential Mux" },
  279. { "Differential Mux", "Line 1", "LINPUT1" },
  280. { "Differential Mux", "Line 1", "RINPUT1" },
  281. { "Differential Mux", "Line 2", "LINPUT2" },
  282. { "Differential Mux", "Line 2", "RINPUT2" },
  283. { "Left ADC Mux", "Stereo", "Left PGA Mux" },
  284. { "Left ADC Mux", "Mono (Left)", "Left PGA Mux" },
  285. { "Left ADC Mux", "Digital Mono", "Left PGA Mux" },
  286. { "Right ADC Mux", "Stereo", "Right PGA Mux" },
  287. { "Right ADC Mux", "Mono (Right)", "Right PGA Mux" },
  288. { "Right ADC Mux", "Digital Mono", "Right PGA Mux" },
  289. { "Left ADC", NULL, "Left ADC Mux" },
  290. { "Right ADC", NULL, "Right ADC Mux" },
  291. { "Left Line Mux", "Line 1", "LINPUT1" },
  292. { "Left Line Mux", "Line 2", "LINPUT2" },
  293. { "Left Line Mux", "PGA", "Left PGA Mux" },
  294. { "Left Line Mux", "Differential", "Differential Mux" },
  295. { "Right Line Mux", "Line 1", "RINPUT1" },
  296. { "Right Line Mux", "Line 2", "RINPUT2" },
  297. { "Right Line Mux", "PGA", "Right PGA Mux" },
  298. { "Right Line Mux", "Differential", "Differential Mux" },
  299. { "Left Mixer", "Playback Switch", "Left DAC" },
  300. { "Left Mixer", "Left Bypass Switch", "Left Line Mux" },
  301. { "Left Mixer", "Right Playback Switch", "Right DAC" },
  302. { "Left Mixer", "Right Bypass Switch", "Right Line Mux" },
  303. { "Right Mixer", "Left Playback Switch", "Left DAC" },
  304. { "Right Mixer", "Left Bypass Switch", "Left Line Mux" },
  305. { "Right Mixer", "Playback Switch", "Right DAC" },
  306. { "Right Mixer", "Right Bypass Switch", "Right Line Mux" },
  307. { "Left Out 1", NULL, "Left Mixer" },
  308. { "LOUT1", NULL, "Left Out 1" },
  309. { "Right Out 1", NULL, "Right Mixer" },
  310. { "ROUT1", NULL, "Right Out 1" },
  311. { "Left Out 2", NULL, "Left Mixer" },
  312. { "LOUT2", NULL, "Left Out 2" },
  313. { "Right Out 2", NULL, "Right Mixer" },
  314. { "ROUT2", NULL, "Right Out 2" },
  315. };
  316. struct _coeff_div {
  317. u32 mclk;
  318. u32 rate;
  319. u16 fs;
  320. u8 sr:5;
  321. u8 usb:1;
  322. };
  323. /* codec hifi mclk clock divider coefficients */
  324. static const struct _coeff_div coeff_div[] = {
  325. /* 8k */
  326. {12288000, 8000, 1536, 0x6, 0x0},
  327. {11289600, 8000, 1408, 0x16, 0x0},
  328. {18432000, 8000, 2304, 0x7, 0x0},
  329. {16934400, 8000, 2112, 0x17, 0x0},
  330. {12000000, 8000, 1500, 0x6, 0x1},
  331. /* 11.025k */
  332. {11289600, 11025, 1024, 0x18, 0x0},
  333. {16934400, 11025, 1536, 0x19, 0x0},
  334. {12000000, 11025, 1088, 0x19, 0x1},
  335. /* 16k */
  336. {12288000, 16000, 768, 0xa, 0x0},
  337. {18432000, 16000, 1152, 0xb, 0x0},
  338. {12000000, 16000, 750, 0xa, 0x1},
  339. /* 22.05k */
  340. {11289600, 22050, 512, 0x1a, 0x0},
  341. {16934400, 22050, 768, 0x1b, 0x0},
  342. {12000000, 22050, 544, 0x1b, 0x1},
  343. /* 32k */
  344. {12288000, 32000, 384, 0xc, 0x0},
  345. {18432000, 32000, 576, 0xd, 0x0},
  346. {12000000, 32000, 375, 0xa, 0x1},
  347. /* 44.1k */
  348. {11289600, 44100, 256, 0x10, 0x0},
  349. {16934400, 44100, 384, 0x11, 0x0},
  350. {12000000, 44100, 272, 0x11, 0x1},
  351. /* 48k */
  352. {12288000, 48000, 256, 0x0, 0x0},
  353. {18432000, 48000, 384, 0x1, 0x0},
  354. {12000000, 48000, 250, 0x0, 0x1},
  355. /* 88.2k */
  356. {11289600, 88200, 128, 0x1e, 0x0},
  357. {16934400, 88200, 192, 0x1f, 0x0},
  358. {12000000, 88200, 136, 0x1f, 0x1},
  359. /* 96k */
  360. {12288000, 96000, 128, 0xe, 0x0},
  361. {18432000, 96000, 192, 0xf, 0x0},
  362. {12000000, 96000, 125, 0xe, 0x1},
  363. };
  364. static inline int get_coeff(int mclk, int rate)
  365. {
  366. int i;
  367. for (i = 0; i < ARRAY_SIZE(coeff_div); i++) {
  368. if (coeff_div[i].rate == rate && coeff_div[i].mclk == mclk)
  369. return i;
  370. }
  371. return -EINVAL;
  372. }
  373. /* The set of rates we can generate from the above for each SYSCLK */
  374. static unsigned int rates_12288[] = {
  375. 8000, 12000, 16000, 24000, 24000, 32000, 48000, 96000,
  376. };
  377. static struct snd_pcm_hw_constraint_list constraints_12288 = {
  378. .count = ARRAY_SIZE(rates_12288),
  379. .list = rates_12288,
  380. };
  381. static unsigned int rates_112896[] = {
  382. 8000, 11025, 22050, 44100,
  383. };
  384. static struct snd_pcm_hw_constraint_list constraints_112896 = {
  385. .count = ARRAY_SIZE(rates_112896),
  386. .list = rates_112896,
  387. };
  388. static unsigned int rates_12[] = {
  389. 8000, 11025, 12000, 16000, 22050, 2400, 32000, 41100, 48000,
  390. 48000, 88235, 96000,
  391. };
  392. static struct snd_pcm_hw_constraint_list constraints_12 = {
  393. .count = ARRAY_SIZE(rates_12),
  394. .list = rates_12,
  395. };
  396. /*
  397. * Note that this should be called from init rather than from hw_params.
  398. */
  399. static int wm8988_set_dai_sysclk(struct snd_soc_dai *codec_dai,
  400. int clk_id, unsigned int freq, int dir)
  401. {
  402. struct snd_soc_codec *codec = codec_dai->codec;
  403. struct wm8988_priv *wm8988 = codec->private_data;
  404. switch (freq) {
  405. case 11289600:
  406. case 18432000:
  407. case 22579200:
  408. case 36864000:
  409. wm8988->sysclk_constraints = &constraints_112896;
  410. wm8988->sysclk = freq;
  411. return 0;
  412. case 12288000:
  413. case 16934400:
  414. case 24576000:
  415. case 33868800:
  416. wm8988->sysclk_constraints = &constraints_12288;
  417. wm8988->sysclk = freq;
  418. return 0;
  419. case 12000000:
  420. case 24000000:
  421. wm8988->sysclk_constraints = &constraints_12;
  422. wm8988->sysclk = freq;
  423. return 0;
  424. }
  425. return -EINVAL;
  426. }
  427. static int wm8988_set_dai_fmt(struct snd_soc_dai *codec_dai,
  428. unsigned int fmt)
  429. {
  430. struct snd_soc_codec *codec = codec_dai->codec;
  431. u16 iface = 0;
  432. /* set master/slave audio interface */
  433. switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
  434. case SND_SOC_DAIFMT_CBM_CFM:
  435. iface = 0x0040;
  436. break;
  437. case SND_SOC_DAIFMT_CBS_CFS:
  438. break;
  439. default:
  440. return -EINVAL;
  441. }
  442. /* interface format */
  443. switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
  444. case SND_SOC_DAIFMT_I2S:
  445. iface |= 0x0002;
  446. break;
  447. case SND_SOC_DAIFMT_RIGHT_J:
  448. break;
  449. case SND_SOC_DAIFMT_LEFT_J:
  450. iface |= 0x0001;
  451. break;
  452. case SND_SOC_DAIFMT_DSP_A:
  453. iface |= 0x0003;
  454. break;
  455. case SND_SOC_DAIFMT_DSP_B:
  456. iface |= 0x0013;
  457. break;
  458. default:
  459. return -EINVAL;
  460. }
  461. /* clock inversion */
  462. switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
  463. case SND_SOC_DAIFMT_NB_NF:
  464. break;
  465. case SND_SOC_DAIFMT_IB_IF:
  466. iface |= 0x0090;
  467. break;
  468. case SND_SOC_DAIFMT_IB_NF:
  469. iface |= 0x0080;
  470. break;
  471. case SND_SOC_DAIFMT_NB_IF:
  472. iface |= 0x0010;
  473. break;
  474. default:
  475. return -EINVAL;
  476. }
  477. snd_soc_write(codec, WM8988_IFACE, iface);
  478. return 0;
  479. }
  480. static int wm8988_pcm_startup(struct snd_pcm_substream *substream,
  481. struct snd_soc_dai *dai)
  482. {
  483. struct snd_soc_codec *codec = dai->codec;
  484. struct wm8988_priv *wm8988 = codec->private_data;
  485. /* The set of sample rates that can be supported depends on the
  486. * MCLK supplied to the CODEC - enforce this.
  487. */
  488. if (!wm8988->sysclk) {
  489. dev_err(codec->dev,
  490. "No MCLK configured, call set_sysclk() on init\n");
  491. return -EINVAL;
  492. }
  493. snd_pcm_hw_constraint_list(substream->runtime, 0,
  494. SNDRV_PCM_HW_PARAM_RATE,
  495. wm8988->sysclk_constraints);
  496. return 0;
  497. }
  498. static int wm8988_pcm_hw_params(struct snd_pcm_substream *substream,
  499. struct snd_pcm_hw_params *params,
  500. struct snd_soc_dai *dai)
  501. {
  502. struct snd_soc_pcm_runtime *rtd = substream->private_data;
  503. struct snd_soc_device *socdev = rtd->socdev;
  504. struct snd_soc_codec *codec = socdev->card->codec;
  505. struct wm8988_priv *wm8988 = codec->private_data;
  506. u16 iface = snd_soc_read(codec, WM8988_IFACE) & 0x1f3;
  507. u16 srate = snd_soc_read(codec, WM8988_SRATE) & 0x180;
  508. int coeff;
  509. coeff = get_coeff(wm8988->sysclk, params_rate(params));
  510. if (coeff < 0) {
  511. coeff = get_coeff(wm8988->sysclk / 2, params_rate(params));
  512. srate |= 0x40;
  513. }
  514. if (coeff < 0) {
  515. dev_err(codec->dev,
  516. "Unable to configure sample rate %dHz with %dHz MCLK\n",
  517. params_rate(params), wm8988->sysclk);
  518. return coeff;
  519. }
  520. /* bit size */
  521. switch (params_format(params)) {
  522. case SNDRV_PCM_FORMAT_S16_LE:
  523. break;
  524. case SNDRV_PCM_FORMAT_S20_3LE:
  525. iface |= 0x0004;
  526. break;
  527. case SNDRV_PCM_FORMAT_S24_LE:
  528. iface |= 0x0008;
  529. break;
  530. case SNDRV_PCM_FORMAT_S32_LE:
  531. iface |= 0x000c;
  532. break;
  533. }
  534. /* set iface & srate */
  535. snd_soc_write(codec, WM8988_IFACE, iface);
  536. if (coeff >= 0)
  537. snd_soc_write(codec, WM8988_SRATE, srate |
  538. (coeff_div[coeff].sr << 1) | coeff_div[coeff].usb);
  539. return 0;
  540. }
  541. static int wm8988_mute(struct snd_soc_dai *dai, int mute)
  542. {
  543. struct snd_soc_codec *codec = dai->codec;
  544. u16 mute_reg = snd_soc_read(codec, WM8988_ADCDAC) & 0xfff7;
  545. if (mute)
  546. snd_soc_write(codec, WM8988_ADCDAC, mute_reg | 0x8);
  547. else
  548. snd_soc_write(codec, WM8988_ADCDAC, mute_reg);
  549. return 0;
  550. }
  551. static int wm8988_set_bias_level(struct snd_soc_codec *codec,
  552. enum snd_soc_bias_level level)
  553. {
  554. u16 pwr_reg = snd_soc_read(codec, WM8988_PWR1) & ~0x1c1;
  555. switch (level) {
  556. case SND_SOC_BIAS_ON:
  557. break;
  558. case SND_SOC_BIAS_PREPARE:
  559. /* VREF, VMID=2x50k, digital enabled */
  560. snd_soc_write(codec, WM8988_PWR1, pwr_reg | 0x00c0);
  561. break;
  562. case SND_SOC_BIAS_STANDBY:
  563. if (codec->bias_level == SND_SOC_BIAS_OFF) {
  564. /* VREF, VMID=2x5k */
  565. snd_soc_write(codec, WM8988_PWR1, pwr_reg | 0x1c1);
  566. /* Charge caps */
  567. msleep(100);
  568. }
  569. /* VREF, VMID=2*500k, digital stopped */
  570. snd_soc_write(codec, WM8988_PWR1, pwr_reg | 0x0141);
  571. break;
  572. case SND_SOC_BIAS_OFF:
  573. snd_soc_write(codec, WM8988_PWR1, 0x0000);
  574. break;
  575. }
  576. codec->bias_level = level;
  577. return 0;
  578. }
  579. #define WM8988_RATES SNDRV_PCM_RATE_8000_96000
  580. #define WM8988_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
  581. SNDRV_PCM_FMTBIT_S24_LE)
  582. static struct snd_soc_dai_ops wm8988_ops = {
  583. .startup = wm8988_pcm_startup,
  584. .hw_params = wm8988_pcm_hw_params,
  585. .set_fmt = wm8988_set_dai_fmt,
  586. .set_sysclk = wm8988_set_dai_sysclk,
  587. .digital_mute = wm8988_mute,
  588. };
  589. struct snd_soc_dai wm8988_dai = {
  590. .name = "WM8988",
  591. .playback = {
  592. .stream_name = "Playback",
  593. .channels_min = 1,
  594. .channels_max = 2,
  595. .rates = WM8988_RATES,
  596. .formats = WM8988_FORMATS,
  597. },
  598. .capture = {
  599. .stream_name = "Capture",
  600. .channels_min = 1,
  601. .channels_max = 2,
  602. .rates = WM8988_RATES,
  603. .formats = WM8988_FORMATS,
  604. },
  605. .ops = &wm8988_ops,
  606. .symmetric_rates = 1,
  607. };
  608. EXPORT_SYMBOL_GPL(wm8988_dai);
  609. static int wm8988_suspend(struct platform_device *pdev, pm_message_t state)
  610. {
  611. struct snd_soc_device *socdev = platform_get_drvdata(pdev);
  612. struct snd_soc_codec *codec = socdev->card->codec;
  613. wm8988_set_bias_level(codec, SND_SOC_BIAS_OFF);
  614. return 0;
  615. }
  616. static int wm8988_resume(struct platform_device *pdev)
  617. {
  618. struct snd_soc_device *socdev = platform_get_drvdata(pdev);
  619. struct snd_soc_codec *codec = socdev->card->codec;
  620. int i;
  621. u8 data[2];
  622. u16 *cache = codec->reg_cache;
  623. /* Sync reg_cache with the hardware */
  624. for (i = 0; i < WM8988_NUM_REG; i++) {
  625. if (i == WM8988_RESET)
  626. continue;
  627. data[0] = (i << 1) | ((cache[i] >> 8) & 0x0001);
  628. data[1] = cache[i] & 0x00ff;
  629. codec->hw_write(codec->control_data, data, 2);
  630. }
  631. wm8988_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
  632. return 0;
  633. }
  634. static struct snd_soc_codec *wm8988_codec;
  635. static int wm8988_probe(struct platform_device *pdev)
  636. {
  637. struct snd_soc_device *socdev = platform_get_drvdata(pdev);
  638. struct snd_soc_codec *codec;
  639. int ret = 0;
  640. if (wm8988_codec == NULL) {
  641. dev_err(&pdev->dev, "Codec device not registered\n");
  642. return -ENODEV;
  643. }
  644. socdev->card->codec = wm8988_codec;
  645. codec = wm8988_codec;
  646. /* register pcms */
  647. ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
  648. if (ret < 0) {
  649. dev_err(codec->dev, "failed to create pcms: %d\n", ret);
  650. goto pcm_err;
  651. }
  652. snd_soc_add_controls(codec, wm8988_snd_controls,
  653. ARRAY_SIZE(wm8988_snd_controls));
  654. snd_soc_dapm_new_controls(codec, wm8988_dapm_widgets,
  655. ARRAY_SIZE(wm8988_dapm_widgets));
  656. snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
  657. snd_soc_dapm_new_widgets(codec);
  658. ret = snd_soc_init_card(socdev);
  659. if (ret < 0) {
  660. dev_err(codec->dev, "failed to register card: %d\n", ret);
  661. goto card_err;
  662. }
  663. return ret;
  664. card_err:
  665. snd_soc_free_pcms(socdev);
  666. snd_soc_dapm_free(socdev);
  667. pcm_err:
  668. return ret;
  669. }
  670. static int wm8988_remove(struct platform_device *pdev)
  671. {
  672. struct snd_soc_device *socdev = platform_get_drvdata(pdev);
  673. snd_soc_free_pcms(socdev);
  674. snd_soc_dapm_free(socdev);
  675. return 0;
  676. }
  677. struct snd_soc_codec_device soc_codec_dev_wm8988 = {
  678. .probe = wm8988_probe,
  679. .remove = wm8988_remove,
  680. .suspend = wm8988_suspend,
  681. .resume = wm8988_resume,
  682. };
  683. EXPORT_SYMBOL_GPL(soc_codec_dev_wm8988);
  684. static int wm8988_register(struct wm8988_priv *wm8988,
  685. enum snd_soc_control_type control)
  686. {
  687. struct snd_soc_codec *codec = &wm8988->codec;
  688. int ret;
  689. u16 reg;
  690. if (wm8988_codec) {
  691. dev_err(codec->dev, "Another WM8988 is registered\n");
  692. ret = -EINVAL;
  693. goto err;
  694. }
  695. mutex_init(&codec->mutex);
  696. INIT_LIST_HEAD(&codec->dapm_widgets);
  697. INIT_LIST_HEAD(&codec->dapm_paths);
  698. codec->private_data = wm8988;
  699. codec->name = "WM8988";
  700. codec->owner = THIS_MODULE;
  701. codec->dai = &wm8988_dai;
  702. codec->num_dai = 1;
  703. codec->reg_cache_size = ARRAY_SIZE(wm8988->reg_cache);
  704. codec->reg_cache = &wm8988->reg_cache;
  705. codec->bias_level = SND_SOC_BIAS_OFF;
  706. codec->set_bias_level = wm8988_set_bias_level;
  707. memcpy(codec->reg_cache, wm8988_reg,
  708. sizeof(wm8988_reg));
  709. ret = snd_soc_codec_set_cache_io(codec, 7, 9, control);
  710. if (ret < 0) {
  711. dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
  712. goto err;
  713. }
  714. ret = wm8988_reset(codec);
  715. if (ret < 0) {
  716. dev_err(codec->dev, "Failed to issue reset\n");
  717. goto err;
  718. }
  719. /* set the update bits (we always update left then right) */
  720. reg = snd_soc_read(codec, WM8988_RADC);
  721. snd_soc_write(codec, WM8988_RADC, reg | 0x100);
  722. reg = snd_soc_read(codec, WM8988_RDAC);
  723. snd_soc_write(codec, WM8988_RDAC, reg | 0x0100);
  724. reg = snd_soc_read(codec, WM8988_ROUT1V);
  725. snd_soc_write(codec, WM8988_ROUT1V, reg | 0x0100);
  726. reg = snd_soc_read(codec, WM8988_ROUT2V);
  727. snd_soc_write(codec, WM8988_ROUT2V, reg | 0x0100);
  728. reg = snd_soc_read(codec, WM8988_RINVOL);
  729. snd_soc_write(codec, WM8988_RINVOL, reg | 0x0100);
  730. wm8988_set_bias_level(&wm8988->codec, SND_SOC_BIAS_STANDBY);
  731. wm8988_dai.dev = codec->dev;
  732. wm8988_codec = codec;
  733. ret = snd_soc_register_codec(codec);
  734. if (ret != 0) {
  735. dev_err(codec->dev, "Failed to register codec: %d\n", ret);
  736. goto err;
  737. }
  738. ret = snd_soc_register_dai(&wm8988_dai);
  739. if (ret != 0) {
  740. dev_err(codec->dev, "Failed to register DAI: %d\n", ret);
  741. snd_soc_unregister_codec(codec);
  742. goto err_codec;
  743. }
  744. return 0;
  745. err_codec:
  746. snd_soc_unregister_codec(codec);
  747. err:
  748. kfree(wm8988);
  749. return ret;
  750. }
  751. static void wm8988_unregister(struct wm8988_priv *wm8988)
  752. {
  753. wm8988_set_bias_level(&wm8988->codec, SND_SOC_BIAS_OFF);
  754. snd_soc_unregister_dai(&wm8988_dai);
  755. snd_soc_unregister_codec(&wm8988->codec);
  756. kfree(wm8988);
  757. wm8988_codec = NULL;
  758. }
  759. #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
  760. static int wm8988_i2c_probe(struct i2c_client *i2c,
  761. const struct i2c_device_id *id)
  762. {
  763. struct wm8988_priv *wm8988;
  764. struct snd_soc_codec *codec;
  765. wm8988 = kzalloc(sizeof(struct wm8988_priv), GFP_KERNEL);
  766. if (wm8988 == NULL)
  767. return -ENOMEM;
  768. codec = &wm8988->codec;
  769. i2c_set_clientdata(i2c, wm8988);
  770. codec->control_data = i2c;
  771. codec->dev = &i2c->dev;
  772. return wm8988_register(wm8988, SND_SOC_I2C);
  773. }
  774. static int wm8988_i2c_remove(struct i2c_client *client)
  775. {
  776. struct wm8988_priv *wm8988 = i2c_get_clientdata(client);
  777. wm8988_unregister(wm8988);
  778. return 0;
  779. }
  780. #ifdef CONFIG_PM
  781. static int wm8988_i2c_suspend(struct i2c_client *client, pm_message_t msg)
  782. {
  783. return snd_soc_suspend_device(&client->dev);
  784. }
  785. static int wm8988_i2c_resume(struct i2c_client *client)
  786. {
  787. return snd_soc_resume_device(&client->dev);
  788. }
  789. #else
  790. #define wm8988_i2c_suspend NULL
  791. #define wm8988_i2c_resume NULL
  792. #endif
  793. static const struct i2c_device_id wm8988_i2c_id[] = {
  794. { "wm8988", 0 },
  795. { }
  796. };
  797. MODULE_DEVICE_TABLE(i2c, wm8988_i2c_id);
  798. static struct i2c_driver wm8988_i2c_driver = {
  799. .driver = {
  800. .name = "WM8988",
  801. .owner = THIS_MODULE,
  802. },
  803. .probe = wm8988_i2c_probe,
  804. .remove = wm8988_i2c_remove,
  805. .suspend = wm8988_i2c_suspend,
  806. .resume = wm8988_i2c_resume,
  807. .id_table = wm8988_i2c_id,
  808. };
  809. #endif
  810. #if defined(CONFIG_SPI_MASTER)
  811. static int __devinit wm8988_spi_probe(struct spi_device *spi)
  812. {
  813. struct wm8988_priv *wm8988;
  814. struct snd_soc_codec *codec;
  815. wm8988 = kzalloc(sizeof(struct wm8988_priv), GFP_KERNEL);
  816. if (wm8988 == NULL)
  817. return -ENOMEM;
  818. codec = &wm8988->codec;
  819. codec->control_data = spi;
  820. codec->dev = &spi->dev;
  821. dev_set_drvdata(&spi->dev, wm8988);
  822. return wm8988_register(wm8988, SND_SOC_SPI);
  823. }
  824. static int __devexit wm8988_spi_remove(struct spi_device *spi)
  825. {
  826. struct wm8988_priv *wm8988 = dev_get_drvdata(&spi->dev);
  827. wm8988_unregister(wm8988);
  828. return 0;
  829. }
  830. #ifdef CONFIG_PM
  831. static int wm8988_spi_suspend(struct spi_device *spi, pm_message_t msg)
  832. {
  833. return snd_soc_suspend_device(&spi->dev);
  834. }
  835. static int wm8988_spi_resume(struct spi_device *spi)
  836. {
  837. return snd_soc_resume_device(&spi->dev);
  838. }
  839. #else
  840. #define wm8988_spi_suspend NULL
  841. #define wm8988_spi_resume NULL
  842. #endif
  843. static struct spi_driver wm8988_spi_driver = {
  844. .driver = {
  845. .name = "wm8988",
  846. .bus = &spi_bus_type,
  847. .owner = THIS_MODULE,
  848. },
  849. .probe = wm8988_spi_probe,
  850. .remove = __devexit_p(wm8988_spi_remove),
  851. .suspend = wm8988_spi_suspend,
  852. .resume = wm8988_spi_resume,
  853. };
  854. #endif
  855. static int __init wm8988_modinit(void)
  856. {
  857. int ret;
  858. #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
  859. ret = i2c_add_driver(&wm8988_i2c_driver);
  860. if (ret != 0)
  861. pr_err("WM8988: Unable to register I2C driver: %d\n", ret);
  862. #endif
  863. #if defined(CONFIG_SPI_MASTER)
  864. ret = spi_register_driver(&wm8988_spi_driver);
  865. if (ret != 0)
  866. pr_err("WM8988: Unable to register SPI driver: %d\n", ret);
  867. #endif
  868. return ret;
  869. }
  870. module_init(wm8988_modinit);
  871. static void __exit wm8988_exit(void)
  872. {
  873. #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
  874. i2c_del_driver(&wm8988_i2c_driver);
  875. #endif
  876. #if defined(CONFIG_SPI_MASTER)
  877. spi_unregister_driver(&wm8988_spi_driver);
  878. #endif
  879. }
  880. module_exit(wm8988_exit);
  881. MODULE_DESCRIPTION("ASoC WM8988 driver");
  882. MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
  883. MODULE_LICENSE("GPL");