msm-pcm-routing.c 133 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656
  1. /* Copyright (c) 2011-2013, 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/init.h>
  13. #include <linux/err.h>
  14. #include <linux/module.h>
  15. #include <linux/moduleparam.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/bitops.h>
  18. #include <linux/mutex.h>
  19. #include <sound/core.h>
  20. #include <sound/soc.h>
  21. #include <sound/soc-dapm.h>
  22. #include <sound/pcm.h>
  23. #include <sound/initval.h>
  24. #include <sound/control.h>
  25. #include <sound/q6adm.h>
  26. #include <sound/q6asm.h>
  27. #include <sound/q6afe.h>
  28. #include <sound/tlv.h>
  29. #include "msm-pcm-routing.h"
  30. #include "qdsp6/q6voice.h"
  31. struct msm_pcm_routing_bdai_data {
  32. u16 port_id; /* AFE port ID */
  33. u8 active; /* track if this backend is enabled */
  34. unsigned long fe_sessions; /* Front-end sessions */
  35. unsigned long port_sessions; /* track Tx BE ports -> Rx BE */
  36. unsigned int sample_rate;
  37. unsigned int channel;
  38. bool perf_mode;
  39. };
  40. struct msm_pcm_routing_fdai_data {
  41. u16 be_srate; /* track prior backend sample rate for flushing purpose */
  42. int strm_id; /* ASM stream ID */
  43. struct msm_pcm_routing_evt event_info;
  44. };
  45. #define INVALID_SESSION -1
  46. #define SESSION_TYPE_RX 0
  47. #define SESSION_TYPE_TX 1
  48. static struct mutex routing_lock;
  49. static int fm_switch_enable;
  50. static int fm_pcmrx_switch_enable;
  51. static short int srs_alsa_ctrl_ever_called_tm;
  52. static short int srs_alsa_ctrl_ever_called_ss3d;
  53. #define INT_RX_VOL_MAX_STEPS 0x2000
  54. #define INT_RX_VOL_GAIN 0x2000
  55. static int msm_route_fm_vol_control;
  56. static const DECLARE_TLV_DB_LINEAR(fm_rx_vol_gain, 0,
  57. INT_RX_VOL_MAX_STEPS);
  58. static int msm_route_lpa_vol_control;
  59. static const DECLARE_TLV_DB_LINEAR(lpa_rx_vol_gain, 0,
  60. INT_RX_VOL_MAX_STEPS);
  61. static int msm_route_multimedia2_vol_control;
  62. static const DECLARE_TLV_DB_LINEAR(multimedia2_rx_vol_gain, 0,
  63. INT_RX_VOL_MAX_STEPS);
  64. static int msm_route_multimedia5_vol_control;
  65. static const DECLARE_TLV_DB_LINEAR(multimedia5_rx_vol_gain, 0,
  66. INT_RX_VOL_MAX_STEPS);
  67. static int msm_route_multimedia3_vol_control;
  68. static const DECLARE_TLV_DB_LINEAR(multimedia3_rx_vol_gain, 0,
  69. INT_RX_VOL_MAX_STEPS);
  70. static int msm_route_compressed_vol_control;
  71. static const DECLARE_TLV_DB_LINEAR(compressed_rx_vol_gain, 0,
  72. INT_RX_VOL_MAX_STEPS);
  73. static int msm_route_compressed2_vol_control;
  74. static const DECLARE_TLV_DB_LINEAR(compressed2_rx_vol_gain, 0,
  75. INT_RX_VOL_MAX_STEPS);
  76. static int msm_route_compressed3_vol_control;
  77. static const DECLARE_TLV_DB_LINEAR(compressed3_rx_vol_gain, 0,
  78. INT_RX_VOL_MAX_STEPS);
  79. static int msm_route_ec_ref_rx;
  80. static int msm_route_ext_ec_ref;
  81. /* Equal to Frontend after last of the MULTIMEDIA SESSIONS */
  82. #define MAX_EQ_SESSIONS MSM_FRONTEND_DAI_CS_VOICE
  83. enum {
  84. EQ_BAND1 = 0,
  85. EQ_BAND2,
  86. EQ_BAND3,
  87. EQ_BAND4,
  88. EQ_BAND5,
  89. EQ_BAND6,
  90. EQ_BAND7,
  91. EQ_BAND8,
  92. EQ_BAND9,
  93. EQ_BAND10,
  94. EQ_BAND11,
  95. EQ_BAND12,
  96. EQ_BAND_MAX,
  97. };
  98. struct msm_audio_eq_band {
  99. uint16_t band_idx; /* The band index, 0 .. 11 */
  100. uint32_t filter_type; /* Filter band type */
  101. uint32_t center_freq_hz; /* Filter band center frequency */
  102. uint32_t filter_gain; /* Filter band initial gain (dB) */
  103. /* Range is +12 dB to -12 dB with 1dB increments. */
  104. uint32_t q_factor;
  105. } __packed;
  106. struct msm_audio_eq_stream_config {
  107. uint32_t enable; /* Number of consequtive bands specified */
  108. uint32_t num_bands;
  109. struct msm_audio_eq_band eq_bands[EQ_BAND_MAX];
  110. } __packed;
  111. struct msm_audio_eq_stream_config eq_data[MAX_EQ_SESSIONS];
  112. static void msm_send_eq_values(int eq_idx);
  113. /* This array is indexed by back-end DAI ID defined in msm-pcm-routing.h
  114. * If new back-end is defined, add new back-end DAI ID at the end of enum
  115. */
  116. union srs_trumedia_params_u {
  117. struct srs_trumedia_params srs_params;
  118. unsigned short int raw_params[1];
  119. };
  120. static union srs_trumedia_params_u msm_srs_trumedia_params[2];
  121. static void srs_send_params_trumedia(int port_id, unsigned int techs,
  122. int param_block_idx) {
  123. pr_debug("SRS %s: called, port_id = %d, techs flags = %u,"
  124. " paramblockidx %d", __func__, port_id, techs,
  125. param_block_idx);
  126. /* force all if techs is set to 1 */
  127. if (techs == 1)
  128. techs = 0xFFFFFFFF;
  129. if (techs & (1 << SRS_ID_WOWHD))
  130. srs_trumedia_open(port_id, SRS_ID_WOWHD,
  131. (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.wowhd);
  132. if (techs & (1 << SRS_ID_CSHP))
  133. srs_trumedia_open(port_id, SRS_ID_CSHP,
  134. (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.cshp);
  135. if (techs & (1 << SRS_ID_HPF))
  136. srs_trumedia_open(port_id, SRS_ID_HPF,
  137. (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.hpf);
  138. if (techs & (1 << SRS_ID_PEQ))
  139. srs_trumedia_open(port_id, SRS_ID_PEQ,
  140. (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.peq);
  141. if (techs & (1 << SRS_ID_HL))
  142. srs_trumedia_open(port_id, SRS_ID_HL,
  143. (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.hl);
  144. if (techs & (1 << SRS_ID_GLOBAL))
  145. srs_trumedia_open(port_id, SRS_ID_GLOBAL,
  146. (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.global);
  147. }
  148. union srs_SS3D_params_u {
  149. struct srs_SS3D_params srs_params;
  150. unsigned short int raw_params[1];
  151. };
  152. static union srs_SS3D_params_u msm_srs_SS3D_params[2];
  153. static void srs_send_params_SS3D(int port_id, unsigned int techs,
  154. int param_block_idx) {
  155. pr_debug("SRS %s: called, port_id = %d, techs flags = %u,\n"
  156. " paramblockidx %d", __func__, port_id, techs,
  157. param_block_idx);
  158. /* force all if techs is set to 1 */
  159. if (techs == 1)
  160. techs = 0xFFFFFFFF;
  161. if (techs & (1 << SRS_ID_SS3D_CTRL))
  162. srs_ss3d_open(port_id, SRS_ID_SS3D_CTRL,
  163. (void *)&msm_srs_SS3D_params[param_block_idx].srs_params.ss3d);
  164. if (techs & (1 << SRS_ID_SS3D_FILTER))
  165. srs_ss3d_open(port_id, SRS_ID_SS3D_FILTER,
  166. (void *)&msm_srs_SS3D_params[param_block_idx].srs_params.ss3d_f);
  167. if (techs & (1 << SRS_ID_SS3D_GLOBAL))
  168. srs_ss3d_open(port_id, SRS_ID_SS3D_GLOBAL,
  169. (void *)&msm_srs_SS3D_params[param_block_idx].srs_params.global);
  170. return;
  171. }
  172. static int srs_port_id = -1;
  173. static void srs_send_params(int port_id, unsigned int techs,
  174. int param_block_id) {
  175. if (srs_alsa_ctrl_ever_called_tm)
  176. srs_send_params_trumedia(port_id, techs, param_block_id);
  177. if (srs_alsa_ctrl_ever_called_ss3d)
  178. srs_send_params_SS3D(port_id, techs, param_block_id);
  179. }
  180. /* This array is indexed by back-end DAI ID defined in msm-pcm-routing.h
  181. * If new back-end is defined, add new back-end DAI ID at the end of enum
  182. */
  183. static struct msm_pcm_routing_bdai_data msm_bedais[MSM_BACKEND_DAI_MAX] = {
  184. { PRIMARY_I2S_RX, 0, 0, 0, 0, 0},
  185. { PRIMARY_I2S_TX, 0, 0, 0, 0, 0},
  186. { SLIMBUS_0_RX, 0, 0, 0, 0, 0},
  187. { SLIMBUS_0_TX, 0, 0, 0, 0, 0},
  188. { HDMI_RX, 0, 0, 0, 0, 0},
  189. { INT_BT_SCO_RX, 0, 0, 0, 0, 0},
  190. { INT_BT_SCO_TX, 0, 0, 0, 0, 0},
  191. { INT_FM_RX, 0, 0, 0, 0, 0},
  192. { INT_FM_TX, 0, 0, 0, 0, 0},
  193. { RT_PROXY_PORT_001_RX, 0, 0, 0, 0, 0},
  194. { RT_PROXY_PORT_001_TX, 0, 0, 0, 0, 0},
  195. { PCM_RX, 0, 0, 0, 0, 0},
  196. { PCM_TX, 0, 0, 0, 0, 0},
  197. { VOICE_PLAYBACK_TX, 0, 0, 0, 0, 0},
  198. { VOICE_RECORD_RX, 0, 0, 0, 0, 0},
  199. { VOICE_RECORD_TX, 0, 0, 0, 0, 0},
  200. { MI2S_RX, 0, 0, 0, 0, 0},
  201. { MI2S_TX, 0, 0, 0, 0},
  202. { SECONDARY_I2S_RX, 0, 0, 0, 0, 0},
  203. { SECONDARY_I2S_TX, 0, 0, 0, 0, 0},
  204. { SLIMBUS_1_RX, 0, 0, 0, 0, 0},
  205. { SLIMBUS_1_TX, 0, 0, 0, 0, 0},
  206. { SLIMBUS_4_RX, 0, 0, 0, 0, 0},
  207. { SLIMBUS_4_TX, 0, 0, 0, 0, 0},
  208. { SLIMBUS_3_RX, 0, 0, 0, 0, 0},
  209. { SLIMBUS_3_TX, 0, 0, 0, 0, 0},
  210. { SLIMBUS_EXTPROC_RX, 0, 0, 0, 0, 0},
  211. { SLIMBUS_EXTPROC_RX, 0, 0, 0, 0, 0},
  212. { SLIMBUS_EXTPROC_RX, 0, 0, 0, 0, 0},
  213. { SECONDARY_PCM_RX, 0, 0, 0, 0, 0},
  214. { SECONDARY_PCM_TX, 0, 0, 0, 0, 0},
  215. { PSEUDOPORT_01, 0, 0, 0, 0, 0},
  216. };
  217. /* Track ASM playback & capture sessions of DAI */
  218. static struct msm_pcm_routing_fdai_data
  219. fe_dai_map[MSM_FRONTEND_DAI_MM_SIZE][2] = {
  220. /* MULTIMEDIA1 */
  221. {{0, INVALID_SESSION, {NULL, NULL} },
  222. {0, INVALID_SESSION, {NULL, NULL} } },
  223. /* MULTIMEDIA2 */
  224. {{0, INVALID_SESSION, {NULL, NULL} },
  225. {0, INVALID_SESSION, {NULL, NULL} } },
  226. /* MULTIMEDIA3 */
  227. {{0, INVALID_SESSION, {NULL, NULL} },
  228. {0, INVALID_SESSION, {NULL, NULL} } },
  229. /* MULTIMEDIA4 */
  230. {{0, INVALID_SESSION, {NULL, NULL} },
  231. {0, INVALID_SESSION, {NULL, NULL} } },
  232. /* MULTIMEDIA5 */
  233. {{0, INVALID_SESSION, {NULL, NULL} },
  234. {0, INVALID_SESSION, {NULL, NULL} } },
  235. /* MULTIMEDIA6 */
  236. {{0, INVALID_SESSION, {NULL, NULL} },
  237. {0, INVALID_SESSION, {NULL, NULL} } },
  238. /* MULTIMEDIA7*/
  239. {{0, INVALID_SESSION, {NULL, NULL} },
  240. {0, INVALID_SESSION, {NULL, NULL} } },
  241. /* MULTIMEDIA8 */
  242. {{0, INVALID_SESSION, {NULL, NULL} },
  243. {0, INVALID_SESSION, {NULL, NULL} } },
  244. /* PSEUDO */
  245. {{0, INVALID_SESSION, {NULL, NULL} },
  246. {0, INVALID_SESSION, {NULL, NULL} } },
  247. };
  248. static uint8_t is_be_dai_extproc(int be_dai)
  249. {
  250. if (be_dai == MSM_BACKEND_DAI_EXTPROC_RX ||
  251. be_dai == MSM_BACKEND_DAI_EXTPROC_TX ||
  252. be_dai == MSM_BACKEND_DAI_EXTPROC_EC_TX)
  253. return 1;
  254. else
  255. return 0;
  256. }
  257. static void msm_pcm_routing_build_matrix(int fedai_id, int dspst_id,
  258. int path_type)
  259. {
  260. int i, port_type;
  261. struct route_payload payload;
  262. payload.num_copps = 0;
  263. port_type = (path_type == ADM_PATH_PLAYBACK ?
  264. MSM_AFE_PORT_TYPE_RX : MSM_AFE_PORT_TYPE_TX);
  265. for (i = 0; i < MSM_BACKEND_DAI_MAX; i++) {
  266. if (!is_be_dai_extproc(i) &&
  267. (afe_get_port_type(msm_bedais[i].port_id) == port_type) &&
  268. (msm_bedais[i].active) &&
  269. (test_bit(fedai_id, &msm_bedais[i].fe_sessions)))
  270. payload.copp_ids[payload.num_copps++] =
  271. msm_bedais[i].port_id;
  272. }
  273. if (payload.num_copps)
  274. adm_matrix_map(dspst_id, path_type,
  275. payload.num_copps, payload.copp_ids, 0);
  276. }
  277. void msm_pcm_routing_reg_psthr_stream(int fedai_id, int dspst_id,
  278. int stream_type, int enable)
  279. {
  280. int i, session_type, path_type, port_type;
  281. u32 mode = 0;
  282. if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) {
  283. /* bad ID assigned in machine driver */
  284. pr_err("%s: bad MM ID\n", __func__);
  285. return;
  286. }
  287. if (stream_type == SNDRV_PCM_STREAM_PLAYBACK) {
  288. session_type = SESSION_TYPE_RX;
  289. path_type = ADM_PATH_PLAYBACK;
  290. port_type = MSM_AFE_PORT_TYPE_RX;
  291. } else {
  292. session_type = SESSION_TYPE_TX;
  293. path_type = ADM_PATH_LIVE_REC;
  294. port_type = MSM_AFE_PORT_TYPE_TX;
  295. }
  296. mutex_lock(&routing_lock);
  297. if (enable)
  298. fe_dai_map[fedai_id][session_type].strm_id = dspst_id;
  299. else
  300. fe_dai_map[fedai_id][session_type].strm_id = INVALID_SESSION;
  301. for (i = 0; i < MSM_BACKEND_DAI_MAX; i++) {
  302. if (!is_be_dai_extproc(i) &&
  303. (afe_get_port_type(msm_bedais[i].port_id) == port_type) &&
  304. (msm_bedais[i].active) &&
  305. (test_bit(fedai_id, &msm_bedais[i].fe_sessions))) {
  306. mode = afe_get_port_type(msm_bedais[i].port_id);
  307. if (enable)
  308. adm_connect_afe_port(mode, dspst_id,
  309. msm_bedais[i].port_id);
  310. else
  311. adm_disconnect_afe_port(mode, dspst_id,
  312. msm_bedais[i].port_id);
  313. break;
  314. }
  315. }
  316. mutex_unlock(&routing_lock);
  317. }
  318. void msm_pcm_routing_reg_pseudo_stream(int fedai_id, bool perf_mode,
  319. int dspst_id, int stream_type,
  320. int sample_rate, int channels)
  321. {
  322. int i, session_type, path_type, port_type, mode, ret;
  323. struct route_payload payload;
  324. pr_debug("%s:fedai_id = %d dspst_id = %d stream_type %d",
  325. __func__, fedai_id, dspst_id, stream_type);
  326. if (stream_type == SNDRV_PCM_STREAM_PLAYBACK) {
  327. session_type = SESSION_TYPE_RX;
  328. path_type = ADM_PATH_PLAYBACK;
  329. port_type = MSM_AFE_PORT_TYPE_RX;
  330. } else {
  331. session_type = SESSION_TYPE_TX;
  332. path_type = ADM_PATH_LIVE_REC;
  333. port_type = MSM_AFE_PORT_TYPE_TX;
  334. }
  335. mutex_lock(&routing_lock);
  336. payload.num_copps = 0;
  337. adm_multi_ch_copp_pseudo_open_v3(PSEUDOPORT_01,
  338. path_type, sample_rate, channels,
  339. DEFAULT_COPP_TOPOLOGY);
  340. payload.copp_ids[payload.num_copps++] = PSEUDOPORT_01;
  341. for (i = 0; i < MSM_BACKEND_DAI_MAX; i++) {
  342. if (test_bit(fedai_id, &msm_bedais[i].fe_sessions))
  343. msm_bedais[i].perf_mode = perf_mode;
  344. if (!is_be_dai_extproc(i) &&
  345. (msm_bedais[i].active) &&
  346. (test_bit(fedai_id, &msm_bedais[i].fe_sessions))) {
  347. mode = afe_get_port_type(msm_bedais[i].port_id);
  348. ret = adm_connect_afe_port_v2(mode, dspst_id,
  349. msm_bedais[i].port_id,
  350. msm_bedais[i].sample_rate,
  351. msm_bedais[i].channel);
  352. if (ret < 0)
  353. pr_err("%s: adm_connect_afe_port_v2 failed\n",
  354. __func__);
  355. }
  356. }
  357. if (payload.num_copps)
  358. adm_matrix_map(dspst_id, path_type,
  359. payload.num_copps, payload.copp_ids, 0);
  360. mutex_unlock(&routing_lock);
  361. }
  362. void msm_pcm_routing_reg_phy_stream(int fedai_id, bool perf_mode, int dspst_id,
  363. int stream_type)
  364. {
  365. int i, session_type, path_type, port_type;
  366. struct route_payload payload;
  367. u32 channels;
  368. if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) {
  369. /* bad ID assigned in machine driver */
  370. pr_err("%s: bad MM ID %d\n", __func__, fedai_id);
  371. return;
  372. }
  373. if (stream_type == SNDRV_PCM_STREAM_PLAYBACK) {
  374. session_type = SESSION_TYPE_RX;
  375. path_type = ADM_PATH_PLAYBACK;
  376. port_type = MSM_AFE_PORT_TYPE_RX;
  377. } else {
  378. session_type = SESSION_TYPE_TX;
  379. path_type = ADM_PATH_LIVE_REC;
  380. port_type = MSM_AFE_PORT_TYPE_TX;
  381. }
  382. mutex_lock(&routing_lock);
  383. payload.num_copps = 0; /* only RX needs to use payload */
  384. fe_dai_map[fedai_id][session_type].strm_id = dspst_id;
  385. /* re-enable EQ if active */
  386. if (eq_data[fedai_id].enable)
  387. msm_send_eq_values(fedai_id);
  388. for (i = 0; i < MSM_BACKEND_DAI_MAX; i++) {
  389. if (test_bit(fedai_id, &msm_bedais[i].fe_sessions))
  390. msm_bedais[i].perf_mode = perf_mode;
  391. if (!is_be_dai_extproc(i) &&
  392. (afe_get_port_type(msm_bedais[i].port_id) == port_type) &&
  393. (msm_bedais[i].active) &&
  394. (test_bit(fedai_id, &msm_bedais[i].fe_sessions))) {
  395. channels = msm_bedais[i].channel;
  396. if ((stream_type == SNDRV_PCM_STREAM_PLAYBACK) &&
  397. ((channels == 1) || (channels == 2)) &&
  398. msm_bedais[i].perf_mode) {
  399. pr_debug("%s configure COPP to lowlatency mode",
  400. __func__);
  401. adm_multi_ch_copp_open(msm_bedais[i].port_id,
  402. path_type,
  403. msm_bedais[i].sample_rate,
  404. msm_bedais[i].channel,
  405. DEFAULT_COPP_TOPOLOGY, msm_bedais[i].perf_mode);
  406. } else if ((stream_type == SNDRV_PCM_STREAM_PLAYBACK) &&
  407. (channels > 2))
  408. adm_multi_ch_copp_open(msm_bedais[i].port_id,
  409. path_type,
  410. msm_bedais[i].sample_rate,
  411. msm_bedais[i].channel,
  412. DEFAULT_COPP_TOPOLOGY, msm_bedais[i].perf_mode);
  413. else
  414. adm_open(msm_bedais[i].port_id,
  415. path_type,
  416. msm_bedais[i].sample_rate,
  417. msm_bedais[i].channel,
  418. DEFAULT_COPP_TOPOLOGY);
  419. payload.copp_ids[payload.num_copps++] =
  420. msm_bedais[i].port_id;
  421. srs_port_id = msm_bedais[i].port_id;
  422. srs_send_params(srs_port_id, 1, 0);
  423. }
  424. }
  425. if (payload.num_copps)
  426. adm_matrix_map(dspst_id, path_type,
  427. payload.num_copps, payload.copp_ids, 0);
  428. mutex_unlock(&routing_lock);
  429. }
  430. void msm_pcm_routing_reg_phy_stream_v2(int fedai_id, bool perf_mode,
  431. int dspst_id, int stream_type,
  432. struct msm_pcm_routing_evt event_info)
  433. {
  434. msm_pcm_routing_reg_phy_stream(fedai_id, perf_mode, dspst_id,
  435. stream_type);
  436. if (stream_type == SNDRV_PCM_STREAM_PLAYBACK)
  437. fe_dai_map[fedai_id][SESSION_TYPE_RX].event_info = event_info;
  438. else
  439. fe_dai_map[fedai_id][SESSION_TYPE_TX].event_info = event_info;
  440. }
  441. void msm_pcm_routing_dereg_pseudo_stream(int fedai_id, int dspst_id)
  442. {
  443. int i, mode, ret;
  444. pr_debug("%s:fedai_id = %d dspst_id = %d",
  445. __func__, fedai_id, dspst_id);
  446. mutex_lock(&routing_lock);
  447. for (i = 0; i < MSM_BACKEND_DAI_MAX; i++) {
  448. if (!is_be_dai_extproc(i) &&
  449. (msm_bedais[i].active) &&
  450. (test_bit(fedai_id, &msm_bedais[i].fe_sessions))) {
  451. mode = afe_get_port_type(msm_bedais[i].port_id);
  452. ret = adm_disconnect_afe_port(mode, dspst_id,
  453. msm_bedais[i].port_id);
  454. if (ret < 0)
  455. pr_err("%s: adm_connect_afe_port_v2 failed\n",
  456. __func__);
  457. }
  458. }
  459. mutex_unlock(&routing_lock);
  460. }
  461. void msm_pcm_routing_dereg_phy_stream(int fedai_id, int stream_type)
  462. {
  463. int i, port_type, session_type;
  464. if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) {
  465. /* bad ID assigned in machine driver */
  466. pr_err("%s: bad MM ID\n", __func__);
  467. return;
  468. }
  469. if (stream_type == SNDRV_PCM_STREAM_PLAYBACK) {
  470. port_type = MSM_AFE_PORT_TYPE_RX;
  471. session_type = SESSION_TYPE_RX;
  472. } else {
  473. port_type = MSM_AFE_PORT_TYPE_TX;
  474. session_type = SESSION_TYPE_TX;
  475. }
  476. mutex_lock(&routing_lock);
  477. for (i = 0; i < MSM_BACKEND_DAI_MAX; i++) {
  478. if (!is_be_dai_extproc(i) &&
  479. (afe_get_port_type(msm_bedais[i].port_id) == port_type) &&
  480. (msm_bedais[i].active) &&
  481. (test_bit(fedai_id, &msm_bedais[i].fe_sessions))) {
  482. if (msm_bedais[i].port_id == PSEUDOPORT_01)
  483. adm_pseudo_close(msm_bedais[i].port_id);
  484. else
  485. adm_close(msm_bedais[i].port_id);
  486. }
  487. }
  488. fe_dai_map[fedai_id][session_type].strm_id = INVALID_SESSION;
  489. fe_dai_map[fedai_id][session_type].be_srate = 0;
  490. mutex_unlock(&routing_lock);
  491. }
  492. /* Check if FE/BE route is set */
  493. static bool msm_pcm_routing_route_is_set(u16 be_id, u16 fe_id)
  494. {
  495. bool rc = false;
  496. if (fe_id > MSM_FRONTEND_DAI_MM_MAX_ID) {
  497. /* recheck FE ID in the mixer control defined in this file */
  498. pr_err("%s: bad MM ID\n", __func__);
  499. return rc;
  500. }
  501. if (test_bit(fe_id, &msm_bedais[be_id].fe_sessions))
  502. rc = true;
  503. return rc;
  504. }
  505. static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set)
  506. {
  507. int session_type, path_type;
  508. u32 channels;
  509. struct msm_pcm_routing_fdai_data *fdai;
  510. pr_debug("%s: reg %x val %x set %x\n", __func__, reg, val, set);
  511. if (val > MSM_FRONTEND_DAI_MM_MAX_ID) {
  512. /* recheck FE ID in the mixer control defined in this file */
  513. pr_err("%s: bad MM ID\n", __func__);
  514. return;
  515. }
  516. if (afe_get_port_type(msm_bedais[reg].port_id) ==
  517. MSM_AFE_PORT_TYPE_RX) {
  518. session_type = SESSION_TYPE_RX;
  519. path_type = ADM_PATH_PLAYBACK;
  520. } else {
  521. session_type = SESSION_TYPE_TX;
  522. path_type = ADM_PATH_LIVE_REC;
  523. }
  524. mutex_lock(&routing_lock);
  525. if (set) {
  526. if (!test_bit(val, &msm_bedais[reg].fe_sessions) &&
  527. (msm_bedais[reg].port_id == VOICE_PLAYBACK_TX))
  528. voc_start_playback(set);
  529. set_bit(val, &msm_bedais[reg].fe_sessions);
  530. fdai = &fe_dai_map[val][session_type];
  531. if (msm_bedais[reg].active && fdai->strm_id !=
  532. INVALID_SESSION) {
  533. channels = msm_bedais[reg].channel;
  534. if (session_type == SESSION_TYPE_TX && fdai->be_srate &&
  535. (fdai->be_srate != msm_bedais[reg].sample_rate)) {
  536. pr_debug("%s: flush strm %d due diff BE rates\n",
  537. __func__, fdai->strm_id);
  538. if (fdai->event_info.event_func)
  539. fdai->event_info.event_func(
  540. MSM_PCM_RT_EVT_BUF_RECFG,
  541. fdai->event_info.priv_data);
  542. fdai->be_srate = 0; /* might not need it */
  543. }
  544. if ((session_type == SESSION_TYPE_RX) &&
  545. ((channels == 1) || (channels == 2))
  546. && msm_bedais[reg].perf_mode) {
  547. adm_multi_ch_copp_open(msm_bedais[reg].port_id,
  548. path_type,
  549. msm_bedais[reg].sample_rate,
  550. channels,
  551. DEFAULT_COPP_TOPOLOGY,
  552. msm_bedais[reg].perf_mode);
  553. pr_debug("%s:configure COPP to lowlatency mode",
  554. __func__);
  555. } else if ((session_type == SESSION_TYPE_RX)
  556. && (channels > 2))
  557. adm_multi_ch_copp_open(msm_bedais[reg].port_id,
  558. path_type,
  559. msm_bedais[reg].sample_rate,
  560. channels,
  561. DEFAULT_COPP_TOPOLOGY,
  562. msm_bedais[reg].perf_mode);
  563. else
  564. adm_open(msm_bedais[reg].port_id,
  565. path_type,
  566. msm_bedais[reg].sample_rate, channels,
  567. DEFAULT_COPP_TOPOLOGY);
  568. if (session_type == SESSION_TYPE_RX &&
  569. fdai->event_info.event_func)
  570. fdai->event_info.event_func(
  571. MSM_PCM_RT_EVT_DEVSWITCH,
  572. fdai->event_info.priv_data);
  573. msm_pcm_routing_build_matrix(val,
  574. fdai->strm_id, path_type);
  575. srs_port_id = msm_bedais[reg].port_id;
  576. srs_send_params(srs_port_id, 1, 0);
  577. }
  578. } else {
  579. if (test_bit(val, &msm_bedais[reg].fe_sessions) &&
  580. (msm_bedais[reg].port_id == VOICE_PLAYBACK_TX))
  581. voc_start_playback(set);
  582. clear_bit(val, &msm_bedais[reg].fe_sessions);
  583. fdai = &fe_dai_map[val][session_type];
  584. if (msm_bedais[reg].active && fdai->strm_id !=
  585. INVALID_SESSION) {
  586. fdai->be_srate = msm_bedais[reg].sample_rate;
  587. adm_close(msm_bedais[reg].port_id);
  588. msm_pcm_routing_build_matrix(val,
  589. fdai->strm_id, path_type);
  590. }
  591. }
  592. if ((msm_bedais[reg].port_id == VOICE_RECORD_RX)
  593. || (msm_bedais[reg].port_id == VOICE_RECORD_TX))
  594. voc_start_record(msm_bedais[reg].port_id, set);
  595. mutex_unlock(&routing_lock);
  596. }
  597. static int msm_routing_get_audio_mixer(struct snd_kcontrol *kcontrol,
  598. struct snd_ctl_elem_value *ucontrol)
  599. {
  600. struct soc_mixer_control *mc =
  601. (struct soc_mixer_control *)kcontrol->private_value;
  602. if (test_bit(mc->shift, &msm_bedais[mc->reg].fe_sessions))
  603. ucontrol->value.integer.value[0] = 1;
  604. else
  605. ucontrol->value.integer.value[0] = 0;
  606. pr_debug("%s: reg %x shift %x val %ld\n", __func__, mc->reg, mc->shift,
  607. ucontrol->value.integer.value[0]);
  608. return 0;
  609. }
  610. static int msm_routing_put_audio_mixer(struct snd_kcontrol *kcontrol,
  611. struct snd_ctl_elem_value *ucontrol)
  612. {
  613. struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
  614. struct snd_soc_dapm_widget *widget = wlist->widgets[0];
  615. struct soc_mixer_control *mc =
  616. (struct soc_mixer_control *)kcontrol->private_value;
  617. if (ucontrol->value.integer.value[0] &&
  618. msm_pcm_routing_route_is_set(mc->reg, mc->shift) == false) {
  619. msm_pcm_routing_process_audio(mc->reg, mc->shift, 1);
  620. snd_soc_dapm_mixer_update_power(widget, kcontrol, 1);
  621. } else if (!ucontrol->value.integer.value[0] &&
  622. msm_pcm_routing_route_is_set(mc->reg, mc->shift) == true) {
  623. msm_pcm_routing_process_audio(mc->reg, mc->shift, 0);
  624. snd_soc_dapm_mixer_update_power(widget, kcontrol, 0);
  625. }
  626. return 1;
  627. }
  628. static void msm_pcm_routing_process_voice(u16 reg, u16 val, int set)
  629. {
  630. u16 session_id = 0;
  631. pr_debug("%s: reg %x val %x set %x\n", __func__, reg, val, set);
  632. if (val == MSM_FRONTEND_DAI_CS_VOICE)
  633. session_id = voc_get_session_id(VOICE_SESSION_NAME);
  634. else if (val == MSM_FRONTEND_DAI_VOLTE)
  635. session_id = voc_get_session_id(VOLTE_SESSION_NAME);
  636. else if (val == MSM_FRONTEND_DAI_VOICE2)
  637. session_id = voc_get_session_id(VOICE2_SESSION_NAME);
  638. else
  639. session_id = voc_get_session_id(VOIP_SESSION_NAME);
  640. pr_debug("%s: FE DAI 0x%x session_id 0x%x\n",
  641. __func__, val, session_id);
  642. mutex_lock(&routing_lock);
  643. if (set)
  644. set_bit(val, &msm_bedais[reg].fe_sessions);
  645. else
  646. clear_bit(val, &msm_bedais[reg].fe_sessions);
  647. if (val == MSM_FRONTEND_DAI_DTMF_RX &&
  648. afe_get_port_type(msm_bedais[reg].port_id) ==
  649. MSM_AFE_PORT_TYPE_RX) {
  650. pr_debug("%s(): set=%d port id=0x%x for dtmf generation\n",
  651. __func__, set, msm_bedais[reg].port_id);
  652. afe_set_dtmf_gen_rx_portid(msm_bedais[reg].port_id, set);
  653. }
  654. mutex_unlock(&routing_lock);
  655. if (afe_get_port_type(msm_bedais[reg].port_id) ==
  656. MSM_AFE_PORT_TYPE_RX) {
  657. voc_set_route_flag(session_id, RX_PATH, set);
  658. if (set) {
  659. voc_set_rxtx_port(session_id,
  660. msm_bedais[reg].port_id, DEV_RX);
  661. if (voc_get_route_flag(session_id, RX_PATH) &&
  662. voc_get_route_flag(session_id, TX_PATH))
  663. voc_enable_cvp(session_id);
  664. } else {
  665. voc_disable_cvp(session_id);
  666. }
  667. } else {
  668. voc_set_route_flag(session_id, TX_PATH, set);
  669. if (set) {
  670. voc_set_rxtx_port(session_id,
  671. msm_bedais[reg].port_id, DEV_TX);
  672. if (voc_get_route_flag(session_id, RX_PATH) &&
  673. voc_get_route_flag(session_id, TX_PATH))
  674. voc_enable_cvp(session_id);
  675. } else {
  676. voc_disable_cvp(session_id);
  677. }
  678. }
  679. }
  680. static int msm_routing_get_voice_mixer(struct snd_kcontrol *kcontrol,
  681. struct snd_ctl_elem_value *ucontrol)
  682. {
  683. struct soc_mixer_control *mc =
  684. (struct soc_mixer_control *)kcontrol->private_value;
  685. mutex_lock(&routing_lock);
  686. if (test_bit(mc->shift, &msm_bedais[mc->reg].fe_sessions))
  687. ucontrol->value.integer.value[0] = 1;
  688. else
  689. ucontrol->value.integer.value[0] = 0;
  690. mutex_unlock(&routing_lock);
  691. pr_debug("%s: reg %x shift %x val %ld\n", __func__, mc->reg, mc->shift,
  692. ucontrol->value.integer.value[0]);
  693. return 0;
  694. }
  695. static int msm_routing_put_voice_mixer(struct snd_kcontrol *kcontrol,
  696. struct snd_ctl_elem_value *ucontrol)
  697. {
  698. struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
  699. struct snd_soc_dapm_widget *widget = wlist->widgets[0];
  700. struct soc_mixer_control *mc =
  701. (struct soc_mixer_control *)kcontrol->private_value;
  702. if (ucontrol->value.integer.value[0]) {
  703. msm_pcm_routing_process_voice(mc->reg, mc->shift, 1);
  704. snd_soc_dapm_mixer_update_power(widget, kcontrol, 1);
  705. } else {
  706. msm_pcm_routing_process_voice(mc->reg, mc->shift, 0);
  707. snd_soc_dapm_mixer_update_power(widget, kcontrol, 0);
  708. }
  709. return 1;
  710. }
  711. static int msm_routing_get_voice_stub_mixer(struct snd_kcontrol *kcontrol,
  712. struct snd_ctl_elem_value *ucontrol)
  713. {
  714. struct soc_mixer_control *mc =
  715. (struct soc_mixer_control *)kcontrol->private_value;
  716. mutex_lock(&routing_lock);
  717. if (test_bit(mc->shift, &msm_bedais[mc->reg].fe_sessions))
  718. ucontrol->value.integer.value[0] = 1;
  719. else
  720. ucontrol->value.integer.value[0] = 0;
  721. mutex_unlock(&routing_lock);
  722. pr_debug("%s: reg %x shift %x val %ld\n", __func__, mc->reg, mc->shift,
  723. ucontrol->value.integer.value[0]);
  724. return 0;
  725. }
  726. static int msm_routing_put_voice_stub_mixer(struct snd_kcontrol *kcontrol,
  727. struct snd_ctl_elem_value *ucontrol)
  728. {
  729. struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
  730. struct snd_soc_dapm_widget *widget = wlist->widgets[0];
  731. struct soc_mixer_control *mc =
  732. (struct soc_mixer_control *)kcontrol->private_value;
  733. if (ucontrol->value.integer.value[0]) {
  734. mutex_lock(&routing_lock);
  735. set_bit(mc->shift, &msm_bedais[mc->reg].fe_sessions);
  736. mutex_unlock(&routing_lock);
  737. snd_soc_dapm_mixer_update_power(widget, kcontrol, 1);
  738. } else {
  739. mutex_lock(&routing_lock);
  740. clear_bit(mc->shift, &msm_bedais[mc->reg].fe_sessions);
  741. mutex_unlock(&routing_lock);
  742. snd_soc_dapm_mixer_update_power(widget, kcontrol, 0);
  743. }
  744. pr_debug("%s: reg %x shift %x val %ld\n", __func__, mc->reg, mc->shift,
  745. ucontrol->value.integer.value[0]);
  746. return 1;
  747. }
  748. static int msm_routing_get_switch_mixer(struct snd_kcontrol *kcontrol,
  749. struct snd_ctl_elem_value *ucontrol)
  750. {
  751. ucontrol->value.integer.value[0] = fm_switch_enable;
  752. pr_debug("%s: FM Switch enable %ld\n", __func__,
  753. ucontrol->value.integer.value[0]);
  754. return 0;
  755. }
  756. static int msm_routing_put_switch_mixer(struct snd_kcontrol *kcontrol,
  757. struct snd_ctl_elem_value *ucontrol)
  758. {
  759. struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
  760. struct snd_soc_dapm_widget *widget = wlist->widgets[0];
  761. pr_debug("%s: FM Switch enable %ld\n", __func__,
  762. ucontrol->value.integer.value[0]);
  763. if (ucontrol->value.integer.value[0])
  764. snd_soc_dapm_mixer_update_power(widget, kcontrol, 1);
  765. else
  766. snd_soc_dapm_mixer_update_power(widget, kcontrol, 0);
  767. fm_switch_enable = ucontrol->value.integer.value[0];
  768. return 1;
  769. }
  770. static int msm_routing_get_fm_pcmrx_switch_mixer(struct snd_kcontrol *kcontrol,
  771. struct snd_ctl_elem_value *ucontrol)
  772. {
  773. ucontrol->value.integer.value[0] = fm_pcmrx_switch_enable;
  774. pr_debug("%s: FM Switch enable %ld\n", __func__,
  775. ucontrol->value.integer.value[0]);
  776. return 0;
  777. }
  778. static int msm_routing_put_fm_pcmrx_switch_mixer(struct snd_kcontrol *kcontrol,
  779. struct snd_ctl_elem_value *ucontrol)
  780. {
  781. struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
  782. struct snd_soc_dapm_widget *widget = wlist->widgets[0];
  783. pr_debug("%s: FM Switch enable %ld\n", __func__,
  784. ucontrol->value.integer.value[0]);
  785. if (ucontrol->value.integer.value[0])
  786. snd_soc_dapm_mixer_update_power(widget, kcontrol, 1);
  787. else
  788. snd_soc_dapm_mixer_update_power(widget, kcontrol, 0);
  789. fm_pcmrx_switch_enable = ucontrol->value.integer.value[0];
  790. return 1;
  791. }
  792. static int msm_routing_get_port_mixer(struct snd_kcontrol *kcontrol,
  793. struct snd_ctl_elem_value *ucontrol)
  794. {
  795. struct soc_mixer_control *mc =
  796. (struct soc_mixer_control *)kcontrol->private_value;
  797. if (test_bit(mc->shift, &msm_bedais[mc->reg].port_sessions))
  798. ucontrol->value.integer.value[0] = 1;
  799. else
  800. ucontrol->value.integer.value[0] = 0;
  801. pr_debug("%s: reg %x shift %x val %ld\n", __func__, mc->reg, mc->shift,
  802. ucontrol->value.integer.value[0]);
  803. return 0;
  804. }
  805. static int msm_routing_put_port_mixer(struct snd_kcontrol *kcontrol,
  806. struct snd_ctl_elem_value *ucontrol)
  807. {
  808. struct soc_mixer_control *mc =
  809. (struct soc_mixer_control *)kcontrol->private_value;
  810. pr_debug("%s: reg %x shift %x val %ld\n", __func__, mc->reg,
  811. mc->shift, ucontrol->value.integer.value[0]);
  812. if (ucontrol->value.integer.value[0]) {
  813. afe_loopback(1, msm_bedais[mc->reg].port_id,
  814. msm_bedais[mc->shift].port_id);
  815. set_bit(mc->shift,
  816. &msm_bedais[mc->reg].port_sessions);
  817. } else {
  818. afe_loopback(0, msm_bedais[mc->reg].port_id,
  819. msm_bedais[mc->shift].port_id);
  820. clear_bit(mc->shift,
  821. &msm_bedais[mc->reg].port_sessions);
  822. }
  823. return 1;
  824. }
  825. static int msm_routing_get_fm_vol_mixer(struct snd_kcontrol *kcontrol,
  826. struct snd_ctl_elem_value *ucontrol)
  827. {
  828. ucontrol->value.integer.value[0] = msm_route_fm_vol_control;
  829. return 0;
  830. }
  831. static int msm_routing_set_fm_vol_mixer(struct snd_kcontrol *kcontrol,
  832. struct snd_ctl_elem_value *ucontrol)
  833. {
  834. afe_loopback_gain(INT_FM_TX, ucontrol->value.integer.value[0]);
  835. msm_route_fm_vol_control = ucontrol->value.integer.value[0];
  836. return 0;
  837. }
  838. static int msm_routing_get_lpa_vol_mixer(struct snd_kcontrol *kcontrol,
  839. struct snd_ctl_elem_value *ucontrol)
  840. {
  841. ucontrol->value.integer.value[0] = msm_route_lpa_vol_control;
  842. return 0;
  843. }
  844. static int msm_routing_set_lpa_vol_mixer(struct snd_kcontrol *kcontrol,
  845. struct snd_ctl_elem_value *ucontrol)
  846. {
  847. if (!lpa_set_volume(ucontrol->value.integer.value[0]))
  848. msm_route_lpa_vol_control =
  849. ucontrol->value.integer.value[0];
  850. return 0;
  851. }
  852. static int msm_routing_get_multimedia2_vol_mixer(struct snd_kcontrol *kcontrol,
  853. struct snd_ctl_elem_value *ucontrol)
  854. {
  855. ucontrol->value.integer.value[0] = msm_route_multimedia2_vol_control;
  856. return 0;
  857. }
  858. static int msm_routing_set_multimedia2_vol_mixer(struct snd_kcontrol *kcontrol,
  859. struct snd_ctl_elem_value *ucontrol)
  860. {
  861. if (!multi_ch_pcm_set_volume(ucontrol->value.integer.value[0]))
  862. msm_route_multimedia2_vol_control =
  863. ucontrol->value.integer.value[0];
  864. return 0;
  865. }
  866. static int msm_routing_get_multimedia5_vol_mixer(struct snd_kcontrol *kcontrol,
  867. struct snd_ctl_elem_value *ucontrol)
  868. {
  869. ucontrol->value.integer.value[0] = msm_route_multimedia5_vol_control;
  870. return 0;
  871. }
  872. static int msm_routing_set_multimedia5_vol_mixer(struct snd_kcontrol *kcontrol,
  873. struct snd_ctl_elem_value *ucontrol)
  874. {
  875. if (!multi_ch_pcm_set_volume(ucontrol->value.integer.value[0]))
  876. msm_route_multimedia5_vol_control =
  877. ucontrol->value.integer.value[0];
  878. return 0;
  879. }
  880. static int msm_routing_get_multimedia3_vol_mixer(struct snd_kcontrol *kcontrol,
  881. struct snd_ctl_elem_value *ucontrol)
  882. {
  883. ucontrol->value.integer.value[0] = msm_route_multimedia3_vol_control;
  884. return 0;
  885. }
  886. static int msm_routing_set_multimedia3_vol_mixer(struct snd_kcontrol *kcontrol,
  887. struct snd_ctl_elem_value *ucontrol)
  888. {
  889. if (!multi_ch_pcm_set_volume(ucontrol->value.integer.value[0]))
  890. msm_route_multimedia3_vol_control =
  891. ucontrol->value.integer.value[0];
  892. return 0;
  893. }
  894. static int msm_routing_get_compressed_vol_mixer(struct snd_kcontrol *kcontrol,
  895. struct snd_ctl_elem_value *ucontrol)
  896. {
  897. ucontrol->value.integer.value[0] = msm_route_compressed_vol_control;
  898. return 0;
  899. }
  900. static int msm_routing_set_compressed_vol_mixer(struct snd_kcontrol *kcontrol,
  901. struct snd_ctl_elem_value *ucontrol)
  902. {
  903. if (!compressed_set_volume(ucontrol->value.integer.value[0]))
  904. msm_route_compressed_vol_control =
  905. ucontrol->value.integer.value[0];
  906. return 0;
  907. }
  908. static int msm_routing_get_compressed2_vol_mixer(struct snd_kcontrol *kcontrol,
  909. struct snd_ctl_elem_value *ucontrol)
  910. {
  911. ucontrol->value.integer.value[0] = msm_route_compressed2_vol_control;
  912. return 0;
  913. }
  914. static int msm_routing_set_compressed2_vol_mixer(struct snd_kcontrol *kcontrol,
  915. struct snd_ctl_elem_value *ucontrol)
  916. {
  917. if (!compressed_set_volume(ucontrol->value.integer.value[0]))
  918. msm_route_compressed2_vol_control =
  919. ucontrol->value.integer.value[0];
  920. return 0;
  921. }
  922. static int msm_routing_get_compressed3_vol_mixer(struct snd_kcontrol *kcontrol,
  923. struct snd_ctl_elem_value *ucontrol)
  924. {
  925. ucontrol->value.integer.value[0] = msm_route_compressed3_vol_control;
  926. return 0;
  927. }
  928. static int msm_routing_set_compressed3_vol_mixer(struct snd_kcontrol *kcontrol,
  929. struct snd_ctl_elem_value *ucontrol)
  930. {
  931. if (!compressed_set_volume(ucontrol->value.integer.value[0]))
  932. msm_route_compressed3_vol_control =
  933. ucontrol->value.integer.value[0];
  934. return 0;
  935. }
  936. static int msm_routing_get_srs_trumedia_control(struct snd_kcontrol *kcontrol,
  937. struct snd_ctl_elem_value *ucontrol)
  938. {
  939. ucontrol->value.integer.value[0] = 0;
  940. return 0;
  941. }
  942. static int msm_routing_set_srs_trumedia_control_(struct snd_kcontrol *kcontrol,
  943. struct snd_ctl_elem_value *ucontrol)
  944. {
  945. unsigned int techs = 0;
  946. unsigned short offset, value, max, index;
  947. srs_alsa_ctrl_ever_called_tm = 1;
  948. max = sizeof(msm_srs_trumedia_params) >> 1;
  949. index = (unsigned short)((ucontrol->value.integer.value[0] &
  950. SRS_PARAM_INDEX_MASK) >> 31);
  951. if (SRS_CMD_UPLOAD ==
  952. (ucontrol->value.integer.value[0] & SRS_CMD_UPLOAD)) {
  953. techs = ucontrol->value.integer.value[0] & 0xFF;
  954. pr_debug("SRS %s: send params request, flags = %u",
  955. __func__, techs);
  956. if (srs_port_id >= 0 && techs)
  957. srs_send_params_trumedia(srs_port_id, techs, index);
  958. return 0;
  959. }
  960. offset = (unsigned short)((ucontrol->value.integer.value[0] &
  961. SRS_PARAM_OFFSET_MASK) >> 16);
  962. value = (unsigned short)(ucontrol->value.integer.value[0] &
  963. SRS_PARAM_VALUE_MASK);
  964. if (offset < max) {
  965. msm_srs_trumedia_params[index].raw_params[offset] = value;
  966. } else {
  967. pr_err("SRS %s: index out of bounds! (max %d, requested %d)",
  968. __func__, max, offset);
  969. }
  970. return 0;
  971. }
  972. static int msm_routing_set_srs_trumedia_control(struct snd_kcontrol *kcontrol,
  973. struct snd_ctl_elem_value *ucontrol) {
  974. int ret;
  975. mutex_lock(&routing_lock);
  976. srs_port_id = SLIMBUS_0_RX;
  977. ret = msm_routing_set_srs_trumedia_control_(kcontrol, ucontrol);
  978. mutex_unlock(&routing_lock);
  979. return ret;
  980. }
  981. static int msm_routing_set_srs_trumedia_control_I2S(
  982. struct snd_kcontrol *kcontrol,
  983. struct snd_ctl_elem_value *ucontrol) {
  984. int ret;
  985. mutex_lock(&routing_lock);
  986. srs_port_id = PRIMARY_I2S_RX;
  987. ret = msm_routing_set_srs_trumedia_control_(kcontrol, ucontrol);
  988. mutex_unlock(&routing_lock);
  989. return ret;
  990. }
  991. static int msm_routing_set_srs_trumedia_control_HDMI(
  992. struct snd_kcontrol *kcontrol,
  993. struct snd_ctl_elem_value *ucontrol) {
  994. int ret;
  995. mutex_lock(&routing_lock);
  996. srs_port_id = HDMI_RX;
  997. ret = msm_routing_set_srs_trumedia_control_(kcontrol, ucontrol);
  998. mutex_unlock(&routing_lock);
  999. return ret;
  1000. }
  1001. static int msm_routing_get_srs_SS3D_control(struct snd_kcontrol *kcontrol,
  1002. struct snd_ctl_elem_value *ucontrol)
  1003. {
  1004. ucontrol->value.integer.value[0] = 0;
  1005. return 0;
  1006. }
  1007. static int msm_routing_set_srs_SS3D_control_(struct snd_kcontrol *kcontrol,
  1008. struct snd_ctl_elem_value *ucontrol)
  1009. {
  1010. unsigned int techs = 0;
  1011. unsigned short offset, value, max, index;
  1012. srs_alsa_ctrl_ever_called_ss3d = 1;
  1013. max = sizeof(msm_srs_SS3D_params) >> 1;
  1014. index = (unsigned short)((ucontrol->value.integer.value[0] &
  1015. SRS_PARAM_INDEX_MASK) >> 31);
  1016. if (SRS_CMD_UPLOAD ==
  1017. (ucontrol->value.integer.value[0] & SRS_CMD_UPLOAD)) {
  1018. techs = ucontrol->value.integer.value[0] & 0xFF;
  1019. pr_debug("SRS %s: send params request, flags = %u", __func__,
  1020. techs);
  1021. if (srs_port_id >= 0 && techs)
  1022. srs_send_params_SS3D(srs_port_id, techs, index);
  1023. return 0;
  1024. }
  1025. offset = (unsigned short)((ucontrol->value.integer.value[0] &
  1026. SRS_PARAM_OFFSET_MASK) >> 16);
  1027. value = (unsigned short)(ucontrol->value.integer.value[0] &
  1028. SRS_PARAM_VALUE_MASK);
  1029. if (offset < max) {
  1030. msm_srs_SS3D_params[index].raw_params[offset] = value;
  1031. } else {
  1032. pr_err("SRS %s: index out of bounds! (max %d, requested %d)",
  1033. __func__, max, offset);
  1034. }
  1035. return 0;
  1036. }
  1037. static int msm_routing_set_srs_SS3D_control(struct snd_kcontrol *kcontrol,
  1038. struct snd_ctl_elem_value *ucontrol) {
  1039. int ret;
  1040. mutex_lock(&routing_lock);
  1041. srs_port_id = SLIMBUS_0_RX;
  1042. ret = msm_routing_set_srs_SS3D_control_(kcontrol, ucontrol);
  1043. mutex_unlock(&routing_lock);
  1044. return ret;
  1045. }
  1046. static int msm_routing_set_srs_SS3D_control_I2S(
  1047. struct snd_kcontrol *kcontrol,
  1048. struct snd_ctl_elem_value *ucontrol) {
  1049. int ret;
  1050. mutex_lock(&routing_lock);
  1051. srs_port_id = PRIMARY_I2S_RX;
  1052. ret = msm_routing_set_srs_SS3D_control_(kcontrol, ucontrol);
  1053. mutex_unlock(&routing_lock);
  1054. return ret;
  1055. }
  1056. static int msm_routing_set_srs_SS3D_control_HDMI(
  1057. struct snd_kcontrol *kcontrol,
  1058. struct snd_ctl_elem_value *ucontrol) {
  1059. int ret;
  1060. mutex_lock(&routing_lock);
  1061. srs_port_id = HDMI_RX;
  1062. ret = msm_routing_set_srs_SS3D_control_(kcontrol, ucontrol);
  1063. mutex_unlock(&routing_lock);
  1064. return ret;
  1065. }
  1066. static void msm_send_eq_values(int eq_idx)
  1067. {
  1068. int result;
  1069. struct audio_client *ac = q6asm_get_audio_client(
  1070. fe_dai_map[eq_idx][SESSION_TYPE_RX].strm_id);
  1071. if (ac == NULL) {
  1072. pr_err("%s: Could not get audio client for session: %d\n",
  1073. __func__, fe_dai_map[eq_idx][SESSION_TYPE_RX].strm_id);
  1074. goto done;
  1075. }
  1076. result = q6asm_equalizer(ac, &eq_data[eq_idx]);
  1077. if (result < 0)
  1078. pr_err("%s: Call to ASM equalizer failed, returned = %d\n",
  1079. __func__, result);
  1080. done:
  1081. return;
  1082. }
  1083. static int msm_routing_get_eq_enable_mixer(struct snd_kcontrol *kcontrol,
  1084. struct snd_ctl_elem_value *ucontrol)
  1085. {
  1086. int eq_idx = ((struct soc_multi_mixer_control *)
  1087. kcontrol->private_value)->reg;
  1088. ucontrol->value.integer.value[0] = eq_data[eq_idx].enable;
  1089. pr_debug("%s: EQ #%d enable %d\n", __func__,
  1090. eq_idx, eq_data[eq_idx].enable);
  1091. return 0;
  1092. }
  1093. static int msm_routing_put_eq_enable_mixer(struct snd_kcontrol *kcontrol,
  1094. struct snd_ctl_elem_value *ucontrol)
  1095. {
  1096. int eq_idx = ((struct soc_multi_mixer_control *)
  1097. kcontrol->private_value)->reg;
  1098. int value = ucontrol->value.integer.value[0];
  1099. pr_debug("%s: EQ #%d enable %d\n", __func__,
  1100. eq_idx, value);
  1101. eq_data[eq_idx].enable = value;
  1102. msm_send_eq_values(eq_idx);
  1103. return 0;
  1104. }
  1105. static int msm_routing_get_eq_band_count_audio_mixer(
  1106. struct snd_kcontrol *kcontrol,
  1107. struct snd_ctl_elem_value *ucontrol)
  1108. {
  1109. int eq_idx = ((struct soc_multi_mixer_control *)
  1110. kcontrol->private_value)->reg;
  1111. ucontrol->value.integer.value[0] = eq_data[eq_idx].num_bands;
  1112. pr_debug("%s: EQ #%d bands %d\n", __func__,
  1113. eq_idx, eq_data[eq_idx].num_bands);
  1114. return eq_data[eq_idx].num_bands;
  1115. }
  1116. static int msm_routing_put_eq_band_count_audio_mixer(
  1117. struct snd_kcontrol *kcontrol,
  1118. struct snd_ctl_elem_value *ucontrol)
  1119. {
  1120. int eq_idx = ((struct soc_multi_mixer_control *)
  1121. kcontrol->private_value)->reg;
  1122. int value = ucontrol->value.integer.value[0];
  1123. pr_debug("%s: EQ #%d bands %d\n", __func__,
  1124. eq_idx, value);
  1125. eq_data[eq_idx].num_bands = value;
  1126. return 0;
  1127. }
  1128. static int msm_routing_get_eq_band_audio_mixer(struct snd_kcontrol *kcontrol,
  1129. struct snd_ctl_elem_value *ucontrol)
  1130. {
  1131. int eq_idx = ((struct soc_multi_mixer_control *)
  1132. kcontrol->private_value)->reg;
  1133. int band_idx = ((struct soc_multi_mixer_control *)
  1134. kcontrol->private_value)->shift;
  1135. ucontrol->value.integer.value[0] =
  1136. eq_data[eq_idx].eq_bands[band_idx].band_idx;
  1137. ucontrol->value.integer.value[1] =
  1138. eq_data[eq_idx].eq_bands[band_idx].filter_type;
  1139. ucontrol->value.integer.value[2] =
  1140. eq_data[eq_idx].eq_bands[band_idx].center_freq_hz;
  1141. ucontrol->value.integer.value[3] =
  1142. eq_data[eq_idx].eq_bands[band_idx].filter_gain;
  1143. ucontrol->value.integer.value[4] =
  1144. eq_data[eq_idx].eq_bands[band_idx].q_factor;
  1145. pr_debug("%s: band_idx = %d\n", __func__,
  1146. eq_data[eq_idx].eq_bands[band_idx].band_idx);
  1147. pr_debug("%s: filter_type = %d\n", __func__,
  1148. eq_data[eq_idx].eq_bands[band_idx].filter_type);
  1149. pr_debug("%s: center_freq_hz = %d\n", __func__,
  1150. eq_data[eq_idx].eq_bands[band_idx].center_freq_hz);
  1151. pr_debug("%s: filter_gain = %d\n", __func__,
  1152. eq_data[eq_idx].eq_bands[band_idx].filter_gain);
  1153. pr_debug("%s: q_factor = %d\n", __func__,
  1154. eq_data[eq_idx].eq_bands[band_idx].q_factor);
  1155. return 0;
  1156. }
  1157. static int msm_routing_put_eq_band_audio_mixer(struct snd_kcontrol *kcontrol,
  1158. struct snd_ctl_elem_value *ucontrol)
  1159. {
  1160. int eq_idx = ((struct soc_multi_mixer_control *)
  1161. kcontrol->private_value)->reg;
  1162. int band_idx = ((struct soc_multi_mixer_control *)
  1163. kcontrol->private_value)->shift;
  1164. eq_data[eq_idx].eq_bands[band_idx].band_idx =
  1165. ucontrol->value.integer.value[0];
  1166. eq_data[eq_idx].eq_bands[band_idx].filter_type =
  1167. ucontrol->value.integer.value[1];
  1168. eq_data[eq_idx].eq_bands[band_idx].center_freq_hz =
  1169. ucontrol->value.integer.value[2];
  1170. eq_data[eq_idx].eq_bands[band_idx].filter_gain =
  1171. ucontrol->value.integer.value[3];
  1172. eq_data[eq_idx].eq_bands[band_idx].q_factor =
  1173. ucontrol->value.integer.value[4];
  1174. return 0;
  1175. }
  1176. static int msm_routing_ec_ref_rx_get(struct snd_kcontrol *kcontrol,
  1177. struct snd_ctl_elem_value *ucontrol)
  1178. {
  1179. pr_debug("%s: ec_ref_rx = %d", __func__, msm_route_ec_ref_rx);
  1180. ucontrol->value.integer.value[0] = msm_route_ec_ref_rx;
  1181. return 0;
  1182. }
  1183. static int msm_routing_ec_ref_rx_put(struct snd_kcontrol *kcontrol,
  1184. struct snd_ctl_elem_value *ucontrol)
  1185. {
  1186. switch (ucontrol->value.integer.value[0]) {
  1187. case 0:
  1188. msm_route_ec_ref_rx = SLIMBUS_0_RX;
  1189. break;
  1190. case 1:
  1191. msm_route_ec_ref_rx = PRIMARY_I2S_RX;
  1192. break;
  1193. default:
  1194. msm_route_ec_ref_rx = 0;
  1195. break;
  1196. }
  1197. adm_ec_ref_rx_id(msm_route_ec_ref_rx);
  1198. pr_debug("%s: msm_route_ec_ref_rx = %d\n",
  1199. __func__, msm_route_ec_ref_rx);
  1200. return 0;
  1201. }
  1202. static const char * const ec_ref_rx[] = {"SLIM_RX", "I2S_RX", "PROXY_RX",
  1203. "NONE"};
  1204. static const struct soc_enum msm_route_ec_ref_rx_enum[] = {
  1205. SOC_ENUM_SINGLE_EXT(4, ec_ref_rx),
  1206. };
  1207. static const struct snd_kcontrol_new ec_ref_rx_mixer_controls[] = {
  1208. SOC_ENUM_EXT("EC_REF_RX", msm_route_ec_ref_rx_enum[0],
  1209. msm_routing_ec_ref_rx_get, msm_routing_ec_ref_rx_put),
  1210. };
  1211. static int msm_routing_ext_ec_get(struct snd_kcontrol *kcontrol,
  1212. struct snd_ctl_elem_value *ucontrol)
  1213. {
  1214. pr_debug("%s: ext_ec_ref_rx = %x\n", __func__, msm_route_ext_ec_ref);
  1215. mutex_lock(&routing_lock);
  1216. ucontrol->value.integer.value[0] = msm_route_ext_ec_ref;
  1217. mutex_unlock(&routing_lock);
  1218. return 0;
  1219. }
  1220. static int msm_routing_ext_ec_put(struct snd_kcontrol *kcontrol,
  1221. struct snd_ctl_elem_value *ucontrol)
  1222. {
  1223. struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
  1224. struct snd_soc_dapm_widget *widget = wlist->widgets[0];
  1225. int mux = ucontrol->value.enumerated.item[0];
  1226. struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
  1227. int ret = 0;
  1228. pr_debug("%s: msm_route_ec_ref_rx = %d value = %ld\n",
  1229. __func__, msm_route_ext_ec_ref,
  1230. ucontrol->value.integer.value[0]);
  1231. mutex_lock(&routing_lock);
  1232. switch (ucontrol->value.integer.value[0]) {
  1233. case 1:
  1234. msm_route_ext_ec_ref = MI2S_TX;
  1235. ret = voc_set_ext_ec_ref(msm_route_ext_ec_ref, true);
  1236. break;
  1237. default:
  1238. msm_route_ext_ec_ref = AFE_PORT_INVALID;
  1239. ret = voc_set_ext_ec_ref(msm_route_ext_ec_ref, false);
  1240. break;
  1241. }
  1242. mutex_unlock(&routing_lock);
  1243. snd_soc_dapm_mux_update_power(widget, kcontrol, 1, mux, e);
  1244. return ret;
  1245. }
  1246. static const char * const ext_ec_ref_rx[] = {"NONE", "MI2S_TX"};
  1247. static const struct soc_enum msm_route_ext_ec_ref_rx_enum[] = {
  1248. SOC_ENUM_SINGLE_EXT(2, ext_ec_ref_rx),
  1249. };
  1250. static const struct snd_kcontrol_new voc_ext_ec_mux =
  1251. SOC_DAPM_ENUM_EXT("VOC_EXT_EC MUX Mux", msm_route_ext_ec_ref_rx_enum[0],
  1252. msm_routing_ext_ec_get, msm_routing_ext_ec_put);
  1253. static const struct snd_kcontrol_new pri_i2s_rx_mixer_controls[] = {
  1254. SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_PRI_I2S_RX ,
  1255. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1256. msm_routing_put_audio_mixer),
  1257. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_PRI_I2S_RX,
  1258. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1259. msm_routing_put_audio_mixer),
  1260. SOC_SINGLE_EXT("MultiMedia3", MSM_BACKEND_DAI_PRI_I2S_RX,
  1261. MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer,
  1262. msm_routing_put_audio_mixer),
  1263. SOC_SINGLE_EXT("MultiMedia4", MSM_BACKEND_DAI_PRI_I2S_RX,
  1264. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1265. msm_routing_put_audio_mixer),
  1266. SOC_SINGLE_EXT("MultiMedia5", MSM_BACKEND_DAI_PRI_I2S_RX,
  1267. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1268. msm_routing_put_audio_mixer),
  1269. SOC_SINGLE_EXT("MultiMedia6", MSM_BACKEND_DAI_PRI_I2S_RX,
  1270. MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer,
  1271. msm_routing_put_audio_mixer),
  1272. SOC_SINGLE_EXT("MultiMedia7", MSM_BACKEND_DAI_PRI_I2S_RX,
  1273. MSM_FRONTEND_DAI_MULTIMEDIA7, 1, 0, msm_routing_get_audio_mixer,
  1274. msm_routing_put_audio_mixer),
  1275. SOC_SINGLE_EXT("MultiMedia8", MSM_BACKEND_DAI_PRI_I2S_RX,
  1276. MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer,
  1277. msm_routing_put_audio_mixer),
  1278. };
  1279. static const struct snd_kcontrol_new sec_i2s_rx_mixer_controls[] = {
  1280. SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_SEC_I2S_RX ,
  1281. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1282. msm_routing_put_audio_mixer),
  1283. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_SEC_I2S_RX,
  1284. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1285. msm_routing_put_audio_mixer),
  1286. SOC_SINGLE_EXT("MultiMedia3", MSM_BACKEND_DAI_SEC_I2S_RX,
  1287. MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer,
  1288. msm_routing_put_audio_mixer),
  1289. SOC_SINGLE_EXT("MultiMedia4", MSM_BACKEND_DAI_SEC_I2S_RX,
  1290. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1291. msm_routing_put_audio_mixer),
  1292. SOC_SINGLE_EXT("MultiMedia5", MSM_BACKEND_DAI_SEC_I2S_RX,
  1293. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1294. msm_routing_put_audio_mixer),
  1295. SOC_SINGLE_EXT("MultiMedia6", MSM_BACKEND_DAI_SEC_I2S_RX,
  1296. MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer,
  1297. msm_routing_put_audio_mixer),
  1298. SOC_SINGLE_EXT("MultiMedia7", MSM_BACKEND_DAI_SEC_I2S_RX,
  1299. MSM_FRONTEND_DAI_MULTIMEDIA7, 1, 0, msm_routing_get_audio_mixer,
  1300. msm_routing_put_audio_mixer),
  1301. SOC_SINGLE_EXT("MultiMedia8", MSM_BACKEND_DAI_SEC_I2S_RX,
  1302. MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer,
  1303. msm_routing_put_audio_mixer),
  1304. SOC_SINGLE_EXT("Pseudo", MSM_BACKEND_DAI_SEC_I2S_RX,
  1305. MSM_FRONTEND_DAI_PSEUDO, 1, 0, msm_routing_get_audio_mixer,
  1306. msm_routing_put_audio_mixer),
  1307. };
  1308. static const struct snd_kcontrol_new slimbus_rx_mixer_controls[] = {
  1309. SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_SLIMBUS_0_RX ,
  1310. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1311. msm_routing_put_audio_mixer),
  1312. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_SLIMBUS_0_RX,
  1313. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1314. msm_routing_put_audio_mixer),
  1315. SOC_SINGLE_EXT("MultiMedia3", MSM_BACKEND_DAI_SLIMBUS_0_RX,
  1316. MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer,
  1317. msm_routing_put_audio_mixer),
  1318. SOC_SINGLE_EXT("MultiMedia4", MSM_BACKEND_DAI_SLIMBUS_0_RX,
  1319. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1320. msm_routing_put_audio_mixer),
  1321. SOC_SINGLE_EXT("MultiMedia5", MSM_BACKEND_DAI_SLIMBUS_0_RX,
  1322. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1323. msm_routing_put_audio_mixer),
  1324. SOC_SINGLE_EXT("MultiMedia6", MSM_BACKEND_DAI_SLIMBUS_0_RX,
  1325. MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer,
  1326. msm_routing_put_audio_mixer),
  1327. SOC_SINGLE_EXT("MultiMedia7", MSM_BACKEND_DAI_SLIMBUS_0_RX,
  1328. MSM_FRONTEND_DAI_MULTIMEDIA7, 1, 0, msm_routing_get_audio_mixer,
  1329. msm_routing_put_audio_mixer),
  1330. SOC_SINGLE_EXT("MultiMedia8", MSM_BACKEND_DAI_SLIMBUS_0_RX,
  1331. MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer,
  1332. msm_routing_put_audio_mixer),
  1333. };
  1334. static const struct snd_kcontrol_new mi2s_rx_mixer_controls[] = {
  1335. SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_MI2S_RX ,
  1336. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1337. msm_routing_put_audio_mixer),
  1338. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_MI2S_RX,
  1339. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1340. msm_routing_put_audio_mixer),
  1341. SOC_SINGLE_EXT("MultiMedia3", MSM_BACKEND_DAI_MI2S_RX,
  1342. MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer,
  1343. msm_routing_put_audio_mixer),
  1344. SOC_SINGLE_EXT("MultiMedia4", MSM_BACKEND_DAI_MI2S_RX,
  1345. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1346. msm_routing_put_audio_mixer),
  1347. SOC_SINGLE_EXT("MultiMedia5", MSM_BACKEND_DAI_MI2S_RX,
  1348. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1349. msm_routing_put_audio_mixer),
  1350. SOC_SINGLE_EXT("MultiMedia6", MSM_BACKEND_DAI_MI2S_RX,
  1351. MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer,
  1352. msm_routing_put_audio_mixer),
  1353. SOC_SINGLE_EXT("MultiMedia7", MSM_BACKEND_DAI_MI2S_RX,
  1354. MSM_FRONTEND_DAI_MULTIMEDIA7, 1, 0, msm_routing_get_audio_mixer,
  1355. msm_routing_put_audio_mixer),
  1356. SOC_SINGLE_EXT("MultiMedia8", MSM_BACKEND_DAI_MI2S_RX,
  1357. MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer,
  1358. msm_routing_put_audio_mixer),
  1359. };
  1360. static const struct snd_kcontrol_new hdmi_mixer_controls[] = {
  1361. SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_HDMI_RX,
  1362. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1363. msm_routing_put_audio_mixer),
  1364. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_HDMI_RX,
  1365. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1366. msm_routing_put_audio_mixer),
  1367. SOC_SINGLE_EXT("MultiMedia3", MSM_BACKEND_DAI_HDMI_RX,
  1368. MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer,
  1369. msm_routing_put_audio_mixer),
  1370. SOC_SINGLE_EXT("MultiMedia4", MSM_BACKEND_DAI_HDMI_RX,
  1371. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1372. msm_routing_put_audio_mixer),
  1373. SOC_SINGLE_EXT("MultiMedia5", MSM_BACKEND_DAI_HDMI_RX,
  1374. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1375. msm_routing_put_audio_mixer),
  1376. SOC_SINGLE_EXT("MultiMedia6", MSM_BACKEND_DAI_HDMI_RX,
  1377. MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer,
  1378. msm_routing_put_audio_mixer),
  1379. SOC_SINGLE_EXT("MultiMedia7", MSM_BACKEND_DAI_HDMI_RX,
  1380. MSM_FRONTEND_DAI_MULTIMEDIA7, 1, 0, msm_routing_get_audio_mixer,
  1381. msm_routing_put_audio_mixer),
  1382. SOC_SINGLE_EXT("MultiMedia8", MSM_BACKEND_DAI_HDMI_RX,
  1383. MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer,
  1384. msm_routing_put_audio_mixer),
  1385. SOC_SINGLE_EXT("Pseudo", MSM_BACKEND_DAI_HDMI_RX,
  1386. MSM_FRONTEND_DAI_PSEUDO, 1, 0, msm_routing_get_audio_mixer,
  1387. msm_routing_put_audio_mixer),
  1388. };
  1389. static const struct snd_kcontrol_new pseudo_mixer_controls[] = {
  1390. SOC_SINGLE_EXT("MultiMedia4", MSM_BACKEND_DAI_PSEUDO_PORT,
  1391. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1392. msm_routing_put_audio_mixer),
  1393. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_PSEUDO_PORT,
  1394. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1395. msm_routing_put_audio_mixer),
  1396. };
  1397. /* incall music delivery mixer */
  1398. static const struct snd_kcontrol_new incall_music_delivery_mixer_controls[] = {
  1399. SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_VOICE_PLAYBACK_TX,
  1400. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1401. msm_routing_put_audio_mixer),
  1402. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_VOICE_PLAYBACK_TX,
  1403. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1404. msm_routing_put_audio_mixer),
  1405. };
  1406. static const struct snd_kcontrol_new slimbus_4_rx_mixer_controls[] = {
  1407. SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_SLIMBUS_4_RX,
  1408. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1409. msm_routing_put_audio_mixer),
  1410. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_SLIMBUS_4_RX,
  1411. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1412. msm_routing_put_audio_mixer),
  1413. };
  1414. static const struct snd_kcontrol_new int_bt_sco_rx_mixer_controls[] = {
  1415. SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_INT_BT_SCO_RX,
  1416. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1417. msm_routing_put_audio_mixer),
  1418. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_INT_BT_SCO_RX,
  1419. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1420. msm_routing_put_audio_mixer),
  1421. SOC_SINGLE_EXT("MultiMedia3", MSM_BACKEND_DAI_INT_BT_SCO_RX,
  1422. MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer,
  1423. msm_routing_put_audio_mixer),
  1424. SOC_SINGLE_EXT("MultiMedia4", MSM_BACKEND_DAI_INT_BT_SCO_RX,
  1425. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1426. msm_routing_put_audio_mixer),
  1427. SOC_SINGLE_EXT("MultiMedia5", MSM_BACKEND_DAI_INT_BT_SCO_RX,
  1428. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1429. msm_routing_put_audio_mixer),
  1430. SOC_SINGLE_EXT("MultiMedia6", MSM_BACKEND_DAI_INT_BT_SCO_RX,
  1431. MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer,
  1432. msm_routing_put_audio_mixer),
  1433. };
  1434. static const struct snd_kcontrol_new int_fm_rx_mixer_controls[] = {
  1435. SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_INT_FM_RX,
  1436. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1437. msm_routing_put_audio_mixer),
  1438. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_INT_FM_RX,
  1439. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1440. msm_routing_put_audio_mixer),
  1441. SOC_SINGLE_EXT("MultiMedia3", MSM_BACKEND_DAI_INT_FM_RX,
  1442. MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer,
  1443. msm_routing_put_audio_mixer),
  1444. SOC_SINGLE_EXT("MultiMedia4", MSM_BACKEND_DAI_INT_FM_RX,
  1445. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1446. msm_routing_put_audio_mixer),
  1447. SOC_SINGLE_EXT("MultiMedia5", MSM_BACKEND_DAI_INT_FM_RX,
  1448. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1449. msm_routing_put_audio_mixer),
  1450. };
  1451. static const struct snd_kcontrol_new afe_pcm_rx_mixer_controls[] = {
  1452. SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_AFE_PCM_RX,
  1453. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1454. msm_routing_put_audio_mixer),
  1455. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_AFE_PCM_RX,
  1456. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1457. msm_routing_put_audio_mixer),
  1458. SOC_SINGLE_EXT("MultiMedia3", MSM_BACKEND_DAI_AFE_PCM_RX,
  1459. MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer,
  1460. msm_routing_put_audio_mixer),
  1461. SOC_SINGLE_EXT("MultiMedia4", MSM_BACKEND_DAI_AFE_PCM_RX,
  1462. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1463. msm_routing_put_audio_mixer),
  1464. SOC_SINGLE_EXT("MultiMedia5", MSM_BACKEND_DAI_AFE_PCM_RX,
  1465. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1466. msm_routing_put_audio_mixer),
  1467. SOC_SINGLE_EXT("MultiMedia6", MSM_BACKEND_DAI_AFE_PCM_RX,
  1468. MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer,
  1469. msm_routing_put_audio_mixer),
  1470. };
  1471. static const struct snd_kcontrol_new auxpcm_rx_mixer_controls[] = {
  1472. SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_AUXPCM_RX,
  1473. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1474. msm_routing_put_audio_mixer),
  1475. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_AUXPCM_RX,
  1476. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1477. msm_routing_put_audio_mixer),
  1478. SOC_SINGLE_EXT("MultiMedia3", MSM_BACKEND_DAI_AUXPCM_RX,
  1479. MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer,
  1480. msm_routing_put_audio_mixer),
  1481. SOC_SINGLE_EXT("MultiMedia4", MSM_BACKEND_DAI_AUXPCM_RX,
  1482. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1483. msm_routing_put_audio_mixer),
  1484. SOC_SINGLE_EXT("MultiMedia5", MSM_BACKEND_DAI_AUXPCM_RX,
  1485. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1486. msm_routing_put_audio_mixer),
  1487. SOC_SINGLE_EXT("MultiMedia6", MSM_BACKEND_DAI_AUXPCM_RX,
  1488. MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer,
  1489. msm_routing_put_audio_mixer),
  1490. };
  1491. static const struct snd_kcontrol_new sec_auxpcm_rx_mixer_controls[] = {
  1492. SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_SEC_AUXPCM_RX,
  1493. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1494. msm_routing_put_audio_mixer),
  1495. SOC_SINGLE_EXT("MultiMedia2", MSM_BACKEND_DAI_SEC_AUXPCM_RX,
  1496. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1497. msm_routing_put_audio_mixer),
  1498. };
  1499. static const struct snd_kcontrol_new mmul1_mixer_controls[] = {
  1500. SOC_SINGLE_EXT("PRI_TX", MSM_BACKEND_DAI_PRI_I2S_TX,
  1501. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1502. msm_routing_put_audio_mixer),
  1503. SOC_SINGLE_EXT("SEC_TX", MSM_BACKEND_DAI_SEC_I2S_TX,
  1504. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1505. msm_routing_put_audio_mixer),
  1506. SOC_SINGLE_EXT("MI2S_TX", MSM_BACKEND_DAI_MI2S_TX,
  1507. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1508. msm_routing_put_audio_mixer),
  1509. SOC_SINGLE_EXT("SLIM_0_TX", MSM_BACKEND_DAI_SLIMBUS_0_TX,
  1510. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1511. msm_routing_put_audio_mixer),
  1512. SOC_SINGLE_EXT("AUX_PCM_UL_TX", MSM_BACKEND_DAI_AUXPCM_TX,
  1513. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1514. msm_routing_put_audio_mixer),
  1515. SOC_SINGLE_EXT("SEC_AUX_PCM_UL_TX", MSM_BACKEND_DAI_SEC_AUXPCM_TX,
  1516. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1517. msm_routing_put_audio_mixer),
  1518. SOC_SINGLE_EXT("INTERNAL_BT_SCO_TX", MSM_BACKEND_DAI_INT_BT_SCO_TX,
  1519. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1520. msm_routing_put_audio_mixer),
  1521. SOC_SINGLE_EXT("INTERNAL_FM_TX", MSM_BACKEND_DAI_INT_FM_TX,
  1522. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1523. msm_routing_put_audio_mixer),
  1524. SOC_SINGLE_EXT("AFE_PCM_TX", MSM_BACKEND_DAI_AFE_PCM_TX,
  1525. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1526. msm_routing_put_audio_mixer),
  1527. SOC_SINGLE_EXT("VOC_REC_DL", MSM_BACKEND_DAI_INCALL_RECORD_RX,
  1528. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1529. msm_routing_put_audio_mixer),
  1530. SOC_SINGLE_EXT("VOC_REC_UL", MSM_BACKEND_DAI_INCALL_RECORD_TX,
  1531. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1532. msm_routing_put_audio_mixer),
  1533. SOC_SINGLE_EXT("SLIM_4_TX", MSM_BACKEND_DAI_SLIMBUS_4_TX,
  1534. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
  1535. msm_routing_put_audio_mixer),
  1536. };
  1537. static const struct snd_kcontrol_new mmul2_mixer_controls[] = {
  1538. SOC_SINGLE_EXT("INTERNAL_FM_TX", MSM_BACKEND_DAI_INT_FM_TX,
  1539. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1540. msm_routing_put_audio_mixer),
  1541. SOC_SINGLE_EXT("MI2S_TX", MSM_BACKEND_DAI_MI2S_TX,
  1542. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
  1543. msm_routing_put_audio_mixer),
  1544. };
  1545. static const struct snd_kcontrol_new mmul5_mixer_controls[] = {
  1546. SOC_SINGLE_EXT("SLIM_0_TX", MSM_BACKEND_DAI_SLIMBUS_0_TX,
  1547. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1548. msm_routing_put_audio_mixer),
  1549. SOC_SINGLE_EXT("INTERNAL_FM_TX", MSM_BACKEND_DAI_INT_FM_TX,
  1550. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1551. msm_routing_put_audio_mixer),
  1552. SOC_SINGLE_EXT("MI2S_TX", MSM_BACKEND_DAI_MI2S_TX,
  1553. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1554. msm_routing_put_audio_mixer),
  1555. SOC_SINGLE_EXT("AFE_PCM_TX", MSM_BACKEND_DAI_AFE_PCM_TX,
  1556. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1557. msm_routing_put_audio_mixer),
  1558. SOC_SINGLE_EXT("INTERNAL_BT_SCO_TX", MSM_BACKEND_DAI_INT_BT_SCO_TX,
  1559. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1560. msm_routing_put_audio_mixer),
  1561. SOC_SINGLE_EXT("AUX_PCM_TX", MSM_BACKEND_DAI_AUXPCM_TX,
  1562. MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
  1563. msm_routing_put_audio_mixer),
  1564. };
  1565. static const struct snd_kcontrol_new mmul4_mixer_controls[] = {
  1566. SOC_SINGLE_EXT("MI2S_TX", MSM_BACKEND_DAI_MI2S_TX,
  1567. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1568. msm_routing_put_audio_mixer),
  1569. SOC_SINGLE_EXT("SLIM_0_TX", MSM_BACKEND_DAI_SLIMBUS_0_TX,
  1570. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1571. msm_routing_put_audio_mixer),
  1572. SOC_SINGLE_EXT("VOC_REC_DL", MSM_BACKEND_DAI_INCALL_RECORD_RX,
  1573. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1574. msm_routing_put_audio_mixer),
  1575. SOC_SINGLE_EXT("VOC_REC_UL", MSM_BACKEND_DAI_INCALL_RECORD_TX,
  1576. MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
  1577. msm_routing_put_audio_mixer),
  1578. };
  1579. static const struct snd_kcontrol_new mmul6_mixer_controls[] = {
  1580. SOC_SINGLE_EXT("INTERNAL_FM_TX", MSM_BACKEND_DAI_INT_FM_TX,
  1581. MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer,
  1582. msm_routing_put_audio_mixer),
  1583. };
  1584. static const struct snd_kcontrol_new pri_rx_voice_mixer_controls[] = {
  1585. SOC_SINGLE_EXT("CSVoice", MSM_BACKEND_DAI_PRI_I2S_RX,
  1586. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1587. msm_routing_put_voice_mixer),
  1588. SOC_SINGLE_EXT("Voip", MSM_BACKEND_DAI_PRI_I2S_RX,
  1589. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1590. msm_routing_put_voice_mixer),
  1591. SOC_SINGLE_EXT("VoLTE", MSM_BACKEND_DAI_PRI_I2S_RX,
  1592. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1593. msm_routing_put_voice_mixer),
  1594. SOC_SINGLE_EXT("Voice2", MSM_BACKEND_DAI_PRI_I2S_RX,
  1595. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1596. msm_routing_put_voice_mixer),
  1597. SOC_SINGLE_EXT("Voice Stub", MSM_BACKEND_DAI_PRI_I2S_RX,
  1598. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1599. msm_routing_put_voice_stub_mixer),
  1600. SOC_SINGLE_EXT("VoLTE Stub", MSM_BACKEND_DAI_PRI_I2S_RX,
  1601. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1602. msm_routing_put_voice_stub_mixer),
  1603. SOC_SINGLE_EXT("Voice2 Stub", MSM_BACKEND_DAI_PRI_I2S_RX,
  1604. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1605. msm_routing_put_voice_stub_mixer),
  1606. SOC_SINGLE_EXT("DTMF", MSM_BACKEND_DAI_PRI_I2S_RX,
  1607. MSM_FRONTEND_DAI_DTMF_RX, 1, 0, msm_routing_get_voice_mixer,
  1608. msm_routing_put_voice_mixer),
  1609. };
  1610. static const struct snd_kcontrol_new sec_i2s_rx_voice_mixer_controls[] = {
  1611. SOC_SINGLE_EXT("CSVoice", MSM_BACKEND_DAI_SEC_I2S_RX,
  1612. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1613. msm_routing_put_voice_mixer),
  1614. SOC_SINGLE_EXT("Voip", MSM_BACKEND_DAI_SEC_I2S_RX,
  1615. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1616. msm_routing_put_voice_mixer),
  1617. SOC_SINGLE_EXT("VoLTE", MSM_BACKEND_DAI_SEC_I2S_RX,
  1618. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1619. msm_routing_put_voice_mixer),
  1620. SOC_SINGLE_EXT("Voice2", MSM_BACKEND_DAI_SEC_I2S_RX,
  1621. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1622. msm_routing_put_voice_mixer),
  1623. SOC_SINGLE_EXT("DTMF", MSM_BACKEND_DAI_SEC_I2S_RX,
  1624. MSM_FRONTEND_DAI_DTMF_RX, 1, 0, msm_routing_get_voice_mixer,
  1625. msm_routing_put_voice_mixer),
  1626. };
  1627. static const struct snd_kcontrol_new slimbus_rx_voice_mixer_controls[] = {
  1628. SOC_SINGLE_EXT("CSVoice", MSM_BACKEND_DAI_SLIMBUS_0_RX,
  1629. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1630. msm_routing_put_voice_mixer),
  1631. SOC_SINGLE_EXT("Voip", MSM_BACKEND_DAI_SLIMBUS_0_RX ,
  1632. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1633. msm_routing_put_voice_mixer),
  1634. SOC_SINGLE_EXT("VoLTE", MSM_BACKEND_DAI_SLIMBUS_0_RX ,
  1635. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1636. msm_routing_put_voice_mixer),
  1637. SOC_SINGLE_EXT("Voice2", MSM_BACKEND_DAI_SLIMBUS_0_RX ,
  1638. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1639. msm_routing_put_voice_mixer),
  1640. SOC_SINGLE_EXT("DTMF", MSM_BACKEND_DAI_SLIMBUS_0_RX ,
  1641. MSM_FRONTEND_DAI_DTMF_RX, 1, 0, msm_routing_get_voice_mixer,
  1642. msm_routing_put_voice_mixer),
  1643. };
  1644. static const struct snd_kcontrol_new bt_sco_rx_voice_mixer_controls[] = {
  1645. SOC_SINGLE_EXT("CSVoice", MSM_BACKEND_DAI_INT_BT_SCO_RX,
  1646. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1647. msm_routing_put_voice_mixer),
  1648. SOC_SINGLE_EXT("Voip", MSM_BACKEND_DAI_INT_BT_SCO_RX ,
  1649. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1650. msm_routing_put_voice_mixer),
  1651. SOC_SINGLE_EXT("Voice Stub", MSM_BACKEND_DAI_INT_BT_SCO_RX,
  1652. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1653. msm_routing_put_voice_stub_mixer),
  1654. SOC_SINGLE_EXT("VoLTE Stub", MSM_BACKEND_DAI_INT_BT_SCO_RX,
  1655. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1656. msm_routing_put_voice_stub_mixer),
  1657. SOC_SINGLE_EXT("Voice2 Stub", MSM_BACKEND_DAI_INT_BT_SCO_RX,
  1658. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1659. msm_routing_put_voice_stub_mixer),
  1660. SOC_SINGLE_EXT("VoLTE", MSM_BACKEND_DAI_INT_BT_SCO_RX ,
  1661. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1662. msm_routing_put_voice_mixer),
  1663. SOC_SINGLE_EXT("Voice2", MSM_BACKEND_DAI_INT_BT_SCO_RX ,
  1664. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1665. msm_routing_put_voice_mixer),
  1666. SOC_SINGLE_EXT("DTMF", MSM_BACKEND_DAI_INT_BT_SCO_RX ,
  1667. MSM_FRONTEND_DAI_DTMF_RX, 1, 0, msm_routing_get_voice_mixer,
  1668. msm_routing_put_voice_mixer),
  1669. };
  1670. static const struct snd_kcontrol_new mi2s_rx_voice_mixer_controls[] = {
  1671. SOC_SINGLE_EXT("CSVoice", MSM_BACKEND_DAI_MI2S_RX,
  1672. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1673. msm_routing_put_voice_mixer),
  1674. SOC_SINGLE_EXT("Voip", MSM_BACKEND_DAI_MI2S_RX,
  1675. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1676. msm_routing_put_voice_mixer),
  1677. SOC_SINGLE_EXT("Voice Stub", MSM_BACKEND_DAI_MI2S_RX,
  1678. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1679. msm_routing_put_voice_stub_mixer),
  1680. SOC_SINGLE_EXT("VoLTE Stub", MSM_BACKEND_DAI_MI2S_RX,
  1681. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1682. msm_routing_put_voice_stub_mixer),
  1683. SOC_SINGLE_EXT("Voice2 Stub", MSM_BACKEND_DAI_MI2S_RX,
  1684. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1685. msm_routing_put_voice_stub_mixer),
  1686. SOC_SINGLE_EXT("Voice2", MSM_BACKEND_DAI_MI2S_RX,
  1687. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1688. msm_routing_put_voice_mixer),
  1689. SOC_SINGLE_EXT("DTMF", MSM_BACKEND_DAI_MI2S_RX,
  1690. MSM_FRONTEND_DAI_DTMF_RX, 1, 0, msm_routing_get_voice_mixer,
  1691. msm_routing_put_voice_mixer),
  1692. };
  1693. static const struct snd_kcontrol_new afe_pcm_rx_voice_mixer_controls[] = {
  1694. SOC_SINGLE_EXT("CSVoice", MSM_BACKEND_DAI_AFE_PCM_RX,
  1695. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1696. msm_routing_put_voice_mixer),
  1697. SOC_SINGLE_EXT("Voip", MSM_BACKEND_DAI_AFE_PCM_RX,
  1698. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1699. msm_routing_put_voice_mixer),
  1700. SOC_SINGLE_EXT("Voice Stub", MSM_BACKEND_DAI_AFE_PCM_RX,
  1701. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1702. msm_routing_put_voice_stub_mixer),
  1703. SOC_SINGLE_EXT("VoLTE Stub", MSM_BACKEND_DAI_AFE_PCM_RX,
  1704. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1705. msm_routing_put_voice_stub_mixer),
  1706. SOC_SINGLE_EXT("Voice2 Stub", MSM_BACKEND_DAI_AFE_PCM_RX,
  1707. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1708. msm_routing_put_voice_stub_mixer),
  1709. SOC_SINGLE_EXT("VoLTE", MSM_BACKEND_DAI_AFE_PCM_RX,
  1710. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1711. msm_routing_put_voice_mixer),
  1712. SOC_SINGLE_EXT("Voice2", MSM_BACKEND_DAI_AFE_PCM_RX,
  1713. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1714. msm_routing_put_voice_mixer),
  1715. SOC_SINGLE_EXT("DTMF", MSM_BACKEND_DAI_AFE_PCM_RX,
  1716. MSM_FRONTEND_DAI_DTMF_RX, 1, 0, msm_routing_get_voice_mixer,
  1717. msm_routing_put_voice_mixer),
  1718. };
  1719. static const struct snd_kcontrol_new aux_pcm_rx_voice_mixer_controls[] = {
  1720. SOC_SINGLE_EXT("CSVoice", MSM_BACKEND_DAI_AUXPCM_RX,
  1721. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1722. msm_routing_put_voice_mixer),
  1723. SOC_SINGLE_EXT("Voip", MSM_BACKEND_DAI_AUXPCM_RX,
  1724. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1725. msm_routing_put_voice_mixer),
  1726. SOC_SINGLE_EXT("Voice Stub", MSM_BACKEND_DAI_AUXPCM_RX,
  1727. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1728. msm_routing_put_voice_stub_mixer),
  1729. SOC_SINGLE_EXT("VoLTE Stub", MSM_BACKEND_DAI_AUXPCM_RX,
  1730. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1731. msm_routing_put_voice_stub_mixer),
  1732. SOC_SINGLE_EXT("Voice2 Stub", MSM_BACKEND_DAI_AUXPCM_RX,
  1733. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1734. msm_routing_put_voice_stub_mixer),
  1735. SOC_SINGLE_EXT("VoLTE", MSM_BACKEND_DAI_AUXPCM_RX,
  1736. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1737. msm_routing_put_voice_mixer),
  1738. SOC_SINGLE_EXT("Voice2", MSM_BACKEND_DAI_AUXPCM_RX,
  1739. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1740. msm_routing_put_voice_mixer),
  1741. SOC_SINGLE_EXT("DTMF", MSM_BACKEND_DAI_AUXPCM_RX,
  1742. MSM_FRONTEND_DAI_DTMF_RX, 1, 0, msm_routing_get_voice_mixer,
  1743. msm_routing_put_voice_mixer),
  1744. };
  1745. static const struct snd_kcontrol_new sec_aux_pcm_rx_voice_mixer_controls[] = {
  1746. SOC_SINGLE_EXT("CSVoice", MSM_BACKEND_DAI_SEC_AUXPCM_RX,
  1747. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1748. msm_routing_put_voice_mixer),
  1749. SOC_SINGLE_EXT("Voip", MSM_BACKEND_DAI_SEC_AUXPCM_RX,
  1750. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1751. msm_routing_put_voice_mixer),
  1752. SOC_SINGLE_EXT("VoLTE", MSM_BACKEND_DAI_SEC_AUXPCM_RX,
  1753. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1754. msm_routing_put_voice_mixer),
  1755. SOC_SINGLE_EXT("Voice2", MSM_BACKEND_DAI_SEC_AUXPCM_RX,
  1756. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1757. msm_routing_put_voice_mixer),
  1758. SOC_SINGLE_EXT("DTMF", MSM_BACKEND_DAI_SEC_AUXPCM_RX,
  1759. MSM_FRONTEND_DAI_DTMF_RX, 1, 0, msm_routing_get_voice_mixer,
  1760. msm_routing_put_voice_mixer),
  1761. };
  1762. static const struct snd_kcontrol_new hdmi_rx_voice_mixer_controls[] = {
  1763. SOC_SINGLE_EXT("CSVoice", MSM_BACKEND_DAI_HDMI_RX,
  1764. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1765. msm_routing_put_voice_mixer),
  1766. SOC_SINGLE_EXT("Voip", MSM_BACKEND_DAI_HDMI_RX,
  1767. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1768. msm_routing_put_voice_mixer),
  1769. SOC_SINGLE_EXT("VoLTE", MSM_BACKEND_DAI_HDMI_RX,
  1770. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1771. msm_routing_put_voice_mixer),
  1772. SOC_SINGLE_EXT("Voice Stub", MSM_BACKEND_DAI_HDMI_RX,
  1773. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1774. msm_routing_put_voice_stub_mixer),
  1775. SOC_SINGLE_EXT("VoLTE Stub", MSM_BACKEND_DAI_HDMI_RX,
  1776. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1777. msm_routing_put_voice_stub_mixer),
  1778. SOC_SINGLE_EXT("Voice2 Stub", MSM_BACKEND_DAI_HDMI_RX,
  1779. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1780. msm_routing_put_voice_stub_mixer),
  1781. SOC_SINGLE_EXT("Voice2", MSM_BACKEND_DAI_HDMI_RX,
  1782. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1783. msm_routing_put_voice_mixer),
  1784. SOC_SINGLE_EXT("DTMF", MSM_BACKEND_DAI_HDMI_RX,
  1785. MSM_FRONTEND_DAI_DTMF_RX, 1, 0, msm_routing_get_voice_mixer,
  1786. msm_routing_put_voice_mixer),
  1787. };
  1788. static const struct snd_kcontrol_new stub_rx_mixer_controls[] = {
  1789. SOC_SINGLE_EXT("Voice Stub", MSM_BACKEND_DAI_EXTPROC_RX,
  1790. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1791. msm_routing_put_voice_stub_mixer),
  1792. SOC_SINGLE_EXT("VoLTE Stub", MSM_BACKEND_DAI_EXTPROC_RX,
  1793. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1794. msm_routing_put_voice_stub_mixer),
  1795. SOC_SINGLE_EXT("Voice2 Stub", MSM_BACKEND_DAI_EXTPROC_RX,
  1796. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1797. msm_routing_put_voice_stub_mixer),
  1798. };
  1799. static const struct snd_kcontrol_new slimbus_1_rx_mixer_controls[] = {
  1800. SOC_SINGLE_EXT("Voice Stub", MSM_BACKEND_DAI_SLIMBUS_1_RX,
  1801. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1802. msm_routing_put_voice_stub_mixer),
  1803. SOC_SINGLE_EXT("VoLTE Stub", MSM_BACKEND_DAI_SLIMBUS_1_RX,
  1804. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1805. msm_routing_put_voice_stub_mixer),
  1806. SOC_SINGLE_EXT("Voice2 Stub", MSM_BACKEND_DAI_SLIMBUS_1_RX,
  1807. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1808. msm_routing_put_voice_stub_mixer),
  1809. };
  1810. static const struct snd_kcontrol_new slimbus_3_rx_mixer_controls[] = {
  1811. SOC_SINGLE_EXT("Voice Stub", MSM_BACKEND_DAI_SLIMBUS_3_RX,
  1812. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1813. msm_routing_put_voice_stub_mixer),
  1814. SOC_SINGLE_EXT("VoLTE Stub", MSM_BACKEND_DAI_SLIMBUS_3_RX,
  1815. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1816. msm_routing_put_voice_stub_mixer),
  1817. SOC_SINGLE_EXT("Voice2 Stub", MSM_BACKEND_DAI_SLIMBUS_3_RX,
  1818. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1819. msm_routing_put_voice_stub_mixer),
  1820. };
  1821. static const struct snd_kcontrol_new tx_voice_mixer_controls[] = {
  1822. SOC_SINGLE_EXT("PRI_TX_Voice", MSM_BACKEND_DAI_PRI_I2S_TX,
  1823. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1824. msm_routing_put_voice_mixer),
  1825. SOC_SINGLE_EXT("SEC_TX_Voice", MSM_BACKEND_DAI_SEC_I2S_TX,
  1826. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1827. msm_routing_put_voice_mixer),
  1828. SOC_SINGLE_EXT("MI2S_TX_Voice", MSM_BACKEND_DAI_MI2S_TX,
  1829. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1830. msm_routing_put_voice_mixer),
  1831. SOC_SINGLE_EXT("SLIM_0_TX_Voice", MSM_BACKEND_DAI_SLIMBUS_0_TX,
  1832. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1833. msm_routing_put_voice_mixer),
  1834. SOC_SINGLE_EXT("INTERNAL_BT_SCO_TX_Voice",
  1835. MSM_BACKEND_DAI_INT_BT_SCO_TX, MSM_FRONTEND_DAI_CS_VOICE, 1, 0,
  1836. msm_routing_get_voice_mixer, msm_routing_put_voice_mixer),
  1837. SOC_SINGLE_EXT("AFE_PCM_TX_Voice", MSM_BACKEND_DAI_AFE_PCM_TX,
  1838. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1839. msm_routing_put_voice_mixer),
  1840. SOC_SINGLE_EXT("AUX_PCM_TX_Voice", MSM_BACKEND_DAI_AUXPCM_TX,
  1841. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1842. msm_routing_put_voice_mixer),
  1843. SOC_SINGLE_EXT("SEC_AUX_PCM_TX_Voice", MSM_BACKEND_DAI_SEC_AUXPCM_TX,
  1844. MSM_FRONTEND_DAI_CS_VOICE, 1, 0, msm_routing_get_voice_mixer,
  1845. msm_routing_put_voice_mixer),
  1846. };
  1847. static const struct snd_kcontrol_new tx_volte_mixer_controls[] = {
  1848. SOC_SINGLE_EXT("PRI_TX_VoLTE", MSM_BACKEND_DAI_PRI_I2S_TX,
  1849. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1850. msm_routing_put_voice_mixer),
  1851. SOC_SINGLE_EXT("SEC_TX_VoLTE", MSM_BACKEND_DAI_SEC_I2S_TX,
  1852. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1853. msm_routing_put_voice_mixer),
  1854. SOC_SINGLE_EXT("SLIM_0_TX_VoLTE", MSM_BACKEND_DAI_SLIMBUS_0_TX,
  1855. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1856. msm_routing_put_voice_mixer),
  1857. SOC_SINGLE_EXT("INTERNAL_BT_SCO_TX_VoLTE",
  1858. MSM_BACKEND_DAI_INT_BT_SCO_TX, MSM_FRONTEND_DAI_VOLTE, 1, 0,
  1859. msm_routing_get_voice_mixer, msm_routing_put_voice_mixer),
  1860. SOC_SINGLE_EXT("AFE_PCM_TX_VoLTE", MSM_BACKEND_DAI_AFE_PCM_TX,
  1861. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1862. msm_routing_put_voice_mixer),
  1863. SOC_SINGLE_EXT("AUX_PCM_TX_VoLTE", MSM_BACKEND_DAI_AUXPCM_TX,
  1864. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1865. msm_routing_put_voice_mixer),
  1866. SOC_SINGLE_EXT("SEC_AUX_PCM_TX_VoLTE", MSM_BACKEND_DAI_SEC_AUXPCM_TX,
  1867. MSM_FRONTEND_DAI_VOLTE, 1, 0, msm_routing_get_voice_mixer,
  1868. msm_routing_put_voice_mixer),
  1869. };
  1870. static const struct snd_kcontrol_new tx_voice2_mixer_controls[] = {
  1871. SOC_SINGLE_EXT("PRI_TX_Voice2", MSM_BACKEND_DAI_PRI_I2S_TX,
  1872. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1873. msm_routing_put_voice_mixer),
  1874. SOC_SINGLE_EXT("SEC_TX_Voice2", MSM_BACKEND_DAI_SEC_I2S_TX,
  1875. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1876. msm_routing_put_voice_mixer),
  1877. SOC_SINGLE_EXT("MI2S_TX_Voice2", MSM_BACKEND_DAI_MI2S_TX,
  1878. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1879. msm_routing_put_voice_mixer),
  1880. SOC_SINGLE_EXT("SLIM_0_TX_Voice2", MSM_BACKEND_DAI_SLIMBUS_0_TX,
  1881. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1882. msm_routing_put_voice_mixer),
  1883. SOC_SINGLE_EXT("INTERNAL_BT_SCO_TX_Voice2",
  1884. MSM_BACKEND_DAI_INT_BT_SCO_TX, MSM_FRONTEND_DAI_VOICE2, 1, 0,
  1885. msm_routing_get_voice_mixer, msm_routing_put_voice_mixer),
  1886. SOC_SINGLE_EXT("AFE_PCM_TX_Voice2", MSM_BACKEND_DAI_AFE_PCM_TX,
  1887. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1888. msm_routing_put_voice_mixer),
  1889. SOC_SINGLE_EXT("AUX_PCM_TX_Voice2", MSM_BACKEND_DAI_AUXPCM_TX,
  1890. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1891. msm_routing_put_voice_mixer),
  1892. SOC_SINGLE_EXT("SEC_AUX_PCM_TX_Voice2", MSM_BACKEND_DAI_SEC_AUXPCM_TX,
  1893. MSM_FRONTEND_DAI_VOICE2, 1, 0, msm_routing_get_voice_mixer,
  1894. msm_routing_put_voice_mixer),
  1895. };
  1896. static const struct snd_kcontrol_new tx_voip_mixer_controls[] = {
  1897. SOC_SINGLE_EXT("PRI_TX_Voip", MSM_BACKEND_DAI_PRI_I2S_TX,
  1898. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1899. msm_routing_put_voice_mixer),
  1900. SOC_SINGLE_EXT("SEC_TX_Voip", MSM_BACKEND_DAI_SEC_I2S_TX,
  1901. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1902. msm_routing_put_voice_mixer),
  1903. SOC_SINGLE_EXT("MI2S_TX_Voip", MSM_BACKEND_DAI_MI2S_TX,
  1904. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1905. msm_routing_put_voice_mixer),
  1906. SOC_SINGLE_EXT("SLIM_0_TX_Voip", MSM_BACKEND_DAI_SLIMBUS_0_TX,
  1907. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1908. msm_routing_put_voice_mixer),
  1909. SOC_SINGLE_EXT("INTERNAL_BT_SCO_TX_Voip", MSM_BACKEND_DAI_INT_BT_SCO_TX,
  1910. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1911. msm_routing_put_voice_mixer),
  1912. SOC_SINGLE_EXT("AFE_PCM_TX_Voip", MSM_BACKEND_DAI_AFE_PCM_TX,
  1913. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1914. msm_routing_put_voice_mixer),
  1915. SOC_SINGLE_EXT("AUX_PCM_TX_Voip", MSM_BACKEND_DAI_AUXPCM_TX,
  1916. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1917. msm_routing_put_voice_mixer),
  1918. SOC_SINGLE_EXT("SEC_AUX_PCM_TX_Voip", MSM_BACKEND_DAI_SEC_AUXPCM_TX,
  1919. MSM_FRONTEND_DAI_VOIP, 1, 0, msm_routing_get_voice_mixer,
  1920. msm_routing_put_voice_mixer),
  1921. };
  1922. static const struct snd_kcontrol_new tx_voice_stub_mixer_controls[] = {
  1923. SOC_SINGLE_EXT("STUB_TX_HL", MSM_BACKEND_DAI_EXTPROC_TX,
  1924. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1925. msm_routing_put_voice_stub_mixer),
  1926. SOC_SINGLE_EXT("INTERNAL_BT_SCO_TX", MSM_BACKEND_DAI_INT_BT_SCO_TX,
  1927. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1928. msm_routing_put_voice_stub_mixer),
  1929. SOC_SINGLE_EXT("SLIM_1_TX", MSM_BACKEND_DAI_SLIMBUS_1_TX,
  1930. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1931. msm_routing_put_voice_stub_mixer),
  1932. SOC_SINGLE_EXT("STUB_1_TX_HL", MSM_BACKEND_DAI_EXTPROC_EC_TX,
  1933. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1934. msm_routing_put_voice_stub_mixer),
  1935. SOC_SINGLE_EXT("MI2S_TX", MSM_BACKEND_DAI_MI2S_TX,
  1936. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1937. msm_routing_put_voice_stub_mixer),
  1938. SOC_SINGLE_EXT("SLIM_3_TX", MSM_BACKEND_DAI_SLIMBUS_3_TX,
  1939. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1940. msm_routing_put_voice_stub_mixer),
  1941. SOC_SINGLE_EXT("PRIMARY_I2S_TX", MSM_BACKEND_DAI_PRI_I2S_TX,
  1942. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1943. msm_routing_put_voice_stub_mixer),
  1944. SOC_SINGLE_EXT("SECONDARY_I2S_TX", MSM_BACKEND_DAI_SEC_I2S_TX,
  1945. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1946. msm_routing_put_voice_stub_mixer),
  1947. SOC_SINGLE_EXT("AFE_PCM_TX", MSM_BACKEND_DAI_AFE_PCM_TX,
  1948. MSM_FRONTEND_DAI_VOICE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1949. msm_routing_put_voice_stub_mixer),
  1950. };
  1951. static const struct snd_kcontrol_new tx_volte_stub_mixer_controls[] = {
  1952. SOC_SINGLE_EXT("STUB_TX_HL", MSM_BACKEND_DAI_EXTPROC_TX,
  1953. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1954. msm_routing_put_voice_stub_mixer),
  1955. SOC_SINGLE_EXT("INTERNAL_BT_SCO_TX", MSM_BACKEND_DAI_INT_BT_SCO_TX,
  1956. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1957. msm_routing_put_voice_stub_mixer),
  1958. SOC_SINGLE_EXT("SLIM_1_TX", MSM_BACKEND_DAI_SLIMBUS_1_TX,
  1959. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1960. msm_routing_put_voice_stub_mixer),
  1961. SOC_SINGLE_EXT("STUB_1_TX_HL", MSM_BACKEND_DAI_EXTPROC_EC_TX,
  1962. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1963. msm_routing_put_voice_stub_mixer),
  1964. SOC_SINGLE_EXT("MI2S_TX", MSM_BACKEND_DAI_MI2S_TX,
  1965. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1966. msm_routing_put_voice_stub_mixer),
  1967. SOC_SINGLE_EXT("SLIM_3_TX", MSM_BACKEND_DAI_SLIMBUS_3_TX,
  1968. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1969. msm_routing_put_voice_stub_mixer),
  1970. SOC_SINGLE_EXT("PRIMARY_I2S_TX", MSM_BACKEND_DAI_PRI_I2S_TX,
  1971. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1972. msm_routing_put_voice_stub_mixer),
  1973. SOC_SINGLE_EXT("SECONDARY_I2S_TX", MSM_BACKEND_DAI_SEC_I2S_TX,
  1974. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1975. msm_routing_put_voice_stub_mixer),
  1976. SOC_SINGLE_EXT("AFE_PCM_TX", MSM_BACKEND_DAI_AFE_PCM_TX,
  1977. MSM_FRONTEND_DAI_VOLTE_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1978. msm_routing_put_voice_stub_mixer),
  1979. };
  1980. static const struct snd_kcontrol_new tx_voice2_stub_mixer_controls[] = {
  1981. SOC_SINGLE_EXT("STUB_TX_HL", MSM_BACKEND_DAI_EXTPROC_TX,
  1982. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1983. msm_routing_put_voice_stub_mixer),
  1984. SOC_SINGLE_EXT("INTERNAL_BT_SCO_TX", MSM_BACKEND_DAI_INT_BT_SCO_TX,
  1985. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1986. msm_routing_put_voice_stub_mixer),
  1987. SOC_SINGLE_EXT("SLIM_1_TX", MSM_BACKEND_DAI_SLIMBUS_1_TX,
  1988. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1989. msm_routing_put_voice_stub_mixer),
  1990. SOC_SINGLE_EXT("STUB_1_TX_HL", MSM_BACKEND_DAI_EXTPROC_EC_TX,
  1991. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1992. msm_routing_put_voice_stub_mixer),
  1993. SOC_SINGLE_EXT("MI2S_TX", MSM_BACKEND_DAI_MI2S_TX,
  1994. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1995. msm_routing_put_voice_stub_mixer),
  1996. SOC_SINGLE_EXT("SLIM_3_TX", MSM_BACKEND_DAI_SLIMBUS_3_TX,
  1997. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  1998. msm_routing_put_voice_stub_mixer),
  1999. SOC_SINGLE_EXT("PRIMARY_I2S_TX", MSM_BACKEND_DAI_PRI_I2S_TX,
  2000. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  2001. msm_routing_put_voice_stub_mixer),
  2002. SOC_SINGLE_EXT("SECONDARY_I2S_TX", MSM_BACKEND_DAI_SEC_I2S_TX,
  2003. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  2004. msm_routing_put_voice_stub_mixer),
  2005. SOC_SINGLE_EXT("AFE_PCM_TX", MSM_BACKEND_DAI_AFE_PCM_TX,
  2006. MSM_FRONTEND_DAI_VOICE2_STUB, 1, 0, msm_routing_get_voice_stub_mixer,
  2007. msm_routing_put_voice_stub_mixer),
  2008. };
  2009. static const struct snd_kcontrol_new sbus_0_rx_port_mixer_controls[] = {
  2010. SOC_SINGLE_EXT("INTERNAL_FM_TX", MSM_BACKEND_DAI_SLIMBUS_0_RX,
  2011. MSM_BACKEND_DAI_INT_FM_TX, 1, 0, msm_routing_get_port_mixer,
  2012. msm_routing_put_port_mixer),
  2013. SOC_SINGLE_EXT("SLIM_0_TX", MSM_BACKEND_DAI_SLIMBUS_0_RX,
  2014. MSM_BACKEND_DAI_SLIMBUS_0_TX, 1, 0, msm_routing_get_port_mixer,
  2015. msm_routing_put_port_mixer),
  2016. SOC_SINGLE_EXT("AUX_PCM_UL_TX", MSM_BACKEND_DAI_SLIMBUS_0_RX,
  2017. MSM_BACKEND_DAI_AUXPCM_TX, 1, 0, msm_routing_get_port_mixer,
  2018. msm_routing_put_port_mixer),
  2019. SOC_SINGLE_EXT("MI2S_TX", MSM_BACKEND_DAI_SLIMBUS_0_RX,
  2020. MSM_BACKEND_DAI_MI2S_TX, 1, 0, msm_routing_get_port_mixer,
  2021. msm_routing_put_port_mixer),
  2022. };
  2023. static const struct snd_kcontrol_new auxpcm_rx_port_mixer_controls[] = {
  2024. SOC_SINGLE_EXT("AUX_PCM_UL_TX", MSM_BACKEND_DAI_AUXPCM_RX,
  2025. MSM_BACKEND_DAI_AUXPCM_TX, 1, 0, msm_routing_get_port_mixer,
  2026. msm_routing_put_port_mixer),
  2027. SOC_SINGLE_EXT("SLIM_0_TX", MSM_BACKEND_DAI_AUXPCM_RX,
  2028. MSM_BACKEND_DAI_SLIMBUS_0_TX, 1, 0, msm_routing_get_port_mixer,
  2029. msm_routing_put_port_mixer),
  2030. };
  2031. static const struct snd_kcontrol_new sbus_1_rx_port_mixer_controls[] = {
  2032. SOC_SINGLE_EXT("INTERNAL_BT_SCO_TX", MSM_BACKEND_DAI_SLIMBUS_1_RX,
  2033. MSM_BACKEND_DAI_INT_BT_SCO_TX, 1, 0, msm_routing_get_port_mixer,
  2034. msm_routing_put_port_mixer),
  2035. SOC_SINGLE_EXT("AFE_PCM_TX", MSM_BACKEND_DAI_SLIMBUS_1_RX,
  2036. MSM_BACKEND_DAI_AFE_PCM_TX, 1, 0, msm_routing_get_port_mixer,
  2037. msm_routing_put_port_mixer),
  2038. };
  2039. static const struct snd_kcontrol_new sbus_3_rx_port_mixer_controls[] = {
  2040. SOC_SINGLE_EXT("INTERNAL_BT_SCO_RX", MSM_BACKEND_DAI_SLIMBUS_3_RX,
  2041. MSM_BACKEND_DAI_INT_BT_SCO_RX, 1, 0, msm_routing_get_port_mixer,
  2042. msm_routing_put_port_mixer),
  2043. SOC_SINGLE_EXT("MI2S_TX", MSM_BACKEND_DAI_SLIMBUS_3_RX,
  2044. MSM_BACKEND_DAI_MI2S_TX, 1, 0, msm_routing_get_port_mixer,
  2045. msm_routing_put_port_mixer),
  2046. SOC_SINGLE_EXT("AFE_PCM_RX", MSM_BACKEND_DAI_SLIMBUS_3_RX,
  2047. MSM_BACKEND_DAI_AFE_PCM_RX, 1, 0, msm_routing_get_port_mixer,
  2048. msm_routing_put_port_mixer),
  2049. };
  2050. static const struct snd_kcontrol_new bt_sco_rx_port_mixer_controls[] = {
  2051. SOC_SINGLE_EXT("SLIM_1_TX", MSM_BACKEND_DAI_INT_BT_SCO_RX,
  2052. MSM_BACKEND_DAI_SLIMBUS_1_TX, 1, 0, msm_routing_get_port_mixer,
  2053. msm_routing_put_port_mixer),
  2054. };
  2055. static const struct snd_kcontrol_new afe_pcm_rx_port_mixer_controls[] = {
  2056. SOC_SINGLE_EXT("INTERNAL_FM_TX", MSM_BACKEND_DAI_AFE_PCM_RX,
  2057. MSM_BACKEND_DAI_INT_FM_TX, 1, 0, msm_routing_get_port_mixer,
  2058. msm_routing_put_port_mixer),
  2059. SOC_SINGLE_EXT("SLIM_1_TX", MSM_BACKEND_DAI_AFE_PCM_RX,
  2060. MSM_BACKEND_DAI_SLIMBUS_1_TX, 1, 0, msm_routing_get_port_mixer,
  2061. msm_routing_put_port_mixer),
  2062. };
  2063. static const struct snd_kcontrol_new hdmi_rx_port_mixer_controls[] = {
  2064. SOC_SINGLE_EXT("MI2S_TX", MSM_BACKEND_DAI_HDMI_RX,
  2065. MSM_BACKEND_DAI_MI2S_TX, 1, 0, msm_routing_get_port_mixer,
  2066. msm_routing_put_port_mixer),
  2067. SOC_SINGLE_EXT("SLIM_3_TX", MSM_BACKEND_DAI_HDMI_RX,
  2068. MSM_BACKEND_DAI_SLIMBUS_3_TX, 1, 0, msm_routing_get_port_mixer,
  2069. msm_routing_put_port_mixer),
  2070. };
  2071. static const struct snd_kcontrol_new pri_i2s_rx_port_mixer_controls[] = {
  2072. SOC_SINGLE_EXT("MI2S_TX", MSM_BACKEND_DAI_PRI_I2S_RX,
  2073. MSM_BACKEND_DAI_MI2S_TX, 1, 0, msm_routing_get_port_mixer,
  2074. msm_routing_put_port_mixer),
  2075. };
  2076. static const struct snd_kcontrol_new sec_i2s_rx_port_mixer_controls[] = {
  2077. SOC_SINGLE_EXT("MI2S_TX", MSM_BACKEND_DAI_SEC_I2S_RX,
  2078. MSM_BACKEND_DAI_MI2S_TX, 1, 0, msm_routing_get_port_mixer,
  2079. msm_routing_put_port_mixer),
  2080. };
  2081. static const struct snd_kcontrol_new mi2s_rx_port_mixer_controls[] = {
  2082. SOC_SINGLE_EXT("SLIM_1_TX", MSM_BACKEND_DAI_MI2S_RX,
  2083. MSM_BACKEND_DAI_SLIMBUS_1_TX, 1, 0, msm_routing_get_port_mixer,
  2084. msm_routing_put_port_mixer),
  2085. SOC_SINGLE_EXT("PRIMARY_I2S_TX", MSM_BACKEND_DAI_MI2S_RX,
  2086. MSM_BACKEND_DAI_PRI_I2S_TX, 1, 0, msm_routing_get_port_mixer,
  2087. msm_routing_put_port_mixer),
  2088. };
  2089. static const struct snd_kcontrol_new fm_switch_mixer_controls =
  2090. SOC_SINGLE_EXT("Switch", SND_SOC_NOPM,
  2091. 0, 1, 0, msm_routing_get_switch_mixer,
  2092. msm_routing_put_switch_mixer);
  2093. static const struct snd_kcontrol_new pcm_rx_switch_mixer_controls =
  2094. SOC_SINGLE_EXT("Switch", SND_SOC_NOPM,
  2095. 0, 1, 0, msm_routing_get_fm_pcmrx_switch_mixer,
  2096. msm_routing_put_fm_pcmrx_switch_mixer);
  2097. static const struct snd_kcontrol_new int_fm_vol_mixer_controls[] = {
  2098. SOC_SINGLE_EXT_TLV("Internal FM RX Volume", SND_SOC_NOPM, 0,
  2099. INT_RX_VOL_GAIN, 0, msm_routing_get_fm_vol_mixer,
  2100. msm_routing_set_fm_vol_mixer, fm_rx_vol_gain),
  2101. };
  2102. static const struct snd_kcontrol_new lpa_vol_mixer_controls[] = {
  2103. SOC_SINGLE_EXT_TLV("LPA RX Volume", SND_SOC_NOPM, 0,
  2104. INT_RX_VOL_GAIN, 0, msm_routing_get_lpa_vol_mixer,
  2105. msm_routing_set_lpa_vol_mixer, lpa_rx_vol_gain),
  2106. };
  2107. static const struct snd_kcontrol_new multimedia2_vol_mixer_controls[] = {
  2108. SOC_SINGLE_EXT_TLV("HIFI2 RX Volume", SND_SOC_NOPM, 0,
  2109. INT_RX_VOL_GAIN, 0, msm_routing_get_multimedia2_vol_mixer,
  2110. msm_routing_set_multimedia2_vol_mixer, multimedia2_rx_vol_gain),
  2111. };
  2112. static const struct snd_kcontrol_new multimedia5_vol_mixer_controls[] = {
  2113. SOC_SINGLE_EXT_TLV("HIFI3 RX Volume", SND_SOC_NOPM, 0,
  2114. INT_RX_VOL_GAIN, 0, msm_routing_get_multimedia5_vol_mixer,
  2115. msm_routing_set_multimedia5_vol_mixer, multimedia5_rx_vol_gain),
  2116. };
  2117. static const struct snd_kcontrol_new multimedia3_vol_mixer_controls[] = {
  2118. SOC_SINGLE_EXT_TLV("HIFI4 RX Volume", SND_SOC_NOPM, 0,
  2119. INT_RX_VOL_GAIN, 0, msm_routing_get_multimedia3_vol_mixer,
  2120. msm_routing_set_multimedia3_vol_mixer, multimedia3_rx_vol_gain),
  2121. };
  2122. static const struct snd_kcontrol_new compressed_vol_mixer_controls[] = {
  2123. SOC_SINGLE_EXT_TLV("COMPRESSED RX Volume", SND_SOC_NOPM, 0,
  2124. INT_RX_VOL_GAIN, 0, msm_routing_get_compressed_vol_mixer,
  2125. msm_routing_set_compressed_vol_mixer, compressed_rx_vol_gain),
  2126. };
  2127. static const struct snd_kcontrol_new compressed2_vol_mixer_controls[] = {
  2128. SOC_SINGLE_EXT_TLV("COMPRESSED2 RX Volume", SND_SOC_NOPM, 0,
  2129. INT_RX_VOL_GAIN, 0, msm_routing_get_compressed2_vol_mixer,
  2130. msm_routing_set_compressed2_vol_mixer, compressed2_rx_vol_gain),
  2131. };
  2132. static const struct snd_kcontrol_new compressed3_vol_mixer_controls[] = {
  2133. SOC_SINGLE_EXT_TLV("COMPRESSED3 RX Volume", SND_SOC_NOPM, 0,
  2134. INT_RX_VOL_GAIN, 0, msm_routing_get_compressed3_vol_mixer,
  2135. msm_routing_set_compressed3_vol_mixer, compressed3_rx_vol_gain),
  2136. };
  2137. static const struct snd_kcontrol_new lpa_SRS_trumedia_controls[] = {
  2138. {.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  2139. .name = "SRS TruMedia",
  2140. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |
  2141. SNDRV_CTL_ELEM_ACCESS_READWRITE,
  2142. .info = snd_soc_info_volsw, \
  2143. .get = msm_routing_get_srs_trumedia_control,
  2144. .put = msm_routing_set_srs_trumedia_control,
  2145. .private_value = ((unsigned long)&(struct soc_mixer_control)
  2146. {.reg = SND_SOC_NOPM,
  2147. .rreg = SND_SOC_NOPM,
  2148. .shift = 0,
  2149. .rshift = 0,
  2150. .max = 0xFFFFFFFF,
  2151. .platform_max = 0xFFFFFFFF,
  2152. .invert = 0
  2153. })
  2154. }
  2155. };
  2156. static const struct snd_kcontrol_new lpa_SRS_trumedia_controls_HDMI[] = {
  2157. {.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  2158. .name = "SRS TruMedia HDMI",
  2159. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |
  2160. SNDRV_CTL_ELEM_ACCESS_READWRITE,
  2161. .info = snd_soc_info_volsw, \
  2162. .get = msm_routing_get_srs_trumedia_control,
  2163. .put = msm_routing_set_srs_trumedia_control_HDMI,
  2164. .private_value = ((unsigned long)&(struct soc_mixer_control)
  2165. {.reg = SND_SOC_NOPM,
  2166. .rreg = SND_SOC_NOPM,
  2167. .shift = 0,
  2168. .rshift = 0,
  2169. .max = 0xFFFFFFFF,
  2170. .platform_max = 0xFFFFFFFF,
  2171. .invert = 0
  2172. })
  2173. }
  2174. };
  2175. static const struct snd_kcontrol_new lpa_SRS_trumedia_controls_I2S[] = {
  2176. {.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  2177. .name = "SRS TruMedia I2S",
  2178. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |
  2179. SNDRV_CTL_ELEM_ACCESS_READWRITE,
  2180. .info = snd_soc_info_volsw, \
  2181. .get = msm_routing_get_srs_trumedia_control,
  2182. .put = msm_routing_set_srs_trumedia_control_I2S,
  2183. .private_value = ((unsigned long)&(struct soc_mixer_control)
  2184. {.reg = SND_SOC_NOPM,
  2185. .rreg = SND_SOC_NOPM,
  2186. .shift = 0,
  2187. .rshift = 0,
  2188. .max = 0xFFFFFFFF,
  2189. .platform_max = 0xFFFFFFFF,
  2190. .invert = 0
  2191. })
  2192. }
  2193. };
  2194. static const struct snd_kcontrol_new lpa_SRS_SS3D_controls[] = {
  2195. {.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  2196. .name = "SRS SS3D",
  2197. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |
  2198. SNDRV_CTL_ELEM_ACCESS_READWRITE,
  2199. .info = snd_soc_info_volsw, \
  2200. .get = msm_routing_get_srs_SS3D_control,
  2201. .put = msm_routing_set_srs_SS3D_control,
  2202. .private_value = ((unsigned long)&(struct soc_mixer_control)
  2203. {.reg = SND_SOC_NOPM,
  2204. .rreg = SND_SOC_NOPM,
  2205. .shift = 0,
  2206. .rshift = 0,
  2207. .max = 0xFFFFFFFF,
  2208. .platform_max = 0xFFFFFFFF,
  2209. .invert = 0
  2210. })
  2211. }
  2212. };
  2213. static const struct snd_kcontrol_new lpa_SRS_SS3D_controls_HDMI[] = {
  2214. {.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  2215. .name = "SRS SS3D HDMI",
  2216. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |
  2217. SNDRV_CTL_ELEM_ACCESS_READWRITE,
  2218. .info = snd_soc_info_volsw, \
  2219. .get = msm_routing_get_srs_SS3D_control,
  2220. .put = msm_routing_set_srs_SS3D_control_HDMI,
  2221. .private_value = ((unsigned long)&(struct soc_mixer_control)
  2222. {.reg = SND_SOC_NOPM,
  2223. .rreg = SND_SOC_NOPM,
  2224. .shift = 0,
  2225. .rshift = 0,
  2226. .max = 0xFFFFFFFF,
  2227. .platform_max = 0xFFFFFFFF,
  2228. .invert = 0
  2229. })
  2230. }
  2231. };
  2232. static const struct snd_kcontrol_new lpa_SRS_SS3D_controls_I2S[] = {
  2233. {.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  2234. .name = "SRS SS3D I2S",
  2235. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |
  2236. SNDRV_CTL_ELEM_ACCESS_READWRITE,
  2237. .info = snd_soc_info_volsw, \
  2238. .get = msm_routing_get_srs_SS3D_control,
  2239. .put = msm_routing_set_srs_SS3D_control_I2S,
  2240. .private_value = ((unsigned long)&(struct soc_mixer_control)
  2241. {.reg = SND_SOC_NOPM,
  2242. .rreg = SND_SOC_NOPM,
  2243. .shift = 0,
  2244. .rshift = 0,
  2245. .max = 0xFFFFFFFF,
  2246. .platform_max = 0xFFFFFFFF,
  2247. .invert = 0
  2248. })
  2249. }
  2250. };
  2251. static const struct snd_kcontrol_new eq_enable_mixer_controls[] = {
  2252. SOC_SINGLE_EXT("MultiMedia1 EQ Enable", SND_SOC_NOPM,
  2253. MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_eq_enable_mixer,
  2254. msm_routing_put_eq_enable_mixer),
  2255. SOC_SINGLE_EXT("MultiMedia2 EQ Enable", SND_SOC_NOPM,
  2256. MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_eq_enable_mixer,
  2257. msm_routing_put_eq_enable_mixer),
  2258. SOC_SINGLE_EXT("MultiMedia3 EQ Enable", SND_SOC_NOPM,
  2259. MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_eq_enable_mixer,
  2260. msm_routing_put_eq_enable_mixer),
  2261. };
  2262. static const struct snd_kcontrol_new eq_band_mixer_controls[] = {
  2263. SOC_SINGLE_EXT("MultiMedia1 EQ Band Count", SND_SOC_NOPM,
  2264. MSM_FRONTEND_DAI_MULTIMEDIA1, 11, 0,
  2265. msm_routing_get_eq_band_count_audio_mixer,
  2266. msm_routing_put_eq_band_count_audio_mixer),
  2267. SOC_SINGLE_EXT("MultiMedia2 EQ Band Count", SND_SOC_NOPM,
  2268. MSM_FRONTEND_DAI_MULTIMEDIA2, 11, 0,
  2269. msm_routing_get_eq_band_count_audio_mixer,
  2270. msm_routing_put_eq_band_count_audio_mixer),
  2271. SOC_SINGLE_EXT("MultiMedia3 EQ Band Count", SND_SOC_NOPM,
  2272. MSM_FRONTEND_DAI_MULTIMEDIA3, 11, 0,
  2273. msm_routing_get_eq_band_count_audio_mixer,
  2274. msm_routing_put_eq_band_count_audio_mixer),
  2275. };
  2276. static const struct snd_kcontrol_new eq_coeff_mixer_controls[] = {
  2277. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band1", EQ_BAND1,
  2278. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  2279. msm_routing_get_eq_band_audio_mixer,
  2280. msm_routing_put_eq_band_audio_mixer),
  2281. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band2", EQ_BAND2,
  2282. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  2283. msm_routing_get_eq_band_audio_mixer,
  2284. msm_routing_put_eq_band_audio_mixer),
  2285. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band3", EQ_BAND3,
  2286. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  2287. msm_routing_get_eq_band_audio_mixer,
  2288. msm_routing_put_eq_band_audio_mixer),
  2289. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band4", EQ_BAND4,
  2290. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  2291. msm_routing_get_eq_band_audio_mixer,
  2292. msm_routing_put_eq_band_audio_mixer),
  2293. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band5", EQ_BAND5,
  2294. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  2295. msm_routing_get_eq_band_audio_mixer,
  2296. msm_routing_put_eq_band_audio_mixer),
  2297. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band6", EQ_BAND6,
  2298. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  2299. msm_routing_get_eq_band_audio_mixer,
  2300. msm_routing_put_eq_band_audio_mixer),
  2301. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band7", EQ_BAND7,
  2302. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  2303. msm_routing_get_eq_band_audio_mixer,
  2304. msm_routing_put_eq_band_audio_mixer),
  2305. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band8", EQ_BAND8,
  2306. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  2307. msm_routing_get_eq_band_audio_mixer,
  2308. msm_routing_put_eq_band_audio_mixer),
  2309. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band9", EQ_BAND9,
  2310. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  2311. msm_routing_get_eq_band_audio_mixer,
  2312. msm_routing_put_eq_band_audio_mixer),
  2313. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band10", EQ_BAND10,
  2314. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  2315. msm_routing_get_eq_band_audio_mixer,
  2316. msm_routing_put_eq_band_audio_mixer),
  2317. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band11", EQ_BAND11,
  2318. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  2319. msm_routing_get_eq_band_audio_mixer,
  2320. msm_routing_put_eq_band_audio_mixer),
  2321. SOC_SINGLE_MULTI_EXT("MultiMedia1 EQ Band12", EQ_BAND12,
  2322. MSM_FRONTEND_DAI_MULTIMEDIA1, 255, 0, 5,
  2323. msm_routing_get_eq_band_audio_mixer,
  2324. msm_routing_put_eq_band_audio_mixer),
  2325. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band1", EQ_BAND1,
  2326. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  2327. msm_routing_get_eq_band_audio_mixer,
  2328. msm_routing_put_eq_band_audio_mixer),
  2329. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band2", EQ_BAND2,
  2330. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  2331. msm_routing_get_eq_band_audio_mixer,
  2332. msm_routing_put_eq_band_audio_mixer),
  2333. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band3", EQ_BAND3,
  2334. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  2335. msm_routing_get_eq_band_audio_mixer,
  2336. msm_routing_put_eq_band_audio_mixer),
  2337. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band4", EQ_BAND4,
  2338. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  2339. msm_routing_get_eq_band_audio_mixer,
  2340. msm_routing_put_eq_band_audio_mixer),
  2341. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band5", EQ_BAND5,
  2342. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  2343. msm_routing_get_eq_band_audio_mixer,
  2344. msm_routing_put_eq_band_audio_mixer),
  2345. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band6", EQ_BAND6,
  2346. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  2347. msm_routing_get_eq_band_audio_mixer,
  2348. msm_routing_put_eq_band_audio_mixer),
  2349. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band7", EQ_BAND7,
  2350. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  2351. msm_routing_get_eq_band_audio_mixer,
  2352. msm_routing_put_eq_band_audio_mixer),
  2353. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band8", EQ_BAND8,
  2354. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  2355. msm_routing_get_eq_band_audio_mixer,
  2356. msm_routing_put_eq_band_audio_mixer),
  2357. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band9", EQ_BAND9,
  2358. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  2359. msm_routing_get_eq_band_audio_mixer,
  2360. msm_routing_put_eq_band_audio_mixer),
  2361. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band10", EQ_BAND10,
  2362. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  2363. msm_routing_get_eq_band_audio_mixer,
  2364. msm_routing_put_eq_band_audio_mixer),
  2365. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band11", EQ_BAND11,
  2366. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  2367. msm_routing_get_eq_band_audio_mixer,
  2368. msm_routing_put_eq_band_audio_mixer),
  2369. SOC_SINGLE_MULTI_EXT("MultiMedia2 EQ Band12", EQ_BAND12,
  2370. MSM_FRONTEND_DAI_MULTIMEDIA2, 255, 0, 5,
  2371. msm_routing_get_eq_band_audio_mixer,
  2372. msm_routing_put_eq_band_audio_mixer),
  2373. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band1", EQ_BAND1,
  2374. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  2375. msm_routing_get_eq_band_audio_mixer,
  2376. msm_routing_put_eq_band_audio_mixer),
  2377. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band2", EQ_BAND2,
  2378. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  2379. msm_routing_get_eq_band_audio_mixer,
  2380. msm_routing_put_eq_band_audio_mixer),
  2381. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band3", EQ_BAND3,
  2382. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  2383. msm_routing_get_eq_band_audio_mixer,
  2384. msm_routing_put_eq_band_audio_mixer),
  2385. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band4", EQ_BAND4,
  2386. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  2387. msm_routing_get_eq_band_audio_mixer,
  2388. msm_routing_put_eq_band_audio_mixer),
  2389. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band5", EQ_BAND5,
  2390. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  2391. msm_routing_get_eq_band_audio_mixer,
  2392. msm_routing_put_eq_band_audio_mixer),
  2393. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band6", EQ_BAND6,
  2394. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  2395. msm_routing_get_eq_band_audio_mixer,
  2396. msm_routing_put_eq_band_audio_mixer),
  2397. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band7", EQ_BAND7,
  2398. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  2399. msm_routing_get_eq_band_audio_mixer,
  2400. msm_routing_put_eq_band_audio_mixer),
  2401. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band8", EQ_BAND8,
  2402. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  2403. msm_routing_get_eq_band_audio_mixer,
  2404. msm_routing_put_eq_band_audio_mixer),
  2405. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band9", EQ_BAND9,
  2406. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  2407. msm_routing_get_eq_band_audio_mixer,
  2408. msm_routing_put_eq_band_audio_mixer),
  2409. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band10", EQ_BAND10,
  2410. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  2411. msm_routing_get_eq_band_audio_mixer,
  2412. msm_routing_put_eq_band_audio_mixer),
  2413. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band11", EQ_BAND11,
  2414. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  2415. msm_routing_get_eq_band_audio_mixer,
  2416. msm_routing_put_eq_band_audio_mixer),
  2417. SOC_SINGLE_MULTI_EXT("MultiMedia3 EQ Band12", EQ_BAND12,
  2418. MSM_FRONTEND_DAI_MULTIMEDIA3, 255, 0, 5,
  2419. msm_routing_get_eq_band_audio_mixer,
  2420. msm_routing_put_eq_band_audio_mixer),
  2421. };
  2422. static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = {
  2423. /* Frontend AIF */
  2424. /* Widget name equals to Front-End DAI name<Need confirmation>,
  2425. * Stream name must contains substring of front-end dai name
  2426. */
  2427. SND_SOC_DAPM_AIF_IN("MM_DL1", "MultiMedia1 Playback", 0, 0, 0, 0),
  2428. SND_SOC_DAPM_AIF_IN("MM_DL2", "MultiMedia2 Playback", 0, 0, 0, 0),
  2429. SND_SOC_DAPM_AIF_IN("MM_DL3", "MultiMedia3 Playback", 0, 0, 0, 0),
  2430. SND_SOC_DAPM_AIF_IN("MM_DL4", "MultiMedia4 Playback", 0, 0, 0, 0),
  2431. SND_SOC_DAPM_AIF_IN("MM_DL5", "MultiMedia5 Playback", 0, 0, 0, 0),
  2432. SND_SOC_DAPM_AIF_IN("MM_DL6", "MultiMedia6 Playback", 0, 0, 0, 0),
  2433. SND_SOC_DAPM_AIF_IN("MM_DL7", "MultiMedia7 Playback", 0, 0, 0, 0),
  2434. SND_SOC_DAPM_AIF_IN("MM_DL8", "MultiMedia8 Playback", 0, 0, 0, 0),
  2435. SND_SOC_DAPM_AIF_IN("MM_DL9", "Pseudo Playback", 0, 0, 0, 0),
  2436. SND_SOC_DAPM_AIF_IN("VOIP_DL", "VoIP Playback", 0, 0, 0, 0),
  2437. SND_SOC_DAPM_AIF_OUT("MM_UL1", "MultiMedia1 Capture", 0, 0, 0, 0),
  2438. SND_SOC_DAPM_AIF_OUT("MM_UL2", "MultiMedia2 Capture", 0, 0, 0, 0),
  2439. SND_SOC_DAPM_AIF_OUT("MM_UL4", "MultiMedia4 Capture", 0, 0, 0, 0),
  2440. SND_SOC_DAPM_AIF_OUT("MM_UL5", "MultiMedia5 Capture", 0, 0, 0, 0),
  2441. SND_SOC_DAPM_AIF_OUT("MM_UL6", "MultiMedia6 Capture", 0, 0, 0, 0),
  2442. SND_SOC_DAPM_AIF_IN("CS-VOICE_DL1", "CS-VOICE Playback", 0, 0, 0, 0),
  2443. SND_SOC_DAPM_AIF_OUT("CS-VOICE_UL1", "CS-VOICE Capture", 0, 0, 0, 0),
  2444. SND_SOC_DAPM_AIF_IN("VoLTE_DL", "VoLTE Playback", 0, 0, 0, 0),
  2445. SND_SOC_DAPM_AIF_OUT("VoLTE_UL", "VoLTE Capture", 0, 0, 0, 0),
  2446. SND_SOC_DAPM_AIF_IN("VOICE2_DL", "Voice2 Playback", 0, 0, 0, 0),
  2447. SND_SOC_DAPM_AIF_OUT("VOICE2_UL", "Voice2 Capture", 0, 0, 0, 0),
  2448. SND_SOC_DAPM_AIF_OUT("VOIP_UL", "VoIP Capture", 0, 0, 0, 0),
  2449. SND_SOC_DAPM_AIF_IN("SLIM0_DL_HL", "SLIMBUS0_HOSTLESS Playback",
  2450. 0, 0, 0, 0),
  2451. SND_SOC_DAPM_AIF_OUT("SLIM0_UL_HL", "SLIMBUS0_HOSTLESS Capture",
  2452. 0, 0, 0, 0),
  2453. SND_SOC_DAPM_AIF_IN("INTFM_DL_HL", "INT_FM_HOSTLESS Playback",
  2454. 0, 0, 0, 0),
  2455. SND_SOC_DAPM_AIF_OUT("INTFM_UL_HL", "INT_FM_HOSTLESS Capture",
  2456. 0, 0, 0, 0),
  2457. SND_SOC_DAPM_AIF_IN("HDMI_DL_HL", "HDMI_HOSTLESS Playback", 0, 0, 0, 0),
  2458. SND_SOC_DAPM_AIF_IN("SEC_I2S_DL_HL", "SEC_I2S_RX_HOSTLESS Playback",
  2459. 0, 0, 0, 0),
  2460. SND_SOC_DAPM_AIF_IN("AUXPCM_DL_HL", "AUXPCM_HOSTLESS Playback",
  2461. 0, 0, 0, 0),
  2462. SND_SOC_DAPM_AIF_OUT("AUXPCM_UL_HL", "AUXPCM_HOSTLESS Capture",
  2463. 0, 0, 0, 0),
  2464. SND_SOC_DAPM_AIF_OUT("MI2S_UL_HL", "MI2S_TX_HOSTLESS Capture",
  2465. 0, 0, 0, 0),
  2466. SND_SOC_DAPM_AIF_IN("DTMF_DL_HL", "DTMF_RX_HOSTLESS Playback",
  2467. 0, 0, 0, 0),
  2468. /* Backend AIF */
  2469. /* Stream name equals to backend dai link stream name
  2470. */
  2471. SND_SOC_DAPM_AIF_OUT("PRI_I2S_RX", "Primary I2S Playback", 0, 0, 0, 0),
  2472. SND_SOC_DAPM_AIF_OUT("SEC_I2S_RX", "Secondary I2S Playback",
  2473. 0, 0, 0 , 0),
  2474. SND_SOC_DAPM_AIF_OUT("SLIMBUS_0_RX", "Slimbus Playback", 0, 0, 0, 0),
  2475. SND_SOC_DAPM_AIF_OUT("HDMI", "HDMI Playback", 0, 0, 0 , 0),
  2476. SND_SOC_DAPM_AIF_OUT("PSEUDO", "PSEUDO Playback", 0, 0, 0 , 0),
  2477. SND_SOC_DAPM_AIF_OUT("MI2S_RX", "MI2S Playback", 0, 0, 0, 0),
  2478. SND_SOC_DAPM_AIF_IN("PRI_I2S_TX", "Primary I2S Capture", 0, 0, 0, 0),
  2479. SND_SOC_DAPM_AIF_IN("SEC_I2S_TX", "Secondary I2S Capture", 0, 0, 0, 0),
  2480. SND_SOC_DAPM_AIF_IN("MI2S_TX", "MI2S Capture", 0, 0, 0, 0),
  2481. SND_SOC_DAPM_AIF_IN("SLIMBUS_0_TX", "Slimbus Capture", 0, 0, 0, 0),
  2482. SND_SOC_DAPM_AIF_OUT("INT_BT_SCO_RX", "Internal BT-SCO Playback",
  2483. 0, 0, 0 , 0),
  2484. SND_SOC_DAPM_AIF_IN("INT_BT_SCO_TX", "Internal BT-SCO Capture",
  2485. 0, 0, 0, 0),
  2486. SND_SOC_DAPM_AIF_OUT("INT_FM_RX", "Internal FM Playback",
  2487. 0, 0, 0 , 0),
  2488. SND_SOC_DAPM_AIF_IN("INT_FM_TX", "Internal FM Capture",
  2489. 0, 0, 0, 0),
  2490. SND_SOC_DAPM_AIF_OUT("PCM_RX", "AFE Playback",
  2491. 0, 0, 0 , 0),
  2492. SND_SOC_DAPM_AIF_IN("PCM_TX", "AFE Capture",
  2493. 0, 0, 0 , 0),
  2494. /* incall */
  2495. SND_SOC_DAPM_AIF_OUT("VOICE_PLAYBACK_TX", "Voice Farend Playback",
  2496. 0, 0, 0 , 0),
  2497. SND_SOC_DAPM_AIF_OUT("SLIMBUS_4_RX", "Slimbus4 Playback",
  2498. 0, 0, 0 , 0),
  2499. SND_SOC_DAPM_AIF_IN("INCALL_RECORD_TX", "Voice Uplink Capture",
  2500. 0, 0, 0, 0),
  2501. SND_SOC_DAPM_AIF_IN("INCALL_RECORD_RX", "Voice Downlink Capture",
  2502. 0, 0, 0, 0),
  2503. SND_SOC_DAPM_AIF_IN("SLIMBUS_4_TX", "Slimbus4 Capture",
  2504. 0, 0, 0, 0),
  2505. SND_SOC_DAPM_AIF_OUT("AUX_PCM_RX", "AUX PCM Playback", 0, 0, 0, 0),
  2506. SND_SOC_DAPM_AIF_IN("AUX_PCM_TX", "AUX PCM Capture", 0, 0, 0, 0),
  2507. SND_SOC_DAPM_AIF_OUT("SEC_AUX_PCM_RX", "SEC AUX PCM Playback",
  2508. 0, 0, 0, 0),
  2509. SND_SOC_DAPM_AIF_IN("SEC_AUX_PCM_TX", "SEC AUX PCM Capture",
  2510. 0, 0, 0, 0),
  2511. SND_SOC_DAPM_AIF_IN("VOICE_STUB_DL", "VOICE_STUB Playback", 0, 0, 0, 0),
  2512. SND_SOC_DAPM_AIF_OUT("VOICE_STUB_UL", "VOICE_STUB Capture", 0, 0, 0, 0),
  2513. SND_SOC_DAPM_AIF_IN("VOLTE_STUB_DL", "VOLTE_STUB Playback", 0, 0, 0, 0),
  2514. SND_SOC_DAPM_AIF_OUT("VOLTE_STUB_UL", "VOLTE_STUB Capture", 0, 0, 0, 0),
  2515. SND_SOC_DAPM_AIF_IN("VOICE2_STUB_DL",
  2516. "VOICE2_STUB Playback", 0, 0, 0, 0),
  2517. SND_SOC_DAPM_AIF_OUT("VOICE2_STUB_UL",
  2518. "VOICE2_STUB Capture", 0, 0, 0, 0),
  2519. SND_SOC_DAPM_AIF_OUT("STUB_RX", "Stub Playback", 0, 0, 0, 0),
  2520. SND_SOC_DAPM_AIF_IN("STUB_TX", "Stub Capture", 0, 0, 0, 0),
  2521. SND_SOC_DAPM_AIF_OUT("SLIMBUS_1_RX", "Slimbus1 Playback", 0, 0, 0, 0),
  2522. SND_SOC_DAPM_AIF_IN("SLIMBUS_1_TX", "Slimbus1 Capture", 0, 0, 0, 0),
  2523. SND_SOC_DAPM_AIF_IN("STUB_1_TX", "Stub1 Capture", 0, 0, 0, 0),
  2524. SND_SOC_DAPM_AIF_OUT("SLIMBUS_3_RX", "Slimbus3 Playback", 0, 0, 0, 0),
  2525. SND_SOC_DAPM_AIF_IN("SLIMBUS_3_TX", "Slimbus3 Capture", 0, 0, 0, 0),
  2526. /* Switch Definitions */
  2527. SND_SOC_DAPM_SWITCH("SLIMBUS_DL_HL", SND_SOC_NOPM, 0, 0,
  2528. &fm_switch_mixer_controls),
  2529. SND_SOC_DAPM_SWITCH("PCM_RX_DL_HL", SND_SOC_NOPM, 0, 0,
  2530. &pcm_rx_switch_mixer_controls),
  2531. /* Mixer definitions */
  2532. SND_SOC_DAPM_MIXER("PRI_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
  2533. pri_i2s_rx_mixer_controls, ARRAY_SIZE(pri_i2s_rx_mixer_controls)),
  2534. SND_SOC_DAPM_MIXER("SEC_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
  2535. sec_i2s_rx_mixer_controls, ARRAY_SIZE(sec_i2s_rx_mixer_controls)),
  2536. SND_SOC_DAPM_MIXER("SLIMBUS_0_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
  2537. slimbus_rx_mixer_controls, ARRAY_SIZE(slimbus_rx_mixer_controls)),
  2538. SND_SOC_DAPM_MIXER("HDMI Mixer", SND_SOC_NOPM, 0, 0,
  2539. hdmi_mixer_controls, ARRAY_SIZE(hdmi_mixer_controls)),
  2540. SND_SOC_DAPM_MIXER("PSEUDO Mixer", SND_SOC_NOPM, 0, 0,
  2541. pseudo_mixer_controls, ARRAY_SIZE(pseudo_mixer_controls)),
  2542. SND_SOC_DAPM_MIXER("MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
  2543. mi2s_rx_mixer_controls, ARRAY_SIZE(mi2s_rx_mixer_controls)),
  2544. SND_SOC_DAPM_MIXER("MultiMedia1 Mixer", SND_SOC_NOPM, 0, 0,
  2545. mmul1_mixer_controls, ARRAY_SIZE(mmul1_mixer_controls)),
  2546. SND_SOC_DAPM_MIXER("MultiMedia2 Mixer", SND_SOC_NOPM, 0, 0,
  2547. mmul2_mixer_controls, ARRAY_SIZE(mmul2_mixer_controls)),
  2548. SND_SOC_DAPM_MIXER("MultiMedia4 Mixer", SND_SOC_NOPM, 0, 0,
  2549. mmul4_mixer_controls, ARRAY_SIZE(mmul4_mixer_controls)),
  2550. SND_SOC_DAPM_MIXER("MultiMedia5 Mixer", SND_SOC_NOPM, 0, 0,
  2551. mmul5_mixer_controls, ARRAY_SIZE(mmul5_mixer_controls)),
  2552. SND_SOC_DAPM_MIXER("MultiMedia6 Mixer", SND_SOC_NOPM, 0, 0,
  2553. mmul6_mixer_controls, ARRAY_SIZE(mmul6_mixer_controls)),
  2554. SND_SOC_DAPM_MIXER("AUX_PCM_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
  2555. auxpcm_rx_mixer_controls, ARRAY_SIZE(auxpcm_rx_mixer_controls)),
  2556. SND_SOC_DAPM_MIXER("SEC_AUX_PCM_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
  2557. sec_auxpcm_rx_mixer_controls, ARRAY_SIZE(sec_auxpcm_rx_mixer_controls)),
  2558. /* incall */
  2559. SND_SOC_DAPM_MIXER("Incall_Music Audio Mixer", SND_SOC_NOPM, 0, 0,
  2560. incall_music_delivery_mixer_controls,
  2561. ARRAY_SIZE(incall_music_delivery_mixer_controls)),
  2562. SND_SOC_DAPM_MIXER("SLIMBUS_4_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
  2563. slimbus_4_rx_mixer_controls,
  2564. ARRAY_SIZE(slimbus_4_rx_mixer_controls)),
  2565. /* Voice Mixer */
  2566. SND_SOC_DAPM_MIXER("PRI_RX_Voice Mixer",
  2567. SND_SOC_NOPM, 0, 0, pri_rx_voice_mixer_controls,
  2568. ARRAY_SIZE(pri_rx_voice_mixer_controls)),
  2569. SND_SOC_DAPM_MIXER("SEC_RX_Voice Mixer",
  2570. SND_SOC_NOPM, 0, 0,
  2571. sec_i2s_rx_voice_mixer_controls,
  2572. ARRAY_SIZE(sec_i2s_rx_voice_mixer_controls)),
  2573. SND_SOC_DAPM_MIXER("SLIM_0_RX_Voice Mixer",
  2574. SND_SOC_NOPM, 0, 0,
  2575. slimbus_rx_voice_mixer_controls,
  2576. ARRAY_SIZE(slimbus_rx_voice_mixer_controls)),
  2577. SND_SOC_DAPM_MIXER("INTERNAL_BT_SCO_RX_Voice Mixer",
  2578. SND_SOC_NOPM, 0, 0,
  2579. bt_sco_rx_voice_mixer_controls,
  2580. ARRAY_SIZE(bt_sco_rx_voice_mixer_controls)),
  2581. SND_SOC_DAPM_MIXER("AFE_PCM_RX_Voice Mixer",
  2582. SND_SOC_NOPM, 0, 0,
  2583. afe_pcm_rx_voice_mixer_controls,
  2584. ARRAY_SIZE(afe_pcm_rx_voice_mixer_controls)),
  2585. SND_SOC_DAPM_MIXER("AUX_PCM_RX_Voice Mixer",
  2586. SND_SOC_NOPM, 0, 0,
  2587. aux_pcm_rx_voice_mixer_controls,
  2588. ARRAY_SIZE(aux_pcm_rx_voice_mixer_controls)),
  2589. SND_SOC_DAPM_MIXER("SEC_AUX_PCM_RX_Voice Mixer",
  2590. SND_SOC_NOPM, 0, 0,
  2591. sec_aux_pcm_rx_voice_mixer_controls,
  2592. ARRAY_SIZE(sec_aux_pcm_rx_voice_mixer_controls)),
  2593. SND_SOC_DAPM_MIXER("HDMI_RX_Voice Mixer",
  2594. SND_SOC_NOPM, 0, 0,
  2595. hdmi_rx_voice_mixer_controls,
  2596. ARRAY_SIZE(hdmi_rx_voice_mixer_controls)),
  2597. SND_SOC_DAPM_MIXER("MI2S_RX_Voice Mixer",
  2598. SND_SOC_NOPM, 0, 0,
  2599. mi2s_rx_voice_mixer_controls,
  2600. ARRAY_SIZE(mi2s_rx_voice_mixer_controls)),
  2601. SND_SOC_DAPM_MIXER("Voice_Tx Mixer",
  2602. SND_SOC_NOPM, 0, 0, tx_voice_mixer_controls,
  2603. ARRAY_SIZE(tx_voice_mixer_controls)),
  2604. SND_SOC_DAPM_MIXER("Voip_Tx Mixer",
  2605. SND_SOC_NOPM, 0, 0, tx_voip_mixer_controls,
  2606. ARRAY_SIZE(tx_voip_mixer_controls)),
  2607. SND_SOC_DAPM_MIXER("VoLTE_Tx Mixer",
  2608. SND_SOC_NOPM, 0, 0, tx_volte_mixer_controls,
  2609. ARRAY_SIZE(tx_volte_mixer_controls)),
  2610. SND_SOC_DAPM_MIXER("Voice2_Tx Mixer",
  2611. SND_SOC_NOPM, 0, 0, tx_voice2_mixer_controls,
  2612. ARRAY_SIZE(tx_voice2_mixer_controls)),
  2613. SND_SOC_DAPM_MIXER("INTERNAL_BT_SCO_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
  2614. int_bt_sco_rx_mixer_controls, ARRAY_SIZE(int_bt_sco_rx_mixer_controls)),
  2615. SND_SOC_DAPM_MIXER("INTERNAL_FM_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
  2616. int_fm_rx_mixer_controls, ARRAY_SIZE(int_fm_rx_mixer_controls)),
  2617. SND_SOC_DAPM_MIXER("AFE_PCM_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
  2618. afe_pcm_rx_mixer_controls, ARRAY_SIZE(afe_pcm_rx_mixer_controls)),
  2619. SND_SOC_DAPM_MIXER("Voice Stub Tx Mixer", SND_SOC_NOPM, 0, 0,
  2620. tx_voice_stub_mixer_controls, ARRAY_SIZE(tx_voice_stub_mixer_controls)),
  2621. SND_SOC_DAPM_MIXER("STUB_RX Mixer", SND_SOC_NOPM, 0, 0,
  2622. stub_rx_mixer_controls, ARRAY_SIZE(stub_rx_mixer_controls)),
  2623. SND_SOC_DAPM_MIXER("SLIMBUS_1_RX Mixer", SND_SOC_NOPM, 0, 0,
  2624. slimbus_1_rx_mixer_controls, ARRAY_SIZE(slimbus_1_rx_mixer_controls)),
  2625. SND_SOC_DAPM_MIXER("SLIMBUS_3_RX_Voice Mixer", SND_SOC_NOPM, 0, 0,
  2626. slimbus_3_rx_mixer_controls, ARRAY_SIZE(slimbus_3_rx_mixer_controls)),
  2627. SND_SOC_DAPM_MIXER("SLIMBUS_0_RX Port Mixer",
  2628. SND_SOC_NOPM, 0, 0, sbus_0_rx_port_mixer_controls,
  2629. ARRAY_SIZE(sbus_0_rx_port_mixer_controls)),
  2630. SND_SOC_DAPM_MIXER("AUXPCM_RX Port Mixer",
  2631. SND_SOC_NOPM, 0, 0, auxpcm_rx_port_mixer_controls,
  2632. ARRAY_SIZE(auxpcm_rx_port_mixer_controls)),
  2633. SND_SOC_DAPM_MIXER("SLIMBUS_1_RX Port Mixer", SND_SOC_NOPM, 0, 0,
  2634. sbus_1_rx_port_mixer_controls,
  2635. ARRAY_SIZE(sbus_1_rx_port_mixer_controls)),
  2636. SND_SOC_DAPM_MIXER("INTERNAL_BT_SCO_RX Port Mixer", SND_SOC_NOPM, 0, 0,
  2637. bt_sco_rx_port_mixer_controls,
  2638. ARRAY_SIZE(bt_sco_rx_port_mixer_controls)),
  2639. SND_SOC_DAPM_MIXER("AFE_PCM_RX Port Mixer",
  2640. SND_SOC_NOPM, 0, 0, afe_pcm_rx_port_mixer_controls,
  2641. ARRAY_SIZE(afe_pcm_rx_port_mixer_controls)),
  2642. SND_SOC_DAPM_MIXER("HDMI_RX Port Mixer",
  2643. SND_SOC_NOPM, 0, 0, hdmi_rx_port_mixer_controls,
  2644. ARRAY_SIZE(hdmi_rx_port_mixer_controls)),
  2645. SND_SOC_DAPM_MIXER("PRI_I2S_RX Port Mixer",
  2646. SND_SOC_NOPM, 0, 0, pri_i2s_rx_port_mixer_controls,
  2647. ARRAY_SIZE(pri_i2s_rx_port_mixer_controls)),
  2648. SND_SOC_DAPM_MIXER("SEC_I2S_RX Port Mixer",
  2649. SND_SOC_NOPM, 0, 0, sec_i2s_rx_port_mixer_controls,
  2650. ARRAY_SIZE(sec_i2s_rx_port_mixer_controls)),
  2651. SND_SOC_DAPM_MIXER("SLIMBUS_3_RX Port Mixer",
  2652. SND_SOC_NOPM, 0, 0, sbus_3_rx_port_mixer_controls,
  2653. ARRAY_SIZE(sbus_3_rx_port_mixer_controls)),
  2654. SND_SOC_DAPM_MIXER("MI2S_RX Port Mixer", SND_SOC_NOPM, 0, 0,
  2655. mi2s_rx_port_mixer_controls, ARRAY_SIZE(mi2s_rx_port_mixer_controls)),
  2656. SND_SOC_DAPM_MIXER("VoLTE Stub Tx Mixer", SND_SOC_NOPM, 0, 0,
  2657. tx_volte_stub_mixer_controls,
  2658. ARRAY_SIZE(tx_volte_stub_mixer_controls)),
  2659. SND_SOC_DAPM_MIXER("Voice2 Stub Tx Mixer", SND_SOC_NOPM, 0, 0,
  2660. tx_voice2_stub_mixer_controls,
  2661. ARRAY_SIZE(tx_voice2_stub_mixer_controls)),
  2662. /* Virtual Pins to force backends ON atm */
  2663. SND_SOC_DAPM_OUTPUT("BE_OUT"),
  2664. SND_SOC_DAPM_INPUT("BE_IN"),
  2665. SND_SOC_DAPM_MUX("VOC_EXT_EC MUX", SND_SOC_NOPM, 0, 0, &voc_ext_ec_mux),
  2666. };
  2667. static const struct snd_soc_dapm_route intercon[] = {
  2668. {"PRI_RX Audio Mixer", "MultiMedia1", "MM_DL1"},
  2669. {"PRI_RX Audio Mixer", "MultiMedia2", "MM_DL2"},
  2670. {"PRI_RX Audio Mixer", "MultiMedia3", "MM_DL3"},
  2671. {"PRI_RX Audio Mixer", "MultiMedia4", "MM_DL4"},
  2672. {"PRI_RX Audio Mixer", "MultiMedia5", "MM_DL5"},
  2673. {"PRI_RX Audio Mixer", "MultiMedia6", "MM_DL6"},
  2674. {"PRI_RX Audio Mixer", "MultiMedia7", "MM_DL7"},
  2675. {"PRI_RX Audio Mixer", "MultiMedia8", "MM_DL8"},
  2676. {"PRI_I2S_RX", NULL, "PRI_RX Audio Mixer"},
  2677. {"SEC_RX Audio Mixer", "MultiMedia1", "MM_DL1"},
  2678. {"SEC_RX Audio Mixer", "MultiMedia2", "MM_DL2"},
  2679. {"SEC_RX Audio Mixer", "MultiMedia3", "MM_DL3"},
  2680. {"SEC_RX Audio Mixer", "MultiMedia4", "MM_DL4"},
  2681. {"SEC_RX Audio Mixer", "MultiMedia5", "MM_DL5"},
  2682. {"SEC_RX Audio Mixer", "MultiMedia6", "MM_DL6"},
  2683. {"SEC_RX Audio Mixer", "MultiMedia7", "MM_DL7"},
  2684. {"SEC_RX Audio Mixer", "MultiMedia8", "MM_DL8"},
  2685. {"SEC_RX Audio Mixer", "Pseudo", "MM_DL9"},
  2686. {"SEC_I2S_RX", NULL, "SEC_RX Audio Mixer"},
  2687. {"SLIMBUS_0_RX Audio Mixer", "MultiMedia1", "MM_DL1"},
  2688. {"SLIMBUS_0_RX Audio Mixer", "MultiMedia2", "MM_DL2"},
  2689. {"SLIMBUS_0_RX Audio Mixer", "MultiMedia3", "MM_DL3"},
  2690. {"SLIMBUS_0_RX Audio Mixer", "MultiMedia4", "MM_DL4"},
  2691. {"SLIMBUS_0_RX Audio Mixer", "MultiMedia5", "MM_DL5"},
  2692. {"SLIMBUS_0_RX Audio Mixer", "MultiMedia6", "MM_DL6"},
  2693. {"SLIMBUS_0_RX Audio Mixer", "MultiMedia7", "MM_DL7"},
  2694. {"SLIMBUS_0_RX Audio Mixer", "MultiMedia8", "MM_DL8"},
  2695. {"SLIMBUS_0_RX", NULL, "SLIMBUS_0_RX Audio Mixer"},
  2696. {"HDMI Mixer", "MultiMedia1", "MM_DL1"},
  2697. {"HDMI Mixer", "MultiMedia2", "MM_DL2"},
  2698. {"HDMI Mixer", "MultiMedia3", "MM_DL3"},
  2699. {"HDMI Mixer", "MultiMedia4", "MM_DL4"},
  2700. {"HDMI Mixer", "MultiMedia5", "MM_DL5"},
  2701. {"HDMI Mixer", "MultiMedia6", "MM_DL6"},
  2702. {"HDMI Mixer", "MultiMedia7", "MM_DL7"},
  2703. {"HDMI Mixer", "MultiMedia8", "MM_DL8"},
  2704. {"HDMI Mixer", "Pseudo", "MM_DL9"},
  2705. {"HDMI", NULL, "HDMI Mixer"},
  2706. {"PSEUDO Mixer", "MultiMedia4", "MM_DL4"},
  2707. {"PSEUDO", NULL, "PSEUDO Mixer"},
  2708. /* incall */
  2709. {"Incall_Music Audio Mixer", "MultiMedia1", "MM_DL1"},
  2710. {"Incall_Music Audio Mixer", "MultiMedia2", "MM_DL2"},
  2711. {"VOICE_PLAYBACK_TX", NULL, "Incall_Music Audio Mixer"},
  2712. {"SLIMBUS_4_RX Audio Mixer", "MultiMedia1", "MM_DL1"},
  2713. {"SLIMBUS_4_RX Audio Mixer", "MultiMedia2", "MM_DL2"},
  2714. {"SLIMBUS_4_RX", NULL, "SLIMBUS_4_RX Audio Mixer"},
  2715. {"MultiMedia1 Mixer", "VOC_REC_UL", "INCALL_RECORD_TX"},
  2716. {"MultiMedia1 Mixer", "VOC_REC_DL", "INCALL_RECORD_RX"},
  2717. {"MultiMedia4 Mixer", "VOC_REC_UL", "INCALL_RECORD_TX"},
  2718. {"MultiMedia4 Mixer", "VOC_REC_DL", "INCALL_RECORD_RX"},
  2719. {"MultiMedia1 Mixer", "SLIM_4_TX", "SLIMBUS_4_TX"},
  2720. {"MultiMedia5 Mixer", "SLIM_0_TX", "SLIMBUS_0_TX"},
  2721. {"MI2S_RX Audio Mixer", "MultiMedia1", "MM_DL1"},
  2722. {"MI2S_RX Audio Mixer", "MultiMedia2", "MM_DL2"},
  2723. {"MI2S_RX Audio Mixer", "MultiMedia3", "MM_DL3"},
  2724. {"MI2S_RX Audio Mixer", "MultiMedia4", "MM_DL4"},
  2725. {"MI2S_RX Audio Mixer", "MultiMedia5", "MM_DL5"},
  2726. {"MI2S_RX Audio Mixer", "MultiMedia6", "MM_DL6"},
  2727. {"MI2S_RX", NULL, "MI2S_RX Audio Mixer"},
  2728. {"MultiMedia1 Mixer", "PRI_TX", "PRI_I2S_TX"},
  2729. {"MultiMedia1 Mixer", "SEC_TX", "SEC_I2S_TX"},
  2730. {"MultiMedia1 Mixer", "MI2S_TX", "MI2S_TX"},
  2731. {"MultiMedia2 Mixer", "MI2S_TX", "MI2S_TX"},
  2732. {"MultiMedia4 Mixer", "MI2S_TX", "MI2S_TX"},
  2733. {"MultiMedia4 Mixer", "SLIM_0_TX", "SLIMBUS_0_TX"},
  2734. {"MultiMedia1 Mixer", "SLIM_0_TX", "SLIMBUS_0_TX"},
  2735. {"MultiMedia1 Mixer", "AUX_PCM_UL_TX", "AUX_PCM_TX"},
  2736. {"MultiMedia5 Mixer", "AUX_PCM_TX", "AUX_PCM_TX"},
  2737. {"MultiMedia1 Mixer", "SEC_AUX_PCM_UL_TX", "SEC_AUX_PCM_TX"},
  2738. {"INTERNAL_BT_SCO_RX Audio Mixer", "MultiMedia1", "MM_DL1"},
  2739. {"INTERNAL_BT_SCO_RX Audio Mixer", "MultiMedia2", "MM_DL2"},
  2740. {"INTERNAL_BT_SCO_RX Audio Mixer", "MultiMedia3", "MM_DL3"},
  2741. {"INTERNAL_BT_SCO_RX Audio Mixer", "MultiMedia4", "MM_DL4"},
  2742. {"INTERNAL_BT_SCO_RX Audio Mixer", "MultiMedia5", "MM_DL5"},
  2743. {"INTERNAL_BT_SCO_RX Audio Mixer", "MultiMedia6", "MM_DL6"},
  2744. {"INT_BT_SCO_RX", NULL, "INTERNAL_BT_SCO_RX Audio Mixer"},
  2745. {"INTERNAL_FM_RX Audio Mixer", "MultiMedia1", "MM_DL1"},
  2746. {"INTERNAL_FM_RX Audio Mixer", "MultiMedia2", "MM_DL2"},
  2747. {"INTERNAL_FM_RX Audio Mixer", "MultiMedia3", "MM_DL3"},
  2748. {"INTERNAL_FM_RX Audio Mixer", "MultiMedia4", "MM_DL4"},
  2749. {"INTERNAL_FM_RX Audio Mixer", "MultiMedia5", "MM_DL5"},
  2750. {"INT_FM_RX", NULL, "INTERNAL_FM_RX Audio Mixer"},
  2751. {"AFE_PCM_RX Audio Mixer", "MultiMedia1", "MM_DL1"},
  2752. {"AFE_PCM_RX Audio Mixer", "MultiMedia2", "MM_DL2"},
  2753. {"AFE_PCM_RX Audio Mixer", "MultiMedia3", "MM_DL3"},
  2754. {"AFE_PCM_RX Audio Mixer", "MultiMedia4", "MM_DL4"},
  2755. {"AFE_PCM_RX Audio Mixer", "MultiMedia5", "MM_DL5"},
  2756. {"AFE_PCM_RX Audio Mixer", "MultiMedia6", "MM_DL6"},
  2757. {"PCM_RX", NULL, "AFE_PCM_RX Audio Mixer"},
  2758. {"MultiMedia1 Mixer", "INTERNAL_BT_SCO_TX", "INT_BT_SCO_TX"},
  2759. {"MultiMedia5 Mixer", "INTERNAL_BT_SCO_TX", "INT_BT_SCO_TX"},
  2760. {"MultiMedia1 Mixer", "INTERNAL_FM_TX", "INT_FM_TX"},
  2761. {"MultiMedia5 Mixer", "INTERNAL_FM_TX", "INT_FM_TX"},
  2762. {"MultiMedia6 Mixer", "INTERNAL_FM_TX", "INT_FM_TX"},
  2763. {"MultiMedia1 Mixer", "AFE_PCM_TX", "PCM_TX"},
  2764. {"MultiMedia5 Mixer", "AFE_PCM_TX", "PCM_TX"},
  2765. {"MM_UL1", NULL, "MultiMedia1 Mixer"},
  2766. {"MultiMedia2 Mixer", "INTERNAL_FM_TX", "INT_FM_TX"},
  2767. {"MM_UL2", NULL, "MultiMedia2 Mixer"},
  2768. {"MM_UL4", NULL, "MultiMedia4 Mixer"},
  2769. {"MM_UL5", NULL, "MultiMedia5 Mixer"},
  2770. {"MM_UL6", NULL, "MultiMedia6 Mixer"},
  2771. {"AUX_PCM_RX Audio Mixer", "MultiMedia1", "MM_DL1"},
  2772. {"AUX_PCM_RX Audio Mixer", "MultiMedia2", "MM_DL2"},
  2773. {"AUX_PCM_RX Audio Mixer", "MultiMedia3", "MM_DL3"},
  2774. {"AUX_PCM_RX Audio Mixer", "MultiMedia4", "MM_DL4"},
  2775. {"AUX_PCM_RX Audio Mixer", "MultiMedia5", "MM_DL5"},
  2776. {"AUX_PCM_RX Audio Mixer", "MultiMedia6", "MM_DL6"},
  2777. {"AUX_PCM_RX", NULL, "AUX_PCM_RX Audio Mixer"},
  2778. {"SEC_AUX_PCM_RX Audio Mixer", "MultiMedia1", "MM_DL1"},
  2779. {"SEC_AUX_PCM_RX Audio Mixer", "MultiMedia2", "MM_DL2"},
  2780. {"SEC_AUX_PCM_RX", NULL, "SEC_AUX_PCM_RX Audio Mixer"},
  2781. {"PRI_RX_Voice Mixer", "CSVoice", "CS-VOICE_DL1"},
  2782. {"PRI_RX_Voice Mixer", "VoLTE", "VoLTE_DL"},
  2783. {"PRI_RX_Voice Mixer", "Voice2", "VOICE2_DL"},
  2784. {"PRI_RX_Voice Mixer", "Voip", "VOIP_DL"},
  2785. {"PRI_RX_Voice Mixer", "Voice Stub", "VOICE_STUB_DL"},
  2786. {"PRI_RX_Voice Mixer", "DTMF", "DTMF_DL_HL"},
  2787. {"PRI_I2S_RX", NULL, "PRI_RX_Voice Mixer"},
  2788. {"SEC_RX_Voice Mixer", "CSVoice", "CS-VOICE_DL1"},
  2789. {"SEC_RX_Voice Mixer", "VoLTE", "VoLTE_DL"},
  2790. {"SEC_RX_Voice Mixer", "Voice2", "VOICE2_DL"},
  2791. {"SEC_RX_Voice Mixer", "Voip", "VOIP_DL"},
  2792. {"SEC_RX_Voice Mixer", "DTMF", "DTMF_DL_HL"},
  2793. {"SEC_I2S_RX", NULL, "SEC_RX_Voice Mixer"},
  2794. {"SLIM_0_RX_Voice Mixer", "CSVoice", "CS-VOICE_DL1"},
  2795. {"SLIM_0_RX_Voice Mixer", "VoLTE", "VoLTE_DL"},
  2796. {"SLIM_0_RX_Voice Mixer", "Voice2", "VOICE2_DL"},
  2797. {"SLIM_0_RX_Voice Mixer", "Voip", "VOIP_DL"},
  2798. {"SLIM_0_RX_Voice Mixer", "DTMF", "DTMF_DL_HL"},
  2799. {"SLIMBUS_0_RX", NULL, "SLIM_0_RX_Voice Mixer"},
  2800. {"INTERNAL_BT_SCO_RX_Voice Mixer", "CSVoice", "CS-VOICE_DL1"},
  2801. {"INTERNAL_BT_SCO_RX_Voice Mixer", "VoLTE", "VoLTE_DL"},
  2802. {"INTERNAL_BT_SCO_RX_Voice Mixer", "Voice2", "VOICE2_DL"},
  2803. {"INTERNAL_BT_SCO_RX_Voice Mixer", "Voip", "VOIP_DL"},
  2804. {"INTERNAL_BT_SCO_RX_Voice Mixer", "DTMF", "DTMF_DL_HL"},
  2805. {"INT_BT_SCO_RX", NULL, "INTERNAL_BT_SCO_RX_Voice Mixer"},
  2806. {"AFE_PCM_RX_Voice Mixer", "CSVoice", "CS-VOICE_DL1"},
  2807. {"AFE_PCM_RX_Voice Mixer", "VoLTE", "VoLTE_DL"},
  2808. {"AFE_PCM_RX_Voice Mixer", "Voice2", "VOICE2_DL"},
  2809. {"AFE_PCM_RX_Voice Mixer", "Voip", "VOIP_DL"},
  2810. {"AFE_PCM_RX_Voice Mixer", "DTMF", "DTMF_DL_HL"},
  2811. {"PCM_RX", NULL, "AFE_PCM_RX_Voice Mixer"},
  2812. {"AUX_PCM_RX_Voice Mixer", "CSVoice", "CS-VOICE_DL1"},
  2813. {"AUX_PCM_RX_Voice Mixer", "VoLTE", "VoLTE_DL"},
  2814. {"AUX_PCM_RX_Voice Mixer", "Voice2", "VOICE2_DL"},
  2815. {"AUX_PCM_RX_Voice Mixer", "Voip", "VOIP_DL"},
  2816. {"AUX_PCM_RX_Voice Mixer", "DTMF", "DTMF_DL_HL"},
  2817. {"AUX_PCM_RX", NULL, "AUX_PCM_RX_Voice Mixer"},
  2818. {"SEC_AUX_PCM_RX_Voice Mixer", "CSVoice", "CS-VOICE_DL1"},
  2819. {"SEC_AUX_PCM_RX_Voice Mixer", "VoLTE", "VoLTE_DL"},
  2820. {"SEC_AUX_PCM_RX_Voice Mixer", "Voice2", "VOICE2_DL"},
  2821. {"SEC_AUX_PCM_RX_Voice Mixer", "Voip", "VOIP_DL"},
  2822. {"SEC_AUX_PCM_RX_Voice Mixer", "DTMF", "DTMF_DL_HL"},
  2823. {"SEC_AUX_PCM_RX", NULL, "SEC_AUX_PCM_RX_Voice Mixer"},
  2824. {"HDMI_RX_Voice Mixer", "CSVoice", "CS-VOICE_DL1"},
  2825. {"HDMI_RX_Voice Mixer", "VoLTE", "VoLTE_DL"},
  2826. {"HDMI_RX_Voice Mixer", "Voice2", "VOICE2_DL"},
  2827. {"HDMI_RX_Voice Mixer", "Voip", "VOIP_DL"},
  2828. {"HDMI_RX_Voice Mixer", "DTMF", "DTMF_DL_HL"},
  2829. {"HDMI", NULL, "HDMI_RX_Voice Mixer"},
  2830. {"HDMI", NULL, "HDMI_DL_HL"},
  2831. {"VOC_EXT_EC MUX", "MI2S_TX" , "MI2S_TX"},
  2832. {"CS-VOICE_UL1", NULL, "VOC_EXT_EC MUX"},
  2833. {"Voice_Tx Mixer", "PRI_TX_Voice", "PRI_I2S_TX"},
  2834. {"Voice_Tx Mixer", "SEC_TX_Voice", "SEC_I2S_TX"},
  2835. {"Voice_Tx Mixer", "MI2S_TX_Voice", "MI2S_TX"},
  2836. {"Voice_Tx Mixer", "SLIM_0_TX_Voice", "SLIMBUS_0_TX"},
  2837. {"Voice_Tx Mixer", "INTERNAL_BT_SCO_TX_Voice", "INT_BT_SCO_TX"},
  2838. {"Voice_Tx Mixer", "AFE_PCM_TX_Voice", "PCM_TX"},
  2839. {"Voice_Tx Mixer", "AUX_PCM_TX_Voice", "AUX_PCM_TX"},
  2840. {"Voice_Tx Mixer", "SEC_AUX_PCM_TX_Voice", "SEC_AUX_PCM_TX"},
  2841. {"CS-VOICE_UL1", NULL, "Voice_Tx Mixer"},
  2842. {"VoLTE_Tx Mixer", "PRI_TX_VoLTE", "PRI_I2S_TX"},
  2843. {"VoLTE_Tx Mixer", "SEC_TX_VoLTE", "SEC_I2S_TX"},
  2844. {"VoLTE_Tx Mixer", "SLIM_0_TX_VoLTE", "SLIMBUS_0_TX"},
  2845. {"VoLTE_Tx Mixer", "INTERNAL_BT_SCO_TX_VoLTE", "INT_BT_SCO_TX"},
  2846. {"VoLTE_Tx Mixer", "AFE_PCM_TX_VoLTE", "PCM_TX"},
  2847. {"VoLTE_Tx Mixer", "AUX_PCM_TX_VoLTE", "AUX_PCM_TX"},
  2848. {"VoLTE_Tx Mixer", "SEC_AUX_PCM_TX_VoLTE", "SEC_AUX_PCM_TX"},
  2849. {"VoLTE_UL", NULL, "VoLTE_Tx Mixer"},
  2850. {"Voice2_Tx Mixer", "PRI_TX_Voice2", "PRI_I2S_TX"},
  2851. {"Voice2_Tx Mixer", "SEC_TX_Voice2", "SEC_I2S_TX"},
  2852. {"Voice2_Tx Mixer", "MI2S_TX_Voice2", "MI2S_TX"},
  2853. {"Voice2_Tx Mixer", "SLIM_0_TX_Voice2", "SLIMBUS_0_TX"},
  2854. {"Voice2_Tx Mixer", "INTERNAL_BT_SCO_TX_Voice2", "INT_BT_SCO_TX"},
  2855. {"Voice2_Tx Mixer", "AFE_PCM_TX_Voice2", "PCM_TX"},
  2856. {"Voice2_Tx Mixer", "AUX_PCM_TX_Voice2", "AUX_PCM_TX"},
  2857. {"Voice2_Tx Mixer", "SEC_AUX_PCM_TX_Voice2", "SEC_AUX_PCM_TX"},
  2858. {"VOICE2_UL", NULL, "Voice2_Tx Mixer"},
  2859. {"Voip_Tx Mixer", "PRI_TX_Voip", "PRI_I2S_TX"},
  2860. {"Voip_Tx Mixer", "SEC_TX_Voip", "SEC_I2S_TX"},
  2861. {"Voip_Tx Mixer", "MI2S_TX_Voip", "MI2S_TX"},
  2862. {"Voip_Tx Mixer", "SLIM_0_TX_Voip", "SLIMBUS_0_TX"},
  2863. {"Voip_Tx Mixer", "INTERNAL_BT_SCO_TX_Voip", "INT_BT_SCO_TX"},
  2864. {"Voip_Tx Mixer", "AFE_PCM_TX_Voip", "PCM_TX"},
  2865. {"Voip_Tx Mixer", "AUX_PCM_TX_Voip", "AUX_PCM_TX"},
  2866. {"Voip_Tx Mixer", "SEC_AUX_PCM_TX_Voip", "SEC_AUX_PCM_TX"},
  2867. {"VOIP_UL", NULL, "Voip_Tx Mixer"},
  2868. {"SLIMBUS_DL_HL", "Switch", "SLIM0_DL_HL"},
  2869. {"SLIMBUS_0_RX", NULL, "SLIMBUS_DL_HL"},
  2870. {"SLIM0_UL_HL", NULL, "SLIMBUS_0_TX"},
  2871. {"INT_FM_RX", NULL, "INTFM_DL_HL"},
  2872. {"INTFM_UL_HL", NULL, "INT_FM_TX"},
  2873. {"AUX_PCM_RX", NULL, "AUXPCM_DL_HL"},
  2874. {"AUXPCM_UL_HL", NULL, "AUX_PCM_TX"},
  2875. {"PCM_RX_DL_HL", "Switch", "SLIM0_DL_HL"},
  2876. {"PCM_RX", NULL, "PCM_RX_DL_HL"},
  2877. {"MI2S_UL_HL", NULL, "MI2S_TX"},
  2878. {"SEC_I2S_RX", NULL, "SEC_I2S_DL_HL"},
  2879. {"SLIMBUS_0_RX Port Mixer", "INTERNAL_FM_TX", "INT_FM_TX"},
  2880. {"SLIMBUS_0_RX Port Mixer", "SLIM_0_TX", "SLIMBUS_0_TX"},
  2881. {"SLIMBUS_0_RX Port Mixer", "AUX_PCM_UL_TX", "AUX_PCM_TX"},
  2882. {"SLIMBUS_0_RX Port Mixer", "MI2S_TX", "MI2S_TX"},
  2883. {"SLIMBUS_0_RX", NULL, "SLIMBUS_0_RX Port Mixer"},
  2884. {"AFE_PCM_RX Port Mixer", "INTERNAL_FM_TX", "INT_FM_TX"},
  2885. {"AFE_PCM_RX Port Mixer", "SLIM_1_TX", "SLIMBUS_1_TX"},
  2886. {"PCM_RX", NULL, "AFE_PCM_RX Port Mixer"},
  2887. {"AUXPCM_RX Port Mixer", "AUX_PCM_UL_TX", "AUX_PCM_TX"},
  2888. {"AUXPCM_RX Port Mixer", "SLIM_0_TX", "SLIMBUS_0_TX"},
  2889. {"AUX_PCM_RX", NULL, "AUXPCM_RX Port Mixer"},
  2890. {"Voice Stub Tx Mixer", "STUB_TX_HL", "STUB_TX"},
  2891. {"Voice Stub Tx Mixer", "SLIM_1_TX", "SLIMBUS_1_TX"},
  2892. {"Voice Stub Tx Mixer", "INTERNAL_BT_SCO_TX", "INT_BT_SCO_TX"},
  2893. {"Voice Stub Tx Mixer", "STUB_1_TX_HL", "STUB_1_TX"},
  2894. {"Voice Stub Tx Mixer", "MI2S_TX", "MI2S_TX"},
  2895. {"Voice Stub Tx Mixer", "SLIM_3_TX", "SLIMBUS_3_TX"},
  2896. {"Voice Stub Tx Mixer", "PRIMARY_I2S_TX", "PRI_I2S_TX"},
  2897. {"Voice Stub Tx Mixer", "SECONDARY_I2S_TX", "SEC_I2S_TX"},
  2898. {"Voice Stub Tx Mixer", "AFE_PCM_TX", "PCM_TX"},
  2899. {"VOICE_STUB_UL", NULL, "Voice Stub Tx Mixer"},
  2900. {"VoLTE Stub Tx Mixer", "STUB_TX_HL", "STUB_TX"},
  2901. {"VoLTE Stub Tx Mixer", "SLIM_1_TX", "SLIMBUS_1_TX"},
  2902. {"VoLTE Stub Tx Mixer", "INTERNAL_BT_SCO_TX", "INT_BT_SCO_TX"},
  2903. {"VoLTE Stub Tx Mixer", "STUB_1_TX_HL", "STUB_1_TX"},
  2904. {"VoLTE Stub Tx Mixer", "MI2S_TX", "MI2S_TX"},
  2905. {"VoLTE Stub Tx Mixer", "SLIM_3_TX", "SLIMBUS_3_TX"},
  2906. {"VoLTE Stub Tx Mixer", "PRIMARY_I2S_TX", "PRI_I2S_TX"},
  2907. {"VoLTE Stub Tx Mixer", "SECONDARY_I2S_TX", "SEC_I2S_TX"},
  2908. {"VoLTE Stub Tx Mixer", "AFE_PCM_TX", "PCM_TX"},
  2909. {"VOLTE_STUB_UL", NULL, "VoLTE Stub Tx Mixer"},
  2910. {"Voice2 Stub Tx Mixer", "STUB_TX_HL", "STUB_TX"},
  2911. {"Voice2 Stub Tx Mixer", "SLIM_1_TX", "SLIMBUS_1_TX"},
  2912. {"Voice2 Stub Tx Mixer", "INTERNAL_BT_SCO_TX", "INT_BT_SCO_TX"},
  2913. {"Voice2 Stub Tx Mixer", "STUB_1_TX_HL", "STUB_1_TX"},
  2914. {"Voice2 Stub Tx Mixer", "MI2S_TX", "MI2S_TX"},
  2915. {"Voice2 Stub Tx Mixer", "SLIM_3_TX", "SLIMBUS_3_TX"},
  2916. {"Voice2 Stub Tx Mixer", "PRIMARY_I2S_TX", "PRI_I2S_TX"},
  2917. {"Voice2 Stub Tx Mixer", "SECONDARY_I2S_TX", "SEC_I2S_TX"},
  2918. {"Voice2 Stub Tx Mixer", "AFE_PCM_TX", "PCM_TX"},
  2919. {"VOICE2_STUB_UL", NULL, "Voice2 Stub Tx Mixer"},
  2920. {"STUB_RX Mixer", "Voice Stub", "VOICE_STUB_DL"},
  2921. {"STUB_RX Mixer", "VoLTE Stub", "VOLTE_STUB_DL"},
  2922. {"STUB_RX Mixer", "Voice2 Stub", "VOICE2_STUB_DL"},
  2923. {"STUB_RX", NULL, "STUB_RX Mixer"},
  2924. {"SLIMBUS_1_RX Mixer", "Voice Stub", "VOICE_STUB_DL"},
  2925. {"SLIMBUS_1_RX Mixer", "VoLTE Stub", "VOLTE_STUB_DL"},
  2926. {"SLIMBUS_1_RX Mixer", "Voice2 Stub", "VOICE2_STUB_DL"},
  2927. {"SLIMBUS_1_RX", NULL, "SLIMBUS_1_RX Mixer"},
  2928. {"INTERNAL_BT_SCO_RX_Voice Mixer", "Voice Stub", "VOICE_STUB_DL"},
  2929. {"INTERNAL_BT_SCO_RX_Voice Mixer", "VoLTE Stub", "VOLTE_STUB_DL"},
  2930. {"INTERNAL_BT_SCO_RX_Voice Mixer", "Voice2 Stub", "VOICE2_STUB_DL"},
  2931. {"MI2S_RX_Voice Mixer", "Voice Stub", "VOICE_STUB_DL"},
  2932. {"MI2S_RX_Voice Mixer", "VoLTE Stub", "VOLTE_STUB_DL"},
  2933. {"MI2S_RX_Voice Mixer", "Voice2 Stub", "VOICE2_STUB_DL"},
  2934. {"MI2S_RX", NULL, "MI2S_RX_Voice Mixer"},
  2935. {"HDMI_RX_Voice Mixer", "Voice Stub", "VOICE_STUB_DL"},
  2936. {"HDMI_RX_Voice Mixer", "VoLTE Stub", "VOLTE_STUB_DL"},
  2937. {"HDMI_RX_Voice Mixer", "Voice2 Stub", "VOICE2_STUB_DL"},
  2938. {"AFE_PCM_RX_Voice Mixer", "Voice Stub", "VOICE_STUB_DL"},
  2939. {"AFE_PCM_RX_Voice Mixer", "VoLTE Stub", "VOLTE_STUB_DL"},
  2940. {"AFE_PCM_RX_Voice Mixer", "Voice2 Stub", "VOICE2_STUB_DL"},
  2941. {"SLIMBUS_3_RX_Voice Mixer", "Voice Stub", "VOICE_STUB_DL"},
  2942. {"SLIMBUS_3_RX_Voice Mixer", "VoLTE Stub", "VOLTE_STUB_DL"},
  2943. {"SLIMBUS_3_RX_Voice Mixer", "Voice2 Stub", "VOICE2_STUB_DL"},
  2944. {"SLIMBUS_3_RX", NULL, "SLIMBUS_3_RX_Voice Mixer"},
  2945. {"SLIMBUS_1_RX Port Mixer", "INTERNAL_BT_SCO_TX", "INT_BT_SCO_TX"},
  2946. {"SLIMBUS_1_RX Port Mixer", "AFE_PCM_TX", "PCM_TX"},
  2947. {"SLIMBUS_1_RX", NULL, "SLIMBUS_1_RX Port Mixer"},
  2948. {"INTERNAL_BT_SCO_RX Port Mixer", "SLIM_1_TX", "SLIMBUS_1_TX"},
  2949. {"INT_BT_SCO_RX", NULL, "INTERNAL_BT_SCO_RX Port Mixer"},
  2950. {"SLIMBUS_3_RX Port Mixer", "INTERNAL_BT_SCO_RX", "INT_BT_SCO_RX"},
  2951. {"SLIMBUS_3_RX Port Mixer", "MI2S_TX", "MI2S_TX"},
  2952. {"SLIMBUS_3_RX Port Mixer", "AFE_PCM_RX", "PCM_RX"},
  2953. {"SLIMBUS_3_RX", NULL, "SLIMBUS_3_RX Port Mixer"},
  2954. {"HDMI_RX Port Mixer", "MI2S_TX", "MI2S_TX"},
  2955. {"HDMI_RX Port Mixer", "SLIM_3_TX", "SLIMBUS_3_TX"},
  2956. {"HDMI", NULL, "HDMI_RX Port Mixer"},
  2957. {"SEC_I2S_RX Port Mixer", "MI2S_TX", "MI2S_TX"},
  2958. {"SEC_I2S_RX", NULL, "SEC_I2S_RX Port Mixer"},
  2959. {"PRI_I2S_RX Port Mixer", "MI2S_TX", "MI2S_TX"},
  2960. {"PRI_I2S_RX", NULL, "PRI_I2S_RX Port Mixer"},
  2961. {"MI2S_RX Port Mixer", "SLIM_1_TX", "SLIMBUS_1_TX"},
  2962. {"MI2S_RX Port Mixer", "PRIMARY_I2S_TX", "PRI_I2S_TX"},
  2963. {"MI2S_RX", NULL, "MI2S_RX Port Mixer"},
  2964. /* Backend Enablement */
  2965. {"BE_OUT", NULL, "PRI_I2S_RX"},
  2966. {"BE_OUT", NULL, "SEC_I2S_RX"},
  2967. {"BE_OUT", NULL, "SLIMBUS_0_RX"},
  2968. {"BE_OUT", NULL, "SLIMBUS_1_RX"},
  2969. {"BE_OUT", NULL, "SLIMBUS_3_RX"},
  2970. {"BE_OUT", NULL, "SLIMBUS_4_RX"},
  2971. {"BE_OUT", NULL, "HDMI"},
  2972. {"BE_OUT", NULL, "PSEUDO"},
  2973. {"BE_OUT", NULL, "MI2S_RX"},
  2974. {"PRI_I2S_TX", NULL, "BE_IN"},
  2975. {"SEC_I2S_TX", NULL, "BE_IN"},
  2976. {"MI2S_TX", NULL, "BE_IN"},
  2977. {"SLIMBUS_0_TX", NULL, "BE_IN" },
  2978. {"SLIMBUS_1_TX", NULL, "BE_IN" },
  2979. {"SLIMBUS_3_TX", NULL, "BE_IN" },
  2980. {"SLIMBUS_4_TX", NULL, "BE_IN" },
  2981. {"BE_OUT", NULL, "INT_BT_SCO_RX"},
  2982. {"INT_BT_SCO_TX", NULL, "BE_IN"},
  2983. {"BE_OUT", NULL, "INT_FM_RX"},
  2984. {"INT_FM_TX", NULL, "BE_IN"},
  2985. {"BE_OUT", NULL, "PCM_RX"},
  2986. {"PCM_TX", NULL, "BE_IN"},
  2987. {"BE_OUT", NULL, "STUB_RX"},
  2988. {"STUB_TX", NULL, "BE_IN"},
  2989. {"STUB_1_TX", NULL, "BE_IN"},
  2990. {"BE_OUT", NULL, "SEC_AUX_PCM_RX"},
  2991. {"SEC_AUX_PCM_TX", NULL, "BE_IN"},
  2992. {"BE_OUT", NULL, "AUX_PCM_RX"},
  2993. {"AUX_PCM_TX", NULL, "BE_IN"},
  2994. {"INCALL_RECORD_TX", NULL, "BE_IN"},
  2995. {"INCALL_RECORD_RX", NULL, "BE_IN"},
  2996. {"BE_OUT", NULL, "VOICE_PLAYBACK_TX"},
  2997. };
  2998. static int msm_pcm_routing_hw_params(struct snd_pcm_substream *substream,
  2999. struct snd_pcm_hw_params *params)
  3000. {
  3001. struct snd_soc_pcm_runtime *rtd = substream->private_data;
  3002. unsigned int be_id = rtd->dai_link->be_id;
  3003. if (be_id >= MSM_BACKEND_DAI_MAX) {
  3004. pr_err("%s: unexpected be_id %d\n", __func__, be_id);
  3005. return -EINVAL;
  3006. }
  3007. mutex_lock(&routing_lock);
  3008. msm_bedais[be_id].sample_rate = params_rate(params);
  3009. msm_bedais[be_id].channel = params_channels(params);
  3010. mutex_unlock(&routing_lock);
  3011. return 0;
  3012. }
  3013. static int msm_pcm_routing_close(struct snd_pcm_substream *substream)
  3014. {
  3015. struct snd_soc_pcm_runtime *rtd = substream->private_data;
  3016. unsigned int be_id = rtd->dai_link->be_id;
  3017. int i, session_type;
  3018. struct msm_pcm_routing_bdai_data *bedai;
  3019. if (be_id >= MSM_BACKEND_DAI_MAX) {
  3020. pr_err("%s: unexpected be_id %d\n", __func__, be_id);
  3021. return -EINVAL;
  3022. }
  3023. bedai = &msm_bedais[be_id];
  3024. session_type = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
  3025. 0 : 1);
  3026. mutex_lock(&routing_lock);
  3027. for_each_set_bit(i, &bedai->fe_sessions, MSM_FRONTEND_DAI_MM_SIZE) {
  3028. if (fe_dai_map[i][session_type].strm_id != INVALID_SESSION) {
  3029. fe_dai_map[i][session_type].be_srate =
  3030. bedai->sample_rate;
  3031. adm_close(bedai->port_id);
  3032. srs_port_id = -1;
  3033. }
  3034. }
  3035. bedai->active = 0;
  3036. bedai->sample_rate = 0;
  3037. bedai->channel = 0;
  3038. bedai->perf_mode = false;
  3039. mutex_unlock(&routing_lock);
  3040. return 0;
  3041. }
  3042. static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream)
  3043. {
  3044. struct snd_soc_pcm_runtime *rtd = substream->private_data;
  3045. unsigned int be_id = rtd->dai_link->be_id;
  3046. int i, path_type, session_type;
  3047. struct msm_pcm_routing_bdai_data *bedai;
  3048. u32 channels;
  3049. bool playback, capture;
  3050. struct msm_pcm_routing_fdai_data *fdai;
  3051. if (be_id >= MSM_BACKEND_DAI_MAX) {
  3052. pr_err("%s: unexpected be_id %d\n", __func__, be_id);
  3053. return -EINVAL;
  3054. }
  3055. bedai = &msm_bedais[be_id];
  3056. if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
  3057. path_type = ADM_PATH_PLAYBACK;
  3058. session_type = SESSION_TYPE_RX;
  3059. } else {
  3060. path_type = ADM_PATH_LIVE_REC;
  3061. session_type = SESSION_TYPE_TX;
  3062. }
  3063. mutex_lock(&routing_lock);
  3064. if (bedai->active == 1)
  3065. goto done; /* Ignore prepare if back-end already active */
  3066. /* AFE port is not active at this point. However, still
  3067. * go ahead setting active flag under the notion that
  3068. * QDSP6 is able to handle ADM starting before AFE port
  3069. * is started.
  3070. */
  3071. bedai->active = 1;
  3072. playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
  3073. capture = substream->stream == SNDRV_PCM_STREAM_CAPTURE;
  3074. for_each_set_bit(i, &bedai->fe_sessions, MSM_FRONTEND_DAI_MM_SIZE) {
  3075. fdai = &fe_dai_map[i][session_type];
  3076. if (fdai->strm_id != INVALID_SESSION) {
  3077. if (session_type == SESSION_TYPE_TX && fdai->be_srate &&
  3078. (fdai->be_srate != bedai->sample_rate)) {
  3079. pr_debug("%s: flush strm %d due diff BE rates\n",
  3080. __func__,
  3081. fdai->strm_id);
  3082. if (fdai->event_info.event_func)
  3083. fdai->event_info.event_func(
  3084. MSM_PCM_RT_EVT_BUF_RECFG,
  3085. fdai->event_info.priv_data);
  3086. fdai->be_srate = 0; /* might not need it */
  3087. }
  3088. channels = bedai->channel;
  3089. if (bedai->port_id == PSEUDOPORT_01) {
  3090. adm_multi_ch_copp_pseudo_open_v3(bedai->port_id,
  3091. path_type,
  3092. bedai->sample_rate,
  3093. channels > 6 ? 6 :
  3094. channels,
  3095. DEFAULT_COPP_TOPOLOGY);
  3096. } else if ((playback || capture)
  3097. && ((channels == 2) || (channels == 1)) &&
  3098. bedai->perf_mode) {
  3099. adm_multi_ch_copp_open(bedai->port_id,
  3100. path_type,
  3101. bedai->sample_rate,
  3102. channels,
  3103. DEFAULT_COPP_TOPOLOGY, bedai->perf_mode);
  3104. pr_debug("%s:configure COPP to lowlatency mode",
  3105. __func__);
  3106. } else if ((playback || capture)
  3107. && (channels > 2))
  3108. adm_multi_ch_copp_open(bedai->port_id,
  3109. path_type,
  3110. bedai->sample_rate,
  3111. channels,
  3112. DEFAULT_COPP_TOPOLOGY, bedai->perf_mode);
  3113. else
  3114. adm_open(bedai->port_id,
  3115. path_type,
  3116. bedai->sample_rate,
  3117. channels,
  3118. DEFAULT_COPP_TOPOLOGY);
  3119. msm_pcm_routing_build_matrix(i,
  3120. fdai->strm_id, path_type);
  3121. srs_port_id = bedai->port_id;
  3122. srs_send_params(srs_port_id, 1, 0);
  3123. }
  3124. }
  3125. done:
  3126. mutex_unlock(&routing_lock);
  3127. return 0;
  3128. }
  3129. static struct snd_pcm_ops msm_routing_pcm_ops = {
  3130. .hw_params = msm_pcm_routing_hw_params,
  3131. .close = msm_pcm_routing_close,
  3132. .prepare = msm_pcm_routing_prepare,
  3133. };
  3134. static unsigned int msm_routing_read(struct snd_soc_platform *platform,
  3135. unsigned int reg)
  3136. {
  3137. dev_dbg(platform->dev, "reg %x\n", reg);
  3138. return 0;
  3139. }
  3140. /* Not used but frame seems to require it */
  3141. static int msm_routing_write(struct snd_soc_platform *platform,
  3142. unsigned int reg, unsigned int val)
  3143. {
  3144. dev_dbg(platform->dev, "reg %x val %x\n", reg, val);
  3145. return 0;
  3146. }
  3147. /* Not used but frame seems to require it */
  3148. static int msm_routing_probe(struct snd_soc_platform *platform)
  3149. {
  3150. snd_soc_dapm_new_controls(&platform->dapm, msm_qdsp6_widgets,
  3151. ARRAY_SIZE(msm_qdsp6_widgets));
  3152. snd_soc_dapm_add_routes(&platform->dapm, intercon,
  3153. ARRAY_SIZE(intercon));
  3154. snd_soc_dapm_new_widgets(&platform->dapm);
  3155. snd_soc_add_platform_controls(platform,
  3156. int_fm_vol_mixer_controls,
  3157. ARRAY_SIZE(int_fm_vol_mixer_controls));
  3158. snd_soc_add_platform_controls(platform,
  3159. lpa_vol_mixer_controls,
  3160. ARRAY_SIZE(lpa_vol_mixer_controls));
  3161. snd_soc_add_platform_controls(platform,
  3162. eq_enable_mixer_controls,
  3163. ARRAY_SIZE(eq_enable_mixer_controls));
  3164. snd_soc_add_platform_controls(platform,
  3165. eq_band_mixer_controls,
  3166. ARRAY_SIZE(eq_band_mixer_controls));
  3167. snd_soc_add_platform_controls(platform,
  3168. eq_coeff_mixer_controls,
  3169. ARRAY_SIZE(eq_coeff_mixer_controls));
  3170. snd_soc_add_platform_controls(platform,
  3171. multimedia2_vol_mixer_controls,
  3172. ARRAY_SIZE(multimedia2_vol_mixer_controls));
  3173. snd_soc_add_platform_controls(platform,
  3174. multimedia5_vol_mixer_controls,
  3175. ARRAY_SIZE(multimedia5_vol_mixer_controls));
  3176. snd_soc_add_platform_controls(platform,
  3177. multimedia3_vol_mixer_controls,
  3178. ARRAY_SIZE(multimedia3_vol_mixer_controls));
  3179. snd_soc_add_platform_controls(platform,
  3180. compressed_vol_mixer_controls,
  3181. ARRAY_SIZE(compressed_vol_mixer_controls));
  3182. snd_soc_add_platform_controls(platform,
  3183. compressed2_vol_mixer_controls,
  3184. ARRAY_SIZE(compressed2_vol_mixer_controls));
  3185. snd_soc_add_platform_controls(platform,
  3186. compressed3_vol_mixer_controls,
  3187. ARRAY_SIZE(compressed3_vol_mixer_controls));
  3188. snd_soc_add_platform_controls(platform,
  3189. lpa_SRS_trumedia_controls,
  3190. ARRAY_SIZE(lpa_SRS_trumedia_controls));
  3191. snd_soc_add_platform_controls(platform,
  3192. lpa_SRS_trumedia_controls_HDMI,
  3193. ARRAY_SIZE(lpa_SRS_trumedia_controls_HDMI));
  3194. snd_soc_add_platform_controls(platform,
  3195. lpa_SRS_trumedia_controls_I2S,
  3196. ARRAY_SIZE(lpa_SRS_trumedia_controls_I2S));
  3197. snd_soc_add_platform_controls(platform,
  3198. lpa_SRS_SS3D_controls,
  3199. ARRAY_SIZE(lpa_SRS_SS3D_controls));
  3200. snd_soc_add_platform_controls(platform,
  3201. lpa_SRS_SS3D_controls_HDMI,
  3202. ARRAY_SIZE(lpa_SRS_SS3D_controls_HDMI));
  3203. snd_soc_add_platform_controls(platform,
  3204. lpa_SRS_SS3D_controls_I2S,
  3205. ARRAY_SIZE(lpa_SRS_SS3D_controls_I2S));
  3206. snd_soc_add_platform_controls(platform,
  3207. ec_ref_rx_mixer_controls,
  3208. ARRAY_SIZE(ec_ref_rx_mixer_controls));
  3209. return 0;
  3210. }
  3211. static struct snd_soc_platform_driver msm_soc_routing_platform = {
  3212. .ops = &msm_routing_pcm_ops,
  3213. .probe = msm_routing_probe,
  3214. .read = msm_routing_read,
  3215. .write = msm_routing_write,
  3216. };
  3217. static __devinit int msm_routing_pcm_probe(struct platform_device *pdev)
  3218. {
  3219. dev_dbg(&pdev->dev, "dev name %s\n", dev_name(&pdev->dev));
  3220. return snd_soc_register_platform(&pdev->dev,
  3221. &msm_soc_routing_platform);
  3222. }
  3223. static int msm_routing_pcm_remove(struct platform_device *pdev)
  3224. {
  3225. snd_soc_unregister_platform(&pdev->dev);
  3226. return 0;
  3227. }
  3228. static struct platform_driver msm_routing_pcm_driver = {
  3229. .driver = {
  3230. .name = "msm-pcm-routing",
  3231. .owner = THIS_MODULE,
  3232. },
  3233. .probe = msm_routing_pcm_probe,
  3234. .remove = __devexit_p(msm_routing_pcm_remove),
  3235. };
  3236. int msm_routing_check_backend_enabled(int fedai_id)
  3237. {
  3238. int i;
  3239. if (fedai_id >= MSM_FRONTEND_DAI_MM_MAX_ID) {
  3240. /* bad ID assigned in machine driver */
  3241. pr_err("%s: bad MM ID\n", __func__);
  3242. return 0;
  3243. }
  3244. for (i = 0; i < MSM_BACKEND_DAI_MAX; i++) {
  3245. if (test_bit(fedai_id, &msm_bedais[i].fe_sessions))
  3246. return msm_bedais[i].active;
  3247. }
  3248. return 0;
  3249. }
  3250. static int __init msm_soc_routing_platform_init(void)
  3251. {
  3252. mutex_init(&routing_lock);
  3253. return platform_driver_register(&msm_routing_pcm_driver);
  3254. }
  3255. module_init(msm_soc_routing_platform_init);
  3256. static void __exit msm_soc_routing_platform_exit(void)
  3257. {
  3258. platform_driver_unregister(&msm_routing_pcm_driver);
  3259. }
  3260. module_exit(msm_soc_routing_platform_exit);
  3261. MODULE_DESCRIPTION("MSM routing platform driver");
  3262. MODULE_LICENSE("GPL v2");