msm-qti-pp-config.c 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475
  1. /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #include <linux/err.h>
  13. #include <linux/module.h>
  14. #include <linux/bitops.h>
  15. #include <linux/mutex.h>
  16. #include <sound/control.h>
  17. #include <sound/asound.h>
  18. #include <sound/tlv.h>
  19. #include <dsp/q6adm-v2.h>
  20. #include <dsp/q6asm-v2.h>
  21. #include <dsp/q6afe-v2.h>
  22. #include <dsp/q6audio-v2.h>
  23. #include <dsp/q6common.h>
  24. #include "msm-qti-pp-config.h"
  25. #include "msm-pcm-routing-v2.h"
  26. /* EQUALIZER */
  27. /* Equal to Frontend after last of the MULTIMEDIA SESSIONS */
  28. #define MAX_EQ_SESSIONS (MSM_FRONTEND_DAI_MULTIMEDIA20 + 1)
  29. enum {
  30. EQ_BAND1 = 0,
  31. EQ_BAND2,
  32. EQ_BAND3,
  33. EQ_BAND4,
  34. EQ_BAND5,
  35. EQ_BAND6,
  36. EQ_BAND7,
  37. EQ_BAND8,
  38. EQ_BAND9,
  39. EQ_BAND10,
  40. EQ_BAND11,
  41. EQ_BAND12,
  42. EQ_BAND_MAX,
  43. };
  44. /* Audio Sphere data structures */
  45. struct msm_audio_pp_asphere_state_s {
  46. uint32_t enabled;
  47. uint32_t strength;
  48. uint32_t mode;
  49. uint32_t version;
  50. int port_id[AFE_MAX_PORTS];
  51. int copp_idx[AFE_MAX_PORTS];
  52. bool initialized;
  53. uint32_t enabled_prev;
  54. uint32_t strength_prev;
  55. };
  56. static struct msm_audio_pp_asphere_state_s asphere_state;
  57. struct msm_audio_eq_stream_config eq_data[MAX_EQ_SESSIONS];
  58. static int msm_route_hfp_vol_control;
  59. static const DECLARE_TLV_DB_LINEAR(hfp_rx_vol_gain, 0,
  60. INT_RX_VOL_MAX_STEPS);
  61. static int msm_route_icc_vol_control;
  62. static const DECLARE_TLV_DB_LINEAR(icc_rx_vol_gain, 0,
  63. INT_RX_VOL_MAX_STEPS);
  64. static int msm_route_pri_auxpcm_lb_vol_ctrl;
  65. static const DECLARE_TLV_DB_LINEAR(pri_auxpcm_lb_vol_gain, 0,
  66. INT_RX_VOL_MAX_STEPS);
  67. static int msm_route_sec_auxpcm_lb_vol_ctrl;
  68. static const DECLARE_TLV_DB_LINEAR(sec_auxpcm_lb_vol_gain, 0,
  69. INT_RX_VOL_MAX_STEPS);
  70. static int msm_multichannel_ec_primary_mic_ch;
  71. static void msm_qti_pp_send_eq_values_(int eq_idx)
  72. {
  73. int result;
  74. struct msm_pcm_routing_fdai_data fe_dai;
  75. struct audio_client *ac = NULL;
  76. msm_pcm_routing_get_fedai_info(eq_idx, SESSION_TYPE_RX, &fe_dai);
  77. ac = q6asm_get_audio_client(fe_dai.strm_id);
  78. if (ac == NULL) {
  79. pr_err("%s: Could not get audio client for session: %d\n",
  80. __func__, fe_dai.strm_id);
  81. goto done;
  82. }
  83. result = q6asm_equalizer(ac, &eq_data[eq_idx]);
  84. if (result < 0)
  85. pr_err("%s: Call to ASM equalizer failed, returned = %d\n",
  86. __func__, result);
  87. done:
  88. return;
  89. }
  90. static int msm_qti_pp_get_eq_enable_mixer(struct snd_kcontrol *kcontrol,
  91. struct snd_ctl_elem_value *ucontrol)
  92. {
  93. int eq_idx = ((struct soc_multi_mixer_control *)
  94. kcontrol->private_value)->reg;
  95. if ((eq_idx < 0) || (eq_idx >= MAX_EQ_SESSIONS))
  96. return -EINVAL;
  97. ucontrol->value.integer.value[0] = eq_data[eq_idx].enable;
  98. pr_debug("%s: EQ #%d enable %d\n", __func__,
  99. eq_idx, eq_data[eq_idx].enable);
  100. return 0;
  101. }
  102. static int msm_qti_pp_put_eq_enable_mixer(struct snd_kcontrol *kcontrol,
  103. struct snd_ctl_elem_value *ucontrol)
  104. {
  105. int eq_idx = ((struct soc_multi_mixer_control *)
  106. kcontrol->private_value)->reg;
  107. int value = ucontrol->value.integer.value[0];
  108. if ((eq_idx < 0) || (eq_idx >= MAX_EQ_SESSIONS))
  109. return -EINVAL;
  110. pr_debug("%s: EQ #%d enable %d\n", __func__,
  111. eq_idx, value);
  112. eq_data[eq_idx].enable = value;
  113. msm_pcm_routing_acquire_lock();
  114. msm_qti_pp_send_eq_values_(eq_idx);
  115. msm_pcm_routing_release_lock();
  116. return 0;
  117. }
  118. static int msm_qti_pp_get_eq_band_count_audio_mixer(
  119. struct snd_kcontrol *kcontrol,
  120. struct snd_ctl_elem_value *ucontrol)
  121. {
  122. int eq_idx = ((struct soc_multi_mixer_control *)
  123. kcontrol->private_value)->reg;
  124. if ((eq_idx < 0) || (eq_idx >= MAX_EQ_SESSIONS))
  125. return -EINVAL;
  126. ucontrol->value.integer.value[0] = eq_data[eq_idx].num_bands;
  127. pr_debug("%s: EQ #%d bands %d\n", __func__,
  128. eq_idx, eq_data[eq_idx].num_bands);
  129. return eq_data[eq_idx].num_bands;
  130. }
  131. static int msm_qti_pp_put_eq_band_count_audio_mixer(
  132. struct snd_kcontrol *kcontrol,
  133. struct snd_ctl_elem_value *ucontrol)
  134. {
  135. int eq_idx = ((struct soc_multi_mixer_control *)
  136. kcontrol->private_value)->reg;
  137. int value = ucontrol->value.integer.value[0];
  138. if ((eq_idx < 0) || (eq_idx >= MAX_EQ_SESSIONS))
  139. return -EINVAL;
  140. pr_debug("%s: EQ #%d bands %d\n", __func__,
  141. eq_idx, value);
  142. eq_data[eq_idx].num_bands = value;
  143. return 0;
  144. }
  145. static int msm_qti_pp_get_eq_band_audio_mixer(struct snd_kcontrol *kcontrol,
  146. struct snd_ctl_elem_value *ucontrol)
  147. {
  148. int eq_idx = ((struct soc_multi_mixer_control *)
  149. kcontrol->private_value)->reg;
  150. int band_idx = ((struct soc_multi_mixer_control *)
  151. kcontrol->private_value)->shift;
  152. if ((eq_idx < 0) || (eq_idx >= MAX_EQ_SESSIONS) ||
  153. (band_idx < EQ_BAND1) || (band_idx >= EQ_BAND_MAX))
  154. return -EINVAL;
  155. ucontrol->value.integer.value[0] =
  156. eq_data[eq_idx].eq_bands[band_idx].band_idx;
  157. ucontrol->value.integer.value[1] =
  158. eq_data[eq_idx].eq_bands[band_idx].filter_type;
  159. ucontrol->value.integer.value[2] =
  160. eq_data[eq_idx].eq_bands[band_idx].center_freq_hz;
  161. ucontrol->value.integer.value[3] =
  162. eq_data[eq_idx].eq_bands[band_idx].filter_gain;
  163. ucontrol->value.integer.value[4] =
  164. eq_data[eq_idx].eq_bands[band_idx].q_factor;
  165. pr_debug("%s: band_idx = %d\n", __func__,
  166. eq_data[eq_idx].eq_bands[band_idx].band_idx);
  167. pr_debug("%s: filter_type = %d\n", __func__,
  168. eq_data[eq_idx].eq_bands[band_idx].filter_type);
  169. pr_debug("%s: center_freq_hz = %d\n", __func__,
  170. eq_data[eq_idx].eq_bands[band_idx].center_freq_hz);
  171. pr_debug("%s: filter_gain = %d\n", __func__,
  172. eq_data[eq_idx].eq_bands[band_idx].filter_gain);
  173. pr_debug("%s: q_factor = %d\n", __func__,
  174. eq_data[eq_idx].eq_bands[band_idx].q_factor);
  175. return 0;
  176. }
  177. static int msm_qti_pp_put_eq_band_audio_mixer(struct snd_kcontrol *kcontrol,
  178. struct snd_ctl_elem_value *ucontrol)
  179. {
  180. int eq_idx = ((struct soc_multi_mixer_control *)
  181. kcontrol->private_value)->reg;
  182. int band_idx = ((struct soc_multi_mixer_control *)
  183. kcontrol->private_value)->shift;
  184. if ((eq_idx < 0) || (eq_idx >= MAX_EQ_SESSIONS) ||
  185. (band_idx < EQ_BAND1) || (band_idx >= EQ_BAND_MAX))
  186. return -EINVAL;
  187. eq_data[eq_idx].eq_bands[band_idx].band_idx =
  188. ucontrol->value.integer.value[0];
  189. eq_data[eq_idx].eq_bands[band_idx].filter_type =
  190. ucontrol->value.integer.value[1];
  191. eq_data[eq_idx].eq_bands[band_idx].center_freq_hz =
  192. ucontrol->value.integer.value[2];
  193. eq_data[eq_idx].eq_bands[band_idx].filter_gain =
  194. ucontrol->value.integer.value[3];
  195. eq_data[eq_idx].eq_bands[band_idx].q_factor =
  196. ucontrol->value.integer.value[4];
  197. return 0;
  198. }
  199. #ifdef CONFIG_QTI_PP
  200. void msm_qti_pp_send_eq_values(int fedai_id)
  201. {
  202. if (eq_data[fedai_id].enable)
  203. msm_qti_pp_send_eq_values_(fedai_id);
  204. }
  205. /* CUSTOM MIXING */
  206. int msm_qti_pp_send_stereo_to_custom_stereo_cmd(int port_id, int copp_idx,
  207. unsigned int session_id,
  208. uint16_t op_FL_ip_FL_weight,
  209. uint16_t op_FL_ip_FR_weight,
  210. uint16_t op_FR_ip_FL_weight,
  211. uint16_t op_FR_ip_FR_weight)
  212. {
  213. char *params_value;
  214. int *update_params_value32, rc = 0;
  215. int16_t *update_params_value16 = 0;
  216. uint32_t params_length = CUSTOM_STEREO_PAYLOAD_SIZE * sizeof(uint32_t);
  217. uint32_t avail_length = params_length;
  218. pr_debug("%s: port_id - %d, session id - %d\n", __func__, port_id,
  219. session_id);
  220. params_value = kzalloc(params_length, GFP_KERNEL);
  221. if (!params_value) {
  222. pr_err("%s, params memory alloc failed\n", __func__);
  223. return -ENOMEM;
  224. }
  225. update_params_value32 = (int *)params_value;
  226. if (avail_length < 2 * sizeof(uint32_t))
  227. goto skip_send_cmd;
  228. /*
  229. * This module is internal to ADSP and cannot be configured with
  230. * an instance id
  231. */
  232. *update_params_value32++ = MTMX_MODULE_ID_DEFAULT_CHMIXER;
  233. *update_params_value32++ = DEFAULT_CHMIXER_PARAM_ID_COEFF;
  234. avail_length = avail_length - (2 * sizeof(uint32_t));
  235. update_params_value16 = (int16_t *)update_params_value32;
  236. if (avail_length < 10 * sizeof(uint16_t))
  237. goto skip_send_cmd;
  238. *update_params_value16++ = CUSTOM_STEREO_CMD_PARAM_SIZE;
  239. /*for alignment only*/
  240. *update_params_value16++ = 0;
  241. /*index is 32-bit param in little endian*/
  242. *update_params_value16++ = CUSTOM_STEREO_INDEX_PARAM;
  243. *update_params_value16++ = 0;
  244. /*for stereo mixing num out ch*/
  245. *update_params_value16++ = CUSTOM_STEREO_NUM_OUT_CH;
  246. /*for stereo mixing num in ch*/
  247. *update_params_value16++ = CUSTOM_STEREO_NUM_IN_CH;
  248. /* Out ch map FL/FR*/
  249. *update_params_value16++ = PCM_CHANNEL_FL;
  250. *update_params_value16++ = PCM_CHANNEL_FR;
  251. /* In ch map FL/FR*/
  252. *update_params_value16++ = PCM_CHANNEL_FL;
  253. *update_params_value16++ = PCM_CHANNEL_FR;
  254. avail_length = avail_length - (10 * sizeof(uint16_t));
  255. /* weighting coefficients as name suggests,
  256. * mixing will be done according to these coefficients
  257. */
  258. if (avail_length < 4 * sizeof(uint16_t))
  259. goto skip_send_cmd;
  260. *update_params_value16++ = op_FL_ip_FL_weight;
  261. *update_params_value16++ = op_FL_ip_FR_weight;
  262. *update_params_value16++ = op_FR_ip_FL_weight;
  263. *update_params_value16++ = op_FR_ip_FR_weight;
  264. avail_length = avail_length - (4 * sizeof(uint16_t));
  265. if (params_length) {
  266. rc = adm_set_stereo_to_custom_stereo(port_id,
  267. copp_idx,
  268. session_id,
  269. params_value,
  270. params_length);
  271. if (rc) {
  272. pr_err("%s: send params failed rc=%d\n", __func__, rc);
  273. kfree(params_value);
  274. return -EINVAL;
  275. }
  276. }
  277. kfree(params_value);
  278. return 0;
  279. skip_send_cmd:
  280. pr_err("%s: insufficient memory, send cmd failed\n",
  281. __func__);
  282. kfree(params_value);
  283. return -ENOMEM;
  284. }
  285. #endif /* CONFIG_QTI_PP */
  286. /* RMS */
  287. static int msm_qti_pp_get_rms_value_control(struct snd_kcontrol *kcontrol,
  288. struct snd_ctl_elem_value *ucontrol)
  289. {
  290. int rc = 0;
  291. int be_idx = 0, copp_idx;
  292. char *param_value;
  293. int *update_param_value;
  294. uint32_t param_size = (RMS_PAYLOAD_LEN + 1) * sizeof(uint32_t);
  295. struct msm_pcm_routing_bdai_data msm_bedai;
  296. struct param_hdr_v3 param_hdr;
  297. param_value = kzalloc(param_size, GFP_KERNEL);
  298. if (!param_value)
  299. return -ENOMEM;
  300. msm_pcm_routing_acquire_lock();
  301. for (be_idx = 0; be_idx < MSM_BACKEND_DAI_MAX; be_idx++) {
  302. msm_pcm_routing_get_bedai_info(be_idx, &msm_bedai);
  303. if (msm_bedai.port_id == SLIMBUS_0_TX)
  304. break;
  305. }
  306. if ((be_idx >= MSM_BACKEND_DAI_MAX) || !msm_bedai.active) {
  307. pr_err("%s, back not active to query rms be_idx:%d\n",
  308. __func__, be_idx);
  309. rc = -EINVAL;
  310. goto get_rms_value_err;
  311. }
  312. copp_idx = adm_get_default_copp_idx(SLIMBUS_0_TX);
  313. if ((copp_idx < 0) || (copp_idx > MAX_COPPS_PER_PORT)) {
  314. pr_err("%s, no active copp to query rms copp_idx:%d\n",
  315. __func__, copp_idx);
  316. rc = -EINVAL;
  317. goto get_rms_value_err;
  318. }
  319. memset(&param_hdr, 0, sizeof(param_hdr));
  320. param_hdr.module_id = RMS_MODULEID_APPI_PASSTHRU;
  321. param_hdr.instance_id = INSTANCE_ID_0;
  322. param_hdr.param_id = RMS_PARAM_FIRST_SAMPLE;
  323. param_hdr.param_size = param_size;
  324. rc = adm_get_pp_params(SLIMBUS_0_TX, copp_idx, ADM_CLIENT_ID_DEFAULT,
  325. NULL, &param_hdr, param_value);
  326. if (rc) {
  327. pr_err("%s: get parameters failed rc=%d\n", __func__, rc);
  328. rc = -EINVAL;
  329. goto get_rms_value_err;
  330. }
  331. update_param_value = (int *)param_value;
  332. ucontrol->value.integer.value[0] = update_param_value[0];
  333. pr_debug("%s: FROM DSP value[0] 0x%x\n",
  334. __func__, update_param_value[0]);
  335. get_rms_value_err:
  336. msm_pcm_routing_release_lock();
  337. kfree(param_value);
  338. return rc;
  339. }
  340. static int msm_qti_pp_put_rms_value_control(struct snd_kcontrol *kcontrol,
  341. struct snd_ctl_elem_value *ucontrol)
  342. {
  343. /* not used */
  344. return 0;
  345. }
  346. /* VOLUME */
  347. static int msm_route_fm_vol_control;
  348. static int msm_afe_lb_vol_ctrl;
  349. static int msm_afe_sec_mi2s_lb_vol_ctrl;
  350. static int msm_afe_tert_mi2s_lb_vol_ctrl;
  351. static int msm_afe_quat_mi2s_lb_vol_ctrl;
  352. static int msm_afe_slimbus_7_lb_vol_ctrl;
  353. static int msm_afe_slimbus_8_lb_vol_ctrl;
  354. static int msm_asm_bit_width;
  355. static const DECLARE_TLV_DB_LINEAR(fm_rx_vol_gain, 0, INT_RX_VOL_MAX_STEPS);
  356. static const DECLARE_TLV_DB_LINEAR(afe_lb_vol_gain, 0, INT_RX_VOL_MAX_STEPS);
  357. static int msm_qti_pp_get_fm_vol_mixer(struct snd_kcontrol *kcontrol,
  358. struct snd_ctl_elem_value *ucontrol)
  359. {
  360. ucontrol->value.integer.value[0] = msm_route_fm_vol_control;
  361. return 0;
  362. }
  363. static int msm_qti_pp_set_fm_vol_mixer(struct snd_kcontrol *kcontrol,
  364. struct snd_ctl_elem_value *ucontrol)
  365. {
  366. afe_loopback_gain(INT_FM_TX, ucontrol->value.integer.value[0]);
  367. msm_route_fm_vol_control = ucontrol->value.integer.value[0];
  368. return 0;
  369. }
  370. static int msm_asm_bit_width_get(struct snd_kcontrol *kcontrol,
  371. struct snd_ctl_elem_value *ucontrol)
  372. {
  373. pr_debug("%s get ASM bitwidth = %d\n",
  374. __func__, msm_asm_bit_width);
  375. ucontrol->value.integer.value[0] = msm_asm_bit_width;
  376. return 0;
  377. }
  378. static int msm_asm_bit_width_put(struct snd_kcontrol *kcontrol,
  379. struct snd_ctl_elem_value *ucontrol)
  380. {
  381. switch (ucontrol->value.integer.value[0]) {
  382. case 16:
  383. msm_asm_bit_width = 16;
  384. break;
  385. case 24:
  386. msm_asm_bit_width = 24;
  387. break;
  388. case 32:
  389. msm_asm_bit_width = 32;
  390. break;
  391. default:
  392. msm_asm_bit_width = 0;
  393. break;
  394. }
  395. return 0;
  396. }
  397. static int msm_qti_pp_get_pri_mi2s_lb_vol_mixer(struct snd_kcontrol *kcontrol,
  398. struct snd_ctl_elem_value *ucontrol)
  399. {
  400. ucontrol->value.integer.value[0] = msm_afe_lb_vol_ctrl;
  401. return 0;
  402. }
  403. static int msm_qti_pp_set_pri_mi2s_lb_vol_mixer(struct snd_kcontrol *kcontrol,
  404. struct snd_ctl_elem_value *ucontrol)
  405. {
  406. afe_loopback_gain(AFE_PORT_ID_PRIMARY_MI2S_TX,
  407. ucontrol->value.integer.value[0]);
  408. msm_afe_lb_vol_ctrl = ucontrol->value.integer.value[0];
  409. return 0;
  410. }
  411. static int msm_qti_pp_get_sec_mi2s_lb_vol_mixer(struct snd_kcontrol *kcontrol,
  412. struct snd_ctl_elem_value *ucontrol)
  413. {
  414. ucontrol->value.integer.value[0] = msm_afe_sec_mi2s_lb_vol_ctrl;
  415. return 0;
  416. }
  417. static int msm_qti_pp_set_sec_mi2s_lb_vol_mixer(struct snd_kcontrol *kcontrol,
  418. struct snd_ctl_elem_value *ucontrol)
  419. {
  420. afe_loopback_gain(AFE_PORT_ID_SECONDARY_MI2S_TX,
  421. ucontrol->value.integer.value[0]);
  422. msm_afe_sec_mi2s_lb_vol_ctrl = ucontrol->value.integer.value[0];
  423. return 0;
  424. }
  425. static int msm_qti_pp_get_tert_mi2s_lb_vol_mixer(struct snd_kcontrol *kcontrol,
  426. struct snd_ctl_elem_value *ucontrol)
  427. {
  428. ucontrol->value.integer.value[0] = msm_afe_tert_mi2s_lb_vol_ctrl;
  429. return 0;
  430. }
  431. static int msm_qti_pp_set_tert_mi2s_lb_vol_mixer(struct snd_kcontrol *kcontrol,
  432. struct snd_ctl_elem_value *ucontrol)
  433. {
  434. afe_loopback_gain(AFE_PORT_ID_TERTIARY_MI2S_TX,
  435. ucontrol->value.integer.value[0]);
  436. msm_afe_tert_mi2s_lb_vol_ctrl = ucontrol->value.integer.value[0];
  437. return 0;
  438. }
  439. static int msm_qti_pp_get_slimbus_7_lb_vol_mixer(struct snd_kcontrol *kcontrol,
  440. struct snd_ctl_elem_value *ucontrol)
  441. {
  442. ucontrol->value.integer.value[0] = msm_afe_slimbus_7_lb_vol_ctrl;
  443. return 0;
  444. }
  445. static int msm_qti_pp_set_slimbus_7_lb_vol_mixer(struct snd_kcontrol *kcontrol,
  446. struct snd_ctl_elem_value *ucontrol)
  447. {
  448. int ret = afe_loopback_gain(SLIMBUS_7_TX,
  449. ucontrol->value.integer.value[0]);
  450. if (ret)
  451. pr_err("%s: failed to set LB vol for SLIMBUS_7_TX, err %d\n",
  452. __func__, ret);
  453. else
  454. msm_afe_slimbus_7_lb_vol_ctrl =
  455. ucontrol->value.integer.value[0];
  456. return ret;
  457. }
  458. static int msm_qti_pp_get_slimbus_8_lb_vol_mixer(struct snd_kcontrol *kcontrol,
  459. struct snd_ctl_elem_value *ucontrol)
  460. {
  461. ucontrol->value.integer.value[0] = msm_afe_slimbus_8_lb_vol_ctrl;
  462. return 0;
  463. }
  464. static int msm_qti_pp_set_slimbus_8_lb_vol_mixer(struct snd_kcontrol *kcontrol,
  465. struct snd_ctl_elem_value *ucontrol)
  466. {
  467. int ret = 0;
  468. ret = afe_loopback_gain(SLIMBUS_8_TX,
  469. ucontrol->value.integer.value[0]);
  470. if (ret)
  471. pr_err("%s: failed to set LB vol for SLIMBUS_8_TX", __func__);
  472. else
  473. msm_afe_slimbus_8_lb_vol_ctrl =
  474. ucontrol->value.integer.value[0];
  475. return ret;
  476. }
  477. static int msm_qti_pp_get_icc_vol_mixer(struct snd_kcontrol *kcontrol,
  478. struct snd_ctl_elem_value *ucontrol)
  479. {
  480. ucontrol->value.integer.value[0] = msm_route_icc_vol_control;
  481. return 0;
  482. }
  483. static int msm_qti_pp_set_icc_vol_mixer(struct snd_kcontrol *kcontrol,
  484. struct snd_ctl_elem_value *ucontrol)
  485. {
  486. adm_set_mic_gain(AFE_PORT_ID_QUATERNARY_TDM_TX,
  487. adm_get_default_copp_idx(AFE_PORT_ID_QUATERNARY_TDM_TX),
  488. ucontrol->value.integer.value[0]);
  489. msm_route_icc_vol_control = ucontrol->value.integer.value[0];
  490. return 0;
  491. }
  492. static int msm_qti_pp_get_quat_mi2s_fm_vol_mixer(struct snd_kcontrol *kcontrol,
  493. struct snd_ctl_elem_value *ucontrol)
  494. {
  495. ucontrol->value.integer.value[0] = msm_afe_quat_mi2s_lb_vol_ctrl;
  496. return 0;
  497. }
  498. static int msm_qti_pp_set_quat_mi2s_fm_vol_mixer(struct snd_kcontrol *kcontrol,
  499. struct snd_ctl_elem_value *ucontrol)
  500. {
  501. afe_loopback_gain(AFE_PORT_ID_QUATERNARY_MI2S_TX,
  502. ucontrol->value.integer.value[0]);
  503. msm_afe_quat_mi2s_lb_vol_ctrl = ucontrol->value.integer.value[0];
  504. return 0;
  505. }
  506. static int msm_qti_pp_get_hfp_vol_mixer(struct snd_kcontrol *kcontrol,
  507. struct snd_ctl_elem_value *ucontrol)
  508. {
  509. ucontrol->value.integer.value[0] = msm_route_hfp_vol_control;
  510. return 0;
  511. }
  512. static int msm_qti_pp_set_hfp_vol_mixer(struct snd_kcontrol *kcontrol,
  513. struct snd_ctl_elem_value *ucontrol)
  514. {
  515. afe_loopback_gain(INT_BT_SCO_TX, ucontrol->value.integer.value[0]);
  516. msm_route_hfp_vol_control = ucontrol->value.integer.value[0];
  517. return 0;
  518. }
  519. static int msm_qti_pp_get_pri_auxpcm_lb_vol_mixer(
  520. struct snd_kcontrol *kcontrol,
  521. struct snd_ctl_elem_value *ucontrol)
  522. {
  523. ucontrol->value.integer.value[0] = msm_route_pri_auxpcm_lb_vol_ctrl;
  524. pr_debug("%s: Volume = %ld\n", __func__,
  525. ucontrol->value.integer.value[0]);
  526. return 0;
  527. }
  528. static int msm_qti_pp_set_pri_auxpcm_lb_vol_mixer(
  529. struct snd_kcontrol *kcontrol,
  530. struct snd_ctl_elem_value *ucontrol)
  531. {
  532. struct soc_mixer_control *mc =
  533. (struct soc_mixer_control *)kcontrol->private_value;
  534. afe_loopback_gain(mc->reg, ucontrol->value.integer.value[0]);
  535. msm_route_pri_auxpcm_lb_vol_ctrl = ucontrol->value.integer.value[0];
  536. return 0;
  537. }
  538. static int msm_qti_pp_get_sec_auxpcm_lb_vol_mixer(
  539. struct snd_kcontrol *kcontrol,
  540. struct snd_ctl_elem_value *ucontrol)
  541. {
  542. ucontrol->value.integer.value[0] = msm_route_sec_auxpcm_lb_vol_ctrl;
  543. pr_debug("%s: Volume = %ld\n", __func__,
  544. ucontrol->value.integer.value[0]);
  545. return 0;
  546. }
  547. static int msm_qti_pp_set_sec_auxpcm_lb_vol_mixer(
  548. struct snd_kcontrol *kcontrol,
  549. struct snd_ctl_elem_value *ucontrol)
  550. {
  551. struct soc_mixer_control *mc =
  552. (struct soc_mixer_control *)kcontrol->private_value;
  553. afe_loopback_gain(mc->reg, ucontrol->value.integer.value[0]);
  554. msm_route_sec_auxpcm_lb_vol_ctrl = ucontrol->value.integer.value[0];
  555. return 0;
  556. }
  557. static int msm_qti_pp_get_channel_map_mixer(struct snd_kcontrol *kcontrol,
  558. struct snd_ctl_elem_value *ucontrol)
  559. {
  560. char channel_map[PCM_FORMAT_MAX_NUM_CHANNEL] = {0};
  561. int i;
  562. adm_get_multi_ch_map(channel_map, ADM_PATH_PLAYBACK);
  563. for (i = 0; i < PCM_FORMAT_MAX_NUM_CHANNEL; i++)
  564. ucontrol->value.integer.value[i] =
  565. (unsigned int) channel_map[i];
  566. return 0;
  567. }
  568. static int msm_qti_pp_put_channel_map_mixer(struct snd_kcontrol *kcontrol,
  569. struct snd_ctl_elem_value *ucontrol)
  570. {
  571. char channel_map[PCM_FORMAT_MAX_NUM_CHANNEL];
  572. int i;
  573. for (i = 0; i < PCM_FORMAT_MAX_NUM_CHANNEL; i++)
  574. channel_map[i] = (char)(ucontrol->value.integer.value[i]);
  575. adm_set_multi_ch_map(channel_map, ADM_PATH_PLAYBACK);
  576. return 0;
  577. }
  578. /* Audio Sphere functions */
  579. static void msm_qti_pp_asphere_init_state(void)
  580. {
  581. int i;
  582. if (asphere_state.initialized)
  583. return;
  584. asphere_state.initialized = true;
  585. for (i = 0; i < AFE_MAX_PORTS; i++) {
  586. asphere_state.port_id[i] = -1;
  587. asphere_state.copp_idx[i] = -1;
  588. }
  589. asphere_state.enabled = 0;
  590. asphere_state.strength = 0;
  591. asphere_state.mode = 0;
  592. asphere_state.version = 0;
  593. asphere_state.enabled_prev = 0;
  594. asphere_state.strength_prev = 0;
  595. }
  596. static int msm_qti_pp_asphere_send_params(int port_id, int copp_idx, bool force)
  597. {
  598. u8 *packed_params = NULL;
  599. u32 packed_params_size = 0;
  600. u32 param_size = 0;
  601. struct param_hdr_v3 param_hdr;
  602. bool set_enable = force ||
  603. (asphere_state.enabled != asphere_state.enabled_prev);
  604. bool set_strength = asphere_state.enabled == 1 && (set_enable ||
  605. (asphere_state.strength != asphere_state.strength_prev));
  606. int param_count = 0;
  607. int ret = 0;
  608. if (set_enable)
  609. param_count++;
  610. if (set_strength)
  611. param_count++;
  612. if (param_count == 0) {
  613. pr_debug("%s: Nothing to send, exiting\n", __func__);
  614. return 0;
  615. }
  616. pr_debug("%s: port_id %d, copp_id %d, forced %d, param_count %d\n",
  617. __func__, port_id, copp_idx, force, param_count);
  618. pr_debug("%s: enable prev:%u cur:%u, strength prev:%u cur:%u\n",
  619. __func__, asphere_state.enabled_prev, asphere_state.enabled,
  620. asphere_state.strength_prev, asphere_state.strength);
  621. packed_params_size =
  622. param_count * (sizeof(struct param_hdr_v3) + sizeof(uint32_t));
  623. packed_params = kzalloc(packed_params_size, GFP_KERNEL);
  624. if (!packed_params)
  625. return -ENOMEM;
  626. memset(&param_hdr, 0, sizeof(param_hdr));
  627. packed_params_size = 0;
  628. param_hdr.module_id = AUDPROC_MODULE_ID_AUDIOSPHERE;
  629. param_hdr.instance_id = INSTANCE_ID_0;
  630. if (set_strength) {
  631. /* add strength command */
  632. param_hdr.param_id = AUDPROC_PARAM_ID_AUDIOSPHERE_STRENGTH;
  633. param_hdr.param_size = sizeof(asphere_state.strength);
  634. ret = q6common_pack_pp_params(packed_params +
  635. packed_params_size,
  636. &param_hdr,
  637. (u8 *) &asphere_state.strength,
  638. &param_size);
  639. if (ret) {
  640. pr_err("%s: Failed to pack params for audio sphere"
  641. " strength, error %d\n", __func__, ret);
  642. goto done;
  643. }
  644. packed_params_size += param_size;
  645. }
  646. if (set_enable) {
  647. /* add enable command */
  648. param_hdr.param_id = AUDPROC_PARAM_ID_AUDIOSPHERE_ENABLE;
  649. param_hdr.param_size = sizeof(asphere_state.enabled);
  650. q6common_pack_pp_params(packed_params + packed_params_size,
  651. &param_hdr,
  652. (u8 *) &asphere_state.enabled,
  653. &param_size);
  654. if (ret) {
  655. pr_err("%s: Failed to pack params for audio sphere"
  656. " enable, error %d\n", __func__, ret);
  657. goto done;
  658. }
  659. packed_params_size += param_size;
  660. }
  661. pr_debug("%s: packed data size: %d\n", __func__, packed_params_size);
  662. ret = adm_set_pp_params(port_id, copp_idx, NULL, packed_params,
  663. packed_params_size);
  664. if (ret)
  665. pr_err("%s: set param failed with err=%d\n", __func__, ret);
  666. done:
  667. kfree(packed_params);
  668. return 0;
  669. }
  670. #if defined(CONFIG_QTI_PP) && defined(CONFIG_QTI_PP_AUDIOSPHERE)
  671. int msm_qti_pp_asphere_init(int port_id, int copp_idx)
  672. {
  673. int index = adm_validate_and_get_port_index(port_id);
  674. pr_debug("%s, port_id %d, copp_id %d\n", __func__, port_id, copp_idx);
  675. if (index < 0) {
  676. pr_err("%s: Invalid port idx %d port_id %#x\n", __func__, index,
  677. port_id);
  678. return -EINVAL;
  679. }
  680. msm_qti_pp_asphere_init_state();
  681. asphere_state.port_id[index] = port_id;
  682. asphere_state.copp_idx[index] = copp_idx;
  683. if (asphere_state.enabled)
  684. msm_qti_pp_asphere_send_params(port_id, copp_idx, true);
  685. return 0;
  686. }
  687. void msm_qti_pp_asphere_deinit(int port_id)
  688. {
  689. int index = adm_validate_and_get_port_index(port_id);
  690. pr_debug("%s, port_id %d\n", __func__, port_id);
  691. if (index < 0) {
  692. pr_err("%s: Invalid port idx %d port_id %#x\n", __func__, index,
  693. port_id);
  694. return;
  695. }
  696. if (asphere_state.port_id[index] == port_id) {
  697. asphere_state.port_id[index] = -1;
  698. asphere_state.copp_idx[index] = -1;
  699. }
  700. }
  701. #endif
  702. static int msm_qti_pp_asphere_get(struct snd_kcontrol *kcontrol,
  703. struct snd_ctl_elem_value *ucontrol)
  704. {
  705. if (!asphere_state.initialized)
  706. return -EAGAIN;
  707. ucontrol->value.integer.value[0] = asphere_state.enabled;
  708. ucontrol->value.integer.value[1] = asphere_state.strength;
  709. pr_debug("%s, enable %u, strength %u\n", __func__,
  710. asphere_state.enabled, asphere_state.strength);
  711. return 0;
  712. }
  713. static int msm_qti_pp_asphere_set(struct snd_kcontrol *kcontrol,
  714. struct snd_ctl_elem_value *ucontrol)
  715. {
  716. int32_t enable = ucontrol->value.integer.value[0];
  717. int32_t strength = ucontrol->value.integer.value[1];
  718. int i;
  719. pr_debug("%s, enable %u, strength %u\n", __func__, enable, strength);
  720. msm_qti_pp_asphere_init_state();
  721. if (enable == 0 || enable == 1) {
  722. asphere_state.enabled_prev = asphere_state.enabled;
  723. asphere_state.enabled = enable;
  724. }
  725. if (strength >= 0 && strength <= 1000) {
  726. asphere_state.strength_prev = asphere_state.strength;
  727. asphere_state.strength = strength;
  728. }
  729. if (asphere_state.strength != asphere_state.strength_prev ||
  730. asphere_state.enabled != asphere_state.enabled_prev) {
  731. for (i = 0; i < AFE_MAX_PORTS; i++) {
  732. if (asphere_state.port_id[i] >= 0)
  733. msm_qti_pp_asphere_send_params(
  734. asphere_state.port_id[i],
  735. asphere_state.copp_idx[i],
  736. false);
  737. }
  738. }
  739. return 0;
  740. }
  741. int msm_adsp_init_mixer_ctl_pp_event_queue(struct snd_soc_pcm_runtime *rtd)
  742. {
  743. struct snd_kcontrol *kctl;
  744. const char *deviceNo = "NN";
  745. char *mixer_str = NULL;
  746. int ctl_len = 0, ret = 0;
  747. const char *mixer_ctl_name = DSP_STREAM_CALLBACK;
  748. struct dsp_stream_callback_prtd *kctl_prtd = NULL;
  749. if (!rtd) {
  750. pr_err("%s: rtd is NULL\n", __func__);
  751. ret = -EINVAL;
  752. goto done;
  753. }
  754. ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
  755. mixer_str = kzalloc(ctl_len, GFP_KERNEL);
  756. if (!mixer_str) {
  757. ret = -EINVAL;
  758. goto done;
  759. }
  760. snprintf(mixer_str, ctl_len, "%s %d", mixer_ctl_name,
  761. rtd->pcm->device);
  762. kctl = snd_soc_card_get_kcontrol(rtd->card, mixer_str);
  763. kfree(mixer_str);
  764. if (!kctl) {
  765. pr_err("%s: failed to get kctl.\n", __func__);
  766. ret = -EINVAL;
  767. goto done;
  768. }
  769. if (kctl->private_data != NULL) {
  770. pr_err("%s: kctl_prtd is not NULL at initialization.\n",
  771. __func__);
  772. return -EINVAL;
  773. }
  774. kctl_prtd = kzalloc(sizeof(struct dsp_stream_callback_prtd),
  775. GFP_KERNEL);
  776. if (!kctl_prtd) {
  777. ret = -ENOMEM;
  778. goto done;
  779. }
  780. spin_lock_init(&kctl_prtd->prtd_spin_lock);
  781. INIT_LIST_HEAD(&kctl_prtd->event_queue);
  782. kctl_prtd->event_count = 0;
  783. kctl->private_data = kctl_prtd;
  784. done:
  785. return ret;
  786. }
  787. int msm_adsp_clean_mixer_ctl_pp_event_queue(struct snd_soc_pcm_runtime *rtd)
  788. {
  789. struct snd_kcontrol *kctl;
  790. const char *deviceNo = "NN";
  791. char *mixer_str = NULL;
  792. int ctl_len = 0, ret = 0;
  793. struct dsp_stream_callback_list *node, *n;
  794. unsigned long spin_flags;
  795. const char *mixer_ctl_name = DSP_STREAM_CALLBACK;
  796. struct dsp_stream_callback_prtd *kctl_prtd = NULL;
  797. if (!rtd) {
  798. pr_err("%s: rtd is NULL\n", __func__);
  799. ret = -EINVAL;
  800. goto done;
  801. }
  802. ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
  803. mixer_str = kzalloc(ctl_len, GFP_KERNEL);
  804. if (!mixer_str) {
  805. ret = -EINVAL;
  806. goto done;
  807. }
  808. snprintf(mixer_str, ctl_len, "%s %d", mixer_ctl_name,
  809. rtd->pcm->device);
  810. kctl = snd_soc_card_get_kcontrol(rtd->card, mixer_str);
  811. kfree(mixer_str);
  812. if (!kctl) {
  813. pr_err("%s: failed to get kctl.\n", __func__);
  814. ret = -EINVAL;
  815. goto done;
  816. }
  817. kctl_prtd = (struct dsp_stream_callback_prtd *)
  818. kctl->private_data;
  819. if (kctl_prtd != NULL) {
  820. spin_lock_irqsave(&kctl_prtd->prtd_spin_lock, spin_flags);
  821. /* clean the queue */
  822. list_for_each_entry_safe(node, n,
  823. &kctl_prtd->event_queue, list) {
  824. list_del(&node->list);
  825. kctl_prtd->event_count--;
  826. pr_debug("%s: %d remaining events after del.\n",
  827. __func__, kctl_prtd->event_count);
  828. kfree(node);
  829. }
  830. spin_unlock_irqrestore(&kctl_prtd->prtd_spin_lock, spin_flags);
  831. }
  832. kfree(kctl_prtd);
  833. kctl->private_data = NULL;
  834. done:
  835. return ret;
  836. }
  837. int msm_adsp_inform_mixer_ctl(struct snd_soc_pcm_runtime *rtd,
  838. uint32_t *payload)
  839. {
  840. /* adsp pp event notifier */
  841. struct snd_kcontrol *kctl;
  842. struct snd_ctl_elem_value control;
  843. const char *deviceNo = "NN";
  844. char *mixer_str = NULL;
  845. int ctl_len = 0, ret = 0;
  846. struct dsp_stream_callback_list *new_event;
  847. struct dsp_stream_callback_list *oldest_event;
  848. unsigned long spin_flags;
  849. struct dsp_stream_callback_prtd *kctl_prtd = NULL;
  850. struct msm_adsp_event_data *event_data = NULL;
  851. const char *mixer_ctl_name = DSP_STREAM_CALLBACK;
  852. struct snd_ctl_elem_info kctl_info;
  853. if (!rtd || !payload) {
  854. pr_err("%s: %s is NULL\n", __func__,
  855. (!rtd) ? "rtd" : "payload");
  856. ret = -EINVAL;
  857. goto done;
  858. }
  859. if (rtd->card->snd_card == NULL) {
  860. pr_err("%s: snd_card is null.\n", __func__);
  861. ret = -EINVAL;
  862. goto done;
  863. }
  864. ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
  865. mixer_str = kzalloc(ctl_len, GFP_ATOMIC);
  866. if (!mixer_str) {
  867. ret = -EINVAL;
  868. goto done;
  869. }
  870. snprintf(mixer_str, ctl_len, "%s %d", mixer_ctl_name,
  871. rtd->pcm->device);
  872. kctl = snd_soc_card_get_kcontrol(rtd->card, mixer_str);
  873. kfree(mixer_str);
  874. if (!kctl) {
  875. pr_err("%s: failed to get kctl.\n", __func__);
  876. ret = -EINVAL;
  877. goto done;
  878. }
  879. event_data = (struct msm_adsp_event_data *)payload;
  880. kctl->info(kctl, &kctl_info);
  881. if (event_data->payload_len >
  882. kctl_info.count - sizeof(struct msm_adsp_event_data)) {
  883. pr_err("%s: payload length exceeds limit of %u bytes.\n",
  884. __func__, kctl_info.count);
  885. ret = -EINVAL;
  886. goto done;
  887. }
  888. kctl_prtd = (struct dsp_stream_callback_prtd *)
  889. kctl->private_data;
  890. if (kctl_prtd == NULL) {
  891. /* queue is not initialized */
  892. ret = -EINVAL;
  893. pr_err("%s: event queue is not initialized.\n", __func__);
  894. goto done;
  895. }
  896. new_event = kzalloc(sizeof(struct dsp_stream_callback_list)
  897. + event_data->payload_len,
  898. GFP_ATOMIC);
  899. if (new_event == NULL) {
  900. ret = -ENOMEM;
  901. goto done;
  902. }
  903. memcpy((void *)&new_event->event, (void *)payload,
  904. event_data->payload_len
  905. + sizeof(struct msm_adsp_event_data));
  906. spin_lock_irqsave(&kctl_prtd->prtd_spin_lock, spin_flags);
  907. while (kctl_prtd->event_count >= DSP_STREAM_CALLBACK_QUEUE_SIZE) {
  908. pr_info("%s: queue of size %d is full. delete oldest one.\n",
  909. __func__, DSP_STREAM_CALLBACK_QUEUE_SIZE);
  910. oldest_event = list_first_entry(&kctl_prtd->event_queue,
  911. struct dsp_stream_callback_list, list);
  912. pr_info("%s: event deleted: type %d length %d\n",
  913. __func__, oldest_event->event.event_type,
  914. oldest_event->event.payload_len);
  915. list_del(&oldest_event->list);
  916. kctl_prtd->event_count--;
  917. kfree(oldest_event);
  918. }
  919. list_add_tail(&new_event->list, &kctl_prtd->event_queue);
  920. kctl_prtd->event_count++;
  921. spin_unlock_irqrestore(&kctl_prtd->prtd_spin_lock, spin_flags);
  922. control.id = kctl->id;
  923. snd_ctl_notify(rtd->card->snd_card,
  924. SNDRV_CTL_EVENT_MASK_INFO,
  925. &control.id);
  926. done:
  927. return ret;
  928. }
  929. int msm_adsp_stream_cmd_info(struct snd_kcontrol *kcontrol,
  930. struct snd_ctl_elem_info *uinfo)
  931. {
  932. uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
  933. uinfo->count =
  934. sizeof(((struct snd_ctl_elem_value *)0)->value.bytes.data);
  935. return 0;
  936. }
  937. int msm_adsp_stream_callback_get(struct snd_kcontrol *kcontrol,
  938. struct snd_ctl_elem_value *ucontrol)
  939. {
  940. uint32_t payload_size = 0;
  941. struct dsp_stream_callback_list *oldest_event;
  942. unsigned long spin_flags;
  943. struct dsp_stream_callback_prtd *kctl_prtd = NULL;
  944. int ret = 0;
  945. kctl_prtd = (struct dsp_stream_callback_prtd *)
  946. kcontrol->private_data;
  947. if (kctl_prtd == NULL) {
  948. pr_err("%s: ASM Stream PP event queue is not initialized.\n",
  949. __func__);
  950. ret = -EINVAL;
  951. goto done;
  952. }
  953. spin_lock_irqsave(&kctl_prtd->prtd_spin_lock, spin_flags);
  954. pr_debug("%s: %d events in queue.\n", __func__, kctl_prtd->event_count);
  955. if (list_empty(&kctl_prtd->event_queue)) {
  956. pr_err("%s: ASM Stream PP event queue is empty.\n", __func__);
  957. ret = -EINVAL;
  958. spin_unlock_irqrestore(&kctl_prtd->prtd_spin_lock, spin_flags);
  959. goto done;
  960. }
  961. oldest_event = list_first_entry(&kctl_prtd->event_queue,
  962. struct dsp_stream_callback_list, list);
  963. list_del(&oldest_event->list);
  964. kctl_prtd->event_count--;
  965. spin_unlock_irqrestore(&kctl_prtd->prtd_spin_lock, spin_flags);
  966. payload_size = oldest_event->event.payload_len;
  967. pr_debug("%s: event fetched: type %d length %d\n",
  968. __func__, oldest_event->event.event_type,
  969. oldest_event->event.payload_len);
  970. memcpy(ucontrol->value.bytes.data, &oldest_event->event,
  971. sizeof(struct msm_adsp_event_data) + payload_size);
  972. kfree(oldest_event);
  973. done:
  974. return ret;
  975. }
  976. int msm_adsp_stream_callback_info(struct snd_kcontrol *kcontrol,
  977. struct snd_ctl_elem_info *uinfo)
  978. {
  979. uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
  980. uinfo->count =
  981. sizeof(((struct snd_ctl_elem_value *)0)->value.bytes.data);
  982. return 0;
  983. }
  984. static int msm_multichannel_ec_primary_mic_ch_put(struct snd_kcontrol *kcontrol,
  985. struct snd_ctl_elem_value *ucontrol)
  986. {
  987. int ret = 0;
  988. int copp_idx = 0;
  989. int port_id = AFE_PORT_ID_QUATERNARY_TDM_TX;
  990. msm_multichannel_ec_primary_mic_ch = ucontrol->value.integer.value[0];
  991. pr_debug("%s: msm_multichannel_ec_primary_mic_ch = %u\n",
  992. __func__, msm_multichannel_ec_primary_mic_ch);
  993. copp_idx = adm_get_default_copp_idx(port_id);
  994. if ((copp_idx < 0) || (copp_idx > MAX_COPPS_PER_PORT)) {
  995. pr_err("%s : no active copp to query multichannel ec copp_idx: %u\n",
  996. __func__, copp_idx);
  997. return -EINVAL;
  998. }
  999. adm_send_set_multichannel_ec_primary_mic_ch(port_id, copp_idx,
  1000. msm_multichannel_ec_primary_mic_ch);
  1001. return ret;
  1002. }
  1003. static int msm_multichannel_ec_primary_mic_ch_get(struct snd_kcontrol *kcontrol,
  1004. struct snd_ctl_elem_value *ucontrol)
  1005. {
  1006. ucontrol->value.integer.value[0] = msm_multichannel_ec_primary_mic_ch;
  1007. pr_debug("%s: msm_multichannel_ec_primary_mic_ch = %lu\n",
  1008. __func__, ucontrol->value.integer.value[0]);
  1009. return 0;
  1010. }
  1011. static const struct snd_kcontrol_new msm_multichannel_ec_controls[] = {
  1012. SOC_SINGLE_EXT("Multichannel EC Primary Mic Ch", SND_SOC_NOPM, 0,
  1013. 0xFFFFFFFF, 0, msm_multichannel_ec_primary_mic_ch_get,
  1014. msm_multichannel_ec_primary_mic_ch_put),
  1015. };
  1016. static const struct snd_kcontrol_new int_fm_vol_mixer_controls[] = {
  1017. SOC_SINGLE_EXT_TLV("Internal FM RX Volume", SND_SOC_NOPM, 0,
  1018. INT_RX_VOL_GAIN, 0, msm_qti_pp_get_fm_vol_mixer,
  1019. msm_qti_pp_set_fm_vol_mixer, fm_rx_vol_gain),
  1020. SOC_SINGLE_EXT_TLV("Quat MI2S FM RX Volume", SND_SOC_NOPM, 0,
  1021. INT_RX_VOL_GAIN, 0, msm_qti_pp_get_quat_mi2s_fm_vol_mixer,
  1022. msm_qti_pp_set_quat_mi2s_fm_vol_mixer, fm_rx_vol_gain),
  1023. };
  1024. static const struct snd_kcontrol_new dsp_bit_width_controls[] = {
  1025. SOC_SINGLE_EXT(DSP_BIT_WIDTH_MIXER_CTL, SND_SOC_NOPM, 0, 0x20,
  1026. 0, msm_asm_bit_width_get, msm_asm_bit_width_put),
  1027. };
  1028. static const struct snd_kcontrol_new pri_mi2s_lb_vol_mixer_controls[] = {
  1029. SOC_SINGLE_EXT_TLV("PRI MI2S LOOPBACK Volume", SND_SOC_NOPM, 0,
  1030. INT_RX_VOL_GAIN, 0, msm_qti_pp_get_pri_mi2s_lb_vol_mixer,
  1031. msm_qti_pp_set_pri_mi2s_lb_vol_mixer, afe_lb_vol_gain),
  1032. };
  1033. static const struct snd_kcontrol_new sec_mi2s_lb_vol_mixer_controls[] = {
  1034. SOC_SINGLE_EXT_TLV("SEC MI2S LOOPBACK Volume", SND_SOC_NOPM, 0,
  1035. INT_RX_VOL_GAIN, 0, msm_qti_pp_get_sec_mi2s_lb_vol_mixer,
  1036. msm_qti_pp_set_sec_mi2s_lb_vol_mixer, afe_lb_vol_gain),
  1037. };
  1038. static const struct snd_kcontrol_new tert_mi2s_lb_vol_mixer_controls[] = {
  1039. SOC_SINGLE_EXT_TLV("Tert MI2S LOOPBACK Volume", SND_SOC_NOPM, 0,
  1040. INT_RX_VOL_GAIN, 0, msm_qti_pp_get_tert_mi2s_lb_vol_mixer,
  1041. msm_qti_pp_set_tert_mi2s_lb_vol_mixer, afe_lb_vol_gain),
  1042. };
  1043. static const struct snd_kcontrol_new slimbus_7_lb_vol_mixer_controls[] = {
  1044. SOC_SINGLE_EXT_TLV("SLIMBUS_7 LOOPBACK Volume", SND_SOC_NOPM, 0,
  1045. INT_RX_VOL_GAIN, 0,
  1046. msm_qti_pp_get_slimbus_7_lb_vol_mixer,
  1047. msm_qti_pp_set_slimbus_7_lb_vol_mixer,
  1048. afe_lb_vol_gain),
  1049. };
  1050. static const struct snd_kcontrol_new slimbus_8_lb_vol_mixer_controls[] = {
  1051. SOC_SINGLE_EXT_TLV("SLIMBUS_8 LOOPBACK Volume", SND_SOC_NOPM, 0,
  1052. INT_RX_VOL_GAIN, 0, msm_qti_pp_get_slimbus_8_lb_vol_mixer,
  1053. msm_qti_pp_set_slimbus_8_lb_vol_mixer, afe_lb_vol_gain),
  1054. };
  1055. static const struct snd_kcontrol_new int_hfp_vol_mixer_controls[] = {
  1056. SOC_SINGLE_EXT_TLV("Internal HFP RX Volume", SND_SOC_NOPM, 0,
  1057. INT_RX_VOL_GAIN, 0, msm_qti_pp_get_hfp_vol_mixer,
  1058. msm_qti_pp_set_hfp_vol_mixer, hfp_rx_vol_gain),
  1059. };
  1060. static const struct snd_kcontrol_new int_icc_vol_mixer_controls[] = {
  1061. SOC_SINGLE_EXT_TLV("Internal ICC Volume", SND_SOC_NOPM, 0,
  1062. INT_RX_VOL_GAIN, 0, msm_qti_pp_get_icc_vol_mixer,
  1063. msm_qti_pp_set_icc_vol_mixer, icc_rx_vol_gain),
  1064. };
  1065. static const struct snd_kcontrol_new pri_auxpcm_lb_vol_mixer_controls[] = {
  1066. SOC_SINGLE_EXT_TLV("PRI AUXPCM LOOPBACK Volume",
  1067. AFE_PORT_ID_PRIMARY_PCM_TX, 0, INT_RX_VOL_GAIN, 0,
  1068. msm_qti_pp_get_pri_auxpcm_lb_vol_mixer,
  1069. msm_qti_pp_set_pri_auxpcm_lb_vol_mixer,
  1070. pri_auxpcm_lb_vol_gain),
  1071. };
  1072. static const struct snd_kcontrol_new sec_auxpcm_lb_vol_mixer_controls[] = {
  1073. SOC_SINGLE_EXT_TLV("SEC AUXPCM LOOPBACK Volume",
  1074. AFE_PORT_ID_SECONDARY_PCM_TX, 0, INT_RX_VOL_GAIN, 0,
  1075. msm_qti_pp_get_sec_auxpcm_lb_vol_mixer,
  1076. msm_qti_pp_set_sec_auxpcm_lb_vol_mixer,
  1077. sec_auxpcm_lb_vol_gain),
  1078. };
  1079. static const struct snd_kcontrol_new multi_ch_channel_map_mixer_controls[] = {
  1080. SOC_SINGLE_MULTI_EXT("Playback Device Channel Map", SND_SOC_NOPM, 0, 16,
  1081. 0, 8, msm_qti_pp_get_channel_map_mixer,
  1082. msm_qti_pp_put_channel_map_mixer),
  1083. };
  1084. static const struct snd_kcontrol_new get_rms_controls[] = {
  1085. SOC_SINGLE_EXT("Get RMS", SND_SOC_NOPM, 0, 0xFFFFFFFF,
  1086. 0, msm_qti_pp_get_rms_value_control, msm_qti_pp_put_rms_value_control),
  1087. };
  1088. static const struct snd_kcontrol_new eq_enable_mixer_controls[] = {
  1089. SOC_SINGLE_EXT("MultiMedia1 EQ Enable", SND_SOC_NOPM,
  1090. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_qti_pp_get_eq_enable_mixer,
  1091. msm_qti_pp_put_eq_enable_mixer),
  1092. SOC_SINGLE_EXT("MultiMedia2 EQ Enable", SND_SOC_NOPM,
  1093. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_qti_pp_get_eq_enable_mixer,
  1094. msm_qti_pp_put_eq_enable_mixer),
  1095. SOC_SINGLE_EXT("MultiMedia3 EQ Enable", SND_SOC_NOPM,
  1096. MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_qti_pp_get_eq_enable_mixer,
  1097. msm_qti_pp_put_eq_enable_mixer),
  1098. };
  1099. static const struct snd_kcontrol_new eq_band_mixer_controls[] = {
  1100. SOC_SINGLE_EXT("MultiMedia1 EQ Band Count", SND_SOC_NOPM,
  1101. MSM_FRONTEND_DAI_MULTIMEDIA1, 11, 0,
  1102. msm_qti_pp_get_eq_band_count_audio_mixer,
  1103. msm_qti_pp_put_eq_band_count_audio_mixer),
  1104. SOC_SINGLE_EXT("MultiMedia2 EQ Band Count", SND_SOC_NOPM,
  1105. MSM_FRONTEND_DAI_MULTIMEDIA2, 11, 0,
  1106. msm_qti_pp_get_eq_band_count_audio_mixer,
  1107. msm_qti_pp_put_eq_band_count_audio_mixer),
  1108. SOC_SINGLE_EXT("MultiMedia3 EQ Band Count", SND_SOC_NOPM,
  1109. MSM_FRONTEND_DAI_MULTIMEDIA3, 11, 0,
  1110. msm_qti_pp_get_eq_band_count_audio_mixer,
  1111. msm_qti_pp_put_eq_band_count_audio_mixer),
  1112. };
  1113. static const struct snd_kcontrol_new eq_coeff_mixer_controls[] = {
  1114. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band1", EQ_BAND1,
  1115. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  1116. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1117. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band2", EQ_BAND2,
  1118. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  1119. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1120. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band3", EQ_BAND3,
  1121. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  1122. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1123. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band4", EQ_BAND4,
  1124. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  1125. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1126. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band5", EQ_BAND5,
  1127. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  1128. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1129. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band6", EQ_BAND6,
  1130. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  1131. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1132. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band7", EQ_BAND7,
  1133. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  1134. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1135. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band8", EQ_BAND8,
  1136. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  1137. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1138. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band9", EQ_BAND9,
  1139. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  1140. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1141. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band10", EQ_BAND10,
  1142. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  1143. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1144. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band11", EQ_BAND11,
  1145. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  1146. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1147. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band12", EQ_BAND12,
  1148. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  1149. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1150. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band1", EQ_BAND1,
  1151. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  1152. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1153. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band2", EQ_BAND2,
  1154. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  1155. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1156. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band3", EQ_BAND3,
  1157. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  1158. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1159. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band4", EQ_BAND4,
  1160. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  1161. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1162. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band5", EQ_BAND5,
  1163. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  1164. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1165. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band6", EQ_BAND6,
  1166. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  1167. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1168. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band7", EQ_BAND7,
  1169. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  1170. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1171. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band8", EQ_BAND8,
  1172. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  1173. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1174. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band9", EQ_BAND9,
  1175. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  1176. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1177. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band10", EQ_BAND10,
  1178. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  1179. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1180. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band11", EQ_BAND11,
  1181. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  1182. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1183. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band12", EQ_BAND12,
  1184. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  1185. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1186. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band1", EQ_BAND1,
  1187. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  1188. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1189. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band2", EQ_BAND2,
  1190. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  1191. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1192. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band3", EQ_BAND3,
  1193. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  1194. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1195. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band4", EQ_BAND4,
  1196. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  1197. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1198. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band5", EQ_BAND5,
  1199. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  1200. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1201. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band6", EQ_BAND6,
  1202. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  1203. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1204. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band7", EQ_BAND7,
  1205. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  1206. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1207. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band8", EQ_BAND8,
  1208. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  1209. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1210. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band9", EQ_BAND9,
  1211. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  1212. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1213. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band10", EQ_BAND10,
  1214. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  1215. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1216. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band11", EQ_BAND11,
  1217. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  1218. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1219. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band12", EQ_BAND12,
  1220. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  1221. msm_qti_pp_get_eq_band_audio_mixer, msm_qti_pp_put_eq_band_audio_mixer),
  1222. };
  1223. static const struct snd_kcontrol_new asphere_mixer_controls[] = {
  1224. SOC_SINGLE_MULTI_EXT("MSM ASphere Set Param", SND_SOC_NOPM, 0,
  1225. 0xFFFFFFFF, 0, 2, msm_qti_pp_asphere_get, msm_qti_pp_asphere_set),
  1226. };
  1227. #ifdef CONFIG_QTI_PP
  1228. void msm_qti_pp_add_controls(struct snd_soc_platform *platform)
  1229. {
  1230. snd_soc_add_platform_controls(platform, int_fm_vol_mixer_controls,
  1231. ARRAY_SIZE(int_fm_vol_mixer_controls));
  1232. snd_soc_add_platform_controls(platform, pri_mi2s_lb_vol_mixer_controls,
  1233. ARRAY_SIZE(pri_mi2s_lb_vol_mixer_controls));
  1234. snd_soc_add_platform_controls(platform, sec_mi2s_lb_vol_mixer_controls,
  1235. ARRAY_SIZE(sec_mi2s_lb_vol_mixer_controls));
  1236. snd_soc_add_platform_controls(platform, tert_mi2s_lb_vol_mixer_controls,
  1237. ARRAY_SIZE(tert_mi2s_lb_vol_mixer_controls));
  1238. snd_soc_add_platform_controls(platform, slimbus_7_lb_vol_mixer_controls,
  1239. ARRAY_SIZE(slimbus_7_lb_vol_mixer_controls));
  1240. snd_soc_add_platform_controls(platform, slimbus_8_lb_vol_mixer_controls,
  1241. ARRAY_SIZE(slimbus_8_lb_vol_mixer_controls));
  1242. snd_soc_add_platform_controls(platform, int_hfp_vol_mixer_controls,
  1243. ARRAY_SIZE(int_hfp_vol_mixer_controls));
  1244. snd_soc_add_platform_controls(platform, int_icc_vol_mixer_controls,
  1245. ARRAY_SIZE(int_icc_vol_mixer_controls));
  1246. snd_soc_add_platform_controls(platform,
  1247. pri_auxpcm_lb_vol_mixer_controls,
  1248. ARRAY_SIZE(pri_auxpcm_lb_vol_mixer_controls));
  1249. snd_soc_add_platform_controls(platform,
  1250. sec_auxpcm_lb_vol_mixer_controls,
  1251. ARRAY_SIZE(sec_auxpcm_lb_vol_mixer_controls));
  1252. snd_soc_add_platform_controls(platform,
  1253. multi_ch_channel_map_mixer_controls,
  1254. ARRAY_SIZE(multi_ch_channel_map_mixer_controls));
  1255. snd_soc_add_platform_controls(platform, get_rms_controls,
  1256. ARRAY_SIZE(get_rms_controls));
  1257. snd_soc_add_platform_controls(platform, eq_enable_mixer_controls,
  1258. ARRAY_SIZE(eq_enable_mixer_controls));
  1259. snd_soc_add_platform_controls(platform, eq_band_mixer_controls,
  1260. ARRAY_SIZE(eq_band_mixer_controls));
  1261. snd_soc_add_platform_controls(platform, eq_coeff_mixer_controls,
  1262. ARRAY_SIZE(eq_coeff_mixer_controls));
  1263. snd_soc_add_platform_controls(platform, asphere_mixer_controls,
  1264. ARRAY_SIZE(asphere_mixer_controls));
  1265. snd_soc_add_platform_controls(platform, msm_multichannel_ec_controls,
  1266. ARRAY_SIZE(msm_multichannel_ec_controls));
  1267. snd_soc_add_platform_controls(platform, dsp_bit_width_controls,
  1268. ARRAY_SIZE(dsp_bit_width_controls));
  1269. }
  1270. #endif /* CONFIG_QTI_PP */