cs47l24.c 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332
  1. /*
  2. * cs47l24.h -- ALSA SoC Audio driver for Cirrus Logic CS47L24
  3. *
  4. * Copyright 2015 Cirrus Logic Inc.
  5. *
  6. * Author: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/module.h>
  13. #include <linux/moduleparam.h>
  14. #include <linux/init.h>
  15. #include <linux/delay.h>
  16. #include <linux/pm.h>
  17. #include <linux/pm_runtime.h>
  18. #include <linux/regmap.h>
  19. #include <linux/slab.h>
  20. #include <sound/core.h>
  21. #include <sound/pcm.h>
  22. #include <sound/pcm_params.h>
  23. #include <sound/soc.h>
  24. #include <sound/jack.h>
  25. #include <sound/initval.h>
  26. #include <sound/tlv.h>
  27. #include <linux/mfd/arizona/core.h>
  28. #include <linux/mfd/arizona/registers.h>
  29. #include "arizona.h"
  30. #include "wm_adsp.h"
  31. #include "cs47l24.h"
  32. struct cs47l24_priv {
  33. struct arizona_priv core;
  34. struct arizona_fll fll[2];
  35. };
  36. static const struct wm_adsp_region cs47l24_dsp2_regions[] = {
  37. { .type = WMFW_ADSP2_PM, .base = 0x200000 },
  38. { .type = WMFW_ADSP2_ZM, .base = 0x280000 },
  39. { .type = WMFW_ADSP2_XM, .base = 0x290000 },
  40. { .type = WMFW_ADSP2_YM, .base = 0x2a8000 },
  41. };
  42. static const struct wm_adsp_region cs47l24_dsp3_regions[] = {
  43. { .type = WMFW_ADSP2_PM, .base = 0x300000 },
  44. { .type = WMFW_ADSP2_ZM, .base = 0x380000 },
  45. { .type = WMFW_ADSP2_XM, .base = 0x390000 },
  46. { .type = WMFW_ADSP2_YM, .base = 0x3a8000 },
  47. };
  48. static const struct wm_adsp_region *cs47l24_dsp_regions[] = {
  49. cs47l24_dsp2_regions,
  50. cs47l24_dsp3_regions,
  51. };
  52. static int cs47l24_adsp_power_ev(struct snd_soc_dapm_widget *w,
  53. struct snd_kcontrol *kcontrol, int event)
  54. {
  55. struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
  56. struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
  57. unsigned int v;
  58. int ret;
  59. ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v);
  60. if (ret != 0) {
  61. dev_err(codec->dev, "Failed to read SYSCLK state: %d\n", ret);
  62. return ret;
  63. }
  64. v = (v & ARIZONA_SYSCLK_FREQ_MASK) >> ARIZONA_SYSCLK_FREQ_SHIFT;
  65. return wm_adsp2_early_event(w, kcontrol, event, v);
  66. }
  67. static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
  68. static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
  69. static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
  70. static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
  71. #define CS47L24_NG_SRC(name, base) \
  72. SOC_SINGLE(name " NG HPOUT1L Switch", base, 0, 1, 0), \
  73. SOC_SINGLE(name " NG HPOUT1R Switch", base, 1, 1, 0), \
  74. SOC_SINGLE(name " NG SPKOUT Switch", base, 6, 1, 0)
  75. static const struct snd_kcontrol_new cs47l24_snd_controls[] = {
  76. SOC_ENUM("IN1 OSR", arizona_in_dmic_osr[0]),
  77. SOC_ENUM("IN2 OSR", arizona_in_dmic_osr[1]),
  78. SOC_ENUM("IN HPF Cutoff Frequency", arizona_in_hpf_cut_enum),
  79. SOC_SINGLE("IN1L HPF Switch", ARIZONA_IN1L_CONTROL,
  80. ARIZONA_IN1L_HPF_SHIFT, 1, 0),
  81. SOC_SINGLE("IN1R HPF Switch", ARIZONA_IN1R_CONTROL,
  82. ARIZONA_IN1R_HPF_SHIFT, 1, 0),
  83. SOC_SINGLE("IN2L HPF Switch", ARIZONA_IN2L_CONTROL,
  84. ARIZONA_IN2L_HPF_SHIFT, 1, 0),
  85. SOC_SINGLE("IN2R HPF Switch", ARIZONA_IN2R_CONTROL,
  86. ARIZONA_IN2R_HPF_SHIFT, 1, 0),
  87. SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
  88. ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
  89. SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R,
  90. ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
  91. SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
  92. ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
  93. SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R,
  94. ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
  95. SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
  96. SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
  97. ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
  98. ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
  99. ARIZONA_EQ_CONTROL("EQ1 Coefficients", ARIZONA_EQ1_2),
  100. SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
  101. 24, 0, eq_tlv),
  102. SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
  103. 24, 0, eq_tlv),
  104. SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
  105. 24, 0, eq_tlv),
  106. SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
  107. 24, 0, eq_tlv),
  108. SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
  109. 24, 0, eq_tlv),
  110. ARIZONA_EQ_CONTROL("EQ2 Coefficients", ARIZONA_EQ2_2),
  111. SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
  112. 24, 0, eq_tlv),
  113. SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
  114. 24, 0, eq_tlv),
  115. SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
  116. 24, 0, eq_tlv),
  117. SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
  118. 24, 0, eq_tlv),
  119. SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
  120. 24, 0, eq_tlv),
  121. ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
  122. ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
  123. ARIZONA_MIXER_CONTROLS("DRC2L", ARIZONA_DRC2LMIX_INPUT_1_SOURCE),
  124. ARIZONA_MIXER_CONTROLS("DRC2R", ARIZONA_DRC2RMIX_INPUT_1_SOURCE),
  125. SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
  126. ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
  127. SND_SOC_BYTES_MASK("DRC2", ARIZONA_DRC2_CTRL1, 5,
  128. ARIZONA_DRC2R_ENA | ARIZONA_DRC2L_ENA),
  129. ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
  130. ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
  131. ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
  132. ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
  133. ARIZONA_LHPF_CONTROL("LHPF1 Coefficients", ARIZONA_HPLPF1_2),
  134. ARIZONA_LHPF_CONTROL("LHPF2 Coefficients", ARIZONA_HPLPF2_2),
  135. ARIZONA_LHPF_CONTROL("LHPF3 Coefficients", ARIZONA_HPLPF3_2),
  136. ARIZONA_LHPF_CONTROL("LHPF4 Coefficients", ARIZONA_HPLPF4_2),
  137. SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
  138. SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
  139. SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
  140. SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
  141. SOC_ENUM("ISRC1 FSL", arizona_isrc_fsl[0]),
  142. SOC_ENUM("ISRC2 FSL", arizona_isrc_fsl[1]),
  143. SOC_ENUM("ISRC3 FSL", arizona_isrc_fsl[2]),
  144. SOC_ENUM("ISRC1 FSH", arizona_isrc_fsh[0]),
  145. SOC_ENUM("ISRC2 FSH", arizona_isrc_fsh[1]),
  146. SOC_ENUM("ISRC3 FSH", arizona_isrc_fsh[2]),
  147. SOC_ENUM("ASRC RATE 1", arizona_asrc_rate1),
  148. ARIZONA_MIXER_CONTROLS("DSP2L", ARIZONA_DSP2LMIX_INPUT_1_SOURCE),
  149. ARIZONA_MIXER_CONTROLS("DSP2R", ARIZONA_DSP2RMIX_INPUT_1_SOURCE),
  150. ARIZONA_MIXER_CONTROLS("DSP3L", ARIZONA_DSP3LMIX_INPUT_1_SOURCE),
  151. ARIZONA_MIXER_CONTROLS("DSP3R", ARIZONA_DSP3RMIX_INPUT_1_SOURCE),
  152. SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR,
  153. ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv),
  154. ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
  155. ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
  156. ARIZONA_MIXER_CONTROLS("SPKOUT", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
  157. SOC_SINGLE("HPOUT1 SC Protect Switch", ARIZONA_HP1_SHORT_CIRCUIT_CTRL,
  158. ARIZONA_HP1_SC_ENA_SHIFT, 1, 0),
  159. SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
  160. ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
  161. SOC_SINGLE("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
  162. ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
  163. SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
  164. ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
  165. 0xbf, 0, digital_tlv),
  166. SOC_SINGLE_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
  167. ARIZONA_OUT4L_VOL_SHIFT,
  168. 0xbf, 0, digital_tlv),
  169. SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
  170. SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
  171. SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
  172. ARIZONA_NGATE_ENA_SHIFT, 1, 0),
  173. SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
  174. ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
  175. SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
  176. CS47L24_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
  177. CS47L24_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
  178. CS47L24_NG_SRC("SPKOUT", ARIZONA_NOISE_GATE_SELECT_4L),
  179. ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
  180. ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
  181. ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
  182. ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
  183. ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
  184. ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
  185. ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE),
  186. ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE),
  187. ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
  188. ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
  189. ARIZONA_MIXER_CONTROLS("AIF2TX3", ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE),
  190. ARIZONA_MIXER_CONTROLS("AIF2TX4", ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE),
  191. ARIZONA_MIXER_CONTROLS("AIF2TX5", ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE),
  192. ARIZONA_MIXER_CONTROLS("AIF2TX6", ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE),
  193. ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
  194. ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
  195. };
  196. ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
  197. ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
  198. ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
  199. ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
  200. ARIZONA_MIXER_ENUMS(DRC2L, ARIZONA_DRC2LMIX_INPUT_1_SOURCE);
  201. ARIZONA_MIXER_ENUMS(DRC2R, ARIZONA_DRC2RMIX_INPUT_1_SOURCE);
  202. ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
  203. ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
  204. ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
  205. ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
  206. ARIZONA_MIXER_ENUMS(DSP2L, ARIZONA_DSP2LMIX_INPUT_1_SOURCE);
  207. ARIZONA_MIXER_ENUMS(DSP2R, ARIZONA_DSP2RMIX_INPUT_1_SOURCE);
  208. ARIZONA_DSP_AUX_ENUMS(DSP2, ARIZONA_DSP2AUX1MIX_INPUT_1_SOURCE);
  209. ARIZONA_MIXER_ENUMS(DSP3L, ARIZONA_DSP3LMIX_INPUT_1_SOURCE);
  210. ARIZONA_MIXER_ENUMS(DSP3R, ARIZONA_DSP3RMIX_INPUT_1_SOURCE);
  211. ARIZONA_DSP_AUX_ENUMS(DSP3, ARIZONA_DSP3AUX1MIX_INPUT_1_SOURCE);
  212. ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
  213. ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
  214. ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
  215. ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
  216. ARIZONA_MIXER_ENUMS(SPKOUT, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
  217. ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
  218. ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
  219. ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
  220. ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
  221. ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
  222. ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
  223. ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE);
  224. ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE);
  225. ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
  226. ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
  227. ARIZONA_MIXER_ENUMS(AIF2TX3, ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE);
  228. ARIZONA_MIXER_ENUMS(AIF2TX4, ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE);
  229. ARIZONA_MIXER_ENUMS(AIF2TX5, ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE);
  230. ARIZONA_MIXER_ENUMS(AIF2TX6, ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE);
  231. ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE);
  232. ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE);
  233. ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE);
  234. ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE);
  235. ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE);
  236. ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE);
  237. ARIZONA_MUX_ENUMS(ISRC1INT1, ARIZONA_ISRC1INT1MIX_INPUT_1_SOURCE);
  238. ARIZONA_MUX_ENUMS(ISRC1INT2, ARIZONA_ISRC1INT2MIX_INPUT_1_SOURCE);
  239. ARIZONA_MUX_ENUMS(ISRC1INT3, ARIZONA_ISRC1INT3MIX_INPUT_1_SOURCE);
  240. ARIZONA_MUX_ENUMS(ISRC1INT4, ARIZONA_ISRC1INT4MIX_INPUT_1_SOURCE);
  241. ARIZONA_MUX_ENUMS(ISRC1DEC1, ARIZONA_ISRC1DEC1MIX_INPUT_1_SOURCE);
  242. ARIZONA_MUX_ENUMS(ISRC1DEC2, ARIZONA_ISRC1DEC2MIX_INPUT_1_SOURCE);
  243. ARIZONA_MUX_ENUMS(ISRC1DEC3, ARIZONA_ISRC1DEC3MIX_INPUT_1_SOURCE);
  244. ARIZONA_MUX_ENUMS(ISRC1DEC4, ARIZONA_ISRC1DEC4MIX_INPUT_1_SOURCE);
  245. ARIZONA_MUX_ENUMS(ISRC2INT1, ARIZONA_ISRC2INT1MIX_INPUT_1_SOURCE);
  246. ARIZONA_MUX_ENUMS(ISRC2INT2, ARIZONA_ISRC2INT2MIX_INPUT_1_SOURCE);
  247. ARIZONA_MUX_ENUMS(ISRC2INT3, ARIZONA_ISRC2INT3MIX_INPUT_1_SOURCE);
  248. ARIZONA_MUX_ENUMS(ISRC2INT4, ARIZONA_ISRC2INT4MIX_INPUT_1_SOURCE);
  249. ARIZONA_MUX_ENUMS(ISRC2DEC1, ARIZONA_ISRC2DEC1MIX_INPUT_1_SOURCE);
  250. ARIZONA_MUX_ENUMS(ISRC2DEC2, ARIZONA_ISRC2DEC2MIX_INPUT_1_SOURCE);
  251. ARIZONA_MUX_ENUMS(ISRC2DEC3, ARIZONA_ISRC2DEC3MIX_INPUT_1_SOURCE);
  252. ARIZONA_MUX_ENUMS(ISRC2DEC4, ARIZONA_ISRC2DEC4MIX_INPUT_1_SOURCE);
  253. ARIZONA_MUX_ENUMS(ISRC3INT1, ARIZONA_ISRC3INT1MIX_INPUT_1_SOURCE);
  254. ARIZONA_MUX_ENUMS(ISRC3INT2, ARIZONA_ISRC3INT2MIX_INPUT_1_SOURCE);
  255. ARIZONA_MUX_ENUMS(ISRC3INT3, ARIZONA_ISRC3INT3MIX_INPUT_1_SOURCE);
  256. ARIZONA_MUX_ENUMS(ISRC3INT4, ARIZONA_ISRC3INT4MIX_INPUT_1_SOURCE);
  257. ARIZONA_MUX_ENUMS(ISRC3DEC1, ARIZONA_ISRC3DEC1MIX_INPUT_1_SOURCE);
  258. ARIZONA_MUX_ENUMS(ISRC3DEC2, ARIZONA_ISRC3DEC2MIX_INPUT_1_SOURCE);
  259. ARIZONA_MUX_ENUMS(ISRC3DEC3, ARIZONA_ISRC3DEC3MIX_INPUT_1_SOURCE);
  260. ARIZONA_MUX_ENUMS(ISRC3DEC4, ARIZONA_ISRC3DEC4MIX_INPUT_1_SOURCE);
  261. static const char * const cs47l24_aec_loopback_texts[] = {
  262. "HPOUT1L", "HPOUT1R", "SPKOUT",
  263. };
  264. static const unsigned int cs47l24_aec_loopback_values[] = {
  265. 0, 1, 6,
  266. };
  267. static const struct soc_enum cs47l24_aec_loopback =
  268. SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
  269. ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
  270. ARRAY_SIZE(cs47l24_aec_loopback_texts),
  271. cs47l24_aec_loopback_texts,
  272. cs47l24_aec_loopback_values);
  273. static const struct snd_kcontrol_new cs47l24_aec_loopback_mux =
  274. SOC_DAPM_ENUM("AEC Loopback", cs47l24_aec_loopback);
  275. static const struct snd_soc_dapm_widget cs47l24_dapm_widgets[] = {
  276. SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1,
  277. ARIZONA_SYSCLK_ENA_SHIFT, 0, NULL, 0),
  278. SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
  279. ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
  280. SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
  281. ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
  282. SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
  283. ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
  284. SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
  285. SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
  286. SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDD", 0, 0),
  287. SND_SOC_DAPM_SIGGEN("TONE"),
  288. SND_SOC_DAPM_SIGGEN("NOISE"),
  289. SND_SOC_DAPM_SIGGEN("HAPTICS"),
  290. SND_SOC_DAPM_INPUT("IN1L"),
  291. SND_SOC_DAPM_INPUT("IN1R"),
  292. SND_SOC_DAPM_INPUT("IN2L"),
  293. SND_SOC_DAPM_INPUT("IN2R"),
  294. SND_SOC_DAPM_OUTPUT("DRC1 Signal Activity"),
  295. SND_SOC_DAPM_OUTPUT("DRC2 Signal Activity"),
  296. SND_SOC_DAPM_OUTPUT("DSP Voice Trigger"),
  297. SND_SOC_DAPM_SWITCH("DSP3 Voice Trigger", SND_SOC_NOPM, 2, 0,
  298. &arizona_voice_trigger_switch[2]),
  299. SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
  300. 0, NULL, 0, arizona_in_ev,
  301. SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
  302. SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
  303. SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
  304. 0, NULL, 0, arizona_in_ev,
  305. SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
  306. SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
  307. SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
  308. 0, NULL, 0, arizona_in_ev,
  309. SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
  310. SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
  311. SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT,
  312. 0, NULL, 0, arizona_in_ev,
  313. SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
  314. SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
  315. SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
  316. ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
  317. SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
  318. ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
  319. SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
  320. ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
  321. SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
  322. ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
  323. SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
  324. ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
  325. SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
  326. SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
  327. SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
  328. NULL, 0),
  329. SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
  330. NULL, 0),
  331. SND_SOC_DAPM_PGA("DRC2L", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2L_ENA_SHIFT, 0,
  332. NULL, 0),
  333. SND_SOC_DAPM_PGA("DRC2R", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2R_ENA_SHIFT, 0,
  334. NULL, 0),
  335. SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
  336. NULL, 0),
  337. SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
  338. NULL, 0),
  339. SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
  340. NULL, 0),
  341. SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
  342. NULL, 0),
  343. SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
  344. 0, NULL, 0),
  345. SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
  346. 0, NULL, 0),
  347. SND_SOC_DAPM_PGA("ASRC1L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1L_ENA_SHIFT, 0,
  348. NULL, 0),
  349. SND_SOC_DAPM_PGA("ASRC1R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1R_ENA_SHIFT, 0,
  350. NULL, 0),
  351. SND_SOC_DAPM_PGA("ASRC2L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2L_ENA_SHIFT, 0,
  352. NULL, 0),
  353. SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0,
  354. NULL, 0),
  355. WM_ADSP2("DSP2", 1, cs47l24_adsp_power_ev),
  356. WM_ADSP2("DSP3", 2, cs47l24_adsp_power_ev),
  357. SND_SOC_DAPM_PGA("ISRC1INT1", ARIZONA_ISRC_1_CTRL_3,
  358. ARIZONA_ISRC1_INT0_ENA_SHIFT, 0, NULL, 0),
  359. SND_SOC_DAPM_PGA("ISRC1INT2", ARIZONA_ISRC_1_CTRL_3,
  360. ARIZONA_ISRC1_INT1_ENA_SHIFT, 0, NULL, 0),
  361. SND_SOC_DAPM_PGA("ISRC1INT3", ARIZONA_ISRC_1_CTRL_3,
  362. ARIZONA_ISRC1_INT2_ENA_SHIFT, 0, NULL, 0),
  363. SND_SOC_DAPM_PGA("ISRC1INT4", ARIZONA_ISRC_1_CTRL_3,
  364. ARIZONA_ISRC1_INT3_ENA_SHIFT, 0, NULL, 0),
  365. SND_SOC_DAPM_PGA("ISRC1DEC1", ARIZONA_ISRC_1_CTRL_3,
  366. ARIZONA_ISRC1_DEC0_ENA_SHIFT, 0, NULL, 0),
  367. SND_SOC_DAPM_PGA("ISRC1DEC2", ARIZONA_ISRC_1_CTRL_3,
  368. ARIZONA_ISRC1_DEC1_ENA_SHIFT, 0, NULL, 0),
  369. SND_SOC_DAPM_PGA("ISRC1DEC3", ARIZONA_ISRC_1_CTRL_3,
  370. ARIZONA_ISRC1_DEC2_ENA_SHIFT, 0, NULL, 0),
  371. SND_SOC_DAPM_PGA("ISRC1DEC4", ARIZONA_ISRC_1_CTRL_3,
  372. ARIZONA_ISRC1_DEC3_ENA_SHIFT, 0, NULL, 0),
  373. SND_SOC_DAPM_PGA("ISRC2INT1", ARIZONA_ISRC_2_CTRL_3,
  374. ARIZONA_ISRC2_INT0_ENA_SHIFT, 0, NULL, 0),
  375. SND_SOC_DAPM_PGA("ISRC2INT2", ARIZONA_ISRC_2_CTRL_3,
  376. ARIZONA_ISRC2_INT1_ENA_SHIFT, 0, NULL, 0),
  377. SND_SOC_DAPM_PGA("ISRC2INT3", ARIZONA_ISRC_2_CTRL_3,
  378. ARIZONA_ISRC2_INT2_ENA_SHIFT, 0, NULL, 0),
  379. SND_SOC_DAPM_PGA("ISRC2INT4", ARIZONA_ISRC_2_CTRL_3,
  380. ARIZONA_ISRC2_INT3_ENA_SHIFT, 0, NULL, 0),
  381. SND_SOC_DAPM_PGA("ISRC2DEC1", ARIZONA_ISRC_2_CTRL_3,
  382. ARIZONA_ISRC2_DEC0_ENA_SHIFT, 0, NULL, 0),
  383. SND_SOC_DAPM_PGA("ISRC2DEC2", ARIZONA_ISRC_2_CTRL_3,
  384. ARIZONA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0),
  385. SND_SOC_DAPM_PGA("ISRC2DEC3", ARIZONA_ISRC_2_CTRL_3,
  386. ARIZONA_ISRC2_DEC2_ENA_SHIFT, 0, NULL, 0),
  387. SND_SOC_DAPM_PGA("ISRC2DEC4", ARIZONA_ISRC_2_CTRL_3,
  388. ARIZONA_ISRC2_DEC3_ENA_SHIFT, 0, NULL, 0),
  389. SND_SOC_DAPM_PGA("ISRC3INT1", ARIZONA_ISRC_3_CTRL_3,
  390. ARIZONA_ISRC3_INT0_ENA_SHIFT, 0, NULL, 0),
  391. SND_SOC_DAPM_PGA("ISRC3INT2", ARIZONA_ISRC_3_CTRL_3,
  392. ARIZONA_ISRC3_INT1_ENA_SHIFT, 0, NULL, 0),
  393. SND_SOC_DAPM_PGA("ISRC3INT3", ARIZONA_ISRC_3_CTRL_3,
  394. ARIZONA_ISRC3_INT2_ENA_SHIFT, 0, NULL, 0),
  395. SND_SOC_DAPM_PGA("ISRC3INT4", ARIZONA_ISRC_3_CTRL_3,
  396. ARIZONA_ISRC3_INT3_ENA_SHIFT, 0, NULL, 0),
  397. SND_SOC_DAPM_PGA("ISRC3DEC1", ARIZONA_ISRC_3_CTRL_3,
  398. ARIZONA_ISRC3_DEC0_ENA_SHIFT, 0, NULL, 0),
  399. SND_SOC_DAPM_PGA("ISRC3DEC2", ARIZONA_ISRC_3_CTRL_3,
  400. ARIZONA_ISRC3_DEC1_ENA_SHIFT, 0, NULL, 0),
  401. SND_SOC_DAPM_PGA("ISRC3DEC3", ARIZONA_ISRC_3_CTRL_3,
  402. ARIZONA_ISRC3_DEC2_ENA_SHIFT, 0, NULL, 0),
  403. SND_SOC_DAPM_PGA("ISRC3DEC4", ARIZONA_ISRC_3_CTRL_3,
  404. ARIZONA_ISRC3_DEC3_ENA_SHIFT, 0, NULL, 0),
  405. SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
  406. ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0,
  407. &cs47l24_aec_loopback_mux),
  408. SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
  409. ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
  410. SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0,
  411. ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
  412. SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0,
  413. ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
  414. SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0,
  415. ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
  416. SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 0,
  417. ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
  418. SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 0,
  419. ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
  420. SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 0,
  421. ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0),
  422. SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 0,
  423. ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0),
  424. SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
  425. ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
  426. SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 0,
  427. ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
  428. SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 0,
  429. ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
  430. SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 0,
  431. ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
  432. SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 0,
  433. ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
  434. SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 0,
  435. ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
  436. SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 0,
  437. ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0),
  438. SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 0,
  439. ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0),
  440. SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
  441. ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
  442. SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 0,
  443. ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
  444. SND_SOC_DAPM_AIF_OUT("AIF2TX3", NULL, 0,
  445. ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX3_ENA_SHIFT, 0),
  446. SND_SOC_DAPM_AIF_OUT("AIF2TX4", NULL, 0,
  447. ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX4_ENA_SHIFT, 0),
  448. SND_SOC_DAPM_AIF_OUT("AIF2TX5", NULL, 0,
  449. ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX5_ENA_SHIFT, 0),
  450. SND_SOC_DAPM_AIF_OUT("AIF2TX6", NULL, 0,
  451. ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX6_ENA_SHIFT, 0),
  452. SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
  453. ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
  454. SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 0,
  455. ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
  456. SND_SOC_DAPM_AIF_IN("AIF2RX3", NULL, 0,
  457. ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX3_ENA_SHIFT, 0),
  458. SND_SOC_DAPM_AIF_IN("AIF2RX4", NULL, 0,
  459. ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX4_ENA_SHIFT, 0),
  460. SND_SOC_DAPM_AIF_IN("AIF2RX5", NULL, 0,
  461. ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX5_ENA_SHIFT, 0),
  462. SND_SOC_DAPM_AIF_IN("AIF2RX6", NULL, 0,
  463. ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX6_ENA_SHIFT, 0),
  464. SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0,
  465. ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX1_ENA_SHIFT, 0),
  466. SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 0,
  467. ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX2_ENA_SHIFT, 0),
  468. SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0,
  469. ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX1_ENA_SHIFT, 0),
  470. SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0,
  471. ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0),
  472. SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
  473. ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
  474. SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
  475. SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
  476. SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
  477. ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
  478. SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
  479. SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
  480. ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"),
  481. ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"),
  482. ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"),
  483. ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"),
  484. ARIZONA_MIXER_WIDGETS(DRC2L, "DRC2L"),
  485. ARIZONA_MIXER_WIDGETS(DRC2R, "DRC2R"),
  486. ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
  487. ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
  488. ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
  489. ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
  490. ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
  491. ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
  492. ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
  493. ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
  494. ARIZONA_MIXER_WIDGETS(SPKOUT, "SPKOUT"),
  495. ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
  496. ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
  497. ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
  498. ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
  499. ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
  500. ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
  501. ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
  502. ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
  503. ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
  504. ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
  505. ARIZONA_MIXER_WIDGETS(AIF2TX3, "AIF2TX3"),
  506. ARIZONA_MIXER_WIDGETS(AIF2TX4, "AIF2TX4"),
  507. ARIZONA_MIXER_WIDGETS(AIF2TX5, "AIF2TX5"),
  508. ARIZONA_MIXER_WIDGETS(AIF2TX6, "AIF2TX6"),
  509. ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
  510. ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
  511. ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"),
  512. ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"),
  513. ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"),
  514. ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"),
  515. ARIZONA_DSP_WIDGETS(DSP2, "DSP2"),
  516. ARIZONA_DSP_WIDGETS(DSP3, "DSP3"),
  517. ARIZONA_MUX_WIDGETS(ISRC1DEC1, "ISRC1DEC1"),
  518. ARIZONA_MUX_WIDGETS(ISRC1DEC2, "ISRC1DEC2"),
  519. ARIZONA_MUX_WIDGETS(ISRC1DEC3, "ISRC1DEC3"),
  520. ARIZONA_MUX_WIDGETS(ISRC1DEC4, "ISRC1DEC4"),
  521. ARIZONA_MUX_WIDGETS(ISRC1INT1, "ISRC1INT1"),
  522. ARIZONA_MUX_WIDGETS(ISRC1INT2, "ISRC1INT2"),
  523. ARIZONA_MUX_WIDGETS(ISRC1INT3, "ISRC1INT3"),
  524. ARIZONA_MUX_WIDGETS(ISRC1INT4, "ISRC1INT4"),
  525. ARIZONA_MUX_WIDGETS(ISRC2DEC1, "ISRC2DEC1"),
  526. ARIZONA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DEC2"),
  527. ARIZONA_MUX_WIDGETS(ISRC2DEC3, "ISRC2DEC3"),
  528. ARIZONA_MUX_WIDGETS(ISRC2DEC4, "ISRC2DEC4"),
  529. ARIZONA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"),
  530. ARIZONA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"),
  531. ARIZONA_MUX_WIDGETS(ISRC2INT3, "ISRC2INT3"),
  532. ARIZONA_MUX_WIDGETS(ISRC2INT4, "ISRC2INT4"),
  533. ARIZONA_MUX_WIDGETS(ISRC3DEC1, "ISRC3DEC1"),
  534. ARIZONA_MUX_WIDGETS(ISRC3DEC2, "ISRC3DEC2"),
  535. ARIZONA_MUX_WIDGETS(ISRC3DEC3, "ISRC3DEC3"),
  536. ARIZONA_MUX_WIDGETS(ISRC3DEC4, "ISRC3DEC4"),
  537. ARIZONA_MUX_WIDGETS(ISRC3INT1, "ISRC3INT1"),
  538. ARIZONA_MUX_WIDGETS(ISRC3INT2, "ISRC3INT2"),
  539. ARIZONA_MUX_WIDGETS(ISRC3INT3, "ISRC3INT3"),
  540. ARIZONA_MUX_WIDGETS(ISRC3INT4, "ISRC3INT4"),
  541. SND_SOC_DAPM_OUTPUT("HPOUT1L"),
  542. SND_SOC_DAPM_OUTPUT("HPOUT1R"),
  543. SND_SOC_DAPM_OUTPUT("SPKOUTN"),
  544. SND_SOC_DAPM_OUTPUT("SPKOUTP"),
  545. SND_SOC_DAPM_OUTPUT("MICSUPP"),
  546. };
  547. #define ARIZONA_MIXER_INPUT_ROUTES(name) \
  548. { name, "Noise Generator", "Noise Generator" }, \
  549. { name, "Tone Generator 1", "Tone Generator 1" }, \
  550. { name, "Tone Generator 2", "Tone Generator 2" }, \
  551. { name, "Haptics", "HAPTICS" }, \
  552. { name, "AEC", "AEC Loopback" }, \
  553. { name, "IN1L", "IN1L PGA" }, \
  554. { name, "IN1R", "IN1R PGA" }, \
  555. { name, "IN2L", "IN2L PGA" }, \
  556. { name, "IN2R", "IN2R PGA" }, \
  557. { name, "AIF1RX1", "AIF1RX1" }, \
  558. { name, "AIF1RX2", "AIF1RX2" }, \
  559. { name, "AIF1RX3", "AIF1RX3" }, \
  560. { name, "AIF1RX4", "AIF1RX4" }, \
  561. { name, "AIF1RX5", "AIF1RX5" }, \
  562. { name, "AIF1RX6", "AIF1RX6" }, \
  563. { name, "AIF1RX7", "AIF1RX7" }, \
  564. { name, "AIF1RX8", "AIF1RX8" }, \
  565. { name, "AIF2RX1", "AIF2RX1" }, \
  566. { name, "AIF2RX2", "AIF2RX2" }, \
  567. { name, "AIF2RX3", "AIF2RX3" }, \
  568. { name, "AIF2RX4", "AIF2RX4" }, \
  569. { name, "AIF2RX5", "AIF2RX5" }, \
  570. { name, "AIF2RX6", "AIF2RX6" }, \
  571. { name, "AIF3RX1", "AIF3RX1" }, \
  572. { name, "AIF3RX2", "AIF3RX2" }, \
  573. { name, "EQ1", "EQ1" }, \
  574. { name, "EQ2", "EQ2" }, \
  575. { name, "DRC1L", "DRC1L" }, \
  576. { name, "DRC1R", "DRC1R" }, \
  577. { name, "DRC2L", "DRC2L" }, \
  578. { name, "DRC2R", "DRC2R" }, \
  579. { name, "LHPF1", "LHPF1" }, \
  580. { name, "LHPF2", "LHPF2" }, \
  581. { name, "LHPF3", "LHPF3" }, \
  582. { name, "LHPF4", "LHPF4" }, \
  583. { name, "ASRC1L", "ASRC1L" }, \
  584. { name, "ASRC1R", "ASRC1R" }, \
  585. { name, "ASRC2L", "ASRC2L" }, \
  586. { name, "ASRC2R", "ASRC2R" }, \
  587. { name, "ISRC1DEC1", "ISRC1DEC1" }, \
  588. { name, "ISRC1DEC2", "ISRC1DEC2" }, \
  589. { name, "ISRC1DEC3", "ISRC1DEC3" }, \
  590. { name, "ISRC1DEC4", "ISRC1DEC4" }, \
  591. { name, "ISRC1INT1", "ISRC1INT1" }, \
  592. { name, "ISRC1INT2", "ISRC1INT2" }, \
  593. { name, "ISRC1INT3", "ISRC1INT3" }, \
  594. { name, "ISRC1INT4", "ISRC1INT4" }, \
  595. { name, "ISRC2DEC1", "ISRC2DEC1" }, \
  596. { name, "ISRC2DEC2", "ISRC2DEC2" }, \
  597. { name, "ISRC2DEC3", "ISRC2DEC3" }, \
  598. { name, "ISRC2DEC4", "ISRC2DEC4" }, \
  599. { name, "ISRC2INT1", "ISRC2INT1" }, \
  600. { name, "ISRC2INT2", "ISRC2INT2" }, \
  601. { name, "ISRC2INT3", "ISRC2INT3" }, \
  602. { name, "ISRC2INT4", "ISRC2INT4" }, \
  603. { name, "ISRC3DEC1", "ISRC3DEC1" }, \
  604. { name, "ISRC3DEC2", "ISRC3DEC2" }, \
  605. { name, "ISRC3DEC3", "ISRC3DEC3" }, \
  606. { name, "ISRC3DEC4", "ISRC3DEC4" }, \
  607. { name, "ISRC3INT1", "ISRC3INT1" }, \
  608. { name, "ISRC3INT2", "ISRC3INT2" }, \
  609. { name, "ISRC3INT3", "ISRC3INT3" }, \
  610. { name, "ISRC3INT4", "ISRC3INT4" }, \
  611. { name, "DSP2.1", "DSP2" }, \
  612. { name, "DSP2.2", "DSP2" }, \
  613. { name, "DSP2.3", "DSP2" }, \
  614. { name, "DSP2.4", "DSP2" }, \
  615. { name, "DSP2.5", "DSP2" }, \
  616. { name, "DSP2.6", "DSP2" }, \
  617. { name, "DSP3.1", "DSP3" }, \
  618. { name, "DSP3.2", "DSP3" }, \
  619. { name, "DSP3.3", "DSP3" }, \
  620. { name, "DSP3.4", "DSP3" }, \
  621. { name, "DSP3.5", "DSP3" }, \
  622. { name, "DSP3.6", "DSP3" }
  623. static const struct snd_soc_dapm_route cs47l24_dapm_routes[] = {
  624. { "OUT1L", NULL, "CPVDD" },
  625. { "OUT1R", NULL, "CPVDD" },
  626. { "OUT4L", NULL, "SPKVDD" },
  627. { "OUT1L", NULL, "SYSCLK" },
  628. { "OUT1R", NULL, "SYSCLK" },
  629. { "OUT4L", NULL, "SYSCLK" },
  630. { "IN1L", NULL, "SYSCLK" },
  631. { "IN1R", NULL, "SYSCLK" },
  632. { "IN2L", NULL, "SYSCLK" },
  633. { "IN2R", NULL, "SYSCLK" },
  634. { "ASRC1L", NULL, "SYSCLK" },
  635. { "ASRC1R", NULL, "SYSCLK" },
  636. { "ASRC2L", NULL, "SYSCLK" },
  637. { "ASRC2R", NULL, "SYSCLK" },
  638. { "ASRC1L", NULL, "ASYNCCLK" },
  639. { "ASRC1R", NULL, "ASYNCCLK" },
  640. { "ASRC2L", NULL, "ASYNCCLK" },
  641. { "ASRC2R", NULL, "ASYNCCLK" },
  642. { "MICBIAS1", NULL, "MICVDD" },
  643. { "MICBIAS2", NULL, "MICVDD" },
  644. { "Noise Generator", NULL, "SYSCLK" },
  645. { "Tone Generator 1", NULL, "SYSCLK" },
  646. { "Tone Generator 2", NULL, "SYSCLK" },
  647. { "Noise Generator", NULL, "NOISE" },
  648. { "Tone Generator 1", NULL, "TONE" },
  649. { "Tone Generator 2", NULL, "TONE" },
  650. { "AIF1 Capture", NULL, "AIF1TX1" },
  651. { "AIF1 Capture", NULL, "AIF1TX2" },
  652. { "AIF1 Capture", NULL, "AIF1TX3" },
  653. { "AIF1 Capture", NULL, "AIF1TX4" },
  654. { "AIF1 Capture", NULL, "AIF1TX5" },
  655. { "AIF1 Capture", NULL, "AIF1TX6" },
  656. { "AIF1 Capture", NULL, "AIF1TX7" },
  657. { "AIF1 Capture", NULL, "AIF1TX8" },
  658. { "AIF1RX1", NULL, "AIF1 Playback" },
  659. { "AIF1RX2", NULL, "AIF1 Playback" },
  660. { "AIF1RX3", NULL, "AIF1 Playback" },
  661. { "AIF1RX4", NULL, "AIF1 Playback" },
  662. { "AIF1RX5", NULL, "AIF1 Playback" },
  663. { "AIF1RX6", NULL, "AIF1 Playback" },
  664. { "AIF1RX7", NULL, "AIF1 Playback" },
  665. { "AIF1RX8", NULL, "AIF1 Playback" },
  666. { "AIF2 Capture", NULL, "AIF2TX1" },
  667. { "AIF2 Capture", NULL, "AIF2TX2" },
  668. { "AIF2 Capture", NULL, "AIF2TX3" },
  669. { "AIF2 Capture", NULL, "AIF2TX4" },
  670. { "AIF2 Capture", NULL, "AIF2TX5" },
  671. { "AIF2 Capture", NULL, "AIF2TX6" },
  672. { "AIF2RX1", NULL, "AIF2 Playback" },
  673. { "AIF2RX2", NULL, "AIF2 Playback" },
  674. { "AIF2RX3", NULL, "AIF2 Playback" },
  675. { "AIF2RX4", NULL, "AIF2 Playback" },
  676. { "AIF2RX5", NULL, "AIF2 Playback" },
  677. { "AIF2RX6", NULL, "AIF2 Playback" },
  678. { "AIF3 Capture", NULL, "AIF3TX1" },
  679. { "AIF3 Capture", NULL, "AIF3TX2" },
  680. { "AIF3RX1", NULL, "AIF3 Playback" },
  681. { "AIF3RX2", NULL, "AIF3 Playback" },
  682. { "AIF1 Playback", NULL, "SYSCLK" },
  683. { "AIF2 Playback", NULL, "SYSCLK" },
  684. { "AIF3 Playback", NULL, "SYSCLK" },
  685. { "AIF1 Capture", NULL, "SYSCLK" },
  686. { "AIF2 Capture", NULL, "SYSCLK" },
  687. { "AIF3 Capture", NULL, "SYSCLK" },
  688. { "Voice Control DSP", NULL, "DSP3" },
  689. { "IN1L PGA", NULL, "IN1L" },
  690. { "IN1R PGA", NULL, "IN1R" },
  691. { "IN2L PGA", NULL, "IN2L" },
  692. { "IN2R PGA", NULL, "IN2R" },
  693. { "Audio Trace DSP", NULL, "DSP2" },
  694. ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
  695. ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
  696. ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUT"),
  697. ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
  698. ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
  699. ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
  700. ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
  701. ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
  702. ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
  703. ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
  704. ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
  705. ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
  706. ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
  707. ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
  708. ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
  709. ARIZONA_MIXER_ROUTES("AIF2TX3", "AIF2TX3"),
  710. ARIZONA_MIXER_ROUTES("AIF2TX4", "AIF2TX4"),
  711. ARIZONA_MIXER_ROUTES("AIF2TX5", "AIF2TX5"),
  712. ARIZONA_MIXER_ROUTES("AIF2TX6", "AIF2TX6"),
  713. ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
  714. ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
  715. ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
  716. ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
  717. ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
  718. ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
  719. ARIZONA_MIXER_ROUTES("DRC2L", "DRC2L"),
  720. ARIZONA_MIXER_ROUTES("DRC2R", "DRC2R"),
  721. ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
  722. ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
  723. ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
  724. ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
  725. ARIZONA_MUX_ROUTES("ASRC1L", "ASRC1L"),
  726. ARIZONA_MUX_ROUTES("ASRC1R", "ASRC1R"),
  727. ARIZONA_MUX_ROUTES("ASRC2L", "ASRC2L"),
  728. ARIZONA_MUX_ROUTES("ASRC2R", "ASRC2R"),
  729. ARIZONA_DSP_ROUTES("DSP2"),
  730. ARIZONA_DSP_ROUTES("DSP3"),
  731. ARIZONA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"),
  732. ARIZONA_MUX_ROUTES("ISRC1INT2", "ISRC1INT2"),
  733. ARIZONA_MUX_ROUTES("ISRC1INT3", "ISRC1INT3"),
  734. ARIZONA_MUX_ROUTES("ISRC1INT4", "ISRC1INT4"),
  735. ARIZONA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"),
  736. ARIZONA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"),
  737. ARIZONA_MUX_ROUTES("ISRC1DEC3", "ISRC1DEC3"),
  738. ARIZONA_MUX_ROUTES("ISRC1DEC4", "ISRC1DEC4"),
  739. ARIZONA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"),
  740. ARIZONA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"),
  741. ARIZONA_MUX_ROUTES("ISRC2INT3", "ISRC2INT3"),
  742. ARIZONA_MUX_ROUTES("ISRC2INT4", "ISRC2INT4"),
  743. ARIZONA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"),
  744. ARIZONA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"),
  745. ARIZONA_MUX_ROUTES("ISRC2DEC3", "ISRC2DEC3"),
  746. ARIZONA_MUX_ROUTES("ISRC2DEC4", "ISRC2DEC4"),
  747. ARIZONA_MUX_ROUTES("ISRC3INT1", "ISRC3INT1"),
  748. ARIZONA_MUX_ROUTES("ISRC3INT2", "ISRC3INT2"),
  749. ARIZONA_MUX_ROUTES("ISRC3INT3", "ISRC3INT3"),
  750. ARIZONA_MUX_ROUTES("ISRC3INT4", "ISRC3INT4"),
  751. ARIZONA_MUX_ROUTES("ISRC3DEC1", "ISRC3DEC1"),
  752. ARIZONA_MUX_ROUTES("ISRC3DEC2", "ISRC3DEC2"),
  753. ARIZONA_MUX_ROUTES("ISRC3DEC3", "ISRC3DEC3"),
  754. ARIZONA_MUX_ROUTES("ISRC3DEC4", "ISRC3DEC4"),
  755. { "AEC Loopback", "HPOUT1L", "OUT1L" },
  756. { "AEC Loopback", "HPOUT1R", "OUT1R" },
  757. { "HPOUT1L", NULL, "OUT1L" },
  758. { "HPOUT1R", NULL, "OUT1R" },
  759. { "AEC Loopback", "SPKOUT", "OUT4L" },
  760. { "SPKOUTN", NULL, "OUT4L" },
  761. { "SPKOUTP", NULL, "OUT4L" },
  762. { "MICSUPP", NULL, "SYSCLK" },
  763. { "DRC1 Signal Activity", NULL, "SYSCLK" },
  764. { "DRC2 Signal Activity", NULL, "SYSCLK" },
  765. { "DRC1 Signal Activity", NULL, "DRC1L" },
  766. { "DRC1 Signal Activity", NULL, "DRC1R" },
  767. { "DRC2 Signal Activity", NULL, "DRC2L" },
  768. { "DRC2 Signal Activity", NULL, "DRC2R" },
  769. { "DSP Voice Trigger", NULL, "SYSCLK" },
  770. { "DSP Voice Trigger", NULL, "DSP3 Voice Trigger" },
  771. { "DSP3 Voice Trigger", "Switch", "DSP3" },
  772. };
  773. static int cs47l24_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
  774. unsigned int Fref, unsigned int Fout)
  775. {
  776. struct cs47l24_priv *cs47l24 = snd_soc_codec_get_drvdata(codec);
  777. switch (fll_id) {
  778. case CS47L24_FLL1:
  779. return arizona_set_fll(&cs47l24->fll[0], source, Fref, Fout);
  780. case CS47L24_FLL2:
  781. return arizona_set_fll(&cs47l24->fll[1], source, Fref, Fout);
  782. case CS47L24_FLL1_REFCLK:
  783. return arizona_set_fll_refclk(&cs47l24->fll[0], source, Fref,
  784. Fout);
  785. case CS47L24_FLL2_REFCLK:
  786. return arizona_set_fll_refclk(&cs47l24->fll[1], source, Fref,
  787. Fout);
  788. default:
  789. return -EINVAL;
  790. }
  791. }
  792. #define CS47L24_RATES SNDRV_PCM_RATE_KNOT
  793. #define CS47L24_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
  794. SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
  795. static struct snd_soc_dai_driver cs47l24_dai[] = {
  796. {
  797. .name = "cs47l24-aif1",
  798. .id = 1,
  799. .base = ARIZONA_AIF1_BCLK_CTRL,
  800. .playback = {
  801. .stream_name = "AIF1 Playback",
  802. .channels_min = 1,
  803. .channels_max = 8,
  804. .rates = CS47L24_RATES,
  805. .formats = CS47L24_FORMATS,
  806. },
  807. .capture = {
  808. .stream_name = "AIF1 Capture",
  809. .channels_min = 1,
  810. .channels_max = 8,
  811. .rates = CS47L24_RATES,
  812. .formats = CS47L24_FORMATS,
  813. },
  814. .ops = &arizona_dai_ops,
  815. .symmetric_rates = 1,
  816. .symmetric_samplebits = 1,
  817. },
  818. {
  819. .name = "cs47l24-aif2",
  820. .id = 2,
  821. .base = ARIZONA_AIF2_BCLK_CTRL,
  822. .playback = {
  823. .stream_name = "AIF2 Playback",
  824. .channels_min = 1,
  825. .channels_max = 6,
  826. .rates = CS47L24_RATES,
  827. .formats = CS47L24_FORMATS,
  828. },
  829. .capture = {
  830. .stream_name = "AIF2 Capture",
  831. .channels_min = 1,
  832. .channels_max = 6,
  833. .rates = CS47L24_RATES,
  834. .formats = CS47L24_FORMATS,
  835. },
  836. .ops = &arizona_dai_ops,
  837. .symmetric_rates = 1,
  838. .symmetric_samplebits = 1,
  839. },
  840. {
  841. .name = "cs47l24-aif3",
  842. .id = 3,
  843. .base = ARIZONA_AIF3_BCLK_CTRL,
  844. .playback = {
  845. .stream_name = "AIF3 Playback",
  846. .channels_min = 1,
  847. .channels_max = 2,
  848. .rates = CS47L24_RATES,
  849. .formats = CS47L24_FORMATS,
  850. },
  851. .capture = {
  852. .stream_name = "AIF3 Capture",
  853. .channels_min = 1,
  854. .channels_max = 2,
  855. .rates = CS47L24_RATES,
  856. .formats = CS47L24_FORMATS,
  857. },
  858. .ops = &arizona_dai_ops,
  859. .symmetric_rates = 1,
  860. .symmetric_samplebits = 1,
  861. },
  862. {
  863. .name = "cs47l24-cpu-voicectrl",
  864. .capture = {
  865. .stream_name = "Voice Control CPU",
  866. .channels_min = 1,
  867. .channels_max = 1,
  868. .rates = CS47L24_RATES,
  869. .formats = CS47L24_FORMATS,
  870. },
  871. .compress_new = snd_soc_new_compress,
  872. },
  873. {
  874. .name = "cs47l24-dsp-voicectrl",
  875. .capture = {
  876. .stream_name = "Voice Control DSP",
  877. .channels_min = 1,
  878. .channels_max = 1,
  879. .rates = CS47L24_RATES,
  880. .formats = CS47L24_FORMATS,
  881. },
  882. },
  883. {
  884. .name = "cs47l24-cpu-trace",
  885. .capture = {
  886. .stream_name = "Audio Trace CPU",
  887. .channels_min = 1,
  888. .channels_max = 6,
  889. .rates = CS47L24_RATES,
  890. .formats = CS47L24_FORMATS,
  891. },
  892. .compress_new = snd_soc_new_compress,
  893. },
  894. {
  895. .name = "cs47l24-dsp-trace",
  896. .capture = {
  897. .stream_name = "Audio Trace DSP",
  898. .channels_min = 1,
  899. .channels_max = 6,
  900. .rates = CS47L24_RATES,
  901. .formats = CS47L24_FORMATS,
  902. },
  903. },
  904. };
  905. static int cs47l24_open(struct snd_compr_stream *stream)
  906. {
  907. struct snd_soc_pcm_runtime *rtd = stream->private_data;
  908. struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(rtd->codec);
  909. struct arizona *arizona = priv->core.arizona;
  910. int n_adsp;
  911. if (strcmp(rtd->codec_dai->name, "cs47l24-dsp-voicectrl") == 0) {
  912. n_adsp = 2;
  913. } else if (strcmp(rtd->codec_dai->name, "cs47l24-dsp-trace") == 0) {
  914. n_adsp = 1;
  915. } else {
  916. dev_err(arizona->dev,
  917. "No suitable compressed stream for DAI '%s'\n",
  918. rtd->codec_dai->name);
  919. return -EINVAL;
  920. }
  921. return wm_adsp_compr_open(&priv->core.adsp[n_adsp], stream);
  922. }
  923. static irqreturn_t cs47l24_adsp2_irq(int irq, void *data)
  924. {
  925. struct cs47l24_priv *priv = data;
  926. struct arizona *arizona = priv->core.arizona;
  927. struct arizona_voice_trigger_info info;
  928. int serviced = 0;
  929. int i, ret;
  930. for (i = 1; i <= 2; ++i) {
  931. ret = wm_adsp_compr_handle_irq(&priv->core.adsp[i]);
  932. if (ret != -ENODEV)
  933. serviced++;
  934. if (ret == WM_ADSP_COMPR_VOICE_TRIGGER) {
  935. info.core = i;
  936. arizona_call_notifiers(arizona,
  937. ARIZONA_NOTIFY_VOICE_TRIGGER,
  938. &info);
  939. }
  940. }
  941. if (!serviced) {
  942. dev_err(arizona->dev, "Spurious compressed data IRQ\n");
  943. return IRQ_NONE;
  944. }
  945. return IRQ_HANDLED;
  946. }
  947. static int cs47l24_codec_probe(struct snd_soc_codec *codec)
  948. {
  949. struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
  950. struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec);
  951. struct arizona *arizona = priv->core.arizona;
  952. int ret;
  953. priv->core.arizona->dapm = dapm;
  954. arizona_init_spk(codec);
  955. arizona_init_gpio(codec);
  956. arizona_init_mono(codec);
  957. arizona_init_notifiers(codec);
  958. ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1,
  959. "ADSP2 Compressed IRQ", cs47l24_adsp2_irq,
  960. priv);
  961. if (ret != 0) {
  962. dev_err(codec->dev, "Failed to request DSP IRQ: %d\n", ret);
  963. return ret;
  964. }
  965. ret = wm_adsp2_codec_probe(&priv->core.adsp[1], codec);
  966. if (ret)
  967. goto err_adsp2_codec_probe;
  968. ret = wm_adsp2_codec_probe(&priv->core.adsp[2], codec);
  969. if (ret)
  970. goto err_adsp2_codec_probe;
  971. ret = snd_soc_add_codec_controls(codec,
  972. &arizona_adsp2_rate_controls[1], 2);
  973. if (ret)
  974. goto err_adsp2_codec_probe;
  975. snd_soc_dapm_disable_pin(dapm, "HAPTICS");
  976. return 0;
  977. err_adsp2_codec_probe:
  978. wm_adsp2_codec_remove(&priv->core.adsp[1], codec);
  979. wm_adsp2_codec_remove(&priv->core.adsp[2], codec);
  980. return ret;
  981. }
  982. static int cs47l24_codec_remove(struct snd_soc_codec *codec)
  983. {
  984. struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec);
  985. struct arizona *arizona = priv->core.arizona;
  986. wm_adsp2_codec_remove(&priv->core.adsp[1], codec);
  987. wm_adsp2_codec_remove(&priv->core.adsp[2], codec);
  988. priv->core.arizona->dapm = NULL;
  989. arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, priv);
  990. arizona_free_spk(codec);
  991. return 0;
  992. }
  993. #define CS47L24_DIG_VU 0x0200
  994. static unsigned int cs47l24_digital_vu[] = {
  995. ARIZONA_DAC_DIGITAL_VOLUME_1L,
  996. ARIZONA_DAC_DIGITAL_VOLUME_1R,
  997. ARIZONA_DAC_DIGITAL_VOLUME_4L,
  998. };
  999. static struct regmap *cs47l24_get_regmap(struct device *dev)
  1000. {
  1001. struct cs47l24_priv *priv = dev_get_drvdata(dev);
  1002. return priv->core.arizona->regmap;
  1003. }
  1004. static struct snd_soc_codec_driver soc_codec_dev_cs47l24 = {
  1005. .probe = cs47l24_codec_probe,
  1006. .remove = cs47l24_codec_remove,
  1007. .get_regmap = cs47l24_get_regmap,
  1008. .idle_bias_off = true,
  1009. .set_sysclk = arizona_set_sysclk,
  1010. .set_pll = cs47l24_set_fll,
  1011. .component_driver = {
  1012. .controls = cs47l24_snd_controls,
  1013. .num_controls = ARRAY_SIZE(cs47l24_snd_controls),
  1014. .dapm_widgets = cs47l24_dapm_widgets,
  1015. .num_dapm_widgets = ARRAY_SIZE(cs47l24_dapm_widgets),
  1016. .dapm_routes = cs47l24_dapm_routes,
  1017. .num_dapm_routes = ARRAY_SIZE(cs47l24_dapm_routes),
  1018. },
  1019. };
  1020. static struct snd_compr_ops cs47l24_compr_ops = {
  1021. .open = cs47l24_open,
  1022. .free = wm_adsp_compr_free,
  1023. .set_params = wm_adsp_compr_set_params,
  1024. .get_caps = wm_adsp_compr_get_caps,
  1025. .trigger = wm_adsp_compr_trigger,
  1026. .pointer = wm_adsp_compr_pointer,
  1027. .copy = wm_adsp_compr_copy,
  1028. };
  1029. static struct snd_soc_platform_driver cs47l24_compr_platform = {
  1030. .compr_ops = &cs47l24_compr_ops,
  1031. };
  1032. static int cs47l24_probe(struct platform_device *pdev)
  1033. {
  1034. struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
  1035. struct cs47l24_priv *cs47l24;
  1036. int i, ret;
  1037. BUILD_BUG_ON(ARRAY_SIZE(cs47l24_dai) > ARIZONA_MAX_DAI);
  1038. cs47l24 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l24_priv),
  1039. GFP_KERNEL);
  1040. if (!cs47l24)
  1041. return -ENOMEM;
  1042. platform_set_drvdata(pdev, cs47l24);
  1043. cs47l24->core.arizona = arizona;
  1044. cs47l24->core.num_inputs = 4;
  1045. for (i = 1; i <= 2; i++) {
  1046. cs47l24->core.adsp[i].part = "cs47l24";
  1047. cs47l24->core.adsp[i].num = i + 1;
  1048. cs47l24->core.adsp[i].type = WMFW_ADSP2;
  1049. cs47l24->core.adsp[i].dev = arizona->dev;
  1050. cs47l24->core.adsp[i].regmap = arizona->regmap;
  1051. cs47l24->core.adsp[i].base = ARIZONA_DSP1_CONTROL_1 +
  1052. (0x100 * i);
  1053. cs47l24->core.adsp[i].mem = cs47l24_dsp_regions[i - 1];
  1054. cs47l24->core.adsp[i].num_mems =
  1055. ARRAY_SIZE(cs47l24_dsp2_regions);
  1056. ret = wm_adsp2_init(&cs47l24->core.adsp[i]);
  1057. if (ret != 0)
  1058. return ret;
  1059. }
  1060. for (i = 0; i < ARRAY_SIZE(cs47l24->fll); i++)
  1061. cs47l24->fll[i].vco_mult = 3;
  1062. arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
  1063. ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
  1064. &cs47l24->fll[0]);
  1065. arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
  1066. ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
  1067. &cs47l24->fll[1]);
  1068. /* SR2 fixed at 8kHz, SR3 fixed at 16kHz */
  1069. regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_2,
  1070. ARIZONA_SAMPLE_RATE_2_MASK, 0x11);
  1071. regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_3,
  1072. ARIZONA_SAMPLE_RATE_3_MASK, 0x12);
  1073. for (i = 0; i < ARRAY_SIZE(cs47l24_dai); i++)
  1074. arizona_init_dai(&cs47l24->core, i);
  1075. /* Latch volume update bits */
  1076. for (i = 0; i < ARRAY_SIZE(cs47l24_digital_vu); i++)
  1077. regmap_update_bits(arizona->regmap, cs47l24_digital_vu[i],
  1078. CS47L24_DIG_VU, CS47L24_DIG_VU);
  1079. pm_runtime_enable(&pdev->dev);
  1080. pm_runtime_idle(&pdev->dev);
  1081. ret = snd_soc_register_platform(&pdev->dev, &cs47l24_compr_platform);
  1082. if (ret < 0) {
  1083. dev_err(&pdev->dev, "Failed to register platform: %d\n", ret);
  1084. return ret;
  1085. }
  1086. ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_cs47l24,
  1087. cs47l24_dai, ARRAY_SIZE(cs47l24_dai));
  1088. if (ret < 0) {
  1089. dev_err(&pdev->dev, "Failed to register codec: %d\n", ret);
  1090. snd_soc_unregister_platform(&pdev->dev);
  1091. }
  1092. return ret;
  1093. }
  1094. static int cs47l24_remove(struct platform_device *pdev)
  1095. {
  1096. struct cs47l24_priv *cs47l24 = platform_get_drvdata(pdev);
  1097. snd_soc_unregister_platform(&pdev->dev);
  1098. snd_soc_unregister_codec(&pdev->dev);
  1099. pm_runtime_disable(&pdev->dev);
  1100. wm_adsp2_remove(&cs47l24->core.adsp[1]);
  1101. wm_adsp2_remove(&cs47l24->core.adsp[2]);
  1102. return 0;
  1103. }
  1104. static struct platform_driver cs47l24_codec_driver = {
  1105. .driver = {
  1106. .name = "cs47l24-codec",
  1107. },
  1108. .probe = cs47l24_probe,
  1109. .remove = cs47l24_remove,
  1110. };
  1111. module_platform_driver(cs47l24_codec_driver);
  1112. MODULE_DESCRIPTION("ASoC CS47L24 driver");
  1113. MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.wolfsonmicro.com>");
  1114. MODULE_LICENSE("GPL v2");
  1115. MODULE_ALIAS("platform:cs47l24-codec");