apr_audio-v2.h 392 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _APR_AUDIO_V2_H_
  6. #define _APR_AUDIO_V2_H_
  7. #include <ipc/apr.h>
  8. #include <audio/linux/msm_audio.h>
  9. /* number of threshold levels in speaker protection module */
  10. #define MAX_CPS_LEVELS 3
  11. /* size of header needed for passing data out of band */
  12. #define APR_CMD_OB_HDR_SZ 12
  13. /* size of header needed for getting data */
  14. #define APR_CMD_GET_HDR_SZ 16
  15. struct param_outband {
  16. size_t size;
  17. void *kvaddr;
  18. phys_addr_t paddr;
  19. };
  20. /* Common structures and definitions used for instance ID support */
  21. /* Instance ID definitions */
  22. #define INSTANCE_ID_0 0x0000
  23. struct mem_mapping_hdr {
  24. /*
  25. * LSW of parameter data payload address. Supported values: any.
  26. * - Must be set to zero for in-band data.
  27. */
  28. u32 data_payload_addr_lsw;
  29. /*
  30. * MSW of Parameter data payload address. Supported values: any.
  31. * - Must be set to zero for in-band data.
  32. * - In the case of 32 bit Shared memory address, MSW field must be
  33. * set to zero.
  34. * - In the case of 36 bit shared memory address, bit 31 to bit 4 of
  35. * MSW must be set to zero.
  36. */
  37. u32 data_payload_addr_msw;
  38. /*
  39. * Memory map handle returned by DSP through
  40. * ASM_CMD_SHARED_MEM_MAP_REGIONS command.
  41. * Supported Values: Any.
  42. * If memory map handle is NULL, the parameter data payloads are
  43. * within the message payload (in-band).
  44. * If memory map handle is non-NULL, the parameter data payloads begin
  45. * at the address specified in the address MSW and LSW (out-of-band).
  46. */
  47. u32 mem_map_handle;
  48. } __packed;
  49. /*
  50. * Payload format for parameter data.
  51. * Immediately following these structures are param_size bytes of parameter
  52. * data.
  53. */
  54. struct param_hdr_v1 {
  55. /* Valid ID of the module. */
  56. uint32_t module_id;
  57. /* Valid ID of the parameter. */
  58. uint32_t param_id;
  59. /* The size of the parameter specified by the module/param ID combo */
  60. uint16_t param_size;
  61. /* This field must be set to zero. */
  62. uint16_t reserved;
  63. } __packed;
  64. struct param_hdr_v2 {
  65. /* Valid ID of the module. */
  66. uint32_t module_id;
  67. /* Valid ID of the parameter. */
  68. uint32_t param_id;
  69. /* The size of the parameter specified by the module/param ID combo */
  70. uint32_t param_size;
  71. } __packed;
  72. struct param_hdr_v3 {
  73. /* Valid ID of the module. */
  74. uint32_t module_id;
  75. /* Instance of the module. */
  76. uint16_t instance_id;
  77. /* This field must be set to zero. */
  78. uint16_t reserved;
  79. /* Valid ID of the parameter. */
  80. uint32_t param_id;
  81. /* The size of the parameter specified by the module/param ID combo */
  82. uint32_t param_size;
  83. } __packed;
  84. /* A union of all param_hdr versions for versitility and max size */
  85. union param_hdrs {
  86. struct param_hdr_v1 v1;
  87. struct param_hdr_v2 v2;
  88. struct param_hdr_v3 v3;
  89. };
  90. struct module_instance_info {
  91. /* Module ID. */
  92. u32 module_id;
  93. /* Instance of the module */
  94. u16 instance_id;
  95. /* Reserved. This field must be set to zero. */
  96. u16 reserved;
  97. } __packed;
  98. /* Begin service specific definitions and structures */
  99. #define ADSP_ADM_VERSION 0x00070000
  100. #define ADM_CMD_SHARED_MEM_MAP_REGIONS 0x00010322
  101. #define ADM_CMDRSP_SHARED_MEM_MAP_REGIONS 0x00010323
  102. #define ADM_CMD_SHARED_MEM_UNMAP_REGIONS 0x00010324
  103. #define ADM_CMD_MATRIX_MAP_ROUTINGS_V5 0x00010325
  104. #define ADM_CMD_STREAM_DEVICE_MAP_ROUTINGS_V5 0x0001033D
  105. /* Enumeration for an audio Rx matrix ID.*/
  106. #define ADM_MATRIX_ID_AUDIO_RX 0
  107. #define ADM_MATRIX_ID_AUDIO_TX 1
  108. #define ADM_MATRIX_ID_COMPRESSED_AUDIO_RX 2
  109. #define ADM_MATRIX_ID_COMPRESSED_AUDIO_TX 3
  110. #define ADM_MATRIX_ID_LISTEN_TX 4
  111. /* Enumeration for an audio Tx matrix ID.*/
  112. #define ADM_MATRIX_ID_AUDIOX 1
  113. #define ADM_MAX_COPPS 5
  114. /* make sure this matches with msm_audio_calibration */
  115. #define SP_V2_NUM_MAX_SPKR 2
  116. /* Session map node structure.
  117. * Immediately following this structure are num_copps
  118. * entries of COPP IDs. The COPP IDs are 16 bits, so
  119. * there might be a padding 16-bit field if num_copps
  120. * is odd.
  121. */
  122. struct adm_session_map_node_v5 {
  123. u16 session_id;
  124. /* Handle of the ASM session to be routed. Supported values: 1
  125. * to 8.
  126. */
  127. u16 num_copps;
  128. /* Number of COPPs to which this session is to be routed.
  129. * Supported values: 0 < num_copps <= ADM_MAX_COPPS.
  130. */
  131. } __packed;
  132. /* Payload of the #ADM_CMD_MATRIX_MAP_ROUTINGS_V5 command.
  133. * Immediately following this structure are num_sessions of the session map
  134. * node payload (adm_session_map_node_v5).
  135. */
  136. struct adm_cmd_matrix_map_routings_v5 {
  137. struct apr_hdr hdr;
  138. u32 matrix_id;
  139. /* Specifies whether the matrix ID is Audio Rx (0) or Audio Tx
  140. * (1). Use the ADM_MATRIX_ID_AUDIO_RX or ADM_MATRIX_ID_AUDIOX
  141. * macros to set this field.
  142. */
  143. u32 num_sessions;
  144. /* Number of sessions being updated by this command (optional). */
  145. } __packed;
  146. /* This command allows a client to open a COPP/Voice Proc. TX module
  147. * and sets up the device session: Matrix -> COPP -> AFE on the RX
  148. * and AFE -> COPP -> Matrix on the TX. This enables PCM data to
  149. * be transferred to/from the endpoint (AFEPortID).
  150. *
  151. * @return
  152. * #ADM_CMDRSP_DEVICE_OPEN_V5 with the resulting status and COPP ID.
  153. */
  154. #define ADM_CMD_DEVICE_OPEN_V5 0x00010326
  155. /* This command allows a client to open a COPP/Voice Proc the
  156. * way as ADM_CMD_DEVICE_OPEN_V5 but supports multiple endpoint2
  157. * channels.
  158. *
  159. * @return
  160. * #ADM_CMDRSP_DEVICE_OPEN_V6 with the resulting status and
  161. * COPP ID.
  162. */
  163. #define ADM_CMD_DEVICE_OPEN_V6 0x00010356
  164. /* This command allows a client to open a COPP/Voice Proc the
  165. * way as ADM_CMD_DEVICE_OPEN_V8 but supports any number channel
  166. * of configuration.
  167. *
  168. * @return
  169. * #ADM_CMDRSP_DEVICE_OPEN_V8 with the resulting status and
  170. * COPP ID.
  171. */
  172. #define ADM_CMD_DEVICE_OPEN_V8 0x0001036A
  173. /* Definition for a low latency stream session. */
  174. #define ADM_LOW_LATENCY_DEVICE_SESSION 0x2000
  175. /* Definition for a ultra low latency stream session. */
  176. #define ADM_ULTRA_LOW_LATENCY_DEVICE_SESSION 0x4000
  177. /* Definition for a ultra low latency with Post Processing stream session. */
  178. #define ADM_ULL_POST_PROCESSING_DEVICE_SESSION 0x8000
  179. /* Definition for a legacy device session. */
  180. #define ADM_LEGACY_DEVICE_SESSION 0
  181. /* Indicates that endpoint_id_2 is to be ignored.*/
  182. #define ADM_CMD_COPP_OPEN_END_POINT_ID_2_IGNORE 0xFFFF
  183. #define ADM_CMD_COPP_OPEN_MODE_OF_OPERATION_RX_PATH_COPP 1
  184. #define ADM_CMD_COPP_OPEN_MODE_OF_OPERATIONX_PATH_LIVE_COPP 2
  185. #define ADM_CMD_COPP_OPEN_MODE_OF_OPERATIONX_PATH_NON_LIVE_COPP 3
  186. /* Indicates that an audio COPP is to send/receive a mono PCM
  187. * stream to/from
  188. * END_POINT_ID_1.
  189. */
  190. #define ADM_CMD_COPP_OPEN_CHANNEL_CONFIG_MONO 1
  191. /* Indicates that an audio COPP is to send/receive a
  192. * stereo PCM stream to/from END_POINT_ID_1.
  193. */
  194. #define ADM_CMD_COPP_OPEN_CHANNEL_CONFIG_STEREO 2
  195. /* Sample rate is 8000 Hz.*/
  196. #define ADM_CMD_COPP_OPEN_SAMPLE_RATE_8K 8000
  197. /* Sample rate is 16000 Hz.*/
  198. #define ADM_CMD_COPP_OPEN_SAMPLE_RATE_16K 16000
  199. /* Sample rate is 32000 Hz.*/
  200. #define ADM_CMD_COPP_OPEN_SAMPLE_RATE_32K 32000
  201. /* Sample rate is 48000 Hz.*/
  202. #define ADM_CMD_COPP_OPEN_SAMPLE_RATE_48K 48000
  203. /* Definition for a COPP live input flag bitmask.*/
  204. #define ADM_BIT_MASK_COPP_LIVE_INPUT_FLAG (0x0001U)
  205. /* Definition for a COPP live shift value bitmask.*/
  206. #define ADM_SHIFT_COPP_LIVE_INPUT_FLAG 0
  207. /* Definition for the COPP ID bitmask.*/
  208. #define ADM_BIT_MASK_COPP_ID (0x0000FFFFUL)
  209. /* Definition for the COPP ID shift value.*/
  210. #define ADM_SHIFT_COPP_ID 0
  211. /* Definition for the service ID bitmask.*/
  212. #define ADM_BIT_MASK_SERVICE_ID (0x00FF0000UL)
  213. /* Definition for the service ID shift value.*/
  214. #define ADM_SHIFT_SERVICE_ID 16
  215. /* Definition for the domain ID bitmask.*/
  216. #define ADM_BIT_MASK_DOMAIN_ID (0xFF000000UL)
  217. /* Definition for the domain ID shift value.*/
  218. #define ADM_SHIFT_DOMAIN_ID 24
  219. /* ADM device open command payload of the
  220. * #ADM_CMD_DEVICE_OPEN_V5 command.
  221. */
  222. struct adm_cmd_device_open_v5 {
  223. struct apr_hdr hdr;
  224. u16 flags;
  225. /* Reserved for future use. Clients must set this field
  226. * to zero.
  227. */
  228. u16 mode_of_operation;
  229. /* Specifies whether the COPP must be opened on the Tx or Rx
  230. * path. Use the ADM_CMD_COPP_OPEN_MODE_OF_OPERATION_* macros for
  231. * supported values and interpretation.
  232. * Supported values:
  233. * - 0x1 -- Rx path COPP
  234. * - 0x2 -- Tx path live COPP
  235. * - 0x3 -- Tx path nonlive COPP
  236. * Live connections cause sample discarding in the Tx device
  237. * matrix if the destination output ports do not pull them
  238. * fast enough. Nonlive connections queue the samples
  239. * indefinitely.
  240. */
  241. u16 endpoint_id_1;
  242. /* Logical and physical endpoint ID of the audio path.
  243. * If the ID is a voice processor Tx block, it receives near
  244. * samples. Supported values: Any pseudoport, AFE Rx port,
  245. * or AFE Tx port For a list of valid IDs, refer to
  246. * @xhyperref{Q4,[Q4]}.
  247. * Q4 = Hexagon Multimedia: AFE Interface Specification
  248. */
  249. u16 endpoint_id_2;
  250. /* Logical and physical endpoint ID 2 for a voice processor
  251. * Tx block.
  252. * This is not applicable to audio COPP.
  253. * Supported values:
  254. * - AFE Rx port
  255. * - 0xFFFF -- Endpoint 2 is unavailable and the voice
  256. * processor Tx
  257. * block ignores this endpoint
  258. * When the voice processor Tx block is created on the audio
  259. * record path,
  260. * it can receive far-end samples from an AFE Rx port if the
  261. * voice call
  262. * is active. The ID of the AFE port is provided in this
  263. * field.
  264. * For a list of valid IDs, refer @xhyperref{Q4,[Q4]}.
  265. */
  266. u32 topology_id;
  267. /* Audio COPP topology ID; 32-bit GUID. */
  268. u16 dev_num_channel;
  269. /* Number of channels the audio COPP sends to/receives from
  270. * the endpoint.
  271. * Supported values: 1 to 8.
  272. * The value is ignored for the voice processor Tx block,
  273. * where channel
  274. * configuration is derived from the topology ID.
  275. */
  276. u16 bit_width;
  277. /* Bit width (in bits) that the audio COPP sends to/receives
  278. * from the
  279. * endpoint. The value is ignored for the voice processing
  280. * Tx block,
  281. * where the PCM width is 16 bits.
  282. */
  283. u32 sample_rate;
  284. /* Sampling rate at which the audio COPP/voice processor
  285. * Tx block
  286. * interfaces with the endpoint.
  287. * Supported values for voice processor Tx: 8000, 16000,
  288. * 48000 Hz
  289. * Supported values for audio COPP: >0 and <=192 kHz
  290. */
  291. u8 dev_channel_mapping[8];
  292. /* Array of channel mapping of buffers that the audio COPP
  293. * sends to the endpoint. Channel[i] mapping describes channel
  294. * I inside the buffer, where 0 < i < dev_num_channel.
  295. * This value is relevant only for an audio Rx COPP.
  296. * For the voice processor block and Tx audio block, this field
  297. * is set to zero and is ignored.
  298. */
  299. } __packed;
  300. /* ADM device open command payload of the
  301. * #ADM_CMD_DEVICE_OPEN_V6 command.
  302. */
  303. struct adm_cmd_device_open_v6 {
  304. struct apr_hdr hdr;
  305. u16 flags;
  306. /* Reserved for future use. Clients must set this field
  307. * to zero.
  308. */
  309. u16 mode_of_operation;
  310. /* Specifies whether the COPP must be opened on the Tx or Rx
  311. * path. Use the ADM_CMD_COPP_OPEN_MODE_OF_OPERATION_* macros for
  312. * supported values and interpretation.
  313. * Supported values:
  314. * - 0x1 -- Rx path COPP
  315. * - 0x2 -- Tx path live COPP
  316. * - 0x3 -- Tx path nonlive COPP
  317. * Live connections cause sample discarding in the Tx device
  318. * matrix if the destination output ports do not pull them
  319. * fast enough. Nonlive connections queue the samples
  320. * indefinitely.
  321. */
  322. u16 endpoint_id_1;
  323. /* Logical and physical endpoint ID of the audio path.
  324. * If the ID is a voice processor Tx block, it receives near
  325. * samples. Supported values: Any pseudoport, AFE Rx port,
  326. * or AFE Tx port For a list of valid IDs, refer to
  327. * @xhyperref{Q4,[Q4]}.
  328. * Q4 = Hexagon Multimedia: AFE Interface Specification
  329. */
  330. u16 endpoint_id_2;
  331. /* Logical and physical endpoint ID 2 for a voice processor
  332. * Tx block.
  333. * This is not applicable to audio COPP.
  334. * Supported values:
  335. * - AFE Rx port
  336. * - 0xFFFF -- Endpoint 2 is unavailable and the voice
  337. * processor Tx
  338. * block ignores this endpoint
  339. * When the voice processor Tx block is created on the audio
  340. * record path,
  341. * it can receive far-end samples from an AFE Rx port if the
  342. * voice call
  343. * is active. The ID of the AFE port is provided in this
  344. * field.
  345. * For a list of valid IDs, refer @xhyperref{Q4,[Q4]}.
  346. */
  347. u32 topology_id;
  348. /* Audio COPP topology ID; 32-bit GUID. */
  349. u16 dev_num_channel;
  350. /* Number of channels the audio COPP sends to/receives from
  351. * the endpoint.
  352. * Supported values: 1 to 8.
  353. * The value is ignored for the voice processor Tx block,
  354. * where channel
  355. * configuration is derived from the topology ID.
  356. */
  357. u16 bit_width;
  358. /* Bit width (in bits) that the audio COPP sends to/receives
  359. * from the
  360. * endpoint. The value is ignored for the voice processing
  361. * Tx block,
  362. * where the PCM width is 16 bits.
  363. */
  364. u32 sample_rate;
  365. /* Sampling rate at which the audio COPP/voice processor
  366. * Tx block
  367. * interfaces with the endpoint.
  368. * Supported values for voice processor Tx: 8000, 16000,
  369. * 48000 Hz
  370. * Supported values for audio COPP: >0 and <=192 kHz
  371. */
  372. u8 dev_channel_mapping[8];
  373. /* Array of channel mapping of buffers that the audio COPP
  374. * sends to the endpoint. Channel[i] mapping describes channel
  375. * I inside the buffer, where 0 < i < dev_num_channel.
  376. * This value is relevant only for an audio Rx COPP.
  377. * For the voice processor block and Tx audio block, this field
  378. * is set to zero and is ignored.
  379. */
  380. u16 dev_num_channel_eid2;
  381. /* Number of channels the voice processor block sends
  382. * to/receives from the endpoint2.
  383. * Supported values: 1 to 8.
  384. * The value is ignored for audio COPP or if endpoint_id_2 is
  385. * set to 0xFFFF.
  386. */
  387. u16 bit_width_eid2;
  388. /* Bit width (in bits) that the voice processor sends
  389. * to/receives from the endpoint2.
  390. * Supported values: 16 and 24.
  391. * The value is ignored for audio COPP or if endpoint_id_2 is
  392. * set to 0xFFFF.
  393. */
  394. u32 sample_rate_eid2;
  395. /* Sampling rate at which the voice processor Tx block
  396. * interfaces with the endpoint2.
  397. * Supported values for Tx voice processor: >0 and <=384 kHz
  398. * The value is ignored for audio COPP or if endpoint_id_2 is
  399. * set to 0xFFFF.
  400. */
  401. u8 dev_channel_mapping_eid2[8];
  402. /* Array of channel mapping of buffers that the voice processor
  403. * sends to the endpoint. Channel[i] mapping describes channel
  404. * I inside the buffer, where 0 < i < dev_num_channel.
  405. * This value is relevant only for the Tx voice processor.
  406. * The values are ignored for audio COPP or if endpoint_id_2 is
  407. * set to 0xFFFF.
  408. */
  409. } __packed;
  410. /* ADM device open endpoint payload the
  411. * #ADM_CMD_DEVICE_OPEN_V8 command.
  412. */
  413. struct adm_device_endpoint_payload {
  414. u16 dev_num_channel;
  415. /* Number of channels the audio COPP sends to/receives from
  416. * the endpoint.
  417. * Supported values: 1 to 32.
  418. * The value is ignored for the voice processor Tx block,
  419. * where channel
  420. * configuration is derived from the topology ID.
  421. */
  422. u16 bit_width;
  423. /* Bit width (in bits) that the audio COPP sends to/receives
  424. * from the
  425. * endpoint. The value is ignored for the voice processing
  426. * Tx block,
  427. * where the PCM width is 16 bits.
  428. */
  429. u32 sample_rate;
  430. /* Sampling rate at which the audio COPP/voice processor
  431. * Tx block
  432. * interfaces with the endpoint.
  433. * Supported values for voice processor Tx: 8000, 16000,
  434. * 48000 Hz
  435. * Supported values for audio COPP: >0 and <=192 kHz
  436. */
  437. u8 dev_channel_mapping[32];
  438. } __packed;
  439. /* ADM device open command payload of the
  440. * #ADM_CMD_DEVICE_OPEN_V8 command.
  441. */
  442. struct adm_cmd_device_open_v8 {
  443. struct apr_hdr hdr;
  444. u16 flags;
  445. /* Bit width Native mode enabled : 11th bit of flag parameter
  446. * If 11th bit of flag is set then that means matrix mixer will be
  447. * running in native mode for bit width for this device session.
  448. *
  449. * Channel Native mode enabled : 12th bit of flag parameter
  450. * If 12th bit of flag is set then that means matrix mixer will be
  451. * running in native mode for channel configuration for this device session.
  452. * All other bits are reserved; clients must set them to 0.
  453. */
  454. u16 mode_of_operation;
  455. /* Specifies whether the COPP must be opened on the Tx or Rx
  456. * path. Use the ADM_CMD_COPP_OPEN_MODE_OF_OPERATION_* macros for
  457. * supported values and interpretation.
  458. * Supported values:
  459. * - 0x1 -- Rx path COPP
  460. * - 0x2 -- Tx path live COPP
  461. * - 0x3 -- Tx path nonlive COPP
  462. * Live connections cause sample discarding in the Tx device
  463. * matrix if the destination output ports do not pull them
  464. * fast enough. Nonlive connections queue the samples
  465. * indefinitely.
  466. */
  467. u32 topology_id;
  468. /* Audio COPP topology ID; 32-bit GUID. */
  469. u16 endpoint_id_1;
  470. /* Logical and physical endpoint ID of the audio path.
  471. * If the ID is a voice processor Tx block, it receives near
  472. * samples.
  473. * Supported values: Any pseudoport, AFE Rx port,
  474. * or AFE Tx port For a list of valid IDs, refer to
  475. * @xhyperref{Q4,[Q4]}.
  476. * Q4 = Hexagon Multimedia: AFE Interface Specification
  477. */
  478. u16 endpoint_id_2;
  479. /* Logical and physical endpoint ID 2 for a voice processor
  480. * Tx block.
  481. * This is not applicable to audio COPP.
  482. * Supported values:
  483. * - AFE Rx port
  484. * - 0xFFFF -- Endpoint 2 is unavailable and the voice
  485. * processor Tx
  486. * block ignores this endpoint
  487. * When the voice processor Tx block is created on the audio
  488. * record path,
  489. * it can receive far-end samples from an AFE Rx port if the
  490. * voice call
  491. * is active. The ID of the AFE port is provided in this
  492. * field.
  493. * For a list of valid IDs, refer @xhyperref{Q4,[Q4]}.
  494. */
  495. u16 endpoint_id_3;
  496. /*
  497. * Logical and physical endpoint ID of the audio path.
  498. * This indicated afe rx port in ADM loopback use cases.
  499. * In all other use cases this should be set to 0xffff
  500. */
  501. u16 compressed_data_type;
  502. } __packed;
  503. /*
  504. * This command allows the client to close a COPP and disconnect
  505. * the device session.
  506. */
  507. #define ADM_CMD_DEVICE_CLOSE_V5 0x00010327
  508. /* Sets one or more parameters to a COPP. */
  509. #define ADM_CMD_SET_PP_PARAMS_V5 0x00010328
  510. #define ADM_CMD_SET_PP_PARAMS_V6 0x0001035D
  511. /*
  512. * Structure of the ADM Set PP Params command. Parameter data must be
  513. * pre-packed with correct header for either V2 or V3 when sent in-band.
  514. * Use q6core_pack_pp_params to pack the header and data correctly depending on
  515. * Instance ID support.
  516. */
  517. struct adm_cmd_set_pp_params {
  518. /* APR Header */
  519. struct apr_hdr apr_hdr;
  520. /* The memory mapping header to be used when sending out of band */
  521. struct mem_mapping_hdr mem_hdr;
  522. /*
  523. * Size in bytes of the variable payload accompanying this
  524. * message or
  525. * in shared memory. This is used for parsing the parameter
  526. * payload.
  527. */
  528. u32 payload_size;
  529. /*
  530. * Parameter data for in band payload. This should be structured as the
  531. * parameter header immediately followed by the parameter data. Multiple
  532. * parameters can be set in one command by repeating the header followed
  533. * by the data for as many parameters as need to be set.
  534. * Use q6core_pack_pp_params to pack the header and data correctly
  535. * depending on Instance ID support.
  536. */
  537. u8 param_data[0];
  538. } __packed;
  539. #define ASM_STREAM_CMD_REGISTER_PP_EVENTS 0x00013213
  540. #define ASM_STREAM_PP_EVENT 0x00013214
  541. #define ASM_STREAM_CMD_REGISTER_IEC_61937_FMT_UPDATE 0x1321C
  542. #define ASM_IEC_61937_MEDIA_FMT_EVENT 0x1321D
  543. #define DSP_STREAM_CMD "ADSP Stream Cmd"
  544. #define DSP_STREAM_CALLBACK "ADSP Stream Callback Event"
  545. #define DSP_STREAM_CALLBACK_QUEUE_SIZE 1024
  546. struct dsp_stream_callback_list {
  547. struct list_head list;
  548. struct msm_adsp_event_data event;
  549. };
  550. struct dsp_stream_callback_prtd {
  551. uint16_t event_count;
  552. struct list_head event_queue;
  553. spinlock_t prtd_spin_lock;
  554. };
  555. /* set customized mixing on matrix mixer */
  556. #define ADM_CMD_SET_PSPD_MTMX_STRTR_PARAMS_V5 0x00010344
  557. struct adm_cmd_set_pspd_mtmx_strtr_params_v5 {
  558. struct apr_hdr hdr;
  559. /* LSW of parameter data payload address.*/
  560. u32 payload_addr_lsw;
  561. /* MSW of parameter data payload address.*/
  562. u32 payload_addr_msw;
  563. /* Memory map handle returned by ADM_CMD_SHARED_MEM_MAP_REGIONS */
  564. /* command. If mem_map_handle is zero implies the message is in */
  565. /* the payload */
  566. u32 mem_map_handle;
  567. /* Size in bytes of the variable payload accompanying this */
  568. /* message or in shared memory. This is used for parsing the */
  569. /* parameter payload. */
  570. u32 payload_size;
  571. u16 direction;
  572. u16 sessionid;
  573. u16 deviceid;
  574. u16 reserved;
  575. } __packed;
  576. /* set customized mixing on matrix mixer.
  577. * Updated to account for both LSM as well as ASM path.
  578. */
  579. #define ADM_CMD_SET_PSPD_MTMX_STRTR_PARAMS_V6 0x00010364
  580. struct adm_cmd_set_pspd_mtmx_strtr_params_v6 {
  581. struct apr_hdr hdr;
  582. /* LSW of parameter data payload address.*/
  583. u32 payload_addr_lsw;
  584. /* MSW of parameter data payload address.*/
  585. u32 payload_addr_msw;
  586. /* Memory map handle returned by ADM_CMD_SHARED_MEM_MAP_REGIONS */
  587. /* command. If mem_map_handle is zero implies the message is in */
  588. /* the payload */
  589. u32 mem_map_handle;
  590. /* Size in bytes of the variable payload accompanying this */
  591. /* message or in shared memory. This is used for parsing the */
  592. /* parameter payload. */
  593. u32 payload_size;
  594. u16 direction;
  595. u16 sessionid;
  596. u16 deviceid;
  597. u16 stream_type;
  598. } __packed;
  599. /* Returns the status and COPP ID to an #ADM_CMD_DEVICE_OPEN_V5 command.
  600. */
  601. #define ADM_CMDRSP_DEVICE_OPEN_V5 0x00010329
  602. /* Payload of the #ADM_CMDRSP_DEVICE_OPEN_V5 message,
  603. * which returns the
  604. * status and COPP ID to an #ADM_CMD_DEVICE_OPEN_V5 command.
  605. */
  606. struct adm_cmd_rsp_device_open_v5 {
  607. u32 status;
  608. /* Status message (error code).*/
  609. u16 copp_id;
  610. /* COPP ID: Supported values: 0 <= copp_id < ADM_MAX_COPPS*/
  611. u16 reserved;
  612. /* Reserved. This field must be set to zero.*/
  613. } __packed;
  614. /* Returns the status and COPP ID to an #ADM_CMD_DEVICE_OPEN_V6 command. */
  615. #define ADM_CMDRSP_DEVICE_OPEN_V6 0x00010357
  616. /* Returns the status and COPP ID to an #ADM_CMD_DEVICE_OPEN_V8 command. */
  617. #define ADM_CMDRSP_DEVICE_OPEN_V8 0x0001036B
  618. /* Payload of the #ADM_CMDRSP_DEVICE_OPEN_V6 message,
  619. * which returns the
  620. * status and COPP ID to an #ADM_CMD_DEVICE_OPEN_V6 command
  621. * is the exact same as ADM_CMDRSP_DEVICE_OPEN_V5.
  622. */
  623. /* This command allows a query of one COPP parameter. */
  624. #define ADM_CMD_GET_PP_PARAMS_V5 0x0001032A
  625. #define ADM_CMD_GET_PP_PARAMS_V6 0x0001035E
  626. /*
  627. * Structure of the ADM Get PP Params command. Parameter header must be
  628. * packed correctly for either V2 or V3. Use q6core_pack_pp_params to pack the
  629. * header correctly depending on Instance ID support.
  630. */
  631. struct adm_cmd_get_pp_params {
  632. struct apr_hdr apr_hdr;
  633. /* The memory mapping header to be used when requesting outband */
  634. struct mem_mapping_hdr mem_hdr;
  635. /* Parameter header for in band payload. */
  636. union param_hdrs param_hdr;
  637. } __packed;
  638. /* Returns parameter values
  639. * in response to an #ADM_CMD_GET_PP_PARAMS_V5 command.
  640. */
  641. #define ADM_CMDRSP_GET_PP_PARAMS_V5 0x0001032B
  642. /* Payload of the #ADM_CMDRSP_GET_PP_PARAMS_V5 message,
  643. * which returns parameter values in response
  644. * to an #ADM_CMD_GET_PP_PARAMS_V5 command.
  645. * Immediately following this
  646. * structure is the param_hdr_v1
  647. * structure containing the pre/postprocessing
  648. * parameter data. For an in-band
  649. * scenario, the variable payload depends
  650. * on the size of the parameter.
  651. */
  652. struct adm_cmd_rsp_get_pp_params_v5 {
  653. /* Status message (error code).*/
  654. u32 status;
  655. /* The header that identifies the subsequent parameter data */
  656. struct param_hdr_v1 param_hdr;
  657. /* The parameter data returned */
  658. u32 param_data[0];
  659. } __packed;
  660. /*
  661. * Returns parameter values in response to an #ADM_CMD_GET_PP_PARAMS_V5/6
  662. * command.
  663. */
  664. #define ADM_CMDRSP_GET_PP_PARAMS_V6 0x0001035F
  665. /*
  666. * Payload of the #ADM_CMDRSP_GET_PP_PARAMS_V6 message,
  667. * which returns parameter values in response
  668. * to an #ADM_CMD_GET_PP_PARAMS_V6 command.
  669. * Immediately following this
  670. * structure is the param_hdr_v3
  671. * structure containing the pre/postprocessing
  672. * parameter data. For an in-band
  673. * scenario, the variable payload depends
  674. * on the size of the parameter.
  675. */
  676. struct adm_cmd_rsp_get_pp_params_v6 {
  677. /* Status message (error code).*/
  678. u32 status;
  679. /* The header that identifies the subsequent parameter data */
  680. struct param_hdr_v3 param_hdr;
  681. /* The parameter data returned */
  682. u32 param_data[0];
  683. } __packed;
  684. /* Structure for holding soft stepping volume parameters. */
  685. /*
  686. * Payload of the #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
  687. * parameters used by the Volume Control module.
  688. */
  689. struct audproc_softvolume_params {
  690. u32 period;
  691. u32 step;
  692. u32 rampingcurve;
  693. } __packed;
  694. /*
  695. * ID of the Media Format Converter (MFC) module.
  696. * This module supports the following parameter IDs:
  697. * #AUDPROC_PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT
  698. * #AUDPROC_CHMIXER_PARAM_ID_COEFF
  699. */
  700. #define AUDPROC_MODULE_ID_MFC 0x00010912
  701. /* ID of the Output Media Format parameters used by AUDPROC_MODULE_ID_MFC.
  702. *
  703. */
  704. #define AUDPROC_PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT 0x00010913
  705. /* Param ID of Channel Mixer used by AUDPROC_MODULE_ID_MFC */
  706. #define AUDPROC_CHMIXER_PARAM_ID_COEFF 0x00010342
  707. /*
  708. * ID of the Media Format Converter (MFC) module present in EC REF COPP.
  709. * This module supports the all param IDs supported by AUDPROC_MODULE_ID_MFC.
  710. */
  711. #define AUDPROC_MODULE_ID_MFC_EC_REF 0x0001092C
  712. #define PARAM_ID_FFV_SPF_FREEZE 0x00010960
  713. struct adm_cmd_set_pp_params_v5 {
  714. struct apr_hdr hdr;
  715. u32 payload_addr_lsw;
  716. /* LSW of parameter data payload address.*/
  717. u32 payload_addr_msw;
  718. /* MSW of parameter data payload address.*/
  719. u32 mem_map_handle;
  720. /*
  721. * Memory map handle returned by ADM_CMD_SHARED_MEM_MAP_REGIONS
  722. * command.
  723. * If mem_map_handle is zero implies the message is in
  724. * the payload
  725. */
  726. u32 payload_size;
  727. /*
  728. * Size in bytes of the variable payload accompanying this
  729. * message or
  730. * in shared memory. This is used for parsing the parameter
  731. * payload.
  732. */
  733. } __packed;
  734. /* Maximum number of channels supported by MFC media fmt params */
  735. #define AUDPROC_MFC_OUT_CHANNELS_MAX 8
  736. struct audproc_mfc_param_media_fmt {
  737. uint32_t sampling_rate;
  738. uint16_t bits_per_sample;
  739. uint16_t num_channels;
  740. uint16_t channel_type[AUDPROC_MFC_OUT_CHANNELS_MAX];
  741. } __packed;
  742. struct audproc_volume_ctrl_master_gain {
  743. /* Linear gain in Q13 format. */
  744. uint16_t master_gain;
  745. /* Clients must set this field to zero. */
  746. uint16_t reserved;
  747. } __packed;
  748. struct audproc_soft_step_volume_params {
  749. /*
  750. * Period in milliseconds.
  751. * Supported values: 0 to 15000
  752. */
  753. uint32_t period;
  754. /*
  755. * Step in microseconds.
  756. * Supported values: 0 to 15000000
  757. */
  758. uint32_t step;
  759. /*
  760. * Ramping curve type.
  761. * Supported values:
  762. * - #AUDPROC_PARAM_SVC_RAMPINGCURVE_LINEAR
  763. * - #AUDPROC_PARAM_SVC_RAMPINGCURVE_EXP
  764. * - #AUDPROC_PARAM_SVC_RAMPINGCURVE_LOG
  765. */
  766. uint32_t ramping_curve;
  767. } __packed;
  768. struct audproc_enable_param_t {
  769. /*
  770. * Specifies whether the Audio processing module is enabled.
  771. * This parameter is generic/common parameter to configure or
  772. * determine the state of any audio processing module.
  773. * @values 0 : Disable 1: Enable
  774. */
  775. uint32_t enable;
  776. };
  777. /*
  778. * Allows a client to control the gains on various session-to-COPP paths.
  779. */
  780. #define ADM_CMD_MATRIX_RAMP_GAINS_V5 0x0001032C
  781. /*
  782. * Allows a client to control the gains on various session-to-COPP paths.
  783. * Maximum support 32 channels
  784. */
  785. #define ADM_CMD_MATRIX_RAMP_GAINS_V7 0x0001036C
  786. /* Indicates that the target gain in the
  787. * current adm_session_copp_gain_v5
  788. * structure is to be applied to all
  789. * the session-to-COPP paths that exist for
  790. * the specified session.
  791. */
  792. #define ADM_CMD_MATRIX_RAMP_GAINS_COPP_ID_ALL_CONNECTED_COPPS 0xFFFF
  793. /* Indicates that the target gain is
  794. * to be immediately applied to the
  795. * specified session-to-COPP path,
  796. * without a ramping fashion.
  797. */
  798. #define ADM_CMD_MATRIX_RAMP_GAINS_RAMP_DURATION_IMMEDIATE 0x0000
  799. /* Enumeration for a linear ramping curve.*/
  800. #define ADM_CMD_MATRIX_RAMP_GAINS_RAMP_CURVE_LINEAR 0x0000
  801. /* Payload of the #ADM_CMD_MATRIX_RAMP_GAINS_V5 command.
  802. * Immediately following this structure are num_gains of the
  803. * adm_session_copp_gain_v5structure.
  804. */
  805. struct adm_cmd_matrix_ramp_gains_v5 {
  806. u32 matrix_id;
  807. /* Specifies whether the matrix ID is Audio Rx (0) or Audio Tx (1).
  808. * Use the ADM_MATRIX_ID_AUDIO_RX or ADM_MATRIX_ID_AUDIOX
  809. * macros to set this field.
  810. */
  811. u16 num_gains;
  812. /* Number of gains being applied. */
  813. u16 reserved_for_align;
  814. /* Reserved. This field must be set to zero.*/
  815. } __packed;
  816. /* Session-to-COPP path gain structure, used by the
  817. * #ADM_CMD_MATRIX_RAMP_GAINS_V5 command.
  818. * This structure specifies the target
  819. * gain (per channel) that must be applied
  820. * to a particular session-to-COPP path in
  821. * the audio matrix. The structure can
  822. * also be used to apply the gain globally
  823. * to all session-to-COPP paths that
  824. * exist for the given session.
  825. * The aDSP uses device channel mapping to
  826. * determine which channel gains to
  827. * use from this command. For example,
  828. * if the device is configured as stereo,
  829. * the aDSP uses only target_gain_ch_1 and
  830. * target_gain_ch_2, and it ignores
  831. * the others.
  832. */
  833. struct adm_session_copp_gain_v5 {
  834. u16 session_id;
  835. /* Handle of the ASM session.
  836. * Supported values: 1 to 8.
  837. */
  838. u16 copp_id;
  839. /* Handle of the COPP. Gain will be applied on the Session ID
  840. * COPP ID path.
  841. */
  842. u16 ramp_duration;
  843. /* Duration (in milliseconds) of the ramp over
  844. * which target gains are
  845. * to be applied. Use
  846. * #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_DURATION_IMMEDIATE
  847. * to indicate that gain must be applied immediately.
  848. */
  849. u16 step_duration;
  850. /* Duration (in milliseconds) of each step in the ramp.
  851. * This parameter is ignored if ramp_duration is equal to
  852. * #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_DURATION_IMMEDIATE.
  853. * Supported value: 1
  854. */
  855. u16 ramp_curve;
  856. /* Type of ramping curve.
  857. * Supported value: #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_CURVE_LINEAR
  858. */
  859. u16 reserved_for_align;
  860. /* Reserved. This field must be set to zero. */
  861. u16 target_gain_ch_1;
  862. /* Target linear gain for channel 1 in Q13 format; */
  863. u16 target_gain_ch_2;
  864. /* Target linear gain for channel 2 in Q13 format; */
  865. u16 target_gain_ch_3;
  866. /* Target linear gain for channel 3 in Q13 format; */
  867. u16 target_gain_ch_4;
  868. /* Target linear gain for channel 4 in Q13 format; */
  869. u16 target_gain_ch_5;
  870. /* Target linear gain for channel 5 in Q13 format; */
  871. u16 target_gain_ch_6;
  872. /* Target linear gain for channel 6 in Q13 format; */
  873. u16 target_gain_ch_7;
  874. /* Target linear gain for channel 7 in Q13 format; */
  875. u16 target_gain_ch_8;
  876. /* Target linear gain for channel 8 in Q13 format; */
  877. } __packed;
  878. /* Payload of the #ADM_CMD_MATRIX_RAMP_GAINS_V7 command.
  879. * Immediately following this structure are num_gains of the
  880. * adm_session_copp_gain_v5structure.
  881. */
  882. struct adm_cmd_matrix_ramp_gains_v7 {
  883. struct apr_hdr hdr;
  884. u32 matrix_id;
  885. /* Specifies whether the matrix ID is Audio Rx (0) or Audio Tx (1).
  886. * Use the ADM_MATRIX_ID_AUDIO_RX or ADM_MATRIX_ID_AUDIOX
  887. * macros to set this field.
  888. */
  889. u16 num_gains;
  890. /* Number of gains being applied. */
  891. u16 reserved_for_align;
  892. /* Reserved. This field must be set to zero.*/
  893. } __packed;
  894. /* Session-to-COPP path gain structure, used by the
  895. * #ADM_CMD_MATRIX_RAMP_GAINS_V7 command.
  896. * This structure specifies the target
  897. * gain (per channel) that must be applied
  898. * to a particular session-to-COPP path in
  899. * the audio matrix. The structure can
  900. * also be used to apply the gain globally
  901. * to all session-to-COPP paths that
  902. * exist for the given session.
  903. * The aDSP uses device channel mapping to
  904. * determine which channel gains to
  905. * use from this command. For example,
  906. * if the device is configured as stereo,
  907. * the aDSP uses only target_gain_ch_1 and
  908. * target_gain_ch_2, and it ignores
  909. * the others.
  910. */
  911. struct adm_session_copp_gain_v7 {
  912. u16 session_id;
  913. /* Handle of the ASM session.
  914. * Supported values: 1 to 8.
  915. */
  916. u16 copp_id;
  917. /* Handle of the COPP. Gain will be applied on the Session ID
  918. * COPP ID path.
  919. */
  920. u16 ramp_duration;
  921. /* Duration (in milliseconds) of the ramp over
  922. * which target gains are
  923. * to be applied. Use
  924. * #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_DURATION_IMMEDIATE
  925. * to indicate that gain must be applied immediately.
  926. */
  927. u16 step_duration;
  928. /* Duration (in milliseconds) of each step in the ramp.
  929. * This parameter is ignored if ramp_duration is equal to
  930. * #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_DURATION_IMMEDIATE.
  931. * Supported value: 1
  932. */
  933. u16 ramp_curve;
  934. /* Type of ramping curve.
  935. * Supported value: #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_CURVE_LINEAR
  936. */
  937. u16 stream_type;
  938. /* Type of stream_type.
  939. * Supported value: #STREAM_TYPE_ASM STREAM_TYPE_LSM
  940. */
  941. u16 num_channels;
  942. /* Number of channels on which gain needs to be applied.
  943. * Supported value: 1 to 32.
  944. */
  945. u16 reserved_for_align;
  946. /* Reserved. This field must be set to zero. */
  947. } __packed;
  948. /* Allows to set mute/unmute on various session-to-COPP paths.
  949. * For every session-to-COPP path (stream-device interconnection),
  950. * mute/unmute can be set individually on the output channels.
  951. */
  952. #define ADM_CMD_MATRIX_MUTE_V5 0x0001032D
  953. /* Allows to set mute/unmute on various session-to-COPP paths.
  954. * For every session-to-COPP path (stream-device interconnection),
  955. * mute/unmute can be set individually on the output channels.
  956. */
  957. #define ADM_CMD_MATRIX_MUTE_V7 0x0001036D
  958. /* Indicates that mute/unmute in the
  959. * current adm_session_copp_mute_v5structure
  960. * is to be applied to all the session-to-COPP
  961. * paths that exist for the specified session.
  962. */
  963. #define ADM_CMD_MATRIX_MUTE_COPP_ID_ALL_CONNECTED_COPPS 0xFFFF
  964. /* Payload of the #ADM_CMD_MATRIX_MUTE_V5 command*/
  965. struct adm_cmd_matrix_mute_v5 {
  966. u32 matrix_id;
  967. /* Specifies whether the matrix ID is Audio Rx (0) or Audio Tx (1).
  968. * Use the ADM_MATRIX_ID_AUDIO_RX or ADM_MATRIX_ID_AUDIOX
  969. * macros to set this field.
  970. */
  971. u16 session_id;
  972. /* Handle of the ASM session.
  973. * Supported values: 1 to 8.
  974. */
  975. u16 copp_id;
  976. /* Handle of the COPP.
  977. * Use ADM_CMD_MATRIX_MUTE_COPP_ID_ALL_CONNECTED_COPPS
  978. * to indicate that mute/unmute must be applied to
  979. * all the COPPs connected to session_id.
  980. * Supported values:
  981. * - 0xFFFF -- Apply mute/unmute to all connected COPPs
  982. * - Other values -- Valid COPP ID
  983. */
  984. u8 mute_flag_ch_1;
  985. /* Mute flag for channel 1 is set to unmute (0) or mute (1). */
  986. u8 mute_flag_ch_2;
  987. /* Mute flag for channel 2 is set to unmute (0) or mute (1). */
  988. u8 mute_flag_ch_3;
  989. /* Mute flag for channel 3 is set to unmute (0) or mute (1). */
  990. u8 mute_flag_ch_4;
  991. /* Mute flag for channel 4 is set to unmute (0) or mute (1). */
  992. u8 mute_flag_ch_5;
  993. /* Mute flag for channel 5 is set to unmute (0) or mute (1). */
  994. u8 mute_flag_ch_6;
  995. /* Mute flag for channel 6 is set to unmute (0) or mute (1). */
  996. u8 mute_flag_ch_7;
  997. /* Mute flag for channel 7 is set to unmute (0) or mute (1). */
  998. u8 mute_flag_ch_8;
  999. /* Mute flag for channel 8 is set to unmute (0) or mute (1). */
  1000. u16 ramp_duration;
  1001. /* Period (in milliseconds) over which the soft mute/unmute will be
  1002. * applied.
  1003. * Supported values: 0 (Default) to 0xFFFF
  1004. * The default of 0 means mute/unmute will be applied immediately.
  1005. */
  1006. u16 reserved_for_align;
  1007. /* Clients must set this field to zero.*/
  1008. } __packed;
  1009. /* Payload of the #ADM_CMD_MATRIX_MUTE_V7 command*/
  1010. struct adm_cmd_matrix_mute_v7 {
  1011. struct apr_hdr hdr;
  1012. u32 matrix_id;
  1013. /* Specifies whether the matrix ID is Audio Rx (0) or Audio Tx (1).
  1014. * Use the ADM_MATRIX_ID_AUDIO_RX or ADM_MATRIX_ID_AUDIOX
  1015. * macros to set this field.
  1016. */
  1017. u16 session_id;
  1018. /* Handle of the ASM session.
  1019. * Supported values: 1 to .
  1020. */
  1021. u16 copp_id;
  1022. /* Handle of the COPP.
  1023. * Use ADM_CMD_MATRIX_MUTE_COPP_ID_ALL_CONNECTED_COPPS
  1024. * to indicate that mute/unmute must be applied to
  1025. * all the COPPs connected to session_id.
  1026. * Supported values:
  1027. * - 0xFFFF -- Apply mute/unmute to all connected COPPs
  1028. * - Other values -- Valid COPP ID
  1029. */
  1030. u16 ramp_duration;
  1031. /* Duration (in milliseconds) of the ramp over
  1032. * which target gains are
  1033. * to be applied. Use
  1034. * #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_DURATION_IMMEDIATE
  1035. * to indicate that gain must be applied immediately.
  1036. */
  1037. u16 stream_type;
  1038. /* Specify whether the stream type is connectedon the ASM or LSM
  1039. * Supported value: 1
  1040. */
  1041. u16 num_channels;
  1042. /* Number of channels on which gain needs to be applied
  1043. * Supported value: 1 to 32
  1044. */
  1045. } __packed;
  1046. #define ASM_PARAM_ID_AAC_STEREO_MIX_COEFF_SELECTION_FLAG_V2 (0x00010DD8)
  1047. struct asm_aac_stereo_mix_coeff_selection_param_v2 {
  1048. struct apr_hdr hdr;
  1049. u32 param_id;
  1050. u32 param_size;
  1051. u32 aac_stereo_mix_coeff_flag;
  1052. } __packed;
  1053. /* Allows a client to connect the desired stream to
  1054. * the desired AFE port through the stream router
  1055. *
  1056. * This command allows the client to connect specified session to
  1057. * specified AFE port. This is used for compressed streams only
  1058. * opened using the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED or
  1059. * #ASM_STREAM_CMD_OPEN_READ_COMPRESSED command.
  1060. *
  1061. * @prerequisites
  1062. * Session ID and AFE Port ID must be valid.
  1063. * #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED or
  1064. * #ASM_STREAM_CMD_OPEN_READ_COMPRESSED
  1065. * must have been called on this session.
  1066. */
  1067. #define ADM_CMD_CONNECT_AFE_PORT_V5 0x0001032E
  1068. #define ADM_CMD_DISCONNECT_AFE_PORT_V5 0x0001032F
  1069. /* Enumeration for the Rx stream router ID.*/
  1070. #define ADM_STRTR_ID_RX 0
  1071. /* Enumeration for the Tx stream router ID.*/
  1072. #define ADM_STRTR_IDX 1
  1073. /* Payload of the #ADM_CMD_CONNECT_AFE_PORT_V5 command.*/
  1074. struct adm_cmd_connect_afe_port_v5 {
  1075. struct apr_hdr hdr;
  1076. u8 mode;
  1077. /* ID of the stream router (RX/TX). Use the
  1078. * ADM_STRTR_ID_RX or ADM_STRTR_IDX macros
  1079. * to set this field.
  1080. */
  1081. u8 session_id;
  1082. /* Session ID of the stream to connect */
  1083. u16 afe_port_id;
  1084. /* Port ID of the AFE port to connect to.*/
  1085. u32 num_channels;
  1086. /* Number of device channels
  1087. * Supported values: 2(Audio Sample Packet),
  1088. * 8 (HBR Audio Stream Sample Packet)
  1089. */
  1090. u32 sampling_rate;
  1091. /* Device sampling rate
  1092. * Supported values: Any
  1093. */
  1094. } __packed;
  1095. /* adsp_adm_api.h */
  1096. /* Port ID. Update afe_get_port_index
  1097. * when a new port is added here.
  1098. */
  1099. #define PRIMARY_I2S_RX 0
  1100. #define PRIMARY_I2S_TX 1
  1101. #define SECONDARY_I2S_RX 4
  1102. #define SECONDARY_I2S_TX 5
  1103. #define MI2S_RX 6
  1104. #define MI2S_TX 7
  1105. #define HDMI_RX 8
  1106. #define RSVD_2 9
  1107. #define RSVD_3 10
  1108. #define DIGI_MIC_TX 11
  1109. #define VOICE2_PLAYBACK_TX 0x8002
  1110. #define VOICE_RECORD_RX 0x8003
  1111. #define VOICE_RECORD_TX 0x8004
  1112. #define VOICE_PLAYBACK_TX 0x8005
  1113. /* Slimbus Multi channel port id pool */
  1114. #define SLIMBUS_0_RX 0x4000
  1115. #define SLIMBUS_0_TX 0x4001
  1116. #define SLIMBUS_1_RX 0x4002
  1117. #define SLIMBUS_1_TX 0x4003
  1118. #define SLIMBUS_2_RX 0x4004
  1119. #define SLIMBUS_2_TX 0x4005
  1120. #define SLIMBUS_3_RX 0x4006
  1121. #define SLIMBUS_3_TX 0x4007
  1122. #define SLIMBUS_4_RX 0x4008
  1123. #define SLIMBUS_4_TX 0x4009
  1124. #define SLIMBUS_5_RX 0x400a
  1125. #define SLIMBUS_5_TX 0x400b
  1126. #define SLIMBUS_6_RX 0x400c
  1127. #define SLIMBUS_6_TX 0x400d
  1128. #define SLIMBUS_7_RX 0x400e
  1129. #define SLIMBUS_7_TX 0x400f
  1130. #define SLIMBUS_8_RX 0x4010
  1131. #define SLIMBUS_8_TX 0x4011
  1132. #define SLIMBUS_9_RX 0x4012
  1133. #define SLIMBUS_9_TX 0x4013
  1134. #define SLIMBUS_PORT_LAST SLIMBUS_9_TX
  1135. #define INT_BT_SCO_RX 0x3000
  1136. #define INT_BT_SCO_TX 0x3001
  1137. #define INT_BT_A2DP_RX 0x3002
  1138. #define INT_FM_RX 0x3004
  1139. #define INT_FM_TX 0x3005
  1140. #define RT_PROXY_PORT_001_RX 0x2000
  1141. #define RT_PROXY_PORT_001_TX 0x2001
  1142. #define AFE_LOOPBACK_TX 0x6001
  1143. #define HDMI_RX_MS 0x6002
  1144. #define DISPLAY_PORT_RX 0x6020
  1145. #define AFE_LANE_MASK_INVALID 0
  1146. #define AFE_PORT_INVALID 0xFFFF
  1147. #define SLIMBUS_INVALID AFE_PORT_INVALID
  1148. #define AFE_PORT_CMD_START 0x000100ca
  1149. #define AFE_EVENT_RTPORT_START 0
  1150. #define AFE_EVENT_RTPORT_STOP 1
  1151. #define AFE_EVENT_RTPORT_LOW_WM 2
  1152. #define AFE_EVENT_RTPORT_HI_WM 3
  1153. #define ADSP_AFE_VERSION 0x00200000
  1154. /* Size of the range of port IDs for the audio interface. */
  1155. #define AFE_PORT_ID_AUDIO_IF_PORT_RANGE_SIZE 0xF
  1156. /* Size of the range of port IDs for internal BT-FM ports. */
  1157. #define AFE_PORT_ID_INTERNAL_BT_FM_RANGE_SIZE 0x6
  1158. /* Size of the range of port IDs for SLIMbus<sup>&reg;
  1159. * </sup> multichannel
  1160. * ports.
  1161. */
  1162. #define AFE_PORT_ID_SLIMBUS_RANGE_SIZE 0xA
  1163. /* Size of the range of port IDs for real-time proxy ports. */
  1164. #define AFE_PORT_ID_RT_PROXY_PORT_RANGE_SIZE 0x4
  1165. /* Size of the range of port IDs for pseudoports. */
  1166. #define AFE_PORT_ID_PSEUDOPORT_RANGE_SIZE 0x5
  1167. /* Start of the range of port IDs for the audio interface. */
  1168. #define AFE_PORT_ID_AUDIO_IF_PORT_RANGE_START 0x1000
  1169. /* End of the range of port IDs for the audio interface. */
  1170. #define AFE_PORT_ID_AUDIO_IF_PORT_RANGE_END \
  1171. (AFE_PORT_ID_AUDIO_IF_PORT_RANGE_START +\
  1172. AFE_PORT_ID_AUDIO_IF_PORT_RANGE_SIZE - 1)
  1173. /* Start of the range of port IDs for real-time proxy ports. */
  1174. #define AFE_PORT_ID_RT_PROXY_PORT_RANGE_START 0x2000
  1175. /* End of the range of port IDs for real-time proxy ports. */
  1176. #define AFE_PORT_ID_RT_PROXY_PORT_RANGE_END \
  1177. (AFE_PORT_ID_RT_PROXY_PORT_RANGE_START +\
  1178. AFE_PORT_ID_RT_PROXY_PORT_RANGE_SIZE-1)
  1179. /* Start of the range of port IDs for internal BT-FM devices. */
  1180. #define AFE_PORT_ID_INTERNAL_BT_FM_RANGE_START 0x3000
  1181. /* End of the range of port IDs for internal BT-FM devices. */
  1182. #define AFE_PORT_ID_INTERNAL_BT_FM_RANGE_END \
  1183. (AFE_PORT_ID_INTERNAL_BT_FM_RANGE_START +\
  1184. AFE_PORT_ID_INTERNAL_BT_FM_RANGE_SIZE-1)
  1185. /* Start of the range of port IDs for SLIMbus devices. */
  1186. #define AFE_PORT_ID_SLIMBUS_RANGE_START 0x4000
  1187. /* End of the range of port IDs for SLIMbus devices. */
  1188. #define AFE_PORT_ID_SLIMBUS_RANGE_END \
  1189. (AFE_PORT_ID_SLIMBUS_RANGE_START +\
  1190. AFE_PORT_ID_SLIMBUS_RANGE_SIZE-1)
  1191. /* Start of the range of port IDs for pseudoports. */
  1192. #define AFE_PORT_ID_PSEUDOPORT_RANGE_START 0x8001
  1193. /* End of the range of port IDs for pseudoports. */
  1194. #define AFE_PORT_ID_PSEUDOPORT_RANGE_END \
  1195. (AFE_PORT_ID_PSEUDOPORT_RANGE_START +\
  1196. AFE_PORT_ID_PSEUDOPORT_RANGE_SIZE-1)
  1197. /* Start of the range of port IDs for TDM devices. */
  1198. #define AFE_PORT_ID_TDM_PORT_RANGE_START 0x9000
  1199. /* End of the range of port IDs for TDM devices. */
  1200. #define AFE_PORT_ID_TDM_PORT_RANGE_END \
  1201. (AFE_PORT_ID_TDM_PORT_RANGE_START+0x60-1)
  1202. /* Size of the range of port IDs for TDM ports. */
  1203. #define AFE_PORT_ID_TDM_PORT_RANGE_SIZE \
  1204. (AFE_PORT_ID_TDM_PORT_RANGE_END - \
  1205. AFE_PORT_ID_TDM_PORT_RANGE_START+1)
  1206. #define AFE_PORT_ID_PRIMARY_MI2S_RX 0x1000
  1207. #define AFE_PORT_ID_PRIMARY_MI2S_TX 0x1001
  1208. #define AFE_PORT_ID_SECONDARY_MI2S_RX 0x1002
  1209. #define AFE_PORT_ID_SECONDARY_MI2S_TX 0x1003
  1210. #define AFE_PORT_ID_TERTIARY_MI2S_RX 0x1004
  1211. #define AFE_PORT_ID_TERTIARY_MI2S_TX 0x1005
  1212. #define AFE_PORT_ID_QUATERNARY_MI2S_RX 0x1006
  1213. #define AFE_PORT_ID_QUATERNARY_MI2S_TX 0x1007
  1214. #define AUDIO_PORT_ID_I2S_RX 0x1008
  1215. #define AFE_PORT_ID_DIGITAL_MIC_TX 0x1009
  1216. #define AFE_PORT_ID_PRIMARY_PCM_RX 0x100A
  1217. #define AFE_PORT_ID_PRIMARY_PCM_TX 0x100B
  1218. #define AFE_PORT_ID_SECONDARY_PCM_RX 0x100C
  1219. #define AFE_PORT_ID_SECONDARY_PCM_TX 0x100D
  1220. #define AFE_PORT_ID_MULTICHAN_HDMI_RX 0x100E
  1221. #define AFE_PORT_ID_SECONDARY_MI2S_RX_SD1 0x1010
  1222. #define AFE_PORT_ID_TERTIARY_PCM_RX 0x1012
  1223. #define AFE_PORT_ID_TERTIARY_PCM_TX 0x1013
  1224. #define AFE_PORT_ID_QUATERNARY_PCM_RX 0x1014
  1225. #define AFE_PORT_ID_QUATERNARY_PCM_TX 0x1015
  1226. #define AFE_PORT_ID_QUINARY_MI2S_RX 0x1016
  1227. #define AFE_PORT_ID_QUINARY_MI2S_TX 0x1017
  1228. /* ID of the senary MI2S Rx port. */
  1229. #define AFE_PORT_ID_SENARY_MI2S_RX 0x1018
  1230. /* ID of the senary MI2S Tx port. */
  1231. #define AFE_PORT_ID_SENARY_MI2S_TX 0x1019
  1232. /* ID of the Internal 0 MI2S Rx port */
  1233. #define AFE_PORT_ID_INT0_MI2S_RX 0x102E
  1234. /* ID of the Internal 0 MI2S Tx port */
  1235. #define AFE_PORT_ID_INT0_MI2S_TX 0x102F
  1236. /* ID of the Internal 1 MI2S Rx port */
  1237. #define AFE_PORT_ID_INT1_MI2S_RX 0x1030
  1238. /* ID of the Internal 1 MI2S Tx port */
  1239. #define AFE_PORT_ID_INT1_MI2S_TX 0x1031
  1240. /* ID of the Internal 2 MI2S Rx port */
  1241. #define AFE_PORT_ID_INT2_MI2S_RX 0x1032
  1242. /* ID of the Internal 2 MI2S Tx port */
  1243. #define AFE_PORT_ID_INT2_MI2S_TX 0x1033
  1244. /* ID of the Internal 3 MI2S Rx port */
  1245. #define AFE_PORT_ID_INT3_MI2S_RX 0x1034
  1246. /* ID of the Internal 3 MI2S Tx port */
  1247. #define AFE_PORT_ID_INT3_MI2S_TX 0x1035
  1248. /* ID of the Internal 4 MI2S Rx port */
  1249. #define AFE_PORT_ID_INT4_MI2S_RX 0x1036
  1250. /* ID of the Internal 4 MI2S Tx port */
  1251. #define AFE_PORT_ID_INT4_MI2S_TX 0x1037
  1252. /* ID of the Internal 5 MI2S Rx port */
  1253. #define AFE_PORT_ID_INT5_MI2S_RX 0x1038
  1254. /* ID of the Internal 5 MI2S Tx port */
  1255. #define AFE_PORT_ID_INT5_MI2S_TX 0x1039
  1256. /* ID of the Internal 6 MI2S Rx port */
  1257. #define AFE_PORT_ID_INT6_MI2S_RX 0x103A
  1258. /* ID of the Internal 6 MI2S Tx port */
  1259. #define AFE_PORT_ID_INT6_MI2S_TX 0x103B
  1260. #define AFE_PORT_ID_QUINARY_PCM_RX 0x103C
  1261. #define AFE_PORT_ID_QUINARY_PCM_TX 0x103D
  1262. /* ID of the senary auxiliary PCM Rx port. */
  1263. #define AFE_PORT_ID_SENARY_PCM_RX 0x103E
  1264. /* ID of the senary auxiliary PCM Tx port. */
  1265. #define AFE_PORT_ID_SENARY_PCM_TX 0x103F
  1266. #define AFE_PORT_ID_PRIMARY_META_MI2S_RX 0x1300
  1267. #define AFE_PORT_ID_SECONDARY_META_MI2S_RX 0x1302
  1268. #define AFE_PORT_ID_PRIMARY_SPDIF_RX 0x5000
  1269. #define AFE_PORT_ID_PRIMARY_SPDIF_TX 0x5001
  1270. #define AFE_PORT_ID_SECONDARY_SPDIF_RX 0x5002
  1271. #define AFE_PORT_ID_SECONDARY_SPDIF_TX 0x5003
  1272. #define AFE_PORT_ID_SPDIF_RX AFE_PORT_ID_PRIMARY_SPDIF_RX
  1273. #define AFE_PORT_ID_RT_PROXY_PORT_001_RX 0x2000
  1274. #define AFE_PORT_ID_RT_PROXY_PORT_001_TX 0x2001
  1275. #define AFE_PORT_ID_INTERNAL_BT_SCO_RX 0x3000
  1276. #define AFE_PORT_ID_INTERNAL_BT_SCO_TX 0x3001
  1277. #define AFE_PORT_ID_INTERNAL_BT_A2DP_RX 0x3002
  1278. #define AFE_PORT_ID_INTERNAL_FM_RX 0x3004
  1279. #define AFE_PORT_ID_INTERNAL_FM_TX 0x3005
  1280. /* SLIMbus Rx port on channel 0. */
  1281. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_RX 0x4000
  1282. /* SLIMbus Tx port on channel 0. */
  1283. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_TX 0x4001
  1284. /* SLIMbus Rx port on channel 1. */
  1285. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_1_RX 0x4002
  1286. /* SLIMbus Tx port on channel 1. */
  1287. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_1_TX 0x4003
  1288. /* SLIMbus Rx port on channel 2. */
  1289. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_2_RX 0x4004
  1290. /* SLIMbus Tx port on channel 2. */
  1291. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_2_TX 0x4005
  1292. /* SLIMbus Rx port on channel 3. */
  1293. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_3_RX 0x4006
  1294. /* SLIMbus Tx port on channel 3. */
  1295. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_3_TX 0x4007
  1296. /* SLIMbus Rx port on channel 4. */
  1297. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_4_RX 0x4008
  1298. /* SLIMbus Tx port on channel 4. */
  1299. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_4_TX 0x4009
  1300. /* SLIMbus Rx port on channel 5. */
  1301. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_RX 0x400a
  1302. /* SLIMbus Tx port on channel 5. */
  1303. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_TX 0x400b
  1304. /* SLIMbus Rx port on channel 6. */
  1305. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_6_RX 0x400c
  1306. /* SLIMbus Tx port on channel 6. */
  1307. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_6_TX 0x400d
  1308. /* SLIMbus Rx port on channel 7. */
  1309. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_7_RX 0x400e
  1310. /* SLIMbus Tx port on channel 7. */
  1311. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_7_TX 0x400f
  1312. /* SLIMbus Rx port on channel 8. */
  1313. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_8_RX 0x4010
  1314. /* SLIMbus Tx port on channel 8. */
  1315. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_8_TX 0x4011
  1316. /* SLIMbus Rx port on channel 9. */
  1317. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_9_RX 0x4012
  1318. /* SLIMbus Tx port on channel 9. */
  1319. #define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_9_TX 0x4013
  1320. /*AFE Rx port for audio over hdmi*/
  1321. #define AFE_PORT_ID_HDMI_MS 0x6002
  1322. /* AFE Rx port for audio over Display port */
  1323. #define AFE_PORT_ID_HDMI_OVER_DP_RX 0x6020
  1324. /*USB AFE port */
  1325. #define AFE_PORT_ID_USB_RX 0x7000
  1326. #define AFE_PORT_ID_USB_TX 0x7001
  1327. /* AFE WSA Codec DMA Rx port 0 */
  1328. #define AFE_PORT_ID_WSA_CODEC_DMA_RX_0 0xB000
  1329. /* AFE WSA Codec DMA Tx port 0 */
  1330. #define AFE_PORT_ID_WSA_CODEC_DMA_TX_0 0xB001
  1331. /* AFE WSA Codec DMA Rx port 1 */
  1332. #define AFE_PORT_ID_WSA_CODEC_DMA_RX_1 0xB002
  1333. /* AFE WSA Codec DMA Tx port 1 */
  1334. #define AFE_PORT_ID_WSA_CODEC_DMA_TX_1 0xB003
  1335. /* AFE WSA Codec DMA Tx port 2 */
  1336. #define AFE_PORT_ID_WSA_CODEC_DMA_TX_2 0xB005
  1337. /* AFE VA Codec DMA Tx port 0 */
  1338. #define AFE_PORT_ID_VA_CODEC_DMA_TX_0 0xB021
  1339. /* AFE VA Codec DMA Tx port 1 */
  1340. #define AFE_PORT_ID_VA_CODEC_DMA_TX_1 0xB023
  1341. /* AFE VA Codec DMA Tx port 2 */
  1342. #define AFE_PORT_ID_VA_CODEC_DMA_TX_2 0xB025
  1343. /* AFE Rx Codec DMA Rx port 0 */
  1344. #define AFE_PORT_ID_RX_CODEC_DMA_RX_0 0xB030
  1345. /* AFE Tx Codec DMA Tx port 0 */
  1346. #define AFE_PORT_ID_TX_CODEC_DMA_TX_0 0xB031
  1347. /* AFE Rx Codec DMA Rx port 1 */
  1348. #define AFE_PORT_ID_RX_CODEC_DMA_RX_1 0xB032
  1349. /* AFE Tx Codec DMA Tx port 1 */
  1350. #define AFE_PORT_ID_TX_CODEC_DMA_TX_1 0xB033
  1351. /* AFE Rx Codec DMA Rx port 2 */
  1352. #define AFE_PORT_ID_RX_CODEC_DMA_RX_2 0xB034
  1353. /* AFE Tx Codec DMA Tx port 2 */
  1354. #define AFE_PORT_ID_TX_CODEC_DMA_TX_2 0xB035
  1355. /* AFE Rx Codec DMA Rx port 3 */
  1356. #define AFE_PORT_ID_RX_CODEC_DMA_RX_3 0xB036
  1357. /* AFE Tx Codec DMA Tx port 3 */
  1358. #define AFE_PORT_ID_TX_CODEC_DMA_TX_3 0xB037
  1359. /* AFE Rx Codec DMA Rx port 4 */
  1360. #define AFE_PORT_ID_RX_CODEC_DMA_RX_4 0xB038
  1361. /* AFE Tx Codec DMA Tx port 4 */
  1362. #define AFE_PORT_ID_TX_CODEC_DMA_TX_4 0xB039
  1363. /* AFE Rx Codec DMA Rx port 5 */
  1364. #define AFE_PORT_ID_RX_CODEC_DMA_RX_5 0xB03A
  1365. /* AFE Tx Codec DMA Tx port 5 */
  1366. #define AFE_PORT_ID_TX_CODEC_DMA_TX_5 0xB03B
  1367. /* AFE Rx Codec DMA Rx port 6 */
  1368. #define AFE_PORT_ID_RX_CODEC_DMA_RX_6 0xB03C
  1369. /* AFE Rx Codec DMA Rx port 7 */
  1370. #define AFE_PORT_ID_RX_CODEC_DMA_RX_7 0xB03E
  1371. /* Generic pseudoport 1. */
  1372. #define AFE_PORT_ID_PSEUDOPORT_01 0x8001
  1373. /* Generic pseudoport 2. */
  1374. #define AFE_PORT_ID_PSEUDOPORT_02 0x8002
  1375. /* @xreflabel{hdr:AfePortIdPrimaryAuxPcmTx}
  1376. * Primary Aux PCM Tx port ID.
  1377. */
  1378. #define AFE_PORT_ID_PRIMARY_PCM_TX 0x100B
  1379. /* Pseudoport that corresponds to the voice Rx path.
  1380. * For recording, the voice Rx path samples are written to this
  1381. * port and consumed by the audio path.
  1382. */
  1383. #define AFE_PORT_ID_VOICE_RECORD_RX 0x8003
  1384. /* Pseudoport that corresponds to the voice Tx path.
  1385. * For recording, the voice Tx path samples are written to this
  1386. * port and consumed by the audio path.
  1387. */
  1388. #define AFE_PORT_ID_VOICE_RECORD_TX 0x8004
  1389. /* Pseudoport that corresponds to in-call voice delivery samples.
  1390. * During in-call audio delivery, the audio path delivers samples
  1391. * to this port from where the voice path delivers them on the
  1392. * Rx path.
  1393. */
  1394. #define AFE_PORT_ID_VOICE2_PLAYBACK_TX 0x8002
  1395. #define AFE_PORT_ID_VOICE_PLAYBACK_TX 0x8005
  1396. /*
  1397. * Proxyport used for voice call data processing.
  1398. * In cases like call-screening feature, where user can communicate
  1399. * with caller with the help of "call screen" mode, and without
  1400. * connecting the call with any HW input/output devices in the phone,
  1401. * voice call can use Proxy port to start voice data processing.
  1402. */
  1403. #define RT_PROXY_PORT_002_TX 0x2003
  1404. #define RT_PROXY_PORT_002_RX 0x2002
  1405. #define AFE_PORT_ID_PRIMARY_TDM_RX \
  1406. (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x00)
  1407. #define AFE_PORT_ID_PRIMARY_TDM_RX_1 \
  1408. (AFE_PORT_ID_PRIMARY_TDM_RX + 0x02)
  1409. #define AFE_PORT_ID_PRIMARY_TDM_RX_2 \
  1410. (AFE_PORT_ID_PRIMARY_TDM_RX + 0x04)
  1411. #define AFE_PORT_ID_PRIMARY_TDM_RX_3 \
  1412. (AFE_PORT_ID_PRIMARY_TDM_RX + 0x06)
  1413. #define AFE_PORT_ID_PRIMARY_TDM_RX_4 \
  1414. (AFE_PORT_ID_PRIMARY_TDM_RX + 0x08)
  1415. #define AFE_PORT_ID_PRIMARY_TDM_RX_5 \
  1416. (AFE_PORT_ID_PRIMARY_TDM_RX + 0x0A)
  1417. #define AFE_PORT_ID_PRIMARY_TDM_RX_6 \
  1418. (AFE_PORT_ID_PRIMARY_TDM_RX + 0x0C)
  1419. #define AFE_PORT_ID_PRIMARY_TDM_RX_7 \
  1420. (AFE_PORT_ID_PRIMARY_TDM_RX + 0x0E)
  1421. #define AFE_PORT_ID_PRIMARY_TDM_TX \
  1422. (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x01)
  1423. #define AFE_PORT_ID_PRIMARY_TDM_TX_1 \
  1424. (AFE_PORT_ID_PRIMARY_TDM_TX + 0x02)
  1425. #define AFE_PORT_ID_PRIMARY_TDM_TX_2 \
  1426. (AFE_PORT_ID_PRIMARY_TDM_TX + 0x04)
  1427. #define AFE_PORT_ID_PRIMARY_TDM_TX_3 \
  1428. (AFE_PORT_ID_PRIMARY_TDM_TX + 0x06)
  1429. #define AFE_PORT_ID_PRIMARY_TDM_TX_4 \
  1430. (AFE_PORT_ID_PRIMARY_TDM_TX + 0x08)
  1431. #define AFE_PORT_ID_PRIMARY_TDM_TX_5 \
  1432. (AFE_PORT_ID_PRIMARY_TDM_TX + 0x0A)
  1433. #define AFE_PORT_ID_PRIMARY_TDM_TX_6 \
  1434. (AFE_PORT_ID_PRIMARY_TDM_TX + 0x0C)
  1435. #define AFE_PORT_ID_PRIMARY_TDM_TX_7 \
  1436. (AFE_PORT_ID_PRIMARY_TDM_TX + 0x0E)
  1437. #define AFE_PORT_ID_SECONDARY_TDM_RX \
  1438. (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x10)
  1439. #define AFE_PORT_ID_SECONDARY_TDM_RX_1 \
  1440. (AFE_PORT_ID_SECONDARY_TDM_RX + 0x02)
  1441. #define AFE_PORT_ID_SECONDARY_TDM_RX_2 \
  1442. (AFE_PORT_ID_SECONDARY_TDM_RX + 0x04)
  1443. #define AFE_PORT_ID_SECONDARY_TDM_RX_3 \
  1444. (AFE_PORT_ID_SECONDARY_TDM_RX + 0x06)
  1445. #define AFE_PORT_ID_SECONDARY_TDM_RX_4 \
  1446. (AFE_PORT_ID_SECONDARY_TDM_RX + 0x08)
  1447. #define AFE_PORT_ID_SECONDARY_TDM_RX_5 \
  1448. (AFE_PORT_ID_SECONDARY_TDM_RX + 0x0A)
  1449. #define AFE_PORT_ID_SECONDARY_TDM_RX_6 \
  1450. (AFE_PORT_ID_SECONDARY_TDM_RX + 0x0C)
  1451. #define AFE_PORT_ID_SECONDARY_TDM_RX_7 \
  1452. (AFE_PORT_ID_SECONDARY_TDM_RX + 0x0E)
  1453. #define AFE_PORT_ID_SECONDARY_TDM_TX \
  1454. (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x11)
  1455. #define AFE_PORT_ID_SECONDARY_TDM_TX_1 \
  1456. (AFE_PORT_ID_SECONDARY_TDM_TX + 0x02)
  1457. #define AFE_PORT_ID_SECONDARY_TDM_TX_2 \
  1458. (AFE_PORT_ID_SECONDARY_TDM_TX + 0x04)
  1459. #define AFE_PORT_ID_SECONDARY_TDM_TX_3 \
  1460. (AFE_PORT_ID_SECONDARY_TDM_TX + 0x06)
  1461. #define AFE_PORT_ID_SECONDARY_TDM_TX_4 \
  1462. (AFE_PORT_ID_SECONDARY_TDM_TX + 0x08)
  1463. #define AFE_PORT_ID_SECONDARY_TDM_TX_5 \
  1464. (AFE_PORT_ID_SECONDARY_TDM_TX + 0x0A)
  1465. #define AFE_PORT_ID_SECONDARY_TDM_TX_6 \
  1466. (AFE_PORT_ID_SECONDARY_TDM_TX + 0x0C)
  1467. #define AFE_PORT_ID_SECONDARY_TDM_TX_7 \
  1468. (AFE_PORT_ID_SECONDARY_TDM_TX + 0x0E)
  1469. #define AFE_PORT_ID_TERTIARY_TDM_RX \
  1470. (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x20)
  1471. #define AFE_PORT_ID_TERTIARY_TDM_RX_1 \
  1472. (AFE_PORT_ID_TERTIARY_TDM_RX + 0x02)
  1473. #define AFE_PORT_ID_TERTIARY_TDM_RX_2 \
  1474. (AFE_PORT_ID_TERTIARY_TDM_RX + 0x04)
  1475. #define AFE_PORT_ID_TERTIARY_TDM_RX_3 \
  1476. (AFE_PORT_ID_TERTIARY_TDM_RX + 0x06)
  1477. #define AFE_PORT_ID_TERTIARY_TDM_RX_4 \
  1478. (AFE_PORT_ID_TERTIARY_TDM_RX + 0x08)
  1479. #define AFE_PORT_ID_TERTIARY_TDM_RX_5 \
  1480. (AFE_PORT_ID_TERTIARY_TDM_RX + 0x0A)
  1481. #define AFE_PORT_ID_TERTIARY_TDM_RX_6 \
  1482. (AFE_PORT_ID_TERTIARY_TDM_RX + 0x0C)
  1483. #define AFE_PORT_ID_TERTIARY_TDM_RX_7 \
  1484. (AFE_PORT_ID_TERTIARY_TDM_RX + 0x0E)
  1485. #define AFE_PORT_ID_TERTIARY_TDM_TX \
  1486. (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x21)
  1487. #define AFE_PORT_ID_TERTIARY_TDM_TX_1 \
  1488. (AFE_PORT_ID_TERTIARY_TDM_TX + 0x02)
  1489. #define AFE_PORT_ID_TERTIARY_TDM_TX_2 \
  1490. (AFE_PORT_ID_TERTIARY_TDM_TX + 0x04)
  1491. #define AFE_PORT_ID_TERTIARY_TDM_TX_3 \
  1492. (AFE_PORT_ID_TERTIARY_TDM_TX + 0x06)
  1493. #define AFE_PORT_ID_TERTIARY_TDM_TX_4 \
  1494. (AFE_PORT_ID_TERTIARY_TDM_TX + 0x08)
  1495. #define AFE_PORT_ID_TERTIARY_TDM_TX_5 \
  1496. (AFE_PORT_ID_TERTIARY_TDM_TX + 0x0A)
  1497. #define AFE_PORT_ID_TERTIARY_TDM_TX_6 \
  1498. (AFE_PORT_ID_TERTIARY_TDM_TX + 0x0C)
  1499. #define AFE_PORT_ID_TERTIARY_TDM_TX_7 \
  1500. (AFE_PORT_ID_TERTIARY_TDM_TX + 0x0E)
  1501. #define AFE_PORT_ID_QUATERNARY_TDM_RX \
  1502. (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x30)
  1503. #define AFE_PORT_ID_QUATERNARY_TDM_RX_1 \
  1504. (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x02)
  1505. #define AFE_PORT_ID_QUATERNARY_TDM_RX_2 \
  1506. (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x04)
  1507. #define AFE_PORT_ID_QUATERNARY_TDM_RX_3 \
  1508. (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x06)
  1509. #define AFE_PORT_ID_QUATERNARY_TDM_RX_4 \
  1510. (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x08)
  1511. #define AFE_PORT_ID_QUATERNARY_TDM_RX_5 \
  1512. (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x0A)
  1513. #define AFE_PORT_ID_QUATERNARY_TDM_RX_6 \
  1514. (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x0C)
  1515. #define AFE_PORT_ID_QUATERNARY_TDM_RX_7 \
  1516. (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x0E)
  1517. #define AFE_PORT_ID_QUATERNARY_TDM_TX \
  1518. (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x31)
  1519. #define AFE_PORT_ID_QUATERNARY_TDM_TX_1 \
  1520. (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x02)
  1521. #define AFE_PORT_ID_QUATERNARY_TDM_TX_2 \
  1522. (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x04)
  1523. #define AFE_PORT_ID_QUATERNARY_TDM_TX_3 \
  1524. (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x06)
  1525. #define AFE_PORT_ID_QUATERNARY_TDM_TX_4 \
  1526. (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x08)
  1527. #define AFE_PORT_ID_QUATERNARY_TDM_TX_5 \
  1528. (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x0A)
  1529. #define AFE_PORT_ID_QUATERNARY_TDM_TX_6 \
  1530. (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x0C)
  1531. #define AFE_PORT_ID_QUATERNARY_TDM_TX_7 \
  1532. (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x0E)
  1533. #define AFE_PORT_ID_QUINARY_TDM_RX \
  1534. (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x40)
  1535. #define AFE_PORT_ID_QUINARY_TDM_RX_1 \
  1536. (AFE_PORT_ID_QUINARY_TDM_RX + 0x02)
  1537. #define AFE_PORT_ID_QUINARY_TDM_RX_2 \
  1538. (AFE_PORT_ID_QUINARY_TDM_RX + 0x04)
  1539. #define AFE_PORT_ID_QUINARY_TDM_RX_3 \
  1540. (AFE_PORT_ID_QUINARY_TDM_RX + 0x06)
  1541. #define AFE_PORT_ID_QUINARY_TDM_RX_4 \
  1542. (AFE_PORT_ID_QUINARY_TDM_RX + 0x08)
  1543. #define AFE_PORT_ID_QUINARY_TDM_RX_5 \
  1544. (AFE_PORT_ID_QUINARY_TDM_RX + 0x0A)
  1545. #define AFE_PORT_ID_QUINARY_TDM_RX_6 \
  1546. (AFE_PORT_ID_QUINARY_TDM_RX + 0x0C)
  1547. #define AFE_PORT_ID_QUINARY_TDM_RX_7 \
  1548. (AFE_PORT_ID_QUINARY_TDM_RX + 0x0E)
  1549. #define AFE_PORT_ID_QUINARY_TDM_TX \
  1550. (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x41)
  1551. #define AFE_PORT_ID_QUINARY_TDM_TX_1 \
  1552. (AFE_PORT_ID_QUINARY_TDM_TX + 0x02)
  1553. #define AFE_PORT_ID_QUINARY_TDM_TX_2 \
  1554. (AFE_PORT_ID_QUINARY_TDM_TX + 0x04)
  1555. #define AFE_PORT_ID_QUINARY_TDM_TX_3 \
  1556. (AFE_PORT_ID_QUINARY_TDM_TX + 0x06)
  1557. #define AFE_PORT_ID_QUINARY_TDM_TX_4 \
  1558. (AFE_PORT_ID_QUINARY_TDM_TX + 0x08)
  1559. #define AFE_PORT_ID_QUINARY_TDM_TX_5 \
  1560. (AFE_PORT_ID_QUINARY_TDM_TX + 0x0A)
  1561. #define AFE_PORT_ID_QUINARY_TDM_TX_6 \
  1562. (AFE_PORT_ID_QUINARY_TDM_TX + 0x0C)
  1563. #define AFE_PORT_ID_QUINARY_TDM_TX_7 \
  1564. (AFE_PORT_ID_QUINARY_TDM_TX + 0x0E)
  1565. #define AFE_PORT_ID_SENARY_TDM_RX \
  1566. (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x50)
  1567. #define AFE_PORT_ID_SENARY_TDM_RX_1 \
  1568. (AFE_PORT_ID_SENARY_TDM_RX + 0x02)
  1569. #define AFE_PORT_ID_SENARY_TDM_RX_2 \
  1570. (AFE_PORT_ID_SENARY_TDM_RX + 0x04)
  1571. #define AFE_PORT_ID_SENARY_TDM_RX_3 \
  1572. (AFE_PORT_ID_SENARY_TDM_RX + 0x06)
  1573. #define AFE_PORT_ID_SENARY_TDM_RX_4 \
  1574. (AFE_PORT_ID_SENARY_TDM_RX + 0x08)
  1575. #define AFE_PORT_ID_SENARY_TDM_RX_5 \
  1576. (AFE_PORT_ID_SENARY_TDM_RX + 0x0A)
  1577. #define AFE_PORT_ID_SENARY_TDM_RX_6 \
  1578. (AFE_PORT_ID_SENARY_TDM_RX + 0x0C)
  1579. #define AFE_PORT_ID_SENARY_TDM_RX_7 \
  1580. (AFE_PORT_ID_SENARY_TDM_RX + 0x0E)
  1581. #define AFE_PORT_ID_SENARY_TDM_TX \
  1582. (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x51)
  1583. #define AFE_PORT_ID_SENARY_TDM_TX_1 \
  1584. (AFE_PORT_ID_SENARY_TDM_TX + 0x02)
  1585. #define AFE_PORT_ID_SENARY_TDM_TX_2 \
  1586. (AFE_PORT_ID_SENARY_TDM_TX + 0x04)
  1587. #define AFE_PORT_ID_SENARY_TDM_TX_3 \
  1588. (AFE_PORT_ID_SENARY_TDM_TX + 0x06)
  1589. #define AFE_PORT_ID_SENARY_TDM_TX_4 \
  1590. (AFE_PORT_ID_SENARY_TDM_TX + 0x08)
  1591. #define AFE_PORT_ID_SENARY_TDM_TX_5 \
  1592. (AFE_PORT_ID_SENARY_TDM_TX + 0x0A)
  1593. #define AFE_PORT_ID_SENARY_TDM_TX_6 \
  1594. (AFE_PORT_ID_SENARY_TDM_TX + 0x0C)
  1595. #define AFE_PORT_ID_SENARY_TDM_TX_7 \
  1596. (AFE_PORT_ID_SENARY_TDM_TX + 0x0E)
  1597. #define AFE_PORT_ID_INVALID 0xFFFF
  1598. #define AAC_ENC_MODE_AAC_LC 0x02
  1599. #define AAC_ENC_MODE_AAC_P 0x05
  1600. #define AAC_ENC_MODE_EAAC_P 0x1D
  1601. #define AFE_PSEUDOPORT_CMD_START 0x000100cf
  1602. struct afe_pseudoport_start_command {
  1603. struct apr_hdr hdr;
  1604. u16 port_id; /* Pseudo Port 1 = 0x8000 */
  1605. /* Pseudo Port 2 = 0x8001 */
  1606. /* Pseudo Port 3 = 0x8002 */
  1607. u16 timing; /* FTRT = 0 , AVTimer = 1, */
  1608. } __packed;
  1609. #define AFE_PSEUDOPORT_CMD_STOP 0x000100d0
  1610. struct afe_pseudoport_stop_command {
  1611. struct apr_hdr hdr;
  1612. u16 port_id; /* Pseudo Port 1 = 0x8000 */
  1613. /* Pseudo Port 2 = 0x8001 */
  1614. /* Pseudo Port 3 = 0x8002 */
  1615. u16 reserved;
  1616. } __packed;
  1617. #define AFE_MODULE_SIDETONE_IIR_FILTER 0x00010202
  1618. #define AFE_PARAM_ID_ENABLE 0x00010203
  1619. /* Payload of the #AFE_PARAM_ID_ENABLE
  1620. * parameter, which enables or
  1621. * disables any module.
  1622. * The fixed size of this structure is four bytes.
  1623. */
  1624. struct afe_mod_enable_param {
  1625. u16 enable;
  1626. /* Enables (1) or disables (0) the module. */
  1627. u16 reserved;
  1628. /* This field must be set to zero. */
  1629. } __packed;
  1630. /* ID of the configuration parameter used by the
  1631. * #AFE_MODULE_SIDETONE_IIR_FILTER module.
  1632. */
  1633. #define AFE_PARAM_ID_SIDETONE_IIR_FILTER_CONFIG 0x00010204
  1634. #define MAX_SIDETONE_IIR_DATA_SIZE 224
  1635. #define MAX_NO_IIR_FILTER_STAGE 10
  1636. struct afe_sidetone_iir_filter_config_params {
  1637. u16 num_biquad_stages;
  1638. /* Number of stages.
  1639. * Supported values: Minimum of 5 and maximum of 10
  1640. */
  1641. u16 pregain;
  1642. /* Pregain for the compensating filter response.
  1643. * Supported values: Any number in Q13 format
  1644. */
  1645. uint8_t iir_config[MAX_SIDETONE_IIR_DATA_SIZE];
  1646. } __packed;
  1647. #define AFE_MODULE_LOOPBACK 0x00010205
  1648. #define AFE_PARAM_ID_LOOPBACK_GAIN_PER_PATH 0x00010206
  1649. /* Used by RTAC */
  1650. struct afe_rtac_user_data_set_v2 {
  1651. /* Port interface and direction (Rx or Tx) to start. */
  1652. u16 port_id;
  1653. /* Actual size of the payload in bytes.
  1654. * This is used for parsing the parameter payload.
  1655. * Supported values: > 0
  1656. */
  1657. u16 payload_size;
  1658. /* The header detailing the memory mapping for out of band. */
  1659. struct mem_mapping_hdr mem_hdr;
  1660. /* The parameter header for the parameter data to set */
  1661. struct param_hdr_v1 param_hdr;
  1662. /* The parameter data to be filled when sent inband */
  1663. u32 *param_data;
  1664. } __packed;
  1665. struct afe_rtac_user_data_set_v3 {
  1666. /* Port interface and direction (Rx or Tx) to start. */
  1667. u16 port_id;
  1668. /* Reserved for future enhancements. Must be 0. */
  1669. u16 reserved;
  1670. /* The header detailing the memory mapping for out of band. */
  1671. struct mem_mapping_hdr mem_hdr;
  1672. /* The size of the parameter header and parameter data */
  1673. u32 payload_size;
  1674. /* The parameter header for the parameter data to set */
  1675. struct param_hdr_v3 param_hdr;
  1676. /* The parameter data to be filled when sent inband */
  1677. u32 *param_data;
  1678. } __packed;
  1679. struct afe_rtac_user_data_get_v2 {
  1680. /* Port interface and direction (Rx or Tx) to start. */
  1681. u16 port_id;
  1682. /* Actual size of the payload in bytes.
  1683. * This is used for parsing the parameter payload.
  1684. * Supported values: > 0
  1685. */
  1686. u16 payload_size;
  1687. /* The header detailing the memory mapping for out of band. */
  1688. struct mem_mapping_hdr mem_hdr;
  1689. /* The module ID of the parameter to get */
  1690. u32 module_id;
  1691. /* The parameter ID of the parameter to get */
  1692. u32 param_id;
  1693. /* The parameter data to be filled when sent inband */
  1694. struct param_hdr_v1 param_hdr;
  1695. } __packed;
  1696. struct afe_rtac_user_data_get_v3 {
  1697. /* Port interface and direction (Rx or Tx) to start. */
  1698. u16 port_id;
  1699. /* Reserved for future enhancements. Must be 0. */
  1700. u16 reserved;
  1701. /* The header detailing the memory mapping for out of band. */
  1702. struct mem_mapping_hdr mem_hdr;
  1703. /* The parameter data to be filled when sent inband */
  1704. struct param_hdr_v3 param_hdr;
  1705. } __packed;
  1706. #define AFE_PORT_CMD_SET_PARAM_V2 0x000100EF
  1707. struct afe_port_cmd_set_param_v2 {
  1708. /* APR Header */
  1709. struct apr_hdr apr_hdr;
  1710. /* Port interface and direction (Rx or Tx) to start. */
  1711. u16 port_id;
  1712. /*
  1713. * Actual size of the payload in bytes.
  1714. * This is used for parsing the parameter payload.
  1715. * Supported values: > 0
  1716. */
  1717. u16 payload_size;
  1718. /* The header detailing the memory mapping for out of band. */
  1719. struct mem_mapping_hdr mem_hdr;
  1720. /* The parameter data to be filled when sent inband */
  1721. u8 param_data[0];
  1722. } __packed;
  1723. #define AFE_PORT_CMD_SET_PARAM_V3 0x000100FA
  1724. struct afe_port_cmd_set_param_v3 {
  1725. /* APR Header */
  1726. struct apr_hdr apr_hdr;
  1727. /* Port ID of the AFE port to configure. Port interface and direction
  1728. * (Rx or Tx) to configure. An even number represents the Rx direction,
  1729. * and an odd number represents the Tx direction.
  1730. */
  1731. u16 port_id;
  1732. /* Reserved. This field must be set to zero. */
  1733. u16 reserved;
  1734. /* The memory mapping header to be used when sending outband */
  1735. struct mem_mapping_hdr mem_hdr;
  1736. /* The total size of the payload, including param_hdr_v3 */
  1737. u32 payload_size;
  1738. /*
  1739. * The parameter data to be filled when sent inband.
  1740. * Must include param_hdr packed correctly.
  1741. */
  1742. u8 param_data[0];
  1743. } __packed;
  1744. /* Payload of the #AFE_PARAM_ID_LOOPBACK_GAIN_PER_PATH parameter,
  1745. * which gets/sets loopback gain of a port to an Rx port.
  1746. * The Tx port ID of the loopback is part of the set_param command.
  1747. */
  1748. struct afe_loopback_gain_per_path_param {
  1749. u16 rx_port_id;
  1750. /* Rx port of the loopback. */
  1751. u16 gain;
  1752. /* Loopback gain per path of the port.
  1753. * Supported values: Any number in Q13 format
  1754. */
  1755. } __packed;
  1756. /* Parameter ID used to configure and enable/disable the
  1757. * loopback path. The difference with respect to the existing
  1758. * API, AFE_PORT_CMD_LOOPBACK, is that it allows Rx port to be
  1759. * configured as source port in loopback path. Port-id in
  1760. * AFE_PORT_CMD_SET_PARAM cmd is the source port which can be
  1761. * Tx or Rx port. In addition, we can configure the type of
  1762. * routing mode to handle different use cases.
  1763. */
  1764. #define AFE_PARAM_ID_LOOPBACK_CONFIG 0x0001020B
  1765. #define AFE_API_VERSION_LOOPBACK_CONFIG 0x1
  1766. enum afe_loopback_routing_mode {
  1767. LB_MODE_DEFAULT = 1,
  1768. /* Regular loopback from source to destination port */
  1769. LB_MODE_SIDETONE,
  1770. /* Sidetone feed from Tx source to Rx destination port */
  1771. LB_MODE_EC_REF_VOICE_AUDIO,
  1772. /* Echo canceller reference, voice + audio + DTMF */
  1773. LB_MODE_EC_REF_VOICE
  1774. /* Echo canceller reference, voice alone */
  1775. } __packed;
  1776. /* Payload of the #AFE_PARAM_ID_LOOPBACK_CONFIG ,
  1777. * which enables/disables one AFE loopback.
  1778. */
  1779. struct afe_loopback_cfg_v1 {
  1780. u32 loopback_cfg_minor_version;
  1781. /* Minor version used for tracking the version of the RMC module
  1782. * configuration interface.
  1783. * Supported values: #AFE_API_VERSION_LOOPBACK_CONFIG
  1784. */
  1785. u16 dst_port_id;
  1786. /* Destination Port Id. */
  1787. u16 routing_mode;
  1788. /* Specifies data path type from src to dest port.
  1789. * Supported values:
  1790. * #LB_MODE_DEFAULT
  1791. * #LB_MODE_SIDETONE
  1792. * #LB_MODE_EC_REF_VOICE_AUDIO
  1793. * #LB_MODE_EC_REF_VOICE_A
  1794. * #LB_MODE_EC_REF_VOICE
  1795. */
  1796. u16 enable;
  1797. /* Specifies whether to enable (1) or
  1798. * disable (0) an AFE loopback.
  1799. */
  1800. u16 reserved;
  1801. /* Reserved for 32-bit alignment. This field must be set to 0.
  1802. */
  1803. } __packed;
  1804. struct afe_loopback_sidetone_gain {
  1805. u16 rx_port_id;
  1806. u16 gain;
  1807. } __packed;
  1808. struct afe_display_stream_idx {
  1809. u32 minor_version;
  1810. u32 stream_idx;
  1811. } __packed;
  1812. struct afe_display_ctl_idx {
  1813. u32 minor_version;
  1814. u32 ctl_idx;
  1815. } __packed;
  1816. struct loopback_cfg_data {
  1817. u32 loopback_cfg_minor_version;
  1818. /* Minor version used for tracking the version of the RMC module
  1819. * configuration interface.
  1820. * Supported values: #AFE_API_VERSION_LOOPBACK_CONFIG
  1821. */
  1822. u16 dst_port_id;
  1823. /* Destination Port Id. */
  1824. u16 routing_mode;
  1825. /* Specifies data path type from src to dest port.
  1826. * Supported values:
  1827. * #LB_MODE_DEFAULT
  1828. * #LB_MODE_SIDETONE
  1829. * #LB_MODE_EC_REF_VOICE_AUDIO
  1830. * #LB_MODE_EC_REF_VOICE_A
  1831. * #LB_MODE_EC_REF_VOICE
  1832. */
  1833. u16 enable;
  1834. /* Specifies whether to enable (1) or
  1835. * disable (0) an AFE loopback.
  1836. */
  1837. u16 reserved;
  1838. /* Reserved for 32-bit alignment. This field must be set to 0.
  1839. */
  1840. } __packed;
  1841. struct afe_st_loopback_cfg_v1 {
  1842. struct apr_hdr hdr;
  1843. struct mem_mapping_hdr mem_hdr;
  1844. struct param_hdr_v1 gain_pdata;
  1845. struct afe_loopback_sidetone_gain gain_data;
  1846. struct param_hdr_v1 cfg_pdata;
  1847. struct loopback_cfg_data cfg_data;
  1848. } __packed;
  1849. struct afe_loopback_iir_cfg_v2 {
  1850. struct apr_hdr hdr;
  1851. struct mem_mapping_hdr param;
  1852. struct param_hdr_v1 st_iir_enable_pdata;
  1853. struct afe_mod_enable_param st_iir_mode_enable_data;
  1854. struct param_hdr_v1 st_iir_filter_config_pdata;
  1855. struct afe_sidetone_iir_filter_config_params st_iir_filter_config_data;
  1856. } __packed;
  1857. /*
  1858. * Param ID and related structures for AFE event
  1859. * registration.
  1860. */
  1861. #define AFE_PORT_CMD_MOD_EVENT_CFG 0x000100FD
  1862. struct afe_port_cmd_event_cfg {
  1863. struct apr_hdr hdr;
  1864. uint32_t version;
  1865. /* Version number. The current version is 0 */
  1866. uint32_t port_id;
  1867. /*
  1868. * Port ID for the AFE port hosting the modules
  1869. * being registered for the events
  1870. */
  1871. uint32_t num_events;
  1872. /*
  1873. * Number of events to be registered with the service
  1874. * Each event has the structure of
  1875. * afe_port_cmd_mod_evt_cfg_payload.
  1876. */
  1877. uint8_t payload[0];
  1878. };
  1879. /** Event registration for a module. */
  1880. #define AFE_MODULE_REGISTER_EVENT_FLAG 1
  1881. /** Event de-registration for a module. */
  1882. #define AFE_MODULE_DEREGISTER_EVENT_FLAG 0
  1883. struct afe_port_cmd_mod_evt_cfg_payload {
  1884. uint32_t module_id;
  1885. /* Valid ID of the module. */
  1886. uint16_t instance_id;
  1887. /*
  1888. * Valid ID of the module instance in the current topology.
  1889. * If both module_id and instance_id ID are set to 0, the event is
  1890. * registered with all modules and instances in the topology.
  1891. * If module_id is set to 0 and instance_id is set to a non-zero value,
  1892. * the payload is considered to be invalid.
  1893. */
  1894. uint16_t reserved;
  1895. /* Used for alignment; must be set to 0.*/
  1896. uint32_t event_id;
  1897. /* Unique ID of the event. */
  1898. uint32_t reg_flag;
  1899. /*
  1900. * Bit field for enabling or disabling event registration.
  1901. * values
  1902. * - #AFE_MODULE_REGISTER_EVENT_FLAG
  1903. * - #AFE_MODULE_DEREGISTER_EVENT_FLAG
  1904. */
  1905. } __packed;
  1906. #define AFE_PORT_MOD_EVENT 0x0001010C
  1907. struct afe_port_mod_evt_rsp_hdr {
  1908. uint32_t minor_version;
  1909. /* This indicates the minor version of the payload */
  1910. uint32_t port_id;
  1911. /* AFE port hosting this module */
  1912. uint32_t module_id;
  1913. /* Module ID which is raising the event */
  1914. uint16_t instance_id;
  1915. /* Instance ID of the module which is raising the event */
  1916. uint16_t reserved;
  1917. /* For alignment purpose, should be set to 0 */
  1918. uint32_t event_id;
  1919. /* Valid event ID registered by client */
  1920. uint32_t payload_size;
  1921. /*
  1922. * Size of the event payload
  1923. * This is followed by actual payload corresponding to the event
  1924. */
  1925. } __packed;
  1926. #define AFE_PORT_SP_DC_DETECTION_EVENT 0x0001010D
  1927. #define AFE_MODULE_SPEAKER_PROTECTION 0x00010209
  1928. #define AFE_PARAM_ID_SPKR_PROT_CONFIG 0x0001020a
  1929. #define AFE_API_VERSION_SPKR_PROT_CONFIG 0x1
  1930. #define AFE_SPKR_PROT_EXCURSIONF_LEN 512
  1931. struct afe_spkr_prot_cfg_param_v1 {
  1932. u32 spkr_prot_minor_version;
  1933. /*
  1934. * Minor version used for tracking the version of the
  1935. * speaker protection module configuration interface.
  1936. * Supported values: #AFE_API_VERSION_SPKR_PROT_CONFIG
  1937. */
  1938. int16_t win_size;
  1939. /* Analysis and synthesis window size (nWinSize).
  1940. * Supported values: 1024, 512, 256 samples
  1941. */
  1942. int16_t margin;
  1943. /* Allowable margin for excursion prediction,
  1944. * in L16Q15 format. This is a
  1945. * control parameter to allow
  1946. * for overestimation of peak excursion.
  1947. */
  1948. int16_t spkr_exc_limit;
  1949. /* Speaker excursion limit, in L16Q15 format.*/
  1950. int16_t spkr_resonance_freq;
  1951. /* Resonance frequency of the speaker; used
  1952. * to define a frequency range
  1953. * for signal modification.
  1954. *
  1955. * Supported values: 0 to 2000 Hz
  1956. */
  1957. int16_t limhresh;
  1958. /* Threshold of the hard limiter; used to
  1959. * prevent overshooting beyond a
  1960. * signal level that was set by the limiter
  1961. * prior to speaker protection.
  1962. * Supported values: 0 to 32767
  1963. */
  1964. int16_t hpf_cut_off_freq;
  1965. /* High pass filter cutoff frequency.
  1966. * Supported values: 100, 200, 300 Hz
  1967. */
  1968. int16_t hpf_enable;
  1969. /* Specifies whether the high pass filter
  1970. * is enabled (0) or disabled (1).
  1971. */
  1972. int16_t reserved;
  1973. /* This field must be set to zero. */
  1974. int32_t amp_gain;
  1975. /* Amplifier gain in L32Q15 format.
  1976. * This is the RMS voltage at the
  1977. * loudspeaker when a 0dBFS tone
  1978. * is played in the digital domain.
  1979. */
  1980. int16_t excursionf[AFE_SPKR_PROT_EXCURSIONF_LEN];
  1981. /* Array of the excursion transfer function.
  1982. * The peak excursion of the
  1983. * loudspeaker diaphragm is
  1984. * measured in millimeters for 1 Vrms Sine
  1985. * tone at all FFT bin frequencies.
  1986. * Supported values: Q15 format
  1987. */
  1988. } __packed;
  1989. struct lpass_swr_spkr_dep_cfg_t {
  1990. uint32_t vbatt_pkd_reg_addr;
  1991. uint32_t temp_pkd_reg_addr;
  1992. uint32_t value_normal_thrsd[MAX_CPS_LEVELS];
  1993. uint32_t value_low1_thrsd[MAX_CPS_LEVELS];
  1994. uint32_t value_low2_thrsd[MAX_CPS_LEVELS];
  1995. } __packed;
  1996. struct lpass_swr_hw_reg_cfg_t {
  1997. uint32_t lpass_wr_cmd_reg_phy_addr;
  1998. uint32_t lpass_rd_cmd_reg_phy_addr;
  1999. uint32_t lpass_rd_fifo_reg_phy_addr;
  2000. uint32_t vbatt_lower1_threshold;
  2001. uint32_t vbatt_lower2_threshold;
  2002. uint32_t num_spkr;
  2003. } __packed;
  2004. struct afe_cps_hw_intf_cfg {
  2005. uint32_t lpass_hw_intf_cfg_mode;
  2006. struct lpass_swr_hw_reg_cfg_t hw_reg_cfg;
  2007. struct lpass_swr_spkr_dep_cfg_t *spkr_dep_cfg;
  2008. } __packed;
  2009. #define AFE_SERVICE_CMD_REGISTER_RT_PORT_DRIVER 0x000100E0
  2010. /* Payload of the #AFE_SERVICE_CMD_REGISTER_RT_PORT_DRIVER
  2011. * command, which registers a real-time port driver
  2012. * with the AFE service.
  2013. */
  2014. struct afe_service_cmd_register_rt_port_driver {
  2015. struct apr_hdr hdr;
  2016. u16 port_id;
  2017. /* Port ID with which the real-time driver exchanges data
  2018. * (registers for events).
  2019. * Supported values: #AFE_PORT_ID_RT_PROXY_PORT_RANGE_START to
  2020. * #AFE_PORT_ID_RT_PROXY_PORT_RANGE_END
  2021. */
  2022. u16 reserved;
  2023. /* This field must be set to zero. */
  2024. } __packed;
  2025. #define AFE_SERVICE_CMD_UNREGISTER_RT_PORT_DRIVER 0x000100E1
  2026. /* Payload of the #AFE_SERVICE_CMD_UNREGISTER_RT_PORT_DRIVER
  2027. * command, which unregisters a real-time port driver from
  2028. * the AFE service.
  2029. */
  2030. struct afe_service_cmd_unregister_rt_port_driver {
  2031. struct apr_hdr hdr;
  2032. u16 port_id;
  2033. /* Port ID from which the real-time
  2034. * driver unregisters for events.
  2035. * Supported values: #AFE_PORT_ID_RT_PROXY_PORT_RANGE_START to
  2036. * #AFE_PORT_ID_RT_PROXY_PORT_RANGE_END
  2037. */
  2038. u16 reserved;
  2039. /* This field must be set to zero. */
  2040. } __packed;
  2041. #define AFE_EVENT_RT_PROXY_PORT_STATUS 0x00010105
  2042. #define AFE_EVENTYPE_RT_PROXY_PORT_START 0
  2043. #define AFE_EVENTYPE_RT_PROXY_PORT_STOP 1
  2044. #define AFE_EVENTYPE_RT_PROXY_PORT_LOW_WATER_MARK 2
  2045. #define AFE_EVENTYPE_RT_PROXY_PORT_HIGH_WATER_MARK 3
  2046. #define AFE_EVENTYPE_RT_PROXY_PORT_INVALID 0xFFFF
  2047. /* Payload of the #AFE_EVENT_RT_PROXY_PORT_STATUS
  2048. * message, which sends an event from the AFE service
  2049. * to a registered client.
  2050. */
  2051. struct afe_event_rt_proxy_port_status {
  2052. u16 port_id;
  2053. /* Port ID to which the event is sent.
  2054. * Supported values: #AFE_PORT_ID_RT_PROXY_PORT_RANGE_START to
  2055. * #AFE_PORT_ID_RT_PROXY_PORT_RANGE_END
  2056. */
  2057. u16 eventype;
  2058. /* Type of event.
  2059. * Supported values:
  2060. * - #AFE_EVENTYPE_RT_PROXY_PORT_START
  2061. * - #AFE_EVENTYPE_RT_PROXY_PORT_STOP
  2062. * - #AFE_EVENTYPE_RT_PROXY_PORT_LOW_WATER_MARK
  2063. * - #AFE_EVENTYPE_RT_PROXY_PORT_HIGH_WATER_MARK
  2064. */
  2065. } __packed;
  2066. #define AFE_PORT_DATA_CMD_RT_PROXY_PORT_WRITE_V2 0x000100ED
  2067. struct afe_port_data_cmd_rt_proxy_port_write_v2 {
  2068. struct apr_hdr hdr;
  2069. u16 port_id;
  2070. /* Tx (mic) proxy port ID with which the real-time
  2071. * driver exchanges data.
  2072. * Supported values: #AFE_PORT_ID_RT_PROXY_PORT_RANGE_START to
  2073. * #AFE_PORT_ID_RT_PROXY_PORT_RANGE_END
  2074. */
  2075. u16 reserved;
  2076. /* This field must be set to zero. */
  2077. u32 buffer_address_lsw;
  2078. /* LSW Address of the buffer containing the
  2079. * data from the real-time source
  2080. * device on a client.
  2081. */
  2082. u32 buffer_address_msw;
  2083. /* MSW Address of the buffer containing the
  2084. * data from the real-time source
  2085. * device on a client.
  2086. */
  2087. u32 mem_map_handle;
  2088. /* A memory map handle encapsulating shared memory
  2089. * attributes is returned if
  2090. * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS
  2091. * command is successful.
  2092. * Supported Values:
  2093. * - Any 32 bit value
  2094. */
  2095. u32 available_bytes;
  2096. /* Number of valid bytes available
  2097. * in the buffer (including all
  2098. * channels: number of bytes per
  2099. * channel = availableBytesumChannels).
  2100. * Supported values: > 0
  2101. *
  2102. * This field must be equal to the frame
  2103. * size specified in the #AFE_PORT_AUDIO_IF_CONFIG
  2104. * command that was sent to configure this
  2105. * port.
  2106. */
  2107. } __packed;
  2108. #define AFE_PORT_DATA_CMD_RT_PROXY_PORT_READ_V2 0x000100EE
  2109. /* Payload of the
  2110. * #AFE_PORT_DATA_CMD_RT_PROXY_PORT_READ_V2 command, which
  2111. * delivers an empty buffer to the AFE service. On
  2112. * acknowledgment, data is filled in the buffer.
  2113. */
  2114. struct afe_port_data_cmd_rt_proxy_port_read_v2 {
  2115. struct apr_hdr hdr;
  2116. u16 port_id;
  2117. /* Rx proxy port ID with which the real-time
  2118. * driver exchanges data.
  2119. * Supported values: #AFE_PORT_ID_RT_PROXY_PORT_RANGE_START to
  2120. * #AFE_PORT_ID_RT_PROXY_PORT_RANGE_END
  2121. * (This must be an Rx (speaker) port.)
  2122. */
  2123. u16 reserved;
  2124. /* This field must be set to zero. */
  2125. u32 buffer_address_lsw;
  2126. /* LSW Address of the buffer containing the data sent from the AFE
  2127. * service to a real-time sink device on the client.
  2128. */
  2129. u32 buffer_address_msw;
  2130. /* MSW Address of the buffer containing the data sent from the AFE
  2131. * service to a real-time sink device on the client.
  2132. */
  2133. u32 mem_map_handle;
  2134. /* A memory map handle encapsulating shared memory attributes is
  2135. * returned if AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS command is
  2136. * successful.
  2137. * Supported Values:
  2138. * - Any 32 bit value
  2139. */
  2140. u32 available_bytes;
  2141. /* Number of valid bytes available in the buffer (including all
  2142. * channels).
  2143. * Supported values: > 0
  2144. * This field must be equal to the frame size specified in the
  2145. * #AFE_PORT_AUDIO_IF_CONFIG command that was sent to configure
  2146. * this port.
  2147. */
  2148. } __packed;
  2149. /* This module ID is related to device configuring like I2S,PCM,
  2150. * HDMI, SLIMBus etc. This module supports following parameter ids.
  2151. * - #AFE_PARAM_ID_I2S_CONFIG
  2152. * - #AFE_PARAM_ID_PCM_CONFIG
  2153. * - #AFE_PARAM_ID_DIGI_MIC_CONFIG
  2154. * - #AFE_PARAM_ID_HDMI_CONFIG
  2155. * - #AFE_PARAM_ID_INTERNAL_BT_FM_CONFIG
  2156. * - #AFE_PARAM_ID_SLIMBUS_CONFIG
  2157. * - #AFE_PARAM_ID_RT_PROXY_CONFIG
  2158. */
  2159. #define AFE_MODULE_AUDIO_DEV_INTERFACE 0x0001020C
  2160. #define AFE_PORT_SAMPLE_RATE_8K 8000
  2161. #define AFE_PORT_SAMPLE_RATE_16K 16000
  2162. #define AFE_PORT_SAMPLE_RATE_32K 32000
  2163. #define AFE_PORT_SAMPLE_RATE_44_1K 44100
  2164. #define AFE_PORT_SAMPLE_RATE_48K 48000
  2165. #define AFE_PORT_SAMPLE_RATE_96K 96000
  2166. #define AFE_PORT_SAMPLE_RATE_176P4K 176400
  2167. #define AFE_PORT_SAMPLE_RATE_192K 192000
  2168. #define AFE_PORT_SAMPLE_RATE_352P8K 352800
  2169. #define AFE_LINEAR_PCM_DATA 0x0
  2170. #define AFE_NON_LINEAR_DATA 0x1
  2171. #define AFE_LINEAR_PCM_DATA_PACKED_60958 0x2
  2172. #define AFE_NON_LINEAR_DATA_PACKED_60958 0x3
  2173. #define AFE_GENERIC_COMPRESSED 0x8
  2174. #define AFE_LINEAR_PCM_DATA_PACKED_16BIT 0X6
  2175. #define AFE_DSD_DOP_W_MARKER_DATA 0x9
  2176. #define AFE_DSD_DATA 0xA
  2177. /* This param id is used to configure I2S interface */
  2178. #define AFE_PARAM_ID_I2S_CONFIG 0x0001020D
  2179. #define AFE_API_VERSION_I2S_CONFIG 0x1
  2180. /* Enumeration for setting the I2S configuration
  2181. * channel_mode parameter to
  2182. * serial data wire number 1-3 (SD3).
  2183. */
  2184. #define AFE_PORT_I2S_SD0 0x1
  2185. #define AFE_PORT_I2S_SD1 0x2
  2186. #define AFE_PORT_I2S_SD2 0x3
  2187. #define AFE_PORT_I2S_SD3 0x4
  2188. #define AFE_PORT_I2S_QUAD01 0x5
  2189. #define AFE_PORT_I2S_QUAD23 0x6
  2190. #define AFE_PORT_I2S_6CHS 0x7
  2191. #define AFE_PORT_I2S_8CHS 0x8
  2192. #define AFE_PORT_I2S_10CHS 0x9
  2193. #define AFE_PORT_I2S_12CHS 0xA
  2194. #define AFE_PORT_I2S_14CHS 0xB
  2195. #define AFE_PORT_I2S_16CHS 0xC
  2196. #define AFE_PORT_I2S_SD4 0xD
  2197. #define AFE_PORT_I2S_SD5 0xE
  2198. #define AFE_PORT_I2S_SD6 0xF
  2199. #define AFE_PORT_I2S_SD7 0x10
  2200. #define AFE_PORT_I2S_QUAD45 0x11
  2201. #define AFE_PORT_I2S_QUAD67 0x12
  2202. #define AFE_PORT_I2S_8CHS_2 0x13
  2203. #define AFE_PORT_I2S_MONO 0x0
  2204. #define AFE_PORT_I2S_STEREO 0x1
  2205. #define AFE_PORT_CONFIG_I2S_WS_SRC_EXTERNAL 0x0
  2206. #define AFE_PORT_CONFIG_I2S_WS_SRC_INTERNAL 0x1
  2207. /* Payload of the #AFE_PARAM_ID_I2S_CONFIG
  2208. * command's (I2S configuration
  2209. * parameter).
  2210. */
  2211. struct afe_param_id_i2s_cfg {
  2212. u32 i2s_cfg_minor_version;
  2213. /* Minor version used for tracking the version of the I2S
  2214. * configuration interface.
  2215. * Supported values: #AFE_API_VERSION_I2S_CONFIG
  2216. */
  2217. u16 bit_width;
  2218. /* Bit width of the sample.
  2219. * Supported values: 16, 24
  2220. */
  2221. u16 channel_mode;
  2222. /* I2S lines and multichannel operation.
  2223. * Supported values:
  2224. * - #AFE_PORT_I2S_SD0
  2225. * - #AFE_PORT_I2S_SD1
  2226. * - #AFE_PORT_I2S_SD2
  2227. * - #AFE_PORT_I2S_SD3
  2228. * - #AFE_PORT_I2S_QUAD01
  2229. * - #AFE_PORT_I2S_QUAD23
  2230. * - #AFE_PORT_I2S_6CHS
  2231. * - #AFE_PORT_I2S_8CHS
  2232. * - #AFE_PORT_I2S_10CHS
  2233. * - #AFE_PORT_I2S_12CHS
  2234. * - #AFE_PORT_I2S_14CHS
  2235. * - #AFE_PORT_I2S_16CHS
  2236. * - #AFE_PORT_I2S_SD4
  2237. * - #AFE_PORT_I2S_SD5
  2238. * - #AFE_PORT_I2S_SD6
  2239. * - #AFE_PORT_I2S_SD7
  2240. * - #AFE_PORT_I2S_QUAD45
  2241. * - #AFE_PORT_I2S_QUAD67
  2242. * - #AFE_PORT_I2S_8CHS_2
  2243. */
  2244. u16 mono_stereo;
  2245. /* Specifies mono or stereo. This applies only when
  2246. * a single I2S line is used.
  2247. * Supported values:
  2248. * - #AFE_PORT_I2S_MONO
  2249. * - #AFE_PORT_I2S_STEREO
  2250. */
  2251. u16 ws_src;
  2252. /* Word select source: internal or external.
  2253. * Supported values:
  2254. * - #AFE_PORT_CONFIG_I2S_WS_SRC_EXTERNAL
  2255. * - #AFE_PORT_CONFIG_I2S_WS_SRC_INTERNAL
  2256. */
  2257. u32 sample_rate;
  2258. /* Sampling rate of the port.
  2259. * Supported values:
  2260. * - #AFE_PORT_SAMPLE_RATE_8K
  2261. * - #AFE_PORT_SAMPLE_RATE_16K
  2262. * - #AFE_PORT_SAMPLE_RATE_48K
  2263. * - #AFE_PORT_SAMPLE_RATE_96K
  2264. * - #AFE_PORT_SAMPLE_RATE_192K
  2265. */
  2266. u16 data_format;
  2267. /* data format
  2268. * Supported values:
  2269. * - #LINEAR_PCM_DATA
  2270. * - #NON_LINEAR_DATA
  2271. * - #LINEAR_PCM_DATA_PACKED_IN_60958
  2272. * - #NON_LINEAR_DATA_PACKED_IN_60958
  2273. * - #AFE_DSD_DOP_W_MARKER_DATA
  2274. */
  2275. u16 reserved;
  2276. /* This field must be set to zero. */
  2277. } __packed;
  2278. /* This param id is used to configure META I2S interface */
  2279. #define AFE_PARAM_ID_META_I2S_CONFIG 0x000102C5
  2280. #define AFE_API_VERSION_META_I2S_CONFIG 0x1
  2281. #define MAX_NUM_I2S_META_PORT_MEMBER_PORTS 4
  2282. /* Payload of the #AFE_PARAM_ID_META_I2S_CONFIG
  2283. * command's (I2S configuration
  2284. * parameter).
  2285. */
  2286. struct afe_param_id_meta_i2s_cfg {
  2287. u32 minor_version;
  2288. /* Minor version used for tracking the version of the I2S
  2289. * configuration interface.
  2290. * Supported values: #AFE_API_VERSION_META_I2S_CONFIG
  2291. */
  2292. u16 bit_width;
  2293. /* Bit width of the sample.
  2294. * Supported values: 16, 24
  2295. */
  2296. u16 ws_src;
  2297. /* Word select source: internal or external.
  2298. * Supported values:
  2299. * - #AFE_PORT_CONFIG_I2S_WS_SRC_EXTERNAL
  2300. * - #AFE_PORT_CONFIG_I2S_WS_SRC_INTERNAL
  2301. */
  2302. u32 sample_rate;
  2303. /* Sampling rate of the port.
  2304. * Supported values:
  2305. * - #AFE_PORT_SAMPLE_RATE_8K
  2306. * - #AFE_PORT_SAMPLE_RATE_16K
  2307. * - #AFE_PORT_SAMPLE_RATE_48K
  2308. * - #AFE_PORT_SAMPLE_RATE_96K
  2309. * - #AFE_PORT_SAMPLE_RATE_192K
  2310. */
  2311. u16 member_port_id[MAX_NUM_I2S_META_PORT_MEMBER_PORTS];
  2312. /* Array of member port IDs in this meta device.
  2313. * Supported values:
  2314. * - #AFE_PORT_ID_PRIMARY_MI2S_RX
  2315. * - #AFE_PORT_ID_SECONDARY_MI2S_RX
  2316. * - #AFE_PORT_ID_TERTIARY_MI2S_RX
  2317. * - #AFE_PORT_ID_QUATERNY_MI2S_RX
  2318. * - #AFE_PORT_ID_INVALID
  2319. *
  2320. * Fill these values from index 0. Set unused index to AFE_PORT_ID_INVALID.
  2321. *
  2322. * Note:
  2323. * the first member port will act as WS master in case
  2324. * meta port ws_src is configured as AFE_PORT_CONFIG_I2S_WS_SRC_INTERNAL.
  2325. * In all other cases member ports will act as slave.
  2326. * This must be considered when HLOS enables the interface clocks
  2327. */
  2328. u16 member_port_channel_mode[MAX_NUM_I2S_META_PORT_MEMBER_PORTS];
  2329. /* I2S lines and multichannel operation per member port.
  2330. * The sequence matches the sequence in member_port_id,
  2331. * value will be ignored if member port is set to AFE_PORT_ID_INVALID
  2332. *
  2333. * Supported values:
  2334. * - #AFE_PORT_I2S_SD0
  2335. * - #AFE_PORT_I2S_SD1
  2336. * - #AFE_PORT_I2S_SD2
  2337. * - #AFE_PORT_I2S_SD3
  2338. * - #AFE_PORT_I2S_QUAD01
  2339. * - #AFE_PORT_I2S_QUAD23
  2340. * - #AFE_PORT_I2S_6CHS
  2341. * - #AFE_PORT_I2S_8CHS
  2342. * - #AFE_PORT_I2S_10CHS
  2343. * - #AFE_PORT_I2S_12CHS
  2344. * - #AFE_PORT_I2S_14CHS
  2345. * - #AFE_PORT_I2S_16CHS
  2346. * - #AFE_PORT_I2S_SD4
  2347. * - #AFE_PORT_I2S_SD5
  2348. * - #AFE_PORT_I2S_SD6
  2349. * - #AFE_PORT_I2S_SD7
  2350. * - #AFE_PORT_I2S_QUAD45
  2351. * - #AFE_PORT_I2S_QUAD67
  2352. * - #AFE_PORT_I2S_8CHS_2
  2353. */
  2354. u16 data_format;
  2355. /* data format
  2356. * Supported values:
  2357. * - #LINEAR_PCM_DATA
  2358. */
  2359. u16 reserved;
  2360. /* This field must be set to zero. */
  2361. } __packed;
  2362. /*
  2363. * This param id is used to configure PCM interface
  2364. */
  2365. #define AFE_API_VERSION_SPDIF_CONFIG_V2 0x2
  2366. #define AFE_API_VERSION_SPDIF_CONFIG 0x1
  2367. #define AFE_API_VERSION_SPDIF_CH_STATUS_CONFIG 0x1
  2368. #define AFE_API_VERSION_SPDIF_CLK_CONFIG 0x1
  2369. #define AFE_CH_STATUS_A 1
  2370. #define AFE_CH_STATUS_B 2
  2371. #define AFE_PARAM_ID_SPDIF_CONFIG 0x00010244
  2372. #define AFE_PARAM_ID_CH_STATUS_CONFIG 0x00010245
  2373. #define AFE_PARAM_ID_SPDIF_CLK_CONFIG 0x00010246
  2374. #define AFE_PORT_CLK_ROOT_LPAPLL 0x3
  2375. #define AFE_PORT_CLK_ROOT_LPAQ6PLL 0x4
  2376. #define AFE_MODULE_CUSTOM_EVENTS 0x00010251
  2377. #define AFE_PORT_FMT_UPDATE_EVENT 0x0001010E
  2378. #define AFE_API_VERSION_EVENT_FMT_UPDATE 0x1
  2379. #define AFE_PORT_STATUS_NO_SIGNAL 0
  2380. #define AFE_PORT_STATUS_AUDIO_ACTIVE 1
  2381. #define AFE_PORT_STATUS_AUDIO_EOS 2
  2382. struct afe_param_id_spdif_cfg_v2 {
  2383. /* Minor version used for tracking the version of the SPDIF
  2384. * configuration interface.
  2385. * Supported values: #AFE_API_VERSION_SPDIF_CONFIG,
  2386. * #AFE_API_VERSION_SPDIF_CONFIG_V2
  2387. */
  2388. u32 spdif_cfg_minor_version;
  2389. /* Sampling rate of the port.
  2390. * Supported values:
  2391. * - #AFE_PORT_SAMPLE_RATE_22_05K
  2392. * - #AFE_PORT_SAMPLE_RATE_32K
  2393. * - #AFE_PORT_SAMPLE_RATE_44_1K
  2394. * - #AFE_PORT_SAMPLE_RATE_48K
  2395. * - #AFE_PORT_SAMPLE_RATE_96K
  2396. * - #AFE_PORT_SAMPLE_RATE_176_4K
  2397. * - #AFE_PORT_SAMPLE_RATE_192K
  2398. */
  2399. u32 sample_rate;
  2400. /* data format
  2401. * Supported values:
  2402. * - #AFE_LINEAR_PCM_DATA
  2403. * - #AFE_NON_LINEAR_DATA
  2404. */
  2405. u16 data_format;
  2406. /* Number of channels supported by the port
  2407. * - PCM - 1, Compressed Case - 2
  2408. */
  2409. u16 num_channels;
  2410. /* Bit width of the sample.
  2411. * Supported values: 16, 24
  2412. */
  2413. u16 bit_width;
  2414. /* This field must be set to zero. */
  2415. u16 reserved;
  2416. /* Input select for spdif input, must be set to 0 for spdif output. */
  2417. u32 src_sel;
  2418. } __packed;
  2419. struct afe_param_id_spdif_ch_status_cfg {
  2420. u32 ch_status_cfg_minor_version;
  2421. /* Minor version used for tracking the version of channel
  2422. * status configuration. Current supported version is 1
  2423. */
  2424. u32 status_type;
  2425. /* Indicate if the channel status is for channel A or B
  2426. * Supported values:
  2427. * - #AFE_CH_STATUS_A
  2428. * - #AFE_CH_STATUS_B
  2429. */
  2430. u8 status_bits[24];
  2431. /* Channel status - 192 bits for channel
  2432. * Byte ordering as defined by IEC60958-3
  2433. */
  2434. u8 status_mask[24];
  2435. /* Channel status with mask bits 1 will be applied.
  2436. * Byte ordering as defined by IEC60958-3
  2437. */
  2438. } __packed;
  2439. /* deprecated */
  2440. struct afe_param_id_spdif_clk_cfg {
  2441. u32 clk_cfg_minor_version;
  2442. /* Minor version used for tracking the version of SPDIF
  2443. * interface clock configuration. Current supported version
  2444. * is 1
  2445. */
  2446. u32 clk_value;
  2447. /* Specifies the clock frequency in Hz to set
  2448. * Supported values:
  2449. * 0 - Disable the clock
  2450. * 2 (byphase) * 32 (60958 subframe size) * sampling rate * 2
  2451. * (channels A and B)
  2452. */
  2453. u32 clk_root;
  2454. /* Specifies SPDIF root clk source
  2455. * Supported Values:
  2456. * - #AFE_PORT_CLK_ROOT_LPAPLL
  2457. * - #AFE_PORT_CLK_ROOT_LPAQ6PLL
  2458. */
  2459. } __packed;
  2460. struct afe_event_fmt_update {
  2461. /* Tracks the configuration of this event. */
  2462. u32 minor_version;
  2463. /* Detected port status.
  2464. * Supported values:
  2465. * - #AFE_PORT_STATUS_NO_SIGNAL
  2466. * - #AFE_PORT_STATUS_AUDIO_ACTIVE
  2467. * - #AFE_PORT_STATUS_AUDIO_EOS
  2468. */
  2469. u32 status;
  2470. /* Sampling rate of the port.
  2471. * Supported values:
  2472. * - #AFE_PORT_SAMPLE_RATE_32K
  2473. * - #AFE_PORT_SAMPLE_RATE_44_1K
  2474. * - #AFE_PORT_SAMPLE_RATE_48K
  2475. * - #AFE_PORT_SAMPLE_RATE_88_2K
  2476. * - #AFE_PORT_SAMPLE_RATE_96K
  2477. * - #AFE_PORT_SAMPLE_RATE_176_4K
  2478. * - #AFE_PORT_SAMPLE_RATE_192K
  2479. */
  2480. u32 sample_rate;
  2481. /* Data format of the port.
  2482. * Supported values:
  2483. * - #AFE_LINEAR_PCM_DATA
  2484. * - #AFE_NON_LINEAR_DATA
  2485. */
  2486. u16 data_format;
  2487. /* First 6 bytes of channel status bits */
  2488. u8 channel_status[6];
  2489. } __packed;
  2490. struct afe_spdif_port_config {
  2491. struct afe_param_id_spdif_cfg_v2 cfg;
  2492. struct afe_param_id_spdif_ch_status_cfg ch_status;
  2493. } __packed;
  2494. #define AFE_PARAM_ID_PCM_CONFIG 0x0001020E
  2495. #define AFE_API_VERSION_PCM_CONFIG 0x1
  2496. /* Enumeration for the auxiliary PCM synchronization signal
  2497. * provided by an external source.
  2498. */
  2499. #define AFE_PORT_PCM_SYNC_SRC_EXTERNAL 0x0
  2500. /* Enumeration for the auxiliary PCM synchronization signal
  2501. * provided by an internal source.
  2502. */
  2503. #define AFE_PORT_PCM_SYNC_SRC_INTERNAL 0x1
  2504. /* Enumeration for the PCM configuration aux_mode parameter,
  2505. * which configures the auxiliary PCM interface to use
  2506. * short synchronization.
  2507. */
  2508. #define AFE_PORT_PCM_AUX_MODE_PCM 0x0
  2509. /*
  2510. * Enumeration for the PCM configuration aux_mode parameter,
  2511. * which configures the auxiliary PCM interface to use long
  2512. * synchronization.
  2513. */
  2514. #define AFE_PORT_PCM_AUX_MODE_AUX 0x1
  2515. /*
  2516. * Enumeration for setting the PCM configuration frame to 8.
  2517. */
  2518. #define AFE_PORT_PCM_BITS_PER_FRAME_8 0x0
  2519. /*
  2520. * Enumeration for setting the PCM configuration frame to 16.
  2521. */
  2522. #define AFE_PORT_PCM_BITS_PER_FRAME_16 0x1
  2523. /* Enumeration for setting the PCM configuration frame to 32.*/
  2524. #define AFE_PORT_PCM_BITS_PER_FRAME_32 0x2
  2525. /* Enumeration for setting the PCM configuration frame to 64.*/
  2526. #define AFE_PORT_PCM_BITS_PER_FRAME_64 0x3
  2527. /* Enumeration for setting the PCM configuration frame to 128.*/
  2528. #define AFE_PORT_PCM_BITS_PER_FRAME_128 0x4
  2529. /* Enumeration for setting the PCM configuration frame to 256.*/
  2530. #define AFE_PORT_PCM_BITS_PER_FRAME_256 0x5
  2531. /* Enumeration for setting the PCM configuration
  2532. * quantype parameter to A-law with no padding.
  2533. */
  2534. #define AFE_PORT_PCM_ALAW_NOPADDING 0x0
  2535. /* Enumeration for setting the PCM configuration quantype
  2536. * parameter to mu-law with no padding.
  2537. */
  2538. #define AFE_PORT_PCM_MULAW_NOPADDING 0x1
  2539. /* Enumeration for setting the PCM configuration quantype
  2540. * parameter to linear with no padding.
  2541. */
  2542. #define AFE_PORT_PCM_LINEAR_NOPADDING 0x2
  2543. /* Enumeration for setting the PCM configuration quantype
  2544. * parameter to A-law with padding.
  2545. */
  2546. #define AFE_PORT_PCM_ALAW_PADDING 0x3
  2547. /* Enumeration for setting the PCM configuration quantype
  2548. * parameter to mu-law with padding.
  2549. */
  2550. #define AFE_PORT_PCM_MULAW_PADDING 0x4
  2551. /* Enumeration for setting the PCM configuration quantype
  2552. * parameter to linear with padding.
  2553. */
  2554. #define AFE_PORT_PCM_LINEAR_PADDING 0x5
  2555. /* Enumeration for disabling the PCM configuration
  2556. * ctrl_data_out_enable parameter.
  2557. * The PCM block is the only master.
  2558. */
  2559. #define AFE_PORT_PCM_CTRL_DATA_OE_DISABLE 0x0
  2560. /*
  2561. * Enumeration for enabling the PCM configuration
  2562. * ctrl_data_out_enable parameter. The PCM block shares
  2563. * the signal with other masters.
  2564. */
  2565. #define AFE_PORT_PCM_CTRL_DATA_OE_ENABLE 0x1
  2566. /* Payload of the #AFE_PARAM_ID_PCM_CONFIG command's
  2567. * (PCM configuration parameter).
  2568. */
  2569. struct afe_param_id_pcm_cfg {
  2570. u32 pcm_cfg_minor_version;
  2571. /* Minor version used for tracking the version of the AUX PCM
  2572. * configuration interface.
  2573. * Supported values: #AFE_API_VERSION_PCM_CONFIG
  2574. */
  2575. u16 aux_mode;
  2576. /* PCM synchronization setting.
  2577. * Supported values:
  2578. * - #AFE_PORT_PCM_AUX_MODE_PCM
  2579. * - #AFE_PORT_PCM_AUX_MODE_AUX
  2580. */
  2581. u16 sync_src;
  2582. /* Synchronization source.
  2583. * Supported values:
  2584. * - #AFE_PORT_PCM_SYNC_SRC_EXTERNAL
  2585. * - #AFE_PORT_PCM_SYNC_SRC_INTERNAL
  2586. */
  2587. u16 frame_setting;
  2588. /* Number of bits per frame.
  2589. * Supported values:
  2590. * - #AFE_PORT_PCM_BITS_PER_FRAME_8
  2591. * - #AFE_PORT_PCM_BITS_PER_FRAME_16
  2592. * - #AFE_PORT_PCM_BITS_PER_FRAME_32
  2593. * - #AFE_PORT_PCM_BITS_PER_FRAME_64
  2594. * - #AFE_PORT_PCM_BITS_PER_FRAME_128
  2595. * - #AFE_PORT_PCM_BITS_PER_FRAME_256
  2596. */
  2597. u16 quantype;
  2598. /* PCM quantization type.
  2599. * Supported values:
  2600. * - #AFE_PORT_PCM_ALAW_NOPADDING
  2601. * - #AFE_PORT_PCM_MULAW_NOPADDING
  2602. * - #AFE_PORT_PCM_LINEAR_NOPADDING
  2603. * - #AFE_PORT_PCM_ALAW_PADDING
  2604. * - #AFE_PORT_PCM_MULAW_PADDING
  2605. * - #AFE_PORT_PCM_LINEAR_PADDING
  2606. */
  2607. u16 ctrl_data_out_enable;
  2608. /* Specifies whether the PCM block shares the data-out
  2609. * signal to the drive with other masters.
  2610. * Supported values:
  2611. * - #AFE_PORT_PCM_CTRL_DATA_OE_DISABLE
  2612. * - #AFE_PORT_PCM_CTRL_DATA_OE_ENABLE
  2613. */
  2614. u16 reserved;
  2615. /* This field must be set to zero. */
  2616. u32 sample_rate;
  2617. /* Sampling rate of the port.
  2618. * Supported values:
  2619. * - #AFE_PORT_SAMPLE_RATE_8K
  2620. * - #AFE_PORT_SAMPLE_RATE_16K
  2621. */
  2622. u16 bit_width;
  2623. /* Bit width of the sample.
  2624. * Supported values: 16
  2625. */
  2626. u16 num_channels;
  2627. /* Number of channels.
  2628. * Supported values: 1 to 4
  2629. */
  2630. u16 slot_number_mapping[4];
  2631. /* Specifies the slot number for the each channel in
  2632. * multi channel scenario.
  2633. * Supported values: 1 to 32
  2634. */
  2635. } __packed;
  2636. /*
  2637. * This param id is used to configure DIGI MIC interface
  2638. */
  2639. #define AFE_PARAM_ID_DIGI_MIC_CONFIG 0x0001020F
  2640. /* This version information is used to handle the new
  2641. * additions to the config interface in future in backward
  2642. * compatible manner.
  2643. */
  2644. #define AFE_API_VERSION_DIGI_MIC_CONFIG 0x1
  2645. /* Enumeration for setting the digital mic configuration
  2646. * channel_mode parameter to left 0.
  2647. */
  2648. #define AFE_PORT_DIGI_MIC_MODE_LEFT0 0x1
  2649. /*Enumeration for setting the digital mic configuration
  2650. * channel_mode parameter to right 0.
  2651. */
  2652. #define AFE_PORT_DIGI_MIC_MODE_RIGHT0 0x2
  2653. /* Enumeration for setting the digital mic configuration
  2654. * channel_mode parameter to left 1.
  2655. */
  2656. #define AFE_PORT_DIGI_MIC_MODE_LEFT1 0x3
  2657. /* Enumeration for setting the digital mic configuration
  2658. * channel_mode parameter to right 1.
  2659. */
  2660. #define AFE_PORT_DIGI_MIC_MODE_RIGHT1 0x4
  2661. /* Enumeration for setting the digital mic configuration
  2662. * channel_mode parameter to stereo 0.
  2663. */
  2664. #define AFE_PORT_DIGI_MIC_MODE_STEREO0 0x5
  2665. /* Enumeration for setting the digital mic configuration
  2666. * channel_mode parameter to stereo 1.
  2667. */
  2668. #define AFE_PORT_DIGI_MIC_MODE_STEREO1 0x6
  2669. /* Enumeration for setting the digital mic configuration
  2670. * channel_mode parameter to quad.
  2671. */
  2672. #define AFE_PORT_DIGI_MIC_MODE_QUAD 0x7
  2673. /* Payload of the #AFE_PARAM_ID_DIGI_MIC_CONFIG command's
  2674. * (DIGI MIC configuration
  2675. * parameter).
  2676. */
  2677. struct afe_param_id_digi_mic_cfg {
  2678. u32 digi_mic_cfg_minor_version;
  2679. /* Minor version used for tracking the version of the DIGI Mic
  2680. * configuration interface.
  2681. * Supported values: #AFE_API_VERSION_DIGI_MIC_CONFIG
  2682. */
  2683. u16 bit_width;
  2684. /* Bit width of the sample.
  2685. * Supported values: 16
  2686. */
  2687. u16 channel_mode;
  2688. /* Digital mic and multichannel operation.
  2689. * Supported values:
  2690. * - #AFE_PORT_DIGI_MIC_MODE_LEFT0
  2691. * - #AFE_PORT_DIGI_MIC_MODE_RIGHT0
  2692. * - #AFE_PORT_DIGI_MIC_MODE_LEFT1
  2693. * - #AFE_PORT_DIGI_MIC_MODE_RIGHT1
  2694. * - #AFE_PORT_DIGI_MIC_MODE_STEREO0
  2695. * - #AFE_PORT_DIGI_MIC_MODE_STEREO1
  2696. * - #AFE_PORT_DIGI_MIC_MODE_QUAD
  2697. */
  2698. u32 sample_rate;
  2699. /* Sampling rate of the port.
  2700. * Supported values:
  2701. * - #AFE_PORT_SAMPLE_RATE_8K
  2702. * - #AFE_PORT_SAMPLE_RATE_16K
  2703. * - #AFE_PORT_SAMPLE_RATE_48K
  2704. */
  2705. } __packed;
  2706. /* This param id is used to configure HDMI interface */
  2707. #define AFE_PARAM_ID_HDMI_CONFIG 0x00010210
  2708. #define AFE_PARAM_ID_HDMI_DP_MST_VID_IDX_CFG 0x000102b5
  2709. #define AFE_PARAM_ID_HDMI_DPTX_IDX_CFG 0x000102b6
  2710. /* This version information is used to handle the new
  2711. * additions to the config interface in future in backward
  2712. * compatible manner.
  2713. */
  2714. #define AFE_API_VERSION_HDMI_CONFIG 0x1
  2715. /* Payload of the #AFE_PARAM_ID_HDMI_CONFIG command,
  2716. * which configures a multichannel HDMI audio interface.
  2717. */
  2718. struct afe_param_id_hdmi_multi_chan_audio_cfg {
  2719. u32 hdmi_cfg_minor_version;
  2720. /* Minor version used for tracking the version of the HDMI
  2721. * configuration interface.
  2722. * Supported values: #AFE_API_VERSION_HDMI_CONFIG
  2723. */
  2724. u16 datatype;
  2725. /* data type
  2726. * Supported values:
  2727. * - #LINEAR_PCM_DATA
  2728. * - #NON_LINEAR_DATA
  2729. * - #LINEAR_PCM_DATA_PACKED_IN_60958
  2730. * - #NON_LINEAR_DATA_PACKED_IN_60958
  2731. */
  2732. u16 channel_allocation;
  2733. /* HDMI channel allocation information for programming an HDMI
  2734. * frame. The default is 0 (Stereo).
  2735. *
  2736. * This information is defined in the HDMI standard, CEA 861-D
  2737. * (refer to @xhyperref{S1,[S1]}). The number of channels is also
  2738. * inferred from this parameter.
  2739. */
  2740. u32 sample_rate;
  2741. /* Sampling rate of the port.
  2742. * Supported values:
  2743. * - #AFE_PORT_SAMPLE_RATE_8K
  2744. * - #AFE_PORT_SAMPLE_RATE_16K
  2745. * - #AFE_PORT_SAMPLE_RATE_48K
  2746. * - #AFE_PORT_SAMPLE_RATE_96K
  2747. * - 22050, 44100, 176400 for compressed streams
  2748. */
  2749. u16 bit_width;
  2750. /* Bit width of the sample.
  2751. * Supported values: 16, 24
  2752. */
  2753. u16 reserved;
  2754. /* This field must be set to zero. */
  2755. } __packed;
  2756. /* This param id is used to configure BT or FM(RIVA) interface */
  2757. #define AFE_PARAM_ID_INTERNAL_BT_FM_CONFIG 0x00010211
  2758. /* This version information is used to handle the new
  2759. * additions to the config interface in future in backward
  2760. * compatible manner.
  2761. */
  2762. #define AFE_API_VERSION_INTERNAL_BT_FM_CONFIG 0x1
  2763. /* Payload of the #AFE_PARAM_ID_INTERNAL_BT_FM_CONFIG
  2764. * command's BT voice/BT audio/FM configuration parameter.
  2765. */
  2766. struct afe_param_id_internal_bt_fm_cfg {
  2767. u32 bt_fm_cfg_minor_version;
  2768. /* Minor version used for tracking the version of the BT and FM
  2769. * configuration interface.
  2770. * Supported values: #AFE_API_VERSION_INTERNAL_BT_FM_CONFIG
  2771. */
  2772. u16 num_channels;
  2773. /* Number of channels.
  2774. * Supported values: 1 to 2
  2775. */
  2776. u16 bit_width;
  2777. /* Bit width of the sample.
  2778. * Supported values: 16
  2779. */
  2780. u32 sample_rate;
  2781. /* Sampling rate of the port.
  2782. * Supported values:
  2783. * - #AFE_PORT_SAMPLE_RATE_8K (only for BTSCO)
  2784. * - #AFE_PORT_SAMPLE_RATE_16K (only for BTSCO)
  2785. * - #AFE_PORT_SAMPLE_RATE_48K (FM and A2DP)
  2786. */
  2787. } __packed;
  2788. /* This param id is used to configure SLIMBUS interface using
  2789. * shared channel approach.
  2790. */
  2791. /* ID of the parameter used to set the latency mode of the
  2792. * USB audio device.
  2793. */
  2794. #define AFE_PARAM_ID_PORT_LATENCY_MODE_CONFIG 0x000102B3
  2795. /* Minor version used for tracking USB audio latency mode */
  2796. #define AFE_API_MINOR_VERSION_USB_AUDIO_LATENCY_MODE 0x1
  2797. /* Supported AFE port latency modes */
  2798. #define AFE_PORT_DEFAULT_LATENCY_MODE 0x0
  2799. #define AFE_PORT_LOW_LATENCY_MODE 0x1
  2800. #define AFE_PARAM_ID_SLIMBUS_CONFIG 0x00010212
  2801. /* This version information is used to handle the new
  2802. * additions to the config interface in future in backward
  2803. * compatible manner.
  2804. */
  2805. #define AFE_API_VERSION_SLIMBUS_CONFIG 0x1
  2806. /* Enumeration for setting SLIMbus device ID 1. */
  2807. #define AFE_SLIMBUS_DEVICE_1 0x0
  2808. /* Enumeration for setting SLIMbus device ID 2. */
  2809. #define AFE_SLIMBUS_DEVICE_2 0x1
  2810. /* Enumeration for setting the SLIMbus data formats. */
  2811. #define AFE_SB_DATA_FORMAT_NOT_INDICATED 0x0
  2812. /* Enumeration for setting the maximum number of streams per
  2813. * device.
  2814. */
  2815. #define AFE_PORT_MAX_AUDIO_CHAN_CNT 0x8
  2816. #define AFE_PORT_MAX_AUDIO_CHAN_CNT_V2 0x20
  2817. /* Payload of the #AFE_PORT_CMD_SLIMBUS_CONFIG command's SLIMbus
  2818. * port configuration parameter.
  2819. */
  2820. struct afe_param_id_slimbus_cfg {
  2821. u32 sb_cfg_minor_version;
  2822. /* Minor version used for tracking the version of the SLIMBUS
  2823. * configuration interface.
  2824. * Supported values: #AFE_API_VERSION_SLIMBUS_CONFIG
  2825. */
  2826. u16 slimbus_dev_id;
  2827. /* SLIMbus hardware device ID, which is required to handle
  2828. * multiple SLIMbus hardware blocks.
  2829. * Supported values: - #AFE_SLIMBUS_DEVICE_1 - #AFE_SLIMBUS_DEVICE_2
  2830. */
  2831. u16 bit_width;
  2832. /* Bit width of the sample.
  2833. * Supported values: 16, 24
  2834. */
  2835. u16 data_format;
  2836. /* Data format supported by the SLIMbus hardware. The default is
  2837. * 0 (#AFE_SB_DATA_FORMAT_NOT_INDICATED), which indicates the
  2838. * hardware does not perform any format conversions before the data
  2839. * transfer.
  2840. */
  2841. u16 num_channels;
  2842. /* Number of channels.
  2843. * Supported values: 1 to #AFE_PORT_MAX_AUDIO_CHAN_CNT
  2844. */
  2845. u8 shared_ch_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT];
  2846. /* Mapping of shared channel IDs (128 to 255) to which the
  2847. * master port is to be connected.
  2848. * Shared_channel_mapping[i] represents the shared channel assigned
  2849. * for audio channel i in multichannel audio data.
  2850. */
  2851. u32 sample_rate;
  2852. /* Sampling rate of the port.
  2853. * Supported values:
  2854. * - #AFE_PORT_SAMPLE_RATE_8K
  2855. * - #AFE_PORT_SAMPLE_RATE_16K
  2856. * - #AFE_PORT_SAMPLE_RATE_48K
  2857. * - #AFE_PORT_SAMPLE_RATE_96K
  2858. * - #AFE_PORT_SAMPLE_RATE_192K
  2859. */
  2860. } __packed;
  2861. /* ID of the parameter used by AFE_PARAM_ID_USB_AUDIO_DEV_PARAMS to configure
  2862. * USB audio device parameter. It should be used with
  2863. * AFE_MODULE_AUDIO_DEV_INTERFACE
  2864. */
  2865. #define AFE_PARAM_ID_USB_AUDIO_DEV_PARAMS 0x000102A5
  2866. /* ID of the parameter used to set the endianness value for the
  2867. * USB audio device. It should be used with
  2868. * AFE_MODULE_AUDIO_DEV_INTERFACE
  2869. */
  2870. #define AFE_PARAM_ID_USB_AUDIO_DEV_LPCM_FMT 0x000102AA
  2871. /* Minor version used for tracking USB audio configuration */
  2872. #define AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG 0x1
  2873. /* Payload of the AFE_PARAM_ID_USB_AUDIO_DEV_PARAMS parameter used by
  2874. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  2875. */
  2876. struct afe_param_id_usb_audio_dev_params {
  2877. /* Minor version used for tracking USB audio device parameter.
  2878. * Supported values: AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG
  2879. */
  2880. u32 cfg_minor_version;
  2881. /* Token of actual end USB aduio device */
  2882. u32 dev_token;
  2883. } __packed;
  2884. struct afe_param_id_usb_audio_dev_lpcm_fmt {
  2885. /* Minor version used for tracking USB audio device parameter.
  2886. * Supported values: AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG
  2887. */
  2888. u32 cfg_minor_version;
  2889. /* Endianness of actual end USB audio device */
  2890. u32 endian;
  2891. } __packed;
  2892. struct afe_param_id_usb_audio_dev_latency_mode {
  2893. /* Minor version used for tracking USB audio device parameter.
  2894. * Supported values: AFE_API_MINOR_VERSION_USB_AUDIO_LATENCY_MODE
  2895. */
  2896. u32 minor_version;
  2897. /* latency mode for the USB audio device */
  2898. u32 mode;
  2899. } __packed;
  2900. #define AFE_PARAM_ID_USB_AUDIO_SVC_INTERVAL 0x000102B7
  2901. struct afe_param_id_usb_audio_svc_interval {
  2902. /* Minor version used for tracking USB audio device parameter.
  2903. * Supported values: AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG
  2904. */
  2905. u32 cfg_minor_version;
  2906. /* Endianness of actual end USB audio device */
  2907. u32 svc_interval;
  2908. } __packed;
  2909. /* ID of the parameter used by AFE_PARAM_ID_USB_AUDIO_CONFIG to configure
  2910. * USB audio interface. It should be used with AFE_MODULE_AUDIO_DEV_INTERFACE
  2911. */
  2912. #define AFE_PARAM_ID_USB_AUDIO_CONFIG 0x000102A4
  2913. /* Payload of the AFE_PARAM_ID_USB_AUDIO_CONFIG parameter used by
  2914. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  2915. */
  2916. struct afe_param_id_usb_audio_cfg {
  2917. /* Minor version used for tracking USB audio device configuration.
  2918. * Supported values: AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG
  2919. */
  2920. u32 cfg_minor_version;
  2921. /* Sampling rate of the port.
  2922. * Supported values:
  2923. * - AFE_PORT_SAMPLE_RATE_8K
  2924. * - AFE_PORT_SAMPLE_RATE_11025
  2925. * - AFE_PORT_SAMPLE_RATE_12K
  2926. * - AFE_PORT_SAMPLE_RATE_16K
  2927. * - AFE_PORT_SAMPLE_RATE_22050
  2928. * - AFE_PORT_SAMPLE_RATE_24K
  2929. * - AFE_PORT_SAMPLE_RATE_32K
  2930. * - AFE_PORT_SAMPLE_RATE_44P1K
  2931. * - AFE_PORT_SAMPLE_RATE_48K
  2932. * - AFE_PORT_SAMPLE_RATE_96K
  2933. * - AFE_PORT_SAMPLE_RATE_192K
  2934. */
  2935. u32 sample_rate;
  2936. /* Bit width of the sample.
  2937. * Supported values: 16, 24
  2938. */
  2939. u16 bit_width;
  2940. /* Number of channels.
  2941. * Supported values: 1 and 2
  2942. */
  2943. u16 num_channels;
  2944. /* Data format supported by the USB. The supported value is
  2945. * 0 (#AFE_USB_AUDIO_DATA_FORMAT_LINEAR_PCM).
  2946. */
  2947. u16 data_format;
  2948. /* this field must be 0 */
  2949. u16 reserved;
  2950. /* device token of actual end USB aduio device */
  2951. u32 dev_token;
  2952. /* endianness of this interface */
  2953. u32 endian;
  2954. /* service interval */
  2955. u32 service_interval;
  2956. } __packed;
  2957. /* This param id is used to configure Real Time Proxy interface. */
  2958. #define AFE_PARAM_ID_RT_PROXY_CONFIG 0x00010213
  2959. /* This version information is used to handle the new
  2960. * additions to the config interface in future in backward
  2961. * compatible manner.
  2962. */
  2963. #define AFE_API_VERSION_RT_PROXY_CONFIG 0x1
  2964. /* Payload of the #AFE_PARAM_ID_RT_PROXY_CONFIG
  2965. * command (real-time proxy port configuration parameter).
  2966. */
  2967. struct afe_param_id_rt_proxy_port_cfg {
  2968. u32 rt_proxy_cfg_minor_version;
  2969. /* Minor version used for tracking the version of rt-proxy
  2970. * config interface.
  2971. */
  2972. u16 bit_width;
  2973. /* Bit width of the sample.
  2974. * Supported values: 16
  2975. */
  2976. u16 interleaved;
  2977. /* Specifies whether the data exchanged between the AFE
  2978. * interface and real-time port is interleaved.
  2979. * Supported values: - 0 -- Non-interleaved (samples from each
  2980. * channel are contiguous in the buffer) - 1 -- Interleaved
  2981. * (corresponding samples from each input channel are interleaved
  2982. * within the buffer)
  2983. */
  2984. u16 frame_size;
  2985. /* Size of the frames that are used for PCM exchanges with this
  2986. * port.
  2987. * Supported values: > 0, in bytes
  2988. * For example, 5 ms buffers of 16 bits and 16 kHz stereo samples
  2989. * is 5 ms * 16 samples/ms * 2 bytes/sample * 2 channels = 320
  2990. * bytes.
  2991. */
  2992. u16 jitter_allowance;
  2993. /* Configures the amount of jitter that the port will allow.
  2994. * Supported values: > 0
  2995. * For example, if +/-10 ms of jitter is anticipated in the timing
  2996. * of sending frames to the port, and the configuration is 16 kHz
  2997. * mono with 16-bit samples, this field is 10 ms * 16 samples/ms * 2
  2998. * bytes/sample = 320.
  2999. */
  3000. u16 low_water_mark;
  3001. /* Low watermark in bytes (including all channels).
  3002. * Supported values:
  3003. * - 0 -- Do not send any low watermark events
  3004. * - > 0 -- Low watermark for triggering an event
  3005. * If the number of bytes in an internal circular buffer is lower
  3006. * than this low_water_mark parameter, a LOW_WATER_MARK event is
  3007. * sent to applications (via the #AFE_EVENT_RT_PROXY_PORT_STATUS
  3008. * event).
  3009. * Use of watermark events is optional for debugging purposes.
  3010. */
  3011. u16 high_water_mark;
  3012. /* High watermark in bytes (including all channels).
  3013. * Supported values:
  3014. * - 0 -- Do not send any high watermark events
  3015. * - > 0 -- High watermark for triggering an event
  3016. * If the number of bytes in an internal circular buffer exceeds
  3017. * TOTAL_CIRC_BUF_SIZE minus high_water_mark, a high watermark event
  3018. * is sent to applications (via the #AFE_EVENT_RT_PROXY_PORT_STATUS
  3019. * event).
  3020. * The use of watermark events is optional and for debugging
  3021. * purposes.
  3022. */
  3023. u32 sample_rate;
  3024. /* Sampling rate of the port.
  3025. * Supported values:
  3026. * - #AFE_PORT_SAMPLE_RATE_8K
  3027. * - #AFE_PORT_SAMPLE_RATE_16K
  3028. * - #AFE_PORT_SAMPLE_RATE_48K
  3029. */
  3030. u16 num_channels;
  3031. /* Number of channels.
  3032. * Supported values: 1 to #AFE_PORT_MAX_AUDIO_CHAN_CNT
  3033. */
  3034. u16 reserved;
  3035. /* For 32 bit alignment. */
  3036. } __packed;
  3037. /* This param id is used to configure the Pseudoport interface */
  3038. #define AFE_PARAM_ID_PSEUDO_PORT_CONFIG 0x00010219
  3039. /* Version information used to handle future additions to the configuration
  3040. * interface (for backward compatibility).
  3041. */
  3042. #define AFE_API_VERSION_PSEUDO_PORT_CONFIG 0x1
  3043. /* Enumeration for setting the timing_mode parameter to faster than real
  3044. * time.
  3045. */
  3046. #define AFE_PSEUDOPORT_TIMING_MODE_FTRT 0x0
  3047. /* Enumeration for setting the timing_mode parameter to real time using
  3048. * timers.
  3049. */
  3050. #define AFE_PSEUDOPORT_TIMING_MODE_TIMER 0x1
  3051. /* Payload of the AFE_PARAM_ID_PSEUDO_PORT_CONFIG parameter used by
  3052. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  3053. */
  3054. struct afe_param_id_pseudo_port_cfg {
  3055. u32 pseud_port_cfg_minor_version;
  3056. /*
  3057. * Minor version used for tracking the version of the pseudoport
  3058. * configuration interface.
  3059. */
  3060. u16 bit_width;
  3061. /* Bit width of the sample at values 16, 24 */
  3062. u16 num_channels;
  3063. /* Number of channels at values 1 to 8 */
  3064. u16 data_format;
  3065. /* Non-linear data format supported by the pseudoport (for future use).
  3066. * At values #AFE_LINEAR_PCM_DATA
  3067. */
  3068. u16 timing_mode;
  3069. /* Indicates whether the pseudoport synchronizes to the clock or
  3070. * operates faster than real time.
  3071. * at values
  3072. * - #AFE_PSEUDOPORT_TIMING_MODE_FTRT
  3073. * - #AFE_PSEUDOPORT_TIMING_MODE_TIMER @tablebulletend
  3074. */
  3075. u32 sample_rate;
  3076. /* Sample rate at which the pseudoport will run.
  3077. * at values
  3078. * - #AFE_PORT_SAMPLE_RATE_8K
  3079. * - #AFE_PORT_SAMPLE_RATE_32K
  3080. * - #AFE_PORT_SAMPLE_RATE_48K
  3081. * - #AFE_PORT_SAMPLE_RATE_96K
  3082. * - #AFE_PORT_SAMPLE_RATE_192K @tablebulletend
  3083. */
  3084. } __packed;
  3085. #define AFE_PARAM_ID_TDM_CONFIG 0x0001029D
  3086. #define AFE_API_VERSION_TDM_CONFIG 1
  3087. #define AFE_PORT_TDM_SHORT_SYNC_BIT_MODE 0
  3088. #define AFE_PORT_TDM_LONG_SYNC_MODE 1
  3089. #define AFE_PORT_TDM_SHORT_SYNC_SLOT_MODE 2
  3090. #define AFE_PORT_TDM_SYNC_SRC_EXTERNAL 0
  3091. #define AFE_PORT_TDM_SYNC_SRC_INTERNAL 1
  3092. #define AFE_PORT_TDM_CTRL_DATA_OE_DISABLE 0
  3093. #define AFE_PORT_TDM_CTRL_DATA_OE_ENABLE 1
  3094. #define AFE_PORT_TDM_SYNC_NORMAL 0
  3095. #define AFE_PORT_TDM_SYNC_INVERT 1
  3096. #define AFE_PORT_TDM_DATA_DELAY_0_BCLK_CYCLE 0
  3097. #define AFE_PORT_TDM_DATA_DELAY_1_BCLK_CYCLE 1
  3098. #define AFE_PORT_TDM_DATA_DELAY_2_BCLK_CYCLE 2
  3099. /* Payload of the AFE_PARAM_ID_TDM_CONFIG parameter used by
  3100. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  3101. */
  3102. struct afe_param_id_tdm_cfg {
  3103. u32 tdm_cfg_minor_version;
  3104. /* < Minor version used to track TDM configuration.
  3105. * @values #AFE_API_VERSION_TDM_CONFIG
  3106. */
  3107. u32 num_channels;
  3108. /* < Number of enabled slots for TDM frame.
  3109. * @values 1 to 8
  3110. */
  3111. u32 sample_rate;
  3112. /* < Sampling rate of the port.
  3113. * @values
  3114. * - #AFE_PORT_SAMPLE_RATE_8K
  3115. * - #AFE_PORT_SAMPLE_RATE_16K
  3116. * - #AFE_PORT_SAMPLE_RATE_24K
  3117. * - #AFE_PORT_SAMPLE_RATE_32K
  3118. * - #AFE_PORT_SAMPLE_RATE_48K
  3119. * - #AFE_PORT_SAMPLE_RATE_176P4K
  3120. * - #AFE_PORT_SAMPLE_RATE_352P8K @tablebulletend
  3121. */
  3122. u32 bit_width;
  3123. /* < Bit width of the sample.
  3124. * @values 16, 24
  3125. */
  3126. u16 data_format;
  3127. /* < Data format: linear ,compressed, generic compresssed
  3128. * @values
  3129. * - #AFE_LINEAR_PCM_DATA
  3130. * - #AFE_NON_LINEAR_DATA
  3131. * - #AFE_GENERIC_COMPRESSED
  3132. */
  3133. u16 sync_mode;
  3134. /* < TDM synchronization setting.
  3135. * @values (short, long, slot) sync mode
  3136. * - #AFE_PORT_TDM_SHORT_SYNC_BIT_MODE
  3137. * - #AFE_PORT_TDM_LONG_SYNC_MODE
  3138. * - #AFE_PORT_TDM_SHORT_SYNC_SLOT_MODE @tablebulletend
  3139. */
  3140. u16 sync_src;
  3141. /* < Synchronization source.
  3142. * @values
  3143. * - #AFE_PORT_TDM_SYNC_SRC_EXTERNAL
  3144. * - #AFE_PORT_TDM_SYNC_SRC_INTERNAL @tablebulletend
  3145. */
  3146. u16 nslots_per_frame;
  3147. /* < Number of slots per frame. Typical : 1, 2, 4, 8, 16, 32.
  3148. * @values 1 - 32
  3149. */
  3150. u16 ctrl_data_out_enable;
  3151. /* < Specifies whether the TDM block shares the data-out signal to the
  3152. * drive with other masters.
  3153. * @values
  3154. * - #AFE_PORT_TDM_CTRL_DATA_OE_DISABLE
  3155. * - #AFE_PORT_TDM_CTRL_DATA_OE_ENABLE @tablebulletend
  3156. */
  3157. u16 ctrl_invert_sync_pulse;
  3158. /* < Specifies whether to invert the sync or not.
  3159. * @values
  3160. * - #AFE_PORT_TDM_SYNC_NORMAL
  3161. * - #AFE_PORT_TDM_SYNC_INVERT @tablebulletend
  3162. */
  3163. u16 ctrl_sync_data_delay;
  3164. /* < Specifies the number of bit clock to delay data with respect to
  3165. * sync edge.
  3166. * @values
  3167. * - #AFE_PORT_TDM_DATA_DELAY_0_BCLK_CYCLE
  3168. * - #AFE_PORT_TDM_DATA_DELAY_1_BCLK_CYCLE
  3169. * - #AFE_PORT_TDM_DATA_DELAY_2_BCLK_CYCLE @tablebulletend
  3170. */
  3171. u16 slot_width;
  3172. /* < Slot width of the slot in a TDM frame. (slot_width >= bit_width)
  3173. * have to be satisfied.
  3174. * @values 16, 24, 32
  3175. */
  3176. u32 slot_mask;
  3177. /* < Position of active slots. When that bit is set,
  3178. * that paricular slot is active.
  3179. * Number of active slots can be inferred by number of
  3180. * bits set in the mask. Only 8 individual bits can be enabled.
  3181. * Bits 0..31 corresponding to slot 0..31
  3182. * @values 1 to 2^32 - 1
  3183. */
  3184. } __packed;
  3185. /* ID of Time Divsion Multiplexing (TDM) module,
  3186. * which is used for configuring the AFE TDM.
  3187. *
  3188. * This module supports following parameter IDs:
  3189. * - #AFE_PORT_TDM_SLOT_CONFIG
  3190. *
  3191. * To configure the TDM interface, the client must use the
  3192. * #AFE_PORT_CMD_SET_PARAM command, and fill the module ID with the
  3193. * respective parameter IDs as listed above.
  3194. */
  3195. #define AFE_MODULE_TDM 0x0001028A
  3196. /* ID of the parameter used by #AFE_MODULE_TDM to configure
  3197. * the TDM slot mapping. #AFE_PORT_CMD_SET_PARAM can use this parameter ID.
  3198. */
  3199. #define AFE_PARAM_ID_PORT_SLOT_MAPPING_CONFIG 0x00010297
  3200. /* Version information used to handle future additions to slot mapping
  3201. * configuration (for backward compatibility).
  3202. */
  3203. #define AFE_API_VERSION_SLOT_MAPPING_CONFIG 0x1
  3204. /** Version information used to handle future additions to slot mapping
  3205. * configuration support 32 channels.
  3206. */
  3207. #define AFE_API_VERSION_SLOT_MAPPING_CONFIG_V2 0x2
  3208. /* Data align type */
  3209. #define AFE_SLOT_MAPPING_DATA_ALIGN_MSB 0
  3210. #define AFE_SLOT_MAPPING_DATA_ALIGN_LSB 1
  3211. #define AFE_SLOT_MAPPING_OFFSET_INVALID 0xFFFF
  3212. /* Payload of the AFE_PARAM_ID_PORT_SLOT_MAPPING_CONFIG
  3213. * command's TDM configuration parameter.
  3214. */
  3215. struct afe_param_id_slot_mapping_cfg {
  3216. u32 minor_version;
  3217. /* < Minor version used for tracking TDM slot configuration.
  3218. * @values #AFE_API_VERSION_TDM_SLOT_CONFIG
  3219. */
  3220. u16 num_channel;
  3221. /* < number of channel of the audio sample.
  3222. * @values 1, 2, 4, 6, 8 @tablebulletend
  3223. */
  3224. u16 bitwidth;
  3225. /* < Slot bit width for each channel
  3226. * @values 16, 24, 32
  3227. */
  3228. u32 data_align_type;
  3229. /* < indicate how data packed from slot_offset for 32 slot bit width
  3230. * in case of sample bit width is 24.
  3231. * @values
  3232. * #AFE_SLOT_MAPPING_DATA_ALIGN_MSB
  3233. * #AFE_SLOT_MAPPING_DATA_ALIGN_LSB
  3234. */
  3235. u16 offset[AFE_PORT_MAX_AUDIO_CHAN_CNT];
  3236. /* < Array of the slot mapping start offset in bytes for this frame.
  3237. * The bytes is counted from 0. The 0 is mapped to the 1st byte
  3238. * in or out of the digital serial data line this sub-frame belong to.
  3239. * slot_offset[] setting is per-channel based.
  3240. * The max num of channel supported is 8.
  3241. * The valid offset value must always be continuly placed in from
  3242. * index 0.
  3243. * Set offset as AFE_SLOT_MAPPING_OFFSET_INVALID for not used arrays.
  3244. * If "slot_bitwidth_per_channel" is 32 and "sample_bitwidth" is 24,
  3245. * "data_align_type" is used to indicate how 24 bit sample data in
  3246. * aligning with 32 bit slot width per-channel.
  3247. * @values, in byte
  3248. */
  3249. } __packed;
  3250. /* Payload of the AFE_PARAM_ID_PORT_SLOT_MAPPING_CONFIG_V2
  3251. * command's TDM configuration parameter.
  3252. */
  3253. struct afe_param_id_slot_mapping_cfg_v2 {
  3254. u32 minor_version;
  3255. /**< Minor version used for tracking TDM slot configuration.
  3256. * @values #AFE_API_VERSION_TDM_SLOT_CONFIG
  3257. */
  3258. u16 num_channel;
  3259. /**< number of channel of the audio sample.
  3260. * @values 1, 2, 4, 6, 8, 16, 32 @tablebulletend
  3261. */
  3262. u16 bitwidth;
  3263. /**< Slot bit width for each channel
  3264. * @values 16, 24, 32
  3265. */
  3266. u32 data_align_type;
  3267. /**< indicate how data packed from slot_offset for 32 slot bit width
  3268. * in case of sample bit width is 24.
  3269. * @values
  3270. * #AFE_SLOT_MAPPING_DATA_ALIGN_MSB
  3271. * #AFE_SLOT_MAPPING_DATA_ALIGN_LSB
  3272. */
  3273. u16 offset[AFE_PORT_MAX_AUDIO_CHAN_CNT_V2];
  3274. /**< Array of the slot mapping start offset in bytes for this frame.
  3275. * The bytes is counted from 0. The 0 is mapped to the 1st byte
  3276. * in or out of the digital serial data line this sub-frame belong to.
  3277. * slot_offset[] setting is per-channel based.
  3278. * The max num of channel supported is 8.
  3279. * The valid offset value must always be continuly placed in
  3280. * from index 0.
  3281. * Set offset as AFE_SLOT_MAPPING_OFFSET_INVALID for not used arrays.
  3282. * If "slot_bitwidth_per_channel" is 32 and "sample_bitwidth" is 24,
  3283. * "data_align_type" is used to indicate how 24 bit sample data in
  3284. * aligning with 32 bit slot width per-channel.
  3285. * @values, in byte
  3286. */
  3287. } __packed;
  3288. /** ID of the parameter used by #AFE_MODULE_TDM to configure
  3289. the customer TDM header. #AFE_PORT_CMD_SET_PARAM can use this parameter ID.
  3290. */
  3291. #define AFE_PARAM_ID_CUSTOM_TDM_HEADER_CONFIG 0x00010298
  3292. /* Version information used to handle future additions to custom TDM header
  3293. * configuration (for backward compatibility).
  3294. */
  3295. #define AFE_API_VERSION_CUSTOM_TDM_HEADER_CONFIG 0x1
  3296. #define AFE_CUSTOM_TDM_HEADER_TYPE_INVALID 0x0
  3297. #define AFE_CUSTOM_TDM_HEADER_TYPE_DEFAULT 0x1
  3298. #define AFE_CUSTOM_TDM_HEADER_TYPE_ENTERTAINMENT_MOST 0x2
  3299. #define AFE_CUSTOM_TDM_HEADER_MAX_CNT 0x8
  3300. /* Payload of the AFE_PARAM_ID_CUSTOM_TDM_HEADER_CONFIG parameter ID */
  3301. struct afe_param_id_custom_tdm_header_cfg {
  3302. u32 minor_version;
  3303. /* < Minor version used for tracking custom TDM header configuration.
  3304. * @values #AFE_API_VERSION_CUSTOM_TDM_HEADER_CONFIG
  3305. */
  3306. u16 start_offset;
  3307. /* < the slot mapping start offset in bytes from this sub-frame
  3308. * The bytes is counted from 0. The 0 is mapped to the 1st byte in or
  3309. * out of the digital serial data line this sub-frame belong to.
  3310. * @values, in byte,
  3311. * supported values are 0, 4, 8
  3312. */
  3313. u16 header_width;
  3314. /* < the header width per-frame followed.
  3315. * 2 bytes for MOST/TDM case
  3316. * @values, in byte
  3317. * supported value is 2
  3318. */
  3319. u16 header_type;
  3320. /* < Indicate what kind of custom TDM header it is.
  3321. * @values #AFE_CUSTOM_TDM_HEADER_TYPE_INVALID = 0
  3322. * #AFE_CUSTOM_TDM_HEADER_TYPE_DEFAULT = 1 (for AAN channel per MOST)
  3323. * #AFE_CUSTOM_TDM_HEADER_TYPE_ENTERTAINMENT_MOST = 2
  3324. * (for entertainment channel, which will overwrite
  3325. * AFE_API_VERSION_TDM_SAD_HEADER_TYPE_DEFAULT per MOST)
  3326. */
  3327. u16 num_frame_repeat;
  3328. /* < num of header followed.
  3329. * @values, supported value is 8
  3330. */
  3331. u16 header[AFE_CUSTOM_TDM_HEADER_MAX_CNT];
  3332. /* < SAD header for MOST/TDM case is followed as payload as below.
  3333. * The size of followed SAD header in bytes is num_of_frame_repeat *
  3334. * header_width_per_frame, which is 2 * 8 = 16 bytes here.
  3335. * the supported payload format is in uint16_t as below
  3336. * uint16_t header0; SyncHi 0x3C Info[4] - CodecType -> 0x3C00
  3337. * uint16_t header1; SyncLo 0xB2 Info[5] - SampleWidth -> 0xB218
  3338. * uint16_t header2; DTCP Info Info[6] - unused -> 0x0
  3339. * uint16_t header3; Extension Info[7] - ASAD-Value -> 0xC0
  3340. * uint16_t header4; Reserved Info[0] - Num of bytes following -> 0x7
  3341. * uint16_t header5; Reserved Info[1] - Media Type -> 0x0
  3342. * uint16_t header6; Reserved Info[2] - Bitrate[kbps] - High Byte -> 0x0
  3343. * uint16_t header7; Reserved Info[3] - Bitrate[kbps] - Low Byte -> 0x0
  3344. */
  3345. } __packed;
  3346. struct afe_tdm_port_config {
  3347. struct afe_param_id_tdm_cfg tdm;
  3348. struct afe_param_id_slot_mapping_cfg slot_mapping;
  3349. struct afe_param_id_slot_mapping_cfg_v2 slot_mapping_v2;
  3350. struct afe_param_id_custom_tdm_header_cfg custom_tdm_header;
  3351. } __packed;
  3352. #define AFE_PARAM_ID_DEVICE_HW_DELAY 0x00010243
  3353. #define AFE_API_VERSION_DEVICE_HW_DELAY 0x1
  3354. struct afe_param_id_device_hw_delay_cfg {
  3355. uint32_t device_hw_delay_minor_version;
  3356. uint32_t delay_in_us;
  3357. } __packed;
  3358. #define AFE_PARAM_ID_SET_TOPOLOGY 0x0001025A
  3359. #define AFE_PARAM_ID_DEREGISTER_TOPOLOGY 0x000102E8
  3360. #define AFE_API_VERSION_TOPOLOGY_V1 0x1
  3361. struct afe_param_id_set_topology_cfg {
  3362. /*
  3363. * Minor version used for tracking afe topology id configuration.
  3364. * @values #AFE_API_VERSION_TOPOLOGY_V1
  3365. */
  3366. u32 minor_version;
  3367. /*
  3368. * Id of the topology for the afe session.
  3369. * @values Any valid AFE topology ID
  3370. */
  3371. u32 topology_id;
  3372. } __packed;
  3373. #define AFE_PARAM_ID_CODEC_DMA_DATA_ALIGN 0x000102EA
  3374. struct afe_param_id_cdc_dma_data_align {
  3375. uint32_t cdc_dma_data_align;
  3376. } __packed;
  3377. #define MAX_ABR_LEVELS 5
  3378. struct afe_bit_rate_level_map_t {
  3379. /*
  3380. * Key value pair for link quality level to bitrate
  3381. * mapping in AFE
  3382. */
  3383. uint32_t link_quality_level;
  3384. uint32_t bitrate;
  3385. } __packed;
  3386. struct afe_quality_level_to_bitrate_info {
  3387. /*
  3388. * Number of quality levels being mapped.
  3389. * This will be equal to the size of mapping table.
  3390. */
  3391. uint32_t num_levels;
  3392. /*
  3393. * Quality level to bitrate mapping table
  3394. */
  3395. struct afe_bit_rate_level_map_t bit_rate_level_map[MAX_ABR_LEVELS];
  3396. } __packed;
  3397. struct afe_imc_dec_enc_info {
  3398. /*
  3399. * Decoder to encoder communication direction.
  3400. * Transmit = 0 / Receive = 1
  3401. */
  3402. uint32_t direction;
  3403. /*
  3404. * Enable / disable IMC between decoder and encoder
  3405. */
  3406. uint32_t enable;
  3407. /*
  3408. * Purpose of IMC being set up between decoder and encoder.
  3409. * Param ID defined for link quality feedback in LPASS will
  3410. * be the default value sent as purpose.
  3411. * Supported values:
  3412. * AFE_ENCDEC_PURPOSE_ID_BT_INFO
  3413. */
  3414. uint32_t purpose;
  3415. /*
  3416. * Unique communication instance ID.
  3417. * Data type a2dp_abr_instance used to set instance ID.
  3418. * purpose and comm_instance together form the actual key
  3419. * used in IMC registration, which must be the same for
  3420. * encoder and decoder for which IMC is being set up.
  3421. */
  3422. uint32_t comm_instance;
  3423. } __packed;
  3424. struct afe_abr_dec_cfg_t {
  3425. struct afe_imc_dec_enc_info imc_info;
  3426. bool is_abr_enabled;
  3427. } __packed;
  3428. struct afe_abr_enc_cfg_t {
  3429. /*
  3430. * Link quality level to bitrate mapping info sent to DSP.
  3431. */
  3432. struct afe_quality_level_to_bitrate_info mapping_info;
  3433. /*
  3434. * Information to set up IMC between decoder and encoder.
  3435. */
  3436. struct afe_imc_dec_enc_info imc_info;
  3437. /*
  3438. * Flag to indicate whether ABR is enabled.
  3439. */
  3440. bool is_abr_enabled;
  3441. } __packed;
  3442. #define AFE_PARAM_ID_APTX_SYNC_MODE 0x00013205
  3443. struct afe_param_id_aptx_sync_mode {
  3444. /*
  3445. * sync mode: 0x0 = stereo sync mode (default)
  3446. * 0x01 = dual mono sync mode
  3447. * 0x02 = dual mono with no sync on either L or R
  3448. */
  3449. uint32_t sync_mode;
  3450. } __packed;
  3451. #define AFE_ID_APTX_ADAPTIVE_ENC_INIT 0x00013324
  3452. struct afe_id_aptx_adaptive_enc_init
  3453. {
  3454. uint32_t sampling_freq;
  3455. uint32_t mtu;
  3456. uint32_t channel_mode;
  3457. uint32_t min_sink_modeA;
  3458. uint32_t max_sink_modeA;
  3459. uint32_t min_sink_modeB;
  3460. uint32_t max_sink_modeB;
  3461. uint32_t min_sink_modeC;
  3462. uint32_t max_sink_modeC;
  3463. uint32_t mode;
  3464. uint32_t input_mode;
  3465. uint32_t fade_duration;
  3466. uint8_t sink_cap[11];
  3467. } __attribute__ ((packed));
  3468. /*
  3469. * Generic encoder module ID.
  3470. * This module supports the following parameter IDs:
  3471. * #AVS_ENCODER_PARAM_ID_ENC_FMT_ID (cannot be set run time)
  3472. * #AVS_ENCODER_PARAM_ID_ENC_CFG_BLK (may be set run time)
  3473. * #AVS_ENCODER_PARAM_ID_ENC_BITRATE (may be set run time)
  3474. * #AVS_ENCODER_PARAM_ID_PACKETIZER_ID (cannot be set run time)
  3475. * Opcode - AVS_MODULE_ID_ENCODER
  3476. * AFE Command AFE_PORT_CMD_SET_PARAM_V2 supports this module ID.
  3477. */
  3478. #define AFE_MODULE_ID_ENCODER 0x00013229
  3479. /* Macro for defining the packetizer ID: COP. */
  3480. #define AFE_MODULE_ID_PACKETIZER_COP 0x0001322A
  3481. /*
  3482. * Packetizer type parameter for the #AVS_MODULE_ID_ENCODER module.
  3483. * This parameter cannot be set runtime.
  3484. */
  3485. #define AFE_ENCODER_PARAM_ID_PACKETIZER_ID 0x0001322E
  3486. /*
  3487. * Encoder config block parameter for the #AVS_MODULE_ID_ENCODER module.
  3488. * This parameter may be set runtime.
  3489. */
  3490. #define AFE_ENCODER_PARAM_ID_ENC_CFG_BLK 0x0001322C
  3491. /*
  3492. * Encoder format ID parameter for the #AVS_MODULE_ID_ENCODER module.
  3493. * This parameter cannot be set runtime.
  3494. */
  3495. #define AFE_ENCODER_PARAM_ID_ENC_FMT_ID 0x0001322B
  3496. /*
  3497. * Decoder format ID parameter for the #AVS_MODULE_ID_DECODER module.
  3498. * This parameter cannot be set runtime.
  3499. */
  3500. #define AFE_DECODER_PARAM_ID_DEC_FMT_ID 0x00013234
  3501. /*
  3502. * Encoder scrambler parameter for the #AVS_MODULE_ID_ENCODER module.
  3503. * This parameter cannot be set runtime.
  3504. */
  3505. #define AFE_ENCODER_PARAM_ID_ENABLE_SCRAMBLING 0x0001323C
  3506. /*
  3507. * Link quality level to bitrate mapping info sent to AFE Encoder.
  3508. * This parameter may be set runtime.
  3509. */
  3510. #define AFE_ENCODER_PARAM_ID_BIT_RATE_LEVEL_MAP 0x000132E1
  3511. /*
  3512. * Parameter to set up Inter Module Communication (IMC) between
  3513. * AFE Decoder and Encoder.
  3514. * This parameter may be set runtime.
  3515. */
  3516. #define AFE_ENCDEC_PARAM_ID_DEC_TO_ENC_COMMUNICATION 0x0001323D
  3517. /*
  3518. * This is needed to be used only for SWB voice call use case.
  3519. * This is needed to be issued for each direction (RX AFE and TX AFE)
  3520. * along with AFE_PARAM_ID_PORT_MEDIA_TYPE
  3521. * (Issuing AF_PARAM_ID_RATE_MATCHED_PORT param alone is not useful).
  3522. */
  3523. #define AFE_PARAM_ID_RATE_MATCHED_PORT 0x000102BE
  3524. /*
  3525. * Purpose of IMC set up between encoder and decoder.
  3526. * Communication instance and purpose together form the
  3527. * actual key used for IMC registration.
  3528. */
  3529. #define AFE_ENCDEC_PURPOSE_ID_BT_INFO 0x000132E2
  3530. #define AFE_MODULE_ID_DECODER 0x00013231
  3531. /*
  3532. * Macro for defining the depacketizer ID: COP.
  3533. */
  3534. #define AFE_MODULE_ID_DEPACKETIZER_COP 0x00013233
  3535. #define AFE_MODULE_ID_DEPACKETIZER_COP_V1 0x000132E9
  3536. /* Macros for dynamic loading of modules by AVCS */
  3537. #define AVS_MODULE_ID_PACKETIZER_COP 0x0001322A
  3538. #define AVS_MODULE_ID_PACKETIZER_COP_V1 0x000132E8
  3539. #define AVS_MODULE_ID_DEPACKETIZER_COP 0x00013233
  3540. #define AVS_MODULE_ID_DEPACKETIZER_COP_V1 0x000132E9
  3541. /*
  3542. * Depacketizer type parameter for the #AVS_MODULE_ID_DECODER module.
  3543. * This parameter cannot be set runtime.
  3544. */
  3545. #define AFE_DECODER_PARAM_ID_DEPACKETIZER_ID 0x00013235
  3546. #define CAPI_V2_PARAM_ID_APTX_ENC_SWITCH_TO_MONO 0x0001332A
  3547. #define CAPI_V2_PARAM_ID_APTX_AD_ENC_SWITCH_TO_MONO 0x00013354
  3548. struct aptx_channel_mode_param_t {
  3549. u32 channel_mode;
  3550. } __packed;
  3551. /*
  3552. * Decoder buffer ID parameter for the #AVS_MODULE_ID_DECODER module.
  3553. * This parameter cannot be set runtime.
  3554. */
  3555. #define AFE_DECODER_PARAM_ID_CONGESTION_BUFFER_SIZE 0x000132ec
  3556. /*
  3557. * Data format to send compressed data
  3558. * is transmitted/received over Slimbus lines.
  3559. */
  3560. #define AFE_SB_DATA_FORMAT_GENERIC_COMPRESSED 0x3
  3561. /*
  3562. * Parameter to send frame control size
  3563. * to DSP for AAC encoder in AFE.
  3564. */
  3565. #define AFE_PARAM_ID_AAC_FRM_SIZE_CONTROL 0x000132EA
  3566. /*
  3567. * ID for AFE port module. This will be used to define port properties.
  3568. * This module supports following parameter IDs:
  3569. * #AFE_PARAM_ID_PORT_MEDIA_TYPE
  3570. * To configure the port property, the client must use the
  3571. * #AFE_PORT_CMD_SET_PARAM_V2 command,
  3572. * and fill the module ID with the respective parameter IDs as listed above.
  3573. * @apr_hdr_fields
  3574. * Opcode -- AFE_MODULE_PORT
  3575. */
  3576. #define AFE_MODULE_PORT 0x000102a6
  3577. /*
  3578. * ID of the parameter used by #AFE_MODULE_PORT to set the port media type.
  3579. * parameter ID is currently supported using#AFE_PORT_CMD_SET_PARAM_V2 command.
  3580. */
  3581. #define AFE_PARAM_ID_PORT_MEDIA_TYPE 0x000102a7
  3582. /*
  3583. * Macros for defining the "data_format" field in the
  3584. * #AFE_PARAM_ID_PORT_MEDIA_TYPE
  3585. */
  3586. #define AFE_PORT_DATA_FORMAT_PCM 0x0
  3587. #define AFE_PORT_DATA_FORMAT_GENERIC_COMPRESSED 0x1
  3588. /*
  3589. * Macro for defining the "minor_version" field in the
  3590. * #AFE_PARAM_ID_PORT_MEDIA_TYPE
  3591. */
  3592. #define AFE_API_VERSION_PORT_MEDIA_TYPE 0x1
  3593. #define ASM_MEDIA_FMT_NONE 0x0
  3594. /*
  3595. * Media format ID for SBC encode configuration.
  3596. * @par SBC encode configuration (asm_sbc_enc_cfg_t)
  3597. * @table{weak__asm__sbc__enc__cfg__t}
  3598. */
  3599. #define ASM_MEDIA_FMT_SBC 0x00010BF2
  3600. /* SBC channel Mono mode.*/
  3601. #define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_MONO 1
  3602. /* SBC channel Stereo mode. */
  3603. #define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_STEREO 2
  3604. /* SBC channel Dual Mono mode. */
  3605. #define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_DUAL_MONO 8
  3606. /* SBC channel Joint Stereo mode. */
  3607. #define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_JOINT_STEREO 9
  3608. /* SBC bit allocation method = loudness. */
  3609. #define ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_LOUDNESS 0
  3610. /* SBC bit allocation method = SNR. */
  3611. #define ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_SNR 1
  3612. /*
  3613. * Payload of the SBC encoder configuration parameters in the
  3614. * #ASM_MEDIA_FMT_SBC media format.
  3615. */
  3616. struct asm_sbc_enc_cfg_t {
  3617. /*
  3618. * Number of subbands.
  3619. * @values 4, 8
  3620. */
  3621. uint32_t num_subbands;
  3622. /*
  3623. * Size of the encoded block in samples.
  3624. * @values 4, 8, 12, 16
  3625. */
  3626. uint32_t blk_len;
  3627. /*
  3628. * Mode used to allocate bits between channels.
  3629. * @values
  3630. * 0 (Native mode)
  3631. * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_MONO
  3632. * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_STEREO
  3633. * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_DUAL_MONO
  3634. * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_JOINT_STEREO
  3635. * Native mode indicates that encoding must be performed with the number
  3636. * of channels at the input.
  3637. * If postprocessing outputs one-channel data, Mono mode is used. If
  3638. * postprocessing outputs two-channel data, Stereo mode is used.
  3639. * The number of channels must not change during encoding.
  3640. */
  3641. uint32_t channel_mode;
  3642. /*
  3643. * Encoder bit allocation method.
  3644. * @values
  3645. * #ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_LOUDNESS
  3646. * #ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_SNR @tablebulletend
  3647. */
  3648. uint32_t alloc_method;
  3649. /*
  3650. * Number of encoded bits per second.
  3651. * @values
  3652. * Mono channel -- Maximum of 320 kbps
  3653. * Stereo channel -- Maximum of 512 kbps @tablebulletend
  3654. */
  3655. uint32_t bit_rate;
  3656. /*
  3657. * Number of samples per second.
  3658. * @values 0 (Native mode), 16000, 32000, 44100, 48000&nbsp;Hz
  3659. * Native mode indicates that encoding must be performed with the
  3660. * sampling rate at the input.
  3661. * The sampling rate must not change during encoding.
  3662. */
  3663. uint32_t sample_rate;
  3664. };
  3665. #define ASM_MEDIA_FMT_AAC_AOT_LC 2
  3666. #define ASM_MEDIA_FMT_AAC_AOT_SBR 5
  3667. #define ASM_MEDIA_FMT_AAC_AOT_PS 29
  3668. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS 0
  3669. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW 3
  3670. struct asm_aac_enc_cfg_v2_t {
  3671. /* Encoding rate in bits per second.*/
  3672. uint32_t bit_rate;
  3673. /*
  3674. * Encoding mode.
  3675. * Supported values:
  3676. * #ASM_MEDIA_FMT_AAC_AOT_LC
  3677. * #ASM_MEDIA_FMT_AAC_AOT_SBR
  3678. * #ASM_MEDIA_FMT_AAC_AOT_PS
  3679. */
  3680. uint32_t enc_mode;
  3681. /*
  3682. * AAC format flag.
  3683. * Supported values:
  3684. * #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
  3685. * #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
  3686. */
  3687. uint16_t aac_fmt_flag;
  3688. /*
  3689. * Number of channels to encode.
  3690. * Supported values:
  3691. * 0 - Native mode
  3692. * 1 - Mono
  3693. * 2 - Stereo
  3694. * Other values are not supported.
  3695. * @note1hang The eAAC+ encoder mode supports only stereo.
  3696. * Native mode indicates that encoding must be performed with the
  3697. * number of channels at the input.
  3698. * The number of channels must not change during encoding.
  3699. */
  3700. uint16_t channel_cfg;
  3701. /*
  3702. * Number of samples per second.
  3703. * Supported values: - 0 -- Native mode - For other values,
  3704. * Native mode indicates that encoding must be performed with the
  3705. * sampling rate at the input.
  3706. * The sampling rate must not change during encoding.
  3707. */
  3708. uint32_t sample_rate;
  3709. } __packed;
  3710. /* Structure to control frame size of AAC encoded frames. */
  3711. struct asm_aac_frame_size_control_t {
  3712. /* Type of frame size control: MTU_SIZE / PEAK_BIT_RATE*/
  3713. uint32_t ctl_type;
  3714. /*
  3715. * Control value
  3716. * MTU_SIZE: MTU size in bytes
  3717. * PEAK_BIT_RATE: Peak bitrate in bits per second.
  3718. */
  3719. uint32_t ctl_value;
  3720. } __packed;
  3721. struct asm_aac_enc_cfg_t {
  3722. struct asm_aac_enc_cfg_v2_t aac_cfg;
  3723. struct asm_aac_frame_size_control_t frame_ctl;
  3724. struct asm_aac_frame_size_control_t frame_ctl_v2;
  3725. } __packed;
  3726. /* FMT ID for apt-X Classic */
  3727. #define ASM_MEDIA_FMT_APTX 0x000131ff
  3728. /* FMT ID for apt-X HD */
  3729. #define ASM_MEDIA_FMT_APTX_HD 0x00013200
  3730. /* FMT ID for apt-X Adaptive */
  3731. #define ASM_MEDIA_FMT_APTX_ADAPTIVE 0x00013204
  3732. /* FMT ID for apt-X Adaptive speech */
  3733. #define ASM_MEDIA_FMT_APTX_AD_SPEECH 0x00013208
  3734. #define PCM_CHANNEL_L 1
  3735. #define PCM_CHANNEL_R 2
  3736. #define PCM_CHANNEL_C 3
  3737. struct asm_custom_enc_cfg_t {
  3738. uint32_t sample_rate;
  3739. /* Mono or stereo */
  3740. uint16_t num_channels;
  3741. uint16_t reserved;
  3742. /* num_ch == 1, then PCM_CHANNEL_C,
  3743. * num_ch == 2, then {PCM_CHANNEL_L, PCM_CHANNEL_R}
  3744. */
  3745. uint8_t channel_mapping[8];
  3746. uint32_t custom_size;
  3747. } __packed;
  3748. struct asm_aptx_ad_speech_mode_cfg_t
  3749. {
  3750. uint32_t speech_mode;
  3751. /*
  3752. * speech mode of codec.
  3753. *
  3754. * @values 0x0(swb), 0x4(sswb)
  3755. */
  3756. uint32_t swapping;
  3757. /*
  3758. * byte swapping of codec.
  3759. *
  3760. * @values 0x1, enable swapping
  3761. */
  3762. } __packed;
  3763. struct asm_aptx_v2_enc_cfg_ext_t {
  3764. /*
  3765. * sync mode: 0x0 = stereo sync mode (default)
  3766. * 0x01 = dual mono sync mode
  3767. * 0x02 = dual mono with no sync on either L or R
  3768. */
  3769. uint32_t sync_mode;
  3770. } __packed;
  3771. struct asm_aptx_enc_cfg_t {
  3772. struct asm_custom_enc_cfg_t custom_cfg;
  3773. struct asm_aptx_v2_enc_cfg_ext_t aptx_v2_cfg;
  3774. } __packed;
  3775. struct asm_aptx_ad_enc_cfg_t
  3776. {
  3777. struct asm_custom_enc_cfg_t custom_cfg;
  3778. struct afe_id_aptx_adaptive_enc_init aptx_ad_cfg;
  3779. struct afe_abr_enc_cfg_t abr_cfg;
  3780. } __attribute__ ((packed));
  3781. struct asm_aptx_ad_speech_enc_cfg_t
  3782. {
  3783. struct asm_custom_enc_cfg_t custom_cfg;
  3784. struct afe_imc_dec_enc_info imc_info;
  3785. struct asm_aptx_ad_speech_mode_cfg_t speech_mode;
  3786. } __attribute__ ((packed));
  3787. struct afe_matched_port_t
  3788. {
  3789. uint32_t minor_version;
  3790. uint32_t enable;
  3791. } __attribute__ ((packed));
  3792. #define ASM_MEDIA_FMT_CELT 0x00013221
  3793. struct asm_celt_specific_enc_cfg_t {
  3794. /*
  3795. * Bit rate used for encoding.
  3796. * This is used to calculate the upper threshold
  3797. * for bytes per frame if vbr_flag is 1.
  3798. * Or else, this will be used as a regular constant
  3799. * bit rate for encoder output.
  3800. * @Range : 32000 to 1536000
  3801. * @Default: 128
  3802. */
  3803. uint32_t bit_rate;
  3804. /*
  3805. * Frame size used for encoding.
  3806. * @Range : 64, 128, 256, 512
  3807. * @Default: 256
  3808. */
  3809. uint16_t frame_size;
  3810. /*
  3811. * complexity of algorithm.
  3812. * @Range : 0-10
  3813. * @Default: 3
  3814. */
  3815. uint16_t complexity;
  3816. /*
  3817. * Switch variable for prediction feature.
  3818. * Used to choose between the level of interframe
  3819. * predictions allowed while encoding.
  3820. * @Range:
  3821. * 0: Independent Frames.
  3822. * 1: Short Term interframe prediction allowed.
  3823. * 2: Long term prediction allowed.
  3824. * @Default: 2
  3825. */
  3826. uint16_t prediction_mode;
  3827. /*
  3828. * Variable Bit Rate flag.
  3829. * @Default: 0
  3830. */
  3831. uint16_t vbr_flag;
  3832. } __packed;
  3833. struct asm_celt_enc_cfg_t {
  3834. struct asm_custom_enc_cfg_t custom_config;
  3835. struct asm_celt_specific_enc_cfg_t celt_specific_config;
  3836. } __packed;
  3837. #define ASM_MEDIA_FMT_LDAC 0x00013224
  3838. #define ENC_CODEC_TYPE_LDAC 0x23000000
  3839. struct asm_ldac_specific_enc_cfg_t {
  3840. /*
  3841. * This is used to calculate the encoder output
  3842. * bytes per frame (i.e. bytes per packet).
  3843. * Bit rate also configures the EQMID.
  3844. * The min bit rate 303000 bps is calculated for
  3845. * 44.1 kHz and 88.2 KHz sampling frequencies with
  3846. * Mobile use Quality.
  3847. * The max bit rate of 990000 bps is calculated for
  3848. * 96kHz and 48 KHz with High Quality
  3849. * @Range(in bits per second)
  3850. * 303000 for Mobile use Quality
  3851. * 606000 for standard Quality
  3852. * 909000 for High Quality
  3853. */
  3854. uint32_t bit_rate;
  3855. /*
  3856. * The channel setting information for LDAC specification
  3857. * of Bluetooth A2DP which is determined by SRC and SNK
  3858. * devices in Bluetooth transmission.
  3859. * @Range:
  3860. * 0 for native mode
  3861. * 4 for mono
  3862. * 2 for dual channel
  3863. * 1 for stereo
  3864. */
  3865. uint16_t channel_mode;
  3866. /*
  3867. * Maximum Transmission Unit (MTU).
  3868. * The minimum MTU that a L2CAP implementation for LDAC shall
  3869. * support is 679 bytes, because LDAC is optimized with 2-DH5
  3870. * packet as its target.
  3871. * @Range : 679
  3872. * @Default: 679 for LDACBT_MTU_2DH5
  3873. */
  3874. uint16_t mtu;
  3875. } __packed;
  3876. struct asm_ldac_enc_cfg_t {
  3877. struct asm_custom_enc_cfg_t custom_config;
  3878. struct asm_ldac_specific_enc_cfg_t ldac_specific_config;
  3879. struct afe_abr_enc_cfg_t abr_config;
  3880. } __packed;
  3881. struct afe_enc_fmt_id_param_t {
  3882. /*
  3883. * Supported values:
  3884. * #ASM_MEDIA_FMT_SBC
  3885. * #ASM_MEDIA_FMT_AAC_V2
  3886. * Any OpenDSP supported values
  3887. */
  3888. uint32_t fmt_id;
  3889. } __packed;
  3890. struct afe_port_media_type_t {
  3891. /*
  3892. * Minor version
  3893. * @values #AFE_API_VERSION_PORT_MEDIA_TYPE.
  3894. */
  3895. uint32_t minor_version;
  3896. /*
  3897. * Sampling rate of the port.
  3898. * @values
  3899. * #AFE_PORT_SAMPLE_RATE_8K
  3900. * #AFE_PORT_SAMPLE_RATE_11_025K
  3901. * #AFE_PORT_SAMPLE_RATE_12K
  3902. * #AFE_PORT_SAMPLE_RATE_16K
  3903. * #AFE_PORT_SAMPLE_RATE_22_05K
  3904. * #AFE_PORT_SAMPLE_RATE_24K
  3905. * #AFE_PORT_SAMPLE_RATE_32K
  3906. * #AFE_PORT_SAMPLE_RATE_44_1K
  3907. * #AFE_PORT_SAMPLE_RATE_48K
  3908. * #AFE_PORT_SAMPLE_RATE_88_2K
  3909. * #AFE_PORT_SAMPLE_RATE_96K
  3910. * #AFE_PORT_SAMPLE_RATE_176_4K
  3911. * #AFE_PORT_SAMPLE_RATE_192K
  3912. * #AFE_PORT_SAMPLE_RATE_352_8K
  3913. * #AFE_PORT_SAMPLE_RATE_384K
  3914. */
  3915. uint32_t sample_rate;
  3916. /*
  3917. * Bit width of the sample.
  3918. * @values 16, 24
  3919. */
  3920. uint16_t bit_width;
  3921. /*
  3922. * Number of channels.
  3923. * @values 1 to #AFE_PORT_MAX_AUDIO_CHAN_CNT
  3924. */
  3925. uint16_t num_channels;
  3926. /*
  3927. * Data format supported by this port.
  3928. * If the port media type and device media type are different,
  3929. * it signifies a encoding/decoding use case
  3930. * @values
  3931. * #AFE_PORT_DATA_FORMAT_PCM
  3932. * #AFE_PORT_DATA_FORMAT_GENERIC_COMPRESSED
  3933. */
  3934. uint16_t data_format;
  3935. /*This field must be set to zero.*/
  3936. uint16_t reserved;
  3937. } __packed;
  3938. /*
  3939. * Payload of the SBC decoder configuration parameters in the
  3940. * #ASM_MEDIA_FMT_SBC media format.
  3941. */
  3942. struct asm_sbc_dec_cfg_t {
  3943. uint16_t channels;
  3944. /*
  3945. * Number of channels present in the SBC stream.
  3946. *
  3947. * @values
  3948. * - 1 -- Mono
  3949. * - 2 -- Stereo
  3950. */
  3951. uint32_t sample_rate;
  3952. /*
  3953. * Number of samples per second.
  3954. *
  3955. * @values 8000, 11025, 12000, 16000, 22050, 24000, 32000,
  3956. * 44100, 48000, 64000, 88200, 96000 Hz
  3957. */
  3958. } __packed;
  3959. /*
  3960. * Payload of the MP3 decoder configuration parameters in the
  3961. * #ASM_MEDIA_FMT_MP3 media format.
  3962. */
  3963. struct asm_mp3_dec_cfg_t {
  3964. /* All configuration is extracted from the stream */
  3965. } __packed;
  3966. struct asm_aac_dec_cfg_v2_t {
  3967. uint16_t aac_fmt_flag;
  3968. /*
  3969. * Bit stream format option.
  3970. *
  3971. * @values
  3972. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
  3973. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS
  3974. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF
  3975. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
  3976. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LATM
  3977. */
  3978. uint16_t audio_obj_type;
  3979. /*
  3980. * Audio Object Type (AOT) present in the AAC stream.
  3981. *
  3982. * @values
  3983. * - #ASM_MEDIA_FMT_AAC_AOT_LC
  3984. * - #ASM_MEDIA_FMT_AAC_AOT_SBR
  3985. * - #ASM_MEDIA_FMT_AAC_AOT_BSAC
  3986. * - #ASM_MEDIA_FMT_AAC_AOT_PS
  3987. *
  3988. * Other values are not supported.
  3989. */
  3990. uint16_t channel_config;
  3991. /*
  3992. * Number of channels present in the AAC stream.
  3993. *
  3994. * @values
  3995. * - 0 -- PCE
  3996. * - 1 -- Mono
  3997. * - 2 -- Stereo
  3998. * - 6 -- 5.1 content
  3999. */
  4000. uint16_t total_size_of_PCE_bits;
  4001. /*
  4002. * For RAW formats and if channel_config=0 (PCE),
  4003. * the client can send the bit stream containing PCE
  4004. * immediately following this structure (in band).
  4005. *
  4006. * @values @ge 0 (does not include the bits required
  4007. * for 32-bit alignment)
  4008. *
  4009. * If this field is set to 0, the PCE information is
  4010. * assumed to be available in the audio bit stream
  4011. * and not in band.
  4012. *
  4013. * If this field is greater than 0, the PCE information
  4014. * follows this structure. Additional bits might
  4015. * be required for 32-bit alignment.
  4016. */
  4017. uint32_t sample_rate;
  4018. /*
  4019. * Number of samples per second.
  4020. *
  4021. * @values 8000, 11025, 12000, 16000, 22050, 24000, 32000,
  4022. * 44100, 48000, 64000, 88200, 96000 Hz
  4023. *
  4024. * This field must be equal to the sample rate of the
  4025. * AAC-LC decoder output.
  4026. * - For MP4 or 3GP containers, this sample rate
  4027. * is indicated by the
  4028. * samplingFrequencyIndex field in the
  4029. * AudioSpecificConfig element.
  4030. * - For ADTS format, this sample rate is indicated by the
  4031. * samplingFrequencyIndex in the ADTS fixed header.
  4032. * - For ADIF format, this sample rate is indicated by the
  4033. * samplingFrequencyIndex in the program_config_element
  4034. * present in the ADIF header.
  4035. */
  4036. } __packed;
  4037. /*
  4038. * Payload of the APTX AD decoder configuration parameters in the
  4039. * #ASM_MEDIA_FMT_APTX_ADAPTIVE media format.
  4040. */
  4041. struct asm_aptx_ad_dec_cfg_t {
  4042. uint32_t sample_rate;
  4043. /*
  4044. * Number of samples per second.
  4045. *
  4046. * @values 0x0(48000Hz), 0x1(44100Hz)
  4047. */
  4048. } __packed;
  4049. struct asm_aptx_ad_speech_dec_cfg_t {
  4050. struct asm_aptx_ad_speech_mode_cfg_t speech_mode;
  4051. };
  4052. union afe_enc_config_data {
  4053. struct asm_sbc_enc_cfg_t sbc_config;
  4054. struct asm_aac_enc_cfg_t aac_config;
  4055. struct asm_custom_enc_cfg_t custom_config;
  4056. struct asm_celt_enc_cfg_t celt_config;
  4057. struct asm_aptx_enc_cfg_t aptx_config;
  4058. struct asm_ldac_enc_cfg_t ldac_config;
  4059. struct asm_aptx_ad_enc_cfg_t aptx_ad_config;
  4060. struct asm_aptx_ad_speech_enc_cfg_t aptx_ad_speech_config;
  4061. };
  4062. struct afe_enc_config {
  4063. u32 format;
  4064. u32 scrambler_mode;
  4065. u32 mono_mode;
  4066. union afe_enc_config_data data;
  4067. };
  4068. /*
  4069. * Enable TTP generator in AFE.
  4070. */
  4071. #define AVS_DEPACKETIZER_PARAM_ID_TTP_GEN_STATE 0x000132EF
  4072. /*
  4073. * Configure TTP generator params in AFE.
  4074. */
  4075. #define AVS_DEPACKETIZER_PARAM_ID_TTP_GEN_CFG 0x000132F0
  4076. #define MAX_TTP_OFFSET_PAIRS 4
  4077. struct afe_ttp_gen_enable_t {
  4078. uint16_t enable;
  4079. uint16_t reserved;
  4080. } __packed;
  4081. struct afe_ttp_ssrc_offset_pair_t {
  4082. uint32_t ssrc;
  4083. uint32_t offset;
  4084. } __packed;
  4085. struct afe_ttp_gen_cfg_t {
  4086. uint32_t ttp_offset_default;
  4087. /*
  4088. * TTP offset uses for all other cases
  4089. * where no valid SSRC is received.
  4090. */
  4091. uint32_t settling_time;
  4092. /*
  4093. * If settling_mode==0x00: time in [us]
  4094. * after first received packet until
  4095. * packets are no longer dropped.
  4096. */
  4097. uint16_t settling_mode;
  4098. /*
  4099. * 0x00(Drop), 0x01(Settle)
  4100. */
  4101. uint16_t num_ssrc_offsets;
  4102. /*
  4103. * Number of SSRC/TTPOFFSET pairs to follow
  4104. */
  4105. struct afe_ttp_ssrc_offset_pair_t ssrc_ttp_offset[MAX_TTP_OFFSET_PAIRS];
  4106. /*
  4107. * Array of ssrc/offset pairs
  4108. */
  4109. } __packed;
  4110. struct afe_ttp_config {
  4111. struct afe_ttp_gen_enable_t ttp_gen_enable;
  4112. struct afe_ttp_gen_cfg_t ttp_gen_cfg;
  4113. };
  4114. union afe_dec_config_data {
  4115. struct asm_sbc_dec_cfg_t sbc_config;
  4116. struct asm_aac_dec_cfg_v2_t aac_config;
  4117. struct asm_mp3_dec_cfg_t mp3_config;
  4118. struct asm_aptx_ad_dec_cfg_t aptx_ad_config;
  4119. struct asm_aptx_ad_speech_dec_cfg_t aptx_ad_speech_config;
  4120. };
  4121. struct afe_dec_config {
  4122. u32 format;
  4123. struct afe_abr_dec_cfg_t abr_dec_cfg;
  4124. union afe_dec_config_data data;
  4125. };
  4126. struct afe_enc_cfg_blk_param_t {
  4127. uint32_t enc_cfg_blk_size;
  4128. /*
  4129. *Size of the encoder configuration block that follows this member
  4130. */
  4131. union afe_enc_config_data enc_blk_config;
  4132. };
  4133. struct afe_enc_aptx_ad_speech_cfg_blk_param_t {
  4134. uint32_t enc_cfg_blk_size;
  4135. /*
  4136. * Size of the encoder configuration block that follows this member
  4137. */
  4138. struct asm_custom_enc_cfg_t custom_cfg;
  4139. };
  4140. /*
  4141. * Payload of the AVS_DECODER_PARAM_ID_DEC_MEDIA_FMT parameter used by
  4142. * AVS_MODULE_ID_DECODER.
  4143. */
  4144. struct afe_dec_media_fmt_t {
  4145. union afe_dec_config_data dec_media_config;
  4146. } __packed;
  4147. /*
  4148. * Payload of the AVS_ENCODER_PARAM_ID_PACKETIZER_ID parameter.
  4149. */
  4150. struct avs_enc_packetizer_id_param_t {
  4151. /*
  4152. * Supported values:
  4153. * #AVS_MODULE_ID_PACKETIZER_COP
  4154. * Any OpenDSP supported values
  4155. */
  4156. uint32_t enc_packetizer_id;
  4157. };
  4158. /*
  4159. * Payload of the AVS_ENCODER_PARAM_ID_ENABLE_SCRAMBLING parameter.
  4160. */
  4161. struct avs_enc_set_scrambler_param_t {
  4162. /*
  4163. * Supported values:
  4164. * 1 : enable scrambler
  4165. * 0 : disable scrambler
  4166. */
  4167. uint32_t enable_scrambler;
  4168. };
  4169. /*
  4170. * Payload of the AVS_ENCODER_PARAM_ID_BIT_RATE_LEVEL_MAP parameter.
  4171. */
  4172. struct afe_enc_level_to_bitrate_map_param_t {
  4173. /*
  4174. * Parameter for mapping link quality level to bitrate.
  4175. */
  4176. struct afe_quality_level_to_bitrate_info mapping_table;
  4177. };
  4178. /*
  4179. * Payload of the AVS_ENCDEC_PARAM_ID_DEC_TO_ENC_COMMUNICATION parameter.
  4180. */
  4181. struct afe_enc_dec_imc_info_param_t {
  4182. /*
  4183. * Parameter to set up Inter Module Communication (IMC) between
  4184. * AFE Decoder and Encoder.
  4185. */
  4186. struct afe_imc_dec_enc_info imc_info;
  4187. };
  4188. /*
  4189. * Payload of the AVS_DECODER_PARAM_ID_DEPACKETIZER_ID parameter.
  4190. */
  4191. struct avs_dec_depacketizer_id_param_t {
  4192. /*
  4193. * Supported values:
  4194. * #AFE_MODULE_ID_DEPACKETIZER_COP
  4195. * #AFE_MODULE_ID_DEPACKETIZER_COP_V1
  4196. * Any OpenDSP supported values
  4197. */
  4198. uint32_t dec_depacketizer_id;
  4199. };
  4200. struct avs_dec_congestion_buffer_param_t {
  4201. uint32_t version;
  4202. uint16_t max_nr_buffers;
  4203. /*
  4204. * Maximum number of 1ms buffers:
  4205. * 0 - 256
  4206. */
  4207. uint16_t pre_buffer_size;
  4208. /*
  4209. * Pre-buffering size in 1ms:
  4210. * 1 - 128
  4211. */
  4212. };
  4213. /*
  4214. * ID of the parameter used by #AVS_MODULE_ID_DECODER to configure
  4215. * the decoder mode for the AFE module.
  4216. * This parameter cannot be set at runtime.
  4217. */
  4218. #define AVS_DECODER_PARAM_ID_DEC_MEDIA_FMT 0x00013232
  4219. /*
  4220. * ID of the parameter used by #AVS_MODULE_ID_DECODER to configure
  4221. * the decoder mode of adaptive speech and byte swap mode
  4222. */
  4223. #define AVS_DECODER_PARAM_ID_APTX_AD_SPEECH_DEC_INIT 0x0001334D
  4224. /*
  4225. * ID of the parameter used by #AVS_MODULE_ID_ENCODER to configure
  4226. * the encoder mode of adaptive speech and byte swap mode
  4227. */
  4228. #define AVS_DECODER_PARAM_ID_APTX_AD_SPEECH_ENC_INIT 0x0001332B
  4229. /* ID of the parameter used by #AFE_MODULE_AUDIO_DEV_INTERFACE to configure
  4230. * the island mode for a given AFE port.
  4231. */
  4232. #define AFE_PARAM_ID_ISLAND_CONFIG 0x000102B4
  4233. /* Version information used to handle future additions to codec DMA
  4234. * configuration (for backward compatibility).
  4235. */
  4236. #define AFE_API_VERSION_ISLAND_CONFIG 0x1
  4237. /* Payload of the AFE_PARAM_ID_ISLAND_CONFIG parameter used by
  4238. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  4239. */
  4240. #define AFE_PARAM_ID_POWER_MODE_CONFIG 0x0002002c
  4241. #define AFE_API_VERSION_POWER_MODE_CONFIG 0x1
  4242. struct afe_param_id_island_cfg_t {
  4243. uint32_t island_cfg_minor_version;
  4244. /* Tracks the configuration of this parameter.
  4245. * Supported values: #AFE_API_VERSION_ISLAND_CONFIG
  4246. */
  4247. uint32_t island_enable;
  4248. /* Specifies whether island mode should be enabled or disabled for the
  4249. * use-case being setup.
  4250. * Supported values: 0 - Disable, 1 - Enable
  4251. */
  4252. } __packed;
  4253. struct afe_param_id_power_mode_cfg_t {
  4254. uint32_t power_mode_cfg_minor_version;
  4255. /* Tracks the configuration of this parameter
  4256. * Supported values: #AFE_API_VERSION_POWER_MODE_CONFIG
  4257. */
  4258. uint32_t power_mode_enable;
  4259. /* Specifies whether island mode should be enabled or disabled for the
  4260. * use-case being setup.
  4261. * Supported values: 0 - Disable, 1 - Enable
  4262. */
  4263. } __packed;
  4264. /* ID of the parameter used by #AFE_MODULE_AUDIO_DEV_INTERFACE to configure
  4265. * the Codec DMA interface.
  4266. */
  4267. #define AFE_PARAM_ID_CODEC_DMA_CONFIG 0x000102B8
  4268. /* Version information used to handle future additions to codec DMA
  4269. * configuration (for backward compatibility).
  4270. */
  4271. #define AFE_API_VERSION_CODEC_DMA_CONFIG 0x1
  4272. /* Payload of the AFE_PARAM_ID_CODEC_DMA_CONFIG parameter used by
  4273. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  4274. */
  4275. struct afe_param_id_cdc_dma_cfg_t {
  4276. uint32_t cdc_dma_cfg_minor_version;
  4277. /* Tracks the configuration of this parameter.
  4278. * Supported values: #AFE_API_VERSION_CODEC_DMA_CONFIG
  4279. */
  4280. uint32_t sample_rate;
  4281. /* Sampling rate of the port.
  4282. * Supported values:
  4283. * - #AFE_PORT_SAMPLE_RATE_8K
  4284. * - #AFE_PORT_SAMPLE_RATE_11_025K
  4285. * - #AFE_PORT_SAMPLE_RATE_12K
  4286. * - #AFE_PORT_SAMPLE_RATE_16K
  4287. * - #AFE_PORT_SAMPLE_RATE_22_05K
  4288. * - #AFE_PORT_SAMPLE_RATE_24K
  4289. * - #AFE_PORT_SAMPLE_RATE_32K
  4290. * - #AFE_PORT_SAMPLE_RATE_44_1K
  4291. * - #AFE_PORT_SAMPLE_RATE_48K
  4292. * - #AFE_PORT_SAMPLE_RATE_88_2K
  4293. * - #AFE_PORT_SAMPLE_RATE_96K
  4294. * - #AFE_PORT_SAMPLE_RATE_176_4K
  4295. * - #AFE_PORT_SAMPLE_RATE_192K
  4296. * - #AFE_PORT_SAMPLE_RATE_352_8K
  4297. * - #AFE_PORT_SAMPLE_RATE_384K
  4298. */
  4299. uint16_t bit_width;
  4300. /* Bit width of the sample.
  4301. * Supported values: 16, 24, 32
  4302. */
  4303. uint16_t data_format;
  4304. /* Data format supported by the codec DMA interface.
  4305. * Supported values:
  4306. * - #AFE_LINEAR_PCM_DATA
  4307. * - #AFE_LINEAR_PCM_DATA_PACKED_16BIT
  4308. */
  4309. uint16_t num_channels;
  4310. /* Number of channels.
  4311. * Supported values: 1 to Maximum number of channels supported
  4312. * for each interface
  4313. */
  4314. uint16_t active_channels_mask;
  4315. /* Active channels mask to denote the bit mask for active channels.
  4316. * Bits 0 to 7 denote channels 0 to 7. A 1 denotes the channel is active
  4317. * while a 0 denotes a channel is inactive.
  4318. * Supported values:
  4319. * Any mask with number of active bits equal to num_channels
  4320. */
  4321. } __packed;
  4322. union afe_port_config {
  4323. struct afe_param_id_pcm_cfg pcm;
  4324. struct afe_param_id_i2s_cfg i2s;
  4325. struct afe_param_id_meta_i2s_cfg meta_i2s;
  4326. struct afe_param_id_hdmi_multi_chan_audio_cfg hdmi_multi_ch;
  4327. struct afe_param_id_slimbus_cfg slim_sch;
  4328. struct afe_param_id_rt_proxy_port_cfg rtproxy;
  4329. struct afe_param_id_internal_bt_fm_cfg int_bt_fm;
  4330. struct afe_param_id_pseudo_port_cfg pseudo_port;
  4331. struct afe_param_id_device_hw_delay_cfg hw_delay;
  4332. struct afe_param_id_spdif_cfg_v2 spdif;
  4333. struct afe_param_id_set_topology_cfg topology;
  4334. struct afe_param_id_tdm_cfg tdm;
  4335. struct afe_param_id_usb_audio_cfg usb_audio;
  4336. struct afe_param_id_aptx_sync_mode sync_mode_param;
  4337. struct asm_aac_frame_size_control_t frame_ctl_param;
  4338. struct afe_enc_fmt_id_param_t enc_fmt;
  4339. struct afe_port_media_type_t media_type;
  4340. struct afe_enc_cfg_blk_param_t enc_blk_param;
  4341. struct avs_enc_packetizer_id_param_t enc_pkt_id_param;
  4342. struct avs_enc_set_scrambler_param_t enc_set_scrambler_param;
  4343. struct avs_dec_depacketizer_id_param_t dec_depkt_id_param;
  4344. struct afe_dec_media_fmt_t dec_media_fmt;
  4345. struct afe_enc_level_to_bitrate_map_param_t map_param;
  4346. struct afe_enc_dec_imc_info_param_t imc_info_param;
  4347. struct afe_param_id_cdc_dma_cfg_t cdc_dma;
  4348. } __packed;
  4349. /*
  4350. * AFE event registration related APIs and corresponding payloads
  4351. */
  4352. #define AFE_SVC_CMD_EVENT_CFG 0x000100FE
  4353. #define AFE_CMD_APPS_WAKEUP_IRQ_REGISTER_MINOR_VERSION 0x1
  4354. /* Flag to indicate AFE to register APPS wakeup Interrupt */
  4355. #define AFE_APPS_WAKEUP_IRQ_REGISTER_FLAG 1
  4356. /* Flag to indicate AFE to de-register APPS wakeup Interrupt */
  4357. #define AFE_APPS_WAKEUP_IRQ_DEREGISTER_FLAG 0
  4358. /* Default interrupt trigger value. */
  4359. #define DEFAULT_SETTINGS 0x00000001
  4360. /* Interrupt is triggered only if the input signal at the source is high. */
  4361. #define LEVEL_HIGH_TRIGGER 0x00000002
  4362. /* Interrupt is triggered only if the input signal at the source is low. */
  4363. #define LEVEL_LOW_TRIGGER 0x00000003
  4364. /* Interrupt is triggered only if the input signal at the source transitions
  4365. *from low to high.
  4366. */
  4367. #define RISING_EDGE_TRIGGER 0x00000004
  4368. /* Interrupt is triggered only if the input signal at the source transitions
  4369. *from high to low.
  4370. */
  4371. #define FALLING_EDGE_TRIGGER 0x00000005
  4372. /* Macro for invalid trigger type. This should not be used. */
  4373. #define INVALID_TRIGGER 0x00000006
  4374. #define AFE_EVENT_ID_MBHC_DETECTION_SW_WA 0x1
  4375. /* @weakgroup weak_afe_svc_cmd_evt_cfg_payload
  4376. *
  4377. * This is payload of each event that is to be
  4378. * registered with AFE service.
  4379. */
  4380. struct afe_svc_cmd_evt_cfg_payload {
  4381. struct apr_hdr hdr;
  4382. uint32_t event_id;
  4383. /* Unique ID of the event.
  4384. *
  4385. * @values
  4386. * -# AFE_EVENT_ID_MBHC_DETECTION_SW_WA
  4387. */
  4388. uint32_t reg_flag;
  4389. /* Flag for registering or de-registering an event.
  4390. * @values
  4391. * - #AFE_SVC_REGISTER_EVENT_FLAG
  4392. * - #AFE_SVC_DEREGISTER_EVENT_FLAG
  4393. */
  4394. } __packed;
  4395. #define AFE_EVENT_MBHC_DETECTION_SW_WA 0x0001010F
  4396. #define AFE_PORT_CMD_DEVICE_START 0x000100E5
  4397. /* Payload of the #AFE_PORT_CMD_DEVICE_START.*/
  4398. struct afe_port_cmd_device_start {
  4399. struct apr_hdr hdr;
  4400. u16 port_id;
  4401. /* Port interface and direction (Rx or Tx) to start. An even
  4402. * number represents the Rx direction, and an odd number represents
  4403. * the Tx direction.
  4404. */
  4405. u16 reserved;
  4406. /* Reserved for 32-bit alignment. This field must be set to 0.*/
  4407. } __packed;
  4408. #define AFE_PORT_CMD_DEVICE_STOP 0x000100E6
  4409. /* Payload of the #AFE_PORT_CMD_DEVICE_STOP. */
  4410. struct afe_port_cmd_device_stop {
  4411. struct apr_hdr hdr;
  4412. u16 port_id;
  4413. /* Port interface and direction (Rx or Tx) to start. An even
  4414. * number represents the Rx direction, and an odd number represents
  4415. * the Tx direction.
  4416. */
  4417. u16 reserved;
  4418. /* Reserved for 32-bit alignment. This field must be set to 0.*/
  4419. } __packed;
  4420. #define AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS 0x000100EA
  4421. /* Memory map regions command payload used by the
  4422. * #AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS .
  4423. * This structure allows clients to map multiple shared memory
  4424. * regions in a single command. Following this structure are
  4425. * num_regions of afe_service_shared_map_region_payload.
  4426. */
  4427. struct afe_service_cmd_shared_mem_map_regions {
  4428. struct apr_hdr hdr;
  4429. u16 mem_pool_id;
  4430. /* Type of memory on which this memory region is mapped.
  4431. * Supported values:
  4432. * - #ADSP_MEMORY_MAP_EBI_POOL
  4433. * - #ADSP_MEMORY_MAP_SMI_POOL
  4434. * - #ADSP_MEMORY_MAP_SHMEM8_4K_POOL
  4435. * - Other values are reserved
  4436. *
  4437. * The memory pool ID implicitly defines the characteristics of the
  4438. * memory. Characteristics may include alignment type, permissions,
  4439. * etc.
  4440. *
  4441. * ADSP_MEMORY_MAP_EBI_POOL is External Buffer Interface type memory
  4442. * ADSP_MEMORY_MAP_SMI_POOL is Shared Memory Interface type memory
  4443. * ADSP_MEMORY_MAP_SHMEM8_4K_POOL is shared memory, byte
  4444. * addressable, and 4 KB aligned.
  4445. */
  4446. u16 num_regions;
  4447. /* Number of regions to map.
  4448. * Supported values:
  4449. * - Any value greater than zero
  4450. */
  4451. u32 property_flag;
  4452. /* Configures one common property for all the regions in the
  4453. * payload.
  4454. *
  4455. * Supported values: - 0x00000000 to 0x00000001
  4456. *
  4457. * b0 - bit 0 indicates physical or virtual mapping 0 Shared memory
  4458. * address provided in afe_service_shared_map_region_payloadis a
  4459. * physical address. The shared memory needs to be mapped( hardware
  4460. * TLB entry) and a software entry needs to be added for internal
  4461. * book keeping.
  4462. *
  4463. * 1 Shared memory address provided in
  4464. * afe_service_shared_map_region_payloadis a virtual address. The
  4465. * shared memory must not be mapped (since hardware TLB entry is
  4466. * already available) but a software entry needs to be added for
  4467. * internal book keeping. This can be useful if two services with in
  4468. * ADSP is communicating via APR. They can now directly communicate
  4469. * via the Virtual address instead of Physical address. The virtual
  4470. * regions must be contiguous. num_regions must be 1 in this case.
  4471. *
  4472. * b31-b1 - reserved bits. must be set to zero
  4473. */
  4474. } __packed;
  4475. /* Map region payload used by the
  4476. * afe_service_shared_map_region_payloadstructure.
  4477. */
  4478. struct afe_service_shared_map_region_payload {
  4479. u32 shm_addr_lsw;
  4480. /* least significant word of starting address in the memory
  4481. * region to map. It must be contiguous memory, and it must be 4 KB
  4482. * aligned.
  4483. * Supported values: - Any 32 bit value
  4484. */
  4485. u32 shm_addr_msw;
  4486. /* most significant word of startng address in the memory region
  4487. * to map. For 32 bit shared memory address, this field must be set
  4488. * to zero. For 36 bit shared memory address, bit31 to bit 4 must be
  4489. * set to zero
  4490. *
  4491. * Supported values: - For 32 bit shared memory address, this field
  4492. * must be set to zero. - For 36 bit shared memory address, bit31 to
  4493. * bit 4 must be set to zero - For 64 bit shared memory address, any
  4494. * 32 bit value
  4495. */
  4496. u32 mem_size_bytes;
  4497. /* Number of bytes in the region. The aDSP will always map the
  4498. * regions as virtual contiguous memory, but the memory size must be
  4499. * in multiples of 4 KB to avoid gaps in the virtually contiguous
  4500. * mapped memory.
  4501. *
  4502. * Supported values: - multiples of 4KB
  4503. */
  4504. } __packed;
  4505. #define AFE_SERVICE_CMDRSP_SHARED_MEM_MAP_REGIONS 0x000100EB
  4506. struct afe_service_cmdrsp_shared_mem_map_regions {
  4507. u32 mem_map_handle;
  4508. /* A memory map handle encapsulating shared memory attributes is
  4509. * returned iff AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS command is
  4510. * successful. In the case of failure , a generic APR error response
  4511. * is returned to the client.
  4512. *
  4513. * Supported Values: - Any 32 bit value
  4514. */
  4515. } __packed;
  4516. #define AFE_SERVICE_CMD_SHARED_MEM_UNMAP_REGIONS 0x000100EC
  4517. /* Memory unmap regions command payload used by the
  4518. * #AFE_SERVICE_CMD_SHARED_MEM_UNMAP_REGIONS
  4519. *
  4520. * This structure allows clients to unmap multiple shared memory
  4521. * regions in a single command.
  4522. */
  4523. struct afe_service_cmd_shared_mem_unmap_regions {
  4524. struct apr_hdr hdr;
  4525. u32 mem_map_handle;
  4526. /* memory map handle returned by
  4527. * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS commands
  4528. *
  4529. * Supported Values:
  4530. * - Any 32 bit value
  4531. */
  4532. } __packed;
  4533. /* Used by RTAC */
  4534. struct afe_rtac_get_param_v2 {
  4535. u16 port_id;
  4536. /* Port interface and direction (Rx or Tx) to start. */
  4537. u16 payload_size;
  4538. /* Maximum data size of the parameter ID/module ID combination.
  4539. * This is a multiple of four bytes
  4540. * Supported values: > 0
  4541. */
  4542. u32 payload_address_lsw;
  4543. /* LSW of 64 bit Payload address. Address should be 32-byte,
  4544. * 4kbyte aligned and must be contig memory.
  4545. */
  4546. u32 payload_address_msw;
  4547. /* MSW of 64 bit Payload address. In case of 32-bit shared
  4548. * memory address, this field must be set to zero. In case of 36-bit
  4549. * shared memory address, bit-4 to bit-31 must be set to zero.
  4550. * Address should be 32-byte, 4kbyte aligned and must be contiguous
  4551. * memory.
  4552. */
  4553. u32 mem_map_handle;
  4554. /* Memory map handle returned by
  4555. * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS commands.
  4556. * Supported Values: - NULL -- Message. The parameter data is
  4557. * in-band. - Non-NULL -- The parameter data is Out-band.Pointer to
  4558. * - the physical address in shared memory of the payload data.
  4559. * For detailed payload content, see the afe_port_param_data_v2
  4560. * structure
  4561. */
  4562. u32 module_id;
  4563. /* ID of the module to be queried.
  4564. * Supported values: Valid module ID
  4565. */
  4566. u32 param_id;
  4567. /* ID of the parameter to be queried.
  4568. * Supported values: Valid parameter ID
  4569. */
  4570. } __packed;
  4571. #define AFE_PORT_CMD_GET_PARAM_V2 0x000100F0
  4572. /* Payload of the #AFE_PORT_CMD_GET_PARAM_V2 command,
  4573. * which queries for one post/preprocessing parameter of a
  4574. * stream.
  4575. */
  4576. struct afe_port_cmd_get_param_v2 {
  4577. struct apr_hdr apr_hdr;
  4578. /* Port interface and direction (Rx or Tx) to start. */
  4579. u16 port_id;
  4580. /* Maximum data size of the parameter ID/module ID combination.
  4581. * This is a multiple of four bytes
  4582. * Supported values: > 0
  4583. */
  4584. u16 payload_size;
  4585. /* The memory mapping header to be used when requesting outband */
  4586. struct mem_mapping_hdr mem_hdr;
  4587. /* The module ID of the parameter data requested */
  4588. u32 module_id;
  4589. /* The parameter ID of the parameter data requested */
  4590. u32 param_id;
  4591. /* The header information for the parameter data */
  4592. struct param_hdr_v1 param_hdr;
  4593. } __packed;
  4594. #define AFE_PORT_CMDRSP_GET_PARAM_V2 0x00010106
  4595. /* Payload of the #AFE_PORT_CMDRSP_GET_PARAM_V2 message, which
  4596. * responds to an #AFE_PORT_CMD_GET_PARAM_V2 command.
  4597. *
  4598. * Immediately following this structure is the parameters structure
  4599. * (afe_port_param_data) containing the response(acknowledgment)
  4600. * parameter payload. This payload is included for an in-band
  4601. * scenario. For an address/shared memory-based set parameter, this
  4602. * payload is not needed.
  4603. */
  4604. struct afe_port_cmdrsp_get_param_v2 {
  4605. u32 status;
  4606. struct param_hdr_v1 param_hdr;
  4607. u8 param_data[0];
  4608. } __packed;
  4609. #define AFE_PORT_CMD_GET_PARAM_V3 0x000100FB
  4610. struct afe_port_cmd_get_param_v3 {
  4611. /* APR Header */
  4612. struct apr_hdr apr_hdr;
  4613. /* Port ID of the AFE port to configure. Port interface and direction
  4614. * (Rx or Tx) to configure. An even number represents the Rx direction,
  4615. * and an odd number represents the Tx direction.
  4616. */
  4617. u16 port_id;
  4618. /* Reserved. This field must be set to zero. */
  4619. u16 reserved;
  4620. /* The memory mapping header to be used when requesting outband */
  4621. struct mem_mapping_hdr mem_hdr;
  4622. /* The header information for the parameter data */
  4623. struct param_hdr_v3 param_hdr;
  4624. } __packed;
  4625. #define AFE_PORT_CMDRSP_GET_PARAM_V3 0x00010108
  4626. struct afe_port_cmdrsp_get_param_v3 {
  4627. /* The status of the command */
  4628. uint32_t status;
  4629. /* The header information for the parameter data */
  4630. struct param_hdr_v3 param_hdr;
  4631. /* The parameter data to be filled when sent inband */
  4632. u8 param_data[0];
  4633. } __packed;
  4634. #define AFE_PARAM_ID_LPASS_CORE_SHARED_CLOCK_CONFIG 0x0001028C
  4635. #define AFE_API_VERSION_LPASS_CORE_SHARED_CLK_CONFIG 0x1
  4636. /* Payload of the AFE_PARAM_ID_LPASS_CORE_SHARED_CLOCK_CONFIG parameter used by
  4637. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  4638. */
  4639. struct afe_param_id_lpass_core_shared_clk_cfg {
  4640. u32 lpass_core_shared_clk_cfg_minor_version;
  4641. /*
  4642. * Minor version used for lpass core shared clock configuration
  4643. * Supported value: AFE_API_VERSION_LPASS_CORE_SHARED_CLK_CONFIG
  4644. */
  4645. u32 enable;
  4646. /*
  4647. * Specifies whether the lpass core shared clock is
  4648. * enabled (1) or disabled (0).
  4649. */
  4650. } __packed;
  4651. /* adsp_afe_service_commands.h */
  4652. #define ADSP_MEMORY_MAP_EBI_POOL 0
  4653. #define ADSP_MEMORY_MAP_SMI_POOL 1
  4654. #define ADSP_MEMORY_MAP_IMEM_POOL 2
  4655. #define ADSP_MEMORY_MAP_SHMEM8_4K_POOL 3
  4656. #define ADSP_MEMORY_MAP_MDF_SHMEM_4K_POOL 4
  4657. /* Definition of virtual memory flag */
  4658. #define ADSP_MEMORY_MAP_VIRTUAL_MEMORY 1
  4659. /* Definition of physical memory flag */
  4660. #define ADSP_MEMORY_MAP_PHYSICAL_MEMORY 0
  4661. #define NULL_POPP_TOPOLOGY 0x00010C68
  4662. #define NULL_COPP_TOPOLOGY 0x00010312
  4663. #define DEFAULT_COPP_TOPOLOGY 0x00010314
  4664. #define DEFAULT_POPP_TOPOLOGY 0x00010BE4
  4665. #define COMPRESSED_PASSTHROUGH_DEFAULT_TOPOLOGY 0x0001076B
  4666. #define COMPRESSED_PASSTHROUGH_NONE_TOPOLOGY 0x00010774
  4667. #define VPM_TX_SM_ECNS_V2_COPP_TOPOLOGY 0x00010F89
  4668. #define VPM_TX_VOICE_SMECNS_V2_COPP_TOPOLOGY 0x10000003
  4669. #define VPM_TX_VOICE_FLUENCE_SM_COPP_TOPOLOGY 0x10000004
  4670. #define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72
  4671. #define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75
  4672. #define VPM_TX_DM_RFECNS_COPP_TOPOLOGY 0x00010F86
  4673. #define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX 0x10015002
  4674. #define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_AUDIOSPHERE 0x10028000
  4675. #define VPM_TX_DM_FLUENCE_EF_COPP_TOPOLOGY 0x10000005
  4676. #define AUDIO_RX_MONO_VOIP_COPP_TOPOLOGY 0x11000101
  4677. /* Memory map regions command payload used by the
  4678. * #ASM_CMD_SHARED_MEM_MAP_REGIONS ,#ADM_CMD_SHARED_MEM_MAP_REGIONS
  4679. * commands.
  4680. *
  4681. * This structure allows clients to map multiple shared memory
  4682. * regions in a single command. Following this structure are
  4683. * num_regions of avs_shared_map_region_payload.
  4684. */
  4685. struct avs_cmd_shared_mem_map_regions {
  4686. struct apr_hdr hdr;
  4687. u16 mem_pool_id;
  4688. /* Type of memory on which this memory region is mapped.
  4689. *
  4690. * Supported values: - #ADSP_MEMORY_MAP_EBI_POOL -
  4691. * #ADSP_MEMORY_MAP_SMI_POOL - #ADSP_MEMORY_MAP_IMEM_POOL
  4692. * (unsupported) - #ADSP_MEMORY_MAP_SHMEM8_4K_POOL - Other values
  4693. * are reserved
  4694. *
  4695. * The memory ID implicitly defines the characteristics of the
  4696. * memory. Characteristics may include alignment type, permissions,
  4697. * etc.
  4698. *
  4699. * SHMEM8_4K is shared memory, byte addressable, and 4 KB aligned.
  4700. */
  4701. u16 num_regions;
  4702. /* Number of regions to map.*/
  4703. u32 property_flag;
  4704. /* Configures one common property for all the regions in the
  4705. * payload. No two regions in the same memory map regions cmd can
  4706. * have differnt property. Supported values: - 0x00000000 to
  4707. * 0x00000001
  4708. *
  4709. * b0 - bit 0 indicates physical or virtual mapping 0 shared memory
  4710. * address provided in avs_shared_map_regions_payload is physical
  4711. * address. The shared memory needs to be mapped( hardware TLB
  4712. * entry)
  4713. *
  4714. * and a software entry needs to be added for internal book keeping.
  4715. *
  4716. * 1 Shared memory address provided in MayPayload[usRegions] is
  4717. * virtual address. The shared memory must not be mapped (since
  4718. * hardware TLB entry is already available) but a software entry
  4719. * needs to be added for internal book keeping. This can be useful
  4720. * if two services with in ADSP is communicating via APR. They can
  4721. * now directly communicate via the Virtual address instead of
  4722. * Physical address. The virtual regions must be contiguous.
  4723. *
  4724. * b31-b1 - reserved bits. must be set to zero
  4725. */
  4726. } __packed;
  4727. struct avs_shared_map_region_payload {
  4728. u32 shm_addr_lsw;
  4729. /* least significant word of shared memory address of the memory
  4730. * region to map. It must be contiguous memory, and it must be 4 KB
  4731. * aligned.
  4732. */
  4733. u32 shm_addr_msw;
  4734. /* most significant word of shared memory address of the memory
  4735. * region to map. For 32 bit shared memory address, this field must
  4736. * tbe set to zero. For 36 bit shared memory address, bit31 to bit 4
  4737. * must be set to zero
  4738. */
  4739. u32 mem_size_bytes;
  4740. /* Number of bytes in the region.
  4741. *
  4742. * The aDSP will always map the regions as virtual contiguous
  4743. * memory, but the memory size must be in multiples of 4 KB to avoid
  4744. * gaps in the virtually contiguous mapped memory.
  4745. */
  4746. } __packed;
  4747. struct avs_cmd_shared_mem_unmap_regions {
  4748. struct apr_hdr hdr;
  4749. u32 mem_map_handle;
  4750. /* memory map handle returned by ASM_CMD_SHARED_MEM_MAP_REGIONS
  4751. * , ADM_CMD_SHARED_MEM_MAP_REGIONS, commands
  4752. */
  4753. } __packed;
  4754. /* Memory map command response payload used by the
  4755. * #ASM_CMDRSP_SHARED_MEM_MAP_REGIONS
  4756. * ,#ADM_CMDRSP_SHARED_MEM_MAP_REGIONS
  4757. */
  4758. struct avs_cmdrsp_shared_mem_map_regions {
  4759. u32 mem_map_handle;
  4760. /* A memory map handle encapsulating shared memory attributes is
  4761. * returned
  4762. */
  4763. } __packed;
  4764. #define AVS_MDF_MDSP_PROC_ID 0x2
  4765. #define AVS_MDF_SSC_PROC_ID 0x3
  4766. #define AVS_MDF_CDSP_PROC_ID 0x4
  4767. /* Shared memory map command payload used by the
  4768. * #AVCS_CMD_MAP_MDF_SHARED_MEMORY.
  4769. *
  4770. * This structure allows clients to map multiple shared memory
  4771. * regions with remote processor ID. All mapped regions must be
  4772. * from the same memory pool. Following this structure are
  4773. * num_regions of avs_shared_map_region_payload.
  4774. */
  4775. struct avs_cmd_map_mdf_shared_memory {
  4776. struct apr_hdr hdr;
  4777. uint32_t mem_map_handle;
  4778. /* Unique identifier for the shared memory address.
  4779. *
  4780. * The aDSP returns this handle for
  4781. * #AVCS_CMD_SHARED_MEM_MAP_REGIONS
  4782. *
  4783. * Supported values:
  4784. * Any 32-bit value
  4785. *
  4786. * The aDSP uses this handle to retrieve the shared memory
  4787. * attributes. This handle can be an abstract representation
  4788. * of the shared memory regions that are being mapped.
  4789. */
  4790. uint32_t proc_id;
  4791. /* Supported values:
  4792. * #AVS_MDF_MDSP_PROC_ID
  4793. * #AVS_MDF_SSC_PROC_ID
  4794. * #AVS_MDF_CDSP_PROC_ID
  4795. */
  4796. uint32_t num_regions;
  4797. /* Number of regions to be mapped with the remote DSP processor
  4798. * mentioned by proc_id field.
  4799. *
  4800. * Array of structures of avs_shared_map_region_payload will follow.
  4801. * The address fields in those arrays should correspond to the remote
  4802. * processor mentioned by proc_id.
  4803. * In case of DSPs with SMMU enabled, the address should be IOVA.
  4804. * And for DSPs without SMMU, the address should be physical address.
  4805. */
  4806. } __packed;
  4807. /*adsp_audio_memmap_api.h*/
  4808. /* ASM related data structures */
  4809. struct asm_wma_cfg {
  4810. u16 format_tag;
  4811. u16 ch_cfg;
  4812. u32 sample_rate;
  4813. u32 avg_bytes_per_sec;
  4814. u16 block_align;
  4815. u16 valid_bits_per_sample;
  4816. u32 ch_mask;
  4817. u16 encode_opt;
  4818. u16 adv_encode_opt;
  4819. u32 adv_encode_opt2;
  4820. u32 drc_peak_ref;
  4821. u32 drc_peak_target;
  4822. u32 drc_ave_ref;
  4823. u32 drc_ave_target;
  4824. } __packed;
  4825. struct asm_wmapro_cfg {
  4826. u16 format_tag;
  4827. u16 ch_cfg;
  4828. u32 sample_rate;
  4829. u32 avg_bytes_per_sec;
  4830. u16 block_align;
  4831. u16 valid_bits_per_sample;
  4832. u32 ch_mask;
  4833. u16 encode_opt;
  4834. u16 adv_encode_opt;
  4835. u32 adv_encode_opt2;
  4836. u32 drc_peak_ref;
  4837. u32 drc_peak_target;
  4838. u32 drc_ave_ref;
  4839. u32 drc_ave_target;
  4840. } __packed;
  4841. struct asm_aac_cfg {
  4842. u16 format;
  4843. u16 aot;
  4844. u16 ep_config;
  4845. u16 section_data_resilience;
  4846. u16 scalefactor_data_resilience;
  4847. u16 spectral_data_resilience;
  4848. u16 ch_cfg;
  4849. u16 reserved;
  4850. u32 sample_rate;
  4851. } __packed;
  4852. struct asm_amrwbplus_cfg {
  4853. u32 size_bytes;
  4854. u32 version;
  4855. u32 num_channels;
  4856. u32 amr_band_mode;
  4857. u32 amr_dtx_mode;
  4858. u32 amr_frame_fmt;
  4859. u32 amr_lsf_idx;
  4860. } __packed;
  4861. struct asm_flac_cfg {
  4862. u32 sample_rate;
  4863. u32 ext_sample_rate;
  4864. u32 min_frame_size;
  4865. u32 max_frame_size;
  4866. u16 stream_info_present;
  4867. u16 min_blk_size;
  4868. u16 max_blk_size;
  4869. u16 ch_cfg;
  4870. u16 sample_size;
  4871. u16 md5_sum;
  4872. };
  4873. struct asm_alac_cfg {
  4874. u32 frame_length;
  4875. u8 compatible_version;
  4876. u8 bit_depth;
  4877. u8 pb;
  4878. u8 mb;
  4879. u8 kb;
  4880. u8 num_channels;
  4881. u16 max_run;
  4882. u32 max_frame_bytes;
  4883. u32 avg_bit_rate;
  4884. u32 sample_rate;
  4885. u32 channel_layout_tag;
  4886. };
  4887. struct asm_g711_dec_cfg {
  4888. u32 sample_rate;
  4889. };
  4890. struct asm_vorbis_cfg {
  4891. u32 bit_stream_fmt;
  4892. };
  4893. struct asm_ape_cfg {
  4894. u16 compatible_version;
  4895. u16 compression_level;
  4896. u32 format_flags;
  4897. u32 blocks_per_frame;
  4898. u32 final_frame_blocks;
  4899. u32 total_frames;
  4900. u16 bits_per_sample;
  4901. u16 num_channels;
  4902. u32 sample_rate;
  4903. u32 seek_table_present;
  4904. };
  4905. struct asm_dsd_cfg {
  4906. u16 num_version;
  4907. u16 is_bitwise_big_endian;
  4908. u16 dsd_channel_block_size;
  4909. u16 num_channels;
  4910. u8 channel_mapping[8];
  4911. u32 dsd_data_rate;
  4912. };
  4913. struct asm_softpause_params {
  4914. u32 enable;
  4915. u32 period;
  4916. u32 step;
  4917. u32 rampingcurve;
  4918. } __packed;
  4919. struct asm_softvolume_params {
  4920. u32 period;
  4921. u32 step;
  4922. u32 rampingcurve;
  4923. } __packed;
  4924. #define ASM_END_POINT_DEVICE_MATRIX 0
  4925. #define PCM_CHANNEL_NULL 0
  4926. /* Front left channel. */
  4927. #define PCM_CHANNEL_FL 1
  4928. /* Front right channel. */
  4929. #define PCM_CHANNEL_FR 2
  4930. /* Front center channel. */
  4931. #define PCM_CHANNEL_FC 3
  4932. /* Left surround channel.*/
  4933. #define PCM_CHANNEL_LS 4
  4934. /* Right surround channel.*/
  4935. #define PCM_CHANNEL_RS 5
  4936. /* Low frequency effect channel. */
  4937. #define PCM_CHANNEL_LFE 6
  4938. /* Center surround channel; Rear center channel. */
  4939. #define PCM_CHANNEL_CS 7
  4940. /* Left back channel; Rear left channel. */
  4941. #define PCM_CHANNEL_LB 8
  4942. /* Right back channel; Rear right channel. */
  4943. #define PCM_CHANNEL_RB 9
  4944. /* Top surround channel. */
  4945. #define PCM_CHANNEL_TS 10
  4946. /* Center vertical height channel.*/
  4947. #define PCM_CHANNEL_CVH 11
  4948. /* Mono surround channel.*/
  4949. #define PCM_CHANNEL_MS 12
  4950. /* Front left of center. */
  4951. #define PCM_CHANNEL_FLC 13
  4952. /* Front right of center. */
  4953. #define PCM_CHANNEL_FRC 14
  4954. /* Rear left of center. */
  4955. #define PCM_CHANNEL_RLC 15
  4956. /* Rear right of center. */
  4957. #define PCM_CHANNEL_RRC 16
  4958. /* Second low frequency channel. */
  4959. #define PCM_CHANNEL_LFE2 17
  4960. /* Side left channel. */
  4961. #define PCM_CHANNEL_SL 18
  4962. /* Side right channel. */
  4963. #define PCM_CHANNEL_SR 19
  4964. /* Top front left channel. */
  4965. #define PCM_CHANNEL_TFL 20
  4966. /* Left vertical height channel. */
  4967. #define PCM_CHANNEL_LVH 20
  4968. /* Top front right channel. */
  4969. #define PCM_CHANNEL_TFR 21
  4970. /* Right vertical height channel. */
  4971. #define PCM_CHANNEL_RVH 21
  4972. /* Top center channel. */
  4973. #define PCM_CHANNEL_TC 22
  4974. /* Top back left channel. */
  4975. #define PCM_CHANNEL_TBL 23
  4976. /* Top back right channel. */
  4977. #define PCM_CHANNEL_TBR 24
  4978. /* Top side left channel. */
  4979. #define PCM_CHANNEL_TSL 25
  4980. /* Top side right channel. */
  4981. #define PCM_CHANNEL_TSR 26
  4982. /* Top back center channel. */
  4983. #define PCM_CHANNEL_TBC 27
  4984. /* Bottom front center channel. */
  4985. #define PCM_CHANNEL_BFC 28
  4986. /* Bottom front left channel. */
  4987. #define PCM_CHANNEL_BFL 29
  4988. /* Bottom front right channel. */
  4989. #define PCM_CHANNEL_BFR 30
  4990. /* Left wide channel. */
  4991. #define PCM_CHANNEL_LW 31
  4992. /* Right wide channel. */
  4993. #define PCM_CHANNEL_RW 32
  4994. /* Left side direct channel. */
  4995. #define PCM_CHANNEL_LSD 33
  4996. /* Right side direct channel. */
  4997. #define PCM_CHANNEL_RSD 34
  4998. /* Mark unused channel. */
  4999. #define PCM_CHANNEL_UNUSED 47
  5000. #define PCM_CUSTOM_CHANNEL_MAP_1 48
  5001. #define PCM_CUSTOM_CHANNEL_MAP_2 49
  5002. #define PCM_CUSTOM_CHANNEL_MAP_3 50
  5003. #define PCM_CUSTOM_CHANNEL_MAP_4 51
  5004. #define PCM_CUSTOM_CHANNEL_MAP_5 52
  5005. #define PCM_CUSTOM_CHANNEL_MAP_6 53
  5006. #define PCM_CUSTOM_CHANNEL_MAP_7 54
  5007. #define PCM_CUSTOM_CHANNEL_MAP_8 55
  5008. #define PCM_CUSTOM_CHANNEL_MAP_9 56
  5009. #define PCM_CUSTOM_CHANNEL_MAP_10 57
  5010. #define PCM_CUSTOM_CHANNEL_MAP_11 58
  5011. #define PCM_CUSTOM_CHANNEL_MAP_12 59
  5012. #define PCM_CUSTOM_CHANNEL_MAP_13 60
  5013. #define PCM_CUSTOM_CHANNEL_MAP_14 61
  5014. #define PCM_CUSTOM_CHANNEL_MAP_15 62
  5015. #define PCM_CUSTOM_CHANNEL_MAP_16 63
  5016. #define PCM_MAX_CHANNEL_MAP 63
  5017. /* Max valid channel map index */
  5018. #define PCM_MAX_CHMAP_ID PCM_MAX_CHANNEL_MAP
  5019. #define PCM_FORMAT_MAX_NUM_CHANNEL 8
  5020. #define PCM_FORMAT_MAX_CHANNELS_9 9
  5021. /* Used for ADM_CMD_DEVICE_OPEN_V8 */
  5022. #define PCM_FORMAT_MAX_NUM_CHANNEL_V8 32
  5023. #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2 0x00010DA5
  5024. #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 0x00010DDC
  5025. #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 0x0001320C
  5026. #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 0x00013222
  5027. #define ASM_MEDIA_FMT_EVRCB_FS 0x00010BEF
  5028. #define ASM_MEDIA_FMT_EVRCWB_FS 0x00010BF0
  5029. #define ASM_MEDIA_FMT_GENERIC_COMPRESSED 0x00013212
  5030. #define ASM_MAX_EQ_BANDS 12
  5031. #define ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2 0x00010D98
  5032. struct asm_data_cmd_media_fmt_update_v2 {
  5033. u32 fmt_blk_size;
  5034. /* Media format block size in bytes.*/
  5035. } __packed;
  5036. struct asm_generic_compressed_fmt_blk_t {
  5037. struct apr_hdr hdr;
  5038. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5039. /*
  5040. * Channel mapping array of bitstream output.
  5041. * Channel[i] mapping describes channel i inside the buffer, where
  5042. * i < num_channels. All valid used channels must be
  5043. * present at the beginning of the array.
  5044. */
  5045. uint8_t channel_mapping[8];
  5046. /*
  5047. * Number of channels of the incoming bitstream.
  5048. * Supported values: 1,2,3,4,5,6,7,8
  5049. */
  5050. uint16_t num_channels;
  5051. /*
  5052. * Nominal bits per sample value of the incoming bitstream.
  5053. * Supported values: 16, 32
  5054. */
  5055. uint16_t bits_per_sample;
  5056. /*
  5057. * Nominal sampling rate of the incoming bitstream.
  5058. * Supported values: 8000, 11025, 16000, 22050, 24000, 32000,
  5059. * 44100, 48000, 88200, 96000, 176400, 192000,
  5060. * 352800, 384000
  5061. */
  5062. uint32_t sampling_rate;
  5063. } __packed;
  5064. /* Command to send sample rate & channels for IEC61937 (compressed) or IEC60958
  5065. * (pcm) streams. Both audio standards use the same format and are used for
  5066. * HDMI or SPDIF output.
  5067. */
  5068. #define ASM_DATA_CMD_IEC_60958_MEDIA_FMT 0x0001321E
  5069. struct asm_iec_compressed_fmt_blk_t {
  5070. struct apr_hdr hdr;
  5071. /*
  5072. * Nominal sampling rate of the incoming bitstream.
  5073. * Supported values: 8000, 11025, 16000, 22050, 24000, 32000,
  5074. * 44100, 48000, 88200, 96000, 176400, 192000,
  5075. * 352800, 384000
  5076. */
  5077. uint32_t sampling_rate;
  5078. /*
  5079. * Number of channels of the incoming bitstream.
  5080. * Supported values: 1,2,3,4,5,6,7,8
  5081. */
  5082. uint32_t num_channels;
  5083. } __packed;
  5084. struct asm_multi_channel_pcm_fmt_blk_v2 {
  5085. struct apr_hdr hdr;
  5086. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5087. u16 num_channels;
  5088. /* Number of channels. Supported values: 1 to 8 */
  5089. u16 bits_per_sample;
  5090. /* Number of bits per sample per channel. * Supported values:
  5091. * 16, 24 * When used for playback, the client must send 24-bit
  5092. * samples packed in 32-bit words. The 24-bit samples must be placed
  5093. * in the most significant 24 bits of the 32-bit word. When used for
  5094. * recording, the aDSP sends 24-bit samples packed in 32-bit words.
  5095. * The 24-bit samples are placed in the most significant 24 bits of
  5096. * the 32-bit word.
  5097. */
  5098. u32 sample_rate;
  5099. /* Number of samples per second (in Hertz).
  5100. * Supported values: 2000 to 48000
  5101. */
  5102. u16 is_signed;
  5103. /* Flag that indicates the samples are signed (1). */
  5104. u16 reserved;
  5105. /* reserved field for 32 bit alignment. must be set to zero. */
  5106. u8 channel_mapping[8];
  5107. /* Channel array of size 8.
  5108. * Supported values:
  5109. * - #PCM_CHANNEL_L
  5110. * - #PCM_CHANNEL_R
  5111. * - #PCM_CHANNEL_C
  5112. * - #PCM_CHANNEL_LS
  5113. * - #PCM_CHANNEL_RS
  5114. * - #PCM_CHANNEL_LFE
  5115. * - #PCM_CHANNEL_CS
  5116. * - #PCM_CHANNEL_LB
  5117. * - #PCM_CHANNEL_RB
  5118. * - #PCM_CHANNEL_TS
  5119. * - #PCM_CHANNEL_CVH
  5120. * - #PCM_CHANNEL_MS
  5121. * - #PCM_CHANNEL_FLC
  5122. * - #PCM_CHANNEL_FRC
  5123. * - #PCM_CHANNEL_RLC
  5124. * - #PCM_CHANNEL_RRC
  5125. *
  5126. * Channel[i] mapping describes channel I. Each element i of the
  5127. * array describes channel I inside the buffer where 0 @le I <
  5128. * num_channels. An unused channel is set to zero.
  5129. */
  5130. } __packed;
  5131. struct asm_multi_channel_pcm_fmt_blk_v3 {
  5132. uint16_t num_channels;
  5133. /*
  5134. * Number of channels
  5135. * Supported values: 1 to 8
  5136. */
  5137. uint16_t bits_per_sample;
  5138. /*
  5139. * Number of bits per sample per channel
  5140. * Supported values: 16, 24
  5141. */
  5142. uint32_t sample_rate;
  5143. /*
  5144. * Number of samples per second
  5145. * Supported values: 2000 to 48000, 96000,192000 Hz
  5146. */
  5147. uint16_t is_signed;
  5148. /* Flag that indicates that PCM samples are signed (1) */
  5149. uint16_t sample_word_size;
  5150. /*
  5151. * Size in bits of the word that holds a sample of a channel.
  5152. * Supported values: 12,24,32
  5153. */
  5154. uint8_t channel_mapping[8];
  5155. /*
  5156. * Each element, i, in the array describes channel i inside the buffer where
  5157. * 0 <= i < num_channels. Unused channels are set to 0.
  5158. */
  5159. } __packed;
  5160. struct asm_multi_channel_pcm_fmt_blk_v4 {
  5161. uint16_t num_channels;
  5162. /*
  5163. * Number of channels
  5164. * Supported values: 1 to 8
  5165. */
  5166. uint16_t bits_per_sample;
  5167. /*
  5168. * Number of bits per sample per channel
  5169. * Supported values: 16, 24, 32
  5170. */
  5171. uint32_t sample_rate;
  5172. /*
  5173. * Number of samples per second
  5174. * Supported values: 2000 to 48000, 96000,192000 Hz
  5175. */
  5176. uint16_t is_signed;
  5177. /* Flag that indicates that PCM samples are signed (1) */
  5178. uint16_t sample_word_size;
  5179. /*
  5180. * Size in bits of the word that holds a sample of a channel.
  5181. * Supported values: 12,24,32
  5182. */
  5183. uint8_t channel_mapping[8];
  5184. /*
  5185. * Each element, i, in the array describes channel i inside the buffer where
  5186. * 0 <= i < num_channels. Unused channels are set to 0.
  5187. */
  5188. uint16_t endianness;
  5189. /*
  5190. * Flag to indicate the endianness of the pcm sample
  5191. * Supported values: 0 - Little endian (all other formats)
  5192. * 1 - Big endian (AIFF)
  5193. */
  5194. uint16_t mode;
  5195. /*
  5196. * Mode to provide additional info about the pcm input data.
  5197. * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
  5198. * Q31 for unpacked 24b or 32b)
  5199. * 15 - for 16 bit
  5200. * 23 - for 24b packed or 8.24 format
  5201. * 31 - for 24b unpacked or 32bit
  5202. */
  5203. } __packed;
  5204. struct asm_multi_channel_pcm_fmt_blk_v5 {
  5205. uint16_t num_channels;
  5206. /*
  5207. * Number of channels
  5208. * Supported values: 1 to 32
  5209. */
  5210. uint16_t bits_per_sample;
  5211. /*
  5212. * Number of bits per sample per channel
  5213. * Supported values: 16, 24, 32
  5214. */
  5215. uint32_t sample_rate;
  5216. /*
  5217. * Number of samples per second
  5218. * Supported values: 2000 to 48000, 96000,192000 Hz
  5219. */
  5220. uint16_t is_signed;
  5221. /* Flag that indicates that PCM samples are signed (1) */
  5222. uint16_t sample_word_size;
  5223. /*
  5224. * Size in bits of the word that holds a sample of a channel.
  5225. * Supported values: 12,24,32
  5226. */
  5227. uint16_t endianness;
  5228. /*
  5229. * Flag to indicate the endianness of the pcm sample
  5230. * Supported values: 0 - Little endian (all other formats)
  5231. * 1 - Big endian (AIFF)
  5232. */
  5233. uint16_t mode;
  5234. /*
  5235. * Mode to provide additional info about the pcm input data.
  5236. * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
  5237. * Q31 for unpacked 24b or 32b)
  5238. * 15 - for 16 bit
  5239. * 23 - for 24b packed or 8.24 format
  5240. * 31 - for 24b unpacked or 32bit
  5241. */
  5242. uint8_t channel_mapping[32];
  5243. /*
  5244. * Each element, i, in the array describes channel i inside the buffer where
  5245. * 0 <= i < num_channels. Unused channels are set to 0.
  5246. */
  5247. } __packed;
  5248. /*
  5249. * Payload of the multichannel PCM configuration parameters in
  5250. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 media format.
  5251. */
  5252. struct asm_multi_channel_pcm_fmt_blk_param_v3 {
  5253. struct apr_hdr hdr;
  5254. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5255. struct asm_multi_channel_pcm_fmt_blk_v3 param;
  5256. } __packed;
  5257. /*
  5258. * Payload of the multichannel PCM configuration parameters in
  5259. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 media format.
  5260. */
  5261. struct asm_multi_channel_pcm_fmt_blk_param_v4 {
  5262. struct apr_hdr hdr;
  5263. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5264. struct asm_multi_channel_pcm_fmt_blk_v4 param;
  5265. } __packed;
  5266. /*
  5267. * Payload of the multichannel PCM configuration parameters in
  5268. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 media format.
  5269. */
  5270. struct asm_multi_channel_pcm_fmt_blk_param_v5 {
  5271. struct apr_hdr hdr;
  5272. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5273. struct asm_multi_channel_pcm_fmt_blk_v5 param;
  5274. } __packed;
  5275. struct asm_stream_cmd_set_encdec_param {
  5276. u32 param_id;
  5277. /* ID of the parameter. */
  5278. u32 param_size;
  5279. /* Data size of this parameter, in bytes. The size is a multiple
  5280. * of 4 bytes.
  5281. */
  5282. } __packed;
  5283. struct asm_enc_cfg_blk_param_v2 {
  5284. u32 frames_per_buf;
  5285. /* Number of encoded frames to pack into each buffer.
  5286. *
  5287. * @note1hang This is only guidance information for the aDSP. The
  5288. * number of encoded frames put into each buffer (specified by the
  5289. * client) is less than or equal to this number.
  5290. */
  5291. u32 enc_cfg_blk_size;
  5292. /* Size in bytes of the encoder configuration block that follows
  5293. * this member.
  5294. */
  5295. } __packed;
  5296. struct asm_custom_enc_cfg_t_v2 {
  5297. struct apr_hdr hdr;
  5298. struct asm_stream_cmd_set_encdec_param encdec;
  5299. struct asm_enc_cfg_blk_param_v2 encblk;
  5300. uint32_t sample_rate;
  5301. uint16_t num_channels;
  5302. uint16_t reserved;
  5303. /* num_ch == 1, then PCM_CHANNEL_C,
  5304. * num_ch == 2, then {PCM_CHANNEL_L, PCM_CHANNEL_R}
  5305. */
  5306. uint8_t channel_mapping[8];
  5307. uint32_t custom_size;
  5308. uint8_t custom_data[15];
  5309. } __packed;
  5310. /* @brief Dolby Digital Plus end point configuration structure
  5311. */
  5312. struct asm_dec_ddp_endp_param_v2 {
  5313. struct apr_hdr hdr;
  5314. struct asm_stream_cmd_set_encdec_param encdec;
  5315. int endp_param_value;
  5316. } __packed;
  5317. /*
  5318. * Payload of the multichannel PCM encoder configuration parameters in
  5319. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 media format.
  5320. */
  5321. struct asm_multi_channel_pcm_enc_cfg_v5 {
  5322. struct apr_hdr hdr;
  5323. struct asm_stream_cmd_set_encdec_param encdec;
  5324. struct asm_enc_cfg_blk_param_v2 encblk;
  5325. uint16_t num_channels;
  5326. /*
  5327. * Number of PCM channels.
  5328. * @values
  5329. * - 0 -- Native mode
  5330. * - 1 -- 8 channels
  5331. * Native mode indicates that encoding must be performed with the number
  5332. * of channels at the input.
  5333. */
  5334. uint16_t bits_per_sample;
  5335. /*
  5336. * Number of bits per sample per channel.
  5337. * @values 16, 24
  5338. */
  5339. uint32_t sample_rate;
  5340. /*
  5341. * Number of samples per second.
  5342. * @values 0, 8000 to 48000 Hz
  5343. * A value of 0 indicates the native sampling rate. Encoding is
  5344. * performed at the input sampling rate.
  5345. */
  5346. uint16_t is_signed;
  5347. /*
  5348. * Flag that indicates the PCM samples are signed (1). Currently, only
  5349. * signed PCM samples are supported.
  5350. */
  5351. uint16_t sample_word_size;
  5352. /*
  5353. * The size in bits of the word that holds a sample of a channel.
  5354. * @values 16, 24, 32
  5355. * 16-bit samples are always placed in 16-bit words:
  5356. * sample_word_size = 1.
  5357. * 24-bit samples can be placed in 32-bit words or in consecutive
  5358. * 24-bit words.
  5359. * - If sample_word_size = 32, 24-bit samples are placed in the
  5360. * most significant 24 bits of a 32-bit word.
  5361. * - If sample_word_size = 24, 24-bit samples are placed in
  5362. * 24-bit words. @tablebulletend
  5363. */
  5364. uint16_t endianness;
  5365. /*
  5366. * Flag to indicate the endianness of the pcm sample
  5367. * Supported values: 0 - Little endian (all other formats)
  5368. * 1 - Big endian (AIFF)
  5369. */
  5370. uint16_t mode;
  5371. /*
  5372. * Mode to provide additional info about the pcm input data.
  5373. * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
  5374. * Q31 for unpacked 24b or 32b)
  5375. * 15 - for 16 bit
  5376. * 23 - for 24b packed or 8.24 format
  5377. */
  5378. uint8_t channel_mapping[PCM_FORMAT_MAX_NUM_CHANNEL_V8];
  5379. /*
  5380. * Channel mapping array expected at the encoder output.
  5381. * Channel[i] mapping describes channel i inside the buffer, where
  5382. * 0 @le i < num_channels. All valid used channels must be present at
  5383. * the beginning of the array.
  5384. * If Native mode is set for the channels, this field is ignored.
  5385. * @values See Section @xref{dox:PcmChannelDefs}
  5386. */
  5387. } __packed;
  5388. /*
  5389. * Payload of the multichannel PCM encoder configuration parameters in
  5390. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 media format.
  5391. */
  5392. struct asm_multi_channel_pcm_enc_cfg_v4 {
  5393. struct apr_hdr hdr;
  5394. struct asm_stream_cmd_set_encdec_param encdec;
  5395. struct asm_enc_cfg_blk_param_v2 encblk;
  5396. uint16_t num_channels;
  5397. /*
  5398. * Number of PCM channels.
  5399. * @values
  5400. * - 0 -- Native mode
  5401. * - 1 -- 8 channels
  5402. * Native mode indicates that encoding must be performed with the number
  5403. * of channels at the input.
  5404. */
  5405. uint16_t bits_per_sample;
  5406. /*
  5407. * Number of bits per sample per channel.
  5408. * @values 16, 24
  5409. */
  5410. uint32_t sample_rate;
  5411. /*
  5412. * Number of samples per second.
  5413. * @values 0, 8000 to 48000 Hz
  5414. * A value of 0 indicates the native sampling rate. Encoding is
  5415. * performed at the input sampling rate.
  5416. */
  5417. uint16_t is_signed;
  5418. /*
  5419. * Flag that indicates the PCM samples are signed (1). Currently, only
  5420. * signed PCM samples are supported.
  5421. */
  5422. uint16_t sample_word_size;
  5423. /*
  5424. * The size in bits of the word that holds a sample of a channel.
  5425. * @values 16, 24, 32
  5426. * 16-bit samples are always placed in 16-bit words:
  5427. * sample_word_size = 1.
  5428. * 24-bit samples can be placed in 32-bit words or in consecutive
  5429. * 24-bit words.
  5430. * - If sample_word_size = 32, 24-bit samples are placed in the
  5431. * most significant 24 bits of a 32-bit word.
  5432. * - If sample_word_size = 24, 24-bit samples are placed in
  5433. * 24-bit words. @tablebulletend
  5434. */
  5435. uint8_t channel_mapping[8];
  5436. /*
  5437. * Channel mapping array expected at the encoder output.
  5438. * Channel[i] mapping describes channel i inside the buffer, where
  5439. * 0 @le i < num_channels. All valid used channels must be present at
  5440. * the beginning of the array.
  5441. * If Native mode is set for the channels, this field is ignored.
  5442. * @values See Section @xref{dox:PcmChannelDefs}
  5443. */
  5444. uint16_t endianness;
  5445. /*
  5446. * Flag to indicate the endianness of the pcm sample
  5447. * Supported values: 0 - Little endian (all other formats)
  5448. * 1 - Big endian (AIFF)
  5449. */
  5450. uint16_t mode;
  5451. /*
  5452. * Mode to provide additional info about the pcm input data.
  5453. * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
  5454. * Q31 for unpacked 24b or 32b)
  5455. * 15 - for 16 bit
  5456. * 23 - for 24b packed or 8.24 format
  5457. * 31 - for 24b unpacked or 32bit
  5458. */
  5459. } __packed;
  5460. /*
  5461. * Payload of the multichannel PCM encoder configuration parameters in
  5462. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 media format.
  5463. */
  5464. struct asm_multi_channel_pcm_enc_cfg_v3 {
  5465. struct apr_hdr hdr;
  5466. struct asm_stream_cmd_set_encdec_param encdec;
  5467. struct asm_enc_cfg_blk_param_v2 encblk;
  5468. uint16_t num_channels;
  5469. /*
  5470. * Number of PCM channels.
  5471. * @values
  5472. * - 0 -- Native mode
  5473. * - 1 -- 8 channels
  5474. * Native mode indicates that encoding must be performed with the number
  5475. * of channels at the input.
  5476. */
  5477. uint16_t bits_per_sample;
  5478. /*
  5479. * Number of bits per sample per channel.
  5480. * @values 16, 24
  5481. */
  5482. uint32_t sample_rate;
  5483. /*
  5484. * Number of samples per second.
  5485. * @values 0, 8000 to 48000 Hz
  5486. * A value of 0 indicates the native sampling rate. Encoding is
  5487. * performed at the input sampling rate.
  5488. */
  5489. uint16_t is_signed;
  5490. /*
  5491. * Flag that indicates the PCM samples are signed (1). Currently, only
  5492. * signed PCM samples are supported.
  5493. */
  5494. uint16_t sample_word_size;
  5495. /*
  5496. * The size in bits of the word that holds a sample of a channel.
  5497. * @values 16, 24, 32
  5498. * 16-bit samples are always placed in 16-bit words:
  5499. * sample_word_size = 1.
  5500. * 24-bit samples can be placed in 32-bit words or in consecutive
  5501. * 24-bit words.
  5502. * - If sample_word_size = 32, 24-bit samples are placed in the
  5503. * most significant 24 bits of a 32-bit word.
  5504. * - If sample_word_size = 24, 24-bit samples are placed in
  5505. * 24-bit words. @tablebulletend
  5506. */
  5507. uint8_t channel_mapping[8];
  5508. /*
  5509. * Channel mapping array expected at the encoder output.
  5510. * Channel[i] mapping describes channel i inside the buffer, where
  5511. * 0 @le i < num_channels. All valid used channels must be present at
  5512. * the beginning of the array.
  5513. * If Native mode is set for the channels, this field is ignored.
  5514. * @values See Section @xref{dox:PcmChannelDefs}
  5515. */
  5516. };
  5517. /* @brief Multichannel PCM encoder configuration structure used
  5518. * in the #ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 command.
  5519. */
  5520. struct asm_multi_channel_pcm_enc_cfg_v2 {
  5521. struct apr_hdr hdr;
  5522. struct asm_stream_cmd_set_encdec_param encdec;
  5523. struct asm_enc_cfg_blk_param_v2 encblk;
  5524. uint16_t num_channels;
  5525. /*< Number of PCM channels.
  5526. *
  5527. * Supported values: - 0 -- Native mode - 1 -- 8 Native mode
  5528. * indicates that encoding must be performed with the number of
  5529. * channels at the input.
  5530. */
  5531. uint16_t bits_per_sample;
  5532. /*< Number of bits per sample per channel.
  5533. * Supported values: 16, 24
  5534. */
  5535. uint32_t sample_rate;
  5536. /*< Number of samples per second (in Hertz).
  5537. *
  5538. * Supported values: 0, 8000 to 48000 A value of 0 indicates the
  5539. * native sampling rate. Encoding is performed at the input sampling
  5540. * rate.
  5541. */
  5542. uint16_t is_signed;
  5543. /*< Specifies whether the samples are signed (1). Currently,
  5544. * only signed samples are supported.
  5545. */
  5546. uint16_t reserved;
  5547. /*< reserved field for 32 bit alignment. must be set to zero.*/
  5548. uint8_t channel_mapping[8];
  5549. } __packed;
  5550. #define ASM_MEDIA_FMT_MP3 0x00010BE9
  5551. #define ASM_MEDIA_FMT_AAC_V2 0x00010DA6
  5552. /* @xreflabel
  5553. * {hdr:AsmMediaFmtDolbyAac} Media format ID for the
  5554. * Dolby AAC decoder. This format ID is be used if the client wants
  5555. * to use the Dolby AAC decoder to decode MPEG2 and MPEG4 AAC
  5556. * contents.
  5557. */
  5558. #define ASM_MEDIA_FMT_DOLBY_AAC 0x00010D86
  5559. /* Enumeration for the audio data transport stream AAC format. */
  5560. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS 0
  5561. /* Enumeration for low overhead audio stream AAC format. */
  5562. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS 1
  5563. /* Enumeration for the audio data interchange format
  5564. * AAC format.
  5565. */
  5566. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF 2
  5567. /* Enumeration for the raw AAC format. */
  5568. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW 3
  5569. /* Enumeration for the AAC LATM format. */
  5570. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LATM 4
  5571. #define ASM_MEDIA_FMT_AAC_AOT_LC 2
  5572. #define ASM_MEDIA_FMT_AAC_AOT_SBR 5
  5573. #define ASM_MEDIA_FMT_AAC_AOT_PS 29
  5574. #define ASM_MEDIA_FMT_AAC_AOT_BSAC 22
  5575. struct asm_aac_fmt_blk_v2 {
  5576. struct apr_hdr hdr;
  5577. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5578. u16 aac_fmt_flag;
  5579. /* Bitstream format option.
  5580. * Supported values:
  5581. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
  5582. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS
  5583. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF
  5584. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
  5585. */
  5586. u16 audio_objype;
  5587. /* Audio Object Type (AOT) present in the AAC stream.
  5588. * Supported values:
  5589. * - #ASM_MEDIA_FMT_AAC_AOT_LC
  5590. * - #ASM_MEDIA_FMT_AAC_AOT_SBR
  5591. * - #ASM_MEDIA_FMT_AAC_AOT_BSAC
  5592. * - #ASM_MEDIA_FMT_AAC_AOT_PS
  5593. * - Otherwise -- Not supported
  5594. */
  5595. u16 channel_config;
  5596. /* Number of channels present in the AAC stream.
  5597. * Supported values:
  5598. * - 1 -- Mono
  5599. * - 2 -- Stereo
  5600. * - 6 -- 5.1 content
  5601. */
  5602. u16 total_size_of_PCE_bits;
  5603. /* greater or equal to zero. * -In case of RAW formats and
  5604. * channel config = 0 (PCE), client can send * the bit stream
  5605. * containing PCE immediately following this structure * (in-band).
  5606. * -This number does not include bits included for 32 bit alignment.
  5607. * -If zero, then the PCE info is assumed to be available in the
  5608. * audio -bit stream & not in-band.
  5609. */
  5610. u32 sample_rate;
  5611. /* Number of samples per second (in Hertz).
  5612. *
  5613. * Supported values: 8000, 11025, 12000, 16000, 22050, 24000, 32000,
  5614. * 44100, 48000
  5615. *
  5616. * This field must be equal to the sample rate of the AAC-LC
  5617. * decoder's output. - For MP4 or 3GP containers, this is indicated
  5618. * by the samplingFrequencyIndex field in the AudioSpecificConfig
  5619. * element. - For ADTS format, this is indicated by the
  5620. * samplingFrequencyIndex in the ADTS fixed header. - For ADIF
  5621. * format, this is indicated by the samplingFrequencyIndex in the
  5622. * program_config_element present in the ADIF header.
  5623. */
  5624. } __packed;
  5625. struct asm_aac_enc_cfg_v2 {
  5626. struct apr_hdr hdr;
  5627. struct asm_stream_cmd_set_encdec_param encdec;
  5628. struct asm_enc_cfg_blk_param_v2 encblk;
  5629. u32 bit_rate;
  5630. /* Encoding rate in bits per second. */
  5631. u32 enc_mode;
  5632. /* Encoding mode.
  5633. * Supported values:
  5634. * - #ASM_MEDIA_FMT_AAC_AOT_LC
  5635. * - #ASM_MEDIA_FMT_AAC_AOT_SBR
  5636. * - #ASM_MEDIA_FMT_AAC_AOT_PS
  5637. */
  5638. u16 aac_fmt_flag;
  5639. /* AAC format flag.
  5640. * Supported values:
  5641. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
  5642. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
  5643. */
  5644. u16 channel_cfg;
  5645. /* Number of channels to encode.
  5646. * Supported values:
  5647. * - 0 -- Native mode
  5648. * - 1 -- Mono
  5649. * - 2 -- Stereo
  5650. * - Other values are not supported.
  5651. * @note1hang The eAAC+ encoder mode supports only stereo.
  5652. * Native mode indicates that encoding must be performed with the
  5653. * number of channels at the input.
  5654. * The number of channels must not change during encoding.
  5655. */
  5656. u32 sample_rate;
  5657. /* Number of samples per second.
  5658. * Supported values: - 0 -- Native mode - For other values,
  5659. * Native mode indicates that encoding must be performed with the
  5660. * sampling rate at the input.
  5661. * The sampling rate must not change during encoding.
  5662. */
  5663. } __packed;
  5664. #define ASM_MEDIA_FMT_G711_ALAW_FS 0x00010BF7
  5665. #define ASM_MEDIA_FMT_G711_MLAW_FS 0x00010C2E
  5666. struct asm_g711_enc_cfg_v2 {
  5667. struct apr_hdr hdr;
  5668. struct asm_stream_cmd_set_encdec_param encdec;
  5669. struct asm_enc_cfg_blk_param_v2 encblk;
  5670. u32 sample_rate;
  5671. /*
  5672. * Number of samples per second.
  5673. * Supported values: 8000, 16000 Hz
  5674. */
  5675. } __packed;
  5676. struct asm_vorbis_fmt_blk_v2 {
  5677. struct apr_hdr hdr;
  5678. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5679. u32 bit_stream_fmt;
  5680. /* Bit stream format.
  5681. * Supported values:
  5682. * - 0 -- Raw bitstream
  5683. * - 1 -- Transcoded bitstream
  5684. *
  5685. * Transcoded bitstream containing the size of the frame as the first
  5686. * word in each frame.
  5687. */
  5688. } __packed;
  5689. struct asm_flac_fmt_blk_v2 {
  5690. struct apr_hdr hdr;
  5691. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5692. u16 is_stream_info_present;
  5693. /* Specifies whether stream information is present in the FLAC format
  5694. * block.
  5695. *
  5696. * Supported values:
  5697. * - 0 -- Stream information is not present in this message
  5698. * - 1 -- Stream information is present in this message
  5699. *
  5700. * When set to 1, the FLAC bitstream was successfully parsed by the
  5701. * client, and other fields in the FLAC format block can be read by the
  5702. * decoder to get metadata stream information.
  5703. */
  5704. u16 num_channels;
  5705. /* Number of channels for decoding.
  5706. * Supported values: 1 to 2
  5707. */
  5708. u16 min_blk_size;
  5709. /* Minimum block size (in samples) used in the stream. It must be less
  5710. * than or equal to max_blk_size.
  5711. */
  5712. u16 max_blk_size;
  5713. /* Maximum block size (in samples) used in the stream. If the
  5714. * minimum block size equals the maximum block size, a fixed block
  5715. * size stream is implied.
  5716. */
  5717. u16 md5_sum[8];
  5718. /* MD5 signature array of the unencoded audio data. This allows the
  5719. * decoder to determine if an error exists in the audio data, even when
  5720. * the error does not result in an invalid bitstream.
  5721. */
  5722. u32 sample_rate;
  5723. /* Number of samples per second.
  5724. * Supported values: 8000 to 48000 Hz
  5725. */
  5726. u32 min_frame_size;
  5727. /* Minimum frame size used in the stream.
  5728. * Supported values:
  5729. * - > 0 bytes
  5730. * - 0 -- The value is unknown
  5731. */
  5732. u32 max_frame_size;
  5733. /* Maximum frame size used in the stream.
  5734. * Supported values:
  5735. * -- > 0 bytes
  5736. * -- 0 . The value is unknown
  5737. */
  5738. u16 sample_size;
  5739. /* Bits per sample.Supported values: 8, 16 */
  5740. u16 reserved;
  5741. /* Clients must set this field to zero
  5742. */
  5743. } __packed;
  5744. struct asm_alac_fmt_blk_v2 {
  5745. struct apr_hdr hdr;
  5746. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5747. u32 frame_length;
  5748. u8 compatible_version;
  5749. u8 bit_depth;
  5750. u8 pb;
  5751. u8 mb;
  5752. u8 kb;
  5753. u8 num_channels;
  5754. u16 max_run;
  5755. u32 max_frame_bytes;
  5756. u32 avg_bit_rate;
  5757. u32 sample_rate;
  5758. u32 channel_layout_tag;
  5759. } __packed;
  5760. struct asm_g711_dec_fmt_blk_v2 {
  5761. struct apr_hdr hdr;
  5762. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5763. u32 sample_rate;
  5764. } __packed;
  5765. struct asm_ape_fmt_blk_v2 {
  5766. struct apr_hdr hdr;
  5767. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5768. u16 compatible_version;
  5769. u16 compression_level;
  5770. u32 format_flags;
  5771. u32 blocks_per_frame;
  5772. u32 final_frame_blocks;
  5773. u32 total_frames;
  5774. u16 bits_per_sample;
  5775. u16 num_channels;
  5776. u32 sample_rate;
  5777. u32 seek_table_present;
  5778. } __packed;
  5779. struct asm_dsd_fmt_blk_v2 {
  5780. struct apr_hdr hdr;
  5781. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5782. u16 num_version;
  5783. u16 is_bitwise_big_endian;
  5784. u16 dsd_channel_block_size;
  5785. u16 num_channels;
  5786. u8 channel_mapping[8];
  5787. u32 dsd_data_rate;
  5788. } __packed;
  5789. #define ASM_MEDIA_FMT_AMRNB_FS 0x00010BEB
  5790. /* Enumeration for 4.75 kbps AMR-NB Encoding mode. */
  5791. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MR475 0
  5792. /* Enumeration for 5.15 kbps AMR-NB Encoding mode. */
  5793. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MR515 1
  5794. /* Enumeration for 5.90 kbps AMR-NB Encoding mode. */
  5795. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR59 2
  5796. /* Enumeration for 6.70 kbps AMR-NB Encoding mode. */
  5797. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR67 3
  5798. /* Enumeration for 7.40 kbps AMR-NB Encoding mode. */
  5799. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR74 4
  5800. /* Enumeration for 7.95 kbps AMR-NB Encoding mode. */
  5801. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR795 5
  5802. /* Enumeration for 10.20 kbps AMR-NB Encoding mode. */
  5803. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR102 6
  5804. /* Enumeration for 12.20 kbps AMR-NB Encoding mode. */
  5805. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR122 7
  5806. /* Enumeration for AMR-NB Discontinuous Transmission mode off. */
  5807. #define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF 0
  5808. /* Enumeration for AMR-NB DTX mode VAD1. */
  5809. #define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1 1
  5810. /* Enumeration for AMR-NB DTX mode VAD2. */
  5811. #define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD2 2
  5812. /* Enumeration for AMR-NB DTX mode auto. */
  5813. #define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_AUTO 3
  5814. struct asm_amrnb_enc_cfg {
  5815. struct apr_hdr hdr;
  5816. struct asm_stream_cmd_set_encdec_param encdec;
  5817. struct asm_enc_cfg_blk_param_v2 encblk;
  5818. u16 enc_mode;
  5819. /* AMR-NB encoding rate.
  5820. * Supported values:
  5821. * Use the ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_*
  5822. * macros
  5823. */
  5824. u16 dtx_mode;
  5825. /* Specifies whether DTX mode is disabled or enabled.
  5826. * Supported values:
  5827. * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF
  5828. * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1
  5829. */
  5830. } __packed;
  5831. #define ASM_MEDIA_FMT_AMRWB_FS 0x00010BEC
  5832. /* Enumeration for 6.6 kbps AMR-WB Encoding mode. */
  5833. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR66 0
  5834. /* Enumeration for 8.85 kbps AMR-WB Encoding mode. */
  5835. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR885 1
  5836. /* Enumeration for 12.65 kbps AMR-WB Encoding mode. */
  5837. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1265 2
  5838. /* Enumeration for 14.25 kbps AMR-WB Encoding mode. */
  5839. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1425 3
  5840. /* Enumeration for 15.85 kbps AMR-WB Encoding mode. */
  5841. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1585 4
  5842. /* Enumeration for 18.25 kbps AMR-WB Encoding mode. */
  5843. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1825 5
  5844. /* Enumeration for 19.85 kbps AMR-WB Encoding mode. */
  5845. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1985 6
  5846. /* Enumeration for 23.05 kbps AMR-WB Encoding mode. */
  5847. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR2305 7
  5848. /* Enumeration for 23.85 kbps AMR-WB Encoding mode. */
  5849. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR2385 8
  5850. struct asm_amrwb_enc_cfg {
  5851. struct apr_hdr hdr;
  5852. struct asm_stream_cmd_set_encdec_param encdec;
  5853. struct asm_enc_cfg_blk_param_v2 encblk;
  5854. u16 enc_mode;
  5855. /* AMR-WB encoding rate.
  5856. * Suupported values:
  5857. * Use the ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_*
  5858. * macros
  5859. */
  5860. u16 dtx_mode;
  5861. /* Specifies whether DTX mode is disabled or enabled.
  5862. * Supported values:
  5863. * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF
  5864. * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1
  5865. */
  5866. } __packed;
  5867. #define ASM_MEDIA_FMT_V13K_FS 0x00010BED
  5868. /* Enumeration for 14.4 kbps V13K Encoding mode. */
  5869. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1440 0
  5870. /* Enumeration for 12.2 kbps V13K Encoding mode. */
  5871. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1220 1
  5872. /* Enumeration for 11.2 kbps V13K Encoding mode. */
  5873. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1120 2
  5874. /* Enumeration for 9.0 kbps V13K Encoding mode. */
  5875. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR90 3
  5876. /* Enumeration for 7.2 kbps V13K eEncoding mode. */
  5877. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR720 4
  5878. /* Enumeration for 1/8 vocoder rate.*/
  5879. #define ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE 1
  5880. /* Enumeration for 1/4 vocoder rate. */
  5881. #define ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE 2
  5882. /* Enumeration for 1/2 vocoder rate. */
  5883. #define ASM_MEDIA_FMT_VOC_HALF_RATE 3
  5884. /* Enumeration for full vocoder rate. */
  5885. #define ASM_MEDIA_FMT_VOC_FULL_RATE 4
  5886. struct asm_v13k_enc_cfg {
  5887. struct apr_hdr hdr;
  5888. struct asm_stream_cmd_set_encdec_param encdec;
  5889. struct asm_enc_cfg_blk_param_v2 encblk;
  5890. u16 max_rate;
  5891. /* Maximum allowed encoder frame rate.
  5892. * Supported values:
  5893. * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
  5894. * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
  5895. * - #ASM_MEDIA_FMT_VOC_HALF_RATE
  5896. * - #ASM_MEDIA_FMT_VOC_FULL_RATE
  5897. */
  5898. u16 min_rate;
  5899. /* Minimum allowed encoder frame rate.
  5900. * Supported values:
  5901. * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
  5902. * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
  5903. * - #ASM_MEDIA_FMT_VOC_HALF_RATE
  5904. * - #ASM_MEDIA_FMT_VOC_FULL_RATE
  5905. */
  5906. u16 reduced_rate_cmd;
  5907. /* Reduced rate command, used to change
  5908. * the average bitrate of the V13K
  5909. * vocoder.
  5910. * Supported values:
  5911. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1440 (Default)
  5912. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1220
  5913. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1120
  5914. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR90
  5915. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR720
  5916. */
  5917. u16 rate_mod_cmd;
  5918. /* Rate modulation command. Default = 0.
  5919. *- If bit 0=1, rate control is enabled.
  5920. *- If bit 1=1, the maximum number of consecutive full rate
  5921. * frames is limited with numbers supplied in
  5922. * bits 2 to 10.
  5923. *- If bit 1=0, the minimum number of non-full rate frames
  5924. * in between two full rate frames is forced to
  5925. * the number supplied in bits 2 to 10. In both cases, if necessary,
  5926. * half rate is used to substitute full rate. - Bits 15 to 10 are
  5927. * reserved and must all be set to zero.
  5928. */
  5929. } __packed;
  5930. #define ASM_MEDIA_FMT_EVRC_FS 0x00010BEE
  5931. /* EVRC encoder configuration structure used in the
  5932. * #ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 command.
  5933. */
  5934. struct asm_evrc_enc_cfg {
  5935. struct apr_hdr hdr;
  5936. struct asm_stream_cmd_set_encdec_param encdec;
  5937. struct asm_enc_cfg_blk_param_v2 encblk;
  5938. u16 max_rate;
  5939. /* Maximum allowed encoder frame rate.
  5940. * Supported values:
  5941. * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
  5942. * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
  5943. * - #ASM_MEDIA_FMT_VOC_HALF_RATE
  5944. * - #ASM_MEDIA_FMT_VOC_FULL_RATE
  5945. */
  5946. u16 min_rate;
  5947. /* Minimum allowed encoder frame rate.
  5948. * Supported values:
  5949. * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
  5950. * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
  5951. * - #ASM_MEDIA_FMT_VOC_HALF_RATE
  5952. * - #ASM_MEDIA_FMT_VOC_FULL_RATE
  5953. */
  5954. u16 rate_mod_cmd;
  5955. /* Rate modulation command. Default: 0.
  5956. * - If bit 0=1, rate control is enabled.
  5957. * - If bit 1=1, the maximum number of consecutive full rate frames
  5958. * is limited with numbers supplied in bits 2 to 10.
  5959. *
  5960. * - If bit 1=0, the minimum number of non-full rate frames in
  5961. * between two full rate frames is forced to the number supplied in
  5962. * bits 2 to 10. In both cases, if necessary, half rate is used to
  5963. * substitute full rate.
  5964. *
  5965. * - Bits 15 to 10 are reserved and must all be set to zero.
  5966. */
  5967. u16 reserved;
  5968. /* Reserved. Clients must set this field to zero. */
  5969. } __packed;
  5970. #define ASM_MEDIA_FMT_WMA_V10PRO_V2 0x00010DA7
  5971. struct asm_wmaprov10_fmt_blk_v2 {
  5972. struct apr_hdr hdr;
  5973. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5974. u16 fmtag;
  5975. /* WMA format type.
  5976. * Supported values:
  5977. * - 0x162 -- WMA 9 Pro
  5978. * - 0x163 -- WMA 9 Pro Lossless
  5979. * - 0x166 -- WMA 10 Pro
  5980. * - 0x167 -- WMA 10 Pro Lossless
  5981. */
  5982. u16 num_channels;
  5983. /* Number of channels encoded in the input stream.
  5984. * Supported values: 1 to 8
  5985. */
  5986. u32 sample_rate;
  5987. /* Number of samples per second (in Hertz).
  5988. * Supported values: 11025, 16000, 22050, 32000, 44100, 48000,
  5989. * 88200, 96000
  5990. */
  5991. u32 avg_bytes_per_sec;
  5992. /* Bitrate expressed as the average bytes per second.
  5993. * Supported values: 2000 to 96000
  5994. */
  5995. u16 blk_align;
  5996. /* Size of the bitstream packet size in bytes. WMA Pro files
  5997. * have a payload of one block per bitstream packet.
  5998. * Supported values: @le 13376
  5999. */
  6000. u16 bits_per_sample;
  6001. /* Number of bits per sample in the encoded WMA stream.
  6002. * Supported values: 16, 24
  6003. */
  6004. u32 channel_mask;
  6005. /* Bit-packed double word (32-bits) that indicates the
  6006. * recommended speaker positions for each source channel.
  6007. */
  6008. u16 enc_options;
  6009. /* Bit-packed word with values that indicate whether certain
  6010. * features of the bitstream are used.
  6011. * Supported values: - 0x0001 -- ENCOPT3_PURE_LOSSLESS - 0x0006 --
  6012. * ENCOPT3_FRM_SIZE_MOD - 0x0038 -- ENCOPT3_SUBFRM_DIV - 0x0040 --
  6013. * ENCOPT3_WRITE_FRAMESIZE_IN_HDR - 0x0080 --
  6014. * ENCOPT3_GENERATE_DRC_PARAMS - 0x0100 -- ENCOPT3_RTMBITS
  6015. */
  6016. u16 usAdvancedEncodeOpt;
  6017. /* Advanced encoding option. */
  6018. u32 advanced_enc_options2;
  6019. /* Advanced encoding option 2. */
  6020. } __packed;
  6021. #define ASM_MEDIA_FMT_WMA_V9_V2 0x00010DA8
  6022. struct asm_wmastdv9_fmt_blk_v2 {
  6023. struct apr_hdr hdr;
  6024. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  6025. u16 fmtag;
  6026. /* WMA format tag.
  6027. * Supported values: 0x161 (WMA 9 standard)
  6028. */
  6029. u16 num_channels;
  6030. /* Number of channels in the stream.
  6031. * Supported values: 1, 2
  6032. */
  6033. u32 sample_rate;
  6034. /* Number of samples per second (in Hertz).
  6035. * Supported values: 48000
  6036. */
  6037. u32 avg_bytes_per_sec;
  6038. /* Bitrate expressed as the average bytes per second. */
  6039. u16 blk_align;
  6040. /* Block align. All WMA files with a maximum packet size of
  6041. * 13376 are supported.
  6042. */
  6043. u16 bits_per_sample;
  6044. /* Number of bits per sample in the output.
  6045. * Supported values: 16
  6046. */
  6047. u32 channel_mask;
  6048. /* Channel mask.
  6049. * Supported values:
  6050. * - 3 -- Stereo (front left/front right)
  6051. * - 4 -- Mono (center)
  6052. */
  6053. u16 enc_options;
  6054. /* Options used during encoding. */
  6055. u16 reserved;
  6056. } __packed;
  6057. #define ASM_MEDIA_FMT_WMA_V8 0x00010D91
  6058. struct asm_wmastdv8_enc_cfg {
  6059. struct apr_hdr hdr;
  6060. struct asm_stream_cmd_set_encdec_param encdec;
  6061. struct asm_enc_cfg_blk_param_v2 encblk;
  6062. u32 bit_rate;
  6063. /* Encoding rate in bits per second. */
  6064. u32 sample_rate;
  6065. /* Number of samples per second.
  6066. *
  6067. * Supported values:
  6068. * - 0 -- Native mode
  6069. * - Other Supported values are 22050, 32000, 44100, and 48000.
  6070. *
  6071. * Native mode indicates that encoding must be performed with the
  6072. * sampling rate at the input.
  6073. * The sampling rate must not change during encoding.
  6074. */
  6075. u16 channel_cfg;
  6076. /* Number of channels to encode.
  6077. * Supported values:
  6078. * - 0 -- Native mode
  6079. * - 1 -- Mono
  6080. * - 2 -- Stereo
  6081. * - Other values are not supported.
  6082. *
  6083. * Native mode indicates that encoding must be performed with the
  6084. * number of channels at the input.
  6085. * The number of channels must not change during encoding.
  6086. */
  6087. u16 reserved;
  6088. /* Reserved. Clients must set this field to zero.*/
  6089. } __packed;
  6090. #define ASM_MEDIA_FMT_AMR_WB_PLUS_V2 0x00010DA9
  6091. struct asm_amrwbplus_fmt_blk_v2 {
  6092. struct apr_hdr hdr;
  6093. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  6094. u32 amr_frame_fmt;
  6095. /* AMR frame format.
  6096. * Supported values:
  6097. * - 6 -- Transport Interface Format (TIF)
  6098. * - Any other value -- File storage format (FSF)
  6099. *
  6100. * TIF stream contains 2-byte header for each frame within the
  6101. * superframe. FSF stream contains one 2-byte header per superframe.
  6102. */
  6103. } __packed;
  6104. #define ASM_MEDIA_FMT_AC3 0x00010DEE
  6105. #define ASM_MEDIA_FMT_EAC3 0x00010DEF
  6106. #define ASM_MEDIA_FMT_DTS 0x00010D88
  6107. #define ASM_MEDIA_FMT_MP2 0x00010DE9
  6108. #define ASM_MEDIA_FMT_FLAC 0x00010C16
  6109. #define ASM_MEDIA_FMT_ALAC 0x00012F31
  6110. #define ASM_MEDIA_FMT_VORBIS 0x00010C15
  6111. #define ASM_MEDIA_FMT_APE 0x00012F32
  6112. #define ASM_MEDIA_FMT_DSD 0x00012F3E
  6113. #define ASM_MEDIA_FMT_TRUEHD 0x00013215
  6114. /* 0x0 is used for fomat ID since ADSP dynamically determines the
  6115. * format encapsulated in the IEC61937 (compressed) or IEC60958
  6116. * (pcm) packets.
  6117. */
  6118. #define ASM_MEDIA_FMT_IEC 0x00000000
  6119. /* Media format ID for adaptive transform acoustic coding. This
  6120. * ID is used by the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED command
  6121. * only.
  6122. */
  6123. #define ASM_MEDIA_FMT_ATRAC 0x00010D89
  6124. /* Media format ID for metadata-enhanced audio transmission.
  6125. * This ID is used by the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED
  6126. * command only.
  6127. */
  6128. #define ASM_MEDIA_FMT_MAT 0x00010D8A
  6129. /* adsp_media_fmt.h */
  6130. #define ASM_DATA_CMD_WRITE_V2 0x00010DAB
  6131. struct asm_data_cmd_write_v2 {
  6132. struct apr_hdr hdr;
  6133. u32 buf_addr_lsw;
  6134. /* The 64 bit address msw-lsw should be a valid, mapped address.
  6135. * 64 bit address should be a multiple of 32 bytes
  6136. */
  6137. u32 buf_addr_msw;
  6138. /* The 64 bit address msw-lsw should be a valid, mapped address.
  6139. * 64 bit address should be a multiple of 32 bytes.
  6140. * -Address of the buffer containing the data to be decoded.
  6141. * The buffer should be aligned to a 32 byte boundary.
  6142. * -In the case of 32 bit Shared memory address, msw field must
  6143. * -be set to zero.
  6144. * -In the case of 36 bit shared memory address, bit 31 to bit 4
  6145. * -of msw must be set to zero.
  6146. */
  6147. u32 mem_map_handle;
  6148. /* memory map handle returned by DSP through
  6149. * ASM_CMD_SHARED_MEM_MAP_REGIONS command
  6150. */
  6151. u32 buf_size;
  6152. /* Number of valid bytes available in the buffer for decoding. The
  6153. * first byte starts at buf_addr.
  6154. */
  6155. u32 seq_id;
  6156. /* Optional buffer sequence ID. */
  6157. u32 timestamp_lsw;
  6158. /* Lower 32 bits of the 64-bit session time in microseconds of the
  6159. * first buffer sample.
  6160. */
  6161. u32 timestamp_msw;
  6162. /* Upper 32 bits of the 64-bit session time in microseconds of the
  6163. * first buffer sample.
  6164. */
  6165. u32 flags;
  6166. /* Bitfield of flags.
  6167. * Supported values for bit 31:
  6168. * - 1 -- Valid timestamp.
  6169. * - 0 -- Invalid timestamp.
  6170. * - Use #ASM_BIT_MASKIMESTAMP_VALID_FLAG as the bitmask and
  6171. * #ASM_SHIFTIMESTAMP_VALID_FLAG as the shift value to set this bit.
  6172. * Supported values for bit 30:
  6173. * - 1 -- Last buffer.
  6174. * - 0 -- Not the last buffer.
  6175. *
  6176. * Supported values for bit 29:
  6177. * - 1 -- Continue the timestamp from the previous buffer.
  6178. * - 0 -- Timestamp of the current buffer is not related
  6179. * to the timestamp of the previous buffer.
  6180. * - Use #ASM_BIT_MASKS_CONTINUE_FLAG and #ASM_SHIFTS_CONTINUE_FLAG
  6181. * to set this bit.
  6182. *
  6183. * Supported values for bit 4:
  6184. * - 1 -- End of the frame.
  6185. * - 0 -- Not the end of frame, or this information is not known.
  6186. * - Use #ASM_BIT_MASK_EOF_FLAG as the bitmask and #ASM_SHIFT_EOF_FLAG
  6187. * as the shift value to set this bit.
  6188. *
  6189. * All other bits are reserved and must be set to 0.
  6190. *
  6191. * If bit 31=0 and bit 29=1: The timestamp of the first sample in
  6192. * this buffer continues from the timestamp of the last sample in
  6193. * the previous buffer. If there is no previous buffer (i.e., this
  6194. * is the first buffer sent after opening the stream or after a
  6195. * flush operation), or if the previous buffer does not have a valid
  6196. * timestamp, the samples in the current buffer also do not have a
  6197. * valid timestamp. They are played out as soon as possible.
  6198. *
  6199. *
  6200. * If bit 31=0 and bit 29=0: No timestamp is associated with the
  6201. * first sample in this buffer. The samples are played out as soon
  6202. * as possible.
  6203. *
  6204. *
  6205. * If bit 31=1 and bit 29 is ignored: The timestamp specified in
  6206. * this payload is honored.
  6207. *
  6208. *
  6209. * If bit 30=0: Not the last buffer in the stream. This is useful
  6210. * in removing trailing samples.
  6211. *
  6212. *
  6213. * For bit 4: The client can set this flag for every buffer sent in
  6214. * which the last byte is the end of a frame. If this flag is set,
  6215. * the buffer can contain data from multiple frames, but it should
  6216. * always end at a frame boundary. Restrictions allow the aDSP to
  6217. * detect an end of frame without requiring additional processing.
  6218. */
  6219. } __packed;
  6220. #define ASM_DATA_CMD_READ_V2 0x00010DAC
  6221. struct asm_data_cmd_read_v2 {
  6222. struct apr_hdr hdr;
  6223. u32 buf_addr_lsw;
  6224. /* the 64 bit address msw-lsw should be a valid mapped address
  6225. * and should be a multiple of 32 bytes
  6226. */
  6227. u32 buf_addr_msw;
  6228. /* the 64 bit address msw-lsw should be a valid mapped address
  6229. * and should be a multiple of 32 bytes.
  6230. * - Address of the buffer where the DSP puts the encoded data,
  6231. * potentially, at an offset specified by the uOffset field in
  6232. * ASM_DATA_EVENT_READ_DONE structure. The buffer should be aligned
  6233. * to a 32 byte boundary.
  6234. * - In the case of 32 bit Shared memory address, msw field must
  6235. * - be set to zero.
  6236. * - In the case of 36 bit shared memory address, bit 31 to bit
  6237. * - 4 of msw must be set to zero.
  6238. */
  6239. u32 mem_map_handle;
  6240. /* memory map handle returned by DSP through
  6241. * ASM_CMD_SHARED_MEM_MAP_REGIONS command.
  6242. */
  6243. u32 buf_size;
  6244. /* Number of bytes available for the aDSP to write. The aDSP
  6245. * starts writing from buf_addr.
  6246. */
  6247. u32 seq_id;
  6248. /* Optional buffer sequence ID. */
  6249. } __packed;
  6250. #define ASM_DATA_CMD_EOS 0x00010BDB
  6251. #define ASM_DATA_EVENT_RENDERED_EOS 0x00010C1C
  6252. #define ASM_DATA_EVENT_EOS 0x00010BDD
  6253. #define ASM_DATA_CMD_EOS_V2 0x00012F3C
  6254. #define ASM_DATA_EVENT_RENDERED_EOS_V2 0x00012F3D
  6255. #define ASM_DATA_EVENT_WRITE_DONE_V2 0x00010D99
  6256. struct asm_data_event_write_done_v2 {
  6257. u32 buf_addr_lsw;
  6258. /* lsw of the 64 bit address */
  6259. u32 buf_addr_msw;
  6260. /* msw of the 64 bit address. address given by the client in
  6261. * ASM_DATA_CMD_WRITE_V2 command.
  6262. */
  6263. u32 mem_map_handle;
  6264. /* memory map handle in the ASM_DATA_CMD_WRITE_V2 */
  6265. u32 status;
  6266. /* Status message (error code) that indicates whether the
  6267. * referenced buffer has been successfully consumed.
  6268. * Supported values: Refer to @xhyperref{Q3,[Q3]}
  6269. */
  6270. } __packed;
  6271. #define ASM_DATA_EVENT_READ_DONE_V2 0x00010D9A
  6272. /* Definition of the frame metadata flag bitmask.*/
  6273. #define ASM_BIT_MASK_FRAME_METADATA_FLAG (0x40000000UL)
  6274. /* Definition of the frame metadata flag shift value. */
  6275. #define ASM_SHIFT_FRAME_METADATA_FLAG 30
  6276. struct asm_data_event_read_done_v2 {
  6277. u32 status;
  6278. /* Status message (error code).
  6279. * Supported values: Refer to @xhyperref{Q3,[Q3]}
  6280. */
  6281. u32 buf_addr_lsw;
  6282. /* 64 bit address msw-lsw is a valid, mapped address. 64 bit
  6283. * address is a multiple of 32 bytes.
  6284. */
  6285. u32 buf_addr_msw;
  6286. /* 64 bit address msw-lsw is a valid, mapped address. 64 bit
  6287. * address is a multiple of 32 bytes.
  6288. *
  6289. * -Same address provided by the client in ASM_DATA_CMD_READ_V2
  6290. * -In the case of 32 bit Shared memory address, msw field is set to
  6291. * zero.
  6292. * -In the case of 36 bit shared memory address, bit 31 to bit 4
  6293. * -of msw is set to zero.
  6294. */
  6295. u32 mem_map_handle;
  6296. /* memory map handle in the ASM_DATA_CMD_READ_V2 */
  6297. u32 enc_framesotal_size;
  6298. /* Total size of the encoded frames in bytes.
  6299. * Supported values: >0
  6300. */
  6301. u32 offset;
  6302. /* Offset (from buf_addr) to the first byte of the first encoded
  6303. * frame. All encoded frames are consecutive, starting from this
  6304. * offset.
  6305. * Supported values: > 0
  6306. */
  6307. u32 timestamp_lsw;
  6308. /* Lower 32 bits of the 64-bit session time in microseconds of
  6309. * the first sample in the buffer. If Bit 5 of mode_flags flag of
  6310. * ASM_STREAM_CMD_OPEN_READ_V2 is 1 then the 64 bit timestamp is
  6311. * absolute capture time otherwise it is relative session time. The
  6312. * absolute timestamp doesn't reset unless the system is reset.
  6313. */
  6314. u32 timestamp_msw;
  6315. /* Upper 32 bits of the 64-bit session time in microseconds of
  6316. * the first sample in the buffer.
  6317. */
  6318. u32 flags;
  6319. /* Bitfield of flags. Bit 30 indicates whether frame metadata is
  6320. * present. If frame metadata is present, num_frames consecutive
  6321. * instances of @xhyperref{hdr:FrameMetaData,Frame metadata} start
  6322. * at the buffer address.
  6323. * Supported values for bit 31:
  6324. * - 1 -- Timestamp is valid.
  6325. * - 0 -- Timestamp is invalid.
  6326. * - Use #ASM_BIT_MASKIMESTAMP_VALID_FLAG and
  6327. * #ASM_SHIFTIMESTAMP_VALID_FLAG to set this bit.
  6328. *
  6329. * Supported values for bit 30:
  6330. * - 1 -- Frame metadata is present.
  6331. * - 0 -- Frame metadata is absent.
  6332. * - Use #ASM_BIT_MASK_FRAME_METADATA_FLAG and
  6333. * #ASM_SHIFT_FRAME_METADATA_FLAG to set this bit.
  6334. *
  6335. * All other bits are reserved; the aDSP sets them to 0.
  6336. */
  6337. u32 num_frames;
  6338. /* Number of encoded frames in the buffer. */
  6339. u32 seq_id;
  6340. /* Optional buffer sequence ID. */
  6341. } __packed;
  6342. struct asm_data_read_buf_metadata_v2 {
  6343. u32 offset;
  6344. /* Offset from buf_addr in #ASM_DATA_EVENT_READ_DONE_PAYLOAD to
  6345. * the frame associated with this metadata.
  6346. * Supported values: > 0
  6347. */
  6348. u32 frm_size;
  6349. /* Size of the encoded frame in bytes.
  6350. * Supported values: > 0
  6351. */
  6352. u32 num_encoded_pcm_samples;
  6353. /* Number of encoded PCM samples (per channel) in the frame
  6354. * associated with this metadata.
  6355. * Supported values: > 0
  6356. */
  6357. u32 timestamp_lsw;
  6358. /* Lower 32 bits of the 64-bit session time in microseconds of the
  6359. * first sample for this frame.
  6360. * If Bit 5 of mode_flags flag of ASM_STREAM_CMD_OPEN_READ_V2 is 1
  6361. * then the 64 bit timestamp is absolute capture time otherwise it
  6362. * is relative session time. The absolute timestamp doesn't reset
  6363. * unless the system is reset.
  6364. */
  6365. u32 timestamp_msw;
  6366. /* Lower 32 bits of the 64-bit session time in microseconds of the
  6367. * first sample for this frame.
  6368. */
  6369. u32 flags;
  6370. /* Frame flags.
  6371. * Supported values for bit 31:
  6372. * - 1 -- Time stamp is valid
  6373. * - 0 -- Time stamp is not valid
  6374. * - All other bits are reserved; the aDSP sets them to 0.
  6375. */
  6376. } __packed;
  6377. /* Notifies the client of a change in the data sampling rate or
  6378. * Channel mode. This event is raised by the decoder service. The
  6379. * event is enabled through the mode flags of
  6380. * #ASM_STREAM_CMD_OPEN_WRITE_V2 or
  6381. * #ASM_STREAM_CMD_OPEN_READWRITE_V2. - The decoder detects a change
  6382. * in the output sampling frequency or the number/positioning of
  6383. * output channels, or if it is the first frame decoded.The new
  6384. * sampling frequency or the new channel configuration is
  6385. * communicated back to the client asynchronously.
  6386. */
  6387. #define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
  6388. /* Payload of the #ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY event.
  6389. * This event is raised when the following conditions are both true:
  6390. * - The event is enabled through the mode_flags of
  6391. * #ASM_STREAM_CMD_OPEN_WRITE_V2 or
  6392. * #ASM_STREAM_CMD_OPEN_READWRITE_V2. - The decoder detects a change
  6393. * in either the output sampling frequency or the number/positioning
  6394. * of output channels, or if it is the first frame decoded.
  6395. * This event is not raised (even if enabled) if the decoder is
  6396. * MIDI, because
  6397. */
  6398. struct asm_data_event_sr_cm_change_notify {
  6399. u32 sample_rate;
  6400. /* New sampling rate (in Hertz) after detecting a change in the
  6401. * bitstream.
  6402. * Supported values: 2000 to 48000
  6403. */
  6404. u16 num_channels;
  6405. /* New number of channels after detecting a change in the
  6406. * bitstream.
  6407. * Supported values: 1 to 8
  6408. */
  6409. u16 reserved;
  6410. /* Reserved for future use. This field must be set to 0.*/
  6411. u8 channel_mapping[8];
  6412. } __packed;
  6413. /* Notifies the client of a data sampling rate or channel mode
  6414. * change. This event is raised by the encoder service.
  6415. * This event is raised when :
  6416. * - Native mode encoding was requested in the encoder
  6417. * configuration (i.e., the channel number was 0), the sample rate
  6418. * was 0, or both were 0.
  6419. *
  6420. * - The input data frame at the encoder is the first one, or the
  6421. * sampling rate/channel mode is different from the previous input
  6422. * data frame.
  6423. *
  6424. */
  6425. #define ASM_DATA_EVENT_ENC_SR_CM_CHANGE_NOTIFY 0x00010BDE
  6426. struct asm_data_event_enc_sr_cm_change_notify {
  6427. u32 sample_rate;
  6428. /* New sampling rate (in Hertz) after detecting a change in the
  6429. * input data.
  6430. * Supported values: 2000 to 48000
  6431. */
  6432. u16 num_channels;
  6433. /* New number of channels after detecting a change in the input
  6434. * data. Supported values: 1 to 8
  6435. */
  6436. u16 bits_per_sample;
  6437. /* New bits per sample after detecting a change in the input
  6438. * data.
  6439. * Supported values: 16, 24
  6440. */
  6441. u8 channel_mapping[8];
  6442. } __packed;
  6443. #define ASM_DATA_CMD_IEC_60958_FRAME_RATE 0x00010D87
  6444. /* Payload of the #ASM_DATA_CMD_IEC_60958_FRAME_RATE command,
  6445. * which is used to indicate the IEC 60958 frame rate of a given
  6446. * packetized audio stream.
  6447. */
  6448. struct asm_data_cmd_iec_60958_frame_rate {
  6449. u32 frame_rate;
  6450. /* IEC 60958 frame rate of the incoming IEC 61937 packetized stream.
  6451. * Supported values: Any valid frame rate
  6452. */
  6453. } __packed;
  6454. /* adsp_asm_data_commands.h*/
  6455. /* Definition of the stream ID bitmask.*/
  6456. #define ASM_BIT_MASK_STREAM_ID (0x000000FFUL)
  6457. /* Definition of the stream ID shift value.*/
  6458. #define ASM_SHIFT_STREAM_ID 0
  6459. /* Definition of the session ID bitmask.*/
  6460. #define ASM_BIT_MASK_SESSION_ID (0x0000FF00UL)
  6461. /* Definition of the session ID shift value.*/
  6462. #define ASM_SHIFT_SESSION_ID 8
  6463. /* Definition of the service ID bitmask.*/
  6464. #define ASM_BIT_MASK_SERVICE_ID (0x00FF0000UL)
  6465. /* Definition of the service ID shift value.*/
  6466. #define ASM_SHIFT_SERVICE_ID 16
  6467. /* Definition of the domain ID bitmask.*/
  6468. #define ASM_BIT_MASK_DOMAIN_ID (0xFF000000UL)
  6469. /* Definition of the domain ID shift value.*/
  6470. #define ASM_SHIFT_DOMAIN_ID 24
  6471. #define ASM_CMD_SHARED_MEM_MAP_REGIONS 0x00010D92
  6472. #define ASM_CMDRSP_SHARED_MEM_MAP_REGIONS 0x00010D93
  6473. #define ASM_CMD_SHARED_MEM_UNMAP_REGIONS 0x00010D94
  6474. /* adsp_asm_service_commands.h */
  6475. #define ASM_MAX_SESSION_ID (15)
  6476. /* Maximum number of sessions.*/
  6477. #define ASM_MAX_NUM_SESSIONS ASM_MAX_SESSION_ID
  6478. /* Maximum number of streams per session.*/
  6479. #define ASM_MAX_STREAMS_PER_SESSION (8)
  6480. #define ASM_SESSION_CMD_RUN_V2 0x00010DAA
  6481. #define ASM_SESSION_CMD_RUN_STARTIME_RUN_IMMEDIATE 0
  6482. #define ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_ABSOLUTEIME 1
  6483. #define ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_RELATIVEIME 2
  6484. #define ASM_SESSION_CMD_RUN_STARTIME_RUN_WITH_DELAY 3
  6485. #define ASM_BIT_MASK_RUN_STARTIME (0x00000003UL)
  6486. /* Bit shift value used to specify the start time for the
  6487. * ASM_SESSION_CMD_RUN_V2 command.
  6488. */
  6489. #define ASM_SHIFT_RUN_STARTIME 0
  6490. struct asm_session_cmd_run_v2 {
  6491. struct apr_hdr hdr;
  6492. u32 flags;
  6493. /* Specifies whether to run immediately or at a specific
  6494. * rendering time or with a specified delay. Run with delay is
  6495. * useful for delaying in case of ASM loopback opened through
  6496. * ASM_STREAM_CMD_OPEN_LOOPBACK_V2. Use #ASM_BIT_MASK_RUN_STARTIME
  6497. * and #ASM_SHIFT_RUN_STARTIME to set this 2-bit flag.
  6498. *
  6499. *
  6500. *Bits 0 and 1 can take one of four possible values:
  6501. *
  6502. *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_IMMEDIATE
  6503. *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_ABSOLUTEIME
  6504. *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_RELATIVEIME
  6505. *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_WITH_DELAY
  6506. *
  6507. *All other bits are reserved; clients must set them to zero.
  6508. */
  6509. u32 time_lsw;
  6510. /* Lower 32 bits of the time in microseconds used to align the
  6511. * session origin time. When bits 0-1 of flags is
  6512. * ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY, time lsw is the lsw of
  6513. * the delay in us. For ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY,
  6514. * maximum value of the 64 bit delay is 150 ms.
  6515. */
  6516. u32 time_msw;
  6517. /* Upper 32 bits of the time in microseconds used to align the
  6518. * session origin time. When bits 0-1 of flags is
  6519. * ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY, time msw is the msw of
  6520. * the delay in us. For ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY,
  6521. * maximum value of the 64 bit delay is 150 ms.
  6522. */
  6523. } __packed;
  6524. #define ASM_SESSION_CMD_PAUSE 0x00010BD3
  6525. #define ASM_SESSION_CMD_SUSPEND 0x00010DEC
  6526. #define ASM_SESSION_CMD_GET_SESSIONTIME_V3 0x00010D9D
  6527. #define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
  6528. struct asm_session_cmd_rgstr_rx_underflow {
  6529. struct apr_hdr hdr;
  6530. u16 enable_flag;
  6531. /* Specifies whether a client is to receive events when an Rx
  6532. * session underflows.
  6533. * Supported values:
  6534. * - 0 -- Do not send underflow events
  6535. * - 1 -- Send underflow events
  6536. */
  6537. u16 reserved;
  6538. /* Reserved. This field must be set to zero.*/
  6539. } __packed;
  6540. #define ASM_SESSION_CMD_REGISTER_FORX_OVERFLOW_EVENTS 0x00010BD6
  6541. struct asm_session_cmd_regx_overflow {
  6542. struct apr_hdr hdr;
  6543. u16 enable_flag;
  6544. /* Specifies whether a client is to receive events when a Tx
  6545. * session overflows.
  6546. * Supported values:
  6547. * - 0 -- Do not send overflow events
  6548. * - 1 -- Send overflow events
  6549. */
  6550. u16 reserved;
  6551. /* Reserved. This field must be set to zero.*/
  6552. } __packed;
  6553. #define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
  6554. #define ASM_SESSION_EVENTX_OVERFLOW 0x00010C18
  6555. #define ASM_SESSION_CMDRSP_GET_SESSIONTIME_V3 0x00010D9E
  6556. struct asm_session_cmdrsp_get_sessiontime_v3 {
  6557. u32 status;
  6558. /* Status message (error code).
  6559. * Supported values: Refer to @xhyperref{Q3,[Q3]}
  6560. */
  6561. u32 sessiontime_lsw;
  6562. /* Lower 32 bits of the current session time in microseconds.*/
  6563. u32 sessiontime_msw;
  6564. /* Upper 32 bits of the current session time in microseconds.*/
  6565. u32 absolutetime_lsw;
  6566. /* Lower 32 bits in micro seconds of the absolute time at which
  6567. * the * sample corresponding to the above session time gets
  6568. * rendered * to hardware. This absolute time may be slightly in the
  6569. * future or past.
  6570. */
  6571. u32 absolutetime_msw;
  6572. /* Upper 32 bits in micro seconds of the absolute time at which
  6573. * the * sample corresponding to the above session time gets
  6574. * rendered to * hardware. This absolute time may be slightly in the
  6575. * future or past.
  6576. */
  6577. } __packed;
  6578. #define ASM_SESSION_CMD_ADJUST_SESSION_CLOCK_V2 0x00010D9F
  6579. struct asm_session_cmd_adjust_session_clock_v2 {
  6580. struct apr_hdr hdr;
  6581. u32 adjustime_lsw;
  6582. /* Lower 32 bits of the signed 64-bit quantity that specifies the
  6583. * adjustment time in microseconds to the session clock.
  6584. *
  6585. * Positive values indicate advancement of the session clock.
  6586. * Negative values indicate delay of the session clock.
  6587. */
  6588. u32 adjustime_msw;
  6589. /* Upper 32 bits of the signed 64-bit quantity that specifies
  6590. * the adjustment time in microseconds to the session clock.
  6591. * Positive values indicate advancement of the session clock.
  6592. * Negative values indicate delay of the session clock.
  6593. */
  6594. } __packed;
  6595. #define ASM_SESSION_CMDRSP_ADJUST_SESSION_CLOCK_V2 0x00010DA0
  6596. struct asm_session_cmdrsp_adjust_session_clock_v2 {
  6597. u32 status;
  6598. /* Status message (error code).
  6599. * Supported values: Refer to @xhyperref{Q3,[Q3]}
  6600. * An error means the session clock is not adjusted. In this case,
  6601. * the next two fields are irrelevant.
  6602. */
  6603. u32 actual_adjustime_lsw;
  6604. /* Lower 32 bits of the signed 64-bit quantity that specifies
  6605. * the actual adjustment in microseconds performed by the aDSP.
  6606. * A positive value indicates advancement of the session clock. A
  6607. * negative value indicates delay of the session clock.
  6608. */
  6609. u32 actual_adjustime_msw;
  6610. /* Upper 32 bits of the signed 64-bit quantity that specifies
  6611. * the actual adjustment in microseconds performed by the aDSP.
  6612. * A positive value indicates advancement of the session clock. A
  6613. * negative value indicates delay of the session clock.
  6614. */
  6615. u32 cmd_latency_lsw;
  6616. /* Lower 32 bits of the unsigned 64-bit quantity that specifies
  6617. * the amount of time in microseconds taken to perform the session
  6618. * clock adjustment.
  6619. */
  6620. u32 cmd_latency_msw;
  6621. /* Upper 32 bits of the unsigned 64-bit quantity that specifies
  6622. * the amount of time in microseconds taken to perform the session
  6623. * clock adjustment.
  6624. */
  6625. } __packed;
  6626. #define ASM_SESSION_CMD_GET_PATH_DELAY_V2 0x00010DAF
  6627. #define ASM_SESSION_CMDRSP_GET_PATH_DELAY_V2 0x00010DB0
  6628. struct asm_session_cmdrsp_get_path_delay_v2 {
  6629. u32 status;
  6630. /* Status message (error code). Whether this get delay operation
  6631. * is successful or not. Delay value is valid only if status is
  6632. * success.
  6633. * Supported values: Refer to @xhyperref{Q5,[Q5]}
  6634. */
  6635. u32 audio_delay_lsw;
  6636. /* Upper 32 bits of the aDSP delay in microseconds. */
  6637. u32 audio_delay_msw;
  6638. /* Lower 32 bits of the aDSP delay in microseconds. */
  6639. } __packed;
  6640. /* adsp_asm_session_command.h*/
  6641. #define ASM_STREAM_CMD_OPEN_WRITE_V3 0x00010DB3
  6642. #define ASM_LOW_LATENCY_STREAM_SESSION 0x10000000
  6643. #define ASM_ULTRA_LOW_LATENCY_STREAM_SESSION 0x20000000
  6644. #define ASM_ULL_POST_PROCESSING_STREAM_SESSION 0x40000000
  6645. #define ASM_LEGACY_STREAM_SESSION 0
  6646. struct asm_stream_cmd_open_write_v3 {
  6647. struct apr_hdr hdr;
  6648. uint32_t mode_flags;
  6649. /* Mode flags that configure the stream to notify the client
  6650. * whenever it detects an SR/CM change at the input to its POPP.
  6651. * Supported values for bits 0 to 1:
  6652. * - Reserved; clients must set them to zero.
  6653. * Supported values for bit 2:
  6654. * - 0 -- SR/CM change notification event is disabled.
  6655. * - 1 -- SR/CM change notification event is enabled.
  6656. * - Use #ASM_BIT_MASK_SR_CM_CHANGE_NOTIFY_FLAG and
  6657. * #ASM_SHIFT_SR_CM_CHANGE_NOTIFY_FLAG to set or get this bit.
  6658. *
  6659. * Supported values for bit 31:
  6660. * - 0 -- Stream to be opened in on-Gapless mode.
  6661. * - 1 -- Stream to be opened in Gapless mode. In Gapless mode,
  6662. * successive streams must be opened with same session ID but
  6663. * different stream IDs.
  6664. *
  6665. * - Use #ASM_BIT_MASK_GAPLESS_MODE_FLAG and
  6666. * #ASM_SHIFT_GAPLESS_MODE_FLAG to set or get this bit.
  6667. *
  6668. *
  6669. * @note1hang MIDI and DTMF streams cannot be opened in Gapless mode.
  6670. */
  6671. uint16_t sink_endpointype;
  6672. /*< Sink point type.
  6673. * Supported values:
  6674. * - 0 -- Device matrix
  6675. * - Other values are reserved.
  6676. *
  6677. * The device matrix is the gateway to the hardware ports.
  6678. */
  6679. uint16_t bits_per_sample;
  6680. /*< Number of bits per sample processed by ASM modules.
  6681. * Supported values: 16 and 24 bits per sample
  6682. */
  6683. uint32_t postprocopo_id;
  6684. /*< Specifies the topology (order of processing) of
  6685. * postprocessing algorithms. <i>None</i> means no postprocessing.
  6686. * Supported values:
  6687. * - #ASM_STREAM_POSTPROCOPO_ID_DEFAULT
  6688. * - #ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL
  6689. * - #ASM_STREAM_POSTPROCOPO_ID_NONE
  6690. *
  6691. * This field can also be enabled through SetParams flags.
  6692. */
  6693. uint32_t dec_fmt_id;
  6694. /*< Configuration ID of the decoder media format.
  6695. *
  6696. * Supported values:
  6697. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6698. * - #ASM_MEDIA_FMT_ADPCM
  6699. * - #ASM_MEDIA_FMT_MP3
  6700. * - #ASM_MEDIA_FMT_AAC_V2
  6701. * - #ASM_MEDIA_FMT_DOLBY_AAC
  6702. * - #ASM_MEDIA_FMT_AMRNB_FS
  6703. * - #ASM_MEDIA_FMT_AMRWB_FS
  6704. * - #ASM_MEDIA_FMT_AMR_WB_PLUS_V2
  6705. * - #ASM_MEDIA_FMT_V13K_FS
  6706. * - #ASM_MEDIA_FMT_EVRC_FS
  6707. * - #ASM_MEDIA_FMT_EVRCB_FS
  6708. * - #ASM_MEDIA_FMT_EVRCWB_FS
  6709. * - #ASM_MEDIA_FMT_SBC
  6710. * - #ASM_MEDIA_FMT_WMA_V10PRO_V2
  6711. * - #ASM_MEDIA_FMT_WMA_V9_V2
  6712. * - #ASM_MEDIA_FMT_AC3
  6713. * - #ASM_MEDIA_FMT_EAC3
  6714. * - #ASM_MEDIA_FMT_G711_ALAW_FS
  6715. * - #ASM_MEDIA_FMT_G711_MLAW_FS
  6716. * - #ASM_MEDIA_FMT_G729A_FS
  6717. * - #ASM_MEDIA_FMT_FR_FS
  6718. * - #ASM_MEDIA_FMT_VORBIS
  6719. * - #ASM_MEDIA_FMT_FLAC
  6720. * - #ASM_MEDIA_FMT_ALAC
  6721. * - #ASM_MEDIA_FMT_APE
  6722. * - #ASM_MEDIA_FMT_EXAMPLE
  6723. */
  6724. } __packed;
  6725. #define ASM_STREAM_CMD_OPEN_PULL_MODE_WRITE 0x00010DD9
  6726. /* Bitmask for the stream_perf_mode subfield. */
  6727. #define ASM_BIT_MASK_STREAM_PERF_FLAG_PULL_MODE_WRITE 0xE0000000UL
  6728. /* Bitmask for the stream_perf_mode subfield. */
  6729. #define ASM_SHIFT_STREAM_PERF_FLAG_PULL_MODE_WRITE 29
  6730. #define ASM_STREAM_CMD_OPEN_PUSH_MODE_READ 0x00010DDA
  6731. #define ASM_BIT_MASK_STREAM_PERF_FLAG_PUSH_MODE_READ 0xE0000000UL
  6732. #define ASM_SHIFT_STREAM_PERF_FLAG_PUSH_MODE_READ 29
  6733. #define ASM_DATA_EVENT_WATERMARK 0x00010DDB
  6734. struct asm_shared_position_buffer {
  6735. volatile uint32_t frame_counter;
  6736. /* Counter used to handle interprocessor synchronization issues.
  6737. * When frame_counter is 0: read_index, wall_clock_us_lsw, and
  6738. * wall_clock_us_msw are invalid.
  6739. * Supported values: >= 0.
  6740. */
  6741. volatile uint32_t index;
  6742. /* Index in bytes from where the aDSP is reading/writing.
  6743. * Supported values: 0 to circular buffer size - 1
  6744. */
  6745. volatile uint32_t wall_clock_us_lsw;
  6746. /* Lower 32 bits of the 64-bit wall clock time in microseconds when the
  6747. * read index was updated.
  6748. * Supported values: >= 0
  6749. */
  6750. volatile uint32_t wall_clock_us_msw;
  6751. /* Upper 32 bits of the 64 bit wall clock time in microseconds when the
  6752. * read index was updated
  6753. * Supported values: >= 0
  6754. */
  6755. } __packed;
  6756. struct asm_shared_watermark_level {
  6757. uint32_t watermark_level_bytes;
  6758. } __packed;
  6759. struct asm_stream_cmd_open_shared_io {
  6760. struct apr_hdr hdr;
  6761. uint32_t mode_flags;
  6762. uint16_t endpoint_type;
  6763. uint16_t topo_bits_per_sample;
  6764. uint32_t topo_id;
  6765. uint32_t fmt_id;
  6766. uint32_t shared_pos_buf_phy_addr_lsw;
  6767. uint32_t shared_pos_buf_phy_addr_msw;
  6768. uint16_t shared_pos_buf_mem_pool_id;
  6769. uint16_t shared_pos_buf_num_regions;
  6770. uint32_t shared_pos_buf_property_flag;
  6771. uint32_t shared_circ_buf_start_phy_addr_lsw;
  6772. uint32_t shared_circ_buf_start_phy_addr_msw;
  6773. uint32_t shared_circ_buf_size;
  6774. uint16_t shared_circ_buf_mem_pool_id;
  6775. uint16_t shared_circ_buf_num_regions;
  6776. uint32_t shared_circ_buf_property_flag;
  6777. uint32_t num_watermark_levels;
  6778. struct asm_multi_channel_pcm_fmt_blk_v3 fmt;
  6779. struct avs_shared_map_region_payload map_region_pos_buf;
  6780. struct avs_shared_map_region_payload map_region_circ_buf;
  6781. struct asm_shared_watermark_level watermark[0];
  6782. } __packed;
  6783. #define ASM_STREAM_CMD_OPEN_READ_V3 0x00010DB4
  6784. /* Definition of the timestamp type flag bitmask */
  6785. #define ASM_BIT_MASKIMESTAMPYPE_FLAG (0x00000020UL)
  6786. /* Definition of the timestamp type flag shift value. */
  6787. #define ASM_SHIFTIMESTAMPYPE_FLAG 5
  6788. /* Relative timestamp is identified by this value.*/
  6789. #define ASM_RELATIVEIMESTAMP 0
  6790. /* Absolute timestamp is identified by this value.*/
  6791. #define ASM_ABSOLUTEIMESTAMP 1
  6792. /* Bit value for Low Latency Tx stream subfield */
  6793. #define ASM_LOW_LATENCY_TX_STREAM_SESSION 1
  6794. /* Bit shift for the stream_perf_mode subfield. */
  6795. #define ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_READ 29
  6796. struct asm_stream_cmd_open_read_v3 {
  6797. struct apr_hdr hdr;
  6798. u32 mode_flags;
  6799. /* Mode flags that indicate whether meta information per encoded
  6800. * frame is to be provided.
  6801. * Supported values for bit 4:
  6802. *
  6803. * - 0 -- Return data buffer contains all encoded frames only; it
  6804. * does not contain frame metadata.
  6805. *
  6806. * - 1 -- Return data buffer contains an array of metadata and
  6807. * encoded frames.
  6808. *
  6809. * - Use #ASM_BIT_MASK_META_INFO_FLAG as the bitmask and
  6810. * #ASM_SHIFT_META_INFO_FLAG as the shift value for this bit.
  6811. *
  6812. *
  6813. * Supported values for bit 5:
  6814. *
  6815. * - ASM_RELATIVEIMESTAMP -- ASM_DATA_EVENT_READ_DONE_V2 will have
  6816. * - relative time-stamp.
  6817. * - ASM_ABSOLUTEIMESTAMP -- ASM_DATA_EVENT_READ_DONE_V2 will
  6818. * - have absolute time-stamp.
  6819. *
  6820. * - Use #ASM_BIT_MASKIMESTAMPYPE_FLAG as the bitmask and
  6821. * #ASM_SHIFTIMESTAMPYPE_FLAG as the shift value for this bit.
  6822. *
  6823. * All other bits are reserved; clients must set them to zero.
  6824. */
  6825. u32 src_endpointype;
  6826. /* Specifies the endpoint providing the input samples.
  6827. * Supported values:
  6828. * - 0 -- Device matrix
  6829. * - All other values are reserved; clients must set them to zero.
  6830. * Otherwise, an error is returned.
  6831. * The device matrix is the gateway from the tunneled Tx ports.
  6832. */
  6833. u32 preprocopo_id;
  6834. /* Specifies the topology (order of processing) of preprocessing
  6835. * algorithms. <i>None</i> means no preprocessing.
  6836. * Supported values:
  6837. * - #ASM_STREAM_PREPROCOPO_ID_DEFAULT
  6838. * - #ASM_STREAM_PREPROCOPO_ID_NONE
  6839. *
  6840. * This field can also be enabled through SetParams flags.
  6841. */
  6842. u32 enc_cfg_id;
  6843. /* Media configuration ID for encoded output.
  6844. * Supported values:
  6845. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6846. * - #ASM_MEDIA_FMT_AAC_V2
  6847. * - #ASM_MEDIA_FMT_AMRNB_FS
  6848. * - #ASM_MEDIA_FMT_AMRWB_FS
  6849. * - #ASM_MEDIA_FMT_V13K_FS
  6850. * - #ASM_MEDIA_FMT_EVRC_FS
  6851. * - #ASM_MEDIA_FMT_EVRCB_FS
  6852. * - #ASM_MEDIA_FMT_EVRCWB_FS
  6853. * - #ASM_MEDIA_FMT_SBC
  6854. * - #ASM_MEDIA_FMT_G711_ALAW_FS
  6855. * - #ASM_MEDIA_FMT_G711_MLAW_FS
  6856. * - #ASM_MEDIA_FMT_G729A_FS
  6857. * - #ASM_MEDIA_FMT_EXAMPLE
  6858. * - #ASM_MEDIA_FMT_WMA_V8
  6859. */
  6860. u16 bits_per_sample;
  6861. /* Number of bits per sample processed by ASM modules.
  6862. * Supported values: 16 and 24 bits per sample
  6863. */
  6864. u16 reserved;
  6865. /* Reserved for future use. This field must be set to zero.*/
  6866. } __packed;
  6867. #define ASM_POPP_OUTPUT_SR_NATIVE_RATE 0
  6868. /* Enumeration for the maximum sampling rate at the POPP output.*/
  6869. #define ASM_POPP_OUTPUT_SR_MAX_RATE 48000
  6870. #define ASM_STREAM_CMD_OPEN_READWRITE_V2 0x00010D8D
  6871. #define ASM_STREAM_CMD_OPEN_READWRITE_V2 0x00010D8D
  6872. struct asm_stream_cmd_open_readwrite_v2 {
  6873. struct apr_hdr hdr;
  6874. u32 mode_flags;
  6875. /* Mode flags.
  6876. * Supported values for bit 2:
  6877. * - 0 -- SR/CM change notification event is disabled.
  6878. * - 1 -- SR/CM change notification event is enabled. Use
  6879. * #ASM_BIT_MASK_SR_CM_CHANGE_NOTIFY_FLAG and
  6880. * #ASM_SHIFT_SR_CM_CHANGE_NOTIFY_FLAG to set or
  6881. * getting this flag.
  6882. *
  6883. * Supported values for bit 4:
  6884. * - 0 -- Return read data buffer contains all encoded frames only; it
  6885. * does not contain frame metadata.
  6886. * - 1 -- Return read data buffer contains an array of metadata and
  6887. * encoded frames.
  6888. *
  6889. * All other bits are reserved; clients must set them to zero.
  6890. */
  6891. u32 postprocopo_id;
  6892. /* Specifies the topology (order of processing) of postprocessing
  6893. * algorithms. <i>None</i> means no postprocessing.
  6894. *
  6895. * Supported values:
  6896. * - #ASM_STREAM_POSTPROCOPO_ID_DEFAULT
  6897. * - #ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL
  6898. * - #ASM_STREAM_POSTPROCOPO_ID_NONE
  6899. */
  6900. u32 dec_fmt_id;
  6901. /* Specifies the media type of the input data. PCM indicates that
  6902. * no decoding must be performed, e.g., this is an NT encoder
  6903. * session.
  6904. * Supported values:
  6905. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6906. * - #ASM_MEDIA_FMT_ADPCM
  6907. * - #ASM_MEDIA_FMT_MP3
  6908. * - #ASM_MEDIA_FMT_AAC_V2
  6909. * - #ASM_MEDIA_FMT_DOLBY_AAC
  6910. * - #ASM_MEDIA_FMT_AMRNB_FS
  6911. * - #ASM_MEDIA_FMT_AMRWB_FS
  6912. * - #ASM_MEDIA_FMT_V13K_FS
  6913. * - #ASM_MEDIA_FMT_EVRC_FS
  6914. * - #ASM_MEDIA_FMT_EVRCB_FS
  6915. * - #ASM_MEDIA_FMT_EVRCWB_FS
  6916. * - #ASM_MEDIA_FMT_SBC
  6917. * - #ASM_MEDIA_FMT_WMA_V10PRO_V2
  6918. * - #ASM_MEDIA_FMT_WMA_V9_V2
  6919. * - #ASM_MEDIA_FMT_AMR_WB_PLUS_V2
  6920. * - #ASM_MEDIA_FMT_AC3
  6921. * - #ASM_MEDIA_FMT_G711_ALAW_FS
  6922. * - #ASM_MEDIA_FMT_G711_MLAW_FS
  6923. * - #ASM_MEDIA_FMT_G729A_FS
  6924. * - #ASM_MEDIA_FMT_EXAMPLE
  6925. */
  6926. u32 enc_cfg_id;
  6927. /* Specifies the media type for the output of the stream. PCM
  6928. * indicates that no encoding must be performed, e.g., this is an NT
  6929. * decoder session.
  6930. * Supported values:
  6931. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6932. * - #ASM_MEDIA_FMT_AAC_V2
  6933. * - #ASM_MEDIA_FMT_AMRNB_FS
  6934. * - #ASM_MEDIA_FMT_AMRWB_FS
  6935. * - #ASM_MEDIA_FMT_V13K_FS
  6936. * - #ASM_MEDIA_FMT_EVRC_FS
  6937. * - #ASM_MEDIA_FMT_EVRCB_FS
  6938. * - #ASM_MEDIA_FMT_EVRCWB_FS
  6939. * - #ASM_MEDIA_FMT_SBC
  6940. * - #ASM_MEDIA_FMT_G711_ALAW_FS
  6941. * - #ASM_MEDIA_FMT_G711_MLAW_FS
  6942. * - #ASM_MEDIA_FMT_G729A_FS
  6943. * - #ASM_MEDIA_FMT_EXAMPLE
  6944. * - #ASM_MEDIA_FMT_WMA_V8
  6945. */
  6946. u16 bits_per_sample;
  6947. /* Number of bits per sample processed by ASM modules.
  6948. * Supported values: 16 and 24 bits per sample
  6949. */
  6950. u16 reserved;
  6951. /* Reserved for future use. This field must be set to zero.*/
  6952. } __packed;
  6953. #define ASM_STREAM_CMD_OPEN_LOOPBACK_V2 0x00010D8E
  6954. struct asm_stream_cmd_open_loopback_v2 {
  6955. struct apr_hdr hdr;
  6956. u32 mode_flags;
  6957. /* Mode flags.
  6958. * Bit 0-31: reserved; client should set these bits to 0
  6959. */
  6960. u16 src_endpointype;
  6961. /* Endpoint type. 0 = Tx Matrix */
  6962. u16 sink_endpointype;
  6963. /* Endpoint type. 0 = Rx Matrix */
  6964. u32 postprocopo_id;
  6965. /* Postprocessor topology ID. Specifies the topology of
  6966. * postprocessing algorithms.
  6967. */
  6968. u16 bits_per_sample;
  6969. /* The number of bits per sample processed by ASM modules
  6970. * Supported values: 16 and 24 bits per sample
  6971. */
  6972. u16 reserved;
  6973. /* Reserved for future use. This field must be set to zero. */
  6974. } __packed;
  6975. #define ASM_STREAM_CMD_OPEN_TRANSCODE_LOOPBACK 0x00010DBA
  6976. /* Bitmask for the stream's Performance mode. */
  6977. #define ASM_BIT_MASK_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK \
  6978. (0x70000000UL)
  6979. /* Bit shift for the stream's Performance mode. */
  6980. #define ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK 28
  6981. /* Bitmask for the decoder converter enable flag. */
  6982. #define ASM_BIT_MASK_DECODER_CONVERTER_FLAG (0x00000078UL)
  6983. /* Shift value for the decoder converter enable flag. */
  6984. #define ASM_SHIFT_DECODER_CONVERTER_FLAG 3
  6985. /* Converter mode is None (Default). */
  6986. #define ASM_CONVERTER_MODE_NONE 0
  6987. /* Converter mode is DDP-to-DD. */
  6988. #define ASM_DDP_DD_CONVERTER_MODE 1
  6989. /* Identifies a special converter mode where source and sink formats
  6990. * are the same but postprocessing must applied. Therefore, Decode
  6991. * @rarrow Re-encode is necessary.
  6992. */
  6993. #define ASM_POST_PROCESS_CONVERTER_MODE 2
  6994. struct asm_stream_cmd_open_transcode_loopback_t {
  6995. struct apr_hdr hdr;
  6996. u32 mode_flags;
  6997. /* Mode Flags specifies the performance mode in which this stream
  6998. * is to be opened.
  6999. * Supported values{for bits 30 to 28}(stream_perf_mode flag)
  7000. *
  7001. * #ASM_LEGACY_STREAM_SESSION -- This mode ensures backward
  7002. * compatibility to the original behavior
  7003. * of ASM_STREAM_CMD_OPEN_TRANSCODE_LOOPBACK
  7004. *
  7005. * #ASM_LOW_LATENCY_STREAM_SESSION -- Opens a loopback session by using
  7006. * shortened buffers in low latency POPP
  7007. * - Recommendation: Do not enable high latency algorithms. They might
  7008. * negate the benefits of opening a low latency stream, and they
  7009. * might also suffer quality degradation from unexpected jitter.
  7010. * - This Low Latency mode is supported only for PCM In and PCM Out
  7011. * loopbacks. An error is returned if Low Latency mode is opened for
  7012. * other transcode loopback modes.
  7013. * - To configure this subfield, use
  7014. * ASM_BIT_MASK_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK and
  7015. * ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK.
  7016. *
  7017. * Supported values{for bits 6 to 3} (decoder-converter compatibility)
  7018. * #ASM_CONVERTER_MODE_NONE (0x0) -- Default
  7019. * #ASM_DDP_DD_CONVERTER_MODE (0x1)
  7020. * #ASM_POST_PROCESS_CONVERTER_MODE (0x2)
  7021. * 0x3-0xF -- Reserved for future use
  7022. * - Use #ASM_BIT_MASK_DECODER_CONVERTER_FLAG and
  7023. * ASM_SHIFT_DECODER_CONVERTER_FLAG to set this bit
  7024. * All other bits are reserved; clients must set them to 0.
  7025. */
  7026. u32 src_format_id;
  7027. /* Specifies the media format of the input audio stream.
  7028. *
  7029. * Supported values
  7030. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  7031. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3
  7032. * - #ASM_MEDIA_FMT_DTS
  7033. * - #ASM_MEDIA_FMT_EAC3_DEC
  7034. * - #ASM_MEDIA_FMT_EAC3
  7035. * - #ASM_MEDIA_FMT_AC3_DEC
  7036. * - #ASM_MEDIA_FMT_AC3
  7037. */
  7038. u32 sink_format_id;
  7039. /* Specifies the media format of the output stream.
  7040. *
  7041. * Supported values
  7042. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  7043. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3
  7044. * - #ASM_MEDIA_FMT_DTS (not supported in Low Latency mode)
  7045. * - #ASM_MEDIA_FMT_EAC3_DEC (not supported in Low Latency mode)
  7046. * - #ASM_MEDIA_FMT_EAC3 (not supported in Low Latency mode)
  7047. * - #ASM_MEDIA_FMT_AC3_DEC (not supported in Low Latency mode)
  7048. * - #ASM_MEDIA_FMT_AC3 (not supported in Low Latency mode)
  7049. */
  7050. u32 audproc_topo_id;
  7051. /* Postprocessing topology ID, which specifies the topology (order of
  7052. * processing) of postprocessing algorithms.
  7053. *
  7054. * Supported values
  7055. * - #ASM_STREAM_POSTPROC_TOPO_ID_DEFAULT
  7056. * - #ASM_STREAM_POSTPROC_TOPO_ID_PEAKMETER
  7057. * - #ASM_STREAM_POSTPROC_TOPO_ID_MCH_PEAK_VOL
  7058. * - #ASM_STREAM_POSTPROC_TOPO_ID_NONE
  7059. * Topologies can be added through #ASM_CMD_ADD_TOPOLOGIES.
  7060. * This field is ignored for the Converter mode, in which no
  7061. * postprocessing is performed.
  7062. */
  7063. u16 src_endpoint_type;
  7064. /* Specifies the source endpoint that provides the input samples.
  7065. *
  7066. * Supported values
  7067. * - 0 -- Tx device matrix or stream router (gateway to the hardware
  7068. * ports)
  7069. * - All other values are reserved
  7070. * Clients must set this field to 0. Otherwise, an error is returned.
  7071. */
  7072. u16 sink_endpoint_type;
  7073. /* Specifies the sink endpoint type.
  7074. *
  7075. * Supported values
  7076. * - 0 -- Rx device matrix or stream router (gateway to the hardware
  7077. * ports)
  7078. * - All other values are reserved
  7079. * Clients must set this field to 0. Otherwise, an error is returned.
  7080. */
  7081. u16 bits_per_sample;
  7082. /* Number of bits per sample processed by the ASM modules.
  7083. * Supported values 16, 24
  7084. */
  7085. u16 reserved;
  7086. /* This field must be set to 0.
  7087. */
  7088. } __packed;
  7089. #define ASM_STREAM_CMD_CLOSE 0x00010BCD
  7090. #define ASM_STREAM_CMD_FLUSH 0x00010BCE
  7091. #define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
  7092. #define ASM_STREAM_CMD_SET_PP_PARAMS_V2 0x00010DA1
  7093. #define ASM_STREAM_CMD_SET_PP_PARAMS_V3 0x0001320D
  7094. /*
  7095. * Structure for the ASM Stream Set PP Params command. Parameter data must be
  7096. * pre-packed with the correct header for either V2 or V3 when sent in-band.
  7097. * Use q6core_pack_pp_params to pack the header and data correctly depending on
  7098. * Instance ID support.
  7099. */
  7100. struct asm_stream_cmd_set_pp_params {
  7101. /* APR Header */
  7102. struct apr_hdr apr_hdr;
  7103. /* The memory mapping header to be used when sending out of band */
  7104. struct mem_mapping_hdr mem_hdr;
  7105. /* The total size of the payload, including the parameter header */
  7106. u32 payload_size;
  7107. /* The parameter data to be filled when sent inband. Parameter data
  7108. * must be pre-packed with parameter header and then copied here. Use
  7109. * q6core_pack_pp_params to pack the header and param data correctly.
  7110. */
  7111. u32 param_data[0];
  7112. } __packed;
  7113. #define ASM_STREAM_CMD_GET_PP_PARAMS_V2 0x00010DA2
  7114. #define ASM_STREAM_CMD_GET_PP_PARAMS_V3 0x0001320E
  7115. struct asm_stream_cmd_get_pp_params_v2 {
  7116. u32 data_payload_addr_lsw;
  7117. /* LSW of the parameter data payload address. */
  7118. u32 data_payload_addr_msw;
  7119. /* MSW of the parameter data payload address.
  7120. * - Size of the shared memory, if specified, shall be large enough
  7121. * to contain the whole ParamData payload, including Module ID,
  7122. * Param ID, Param Size, and Param Values
  7123. * - Must be set to zero for in-band data
  7124. * - In the case of 32 bit Shared memory address, msw field must be
  7125. * set to zero.
  7126. * - In the case of 36 bit shared memory address, bit 31 to bit 4 of
  7127. * msw must be set to zero.
  7128. */
  7129. u32 mem_map_handle;
  7130. /* Supported Values: Any.
  7131. * memory map handle returned by DSP through ASM_CMD_SHARED_MEM_MAP_REGIONS
  7132. * command.
  7133. * if mmhandle is NULL, the ParamData payloads in the ACK are within the
  7134. * message payload (in-band).
  7135. * If mmhandle is non-NULL, the ParamData payloads in the ACK begin at the
  7136. * address specified in the address msw and lsw.
  7137. * (out-of-band).
  7138. */
  7139. u32 module_id;
  7140. /* Unique module ID. */
  7141. u32 param_id;
  7142. /* Unique parameter ID. */
  7143. u16 param_max_size;
  7144. /* Maximum data size of the module_id/param_id combination. This
  7145. * is a multiple of 4 bytes.
  7146. */
  7147. u16 reserved;
  7148. /* Reserved for backward compatibility. Clients must set this
  7149. * field to zero.
  7150. */
  7151. } __packed;
  7152. #define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
  7153. #define ASM_STREAM_CMD_SET_ENCDEC_PARAM_V2 0x00013218
  7154. struct asm_stream_cmd_set_encdec_param_v2 {
  7155. u16 service_id;
  7156. /* 0 - ASM_ENCODER_SVC; 1 - ASM_DECODER_SVC */
  7157. u16 reserved;
  7158. u32 param_id;
  7159. /* ID of the parameter. */
  7160. u32 param_size;
  7161. /*
  7162. * Data size of this parameter, in bytes. The size is a multiple
  7163. * of 4 bytes.
  7164. */
  7165. } __packed;
  7166. #define ASM_STREAM_CMD_REGISTER_ENCDEC_EVENTS 0x00013219
  7167. #define ASM_STREAM_CMD_ENCDEC_EVENTS 0x0001321A
  7168. #define AVS_PARAM_ID_RTIC_SHARED_MEMORY_ADDR 0x00013237
  7169. struct avs_rtic_shared_mem_addr {
  7170. struct apr_hdr hdr;
  7171. struct asm_stream_cmd_set_encdec_param_v2 encdec;
  7172. u32 shm_buf_addr_lsw;
  7173. /* Lower 32 bit of the RTIC shared memory */
  7174. u32 shm_buf_addr_msw;
  7175. /* Upper 32 bit of the RTIC shared memory */
  7176. u32 buf_size;
  7177. /* Size of buffer */
  7178. u16 shm_buf_mem_pool_id;
  7179. /* ADSP_MEMORY_MAP_SHMEM8_4K_POOL */
  7180. u16 shm_buf_num_regions;
  7181. /* number of regions to map */
  7182. u32 shm_buf_flag;
  7183. /* buffer property flag */
  7184. struct avs_shared_map_region_payload map_region;
  7185. /* memory map region*/
  7186. } __packed;
  7187. #define AVS_PARAM_ID_RTIC_EVENT_ACK 0x00013238
  7188. struct avs_param_rtic_event_ack {
  7189. struct apr_hdr hdr;
  7190. struct asm_stream_cmd_set_encdec_param_v2 encdec;
  7191. } __packed;
  7192. #define ASM_PARAM_ID_ENCDEC_BITRATE 0x00010C13
  7193. struct asm_bitrate_param {
  7194. u32 bitrate;
  7195. /* Maximum supported bitrate. Only the AAC encoder is supported.*/
  7196. } __packed;
  7197. #define ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 0x00010DA3
  7198. #define ASM_PARAM_ID_AAC_SBR_PS_FLAG 0x00010C63
  7199. /* Flag to turn off both SBR and PS processing, if they are
  7200. * present in the bitstream.
  7201. */
  7202. #define ASM_AAC_SBR_OFF_PS_OFF (2)
  7203. /* Flag to turn on SBR but turn off PS processing,if they are
  7204. * present in the bitstream.
  7205. */
  7206. #define ASM_AAC_SBR_ON_PS_OFF (1)
  7207. /* Flag to turn on both SBR and PS processing, if they are
  7208. * present in the bitstream (default behavior).
  7209. */
  7210. #define ASM_AAC_SBR_ON_PS_ON (0)
  7211. /* Structure for an AAC SBR PS processing flag. */
  7212. /* Payload of the #ASM_PARAM_ID_AAC_SBR_PS_FLAG parameter in the
  7213. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7214. */
  7215. struct asm_aac_sbr_ps_flag_param {
  7216. struct apr_hdr hdr;
  7217. struct asm_stream_cmd_set_encdec_param encdec;
  7218. struct asm_enc_cfg_blk_param_v2 encblk;
  7219. u32 sbr_ps_flag;
  7220. /* Control parameter to enable or disable SBR/PS processing in
  7221. * the AAC bitstream. Use the following macros to set this field:
  7222. * - #ASM_AAC_SBR_OFF_PS_OFF -- Turn off both SBR and PS
  7223. * processing, if they are present in the bitstream.
  7224. * - #ASM_AAC_SBR_ON_PS_OFF -- Turn on SBR processing, but not PS
  7225. * processing, if they are present in the bitstream.
  7226. * - #ASM_AAC_SBR_ON_PS_ON -- Turn on both SBR and PS processing,
  7227. * if they are present in the bitstream (default behavior).
  7228. * - All other values are invalid.
  7229. * Changes are applied to the next decoded frame.
  7230. */
  7231. } __packed;
  7232. #define ASM_PARAM_ID_AAC_DUAL_MONO_MAPPING 0x00010C64
  7233. /* First single channel element in a dual mono bitstream.*/
  7234. #define ASM_AAC_DUAL_MONO_MAP_SCE_1 (1)
  7235. /* Second single channel element in a dual mono bitstream.*/
  7236. #define ASM_AAC_DUAL_MONO_MAP_SCE_2 (2)
  7237. /* Structure for AAC decoder dual mono channel mapping. */
  7238. struct asm_aac_dual_mono_mapping_param {
  7239. struct apr_hdr hdr;
  7240. struct asm_stream_cmd_set_encdec_param encdec;
  7241. u16 left_channel_sce;
  7242. u16 right_channel_sce;
  7243. } __packed;
  7244. #define ASM_STREAM_CMDRSP_GET_PP_PARAMS_V2 0x00010DA4
  7245. #define ASM_STREAM_CMDRSP_GET_PP_PARAMS_V3 0x0001320F
  7246. struct asm_stream_cmdrsp_get_pp_params_v2 {
  7247. u32 status;
  7248. } __packed;
  7249. #define ASM_PARAM_ID_AC3_KARAOKE_MODE 0x00010D73
  7250. /* Enumeration for both vocals in a karaoke stream.*/
  7251. #define AC3_KARAOKE_MODE_NO_VOCAL (0)
  7252. /* Enumeration for only the left vocal in a karaoke stream.*/
  7253. #define AC3_KARAOKE_MODE_LEFT_VOCAL (1)
  7254. /* Enumeration for only the right vocal in a karaoke stream.*/
  7255. #define AC3_KARAOKE_MODE_RIGHT_VOCAL (2)
  7256. /* Enumeration for both vocal channels in a karaoke stream.*/
  7257. #define AC3_KARAOKE_MODE_BOTH_VOCAL (3)
  7258. #define ASM_PARAM_ID_AC3_DRC_MODE 0x00010D74
  7259. /* Enumeration for the Custom Analog mode.*/
  7260. #define AC3_DRC_MODE_CUSTOM_ANALOG (0)
  7261. /* Enumeration for the Custom Digital mode.*/
  7262. #define AC3_DRC_MODE_CUSTOM_DIGITAL (1)
  7263. /* Enumeration for the Line Out mode (light compression).*/
  7264. #define AC3_DRC_MODE_LINE_OUT (2)
  7265. /* Enumeration for the RF remodulation mode (heavy compression).*/
  7266. #define AC3_DRC_MODE_RF_REMOD (3)
  7267. #define ASM_PARAM_ID_AC3_DUAL_MONO_MODE 0x00010D75
  7268. /* Enumeration for playing dual mono in stereo mode.*/
  7269. #define AC3_DUAL_MONO_MODE_STEREO (0)
  7270. /* Enumeration for playing left mono.*/
  7271. #define AC3_DUAL_MONO_MODE_LEFT_MONO (1)
  7272. /* Enumeration for playing right mono.*/
  7273. #define AC3_DUAL_MONO_MODE_RIGHT_MONO (2)
  7274. /* Enumeration for mixing both dual mono channels and playing them.*/
  7275. #define AC3_DUAL_MONO_MODE_MIXED_MONO (3)
  7276. #define ASM_PARAM_ID_AC3_STEREO_DOWNMIX_MODE 0x00010D76
  7277. /* Enumeration for using the Downmix mode indicated in the bitstream. */
  7278. #define AC3_STEREO_DOWNMIX_MODE_AUTO_DETECT (0)
  7279. /* Enumeration for Surround Compatible mode (preserves the
  7280. * surround information).
  7281. */
  7282. #define AC3_STEREO_DOWNMIX_MODE_LT_RT (1)
  7283. /* Enumeration for Mono Compatible mode (if the output is to be
  7284. * further downmixed to mono).
  7285. */
  7286. #define AC3_STEREO_DOWNMIX_MODE_LO_RO (2)
  7287. /* ID of the AC3 PCM scale factor parameter in the
  7288. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7289. */
  7290. #define ASM_PARAM_ID_AC3_PCM_SCALEFACTOR 0x00010D78
  7291. /* ID of the AC3 DRC boost scale factor parameter in the
  7292. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7293. */
  7294. #define ASM_PARAM_ID_AC3_DRC_BOOST_SCALEFACTOR 0x00010D79
  7295. /* ID of the AC3 DRC cut scale factor parameter in the
  7296. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7297. */
  7298. #define ASM_PARAM_ID_AC3_DRC_CUT_SCALEFACTOR 0x00010D7A
  7299. /* Structure for AC3 Generic Parameter. */
  7300. /* Payload of the AC3 parameters in the
  7301. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7302. */
  7303. struct asm_ac3_generic_param {
  7304. struct apr_hdr hdr;
  7305. struct asm_stream_cmd_set_encdec_param encdec;
  7306. struct asm_enc_cfg_blk_param_v2 encblk;
  7307. u32 generic_parameter;
  7308. /* AC3 generic parameter. Select from one of the following
  7309. * possible values.
  7310. *
  7311. * For #ASM_PARAM_ID_AC3_KARAOKE_MODE, supported values are:
  7312. * - AC3_KARAOKE_MODE_NO_VOCAL
  7313. * - AC3_KARAOKE_MODE_LEFT_VOCAL
  7314. * - AC3_KARAOKE_MODE_RIGHT_VOCAL
  7315. * - AC3_KARAOKE_MODE_BOTH_VOCAL
  7316. *
  7317. * For #ASM_PARAM_ID_AC3_DRC_MODE, supported values are:
  7318. * - AC3_DRC_MODE_CUSTOM_ANALOG
  7319. * - AC3_DRC_MODE_CUSTOM_DIGITAL
  7320. * - AC3_DRC_MODE_LINE_OUT
  7321. * - AC3_DRC_MODE_RF_REMOD
  7322. *
  7323. * For #ASM_PARAM_ID_AC3_DUAL_MONO_MODE, supported values are:
  7324. * - AC3_DUAL_MONO_MODE_STEREO
  7325. * - AC3_DUAL_MONO_MODE_LEFT_MONO
  7326. * - AC3_DUAL_MONO_MODE_RIGHT_MONO
  7327. * - AC3_DUAL_MONO_MODE_MIXED_MONO
  7328. *
  7329. * For #ASM_PARAM_ID_AC3_STEREO_DOWNMIX_MODE, supported values are:
  7330. * - AC3_STEREO_DOWNMIX_MODE_AUTO_DETECT
  7331. * - AC3_STEREO_DOWNMIX_MODE_LT_RT
  7332. * - AC3_STEREO_DOWNMIX_MODE_LO_RO
  7333. *
  7334. * For #ASM_PARAM_ID_AC3_PCM_SCALEFACTOR, supported values are
  7335. * 0 to 1 in Q31 format.
  7336. *
  7337. * For #ASM_PARAM_ID_AC3_DRC_BOOST_SCALEFACTOR, supported values are
  7338. * 0 to 1 in Q31 format.
  7339. *
  7340. * For #ASM_PARAM_ID_AC3_DRC_CUT_SCALEFACTOR, supported values are
  7341. * 0 to 1 in Q31 format.
  7342. */
  7343. } __packed;
  7344. /* Enumeration for Raw mode (no downmixing), which specifies
  7345. * that all channels in the bitstream are to be played out as is
  7346. * without any downmixing. (Default)
  7347. */
  7348. #define WMAPRO_CHANNEL_MASK_RAW (-1)
  7349. /* Enumeration for setting the channel mask to 0. The 7.1 mode
  7350. * (Home Theater) is assigned.
  7351. */
  7352. #define WMAPRO_CHANNEL_MASK_ZERO 0x0000
  7353. /* Speaker layout mask for one channel (Home Theater, mono).
  7354. * - Speaker front center
  7355. */
  7356. #define WMAPRO_CHANNEL_MASK_1_C 0x0004
  7357. /* Speaker layout mask for two channels (Home Theater, stereo).
  7358. * - Speaker front left
  7359. * - Speaker front right
  7360. */
  7361. #define WMAPRO_CHANNEL_MASK_2_L_R 0x0003
  7362. /* Speaker layout mask for three channels (Home Theater).
  7363. * - Speaker front left
  7364. * - Speaker front right
  7365. * - Speaker front center
  7366. */
  7367. #define WMAPRO_CHANNEL_MASK_3_L_C_R 0x0007
  7368. /* Speaker layout mask for two channels (stereo).
  7369. * - Speaker back left
  7370. * - Speaker back right
  7371. */
  7372. #define WMAPRO_CHANNEL_MASK_2_Bl_Br 0x0030
  7373. /* Speaker layout mask for four channels.
  7374. * - Speaker front left
  7375. * - Speaker front right
  7376. * - Speaker back left
  7377. * - Speaker back right
  7378. */
  7379. #define WMAPRO_CHANNEL_MASK_4_L_R_Bl_Br 0x0033
  7380. /* Speaker layout mask for four channels (Home Theater).
  7381. * - Speaker front left
  7382. * - Speaker front right
  7383. * - Speaker front center
  7384. * - Speaker back center
  7385. */
  7386. #define WMAPRO_CHANNEL_MASK_4_L_R_C_Bc_HT 0x0107
  7387. /* Speaker layout mask for five channels.
  7388. * - Speaker front left
  7389. * - Speaker front right
  7390. * - Speaker front center
  7391. * - Speaker back left
  7392. * - Speaker back right
  7393. */
  7394. #define WMAPRO_CHANNEL_MASK_5_L_C_R_Bl_Br 0x0037
  7395. /* Speaker layout mask for five channels (5 mode, Home Theater).
  7396. * - Speaker front left
  7397. * - Speaker front right
  7398. * - Speaker front center
  7399. * - Speaker side left
  7400. * - Speaker side right
  7401. */
  7402. #define WMAPRO_CHANNEL_MASK_5_L_C_R_Sl_Sr_HT 0x0607
  7403. /* Speaker layout mask for six channels (5.1 mode).
  7404. * - Speaker front left
  7405. * - Speaker front right
  7406. * - Speaker front center
  7407. * - Speaker low frequency
  7408. * - Speaker back left
  7409. * - Speaker back right
  7410. */
  7411. #define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Bl_Br_SLF 0x003F
  7412. /* Speaker layout mask for six channels (5.1 mode, Home Theater).
  7413. * - Speaker front left
  7414. * - Speaker front right
  7415. * - Speaker front center
  7416. * - Speaker low frequency
  7417. * - Speaker side left
  7418. * - Speaker side right
  7419. */
  7420. #define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Sl_Sr_SLF_HT 0x060F
  7421. /* Speaker layout mask for six channels (5.1 mode, no LFE).
  7422. * - Speaker front left
  7423. * - Speaker front right
  7424. * - Speaker front center
  7425. * - Speaker back left
  7426. * - Speaker back right
  7427. * - Speaker back center
  7428. */
  7429. #define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Bl_Br_Bc 0x0137
  7430. /* Speaker layout mask for six channels (5.1 mode, Home Theater,
  7431. * no LFE).
  7432. * - Speaker front left
  7433. * - Speaker front right
  7434. * - Speaker front center
  7435. * - Speaker back center
  7436. * - Speaker side left
  7437. * - Speaker side right
  7438. */
  7439. #define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Sl_Sr_Bc_HT 0x0707
  7440. /* Speaker layout mask for seven channels (6.1 mode).
  7441. * - Speaker front left
  7442. * - Speaker front right
  7443. * - Speaker front center
  7444. * - Speaker low frequency
  7445. * - Speaker back left
  7446. * - Speaker back right
  7447. * - Speaker back center
  7448. */
  7449. #define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Bl_Br_Bc_SLF 0x013F
  7450. /* Speaker layout mask for seven channels (6.1 mode, Home
  7451. * Theater).
  7452. * - Speaker front left
  7453. * - Speaker front right
  7454. * - Speaker front center
  7455. * - Speaker low frequency
  7456. * - Speaker back center
  7457. * - Speaker side left
  7458. * - Speaker side right
  7459. */
  7460. #define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Sl_Sr_Bc_SLF_HT 0x070F
  7461. /* Speaker layout mask for seven channels (6.1 mode, no LFE).
  7462. * - Speaker front left
  7463. * - Speaker front right
  7464. * - Speaker front center
  7465. * - Speaker back left
  7466. * - Speaker back right
  7467. * - Speaker front left of center
  7468. * - Speaker front right of center
  7469. */
  7470. #define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Bl_Br_SFLOC_SFROC 0x00F7
  7471. /* Speaker layout mask for seven channels (6.1 mode, Home
  7472. * Theater, no LFE).
  7473. * - Speaker front left
  7474. * - Speaker front right
  7475. * - Speaker front center
  7476. * - Speaker side left
  7477. * - Speaker side right
  7478. * - Speaker front left of center
  7479. * - Speaker front right of center
  7480. */
  7481. #define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Sl_Sr_SFLOC_SFROC_HT 0x0637
  7482. /* Speaker layout mask for eight channels (7.1 mode).
  7483. * - Speaker front left
  7484. * - Speaker front right
  7485. * - Speaker front center
  7486. * - Speaker back left
  7487. * - Speaker back right
  7488. * - Speaker low frequency
  7489. * - Speaker front left of center
  7490. * - Speaker front right of center
  7491. */
  7492. #define WMAPRO_CHANNEL_MASK_7DOT1_L_C_R_Bl_Br_SLF_SFLOC_SFROC \
  7493. 0x00FF
  7494. /* Speaker layout mask for eight channels (7.1 mode, Home Theater).
  7495. * - Speaker front left
  7496. * - Speaker front right
  7497. * - Speaker front center
  7498. * - Speaker side left
  7499. * - Speaker side right
  7500. * - Speaker low frequency
  7501. * - Speaker front left of center
  7502. * - Speaker front right of center
  7503. *
  7504. */
  7505. #define WMAPRO_CHANNEL_MASK_7DOT1_L_C_R_Sl_Sr_SLF_SFLOC_SFROC_HT \
  7506. 0x063F
  7507. #define ASM_PARAM_ID_DEC_OUTPUT_CHAN_MAP 0x00010D82
  7508. /* Maximum number of decoder output channels. */
  7509. #define MAX_CHAN_MAP_CHANNELS 16
  7510. /* Structure for decoder output channel mapping. */
  7511. /* Payload of the #ASM_PARAM_ID_DEC_OUTPUT_CHAN_MAP parameter in the
  7512. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7513. */
  7514. struct asm_dec_out_chan_map_param {
  7515. struct apr_hdr hdr;
  7516. struct asm_stream_cmd_set_encdec_param encdec;
  7517. u32 num_channels;
  7518. /* Number of decoder output channels.
  7519. * Supported values: 0 to #MAX_CHAN_MAP_CHANNELS
  7520. *
  7521. * A value of 0 indicates native channel mapping, which is valid
  7522. * only for NT mode. This means the output of the decoder is to be
  7523. * preserved as is.
  7524. */
  7525. u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];
  7526. } __packed;
  7527. #define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84
  7528. /* Bitmask for the IEC 61937 enable flag.*/
  7529. #define ASM_BIT_MASK_IEC_61937_STREAM_FLAG (0x00000001UL)
  7530. /* Shift value for the IEC 61937 enable flag.*/
  7531. #define ASM_SHIFT_IEC_61937_STREAM_FLAG 0
  7532. /* Bitmask for the IEC 60958 enable flag.*/
  7533. #define ASM_BIT_MASK_IEC_60958_STREAM_FLAG (0x00000002UL)
  7534. /* Shift value for the IEC 60958 enable flag.*/
  7535. #define ASM_SHIFT_IEC_60958_STREAM_FLAG 1
  7536. /* Payload format for open write compressed command */
  7537. /* Payload format for the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED
  7538. * command, which opens a stream for a given session ID and stream ID
  7539. * to be rendered in the compressed format.
  7540. */
  7541. struct asm_stream_cmd_open_write_compressed {
  7542. struct apr_hdr hdr;
  7543. u32 flags;
  7544. /* Mode flags that configure the stream for a specific format.
  7545. * Supported values:
  7546. * - Bit 0 -- IEC 61937 compatibility
  7547. * - 0 -- Stream is not in IEC 61937 format
  7548. * - 1 -- Stream is in IEC 61937 format
  7549. * - Bit 1 -- IEC 60958 compatibility
  7550. * - 0 -- Stream is not in IEC 60958 format
  7551. * - 1 -- Stream is in IEC 60958 format
  7552. * - Bits 2 to 31 -- 0 (Reserved)
  7553. *
  7554. * For the same stream, bit 0 cannot be set to 0 and bit 1 cannot
  7555. * be set to 1. A compressed stream connot have IEC 60958
  7556. * packetization applied without IEC 61937 packetization.
  7557. * @note1hang Currently, IEC 60958 packetized input streams are not
  7558. * supported.
  7559. */
  7560. u32 fmt_id;
  7561. /* Specifies the media type of the HDMI stream to be opened.
  7562. * Supported values:
  7563. * - #ASM_MEDIA_FMT_AC3
  7564. * - #ASM_MEDIA_FMT_EAC3
  7565. * - #ASM_MEDIA_FMT_DTS
  7566. * - #ASM_MEDIA_FMT_ATRAC
  7567. * - #ASM_MEDIA_FMT_MAT
  7568. *
  7569. * @note1hang This field must be set to a valid media type even if
  7570. * IEC 61937 packetization is not performed by the aDSP.
  7571. */
  7572. } __packed;
  7573. /* Indicates the number of samples per channel to be removed from the
  7574. * beginning of the stream.
  7575. */
  7576. #define ASM_DATA_CMD_REMOVE_INITIAL_SILENCE 0x00010D67
  7577. /* Indicates the number of samples per channel to be removed from
  7578. * the end of the stream.
  7579. */
  7580. #define ASM_DATA_CMD_REMOVE_TRAILING_SILENCE 0x00010D68
  7581. struct asm_data_cmd_remove_silence {
  7582. struct apr_hdr hdr;
  7583. u32 num_samples_to_remove;
  7584. /* < Number of samples per channel to be removed.
  7585. * @values 0 to (2@sscr{32}-1)
  7586. */
  7587. } __packed;
  7588. #define ASM_STREAM_CMD_OPEN_READ_COMPRESSED 0x00010D95
  7589. /* Bitmask for the IEC 61937 to 61937 pass-through capture. */
  7590. #define ASM_BIT_MASK_IEC_61937_PASS_THROUGH_FLAG (0x00000001UL)
  7591. /* Shift value for the IEC 61937 to 61937 pass-through capture. */
  7592. #define ASM_SHIFT_IEC_61937_PASS_THROUGH_FLAG 0
  7593. /* Bitmask for the DSD pass-through capture. */
  7594. #define ASM_BIT_MASK_COMPRESSED_FORMAT_FLAG (0x00000003UL)
  7595. /* Shift value for the DSD pass-through capture. */
  7596. #define ASM_SHIFT_DSD_COMPRESSED_FORMAT_FLAG 0
  7597. #define ASM_DSD_FORMAT_FLAG 2
  7598. struct asm_stream_cmd_open_read_compressed {
  7599. struct apr_hdr hdr;
  7600. u32 mode_flags;
  7601. /* Mode flags that indicate whether meta information per encoded
  7602. * frame is to be provided and packaging.
  7603. * Supported values for bit 0: (IEC 61937 pass-through mode)
  7604. * - 0 -- Unpack the IEC 61937 format stream to RAW compressed format
  7605. * - 1 -- Pass-through transfer of the IEC 61937 format stream
  7606. * - Use #ASM_BIT_MASK_IEC_61937_PASS_THROUGH_FLAG to set the bitmask
  7607. * and #ASM_SHIFT_IEC_61937_PASS_THROUGH_FLAG to set the shift value
  7608. * for this bit.
  7609. * Supported values for bit 1: (DSD native pass-through mode)
  7610. * 0 -- non DSD operation
  7611. * 1 -- Pass-through transfer of the DSD format stream
  7612. * To set this bit, use #ASM_BIT_MASK_DSD_PASS_THROUGH_FLAG and
  7613. * use #ASM_SHIFT_DSD_PASS_THROUGH_FLAG to set the shift value for
  7614. * this bit
  7615. * Supported values for bit 4:
  7616. * - 0 -- Return data buffer contains all encoded frames only; it does
  7617. * not contain frame metadata.
  7618. * - 1 -- Return data buffer contains an array of metadata and encoded
  7619. * frames.
  7620. * - Use #ASM_BIT_MASK_META_INFO_FLAG to set the bitmask and
  7621. * #ASM_SHIFT_META_INFO_FLAG to set the shift value for this bit.
  7622. * All other bits are reserved; clients must set them to zero.
  7623. */
  7624. u32 frames_per_buf;
  7625. /* Indicates the number of frames that need to be returned per
  7626. * read buffer
  7627. * Supported values: should be greater than 0 for IEC to RAW compressed
  7628. * unpack mode.
  7629. * Value is don't care for IEC 61937 pass-through mode.
  7630. * @values
  7631. * - >0 -- For IEC 61937-to-RAW Compressed Unpack mode
  7632. * - 1 -- For IEC 61937 or DSD Pass-through mode
  7633. */
  7634. } __packed;
  7635. /* adsp_asm_stream_commands.h*/
  7636. /* adsp_asm_api.h (no changes)*/
  7637. #define ASM_STREAM_POSTPROCOPO_ID_DEFAULT \
  7638. 0x00010BE4
  7639. #define ASM_STREAM_POSTPROCOPO_ID_PEAKMETER \
  7640. 0x00010D83
  7641. #define ASM_STREAM_POSTPROCOPO_ID_NONE \
  7642. 0x00010C68
  7643. #define ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL \
  7644. 0x00010D8B
  7645. #define ASM_STREAM_PREPROCOPO_ID_DEFAULT \
  7646. ASM_STREAM_POSTPROCOPO_ID_DEFAULT
  7647. #define ASM_STREAM_PREPROCOPO_ID_NONE \
  7648. ASM_STREAM_POSTPROCOPO_ID_NONE
  7649. #define ADM_CMD_COPP_OPENOPOLOGY_ID_NONE_AUDIO_COPP \
  7650. 0x00010312
  7651. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MONO_AUDIO_COPP \
  7652. 0x00010313
  7653. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP \
  7654. 0x00010314
  7655. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_IIR_AUDIO_COPP\
  7656. 0x00010704
  7657. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MONO_AUDIO_COPP_MBDRCV2\
  7658. 0x0001070D
  7659. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP_MBDRCV2\
  7660. 0x0001070E
  7661. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_IIR_AUDIO_COPP_MBDRCV2\
  7662. 0x0001070F
  7663. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP_MBDRC_V3 \
  7664. 0x11000000
  7665. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MCH_PEAK_VOL \
  7666. 0x0001031B
  7667. #define ADM_CMD_COPP_OPENOPOLOGY_ID_MIC_MONO_AUDIO_COPP 0x00010315
  7668. #define ADM_CMD_COPP_OPENOPOLOGY_ID_MIC_STEREO_AUDIO_COPP 0x00010316
  7669. #define AUDPROC_COPPOPOLOGY_ID_MCHAN_IIR_AUDIO 0x00010715
  7670. #define ADM_CMD_COPP_OPENOPOLOGY_ID_DEFAULT_AUDIO_COPP 0x00010BE3
  7671. #define ADM_CMD_COPP_OPENOPOLOGY_ID_PEAKMETER_AUDIO_COPP 0x00010317
  7672. #define AUDPROC_MODULE_ID_AIG 0x00010716
  7673. #define AUDPROC_PARAM_ID_AIG_ENABLE 0x00010717
  7674. #define AUDPROC_PARAM_ID_AIG_CONFIG 0x00010718
  7675. struct Audio_AigParam {
  7676. uint16_t mode;
  7677. /*< Mode word for enabling AIG/SIG mode .
  7678. * Byte offset: 0
  7679. */
  7680. int16_t staticGainL16Q12;
  7681. /*< Static input gain when aigMode is set to 1.
  7682. * Byte offset: 2
  7683. */
  7684. int16_t initialGainDBL16Q7;
  7685. /*<Initial value that the adaptive gain update starts from dB
  7686. * Q7 Byte offset: 4
  7687. */
  7688. int16_t idealRMSDBL16Q7;
  7689. /*<Average RMS level that AIG attempts to achieve Q8.7
  7690. * Byte offset: 6
  7691. */
  7692. int32_t noiseGateL32;
  7693. /*Threshold below which signal is considered as noise and AIG
  7694. * Byte offset: 8
  7695. */
  7696. int32_t minGainL32Q15;
  7697. /*Minimum gain that can be provided by AIG Q16.15
  7698. * Byte offset: 12
  7699. */
  7700. int32_t maxGainL32Q15;
  7701. /*Maximum gain that can be provided by AIG Q16.15
  7702. * Byte offset: 16
  7703. */
  7704. uint32_t gainAtRtUL32Q31;
  7705. /*Attack/release time for AIG update Q1.31
  7706. * Byte offset: 20
  7707. */
  7708. uint32_t longGainAtRtUL32Q31;
  7709. /*Long attack/release time while updating gain for
  7710. * noise/silence Q1.31 Byte offset: 24
  7711. */
  7712. uint32_t rmsTavUL32Q32;
  7713. /* RMS smoothing time constant used for long-term RMS estimate
  7714. * Q0.32 Byte offset: 28
  7715. */
  7716. uint32_t gainUpdateStartTimMsUL32Q0;
  7717. /* The waiting time before which AIG starts to apply adaptive
  7718. * gain update Q32.0 Byte offset: 32
  7719. */
  7720. } __packed;
  7721. #define ADM_MODULE_ID_EANS 0x00010C4A
  7722. #define ADM_PARAM_ID_EANS_ENABLE 0x00010C4B
  7723. #define ADM_PARAM_ID_EANS_PARAMS 0x00010C4C
  7724. struct adm_eans_enable {
  7725. uint32_t enable_flag;
  7726. /*< Specifies whether EANS is disabled (0) or enabled
  7727. * (nonzero).
  7728. * This is supported only for sampling rates of 8, 12, 16, 24, 32,
  7729. * and 48 kHz. It is not supported for sampling rates of 11.025,
  7730. * 22.05, or 44.1 kHz.
  7731. */
  7732. } __packed;
  7733. struct adm_eans_params {
  7734. int16_t eans_mode;
  7735. /*< Mode word for enabling/disabling submodules.
  7736. * Byte offset: 0
  7737. */
  7738. int16_t eans_input_gain;
  7739. /*< Q2.13 input gain to the EANS module.
  7740. * Byte offset: 2
  7741. */
  7742. int16_t eans_output_gain;
  7743. /*< Q2.13 output gain to the EANS module.
  7744. * Byte offset: 4
  7745. */
  7746. int16_t eansarget_ns;
  7747. /*< Target noise suppression level in dB.
  7748. * Byte offset: 6
  7749. */
  7750. int16_t eans_s_alpha;
  7751. /*< Q3.12 over-subtraction factor for stationary noise
  7752. * suppression.
  7753. * Byte offset: 8
  7754. */
  7755. int16_t eans_n_alpha;
  7756. /* < Q3.12 over-subtraction factor for nonstationary noise
  7757. * suppression.
  7758. * Byte offset: 10
  7759. */
  7760. int16_t eans_n_alphamax;
  7761. /*< Q3.12 maximum over-subtraction factor for nonstationary
  7762. * noise suppression.
  7763. * Byte offset: 12
  7764. */
  7765. int16_t eans_e_alpha;
  7766. /*< Q15 scaling factor for excess noise suppression.
  7767. * Byte offset: 14
  7768. */
  7769. int16_t eans_ns_snrmax;
  7770. /*< Upper boundary in dB for SNR estimation.
  7771. * Byte offset: 16
  7772. */
  7773. int16_t eans_sns_block;
  7774. /*< Quarter block size for stationary noise suppression.
  7775. * Byte offset: 18
  7776. */
  7777. int16_t eans_ns_i;
  7778. /*< Initialization block size for noise suppression.
  7779. * Byte offset: 20
  7780. */
  7781. int16_t eans_np_scale;
  7782. /*< Power scale factor for nonstationary noise update.
  7783. * Byte offset: 22
  7784. */
  7785. int16_t eans_n_lambda;
  7786. /*< Smoothing factor for higher level nonstationary noise
  7787. * update.
  7788. * Byte offset: 24
  7789. */
  7790. int16_t eans_n_lambdaf;
  7791. /*< Medium averaging factor for noise update.
  7792. * Byte offset: 26
  7793. */
  7794. int16_t eans_gs_bias;
  7795. /*< Bias factor in dB for gain calculation.
  7796. * Byte offset: 28
  7797. */
  7798. int16_t eans_gs_max;
  7799. /*< SNR lower boundary in dB for aggressive gain calculation.
  7800. * Byte offset: 30
  7801. */
  7802. int16_t eans_s_alpha_hb;
  7803. /*< Q3.12 over-subtraction factor for high-band stationary
  7804. * noise suppression.
  7805. * Byte offset: 32
  7806. */
  7807. int16_t eans_n_alphamax_hb;
  7808. /*< Q3.12 maximum over-subtraction factor for high-band
  7809. * nonstationary noise suppression.
  7810. * Byte offset: 34
  7811. */
  7812. int16_t eans_e_alpha_hb;
  7813. /*< Q15 scaling factor for high-band excess noise suppression.
  7814. * Byte offset: 36
  7815. */
  7816. int16_t eans_n_lambda0;
  7817. /*< Smoothing factor for nonstationary noise update during
  7818. * speech activity.
  7819. * Byte offset: 38
  7820. */
  7821. int16_t thresh;
  7822. /*< Threshold for generating a binary VAD decision.
  7823. * Byte offset: 40
  7824. */
  7825. int16_t pwr_scale;
  7826. /*< Indirect lower boundary of the noise level estimate.
  7827. * Byte offset: 42
  7828. */
  7829. int16_t hangover_max;
  7830. /*< Avoids mid-speech clipping and reliably detects weak speech
  7831. * bursts at the end of speech activity.
  7832. * Byte offset: 44
  7833. */
  7834. int16_t alpha_snr;
  7835. /*< Controls responsiveness of the VAD.
  7836. * Byte offset: 46
  7837. */
  7838. int16_t snr_diff_max;
  7839. /*< Maximum SNR difference. Decreasing this parameter value may
  7840. * help in making correct decisions during abrupt changes; however,
  7841. * decreasing too much may increase false alarms during long
  7842. * pauses/silences.
  7843. * Byte offset: 48
  7844. */
  7845. int16_t snr_diff_min;
  7846. /*< Minimum SNR difference. Decreasing this parameter value may
  7847. * help in making correct decisions during abrupt changes; however,
  7848. * decreasing too much may increase false alarms during long
  7849. * pauses/silences.
  7850. * Byte offset: 50
  7851. */
  7852. int16_t init_length;
  7853. /*< Defines the number of frames for which a noise level
  7854. * estimate is set to a fixed value.
  7855. * Byte offset: 52
  7856. */
  7857. int16_t max_val;
  7858. /*< Defines the upper limit of the noise level.
  7859. * Byte offset: 54
  7860. */
  7861. int16_t init_bound;
  7862. /*< Defines the initial bounding value for the noise level
  7863. * estimate. This is used during the initial segment defined by the
  7864. * init_length parameter.
  7865. * Byte offset: 56
  7866. */
  7867. int16_t reset_bound;
  7868. /*< Reset boundary for noise tracking.
  7869. * Byte offset: 58
  7870. */
  7871. int16_t avar_scale;
  7872. /*< Defines the bias factor in noise estimation.
  7873. * Byte offset: 60
  7874. */
  7875. int16_t sub_nc;
  7876. /*< Defines the window length for noise estimation.
  7877. * Byte offset: 62
  7878. */
  7879. int16_t spow_min;
  7880. /*< Defines the minimum signal power required to update the
  7881. * boundaries for the noise floor estimate.
  7882. * Byte offset: 64
  7883. */
  7884. int16_t eans_gs_fast;
  7885. /*< Fast smoothing factor for postprocessor gain.
  7886. * Byte offset: 66
  7887. */
  7888. int16_t eans_gs_med;
  7889. /*< Medium smoothing factor for postprocessor gain.
  7890. * Byte offset: 68
  7891. */
  7892. int16_t eans_gs_slow;
  7893. /*< Slow smoothing factor for postprocessor gain.
  7894. * Byte offset: 70
  7895. */
  7896. int16_t eans_swb_salpha;
  7897. /*< Q3.12 super wideband aggressiveness factor for stationary
  7898. * noise suppression.
  7899. * Byte offset: 72
  7900. */
  7901. int16_t eans_swb_nalpha;
  7902. /*< Q3.12 super wideband aggressiveness factor for
  7903. * nonstationary noise suppression.
  7904. * Byte offset: 74
  7905. */
  7906. } __packed;
  7907. #define ADM_MODULE_IDX_MIC_GAIN_CTRL 0x00010C35
  7908. /* @addtogroup audio_pp_param_ids
  7909. * ID of the Tx mic gain control parameter used by the
  7910. * #ADM_MODULE_IDX_MIC_GAIN_CTRL module.
  7911. * @messagepayload
  7912. * @structure{admx_mic_gain}
  7913. * @tablespace
  7914. * @inputtable{Audio_Postproc_ADM_PARAM_IDX_MIC_GAIN.tex}
  7915. */
  7916. #define ADM_PARAM_IDX_MIC_GAIN 0x00010C36
  7917. /* Structure for a Tx mic gain parameter for the mic gain
  7918. * control module.
  7919. */
  7920. /* @brief Payload of the #ADM_PARAM_IDX_MIC_GAIN parameter in the
  7921. * Tx Mic Gain Control module.
  7922. */
  7923. struct admx_mic_gain {
  7924. uint16_t tx_mic_gain;
  7925. /*< Linear gain in Q13 format. */
  7926. uint16_t reserved;
  7927. /*< Clients must set this field to zero. */
  7928. } __packed;
  7929. /* end_addtogroup audio_pp_param_ids */
  7930. /* @ingroup audio_pp_module_ids
  7931. * ID of the Rx Codec Gain Control module.
  7932. *
  7933. * This module supports the following parameter ID:
  7934. * - #ADM_PARAM_ID_RX_CODEC_GAIN
  7935. */
  7936. #define ADM_MODULE_ID_RX_CODEC_GAIN_CTRL 0x00010C37
  7937. /* @addtogroup audio_pp_param_ids
  7938. * ID of the Rx codec gain control parameter used by the
  7939. * #ADM_MODULE_ID_RX_CODEC_GAIN_CTRL module.
  7940. *
  7941. * @messagepayload
  7942. * @structure{adm_rx_codec_gain}
  7943. * @tablespace
  7944. * @inputtable{Audio_Postproc_ADM_PARAM_ID_RX_CODEC_GAIN.tex}
  7945. */
  7946. #define ADM_PARAM_ID_RX_CODEC_GAIN 0x00010C38
  7947. /* Structure for the Rx common codec gain control module. */
  7948. /* @brief Payload of the #ADM_PARAM_ID_RX_CODEC_GAIN parameter
  7949. * in the Rx Codec Gain Control module.
  7950. */
  7951. struct adm_rx_codec_gain {
  7952. uint16_t rx_codec_gain;
  7953. /* Linear gain in Q13 format. */
  7954. uint16_t reserved;
  7955. /* Clients must set this field to zero.*/
  7956. } __packed;
  7957. /* end_addtogroup audio_pp_param_ids */
  7958. /* @ingroup audio_pp_module_ids
  7959. * ID of the HPF Tuning Filter module on the Tx path.
  7960. * This module supports the following parameter IDs:
  7961. * - #ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG
  7962. * - #ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN
  7963. * - #ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS
  7964. */
  7965. #define ADM_MODULE_ID_HPF_IIRX_FILTER 0x00010C3D
  7966. /* @addtogroup audio_pp_param_ids */
  7967. /* ID of the Tx HPF IIR filter enable parameter used by the
  7968. * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
  7969. * @parspace Message payload
  7970. * @structure{adm_hpfx_iir_filter_enable_cfg}
  7971. * @tablespace
  7972. * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG.tex}
  7973. */
  7974. #define ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG 0x00010C3E
  7975. /* ID of the Tx HPF IIR filter pregain parameter used by the
  7976. * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
  7977. * @parspace Message payload
  7978. * @structure{adm_hpfx_iir_filter_pre_gain}
  7979. * @tablespace
  7980. * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN.tex}
  7981. */
  7982. #define ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN 0x00010C3F
  7983. /* ID of the Tx HPF IIR filter configuration parameters used by the
  7984. * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
  7985. * @parspace Message payload
  7986. * @structure{adm_hpfx_iir_filter_cfg_params}
  7987. * @tablespace
  7988. * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PA
  7989. * RAMS.tex}
  7990. */
  7991. #define ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS 0x00010C40
  7992. /* Structure for enabling a configuration parameter for
  7993. * the HPF IIR tuning filter module on the Tx path.
  7994. */
  7995. /* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG
  7996. * parameter in the Tx path HPF Tuning Filter module.
  7997. */
  7998. struct adm_hpfx_iir_filter_enable_cfg {
  7999. uint32_t enable_flag;
  8000. /* Specifies whether the HPF tuning filter is disabled (0) or
  8001. * enabled (nonzero).
  8002. */
  8003. } __packed;
  8004. /* Structure for the pregain parameter for the HPF
  8005. * IIR tuning filter module on the Tx path.
  8006. */
  8007. /* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN parameter
  8008. * in the Tx path HPF Tuning Filter module.
  8009. */
  8010. struct adm_hpfx_iir_filter_pre_gain {
  8011. uint16_t pre_gain;
  8012. /* Linear gain in Q13 format. */
  8013. uint16_t reserved;
  8014. /* Clients must set this field to zero.*/
  8015. } __packed;
  8016. /* Structure for the configuration parameter for the
  8017. * HPF IIR tuning filter module on the Tx path.
  8018. */
  8019. /* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS
  8020. * parameters in the Tx path HPF Tuning Filter module. \n
  8021. * \n
  8022. * This structure is followed by tuning filter coefficients as follows: \n
  8023. * - Sequence of int32_t FilterCoeffs.
  8024. * Each band has five coefficients, each in int32_t format in the order of
  8025. * b0, b1, b2, a1, a2.
  8026. * - Sequence of int16_t NumShiftFactor.
  8027. * One int16_t per band. The numerator shift factor is related to the Q
  8028. * factor of the filter coefficients.
  8029. * - Sequence of uint16_t PanSetting.
  8030. * One uint16_t for each band to indicate application of the filter to
  8031. * left (0), right (1), or both (2) channels.
  8032. */
  8033. struct adm_hpfx_iir_filter_cfg_params {
  8034. uint16_t num_biquad_stages;
  8035. /*< Number of bands.
  8036. * Supported values: 0 to 20
  8037. */
  8038. uint16_t reserved;
  8039. /*< Clients must set this field to zero.*/
  8040. } __packed;
  8041. /* end_addtogroup audio_pp_module_ids */
  8042. /* @addtogroup audio_pp_module_ids */
  8043. /* ID of the Tx path IIR Tuning Filter module.
  8044. * This module supports the following parameter IDs:
  8045. * - #ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG
  8046. */
  8047. #define ADM_MODULE_IDX_IIR_FILTER 0x00010C41
  8048. /* ID of the Rx path IIR Tuning Filter module for the left channel.
  8049. * The parameter IDs of the IIR tuning filter module
  8050. * (#ASM_MODULE_ID_IIRUNING_FILTER) are used for the left IIR Rx tuning
  8051. * filter.
  8052. *
  8053. * Pan parameters are not required for this per-channel IIR filter; the pan
  8054. * parameters are ignored by this module.
  8055. */
  8056. #define ADM_MODULE_ID_LEFT_IIRUNING_FILTER 0x00010705
  8057. /* ID of the the Rx path IIR Tuning Filter module for the right
  8058. * channel.
  8059. * The parameter IDs of the IIR tuning filter module
  8060. * (#ASM_MODULE_ID_IIRUNING_FILTER) are used for the right IIR Rx
  8061. * tuning filter.
  8062. *
  8063. * Pan parameters are not required for this per-channel IIR filter;
  8064. * the pan parameters are ignored by this module.
  8065. */
  8066. #define ADM_MODULE_ID_RIGHT_IIRUNING_FILTER 0x00010706
  8067. /* end_addtogroup audio_pp_module_ids */
  8068. /* @addtogroup audio_pp_param_ids */
  8069. /* ID of the Tx IIR filter enable parameter used by the
  8070. * #ADM_MODULE_IDX_IIR_FILTER module.
  8071. * @parspace Message payload
  8072. * @structure{admx_iir_filter_enable_cfg}
  8073. * @tablespace
  8074. * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG.tex}
  8075. */
  8076. #define ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG 0x00010C42
  8077. /* ID of the Tx IIR filter pregain parameter used by the
  8078. * #ADM_MODULE_IDX_IIR_FILTER module.
  8079. * @parspace Message payload
  8080. * @structure{admx_iir_filter_pre_gain}
  8081. * @tablespace
  8082. * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN.tex}
  8083. */
  8084. #define ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN 0x00010C43
  8085. /* ID of the Tx IIR filter configuration parameters used by the
  8086. * #ADM_MODULE_IDX_IIR_FILTER module.
  8087. * @parspace Message payload
  8088. * @structure{admx_iir_filter_cfg_params}
  8089. * @tablespace
  8090. * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS.tex}
  8091. */
  8092. #define ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS 0x00010C44
  8093. /* Structure for enabling the configuration parameter for the
  8094. * IIR filter module on the Tx path.
  8095. */
  8096. /* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG
  8097. * parameter in the Tx Path IIR Tuning Filter module.
  8098. */
  8099. struct admx_iir_filter_enable_cfg {
  8100. uint32_t enable_flag;
  8101. /*< Specifies whether the IIR tuning filter is disabled (0) or
  8102. * enabled (nonzero).
  8103. */
  8104. } __packed;
  8105. /* Structure for the pregain parameter for the
  8106. * IIR filter module on the Tx path.
  8107. */
  8108. /* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN
  8109. * parameter in the Tx Path IIR Tuning Filter module.
  8110. */
  8111. struct admx_iir_filter_pre_gain {
  8112. uint16_t pre_gain;
  8113. /*< Linear gain in Q13 format. */
  8114. uint16_t reserved;
  8115. /*< Clients must set this field to zero.*/
  8116. } __packed;
  8117. /* Structure for the configuration parameter for the
  8118. * IIR filter module on the Tx path.
  8119. */
  8120. /* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS
  8121. * parameter in the Tx Path IIR Tuning Filter module. \n
  8122. * \n
  8123. * This structure is followed by the HPF IIR filter coefficients on
  8124. * the Tx path as follows: \n
  8125. * - Sequence of int32_t ulFilterCoeffs. Each band has five
  8126. * coefficients, each in int32_t format in the order of b0, b1, b2,
  8127. * a1, a2.
  8128. * - Sequence of int16_t sNumShiftFactor. One int16_t per band. The
  8129. * numerator shift factor is related to the Q factor of the filter
  8130. * coefficients.
  8131. * - Sequence of uint16_t usPanSetting. One uint16_t for each band
  8132. * to indicate if the filter is applied to left (0), right (1), or
  8133. * both (2) channels.
  8134. */
  8135. struct admx_iir_filter_cfg_params {
  8136. uint16_t num_biquad_stages;
  8137. /*< Number of bands.
  8138. * Supported values: 0 to 20
  8139. */
  8140. uint16_t reserved;
  8141. /*< Clients must set this field to zero.*/
  8142. } __packed;
  8143. /* end_addtogroup audio_pp_module_ids */
  8144. /* @ingroup audio_pp_module_ids
  8145. * ID of the QEnsemble module.
  8146. * This module supports the following parameter IDs:
  8147. * - #ADM_PARAM_ID_QENSEMBLE_ENABLE
  8148. * - #ADM_PARAM_ID_QENSEMBLE_BACKGAIN
  8149. * - #ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE
  8150. */
  8151. #define ADM_MODULE_ID_QENSEMBLE 0x00010C59
  8152. /* @addtogroup audio_pp_param_ids */
  8153. /* ID of the QEnsemble enable parameter used by the
  8154. * #ADM_MODULE_ID_QENSEMBLE module.
  8155. * @messagepayload
  8156. * @structure{adm_qensemble_enable}
  8157. * @tablespace
  8158. * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_ENABLE.tex}
  8159. */
  8160. #define ADM_PARAM_ID_QENSEMBLE_ENABLE 0x00010C60
  8161. /* ID of the QEnsemble back gain parameter used by the
  8162. * #ADM_MODULE_ID_QENSEMBLE module.
  8163. * @messagepayload
  8164. * @structure{adm_qensemble_param_backgain}
  8165. * @tablespace
  8166. * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_BACKGAIN.tex}
  8167. */
  8168. #define ADM_PARAM_ID_QENSEMBLE_BACKGAIN 0x00010C61
  8169. /* ID of the QEnsemble new angle parameter used by the
  8170. * #ADM_MODULE_ID_QENSEMBLE module.
  8171. * @messagepayload
  8172. * @structure{adm_qensemble_param_set_new_angle}
  8173. * @tablespace
  8174. * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE.tex}
  8175. */
  8176. #define ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE 0x00010C62
  8177. /* Structure for enabling the configuration parameter for the
  8178. * QEnsemble module.
  8179. */
  8180. /* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_ENABLE
  8181. * parameter used by the QEnsemble module.
  8182. */
  8183. struct adm_qensemble_enable {
  8184. uint32_t enable_flag;
  8185. /*< Specifies whether the QEnsemble module is disabled (0) or enabled
  8186. * (nonzero).
  8187. */
  8188. } __packed;
  8189. /* Structure for the background gain for the QEnsemble module. */
  8190. /* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_BACKGAIN
  8191. * parameter used by
  8192. * the QEnsemble module.
  8193. */
  8194. struct adm_qensemble_param_backgain {
  8195. int16_t back_gain;
  8196. /*< Linear gain in Q15 format.
  8197. * Supported values: 0 to 32767
  8198. */
  8199. uint16_t reserved;
  8200. /*< Clients must set this field to zero.*/
  8201. } __packed;
  8202. /* Structure for setting a new angle for the QEnsemble module. */
  8203. /* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE
  8204. * parameter used
  8205. * by the QEnsemble module.
  8206. */
  8207. struct adm_qensemble_param_set_new_angle {
  8208. int16_t new_angle;
  8209. /*< New angle in degrees.
  8210. * Supported values: 0 to 359
  8211. */
  8212. int16_t time_ms;
  8213. /*< Transition time in milliseconds to set the new angle.
  8214. * Supported values: 0 to 32767
  8215. */
  8216. } __packed;
  8217. #define ADM_CMD_GET_PP_TOPO_MODULE_LIST 0x00010349
  8218. #define ADM_CMDRSP_GET_PP_TOPO_MODULE_LIST 0x00010350
  8219. #define ADM_CMD_GET_PP_TOPO_MODULE_LIST_V2 0x00010360
  8220. #define ADM_CMDRSP_GET_PP_TOPO_MODULE_LIST_V2 0x00010361
  8221. #define AUDPROC_PARAM_ID_ENABLE 0x00010904
  8222. /*
  8223. * Payload of the ADM_CMD_GET_PP_TOPO_MODULE_LIST command.
  8224. */
  8225. struct adm_cmd_get_pp_topo_module_list {
  8226. struct apr_hdr apr_hdr;
  8227. /* The memory mapping header to be used when requesting out of band */
  8228. struct mem_mapping_hdr mem_hdr;
  8229. /*
  8230. * Maximum data size of the list of modules. This
  8231. * field is a multiple of 4 bytes.
  8232. */
  8233. uint32_t param_max_size;
  8234. } __packed;
  8235. struct audproc_topology_module_id_info_t {
  8236. uint32_t num_modules;
  8237. } __packed;
  8238. /* end_addtogroup audio_pp_module_ids */
  8239. /* @ingroup audio_pp_module_ids
  8240. * ID of the Volume Control module pre/postprocessing block.
  8241. * This module supports the following parameter IDs:
  8242. * - #ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
  8243. * - #ASM_PARAM_ID_MULTICHANNEL_GAIN
  8244. * - #ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG
  8245. * - #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
  8246. * - #ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS
  8247. * - #ASM_PARAM_ID_MULTICHANNEL_GAIN
  8248. * - #ASM_PARAM_ID_MULTICHANNEL_MUTE
  8249. */
  8250. #define ASM_MODULE_ID_VOL_CTRL 0x00010BFE
  8251. #define ASM_MODULE_ID_VOL_CTRL2 0x00010910
  8252. #define AUDPROC_MODULE_ID_VOL_CTRL ASM_MODULE_ID_VOL_CTRL
  8253. /* @addtogroup audio_pp_param_ids */
  8254. /* ID of the master gain parameter used by the #ASM_MODULE_ID_VOL_CTRL
  8255. * module.
  8256. * @messagepayload
  8257. * @structure{asm_volume_ctrl_master_gain}
  8258. * @tablespace
  8259. * @inputtable{Audio_Postproc_ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN.tex}
  8260. */
  8261. #define ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN 0x00010BFF
  8262. #define AUDPROC_PARAM_ID_VOL_CTRL_MASTER_GAIN ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
  8263. /* ID of the left/right channel gain parameter used by the
  8264. * #ASM_MODULE_ID_VOL_CTRL module.
  8265. * @messagepayload
  8266. * @structure{asm_volume_ctrl_lr_chan_gain}
  8267. * @tablespace
  8268. * @inputtable{Audio_Postproc_ASM_PARAM_ID_MULTICHANNEL_GAIN.tex}
  8269. */
  8270. #define ASM_PARAM_ID_VOL_CTRL_LR_CHANNEL_GAIN 0x00010C00
  8271. /* ID of the mute configuration parameter used by the
  8272. * #ASM_MODULE_ID_VOL_CTRL module.
  8273. * @messagepayload
  8274. * @structure{asm_volume_ctrl_mute_config}
  8275. * @tablespace
  8276. * @inputtable{Audio_Postproc_ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG.tex}
  8277. */
  8278. #define ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG 0x00010C01
  8279. /* ID of the soft stepping volume parameters used by the
  8280. * #ASM_MODULE_ID_VOL_CTRL module.
  8281. * @messagepayload
  8282. * @structure{asm_soft_step_volume_params}
  8283. * @tablespace
  8284. * @inputtable{Audio_Postproc_ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMET
  8285. * ERS.tex}
  8286. */
  8287. #define ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS 0x00010C29
  8288. #define AUDPROC_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS\
  8289. ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
  8290. /* ID of the soft pause parameters used by the #ASM_MODULE_ID_VOL_CTRL
  8291. * module.
  8292. */
  8293. #define ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS 0x00010D6A
  8294. /* ID of the multiple-channel volume control parameters used by the
  8295. * #ASM_MODULE_ID_VOL_CTRL module.
  8296. */
  8297. #define ASM_PARAM_ID_MULTICHANNEL_GAIN 0x00010713
  8298. /* ID of the multiple-channel mute configuration parameters used by the
  8299. * #ASM_MODULE_ID_VOL_CTRL module.
  8300. */
  8301. #define ASM_PARAM_ID_MULTICHANNEL_MUTE 0x00010714
  8302. /* Structure for the master gain parameter for a volume control
  8303. * module.
  8304. */
  8305. /* @brief Payload of the #ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
  8306. * parameter used by the Volume Control module.
  8307. */
  8308. struct asm_volume_ctrl_master_gain {
  8309. uint16_t master_gain;
  8310. /* Linear gain in Q13 format. */
  8311. uint16_t reserved;
  8312. /* Clients must set this field to zero. */
  8313. } __packed;
  8314. struct asm_volume_ctrl_lr_chan_gain {
  8315. uint16_t l_chan_gain;
  8316. /*< Linear gain in Q13 format for the left channel. */
  8317. uint16_t r_chan_gain;
  8318. /*< Linear gain in Q13 format for the right channel.*/
  8319. } __packed;
  8320. /* Structure for the mute configuration parameter for a
  8321. * volume control module.
  8322. */
  8323. /* @brief Payload of the #ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG
  8324. * parameter used by the Volume Control module.
  8325. */
  8326. struct asm_volume_ctrl_mute_config {
  8327. uint32_t mute_flag;
  8328. /*< Specifies whether mute is disabled (0) or enabled (nonzero).*/
  8329. } __packed;
  8330. /*
  8331. * Supported parameters for a soft stepping linear ramping curve.
  8332. */
  8333. #define ASM_PARAM_SVC_RAMPINGCURVE_LINEAR 0
  8334. /*
  8335. * Exponential ramping curve.
  8336. */
  8337. #define ASM_PARAM_SVC_RAMPINGCURVE_EXP 1
  8338. /*
  8339. * Logarithmic ramping curve.
  8340. */
  8341. #define ASM_PARAM_SVC_RAMPINGCURVE_LOG 2
  8342. /* Structure for holding soft stepping volume parameters. */
  8343. /* Payload of the #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
  8344. * parameters used by the Volume Control module.
  8345. */
  8346. struct asm_soft_step_volume_params {
  8347. uint32_t period;
  8348. /*< Period in milliseconds.
  8349. * Supported values: 0 to 15000
  8350. */
  8351. uint32_t step;
  8352. /*< Step in microseconds.
  8353. * Supported values: 0 to 15000000
  8354. */
  8355. uint32_t ramping_curve;
  8356. /*< Ramping curve type.
  8357. * Supported values:
  8358. * - #ASM_PARAM_SVC_RAMPINGCURVE_LINEAR
  8359. * - #ASM_PARAM_SVC_RAMPINGCURVE_EXP
  8360. * - #ASM_PARAM_SVC_RAMPINGCURVE_LOG
  8361. */
  8362. } __packed;
  8363. /* Structure for holding soft pause parameters. */
  8364. /* Payload of the #ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS
  8365. * parameters used by the Volume Control module.
  8366. */
  8367. struct asm_soft_pause_params {
  8368. uint32_t enable_flag;
  8369. /*< Specifies whether soft pause is disabled (0) or enabled
  8370. * (nonzero).
  8371. */
  8372. uint32_t period;
  8373. /*< Period in milliseconds.
  8374. * Supported values: 0 to 15000
  8375. */
  8376. uint32_t step;
  8377. /*< Step in microseconds.
  8378. * Supported values: 0 to 15000000
  8379. */
  8380. uint32_t ramping_curve;
  8381. /*< Ramping curve.
  8382. * Supported values:
  8383. * - #ASM_PARAM_SVC_RAMPINGCURVE_LINEAR
  8384. * - #ASM_PARAM_SVC_RAMPINGCURVE_EXP
  8385. * - #ASM_PARAM_SVC_RAMPINGCURVE_LOG
  8386. */
  8387. } __packed;
  8388. /* Maximum number of channels.*/
  8389. #define VOLUME_CONTROL_MAX_CHANNELS 8
  8390. /* Structure for holding one channel type - gain pair. */
  8391. /* Payload of the #ASM_PARAM_ID_MULTICHANNEL_GAIN channel
  8392. * type/gain pairs used by the Volume Control module. \n \n This
  8393. * structure immediately follows the
  8394. * asm_volume_ctrl_multichannel_gain structure.
  8395. */
  8396. struct asm_volume_ctrl_channeltype_gain_pair {
  8397. uint8_t channeltype;
  8398. /*
  8399. * Channel type for which the gain setting is to be applied.
  8400. * Supported values:
  8401. * - #PCM_CHANNEL_L
  8402. * - #PCM_CHANNEL_R
  8403. * - #PCM_CHANNEL_C
  8404. * - #PCM_CHANNEL_LS
  8405. * - #PCM_CHANNEL_RS
  8406. * - #PCM_CHANNEL_LFE
  8407. * - #PCM_CHANNEL_CS
  8408. * - #PCM_CHANNEL_LB
  8409. * - #PCM_CHANNEL_RB
  8410. * - #PCM_CHANNEL_TS
  8411. * - #PCM_CHANNEL_CVH
  8412. * - #PCM_CHANNEL_MS
  8413. * - #PCM_CHANNEL_FLC
  8414. * - #PCM_CHANNEL_FRC
  8415. * - #PCM_CHANNEL_RLC
  8416. * - #PCM_CHANNEL_RRC
  8417. */
  8418. uint8_t reserved1;
  8419. /* Clients must set this field to zero. */
  8420. uint8_t reserved2;
  8421. /* Clients must set this field to zero. */
  8422. uint8_t reserved3;
  8423. /* Clients must set this field to zero. */
  8424. uint32_t gain;
  8425. /*
  8426. * Gain value for this channel in Q28 format.
  8427. * Supported values: Any
  8428. */
  8429. } __packed;
  8430. /* Structure for the multichannel gain command */
  8431. /* Payload of the #ASM_PARAM_ID_MULTICHANNEL_GAIN
  8432. * parameters used by the Volume Control module.
  8433. */
  8434. struct asm_volume_ctrl_multichannel_gain {
  8435. uint32_t num_channels;
  8436. /*
  8437. * Number of channels for which gain values are provided. Any
  8438. * channels present in the data for which gain is not provided are
  8439. * set to unity gain.
  8440. * Supported values: 1 to 8
  8441. */
  8442. struct asm_volume_ctrl_channeltype_gain_pair
  8443. gain_data[VOLUME_CONTROL_MAX_CHANNELS];
  8444. /* Array of channel type/gain pairs.*/
  8445. } __packed;
  8446. /* Structure for holding one channel type - mute pair. */
  8447. /* Payload of the #ASM_PARAM_ID_MULTICHANNEL_MUTE channel
  8448. * type/mute setting pairs used by the Volume Control module. \n \n
  8449. * This structure immediately follows the
  8450. * asm_volume_ctrl_multichannel_mute structure.
  8451. */
  8452. struct asm_volume_ctrl_channelype_mute_pair {
  8453. uint8_t channelype;
  8454. /*< Channel type for which the mute setting is to be applied.
  8455. * Supported values:
  8456. * - #PCM_CHANNEL_L
  8457. * - #PCM_CHANNEL_R
  8458. * - #PCM_CHANNEL_C
  8459. * - #PCM_CHANNEL_LS
  8460. * - #PCM_CHANNEL_RS
  8461. * - #PCM_CHANNEL_LFE
  8462. * - #PCM_CHANNEL_CS
  8463. * - #PCM_CHANNEL_LB
  8464. * - #PCM_CHANNEL_RB
  8465. * - #PCM_CHANNEL_TS
  8466. * - #PCM_CHANNEL_CVH
  8467. * - #PCM_CHANNEL_MS
  8468. * - #PCM_CHANNEL_FLC
  8469. * - #PCM_CHANNEL_FRC
  8470. * - #PCM_CHANNEL_RLC
  8471. * - #PCM_CHANNEL_RRC
  8472. */
  8473. uint8_t reserved1;
  8474. /*< Clients must set this field to zero. */
  8475. uint8_t reserved2;
  8476. /*< Clients must set this field to zero. */
  8477. uint8_t reserved3;
  8478. /*< Clients must set this field to zero. */
  8479. uint32_t mute;
  8480. /*< Mute setting for this channel.
  8481. * Supported values:
  8482. * - 0 = Unmute
  8483. * - Nonzero = Mute
  8484. */
  8485. } __packed;
  8486. /* Structure for the multichannel mute command */
  8487. /* @brief Payload of the #ASM_PARAM_ID_MULTICHANNEL_MUTE
  8488. * parameters used by the Volume Control module.
  8489. */
  8490. struct asm_volume_ctrl_multichannel_mute {
  8491. uint32_t num_channels;
  8492. /*< Number of channels for which mute configuration is
  8493. * provided. Any channels present in the data for which mute
  8494. * configuration is not provided are set to unmute.
  8495. * Supported values: 1 to 8
  8496. */
  8497. struct asm_volume_ctrl_channelype_mute_pair
  8498. mute_data[VOLUME_CONTROL_MAX_CHANNELS];
  8499. /*< Array of channel type/mute setting pairs.*/
  8500. } __packed;
  8501. /* end_addtogroup audio_pp_param_ids */
  8502. /* audio_pp_module_ids
  8503. * ID of the IIR Tuning Filter module.
  8504. * This module supports the following parameter IDs:
  8505. * - #ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG
  8506. * - #ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN
  8507. * - #ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS
  8508. */
  8509. #define ASM_MODULE_ID_IIRUNING_FILTER 0x00010C02
  8510. /* @addtogroup audio_pp_param_ids */
  8511. /* ID of the IIR tuning filter enable parameter used by the
  8512. * #ASM_MODULE_ID_IIRUNING_FILTER module.
  8513. * @messagepayload
  8514. * @structure{asm_iiruning_filter_enable}
  8515. * @tablespace
  8516. * @inputtable{Audio_Postproc_ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CO
  8517. * NFIG.tex}
  8518. */
  8519. #define ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG 0x00010C03
  8520. /* ID of the IIR tuning filter pregain parameter used by the
  8521. * #ASM_MODULE_ID_IIRUNING_FILTER module.
  8522. */
  8523. #define ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN 0x00010C04
  8524. /* ID of the IIR tuning filter configuration parameters used by the
  8525. * #ASM_MODULE_ID_IIRUNING_FILTER module.
  8526. */
  8527. #define ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS 0x00010C05
  8528. /* Structure for an enable configuration parameter for an
  8529. * IIR tuning filter module.
  8530. */
  8531. /* @brief Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG
  8532. * parameter used by the IIR Tuning Filter module.
  8533. */
  8534. struct asm_iiruning_filter_enable {
  8535. uint32_t enable_flag;
  8536. /*< Specifies whether the IIR tuning filter is disabled (0) or
  8537. * enabled (1).
  8538. */
  8539. } __packed;
  8540. /* Structure for the pregain parameter for an IIR tuning filter module. */
  8541. /* Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN
  8542. * parameters used by the IIR Tuning Filter module.
  8543. */
  8544. struct asm_iiruning_filter_pregain {
  8545. uint16_t pregain;
  8546. /*< Linear gain in Q13 format. */
  8547. uint16_t reserved;
  8548. /*< Clients must set this field to zero.*/
  8549. } __packed;
  8550. /* Structure for the configuration parameter for an IIR tuning filter
  8551. * module.
  8552. */
  8553. /* @brief Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS
  8554. * parameters used by the IIR Tuning Filter module. \n
  8555. * \n
  8556. * This structure is followed by the IIR filter coefficients: \n
  8557. * - Sequence of int32_t FilterCoeffs \n
  8558. * Five coefficients for each band. Each coefficient is in int32_t format, in
  8559. * the order of b0, b1, b2, a1, a2.
  8560. * - Sequence of int16_t NumShiftFactor \n
  8561. * One int16_t per band. The numerator shift factor is related to the Q
  8562. * factor of the filter coefficients.
  8563. * - Sequence of uint16_t PanSetting \n
  8564. * One uint16_t per band, indicating if the filter is applied to left (0),
  8565. * right (1), or both (2) channels.
  8566. */
  8567. struct asm_iir_filter_config_params {
  8568. uint16_t num_biquad_stages;
  8569. /*< Number of bands.
  8570. * Supported values: 0 to 20
  8571. */
  8572. uint16_t reserved;
  8573. /*< Clients must set this field to zero.*/
  8574. } __packed;
  8575. /* audio_pp_module_ids
  8576. * ID of the Multiband Dynamic Range Control (MBDRC) module on the Tx/Rx
  8577. * paths.
  8578. * This module supports the following parameter IDs:
  8579. * - #ASM_PARAM_ID_MBDRC_ENABLE
  8580. * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
  8581. */
  8582. #define ASM_MODULE_ID_MBDRC 0x00010C06
  8583. /* audio_pp_param_ids */
  8584. /* ID of the MBDRC enable parameter used by the #ASM_MODULE_ID_MBDRC module.
  8585. * @messagepayload
  8586. * @structure{asm_mbdrc_enable}
  8587. * @tablespace
  8588. * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_ENABLE.tex}
  8589. */
  8590. #define ASM_PARAM_ID_MBDRC_ENABLE 0x00010C07
  8591. /* ID of the MBDRC configuration parameters used by the
  8592. * #ASM_MODULE_ID_MBDRC module.
  8593. * @messagepayload
  8594. * @structure{asm_mbdrc_config_params}
  8595. * @tablespace
  8596. * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_CONFIG_PARAMS.tex}
  8597. *
  8598. * @parspace Sub-band DRC configuration parameters
  8599. * @structure{asm_subband_drc_config_params}
  8600. * @tablespace
  8601. * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_subband_DRC.tex}
  8602. *
  8603. * @keep{6}
  8604. * To obtain legacy ADRC from MBDRC, use the calibration tool to:
  8605. *
  8606. * - Enable MBDRC (EnableFlag = TRUE)
  8607. * - Set number of bands to 1 (uiNumBands = 1)
  8608. * - Enable the first MBDRC band (DrcMode[0] = DRC_ENABLED = 1)
  8609. * - Clear the first band mute flag (MuteFlag[0] = 0)
  8610. * - Set the first band makeup gain to unity (compMakeUpGain[0] = 0x2000)
  8611. * - Use the legacy ADRC parameters to calibrate the rest of the MBDRC
  8612. * parameters.
  8613. */
  8614. #define ASM_PARAM_ID_MBDRC_CONFIG_PARAMS 0x00010C08
  8615. /* end_addtogroup audio_pp_param_ids */
  8616. /* audio_pp_module_ids
  8617. * ID of the MMBDRC module version 2 pre/postprocessing block.
  8618. * This module differs from the original MBDRC (#ASM_MODULE_ID_MBDRC) in
  8619. * the length of the filters used in each sub-band.
  8620. * This module supports the following parameter ID:
  8621. * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_IMPROVED_FILTBANK_V2
  8622. */
  8623. #define ASM_MODULE_ID_MBDRCV2 0x0001070B
  8624. /* @addtogroup audio_pp_param_ids */
  8625. /* ID of the configuration parameters used by the
  8626. * #ASM_MODULE_ID_MBDRCV2 module for the improved filter structure
  8627. * of the MBDRC v2 pre/postprocessing block.
  8628. * The update to this configuration structure from the original
  8629. * MBDRC is the number of filter coefficients in the filter
  8630. * structure. The sequence for is as follows:
  8631. * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
  8632. * - 2 bands = 141 FIR coefficients + 2 mute flags + uint16_t padding
  8633. * - 3 bands = 141+81 FIR coefficients + 3 mute flags + uint16_t padding
  8634. * - 4 bands = 141+81+61 FIR coefficients + 4 mute flags + uint16_t
  8635. * padding
  8636. * - 5 bands = 141+81+61+61 FIR coefficients + 5 mute flags +
  8637. * uint16_t padding
  8638. * This block uses the same parameter structure as
  8639. * #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS.
  8640. */
  8641. #define ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_IMPROVED_FILTBANK_V2 \
  8642. 0x0001070C
  8643. #define ASM_MODULE_ID_MBDRCV3 0x0001090B
  8644. /*
  8645. * ID of the MMBDRC module version 3 pre/postprocessing block.
  8646. * This module differs from MBDRCv2 (#ASM_MODULE_ID_MBDRCV2) in
  8647. * that it supports both 16- and 24-bit data.
  8648. * This module supports the following parameter ID:
  8649. * - #ASM_PARAM_ID_MBDRC_ENABLE
  8650. * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
  8651. * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_V3
  8652. * - #ASM_PARAM_ID_MBDRC_FILTER_XOVER_FREQS
  8653. */
  8654. /* Structure for the enable parameter for an MBDRC module. */
  8655. /* Payload of the #ASM_PARAM_ID_MBDRC_ENABLE parameter used by the
  8656. * MBDRC module.
  8657. */
  8658. struct asm_mbdrc_enable {
  8659. uint32_t enable_flag;
  8660. /*< Specifies whether MBDRC is disabled (0) or enabled (nonzero).*/
  8661. } __packed;
  8662. /* Structure for the configuration parameters for an MBDRC module. */
  8663. /* Payload of the #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
  8664. * parameters used by the MBDRC module. \n \n Following this
  8665. * structure is the payload for sub-band DRC configuration
  8666. * parameters (asm_subband_drc_config_params). This sub-band
  8667. * structure must be repeated for each band.
  8668. */
  8669. struct asm_mbdrc_config_params {
  8670. uint16_t num_bands;
  8671. /*< Number of bands.
  8672. * Supported values: 1 to 5
  8673. */
  8674. int16_t limiterhreshold;
  8675. /*< Threshold in decibels for the limiter output.
  8676. * Supported values: -72 to 18 \n
  8677. * Recommended value: 3994 (-0.22 db in Q3.12 format)
  8678. */
  8679. int16_t limiter_makeup_gain;
  8680. /*< Makeup gain in decibels for the limiter output.
  8681. * Supported values: -42 to 42 \n
  8682. * Recommended value: 256 (0 dB in Q7.8 format)
  8683. */
  8684. int16_t limiter_gc;
  8685. /*< Limiter gain recovery coefficient.
  8686. * Supported values: 0.5 to 0.99 \n
  8687. * Recommended value: 32440 (0.99 in Q15 format)
  8688. */
  8689. int16_t limiter_delay;
  8690. /*< Limiter delay in samples.
  8691. * Supported values: 0 to 10 \n
  8692. * Recommended value: 262 (0.008 samples in Q15 format)
  8693. */
  8694. int16_t limiter_max_wait;
  8695. /*< Maximum limiter waiting time in samples.
  8696. * Supported values: 0 to 10 \n
  8697. * Recommended value: 262 (0.008 samples in Q15 format)
  8698. */
  8699. } __packed;
  8700. /* DRC configuration structure for each sub-band of an MBDRC module. */
  8701. /* Payload of the #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS DRC
  8702. * configuration parameters for each sub-band in the MBDRC module.
  8703. * After this DRC structure is configured for valid bands, the next
  8704. * MBDRC setparams expects the sequence of sub-band MBDRC filter
  8705. * coefficients (the length depends on the number of bands) plus the
  8706. * mute flag for that band plus uint16_t padding.
  8707. *
  8708. * @keep{10}
  8709. * The filter coefficient and mute flag are of type int16_t:
  8710. * - FIR coefficient = int16_t firFilter
  8711. * - Mute flag = int16_t fMuteFlag
  8712. *
  8713. * The sequence is as follows:
  8714. * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
  8715. * - 2 bands = 97 FIR coefficients + 2 mute flags + uint16_t padding
  8716. * - 3 bands = 97+33 FIR coefficients + 3 mute flags + uint16_t padding
  8717. * - 4 bands = 97+33+33 FIR coefficients + 4 mute flags + uint16_t padding
  8718. * - 5 bands = 97+33+33+33 FIR coefficients + 5 mute flags + uint16_t padding
  8719. *
  8720. * For improved filterbank, the sequence is as follows:
  8721. * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
  8722. * - 2 bands = 141 FIR coefficients + 2 mute flags + uint16_t padding
  8723. * - 3 bands = 141+81 FIR coefficients + 3 mute flags + uint16_t padding
  8724. * - 4 bands = 141+81+61 FIR coefficients + 4 mute flags + uint16_t padding
  8725. * - 5 bands = 141+81+61+61 FIR coefficients + 5 mute flags + uint16_t padding
  8726. */
  8727. struct asm_subband_drc_config_params {
  8728. int16_t drc_stereo_linked_flag;
  8729. /*< Specifies whether all stereo channels have the same applied
  8730. * dynamics (1) or if they process their dynamics independently (0).
  8731. * Supported values:
  8732. * - 0 -- Not linked
  8733. * - 1 -- Linked
  8734. */
  8735. int16_t drc_mode;
  8736. /*< Specifies whether DRC mode is bypassed for sub-bands.
  8737. * Supported values:
  8738. * - 0 -- Disabled
  8739. * - 1 -- Enabled
  8740. */
  8741. int16_t drc_down_sample_level;
  8742. /*< DRC down sample level.
  8743. * Supported values: @ge 1
  8744. */
  8745. int16_t drc_delay;
  8746. /*< DRC delay in samples.
  8747. * Supported values: 0 to 1200
  8748. */
  8749. uint16_t drc_rmsime_avg_const;
  8750. /*< RMS signal energy time-averaging constant.
  8751. * Supported values: 0 to 2^16-1
  8752. */
  8753. uint16_t drc_makeup_gain;
  8754. /*< DRC makeup gain in decibels.
  8755. * Supported values: 258 to 64917
  8756. */
  8757. /* Down expander settings */
  8758. int16_t down_expdrhreshold;
  8759. /*< Down expander threshold.
  8760. * Supported Q7 format values: 1320 to up_cmpsrhreshold
  8761. */
  8762. int16_t down_expdr_slope;
  8763. /*< Down expander slope.
  8764. * Supported Q8 format values: -32768 to 0.
  8765. */
  8766. uint32_t down_expdr_attack;
  8767. /*< Down expander attack constant.
  8768. * Supported Q31 format values: 196844 to 2^31.
  8769. */
  8770. uint32_t down_expdr_release;
  8771. /*< Down expander release constant.
  8772. * Supported Q31 format values: 19685 to 2^31
  8773. */
  8774. uint16_t down_expdr_hysteresis;
  8775. /*< Down expander hysteresis constant.
  8776. * Supported Q14 format values: 1 to 32690
  8777. */
  8778. uint16_t reserved;
  8779. /*< Clients must set this field to zero. */
  8780. int32_t down_expdr_min_gain_db;
  8781. /*< Down expander minimum gain.
  8782. * Supported Q23 format values: -805306368 to 0.
  8783. */
  8784. /* Up compressor settings */
  8785. int16_t up_cmpsrhreshold;
  8786. /*< Up compressor threshold.
  8787. * Supported Q7 format values: down_expdrhreshold to
  8788. * down_cmpsrhreshold.
  8789. */
  8790. uint16_t up_cmpsr_slope;
  8791. /*< Up compressor slope.
  8792. * Supported Q16 format values: 0 to 64881.
  8793. */
  8794. uint32_t up_cmpsr_attack;
  8795. /*< Up compressor attack constant.
  8796. * Supported Q31 format values: 196844 to 2^31.
  8797. */
  8798. uint32_t up_cmpsr_release;
  8799. /*< Up compressor release constant.
  8800. * Supported Q31 format values: 19685 to 2^31.
  8801. */
  8802. uint16_t up_cmpsr_hysteresis;
  8803. /*< Up compressor hysteresis constant.
  8804. * Supported Q14 format values: 1 to 32690.
  8805. */
  8806. /* Down compressor settings */
  8807. int16_t down_cmpsrhreshold;
  8808. /*< Down compressor threshold.
  8809. * Supported Q7 format values: up_cmpsrhreshold to 11560.
  8810. */
  8811. uint16_t down_cmpsr_slope;
  8812. /*< Down compressor slope.
  8813. * Supported Q16 format values: 0 to 64881.
  8814. */
  8815. uint16_t reserved1;
  8816. /*< Clients must set this field to zero. */
  8817. uint32_t down_cmpsr_attack;
  8818. /*< Down compressor attack constant.
  8819. * Supported Q31 format values: 196844 to 2^31.
  8820. */
  8821. uint32_t down_cmpsr_release;
  8822. /*< Down compressor release constant.
  8823. * Supported Q31 format values: 19685 to 2^31.
  8824. */
  8825. uint16_t down_cmpsr_hysteresis;
  8826. /*< Down compressor hysteresis constant.
  8827. * Supported Q14 values: 1 to 32690.
  8828. */
  8829. uint16_t reserved2;
  8830. /*< Clients must set this field to zero.*/
  8831. } __packed;
  8832. #define ASM_MODULE_ID_EQUALIZER 0x00010C27
  8833. #define ASM_PARAM_ID_EQUALIZER_PARAMETERS 0x00010C28
  8834. #define ASM_MAX_EQ_BANDS 12
  8835. struct asm_eq_per_band_params {
  8836. uint32_t band_idx;
  8837. /*< Band index.
  8838. * Supported values: 0 to 11
  8839. */
  8840. uint32_t filterype;
  8841. /*< Type of filter.
  8842. * Supported values:
  8843. * - #ASM_PARAM_EQYPE_NONE
  8844. * - #ASM_PARAM_EQ_BASS_BOOST
  8845. * - #ASM_PARAM_EQ_BASS_CUT
  8846. * - #ASM_PARAM_EQREBLE_BOOST
  8847. * - #ASM_PARAM_EQREBLE_CUT
  8848. * - #ASM_PARAM_EQ_BAND_BOOST
  8849. * - #ASM_PARAM_EQ_BAND_CUT
  8850. */
  8851. uint32_t center_freq_hz;
  8852. /*< Filter band center frequency in Hertz. */
  8853. int32_t filter_gain;
  8854. /*< Filter band initial gain.
  8855. * Supported values: +12 to -12 dB in 1 dB increments
  8856. */
  8857. int32_t q_factor;
  8858. /*< Filter band quality factor expressed as a Q8 number, i.e., a
  8859. * fixed-point number with q factor of 8. For example, 3000/(2^8).
  8860. */
  8861. } __packed;
  8862. struct asm_eq_params {
  8863. uint32_t enable_flag;
  8864. /*< Specifies whether the equalizer module is disabled (0) or enabled
  8865. * (nonzero).
  8866. */
  8867. uint32_t num_bands;
  8868. /*< Number of bands.
  8869. * Supported values: 1 to 12
  8870. */
  8871. struct asm_eq_per_band_params eq_bands[ASM_MAX_EQ_BANDS];
  8872. } __packed;
  8873. /* No equalizer effect.*/
  8874. #define ASM_PARAM_EQYPE_NONE 0
  8875. /* Bass boost equalizer effect.*/
  8876. #define ASM_PARAM_EQ_BASS_BOOST 1
  8877. /*Bass cut equalizer effect.*/
  8878. #define ASM_PARAM_EQ_BASS_CUT 2
  8879. /* Treble boost equalizer effect */
  8880. #define ASM_PARAM_EQREBLE_BOOST 3
  8881. /* Treble cut equalizer effect.*/
  8882. #define ASM_PARAM_EQREBLE_CUT 4
  8883. /* Band boost equalizer effect.*/
  8884. #define ASM_PARAM_EQ_BAND_BOOST 5
  8885. /* Band cut equalizer effect.*/
  8886. #define ASM_PARAM_EQ_BAND_CUT 6
  8887. /* Get & set params */
  8888. #define VSS_ICOMMON_CMD_SET_PARAM_V2 0x0001133D
  8889. #define VSS_ICOMMON_CMD_GET_PARAM_V2 0x0001133E
  8890. #define VSS_ICOMMON_RSP_GET_PARAM 0x00011008
  8891. #define VSS_ICOMMON_CMD_SET_PARAM_V3 0x00013245
  8892. #define VSS_ICOMMON_CMD_GET_PARAM_V3 0x00013246
  8893. #define VSS_ICOMMON_RSP_GET_PARAM_V3 0x00013247
  8894. #define VSS_MAX_AVCS_NUM_SERVICES 25
  8895. /* ID of the Bass Boost module.
  8896. * This module supports the following parameter IDs:
  8897. * - #AUDPROC_PARAM_ID_BASS_BOOST_ENABLE
  8898. * - #AUDPROC_PARAM_ID_BASS_BOOST_MODE
  8899. * - #AUDPROC_PARAM_ID_BASS_BOOST_STRENGTH
  8900. */
  8901. #define AUDPROC_MODULE_ID_BASS_BOOST 0x000108A1
  8902. /* ID of the Bass Boost enable parameter used by
  8903. * AUDPROC_MODULE_ID_BASS_BOOST.
  8904. */
  8905. #define AUDPROC_PARAM_ID_BASS_BOOST_ENABLE 0x000108A2
  8906. /* ID of the Bass Boost mode parameter used by
  8907. * AUDPROC_MODULE_ID_BASS_BOOST.
  8908. */
  8909. #define AUDPROC_PARAM_ID_BASS_BOOST_MODE 0x000108A3
  8910. /* ID of the Bass Boost strength parameter used by
  8911. * AUDPROC_MODULE_ID_BASS_BOOST.
  8912. */
  8913. #define AUDPROC_PARAM_ID_BASS_BOOST_STRENGTH 0x000108A4
  8914. /* ID of the PBE module.
  8915. * This module supports the following parameter IDs:
  8916. * - #AUDPROC_PARAM_ID_PBE_ENABLE
  8917. * - #AUDPROC_PARAM_ID_PBE_PARAM_CONFIG
  8918. */
  8919. #define AUDPROC_MODULE_ID_PBE 0x00010C2A
  8920. /* ID of the Bass Boost enable parameter used by
  8921. * AUDPROC_MODULE_ID_BASS_BOOST.
  8922. */
  8923. #define AUDPROC_PARAM_ID_PBE_ENABLE 0x00010C2B
  8924. /* ID of the Bass Boost mode parameter used by
  8925. * AUDPROC_MODULE_ID_BASS_BOOST.
  8926. */
  8927. #define AUDPROC_PARAM_ID_PBE_PARAM_CONFIG 0x00010C49
  8928. /* ID of the Virtualizer module. This module supports the
  8929. * following parameter IDs:
  8930. * - #AUDPROC_PARAM_ID_VIRTUALIZER_ENABLE
  8931. * - #AUDPROC_PARAM_ID_VIRTUALIZER_STRENGTH
  8932. * - #AUDPROC_PARAM_ID_VIRTUALIZER_OUT_TYPE
  8933. * - #AUDPROC_PARAM_ID_VIRTUALIZER_GAIN_ADJUST
  8934. */
  8935. #define AUDPROC_MODULE_ID_VIRTUALIZER 0x000108A5
  8936. /* ID of the Virtualizer enable parameter used by
  8937. * AUDPROC_MODULE_ID_VIRTUALIZER.
  8938. */
  8939. #define AUDPROC_PARAM_ID_VIRTUALIZER_ENABLE 0x000108A6
  8940. /* ID of the Virtualizer strength parameter used by
  8941. * AUDPROC_MODULE_ID_VIRTUALIZER.
  8942. */
  8943. #define AUDPROC_PARAM_ID_VIRTUALIZER_STRENGTH 0x000108A7
  8944. /* ID of the Virtualizer out type parameter used by
  8945. * AUDPROC_MODULE_ID_VIRTUALIZER.
  8946. */
  8947. #define AUDPROC_PARAM_ID_VIRTUALIZER_OUT_TYPE 0x000108A8
  8948. /* ID of the Virtualizer out type parameter used by
  8949. * AUDPROC_MODULE_ID_VIRTUALIZER.
  8950. */
  8951. #define AUDPROC_PARAM_ID_VIRTUALIZER_GAIN_ADJUST 0x000108A9
  8952. /* ID of the Reverb module. This module supports the following
  8953. * parameter IDs:
  8954. * - #AUDPROC_PARAM_ID_REVERB_ENABLE
  8955. * - #AUDPROC_PARAM_ID_REVERB_MODE
  8956. * - #AUDPROC_PARAM_ID_REVERB_PRESET
  8957. * - #AUDPROC_PARAM_ID_REVERB_WET_MIX
  8958. * - #AUDPROC_PARAM_ID_REVERB_GAIN_ADJUST
  8959. * - #AUDPROC_PARAM_ID_REVERB_ROOM_LEVEL
  8960. * - #AUDPROC_PARAM_ID_REVERB_ROOM_HF_LEVEL
  8961. * - #AUDPROC_PARAM_ID_REVERB_DECAY_TIME
  8962. * - #AUDPROC_PARAM_ID_REVERB_DECAY_HF_RATIO
  8963. * - #AUDPROC_PARAM_ID_REVERB_REFLECTIONS_LEVEL
  8964. * - #AUDPROC_PARAM_ID_REVERB_REFLECTIONS_DELAY
  8965. * - #AUDPROC_PARAM_ID_REVERB_LEVEL
  8966. * - #AUDPROC_PARAM_ID_REVERB_DELAY
  8967. * - #AUDPROC_PARAM_ID_REVERB_DIFFUSION
  8968. * - #AUDPROC_PARAM_ID_REVERB_DENSITY
  8969. */
  8970. #define AUDPROC_MODULE_ID_REVERB 0x000108AA
  8971. /* ID of the Reverb enable parameter used by
  8972. * AUDPROC_MODULE_ID_REVERB.
  8973. */
  8974. #define AUDPROC_PARAM_ID_REVERB_ENABLE 0x000108AB
  8975. /* ID of the Reverb mode parameter used by
  8976. * AUDPROC_MODULE_ID_REVERB.
  8977. */
  8978. #define AUDPROC_PARAM_ID_REVERB_MODE 0x000108AC
  8979. /* ID of the Reverb preset parameter used by
  8980. * AUDPROC_MODULE_ID_REVERB.
  8981. */
  8982. #define AUDPROC_PARAM_ID_REVERB_PRESET 0x000108AD
  8983. /* ID of the Reverb wet mix parameter used by
  8984. * AUDPROC_MODULE_ID_REVERB.
  8985. */
  8986. #define AUDPROC_PARAM_ID_REVERB_WET_MIX 0x000108AE
  8987. /* ID of the Reverb gain adjust parameter used by
  8988. * AUDPROC_MODULE_ID_REVERB.
  8989. */
  8990. #define AUDPROC_PARAM_ID_REVERB_GAIN_ADJUST 0x000108AF
  8991. /* ID of the Reverb room level parameter used by
  8992. * AUDPROC_MODULE_ID_REVERB.
  8993. */
  8994. #define AUDPROC_PARAM_ID_REVERB_ROOM_LEVEL 0x000108B0
  8995. /* ID of the Reverb room hf level parameter used by
  8996. * AUDPROC_MODULE_ID_REVERB.
  8997. */
  8998. #define AUDPROC_PARAM_ID_REVERB_ROOM_HF_LEVEL 0x000108B1
  8999. /* ID of the Reverb decay time parameter used by
  9000. * AUDPROC_MODULE_ID_REVERB.
  9001. */
  9002. #define AUDPROC_PARAM_ID_REVERB_DECAY_TIME 0x000108B2
  9003. /* ID of the Reverb decay hf ratio parameter used by
  9004. * AUDPROC_MODULE_ID_REVERB.
  9005. */
  9006. #define AUDPROC_PARAM_ID_REVERB_DECAY_HF_RATIO 0x000108B3
  9007. /* ID of the Reverb reflections level parameter used by
  9008. * AUDPROC_MODULE_ID_REVERB.
  9009. */
  9010. #define AUDPROC_PARAM_ID_REVERB_REFLECTIONS_LEVEL 0x000108B4
  9011. /* ID of the Reverb reflections delay parameter used by
  9012. * AUDPROC_MODULE_ID_REVERB.
  9013. */
  9014. #define AUDPROC_PARAM_ID_REVERB_REFLECTIONS_DELAY 0x000108B5
  9015. /* ID of the Reverb level parameter used by
  9016. * AUDPROC_MODULE_ID_REVERB.
  9017. */
  9018. #define AUDPROC_PARAM_ID_REVERB_LEVEL 0x000108B6
  9019. /* ID of the Reverb delay parameter used by
  9020. * AUDPROC_MODULE_ID_REVERB.
  9021. */
  9022. #define AUDPROC_PARAM_ID_REVERB_DELAY 0x000108B7
  9023. /* ID of the Reverb diffusion parameter used by
  9024. * AUDPROC_MODULE_ID_REVERB.
  9025. */
  9026. #define AUDPROC_PARAM_ID_REVERB_DIFFUSION 0x000108B8
  9027. /* ID of the Reverb density parameter used by
  9028. * AUDPROC_MODULE_ID_REVERB.
  9029. */
  9030. #define AUDPROC_PARAM_ID_REVERB_DENSITY 0x000108B9
  9031. /* ID of the Popless Equalizer module. This module supports the
  9032. * following parameter IDs:
  9033. * - #AUDPROC_PARAM_ID_EQ_ENABLE
  9034. * - #AUDPROC_PARAM_ID_EQ_CONFIG
  9035. * - #AUDPROC_PARAM_ID_EQ_NUM_BANDS
  9036. * - #AUDPROC_PARAM_ID_EQ_BAND_LEVELS
  9037. * - #AUDPROC_PARAM_ID_EQ_BAND_LEVEL_RANGE
  9038. * - #AUDPROC_PARAM_ID_EQ_BAND_FREQS
  9039. * - #AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ_RANGE
  9040. * - #AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ
  9041. * - #AUDPROC_PARAM_ID_EQ_BAND_INDEX
  9042. * - #AUDPROC_PARAM_ID_EQ_PRESET_ID
  9043. * - #AUDPROC_PARAM_ID_EQ_NUM_PRESETS
  9044. * - #AUDPROC_PARAM_ID_EQ_GET_PRESET_NAME
  9045. */
  9046. #define AUDPROC_MODULE_ID_POPLESS_EQUALIZER 0x000108BA
  9047. /* ID of the Popless Equalizer enable parameter used by
  9048. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
  9049. */
  9050. #define AUDPROC_PARAM_ID_EQ_ENABLE 0x000108BB
  9051. /* ID of the Popless Equalizer config parameter used by
  9052. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
  9053. */
  9054. #define AUDPROC_PARAM_ID_EQ_CONFIG 0x000108BC
  9055. /* ID of the Popless Equalizer number of bands parameter used
  9056. * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
  9057. * used for get param only.
  9058. */
  9059. #define AUDPROC_PARAM_ID_EQ_NUM_BANDS 0x000108BD
  9060. /* ID of the Popless Equalizer band levels parameter used by
  9061. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
  9062. * used for get param only.
  9063. */
  9064. #define AUDPROC_PARAM_ID_EQ_BAND_LEVELS 0x000108BE
  9065. /* ID of the Popless Equalizer band level range parameter used
  9066. * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
  9067. * used for get param only.
  9068. */
  9069. #define AUDPROC_PARAM_ID_EQ_BAND_LEVEL_RANGE 0x000108BF
  9070. /* ID of the Popless Equalizer band frequencies parameter used
  9071. * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
  9072. * used for get param only.
  9073. */
  9074. #define AUDPROC_PARAM_ID_EQ_BAND_FREQS 0x000108C0
  9075. /* ID of the Popless Equalizer single band frequency range
  9076. * parameter used by AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
  9077. * This param ID is used for get param only.
  9078. */
  9079. #define AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ_RANGE 0x000108C1
  9080. /* ID of the Popless Equalizer single band frequency parameter
  9081. * used by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID
  9082. * is used for set param only.
  9083. */
  9084. #define AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ 0x000108C2
  9085. /* ID of the Popless Equalizer band index parameter used by
  9086. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
  9087. */
  9088. #define AUDPROC_PARAM_ID_EQ_BAND_INDEX 0x000108C3
  9089. /* ID of the Popless Equalizer preset id parameter used by
  9090. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
  9091. * for get param only.
  9092. */
  9093. #define AUDPROC_PARAM_ID_EQ_PRESET_ID 0x000108C4
  9094. /* ID of the Popless Equalizer number of presets parameter used
  9095. * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
  9096. * for get param only.
  9097. */
  9098. #define AUDPROC_PARAM_ID_EQ_NUM_PRESETS 0x000108C5
  9099. /* ID of the Popless Equalizer preset name parameter used by
  9100. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
  9101. * for get param only.
  9102. */
  9103. #define AUDPROC_PARAM_ID_EQ_PRESET_NAME 0x000108C6
  9104. /* Set Q6 topologies */
  9105. #define ASM_CMD_ADD_TOPOLOGIES 0x00010DBE
  9106. #define ADM_CMD_ADD_TOPOLOGIES 0x00010335
  9107. #define AFE_CMD_ADD_TOPOLOGIES 0x000100f8
  9108. /* structure used for both ioctls */
  9109. struct cmd_set_topologies {
  9110. struct apr_hdr hdr;
  9111. u32 payload_addr_lsw;
  9112. /* LSW of parameter data payload address.*/
  9113. u32 payload_addr_msw;
  9114. /* MSW of parameter data payload address.*/
  9115. u32 mem_map_handle;
  9116. /* Memory map handle returned by mem map command */
  9117. u32 payload_size;
  9118. /* Size in bytes of the variable payload in shared memory */
  9119. } __packed;
  9120. /* This module represents the Rx processing of Feedback speaker protection.
  9121. * It contains the excursion control, thermal protection,
  9122. * analog clip manager features in it.
  9123. * This module id will support following param ids.
  9124. * - AFE_PARAM_ID_FBSP_MODE_RX_CFG
  9125. */
  9126. #define AFE_MODULE_FB_SPKR_PROT_RX 0x0001021C
  9127. #define AFE_MODULE_FB_SPKR_PROT_V2_RX 0x0001025F
  9128. #define AFE_PARAM_ID_SP_RX_LIMITER_TH 0x000102B1
  9129. #define AFE_PARAM_ID_FBSP_MODE_RX_CFG 0x0001021D
  9130. #define AFE_PARAM_ID_FBSP_PTONE_RAMP_CFG 0x00010260
  9131. #define AFE_PARAM_ID_SP_RX_TMAX_XMAX_LOGGING 0x000102BC
  9132. #define AFE_PARAM_ID_CPS_LPASS_HW_INTF_CFG 0x000102EF
  9133. struct asm_fbsp_mode_rx_cfg {
  9134. uint32_t minor_version;
  9135. uint32_t mode;
  9136. } __packed;
  9137. /* This module represents the VI processing of feedback speaker protection.
  9138. * It will receive Vsens and Isens from codec and generates necessary
  9139. * parameters needed by Rx processing.
  9140. * This module id will support following param ids.
  9141. * - AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG
  9142. * - AFE_PARAM_ID_CALIB_RES_CFG
  9143. * - AFE_PARAM_ID_FEEDBACK_PATH_CFG
  9144. */
  9145. #define AFE_MODULE_FB_SPKR_PROT_VI_PROC 0x00010226
  9146. #define AFE_MODULE_FB_SPKR_PROT_VI_PROC_V2 0x0001026A
  9147. #define AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG 0x0001022A
  9148. #define AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG_V2 0x0001026B
  9149. struct asm_spkr_calib_vi_proc_cfg {
  9150. uint32_t minor_version;
  9151. uint32_t operation_mode;
  9152. uint32_t r0_t0_selection_flag[SP_V2_NUM_MAX_SPKR];
  9153. int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
  9154. int16_t t0_cali_q6[SP_V2_NUM_MAX_SPKR];
  9155. uint32_t quick_calib_flag;
  9156. } __packed;
  9157. #define AFE_PARAM_ID_CALIB_RES_CFG 0x0001022B
  9158. #define AFE_PARAM_ID_CALIB_RES_CFG_V2 0x0001026E
  9159. struct asm_calib_res_cfg {
  9160. uint32_t minor_version;
  9161. int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
  9162. uint32_t th_vi_ca_state;
  9163. } __packed;
  9164. #define AFE_PARAM_ID_FEEDBACK_PATH_CFG 0x0001022C
  9165. #define AFE_MODULE_FEEDBACK 0x00010257
  9166. struct asm_feedback_path_cfg {
  9167. uint32_t minor_version;
  9168. int32_t dst_portid;
  9169. int32_t num_channels;
  9170. int32_t chan_info[4];
  9171. } __packed;
  9172. #define AFE_PARAM_ID_MODE_VI_PROC_CFG 0x00010227
  9173. struct asm_mode_vi_proc_cfg {
  9174. uint32_t minor_version;
  9175. uint32_t cal_mode;
  9176. } __packed;
  9177. #define AFE_MODULE_SPEAKER_PROTECTION_V2_TH_VI 0x0001026A
  9178. #define AFE_PARAM_ID_SP_V2_TH_VI_MODE_CFG 0x0001026B
  9179. #define AFE_PARAM_ID_SP_V2_TH_VI_FTM_CFG 0x0001029F
  9180. #define AFE_PARAM_ID_SP_V2_TH_VI_FTM_PARAMS 0x000102A0
  9181. #define AFE_PARAM_ID_SP_V2_TH_VI_V_VALI_CFG 0x000102BF
  9182. #define AFE_PARAM_ID_SP_V2_TH_VI_V_VALI_PARAMS 0x000102C0
  9183. struct afe_sp_th_vi_mode_cfg {
  9184. uint32_t minor_version;
  9185. uint32_t operation_mode;
  9186. /*
  9187. * Operation mode of thermal VI module.
  9188. * 0 -- Normal Running mode
  9189. * 1 -- Calibration mode
  9190. * 2 -- FTM mode
  9191. */
  9192. uint32_t r0t0_selection_flag[SP_V2_NUM_MAX_SPKR];
  9193. /*
  9194. * Specifies which set of R0, T0 values the algorithm will use.
  9195. * This field is valid only in Normal mode (operation_mode = 0).
  9196. * 0 -- Use calibrated R0, T0 value
  9197. * 1 -- Use safe R0, T0 value
  9198. */
  9199. int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
  9200. /*
  9201. * Calibration point resistance per device. This field is valid
  9202. * only in Normal mode (operation_mode = 0).
  9203. * values 33554432 to 1073741824 Ohms (in Q24 format)
  9204. */
  9205. int16_t t0_cali_q6[SP_V2_NUM_MAX_SPKR];
  9206. /*
  9207. * Calibration point temperature per device. This field is valid
  9208. * in both Normal mode and Calibration mode.
  9209. * values -1920 to 5120 degrees C (in Q6 format)
  9210. */
  9211. uint32_t quick_calib_flag;
  9212. /*
  9213. * Indicates whether calibration is to be done in quick mode or not.
  9214. * This field is valid only in Calibration mode (operation_mode = 1).
  9215. * 0 -- Disabled
  9216. * 1 -- Enabled
  9217. */
  9218. } __packed;
  9219. struct afe_sp_th_vi_ftm_cfg {
  9220. uint32_t minor_version;
  9221. uint32_t wait_time_ms[SP_V2_NUM_MAX_SPKR];
  9222. /*
  9223. * Wait time to heat up speaker before collecting statistics
  9224. * for ftm mode in ms.
  9225. * values 0 to 4294967295 ms
  9226. */
  9227. uint32_t ftm_time_ms[SP_V2_NUM_MAX_SPKR];
  9228. /*
  9229. * duration for which FTM statistics are collected in ms.
  9230. * values 0 to 2000 ms
  9231. */
  9232. } __packed;
  9233. struct afe_sp_th_vi_ftm_params {
  9234. uint32_t minor_version;
  9235. int32_t dc_res_q24[SP_V2_NUM_MAX_SPKR];
  9236. /*
  9237. * DC resistance value in q24 format
  9238. * values 0 to 2147483647 Ohms (in Q24 format)
  9239. */
  9240. int32_t temp_q22[SP_V2_NUM_MAX_SPKR];
  9241. /*
  9242. * temperature value in q22 format
  9243. * values -125829120 to 2147483647 degC (in Q22 format)
  9244. */
  9245. uint32_t status[SP_V2_NUM_MAX_SPKR];
  9246. /*
  9247. * FTM packet status
  9248. * 0 - Incorrect operation mode.This status is returned
  9249. * when GET_PARAM is called in non FTM Mode
  9250. * 1 - Inactive mode -- Port is not yet started.
  9251. * 2 - Wait state. wait_time_ms has not yet elapsed
  9252. * 3 - In progress state. ftm_time_ms has not yet elapsed.
  9253. * 4 - Success.
  9254. * 5 - Failed.
  9255. */
  9256. } __packed;
  9257. struct afe_sp_th_vi_get_param {
  9258. struct param_hdr_v3 pdata;
  9259. struct afe_sp_th_vi_ftm_params param;
  9260. } __packed;
  9261. struct afe_sp_th_vi_get_param_resp {
  9262. uint32_t status;
  9263. struct param_hdr_v3 pdata;
  9264. struct afe_sp_th_vi_ftm_params param;
  9265. } __packed;
  9266. struct afe_sp_th_vi_v_vali_cfg {
  9267. uint32_t minor_version;
  9268. uint32_t wait_time_ms[SP_V2_NUM_MAX_SPKR];
  9269. /*
  9270. * Wait time to heat up speaker before collecting statistics
  9271. * for V validation mode in ms.
  9272. * values 100 to 1000 ms
  9273. */
  9274. uint32_t vali_time_ms[SP_V2_NUM_MAX_SPKR];
  9275. /*
  9276. * duration for which V VALIDATION statistics are collected in ms.
  9277. * values 1000 to 3000 ms
  9278. */
  9279. } __packed;
  9280. struct afe_sp_th_vi_v_vali_params {
  9281. uint32_t minor_version;
  9282. uint32_t vrms_q24[SP_V2_NUM_MAX_SPKR];
  9283. /*
  9284. * Vrms value in q24 format
  9285. * values [0 33554432] Q24 (0 - 2Vrms)
  9286. */
  9287. uint32_t status[SP_V2_NUM_MAX_SPKR];
  9288. /*
  9289. * v-vali packet status
  9290. * 0 - Failed.
  9291. * 1 - Success.
  9292. * 2 - Incorrect operation mode.This status is returned
  9293. * when GET_PARAM is called in non v-vali Mode
  9294. * 3 - Inactive mode -- Port is not yet started.
  9295. * 4 - Wait state. wait_time_ms has not yet elapsed
  9296. * 5 - In progress state. ftm_time_ms has not yet elapsed.
  9297. */
  9298. } __packed;
  9299. struct afe_sp_th_vi_v_vali_get_param {
  9300. struct param_hdr_v3 pdata;
  9301. struct afe_sp_th_vi_v_vali_params param;
  9302. } __packed;
  9303. struct afe_sp_th_vi_v_vali_get_param_resp {
  9304. uint32_t status;
  9305. struct param_hdr_v3 pdata;
  9306. struct afe_sp_th_vi_v_vali_params param;
  9307. } __packed;
  9308. #define AFE_MODULE_SPEAKER_PROTECTION_V2_EX_VI 0x0001026F
  9309. #define AFE_PARAM_ID_SP_V2_EX_VI_MODE_CFG 0x000102A1
  9310. #define AFE_PARAM_ID_SP_V2_EX_VI_FTM_CFG 0x000102A2
  9311. #define AFE_PARAM_ID_SP_V2_EX_VI_FTM_PARAMS 0x000102A3
  9312. struct afe_sp_ex_vi_mode_cfg {
  9313. uint32_t minor_version;
  9314. uint32_t operation_mode;
  9315. /*
  9316. * Operation mode of Excursion VI module.
  9317. * 0 - Normal Running mode
  9318. * 2 - FTM mode
  9319. */
  9320. } __packed;
  9321. struct afe_sp_ex_vi_ftm_cfg {
  9322. uint32_t minor_version;
  9323. uint32_t wait_time_ms[SP_V2_NUM_MAX_SPKR];
  9324. /*
  9325. * Wait time to heat up speaker before collecting statistics
  9326. * for ftm mode in ms.
  9327. * values 0 to 4294967295 ms
  9328. */
  9329. uint32_t ftm_time_ms[SP_V2_NUM_MAX_SPKR];
  9330. /*
  9331. * duration for which FTM statistics are collected in ms.
  9332. * values 0 to 2000 ms
  9333. */
  9334. } __packed;
  9335. struct afe_sp_ex_vi_ftm_params {
  9336. uint32_t minor_version;
  9337. int32_t freq_q20[SP_V2_NUM_MAX_SPKR];
  9338. /*
  9339. * Resonance frequency in q20 format
  9340. * values 0 to 2147483647 Hz (in Q20 format)
  9341. */
  9342. int32_t resis_q24[SP_V2_NUM_MAX_SPKR];
  9343. /*
  9344. * Mechanical resistance in q24 format
  9345. * values 0 to 2147483647 Ohms (in Q24 format)
  9346. */
  9347. int32_t qmct_q24[SP_V2_NUM_MAX_SPKR];
  9348. /*
  9349. * Mechanical Qfactor in q24 format
  9350. * values 0 to 2147483647 (in Q24 format)
  9351. */
  9352. uint32_t status[SP_V2_NUM_MAX_SPKR];
  9353. /*
  9354. * FTM packet status
  9355. * 0 - Incorrect operation mode.This status is returned
  9356. * when GET_PARAM is called in non FTM Mode.
  9357. * 1 - Inactive mode -- Port is not yet started.
  9358. * 2 - Wait state. wait_time_ms has not yet elapsed
  9359. * 3 - In progress state. ftm_time_ms has not yet elapsed.
  9360. * 4 - Success.
  9361. * 5 - Failed.
  9362. */
  9363. } __packed;
  9364. struct afe_sp_rx_tmax_xmax_logging_param {
  9365. /*
  9366. * Maximum excursion since the last grasp of xmax in mm.
  9367. */
  9368. int32_t max_excursion[SP_V2_NUM_MAX_SPKR];
  9369. /*
  9370. * Number of periods when the monitored excursion exceeds to and
  9371. * stays at Xmax during logging_count_period.
  9372. */
  9373. uint32_t count_exceeded_excursion[SP_V2_NUM_MAX_SPKR];
  9374. /*
  9375. * Maximum temperature since the last grasp of tmax in C.
  9376. */
  9377. int32_t max_temperature[SP_V2_NUM_MAX_SPKR];
  9378. /*
  9379. * Number of periods when the monitored temperature exceeds to and
  9380. * stays at Tmax during logging_count_period
  9381. */
  9382. uint32_t count_exceeded_temperature[SP_V2_NUM_MAX_SPKR];
  9383. } __packed;
  9384. struct afe_sp_rx_tmax_xmax_logging_resp {
  9385. uint32_t status;
  9386. struct param_hdr_v3 pdata;
  9387. struct afe_sp_rx_tmax_xmax_logging_param param;
  9388. } __packed;
  9389. struct afe_sp_ex_vi_get_param {
  9390. struct param_hdr_v3 pdata;
  9391. struct afe_sp_ex_vi_ftm_params param;
  9392. } __packed;
  9393. struct afe_sp_ex_vi_get_param_resp {
  9394. uint32_t status;
  9395. struct param_hdr_v3 pdata;
  9396. struct afe_sp_ex_vi_ftm_params param;
  9397. } __packed;
  9398. struct afe_sp_rx_limiter_th_param {
  9399. uint32_t minor_version;
  9400. uint32_t lim_thr_per_calib_q27[SP_V2_NUM_MAX_SPKR];
  9401. } __packed;
  9402. struct afe_spkr_prot_get_vi_calib {
  9403. struct apr_hdr hdr;
  9404. struct mem_mapping_hdr mem_hdr;
  9405. struct param_hdr_v3 pdata;
  9406. struct asm_calib_res_cfg res_cfg;
  9407. } __packed;
  9408. struct afe_spkr_prot_calib_get_resp {
  9409. uint32_t status;
  9410. struct param_hdr_v3 pdata;
  9411. struct asm_calib_res_cfg res_cfg;
  9412. } __packed;
  9413. #define AFE_MODULE_SPEAKER_PROTECTION_V4_RX 0x000102C7
  9414. #define AFE_PARAM_ID_SP_V4_OP_MODE 0x000102C9
  9415. #define AFE_PARAM_ID_SP_V4_RX_TMAX_XMAX_LOGGING 0x000102D2
  9416. struct afe_sp_v4_param_op_mode {
  9417. uint32_t mode;
  9418. } __packed;
  9419. struct afe_sp_v4_channel_tmax_xmax_params {
  9420. /*
  9421. * Maximum excursion since the last grasp of xmax in mm.
  9422. */
  9423. int32_t max_excursion;
  9424. /*
  9425. * Number of periods when the monitored excursion exceeds to and
  9426. * stays at Xmax during logging_count_period.
  9427. */
  9428. uint32_t count_exceeded_excursion;
  9429. /*
  9430. * Maximum temperature since the last grasp of tmax in C.
  9431. */
  9432. int32_t max_temperature;
  9433. /*
  9434. * Number of periods when the monitored temperature exceeds to and
  9435. * stays at Tmax during logging_count_period
  9436. */
  9437. uint32_t count_exceeded_temperature;
  9438. } __packed;
  9439. /* This structure is followed by 'num_ch' number of structures of
  9440. * type afe_sp_v4_channel_tmax_xmax_params.
  9441. */
  9442. struct afe_sp_v4_param_tmax_xmax_logging {
  9443. uint32_t num_ch;
  9444. /* Number of channels for Rx signal.
  9445. */
  9446. struct afe_sp_v4_channel_tmax_xmax_params ch_tmax_xmax[0];
  9447. } __packed;
  9448. #define AFE_MODULE_SPEAKER_PROTECTION_V4_VI 0x000102D3
  9449. #define AFE_PARAM_ID_SP_V4_VI_OP_MODE_CFG 0x000102D4
  9450. #define AFE_PARAM_ID_SP_V4_VI_R0T0_CFG 0x000102D5
  9451. #define AFE_PARAM_ID_SP_V4_CALIB_RES_CFG 0x000102D8
  9452. #define AFE_PARAM_ID_SP_V4_TH_VI_FTM_CFG 0x000102D9
  9453. #define AFE_PARAM_ID_SP_V4_TH_VI_FTM_PARAMS 0x000102DA
  9454. #define AFE_PARAM_ID_SP_V4_TH_VI_V_VALI_CFG 0x000102DB
  9455. #define AFE_PARAM_ID_SP_V4_TH_VI_V_VALI_PARAMS 0x000102DC
  9456. #define AFE_PARAM_ID_SP_V4_EX_VI_MODE_CFG 0x000102DF
  9457. #define AFE_PARAM_ID_SP_V4_EX_VI_FTM_CFG 0x000102E0
  9458. #define AFE_PARAM_ID_SP_V4_EX_VI_FTM_PARAMS 0x000102E1
  9459. #define AFE_PARAM_ID_SP_V4_VI_CHANNEL_MAP_CFG 0x000102E5
  9460. struct afe_sp_v4_param_vi_op_mode_cfg {
  9461. uint32_t num_speakers;
  9462. /* Number of channels for Rx signal.
  9463. */
  9464. uint32_t th_operation_mode;
  9465. /*
  9466. * Operation mode of thermal VI module.
  9467. * 0 -- Normal Running mode
  9468. * 1 -- Calibration mode
  9469. * 2 -- FTM mode
  9470. * 3 -- V-Validation mode
  9471. */
  9472. uint32_t th_quick_calib_flag;
  9473. /*
  9474. * Indicates whether calibration is to be done in quick mode or not.
  9475. * This field is valid only in Calibration mode (operation_mode = 1).
  9476. * 0 -- Disabled
  9477. * 1 -- Enabled
  9478. */
  9479. uint32_t th_r0t0_selection_flag[SP_V2_NUM_MAX_SPKR];
  9480. /*
  9481. * Specifies which set of R0, T0 values the algorithm will use.
  9482. * This field is valid only in Normal mode (operation_mode = 0).
  9483. * 0 -- Use calibrated R0, T0 value
  9484. * 1 -- Use safe R0, T0 value
  9485. */
  9486. } __packed;
  9487. struct afe_sp_v4_channel_r0t0 {
  9488. int32_t r0_cali_q24;
  9489. /*
  9490. * Calibration point resistance per device. This field is valid
  9491. * only in Normal mode (operation_mode = 0).
  9492. * values 33554432 to 1073741824 Ohms (in Q24 format)
  9493. */
  9494. int16_t t0_cali_q6;
  9495. /*
  9496. * Calibration point temperature per device. This field is valid
  9497. * in both Normal mode and Calibration mode.
  9498. * values -1920 to 5120 degrees C (in Q6 format)
  9499. */
  9500. uint16_t reserved;
  9501. } __packed;
  9502. /* Followed by this structure are 'num_speaakers' number of structures
  9503. * of type afe_sp_v4_channel_r0t0.
  9504. */
  9505. struct afe_sp_v4_param_th_vi_r0t0_cfg {
  9506. uint32_t num_speakers;
  9507. /* Number of channels for Rx signal.
  9508. */
  9509. struct afe_sp_v4_channel_r0t0 ch_r0t0[0];
  9510. } __packed;
  9511. struct afe_sp_v4_param_th_vi_calib_res_cfg {
  9512. uint32_t num_ch;
  9513. /* Number of channels for Rx signal.
  9514. */
  9515. uint32_t th_vi_ca_state;
  9516. /*
  9517. * Represents the calibration state for both speakers.
  9518. * 0 -- Incorrect operation mode.
  9519. * 1 -- Inactive mode.
  9520. * 2 -- Wait state.
  9521. * 3 -- Calibration in progress state.
  9522. * 4 -- Calibration success.
  9523. * 5 -- Calibration failed.
  9524. */
  9525. int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
  9526. /* Calibration resistance per device.
  9527. */
  9528. } __packed;
  9529. struct afe_sp_v4_th_vi_calib_resp {
  9530. uint32_t status;
  9531. struct param_hdr_v3 pdata;
  9532. struct afe_sp_v4_param_th_vi_calib_res_cfg res_cfg;
  9533. } __packed;
  9534. struct afe_sp_v4_channel_ftm_cfg {
  9535. uint32_t wait_time_ms;
  9536. /*
  9537. * Wait time to heat up speaker before collecting statistics
  9538. * for ftm mode in ms.
  9539. * values 0 to 4294967295 ms
  9540. */
  9541. uint32_t ftm_time_ms;
  9542. /*
  9543. * duration for which FTM statistics are collected in ms.
  9544. * values 0 to 2000 ms
  9545. */
  9546. } __packed;
  9547. /* This structure is followed by 'num_ch' number of structures
  9548. * of type afe_sp_v4_channel_ftm_cfg.
  9549. */
  9550. struct afe_sp_v4_param_th_vi_ftm_cfg {
  9551. uint32_t num_ch;
  9552. /* Number of channels for Rx signal.
  9553. */
  9554. struct afe_sp_v4_channel_ftm_cfg ch_ftm_cfg[0];
  9555. } __packed;
  9556. struct afe_sp_v4_channel_ftm_params {
  9557. int32_t dc_res_q24;
  9558. /*
  9559. * DC resistance value in q24 format
  9560. * values 0 to 2147483647 Ohms (in Q24 format)
  9561. */
  9562. int32_t temp_q22;
  9563. /*
  9564. * temperature value in q22 format
  9565. * values -125829120 to 2147483647 degC (in Q22 format)
  9566. */
  9567. uint32_t status;
  9568. /*
  9569. * FTM packet status
  9570. * 0 - Incorrect operation mode.This status is returned
  9571. * when GET_PARAM is called in non FTM Mode
  9572. * 1 - Inactive mode -- Port is not yet started.
  9573. * 2 - Wait state. wait_time_ms has not yet elapsed
  9574. * 3 - In progress state. ftm_time_ms has not yet elapsed.
  9575. * 4 - Success.
  9576. * 5 - Failed.
  9577. */
  9578. } __packed;
  9579. /* This structure is followed by 'num_ch' number of structures
  9580. * of type afe_sp_v4_channel_ftm_params.
  9581. */
  9582. struct afe_sp_v4_param_th_vi_ftm_params {
  9583. uint32_t num_ch;
  9584. /* Number of channels for Rx signal.
  9585. */
  9586. struct afe_sp_v4_channel_ftm_params ch_ftm_params[0];
  9587. } __packed;
  9588. struct afe_sp_v4_gen_get_param_resp {
  9589. uint32_t status;
  9590. struct param_hdr_v3 pdata;
  9591. } __packed;
  9592. struct afe_sp_v4_channel_v_vali_cfg {
  9593. uint32_t wait_time_ms;
  9594. /*
  9595. * Wait time to heat up speaker before collecting statistics
  9596. * for V validation mode in ms.
  9597. * values 100 to 1000 ms
  9598. */
  9599. uint32_t vali_time_ms;
  9600. /*
  9601. * duration for which V VALIDATION statistics are collected in ms.
  9602. * values 1000 to 3000 ms
  9603. */
  9604. } __packed;
  9605. /* This structure is followed by 'num_ch' number of structures
  9606. * of type afe_sp_v4_channel_v_vali_cfg.
  9607. */
  9608. struct afe_sp_v4_param_th_vi_v_vali_cfg {
  9609. uint32_t num_ch;
  9610. /* Number of channels for Rx signal.
  9611. */
  9612. struct afe_sp_v4_channel_v_vali_cfg ch_v_vali_cfg[0];
  9613. } __packed;
  9614. struct afe_sp_v4_channel_v_vali_params {
  9615. uint32_t vrms_q24;
  9616. /*
  9617. * Vrms value in q24 format
  9618. * values [0 33554432] Q24 (0 - 2Vrms)
  9619. */
  9620. uint32_t status;
  9621. /*
  9622. * v-vali packet status
  9623. * 0 - Failed.
  9624. * 1 - Success.
  9625. * 2 - Incorrect operation mode.This status is returned
  9626. * when GET_PARAM is called in non v-vali Mode
  9627. * 3 - Inactive mode -- Port is not yet started.
  9628. * 4 - Wait state. wait_time_ms has not yet elapsed
  9629. * 5 - In progress state. ftm_time_ms has not yet elapsed.
  9630. */
  9631. } __packed;
  9632. /* This structure is followed by 'num_ch' number of structures
  9633. * of type afe_sp_v4_channel_v_vali_params.
  9634. */
  9635. struct afe_sp_v4_param_th_vi_v_vali_params {
  9636. uint32_t num_ch;
  9637. /* Number of channels for Rx signal.
  9638. */
  9639. struct afe_sp_v4_channel_v_vali_params ch_v_vali_params[0];
  9640. } __packed;
  9641. struct afe_sp_v4_param_ex_vi_mode_cfg {
  9642. uint32_t operation_mode;
  9643. /*
  9644. * Operation mode of Excursion VI module.
  9645. * 0 - Normal Running mode
  9646. * 2 - FTM mode
  9647. */
  9648. } __packed;
  9649. struct afe_sp_v4_channel_ex_vi_ftm {
  9650. uint32_t wait_time_ms;
  9651. /*
  9652. * Wait time to heat up speaker before collecting statistics
  9653. * for ftm mode in ms.
  9654. * values 0 to 4294967295 ms
  9655. */
  9656. uint32_t ftm_time_ms;
  9657. /*
  9658. * duration for which FTM statistics are collected in ms.
  9659. * values 0 to 2000 ms
  9660. */
  9661. } __packed;
  9662. /* This structure is followed by 'num_ch' number of structures
  9663. * of type afe_sp_v4_channel_ex_vi_ftm.
  9664. */
  9665. struct afe_sp_v4_param_ex_vi_ftm_cfg {
  9666. uint32_t num_ch;
  9667. /* Number of channels for Rx signal.
  9668. */
  9669. struct afe_sp_v4_channel_ex_vi_ftm ch_ex_vi_ftm[0];
  9670. } __packed;
  9671. struct afe_sp_v4_channel_ex_vi_ftm_params {
  9672. int32_t ftm_re_q24;
  9673. /*
  9674. * DC resistance of voice coil at room temperature
  9675. * or small signal level in Ohm.
  9676. */
  9677. int32_t ftm_Bl_q24;
  9678. /* Force factor.
  9679. */
  9680. int32_t ftm_Rms_q24;
  9681. /* Mechanical damping or resistance of loudspeaker in Kg/sec.
  9682. */
  9683. int32_t ftm_Kms_q24;
  9684. /* Mechanical stiffness of driver suspension in N/mm.
  9685. */
  9686. int32_t ftm_Fres_q20;
  9687. /* Resonance frequency in Hz.
  9688. */
  9689. int32_t ftm_Qms_q24;
  9690. /* Mechanical Q-factor.
  9691. */
  9692. uint32_t status;
  9693. /*
  9694. * FTM packet status
  9695. * 0 - Incorrect operation mode.This status is returned
  9696. * when GET_PARAM is called in non FTM Mode.
  9697. * 1 - Inactive mode -- Port is not yet started.
  9698. * 2 - Wait state. wait_time_ms has not yet elapsed
  9699. * 3 - In progress state. ftm_time_ms has not yet elapsed.
  9700. * 4 - Success.
  9701. * 5 - Failed.
  9702. */
  9703. } __packed;
  9704. /* This structure is followed by 'num_ch' number of structures of
  9705. * type afe_sp_v4_channel_ex_vi_ftm_params.
  9706. */
  9707. struct afe_sp_v4_param_ex_vi_ftm_params {
  9708. uint32_t num_ch;
  9709. /* Number of channels for Rx signal.
  9710. */
  9711. struct afe_sp_v4_channel_ex_vi_ftm_params ch_ex_vi_ftm_params[0];
  9712. } __packed;
  9713. struct afe_sp_v4_param_vi_channel_map_cfg {
  9714. int32_t num_channels;
  9715. int32_t chan_info[4];
  9716. } __packed;
  9717. union afe_spkr_prot_config {
  9718. struct asm_fbsp_mode_rx_cfg mode_rx_cfg;
  9719. struct asm_spkr_calib_vi_proc_cfg vi_proc_cfg;
  9720. struct asm_feedback_path_cfg feedback_path_cfg;
  9721. struct asm_mode_vi_proc_cfg mode_vi_proc_cfg;
  9722. struct afe_sp_th_vi_mode_cfg th_vi_mode_cfg;
  9723. struct afe_sp_th_vi_ftm_cfg th_vi_ftm_cfg;
  9724. struct afe_sp_th_vi_v_vali_cfg th_vi_v_vali_cfg;
  9725. struct afe_sp_ex_vi_mode_cfg ex_vi_mode_cfg;
  9726. struct afe_sp_ex_vi_ftm_cfg ex_vi_ftm_cfg;
  9727. struct afe_sp_rx_limiter_th_param limiter_th_cfg;
  9728. struct afe_sp_v4_param_op_mode v4_op_mode;
  9729. struct afe_sp_v4_param_vi_op_mode_cfg v4_vi_op_mode;
  9730. struct afe_sp_v4_param_th_vi_r0t0_cfg v4_r0t0_cfg;
  9731. struct afe_sp_v4_param_th_vi_ftm_cfg v4_th_vi_ftm_cfg;
  9732. struct afe_sp_v4_param_th_vi_v_vali_cfg v4_v_vali_cfg;
  9733. struct afe_sp_v4_param_ex_vi_mode_cfg v4_ex_vi_mode_cfg;
  9734. struct afe_sp_v4_param_ex_vi_ftm_cfg v4_ex_vi_ftm_cfg;
  9735. struct afe_sp_v4_param_vi_channel_map_cfg v4_ch_map_cfg;
  9736. } __packed;
  9737. /* SRS TRUMEDIA start */
  9738. /* topology */
  9739. #define SRS_TRUMEDIA_TOPOLOGY_ID 0x00010D90
  9740. /* module */
  9741. #define SRS_TRUMEDIA_MODULE_ID 0x10005010
  9742. /* parameters */
  9743. #define SRS_TRUMEDIA_PARAMS 0x10005011
  9744. #define SRS_TRUMEDIA_PARAMS_WOWHD 0x10005012
  9745. #define SRS_TRUMEDIA_PARAMS_CSHP 0x10005013
  9746. #define SRS_TRUMEDIA_PARAMS_HPF 0x10005014
  9747. #define SRS_TRUMEDIA_PARAMS_AEQ 0x10005015
  9748. #define SRS_TRUMEDIA_PARAMS_HL 0x10005016
  9749. #define SRS_TRUMEDIA_PARAMS_GEQ 0x10005017
  9750. #define SRS_ID_GLOBAL 0x00000001
  9751. #define SRS_ID_WOWHD 0x00000002
  9752. #define SRS_ID_CSHP 0x00000003
  9753. #define SRS_ID_HPF 0x00000004
  9754. #define SRS_ID_AEQ 0x00000005
  9755. #define SRS_ID_HL 0x00000006
  9756. #define SRS_ID_GEQ 0x00000007
  9757. #define SRS_CMD_UPLOAD 0x7FFF0000
  9758. #define SRS_PARAM_OFFSET_MASK 0x3FFF0000
  9759. #define SRS_PARAM_VALUE_MASK 0x0000FFFF
  9760. struct srs_trumedia_params_GLOBAL {
  9761. uint8_t v1;
  9762. uint8_t v2;
  9763. uint8_t v3;
  9764. uint8_t v4;
  9765. uint8_t v5;
  9766. uint8_t v6;
  9767. uint8_t v7;
  9768. uint8_t v8;
  9769. uint16_t v9;
  9770. } __packed;
  9771. struct srs_trumedia_params_WOWHD {
  9772. uint32_t v1;
  9773. uint16_t v2;
  9774. uint16_t v3;
  9775. uint16_t v4;
  9776. uint16_t v5;
  9777. uint16_t v6;
  9778. uint16_t v7;
  9779. uint16_t v8;
  9780. uint16_t v____A1;
  9781. uint32_t v9;
  9782. uint16_t v10;
  9783. uint16_t v11;
  9784. uint32_t v12[16];
  9785. uint32_t v13[16];
  9786. uint32_t v14[16];
  9787. uint32_t v15[16];
  9788. uint32_t v16;
  9789. uint16_t v17;
  9790. uint16_t v18;
  9791. } __packed;
  9792. struct srs_trumedia_params_CSHP {
  9793. uint32_t v1;
  9794. uint16_t v2;
  9795. uint16_t v3;
  9796. uint16_t v4;
  9797. uint16_t v5;
  9798. uint16_t v6;
  9799. uint16_t v____A1;
  9800. uint32_t v7;
  9801. uint16_t v8;
  9802. uint16_t v9;
  9803. uint32_t v10[16];
  9804. } __packed;
  9805. struct srs_trumedia_params_HPF {
  9806. uint32_t v1;
  9807. uint32_t v2[26];
  9808. } __packed;
  9809. struct srs_trumedia_params_AEQ {
  9810. uint32_t v1;
  9811. uint16_t v2;
  9812. uint16_t v3;
  9813. uint16_t v4;
  9814. uint16_t v____A1;
  9815. uint32_t v5[74];
  9816. uint32_t v6[74];
  9817. uint16_t v7[2048];
  9818. } __packed;
  9819. struct srs_trumedia_params_HL {
  9820. uint16_t v1;
  9821. uint16_t v2;
  9822. uint16_t v3;
  9823. uint16_t v____A1;
  9824. int32_t v4;
  9825. uint32_t v5;
  9826. uint16_t v6;
  9827. uint16_t v____A2;
  9828. uint32_t v7;
  9829. } __packed;
  9830. struct srs_trumedia_params_GEQ {
  9831. int16_t v1[10];
  9832. } __packed;
  9833. struct srs_trumedia_params {
  9834. struct srs_trumedia_params_GLOBAL global;
  9835. struct srs_trumedia_params_WOWHD wowhd;
  9836. struct srs_trumedia_params_CSHP cshp;
  9837. struct srs_trumedia_params_HPF hpf;
  9838. struct srs_trumedia_params_AEQ aeq;
  9839. struct srs_trumedia_params_HL hl;
  9840. struct srs_trumedia_params_GEQ geq;
  9841. } __packed;
  9842. /* SRS TruMedia end */
  9843. #define AUDPROC_PARAM_ID_ENABLE 0x00010904
  9844. #define ASM_STREAM_POSTPROC_TOPO_ID_SA_PLUS 0x1000FFFF
  9845. /* DTS Eagle */
  9846. #define AUDPROC_MODULE_ID_DTS_HPX_PREMIX 0x0001077C
  9847. #define AUDPROC_MODULE_ID_DTS_HPX_POSTMIX 0x0001077B
  9848. #define ASM_STREAM_POSTPROC_TOPO_ID_DTS_HPX 0x00010DED
  9849. #define ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS 0x10015000
  9850. #define ASM_STREAM_POSTPROC_TOPO_ID_HPX_MASTER 0x10015001
  9851. /* Opcode to set BT address and license for aptx decoder */
  9852. #define APTX_DECODER_BT_ADDRESS 0x00013201
  9853. #define APTX_CLASSIC_DEC_LICENSE_ID 0x00013202
  9854. struct aptx_dec_bt_addr_cfg {
  9855. uint32_t lap;
  9856. uint32_t uap;
  9857. uint32_t nap;
  9858. } __packed;
  9859. struct aptx_dec_bt_dev_addr {
  9860. struct apr_hdr hdr;
  9861. struct asm_stream_cmd_set_encdec_param encdec;
  9862. struct aptx_dec_bt_addr_cfg bt_addr_cfg;
  9863. } __packed;
  9864. struct asm_aptx_dec_fmt_blk_v2 {
  9865. struct apr_hdr hdr;
  9866. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  9867. u32 sample_rate;
  9868. /* Number of samples per second.
  9869. * Supported values: 44100 and 48000 Hz
  9870. */
  9871. } __packed;
  9872. /* Q6Core Specific */
  9873. #define AVCS_CMD_GET_FWK_VERSION (0x0001292C)
  9874. #define AVCS_CMDRSP_GET_FWK_VERSION (0x0001292D)
  9875. #define AVCS_SERVICE_ID_ALL (0xFFFFFFFF)
  9876. #define APRV2_IDS_SERVICE_ID_ADSP_CVP_V (0xB)
  9877. #define APRV2_IDS_SERVICE_ID_ADSP_AFE_V (0x4)
  9878. struct avcs_get_fwk_version {
  9879. /*
  9880. * Indicates the major version of the AVS build.
  9881. * This value is incremented on chipset family boundaries.
  9882. */
  9883. uint32_t build_major_version;
  9884. /*
  9885. * Minor version of the AVS build.
  9886. * This value represents the mainline to which the AVS build belongs.
  9887. */
  9888. uint32_t build_minor_version;
  9889. /* Indicates the AVS branch version to which the image belongs. */
  9890. uint32_t build_branch_version;
  9891. /* Indicates the AVS sub-branch or customer product line information. */
  9892. uint32_t build_subbranch_version;
  9893. /* Number of supported AVS services in the current build. */
  9894. uint32_t num_services;
  9895. };
  9896. struct avs_svc_api_info {
  9897. /*
  9898. * APRV2 service IDs for the individual static services.
  9899. *
  9900. * @values
  9901. * - APRV2_IDS_SERVICE_ID_ADSP_CORE_V
  9902. * - APRV2_IDS_SERVICE_ID_ADSP_AFE_V
  9903. * - APRV2_IDS_SERVICE_ID_ADSP_ASM_V
  9904. * - APRV2_IDS_SERVICE_ID_ADSP_ADM_V
  9905. * - APRV2_IDS_SERVICE_ID_ADSP_MVM_V
  9906. * - APRV2_IDS_SERVICE_ID_ADSP_CVS_V
  9907. * - APRV2_IDS_SERVICE_ID_ADSP_CVP_V
  9908. * - APRV2_IDS_SERVICE_ID_ADSP_LSM_V
  9909. */
  9910. uint32_t service_id;
  9911. /*
  9912. * Indicates the API version of the service.
  9913. *
  9914. * Each new API update that warrants a change on the HLOS side triggers
  9915. * an increment in the version.
  9916. */
  9917. uint32_t api_version;
  9918. /*
  9919. * Indicates the API increments on a sub-branch (not on the mainline).
  9920. *
  9921. * API branch version numbers can increment independently on different
  9922. * sub-branches.
  9923. */
  9924. uint32_t api_branch_version;
  9925. };
  9926. struct avcs_fwk_ver_info {
  9927. struct avcs_get_fwk_version avcs_fwk_version;
  9928. struct avs_svc_api_info services[0];
  9929. } __packed;
  9930. /* LSM Specific */
  9931. #define VW_FEAT_DIM (39)
  9932. #define APRV2_IDS_SERVICE_ID_ADSP_ASM_V (0x7)
  9933. #define APRV2_IDS_SERVICE_ID_ADSP_ADM_V (0x8)
  9934. #define APRV2_IDS_SERVICE_ID_ADSP_LSM_V (0xD)
  9935. #define APRV2_IDS_DOMAIN_ID_ADSP_V (0x4)
  9936. #define APRV2_IDS_DOMAIN_ID_APPS_V (0x5)
  9937. #define LSM_SESSION_CMD_SHARED_MEM_MAP_REGIONS (0x00012A7F)
  9938. #define LSM_SESSION_CMDRSP_SHARED_MEM_MAP_REGIONS (0x00012A80)
  9939. #define LSM_SESSION_CMD_SHARED_MEM_UNMAP_REGIONS (0x00012A81)
  9940. #define LSM_SESSION_CMD_OPEN_TX (0x00012A82)
  9941. #define LSM_SESSION_CMD_CLOSE_TX (0x00012A88)
  9942. #define LSM_SESSION_CMD_SET_PARAMS (0x00012A83)
  9943. #define LSM_SESSION_CMD_SET_PARAMS_V2 (0x00012A8F)
  9944. #define LSM_SESSION_CMD_SET_PARAMS_V3 (0x00012A92)
  9945. #define LSM_SESSION_CMD_GET_PARAMS_V2 (0x00012A90)
  9946. #define LSM_SESSION_CMDRSP_GET_PARAMS_V2 (0x00012A91)
  9947. #define LSM_SESSION_CMD_GET_PARAMS_V3 (0x00012A93)
  9948. #define LSM_SESSION_CMDRSP_GET_PARAMS_V3 (0x00012A94)
  9949. #define LSM_SESSION_CMD_REGISTER_SOUND_MODEL (0x00012A84)
  9950. #define LSM_SESSION_CMD_DEREGISTER_SOUND_MODEL (0x00012A85)
  9951. #define LSM_SESSION_CMD_START (0x00012A86)
  9952. #define LSM_SESSION_CMD_STOP (0x00012A87)
  9953. #define LSM_SESSION_CMD_EOB (0x00012A89)
  9954. #define LSM_SESSION_CMD_READ (0x00012A8A)
  9955. #define LSM_SESSION_CMD_OPEN_TX_V2 (0x00012A8B)
  9956. #define LSM_SESSION_CMD_OPEN_TX_V3 (0x00012A95)
  9957. #define LSM_CMD_ADD_TOPOLOGIES (0x00012A8C)
  9958. #define LSM_SESSION_EVENT_DETECTION_STATUS (0x00012B00)
  9959. #define LSM_SESSION_EVENT_DETECTION_STATUS_V2 (0x00012B01)
  9960. #define LSM_DATA_EVENT_READ_DONE (0x00012B02)
  9961. #define LSM_DATA_EVENT_STATUS (0x00012B03)
  9962. #define LSM_SESSION_EVENT_DETECTION_STATUS_V3 (0x00012B04)
  9963. #define LSM_SESSION_DETECTION_ENGINE_GENERIC_EVENT (0x00012B06)
  9964. #define LSM_MODULE_ID_VOICE_WAKEUP (0x00012C00)
  9965. #define LSM_PARAM_ID_ENDPOINT_DETECT_THRESHOLD (0x00012C01)
  9966. #define LSM_PARAM_ID_OPERATION_MODE (0x00012C02)
  9967. #define LSM_PARAM_ID_GAIN (0x00012C03)
  9968. #define LSM_PARAM_ID_CONNECT_TO_PORT (0x00012C04)
  9969. #define LSM_PARAM_ID_FEATURE_COMPENSATION_DATA (0x00012C07)
  9970. #define LSM_PARAM_ID_MIN_CONFIDENCE_LEVELS (0x00012C07)
  9971. #define LSM_MODULE_ID_LAB (0x00012C08)
  9972. #define LSM_PARAM_ID_LAB_ENABLE (0x00012C09)
  9973. #define LSM_PARAM_ID_LAB_CONFIG (0x00012C0A)
  9974. #define LSM_MODULE_ID_FRAMEWORK (0x00012C0E)
  9975. #define LSM_PARAM_ID_SWMAD_CFG (0x00012C18)
  9976. #define LSM_PARAM_ID_SWMAD_MODEL (0x00012C19)
  9977. #define LSM_PARAM_ID_SWMAD_ENABLE (0x00012C1A)
  9978. #define LSM_PARAM_ID_POLLING_ENABLE (0x00012C1B)
  9979. #define LSM_PARAM_ID_MEDIA_FMT (0x00012C1E)
  9980. #define LSM_PARAM_ID_FWK_MODE_CONFIG (0x00012C27)
  9981. #define LSM_PARAM_ID_MEDIA_FMT_V2 (0x00012C32)
  9982. #define LSM_PARAM_ID_LAB_OUTPUT_CHANNEL_CONFIG (0x00012C2D)
  9983. /* HW MAD specific */
  9984. #define AFE_MODULE_HW_MAD (0x00010230)
  9985. #define AFE_PARAM_ID_HW_MAD_CFG (0x00010231)
  9986. #define AFE_PARAM_ID_HW_MAD_CTRL (0x00010232)
  9987. #define AFE_PARAM_ID_SLIMBUS_SLAVE_PORT_CFG (0x00010233)
  9988. /* SW MAD specific */
  9989. #define AFE_MODULE_SW_MAD (0x0001022D)
  9990. #define AFE_PARAM_ID_SW_MAD_CFG (0x0001022E)
  9991. #define AFE_PARAM_ID_SVM_MODEL (0x0001022F)
  9992. /* Commands/Params to pass the codec/slimbus data to DSP */
  9993. #define AFE_SVC_CMD_SET_PARAM (0x000100f3)
  9994. #define AFE_SVC_CMD_SET_PARAM_V2 (0x000100fc)
  9995. #define AFE_MODULE_CDC_DEV_CFG (0x00010234)
  9996. #define AFE_PARAM_ID_CDC_SLIMBUS_SLAVE_CFG (0x00010235)
  9997. #define AFE_PARAM_ID_CDC_REG_CFG (0x00010236)
  9998. #define AFE_PARAM_ID_CDC_REG_CFG_INIT (0x00010237)
  9999. #define AFE_PARAM_ID_CDC_REG_PAGE_CFG (0x00010296)
  10000. #define AFE_MAX_CDC_REGISTERS_TO_CONFIG (20)
  10001. /* AANC Port Config Specific */
  10002. #define AFE_PARAM_ID_AANC_PORT_CONFIG (0x00010215)
  10003. #define AFE_API_VERSION_AANC_PORT_CONFIG (0x1)
  10004. #define AANC_TX_MIC_UNUSED (0)
  10005. #define AANC_TX_VOICE_MIC (1)
  10006. #define AANC_TX_ERROR_MIC (2)
  10007. #define AANC_TX_NOISE_MIC (3)
  10008. #define AFE_PORT_MAX_CHANNEL_CNT (8)
  10009. #define AFE_MODULE_AANC (0x00010214)
  10010. #define AFE_PARAM_ID_CDC_AANC_VERSION (0x0001023A)
  10011. #define AFE_API_VERSION_CDC_AANC_VERSION (0x1)
  10012. #define AANC_HW_BLOCK_VERSION_1 (1)
  10013. #define AANC_HW_BLOCK_VERSION_2 (2)
  10014. /*Clip bank selection*/
  10015. #define AFE_API_VERSION_CLIP_BANK_SEL_CFG 0x1
  10016. #define AFE_CLIP_MAX_BANKS 4
  10017. #define AFE_PARAM_ID_CLIP_BANK_SEL_CFG 0x00010242
  10018. struct afe_param_aanc_port_cfg {
  10019. /* Minor version used for tracking the version of the module's
  10020. * source port configuration.
  10021. */
  10022. uint32_t aanc_port_cfg_minor_version;
  10023. /* Sampling rate of the source Tx port. 8k - 192k*/
  10024. uint32_t tx_port_sample_rate;
  10025. /* Channel mapping for the Tx port signal carrying Noise (X),
  10026. * Error (E), and Voice (V) signals.
  10027. */
  10028. uint8_t tx_port_channel_map[AFE_PORT_MAX_CHANNEL_CNT];
  10029. /* Number of channels on the source Tx port. */
  10030. uint16_t tx_port_num_channels;
  10031. /* Port ID of the Rx path reference signal. */
  10032. uint16_t rx_path_ref_port_id;
  10033. /* Sampling rate of the reference port. 8k - 192k*/
  10034. uint32_t ref_port_sample_rate;
  10035. } __packed;
  10036. struct afe_param_id_cdc_aanc_version {
  10037. /* Minor version used for tracking the version of the module's
  10038. * hw version
  10039. */
  10040. uint32_t cdc_aanc_minor_version;
  10041. /* HW version. */
  10042. uint32_t aanc_hw_version;
  10043. } __packed;
  10044. #define AFE_PARAM_ID_AANC_NOISE_REDUCTION 0x000102AB
  10045. struct afe_param_id_aanc_noise_reduction {
  10046. /* Minor version used for tracking the version of the module's
  10047. * hw version
  10048. */
  10049. uint32_t minor_version;
  10050. /* Target noise level */
  10051. int32_t ad_beta;
  10052. } __packed;
  10053. struct afe_param_id_clip_bank_sel {
  10054. /* Minor version used for tracking the version of the module's
  10055. * hw version
  10056. */
  10057. uint32_t minor_version;
  10058. /* Number of banks to be read */
  10059. uint32_t num_banks;
  10060. uint32_t bank_map[AFE_CLIP_MAX_BANKS];
  10061. } __packed;
  10062. /* ERROR CODES */
  10063. /* Success. The operation completed with no errors. */
  10064. #define ADSP_EOK 0x00000000
  10065. /* General failure. */
  10066. #define ADSP_EFAILED 0x00000001
  10067. /* Bad operation parameter. */
  10068. #define ADSP_EBADPARAM 0x00000002
  10069. /* Unsupported routine or operation. */
  10070. #define ADSP_EUNSUPPORTED 0x00000003
  10071. /* Unsupported version. */
  10072. #define ADSP_EVERSION 0x00000004
  10073. /* Unexpected problem encountered. */
  10074. #define ADSP_EUNEXPECTED 0x00000005
  10075. /* Unhandled problem occurred. */
  10076. #define ADSP_EPANIC 0x00000006
  10077. /* Unable to allocate resource. */
  10078. #define ADSP_ENORESOURCE 0x00000007
  10079. /* Invalid handle. */
  10080. #define ADSP_EHANDLE 0x00000008
  10081. /* Operation is already processed. */
  10082. #define ADSP_EALREADY 0x00000009
  10083. /* Operation is not ready to be processed. */
  10084. #define ADSP_ENOTREADY 0x0000000A
  10085. /* Operation is pending completion. */
  10086. #define ADSP_EPENDING 0x0000000B
  10087. /* Operation could not be accepted or processed. */
  10088. #define ADSP_EBUSY 0x0000000C
  10089. /* Operation aborted due to an error. */
  10090. #define ADSP_EABORTED 0x0000000D
  10091. /* Operation preempted by a higher priority. */
  10092. #define ADSP_EPREEMPTED 0x0000000E
  10093. /* Operation requests intervention to complete. */
  10094. #define ADSP_ECONTINUE 0x0000000F
  10095. /* Operation requests immediate intervention to complete. */
  10096. #define ADSP_EIMMEDIATE 0x00000010
  10097. /* Operation is not implemented. */
  10098. #define ADSP_ENOTIMPL 0x00000011
  10099. /* Operation needs more data or resources. */
  10100. #define ADSP_ENEEDMORE 0x00000012
  10101. /* Operation does not have memory. */
  10102. #define ADSP_ENOMEMORY 0x00000014
  10103. /* Item does not exist. */
  10104. #define ADSP_ENOTEXIST 0x00000015
  10105. /* Max count for adsp error code sent to HLOS*/
  10106. #define ADSP_ERR_MAX (ADSP_ENOTEXIST + 1)
  10107. /* Operation is finished. */
  10108. #define ADSP_ETERMINATED 0x00011174
  10109. /*bharath, adsp_error_codes.h */
  10110. /* LPASS clock for I2S Interface */
  10111. /* Supported OSR clock values */
  10112. #define Q6AFE_LPASS_OSR_CLK_12_P288_MHZ 0xBB8000
  10113. #define Q6AFE_LPASS_OSR_CLK_11_P2896_MHZ 0xAC4400
  10114. #define Q6AFE_LPASS_OSR_CLK_9_P600_MHZ 0x927C00
  10115. #define Q6AFE_LPASS_OSR_CLK_8_P192_MHZ 0x7D0000
  10116. #define Q6AFE_LPASS_OSR_CLK_6_P144_MHZ 0x5DC000
  10117. #define Q6AFE_LPASS_OSR_CLK_4_P096_MHZ 0x3E8000
  10118. #define Q6AFE_LPASS_OSR_CLK_3_P072_MHZ 0x2EE000
  10119. #define Q6AFE_LPASS_OSR_CLK_2_P048_MHZ 0x1F4000
  10120. #define Q6AFE_LPASS_OSR_CLK_1_P536_MHZ 0x177000
  10121. #define Q6AFE_LPASS_OSR_CLK_1_P024_MHZ 0xFA000
  10122. #define Q6AFE_LPASS_OSR_CLK_768_kHZ 0xBB800
  10123. #define Q6AFE_LPASS_OSR_CLK_512_kHZ 0x7D000
  10124. #define Q6AFE_LPASS_OSR_CLK_DISABLE 0x0
  10125. /* Supported Bit clock values */
  10126. #define Q6AFE_LPASS_IBIT_CLK_12_P288_MHZ 0xBB8000
  10127. #define Q6AFE_LPASS_IBIT_CLK_11_P2896_MHZ 0xAC4400
  10128. #define Q6AFE_LPASS_IBIT_CLK_8_P192_MHZ 0x7D0000
  10129. #define Q6AFE_LPASS_IBIT_CLK_6_P144_MHZ 0x5DC000
  10130. #define Q6AFE_LPASS_IBIT_CLK_4_P096_MHZ 0x3E8000
  10131. #define Q6AFE_LPASS_IBIT_CLK_3_P072_MHZ 0x2EE000
  10132. #define Q6AFE_LPASS_IBIT_CLK_2_P8224_MHZ 0x2b1100
  10133. #define Q6AFE_LPASS_IBIT_CLK_2_P048_MHZ 0x1F4000
  10134. #define Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ 0x177000
  10135. #define Q6AFE_LPASS_IBIT_CLK_1_P4112_MHZ 0x158880
  10136. #define Q6AFE_LPASS_IBIT_CLK_1_P024_MHZ 0xFA000
  10137. #define Q6AFE_LPASS_IBIT_CLK_768_KHZ 0xBB800
  10138. #define Q6AFE_LPASS_IBIT_CLK_512_KHZ 0x7D000
  10139. #define Q6AFE_LPASS_IBIT_CLK_256_KHZ 0x3E800
  10140. #define Q6AFE_LPASS_IBIT_CLK_DISABLE 0x0
  10141. /* Supported LPASS CLK sources */
  10142. #define Q6AFE_LPASS_CLK_SRC_EXTERNAL 0
  10143. #define Q6AFE_LPASS_CLK_SRC_INTERNAL 1
  10144. /* Supported LPASS CLK root*/
  10145. #define Q6AFE_LPASS_CLK_ROOT_DEFAULT 0
  10146. enum afe_lpass_clk_mode {
  10147. Q6AFE_LPASS_MODE_BOTH_INVALID,
  10148. Q6AFE_LPASS_MODE_CLK1_VALID,
  10149. Q6AFE_LPASS_MODE_CLK2_VALID,
  10150. Q6AFE_LPASS_MODE_BOTH_VALID,
  10151. } __packed;
  10152. /* Clock ID Enumeration Define. */
  10153. /* Clock ID for Primary I2S IBIT */
  10154. #define Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT 0x100
  10155. /* Clock ID for Primary I2S EBIT */
  10156. #define Q6AFE_LPASS_CLK_ID_PRI_MI2S_EBIT 0x101
  10157. /* Clock ID for Secondary I2S IBIT */
  10158. #define Q6AFE_LPASS_CLK_ID_SEC_MI2S_IBIT 0x102
  10159. /* Clock ID for Secondary I2S EBIT */
  10160. #define Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT 0x103
  10161. /* Clock ID for Tertiary I2S IBIT */
  10162. #define Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT 0x104
  10163. /* Clock ID for Tertiary I2S EBIT */
  10164. #define Q6AFE_LPASS_CLK_ID_TER_MI2S_EBIT 0x105
  10165. /* Clock ID for Quartnery I2S IBIT */
  10166. #define Q6AFE_LPASS_CLK_ID_QUAD_MI2S_IBIT 0x106
  10167. /* Clock ID for Quartnery I2S EBIT */
  10168. #define Q6AFE_LPASS_CLK_ID_QUAD_MI2S_EBIT 0x107
  10169. /* Clock ID for Speaker I2S IBIT */
  10170. #define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_IBIT 0x108
  10171. /* Clock ID for Speaker I2S EBIT */
  10172. #define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_EBIT 0x109
  10173. /* Clock ID for Speaker I2S OSR */
  10174. #define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_OSR 0x10A
  10175. /* Clock ID for QUINARY I2S IBIT */
  10176. #define Q6AFE_LPASS_CLK_ID_QUI_MI2S_IBIT 0x10B
  10177. /* Clock ID for QUINARY I2S EBIT */
  10178. #define Q6AFE_LPASS_CLK_ID_QUI_MI2S_EBIT 0x10C
  10179. /* Clock ID for SENARY I2S IBIT */
  10180. #define Q6AFE_LPASS_CLK_ID_SEN_MI2S_IBIT 0x10D
  10181. /* Clock ID for SENARY I2S EBIT */
  10182. #define Q6AFE_LPASS_CLK_ID_SEN_MI2S_EBIT 0x10E
  10183. /* Clock ID for INT0 I2S IBIT */
  10184. #define Q6AFE_LPASS_CLK_ID_INT0_MI2S_IBIT 0x10F
  10185. /* Clock ID for INT1 I2S IBIT */
  10186. #define Q6AFE_LPASS_CLK_ID_INT1_MI2S_IBIT 0x110
  10187. /* Clock ID for INT2 I2S IBIT */
  10188. #define Q6AFE_LPASS_CLK_ID_INT2_MI2S_IBIT 0x111
  10189. /* Clock ID for INT3 I2S IBIT */
  10190. #define Q6AFE_LPASS_CLK_ID_INT3_MI2S_IBIT 0x112
  10191. /* Clock ID for INT4 I2S IBIT */
  10192. #define Q6AFE_LPASS_CLK_ID_INT4_MI2S_IBIT 0x113
  10193. /* Clock ID for INT5 I2S IBIT */
  10194. #define Q6AFE_LPASS_CLK_ID_INT5_MI2S_IBIT 0x114
  10195. /* Clock ID for INT6 I2S IBIT */
  10196. #define Q6AFE_LPASS_CLK_ID_INT6_MI2S_IBIT 0x115
  10197. /* Clock ID for QUINARY MI2S OSR CLK */
  10198. #define Q6AFE_LPASS_CLK_ID_QUI_MI2S_OSR 0x116
  10199. /* Clock ID for Primary PCM IBIT */
  10200. #define Q6AFE_LPASS_CLK_ID_PRI_PCM_IBIT 0x200
  10201. /* Clock ID for Primary PCM EBIT */
  10202. #define Q6AFE_LPASS_CLK_ID_PRI_PCM_EBIT 0x201
  10203. /* Clock ID for Secondary PCM IBIT */
  10204. #define Q6AFE_LPASS_CLK_ID_SEC_PCM_IBIT 0x202
  10205. /* Clock ID for Secondary PCM EBIT */
  10206. #define Q6AFE_LPASS_CLK_ID_SEC_PCM_EBIT 0x203
  10207. /* Clock ID for Tertiary PCM IBIT */
  10208. #define Q6AFE_LPASS_CLK_ID_TER_PCM_IBIT 0x204
  10209. /* Clock ID for Tertiary PCM EBIT */
  10210. #define Q6AFE_LPASS_CLK_ID_TER_PCM_EBIT 0x205
  10211. /* Clock ID for Quartery PCM IBIT */
  10212. #define Q6AFE_LPASS_CLK_ID_QUAD_PCM_IBIT 0x206
  10213. /* Clock ID for Quartery PCM EBIT */
  10214. #define Q6AFE_LPASS_CLK_ID_QUAD_PCM_EBIT 0x207
  10215. /* Clock ID for Quinary PCM IBIT */
  10216. #define Q6AFE_LPASS_CLK_ID_QUIN_PCM_IBIT 0x208
  10217. /* Clock ID for Quinary PCM EBIT */
  10218. #define Q6AFE_LPASS_CLK_ID_QUIN_PCM_EBIT 0x209
  10219. /* Clock ID for QUINARY PCM OSR */
  10220. #define Q6AFE_LPASS_CLK_ID_QUI_PCM_OSR 0x20A
  10221. /* Clock ID for Senary PCM IBIT */
  10222. #define Q6AFE_LPASS_CLK_ID_SEN_PCM_IBIT 0x20B
  10223. /* Clock ID for Senary PCM EBIT */
  10224. #define Q6AFE_LPASS_CLK_ID_SEN_PCM_EBIT 0x20C
  10225. /** Clock ID for Primary TDM IBIT */
  10226. #define Q6AFE_LPASS_CLK_ID_PRI_TDM_IBIT 0x200
  10227. /** Clock ID for Primary TDM EBIT */
  10228. #define Q6AFE_LPASS_CLK_ID_PRI_TDM_EBIT 0x201
  10229. /** Clock ID for Secondary TDM IBIT */
  10230. #define Q6AFE_LPASS_CLK_ID_SEC_TDM_IBIT 0x202
  10231. /** Clock ID for Secondary TDM EBIT */
  10232. #define Q6AFE_LPASS_CLK_ID_SEC_TDM_EBIT 0x203
  10233. /** Clock ID for Tertiary TDM IBIT */
  10234. #define Q6AFE_LPASS_CLK_ID_TER_TDM_IBIT 0x204
  10235. /** Clock ID for Tertiary TDM EBIT */
  10236. #define Q6AFE_LPASS_CLK_ID_TER_TDM_EBIT 0x205
  10237. /** Clock ID for Quartery TDM IBIT */
  10238. #define Q6AFE_LPASS_CLK_ID_QUAD_TDM_IBIT 0x206
  10239. /** Clock ID for Quartery TDM EBIT */
  10240. #define Q6AFE_LPASS_CLK_ID_QUAD_TDM_EBIT 0x207
  10241. /** Clock ID for Quinary TDM IBIT */
  10242. #define Q6AFE_LPASS_CLK_ID_QUIN_TDM_IBIT 0x208
  10243. /** Clock ID for Quinary TDM EBIT */
  10244. #define Q6AFE_LPASS_CLK_ID_QUIN_TDM_EBIT 0x209
  10245. /** Clock ID for Quinary TDM OSR */
  10246. #define Q6AFE_LPASS_CLK_ID_QUIN_TDM_OSR 0x20A
  10247. /** Clock ID for Senary TDM IBIT */
  10248. #define Q6AFE_LPASS_CLK_ID_SEN_TDM_IBIT 0x20B
  10249. /** Clock ID for Senary TDM EBIT */
  10250. #define Q6AFE_LPASS_CLK_ID_SEN_TDM_EBIT 0x20C
  10251. /* Clock ID for MCLK1 */
  10252. #define Q6AFE_LPASS_CLK_ID_MCLK_1 0x300
  10253. /* Clock ID for MCLK2 */
  10254. #define Q6AFE_LPASS_CLK_ID_MCLK_2 0x301
  10255. /* Clock ID for MCLK3 */
  10256. #define Q6AFE_LPASS_CLK_ID_MCLK_3 0x302
  10257. /* Clock ID for MCLK4 */
  10258. #define Q6AFE_LPASS_CLK_ID_MCLK_4 0x304
  10259. /* Clock ID for Internal Digital Codec Core */
  10260. #define Q6AFE_LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE 0x303
  10261. /* Clock ID for INT MCLK0 */
  10262. #define Q6AFE_LPASS_CLK_ID_INT_MCLK_0 0x305
  10263. /* Clock ID for INT MCLK1 */
  10264. #define Q6AFE_LPASS_CLK_ID_INT_MCLK_1 0x306
  10265. /*
  10266. * Clock ID for soundwire NPL.
  10267. * This is the clock to be used to enable NPL clock for internal Soundwire.
  10268. */
  10269. #define AFE_CLOCK_SET_CLOCK_ID_SWR_NPL_CLK 0x307
  10270. /* Clock ID for MCLK5 */
  10271. #define Q6AFE_LPASS_CLK_ID_MCLK_5 0x308
  10272. /* Clock ID for AHB HDMI input */
  10273. #define Q6AFE_LPASS_CLK_ID_AHB_HDMI_INPUT 0x400
  10274. /* Clock ID for the primary SPDIF output core. */
  10275. #define AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_OUTPUT_CORE 0x500
  10276. /* Clock ID for the secondary SPDIF output core. */
  10277. #define AFE_CLOCK_SET_CLOCK_ID_SEC_SPDIF_OUTPUT_CORE 0x501
  10278. /* Clock ID for the primary SPDIF input core. */
  10279. #define AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_INPUT_CORE 0x502
  10280. /* Clock ID for the secondary SPDIF input core. */
  10281. #define AFE_CLOCK_SET_CLOCK_ID_SEC_SPDIF_INPUT_CORE 0x503
  10282. /* Clock ID for the secondary SPDIF output NPL clk. */
  10283. #define AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_OUTPUT_NPL 0x504
  10284. /* Clock ID for the primary SPDIF output NPL clk. */
  10285. #define AFE_CLOCK_SET_CLOCK_ID_SEC_SPDIF_OUTPUT_NPL 0x505
  10286. /* Clock attribute for invalid use (reserved for internal usage) */
  10287. #define Q6AFE_LPASS_CLK_ATTRIBUTE_INVALID 0x0
  10288. /* Clock attribute for no couple case */
  10289. #define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO 0x1
  10290. /* Clock attribute for dividend couple case */
  10291. #define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVIDEND 0x2
  10292. /* Clock attribute for divisor couple case */
  10293. #define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR 0x3
  10294. /* Clock attribute for invert and no couple case */
  10295. #define Q6AFE_LPASS_CLK_ATTRIBUTE_INVERT_COUPLE_NO 0x4
  10296. /* Clock set API version */
  10297. #define Q6AFE_LPASS_CLK_CONFIG_API_VERSION 0x1
  10298. struct afe_clk_set {
  10299. /*
  10300. * Minor version used for tracking clock set.
  10301. * @values #AFE_API_VERSION_CLOCK_SET
  10302. */
  10303. uint32_t clk_set_minor_version;
  10304. /*
  10305. * Clock ID
  10306. * @values
  10307. * - 0x100 to 0x10A - MSM8996
  10308. * - 0x200 to 0x207 - MSM8996
  10309. * - 0x300 to 0x302 - MSM8996 @tablebulletend
  10310. */
  10311. uint32_t clk_id;
  10312. /*
  10313. * Clock frequency (in Hertz) to be set.
  10314. * @values
  10315. * - >= 0 for clock frequency to set @tablebulletend
  10316. */
  10317. uint32_t clk_freq_in_hz;
  10318. /* Use to specific divider for two clocks if needed.
  10319. * Set to Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO for no divider
  10320. * relation clocks
  10321. * @values
  10322. * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO
  10323. * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVIDEND
  10324. * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR @tablebulletend
  10325. */
  10326. uint16_t clk_attri;
  10327. /*
  10328. * Specifies the root clock source.
  10329. * Currently, only Q6AFE_LPASS_CLK_ROOT_DEFAULT is valid
  10330. * @values
  10331. * - 0 @tablebulletend
  10332. */
  10333. uint16_t clk_root;
  10334. /*
  10335. * for enable and disable clock.
  10336. * "clk_freq_in_hz", "clk_attri", and "clk_root"
  10337. * are ignored in disable clock case.
  10338. * @values
  10339. * - 0 -- Disabled
  10340. * - 1 -- Enabled @tablebulletend
  10341. */
  10342. uint32_t enable;
  10343. };
  10344. #define AVS_BUILD_MAJOR_VERSION_V2 2
  10345. #define AVS_BUILD_MINOR_VERSION_V9 9
  10346. #define AVS_BUILD_BRANCH_VERSION_V0 0
  10347. #define AVS_BUILD_BRANCH_VERSION_V3 3
  10348. #define AFE_PARAM_ID_CLOCK_SET_V2 0x000102E6
  10349. #define AFE_API_VERSION_CLOCK_SET_V2 0x1
  10350. struct afe_param_id_clock_set_v2_t {
  10351. uint32_t clk_set_minor_version;
  10352. uint32_t clk_id;
  10353. uint32_t clk_freq_in_hz;
  10354. uint16_t clk_attri;
  10355. uint16_t clk_root;
  10356. uint32_t enable;
  10357. uint32_t divider_2x;
  10358. uint32_t m;
  10359. uint32_t n;
  10360. uint32_t d;
  10361. };
  10362. struct afe_clk_cfg {
  10363. /* Minor version used for tracking the version of the I2S
  10364. * configuration interface.
  10365. * Supported values: #AFE_API_VERSION_I2S_CONFIG
  10366. */
  10367. u32 i2s_cfg_minor_version;
  10368. /* clk value 1 in MHz. */
  10369. u32 clk_val1;
  10370. /* clk value 2 in MHz. */
  10371. u32 clk_val2;
  10372. /* clk_src
  10373. * #Q6AFE_LPASS_CLK_SRC_EXTERNAL
  10374. * #Q6AFE_LPASS_CLK_SRC_INTERNAL
  10375. */
  10376. u16 clk_src;
  10377. /* clk_root -0 for default */
  10378. u16 clk_root;
  10379. /* clk_set_mode
  10380. * #Q6AFE_LPASS_MODE_BOTH_INVALID
  10381. * #Q6AFE_LPASS_MODE_CLK1_VALID
  10382. * #Q6AFE_LPASS_MODE_CLK2_VALID
  10383. * #Q6AFE_LPASS_MODE_BOTH_VALID
  10384. */
  10385. u16 clk_set_mode;
  10386. /* This param id is used to configure I2S clk */
  10387. u16 reserved;
  10388. } __packed;
  10389. /* This param id is used to configure I2S clk */
  10390. #define AFE_PARAM_ID_LPAIF_CLK_CONFIG 0x00010238
  10391. #define AFE_MODULE_CLOCK_SET 0x0001028F
  10392. #define AFE_PARAM_ID_CLOCK_SET 0x00010290
  10393. struct afe_set_clk_drift {
  10394. /*
  10395. * Clock ID
  10396. * @values
  10397. * - 0x100 to 0x10E
  10398. * - 0x200 to 0x20C
  10399. * - 0x500 to 0x505
  10400. */
  10401. uint32_t clk_id;
  10402. /*
  10403. * Clock drift (in PPB) to be set.
  10404. * @values
  10405. * - need to get values from DSP team
  10406. */
  10407. int32_t clk_drift;
  10408. /*
  10409. * Clock rest.
  10410. * @values
  10411. * - 1 -- Reset PLL with the original frequency
  10412. * - 0 -- Adjust the clock with the clk drift value
  10413. */
  10414. uint32_t clk_reset;
  10415. } __packed;
  10416. /* This param id is used to adjust audio interface PLL*/
  10417. #define AFE_PARAM_ID_CLOCK_ADJUST 0x000102C6
  10418. enum afe_lpass_digital_clk_src {
  10419. Q6AFE_LPASS_DIGITAL_ROOT_INVALID,
  10420. Q6AFE_LPASS_DIGITAL_ROOT_PRI_MI2S_OSR,
  10421. Q6AFE_LPASS_DIGITAL_ROOT_SEC_MI2S_OSR,
  10422. Q6AFE_LPASS_DIGITAL_ROOT_TER_MI2S_OSR,
  10423. Q6AFE_LPASS_DIGITAL_ROOT_QUAD_MI2S_OSR,
  10424. Q6AFE_LPASS_DIGITAL_ROOT_CDC_ROOT_CLK,
  10425. } __packed;
  10426. /* This param id is used to configure internal clk */
  10427. #define AFE_PARAM_ID_INTERNAL_DIGIATL_CDC_CLK_CONFIG 0x00010239
  10428. struct afe_digital_clk_cfg {
  10429. /* Minor version used for tracking the version of the I2S
  10430. * configuration interface.
  10431. * Supported values: #AFE_API_VERSION_I2S_CONFIG
  10432. */
  10433. u32 i2s_cfg_minor_version;
  10434. /* clk value in MHz. */
  10435. u32 clk_val;
  10436. /* INVALID
  10437. * PRI_MI2S_OSR
  10438. * SEC_MI2S_OSR
  10439. * TER_MI2S_OSR
  10440. * QUAD_MI2S_OSR
  10441. * DIGT_CDC_ROOT
  10442. */
  10443. u16 clk_root;
  10444. /* This field must be set to zero. */
  10445. u16 reserved;
  10446. } __packed;
  10447. /*
  10448. * Opcode for AFE to start DTMF.
  10449. */
  10450. #define AFE_PORTS_CMD_DTMF_CTL 0x00010102
  10451. /** DTMF payload.*/
  10452. struct afe_dtmf_generation_command {
  10453. struct apr_hdr hdr;
  10454. /*
  10455. * Duration of the DTMF tone in ms.
  10456. * -1 -> continuous,
  10457. * 0 -> disable
  10458. */
  10459. int64_t duration_in_ms;
  10460. /*
  10461. * The DTMF high tone frequency.
  10462. */
  10463. uint16_t high_freq;
  10464. /*
  10465. * The DTMF low tone frequency.
  10466. */
  10467. uint16_t low_freq;
  10468. /*
  10469. * The DTMF volume setting
  10470. */
  10471. uint16_t gain;
  10472. /*
  10473. * The number of ports to enable/disable on.
  10474. */
  10475. uint16_t num_ports;
  10476. /*
  10477. * The Destination ports - array .
  10478. * For DTMF on multiple ports, portIds needs to
  10479. * be populated numPorts times.
  10480. */
  10481. uint16_t port_ids;
  10482. /*
  10483. * variable for 32 bit alignment of APR packet.
  10484. */
  10485. uint16_t reserved;
  10486. } __packed;
  10487. enum afe_config_type {
  10488. AFE_SLIMBUS_SLAVE_PORT_CONFIG,
  10489. AFE_SLIMBUS_SLAVE_CONFIG,
  10490. AFE_CDC_REGISTERS_CONFIG,
  10491. AFE_AANC_VERSION,
  10492. AFE_CDC_CLIP_REGISTERS_CONFIG,
  10493. AFE_CLIP_BANK_SEL,
  10494. AFE_CDC_REGISTER_PAGE_CONFIG,
  10495. AFE_MAX_CONFIG_TYPES,
  10496. };
  10497. struct afe_param_slimbus_slave_port_cfg {
  10498. uint32_t minor_version;
  10499. uint16_t slimbus_dev_id;
  10500. uint16_t slave_dev_pgd_la;
  10501. uint16_t slave_dev_intfdev_la;
  10502. uint16_t bit_width;
  10503. uint16_t data_format;
  10504. uint16_t num_channels;
  10505. uint16_t slave_port_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT];
  10506. } __packed;
  10507. struct afe_param_cdc_slimbus_slave_cfg {
  10508. uint32_t minor_version;
  10509. uint32_t device_enum_addr_lsw;
  10510. uint32_t device_enum_addr_msw;
  10511. uint16_t tx_slave_port_offset;
  10512. uint16_t rx_slave_port_offset;
  10513. } __packed;
  10514. struct afe_param_cdc_reg_cfg {
  10515. uint32_t minor_version;
  10516. uint32_t reg_logical_addr;
  10517. uint32_t reg_field_type;
  10518. uint32_t reg_field_bit_mask;
  10519. uint16_t reg_bit_width;
  10520. uint16_t reg_offset_scale;
  10521. } __packed;
  10522. #define AFE_API_VERSION_CDC_REG_PAGE_CFG 1
  10523. enum {
  10524. AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_0 = 0,
  10525. AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_1,
  10526. AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_2,
  10527. AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_3,
  10528. };
  10529. struct afe_param_cdc_reg_page_cfg {
  10530. uint32_t minor_version;
  10531. uint32_t enable;
  10532. uint32_t proc_id;
  10533. } __packed;
  10534. struct afe_param_cdc_reg_cfg_data {
  10535. uint32_t num_registers;
  10536. struct afe_param_cdc_reg_cfg *reg_data;
  10537. } __packed;
  10538. struct afe_svc_cmd_set_param_v1 {
  10539. /* APR Header */
  10540. struct apr_hdr apr_hdr;
  10541. /* The total size of the payload, including param_hdr_v3 */
  10542. uint32_t payload_size;
  10543. /* The memory mapping header to be used when sending outband */
  10544. struct mem_mapping_hdr mem_hdr;
  10545. /* The parameter data to be filled when sent inband */
  10546. u32 param_data[0];
  10547. } __packed;
  10548. struct afe_svc_cmd_set_param_v2 {
  10549. /* APR Header */
  10550. struct apr_hdr apr_hdr;
  10551. /* The memory mapping header to be used when sending outband */
  10552. struct mem_mapping_hdr mem_hdr;
  10553. /* The total size of the payload, including param_hdr_v3 */
  10554. u32 payload_size;
  10555. /* The parameter data to be filled when sent inband */
  10556. u32 param_data[0];
  10557. } __packed;
  10558. struct afe_param_hw_mad_ctrl {
  10559. uint32_t minor_version;
  10560. uint16_t mad_type;
  10561. uint16_t mad_enable;
  10562. } __packed;
  10563. struct afe_port_cmd_set_aanc_acdb_table {
  10564. struct apr_hdr hdr;
  10565. struct mem_mapping_hdr mem_hdr;
  10566. } __packed;
  10567. /* Dolby DAP topology */
  10568. #define DOLBY_ADM_COPP_TOPOLOGY_ID 0x0001033B
  10569. #define DS2_ADM_COPP_TOPOLOGY_ID 0x1301033B
  10570. /* RMS value from DSP */
  10571. #define RMS_MODULEID_APPI_PASSTHRU 0x10009011
  10572. #define RMS_PARAM_FIRST_SAMPLE 0x10009012
  10573. #define RMS_PAYLOAD_LEN 4
  10574. /* Customized mixing in matix mixer */
  10575. #define MTMX_MODULE_ID_DEFAULT_CHMIXER 0x00010341
  10576. #define DEFAULT_CHMIXER_PARAM_ID_COEFF 0x00010342
  10577. #define CUSTOM_STEREO_PAYLOAD_SIZE 9
  10578. #define CUSTOM_STEREO_CMD_PARAM_SIZE 24
  10579. #define CUSTOM_STEREO_NUM_OUT_CH 0x0002
  10580. #define CUSTOM_STEREO_NUM_IN_CH 0x0002
  10581. #define CUSTOM_STEREO_INDEX_PARAM 0x0002
  10582. #define Q14_GAIN_ZERO_POINT_FIVE 0x2000
  10583. #define Q14_GAIN_UNITY 0x4000
  10584. /* Ultrasound supported formats */
  10585. #define US_POINT_EPOS_FORMAT_V2 0x0001272D
  10586. #define US_RAW_FORMAT_V2 0x0001272C
  10587. #define US_PROX_FORMAT_V4 0x0001273B
  10588. #define US_RAW_SYNC_FORMAT 0x0001272F
  10589. #define US_GES_SYNC_FORMAT 0x00012730
  10590. #define AFE_MODULE_GROUP_DEVICE 0x00010254
  10591. #define AFE_PARAM_ID_GROUP_DEVICE_CFG 0x00010255
  10592. #define AFE_PARAM_ID_GROUP_DEVICE_ENABLE 0x00010256
  10593. #define AFE_GROUP_DEVICE_ID_SECONDARY_MI2S_RX 0x1102
  10594. /* Payload of the #AFE_PARAM_ID_GROUP_DEVICE_CFG
  10595. * parameter, which configures max of 8 AFE ports
  10596. * into a group.
  10597. * The fixed size of this structure is sixteen bytes.
  10598. */
  10599. struct afe_group_device_group_cfg {
  10600. u32 minor_version;
  10601. u16 group_id;
  10602. u16 num_channels;
  10603. u16 port_id[8];
  10604. } __packed;
  10605. #define AFE_GROUP_DEVICE_ID_PRIMARY_TDM_RX \
  10606. (AFE_PORT_ID_PRIMARY_TDM_RX + 0x100)
  10607. #define AFE_GROUP_DEVICE_ID_PRIMARY_TDM_TX \
  10608. (AFE_PORT_ID_PRIMARY_TDM_TX + 0x100)
  10609. #define AFE_GROUP_DEVICE_ID_SECONDARY_TDM_RX \
  10610. (AFE_PORT_ID_SECONDARY_TDM_RX + 0x100)
  10611. #define AFE_GROUP_DEVICE_ID_SECONDARY_TDM_TX \
  10612. (AFE_PORT_ID_SECONDARY_TDM_TX + 0x100)
  10613. #define AFE_GROUP_DEVICE_ID_TERTIARY_TDM_RX \
  10614. (AFE_PORT_ID_TERTIARY_TDM_RX + 0x100)
  10615. #define AFE_GROUP_DEVICE_ID_TERTIARY_TDM_TX \
  10616. (AFE_PORT_ID_TERTIARY_TDM_TX + 0x100)
  10617. #define AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_RX \
  10618. (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x100)
  10619. #define AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_TX \
  10620. (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x100)
  10621. #define AFE_GROUP_DEVICE_ID_QUINARY_TDM_RX \
  10622. (AFE_PORT_ID_QUINARY_TDM_RX + 0x100)
  10623. #define AFE_GROUP_DEVICE_ID_QUINARY_TDM_TX \
  10624. (AFE_PORT_ID_QUINARY_TDM_TX + 0x100)
  10625. #define AFE_GROUP_DEVICE_ID_SENARY_TDM_RX \
  10626. (AFE_PORT_ID_SENARY_TDM_RX + 0x100)
  10627. #define AFE_GROUP_DEVICE_ID_SENARY_TDM_TX \
  10628. (AFE_PORT_ID_SENARY_TDM_TX + 0x100)
  10629. /* ID of the parameter used by #AFE_MODULE_GROUP_DEVICE to configure the
  10630. * group device. #AFE_SVC_CMD_SET_PARAM can use this parameter ID.
  10631. *
  10632. * Requirements:
  10633. * - Configure the group before the member ports in the group are
  10634. * configured and started.
  10635. * - Enable the group only after it is configured.
  10636. * - Stop all member ports in the group before disabling the group.
  10637. */
  10638. #define AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG 0x0001029E
  10639. /* Version information used to handle future additions to
  10640. * AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG processing (for backward compatibility).
  10641. */
  10642. #define AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG 0x1
  10643. /* Number of AFE ports in group device */
  10644. #define AFE_GROUP_DEVICE_NUM_PORTS 8
  10645. /* Payload of the AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG parameter ID
  10646. * used by AFE_MODULE_GROUP_DEVICE.
  10647. */
  10648. struct afe_param_id_group_device_tdm_cfg {
  10649. u32 group_device_cfg_minor_version;
  10650. /* Minor version used to track group device configuration.
  10651. * @values #AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG
  10652. */
  10653. u16 group_id;
  10654. /* ID for the group device.
  10655. * @values
  10656. * - #AFE_GROUP_DEVICE_ID_PRIMARY_TDM_RX
  10657. * - #AFE_GROUP_DEVICE_ID_PRIMARY_TDM_TX
  10658. * - #AFE_GROUP_DEVICE_ID_SECONDARY_TDM_RX
  10659. * - #AFE_GROUP_DEVICE_ID_SECONDARY_TDM_TX
  10660. * - #AFE_GROUP_DEVICE_ID_TERTIARY_TDM_RX
  10661. * - #AFE_GROUP_DEVICE_ID_TERTIARY_TDM_TX
  10662. * - #AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_RX
  10663. * - #AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_TX
  10664. */
  10665. u16 reserved;
  10666. /* 0 */
  10667. u16 port_id[AFE_GROUP_DEVICE_NUM_PORTS];
  10668. /* Array of member port IDs of this group.
  10669. * @values
  10670. * - #AFE_PORT_ID_PRIMARY_TDM_RX
  10671. * - #AFE_PORT_ID_PRIMARY_TDM_RX_1
  10672. * - #AFE_PORT_ID_PRIMARY_TDM_RX_2
  10673. * - #AFE_PORT_ID_PRIMARY_TDM_RX_3
  10674. * - #AFE_PORT_ID_PRIMARY_TDM_RX_4
  10675. * - #AFE_PORT_ID_PRIMARY_TDM_RX_5
  10676. * - #AFE_PORT_ID_PRIMARY_TDM_RX_6
  10677. * - #AFE_PORT_ID_PRIMARY_TDM_RX_7
  10678. * - #AFE_PORT_ID_PRIMARY_TDM_TX
  10679. * - #AFE_PORT_ID_PRIMARY_TDM_TX_1
  10680. * - #AFE_PORT_ID_PRIMARY_TDM_TX_2
  10681. * - #AFE_PORT_ID_PRIMARY_TDM_TX_3
  10682. * - #AFE_PORT_ID_PRIMARY_TDM_TX_4
  10683. * - #AFE_PORT_ID_PRIMARY_TDM_TX_5
  10684. * - #AFE_PORT_ID_PRIMARY_TDM_TX_6
  10685. * - #AFE_PORT_ID_PRIMARY_TDM_TX_7
  10686. * - #AFE_PORT_ID_SECONDARY_TDM_RX
  10687. * - #AFE_PORT_ID_SECONDARY_TDM_RX_1
  10688. * - #AFE_PORT_ID_SECONDARY_TDM_RX_2
  10689. * - #AFE_PORT_ID_SECONDARY_TDM_RX_3
  10690. * - #AFE_PORT_ID_SECONDARY_TDM_RX_4
  10691. * - #AFE_PORT_ID_SECONDARY_TDM_RX_5
  10692. * - #AFE_PORT_ID_SECONDARY_TDM_RX_6
  10693. * - #AFE_PORT_ID_SECONDARY_TDM_RX_7
  10694. * - #AFE_PORT_ID_SECONDARY_TDM_TX
  10695. * - #AFE_PORT_ID_SECONDARY_TDM_TX_1
  10696. * - #AFE_PORT_ID_SECONDARY_TDM_TX_2
  10697. * - #AFE_PORT_ID_SECONDARY_TDM_TX_3
  10698. * - #AFE_PORT_ID_SECONDARY_TDM_TX_4
  10699. * - #AFE_PORT_ID_SECONDARY_TDM_TX_5
  10700. * - #AFE_PORT_ID_SECONDARY_TDM_TX_6
  10701. * - #AFE_PORT_ID_SECONDARY_TDM_TX_7
  10702. * - #AFE_PORT_ID_TERTIARY_TDM_RX
  10703. * - #AFE_PORT_ID_TERTIARY_TDM_RX_1
  10704. * - #AFE_PORT_ID_TERTIARY_TDM_RX_2
  10705. * - #AFE_PORT_ID_TERTIARY_TDM_RX_3
  10706. * - #AFE_PORT_ID_TERTIARY_TDM_RX_4
  10707. * - #AFE_PORT_ID_TERTIARY_TDM_RX_5
  10708. * - #AFE_PORT_ID_TERTIARY_TDM_RX_6
  10709. * - #AFE_PORT_ID_TERTIARY_TDM_RX_7
  10710. * - #AFE_PORT_ID_TERTIARY_TDM_TX
  10711. * - #AFE_PORT_ID_TERTIARY_TDM_TX_1
  10712. * - #AFE_PORT_ID_TERTIARY_TDM_TX_2
  10713. * - #AFE_PORT_ID_TERTIARY_TDM_TX_3
  10714. * - #AFE_PORT_ID_TERTIARY_TDM_TX_4
  10715. * - #AFE_PORT_ID_TERTIARY_TDM_TX_5
  10716. * - #AFE_PORT_ID_TERTIARY_TDM_TX_6
  10717. * - #AFE_PORT_ID_TERTIARY_TDM_TX_7
  10718. * - #AFE_PORT_ID_QUATERNARY_TDM_RX
  10719. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_1
  10720. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_2
  10721. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_3
  10722. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_4
  10723. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_5
  10724. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_6
  10725. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_7
  10726. * - #AFE_PORT_ID_QUATERNARY_TDM_TX
  10727. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_1
  10728. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_2
  10729. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_3
  10730. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_4
  10731. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_5
  10732. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_6
  10733. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_7
  10734. * @tablebulletend
  10735. */
  10736. u32 num_channels;
  10737. /* Number of enabled slots for TDM frame.
  10738. * @values 1 to 8
  10739. */
  10740. u32 sample_rate;
  10741. /* Sampling rate of the port.
  10742. * @values
  10743. * - #AFE_PORT_SAMPLE_RATE_8K
  10744. * - #AFE_PORT_SAMPLE_RATE_16K
  10745. * - #AFE_PORT_SAMPLE_RATE_24K
  10746. * - #AFE_PORT_SAMPLE_RATE_32K
  10747. * - #AFE_PORT_SAMPLE_RATE_48K @tablebulletend
  10748. */
  10749. u32 bit_width;
  10750. /* Bit width of the sample.
  10751. * @values 16, 24, (32)
  10752. */
  10753. u16 nslots_per_frame;
  10754. /* Number of slots per frame. Typical : 1, 2, 4, 8, 16, 32.
  10755. * @values 1 - 32
  10756. */
  10757. u16 slot_width;
  10758. /* Slot width of the slot in a TDM frame. (slot_width >= bit_width)
  10759. * have to be satisfied.
  10760. * @values 16, 24, 32
  10761. */
  10762. u32 slot_mask;
  10763. /* Position of active slots. When that bit is set, that paricular
  10764. * slot is active.
  10765. * Number of active slots can be inferred by number of bits set in
  10766. * the mask. Only 8 individual bits can be enabled.
  10767. * Bits 0..31 corresponding to slot 0..31
  10768. * @values 1 to 2^32 -1
  10769. */
  10770. } __packed;
  10771. /* Payload of the #AFE_PARAM_ID_GROUP_DEVICE_ENABLE
  10772. * parameter, which enables or
  10773. * disables any module.
  10774. * The fixed size of this structure is four bytes.
  10775. */
  10776. struct afe_group_device_enable {
  10777. u16 group_id;
  10778. /* valid value is AFE_GROUP_DEVICE_ID_SECONDARY_MI2S_RX */
  10779. u16 enable;
  10780. /* Enables (1) or disables (0) the module. */
  10781. } __packed;
  10782. union afe_port_group_config {
  10783. struct afe_group_device_group_cfg group_cfg;
  10784. struct afe_group_device_enable group_enable;
  10785. struct afe_param_id_group_device_tdm_cfg tdm_cfg;
  10786. } __packed;
  10787. /* ID of the parameter used by #AFE_MODULE_AUDIO_DEV_INTERFACE to specify
  10788. * the timing statistics of the corresponding device interface.
  10789. * Client can periodically query for the device time statistics to help adjust
  10790. * the PLL based on the drift value. The get param command must be sent to
  10791. * AFE port ID corresponding to device interface
  10792. * This parameter ID supports following get param commands:
  10793. * #AFE_PORT_CMD_GET_PARAM_V2 and
  10794. * #AFE_PORT_CMD_GET_PARAM_V3.
  10795. */
  10796. #define AFE_PARAM_ID_DEV_TIMING_STATS 0x000102AD
  10797. /* Version information used to handle future additions to AFE device
  10798. * interface timing statistics (for backward compatibility).
  10799. */
  10800. #define AFE_API_VERSION_DEV_TIMING_STATS 0x1
  10801. /* Enumeration for specifying a sink(Rx) device */
  10802. #define AFE_SINK_DEVICE 0x0
  10803. /* Enumeration for specifying a source(Tx) device */
  10804. #define AFE_SOURCE_DEVICE 0x1
  10805. /* Enumeration for specifying the drift reference is of type AV Timer */
  10806. #define AFE_REF_TIMER_TYPE_AVTIMER 0x0
  10807. /* Message payload structure for the
  10808. * AFE_PARAM_ID_DEV_TIMING_STATS parameter.
  10809. */
  10810. struct afe_param_id_dev_timing_stats {
  10811. /* Minor version used to track the version of device interface timing
  10812. * statistics. Currently, the supported version is 1.
  10813. * @values #AFE_API_VERSION_DEV_TIMING_STATS
  10814. */
  10815. u32 minor_version;
  10816. /* Indicates the device interface direction as either
  10817. * source (Tx) or sink (Rx).
  10818. * @values
  10819. * #AFE_SINK_DEVICE
  10820. * #AFE_SOURCE_DEVICE
  10821. */
  10822. u16 device_direction;
  10823. /* Reference timer for drift accumulation and time stamp information.
  10824. * @values
  10825. * #AFE_REF_TIMER_TYPE_AVTIMER @tablebulletend
  10826. */
  10827. u16 reference_timer;
  10828. /*
  10829. * Flag to indicate if resync is required on the client side for
  10830. * drift correction. Flag is set to TRUE for the first get_param
  10831. * response after device interface starts. This flag value can be
  10832. * used by client to identify if device interface restart has
  10833. * happened and if any re-sync is required at their end for drift
  10834. * correction.
  10835. * @values
  10836. * 0: FALSE (Resync not required)
  10837. * 1: TRUE (Resync required) @tablebulletend
  10838. */
  10839. u32 resync_flag;
  10840. /* Accumulated drift value in microseconds. This value is updated
  10841. * every 100th ms.
  10842. * Positive drift value indicates AV timer is running faster than device
  10843. * Negative drift value indicates AV timer is running slower than device
  10844. * @values Any valid int32 number
  10845. */
  10846. s32 acc_drift_value;
  10847. /* Lower 32 bits of the 64-bit absolute timestamp of reference
  10848. * timer in microseconds.
  10849. * This timestamp corresponds to the time when the drift values
  10850. * are accumlated for every 100th ms.
  10851. * @values Any valid uint32 number
  10852. */
  10853. u32 ref_timer_abs_ts_lsw;
  10854. /* Upper 32 bits of the 64-bit absolute timestamp of reference
  10855. * timer in microseconds.
  10856. * This timestamp corresponds to the time when the drift values
  10857. * are accumlated for every 100th ms.
  10858. * @values Any valid uint32 number
  10859. */
  10860. u32 ref_timer_abs_ts_msw;
  10861. } __packed;
  10862. struct afe_av_dev_drift_get_param_resp {
  10863. uint32_t status;
  10864. struct param_hdr_v3 pdata;
  10865. struct afe_param_id_dev_timing_stats timing_stats;
  10866. } __packed;
  10867. /* Command for Matrix or Stream Router */
  10868. #define ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2 0x00010DCE
  10869. /* Module for AVSYNC */
  10870. #define ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC 0x00010DC6
  10871. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to specify the
  10872. * render window start value. This parameter is supported only for a Set
  10873. * command (not a Get command) in the Rx direction
  10874. * (#ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2).
  10875. * Render window start is a value (session time minus timestamp, or ST-TS)
  10876. * below which frames are held, and after which frames are immediately
  10877. * rendered.
  10878. */
  10879. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_START_V2 0x00010DD1
  10880. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to specify the
  10881. * render window end value. This parameter is supported only for a Set
  10882. * command (not a Get command) in the Rx direction
  10883. * (#ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2). Render window end is a value
  10884. * (session time minus timestamp) above which frames are dropped, and below
  10885. * which frames are immediately rendered.
  10886. */
  10887. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_END_V2 0x00010DD2
  10888. /* Generic payload of the window parameters in the
  10889. * #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC module.
  10890. * This payload is supported only for a Set command
  10891. * (not a Get command) on the Rx path.
  10892. */
  10893. struct asm_session_mtmx_strtr_param_window_v2_t {
  10894. u32 window_lsw;
  10895. /* Lower 32 bits of the render window start value. */
  10896. u32 window_msw;
  10897. /* Upper 32 bits of the render window start value.
  10898. *
  10899. * The 64-bit number formed by window_lsw and window_msw specifies a
  10900. * signed 64-bit window value in microseconds. The sign extension is
  10901. * necessary. This value is used by the following parameter IDs:
  10902. * #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_START_V2
  10903. * #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_END_V2
  10904. * #ASM_SESSION_MTMX_STRTR_PARAM_STAT_WINDOW_START_V2
  10905. * #ASM_SESSION_MTMX_STRTR_PARAM_STAT_WINDOW_END_V2
  10906. * The value depends on which parameter ID is used.
  10907. * The aDSP honors the windows at a granularity of 1 ms.
  10908. */
  10909. };
  10910. struct asm_session_cmd_set_mtmx_strstr_params_v2 {
  10911. uint32_t data_payload_addr_lsw;
  10912. /* Lower 32 bits of the 64-bit data payload address. */
  10913. uint32_t data_payload_addr_msw;
  10914. /* Upper 32 bits of the 64-bit data payload address.
  10915. * If the address is not sent (NULL), the message is in the payload.
  10916. * If the address is sent (non-NULL), the parameter data payloads
  10917. * begin at the specified address.
  10918. */
  10919. uint32_t mem_map_handle;
  10920. /* Unique identifier for an address. This memory map handle is returned
  10921. * by the aDSP through the #ASM_CMD_SHARED_MEM_MAP_REGIONS command.
  10922. * values
  10923. * - NULL -- Parameter data payloads are within the message payload
  10924. * (in-band).
  10925. * - Non-NULL -- Parameter data payloads begin at the address specified
  10926. * in the data_payload_addr_lsw and data_payload_addr_msw fields
  10927. * (out-of-band).
  10928. */
  10929. uint32_t data_payload_size;
  10930. /* Actual size of the variable payload accompanying the message, or in
  10931. * shared memory. This field is used for parsing the parameter payload.
  10932. * values > 0 bytes
  10933. */
  10934. uint32_t direction;
  10935. /* Direction of the entity (matrix mixer or stream router) on which
  10936. * the parameter is to be set.
  10937. * values
  10938. * - 0 -- Rx (for Rx stream router or Rx matrix mixer)
  10939. * - 1 -- Tx (for Tx stream router or Tx matrix mixer)
  10940. */
  10941. };
  10942. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC which allows the
  10943. * audio client choose the rendering decision that the audio DSP should use.
  10944. */
  10945. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_MODE_CMD 0x00012F0D
  10946. /* Indicates that rendering decision will be based on default rate
  10947. * (session clock based rendering, device driven).
  10948. * 1. The default session clock based rendering is inherently driven
  10949. * by the timing of the device.
  10950. * 2. After the initial decision is made (first buffer after a run
  10951. * command), subsequent data rendering decisions are made with
  10952. * respect to the rate at which the device is rendering, thus deriving
  10953. * its timing from the device.
  10954. * 3. While this decision making is simple, it has some inherent limitations
  10955. * (mentioned in the next section).
  10956. * 4. If this API is not set, the session clock based rendering will be assumed
  10957. * and this will ensure that the DSP is backward compatible.
  10958. */
  10959. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_DEFAULT 0
  10960. /* Indicates that rendering decision will be based on local clock rate.
  10961. * 1. In the DSP loopback/client loopback use cases (frame based
  10962. * inputs), the incoming data into audio DSP is time-stamped at the
  10963. * local clock rate (STC).
  10964. * 2. This TS rate may match the incoming data rate or maybe different
  10965. * from the incoming data rate.
  10966. * 3. Regardless, the data will be time-stamped with local STC and
  10967. * therefore, the client is recommended to set this mode for these
  10968. * use cases. This method is inherently more robust to sequencing
  10969. * (AFE Start/Stop) and device switches, among other benefits.
  10970. * 4. This API will inform the DSP to compare every incoming buffer TS
  10971. * against local STC.
  10972. * 5. DSP will continue to honor render windows APIs, as before.
  10973. */
  10974. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_LOCAL_STC 1
  10975. /* Structure for rendering decision parameter */
  10976. struct asm_session_mtmx_strtr_param_render_mode_t {
  10977. /* Specifies the type of rendering decision the audio DSP should use.
  10978. *
  10979. * @values
  10980. * - #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_DEFAULT
  10981. * - #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_LOCAL_STC
  10982. */
  10983. u32 flags;
  10984. } __packed;
  10985. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC which allows the
  10986. * audio client to specify the clock recovery mechanism that the audio DSP
  10987. * should use.
  10988. */
  10989. #define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_CMD 0x00012F0E
  10990. /* Indicates that default clock recovery will be used (no clock recovery).
  10991. * If the client wishes that no clock recovery be done, the client can
  10992. * choose this. This means that no attempt will made by the DSP to try and
  10993. * match the rates of the input and output audio.
  10994. */
  10995. #define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_NONE 0
  10996. /* Indicates that independent clock recovery needs to be used.
  10997. * 1. In the DSP loopback/client loopback use cases (frame based inputs),
  10998. * the client should choose the independent clock recovery option.
  10999. * 2. This basically de-couples the audio and video from knowing each others
  11000. * clock sources and lets the audio DSP independently rate match the input
  11001. * and output rates.
  11002. * 3. After drift detection, the drift correction is achieved by either pulling
  11003. * the PLLs (if applicable) or by stream to device rate matching
  11004. * (for PCM use cases) by comparing drift with respect to STC.
  11005. * 4. For passthrough use cases, since the PLL pulling is the only option,
  11006. * a best effort will be made.
  11007. * If PLL pulling is not possible / available, the rendering will be
  11008. * done without rate matching.
  11009. */
  11010. #define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_AUTO 1
  11011. /* Payload of the #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC parameter.
  11012. */
  11013. struct asm_session_mtmx_strtr_param_clk_rec_t {
  11014. /* Specifies the type of clock recovery that the audio DSP should
  11015. * use for rate matching.
  11016. */
  11017. /* @values
  11018. * #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_DEFAULT
  11019. * #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_INDEPENDENT
  11020. */
  11021. u32 flags;
  11022. } __packed;
  11023. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to
  11024. * realize smoother adjustment of audio session clock for a specified session.
  11025. * The desired audio session clock adjustment(in micro seconds) is specified
  11026. * using the command #ASM_SESSION_CMD_ADJUST_SESSION_CLOCK_V2.
  11027. * Delaying/Advancing the session clock would be implemented by inserting
  11028. * interpolated/dropping audio samples in the playback path respectively.
  11029. * Also, this parameter has to be configured before the Audio Session is put
  11030. * to RUN state to avoid cold start latency/glitches in the playback.
  11031. */
  11032. #define ASM_SESSION_MTMX_PARAM_ADJUST_SESSION_TIME_CTL 0x00013217
  11033. struct asm_session_mtmx_param_adjust_session_time_ctl_t {
  11034. /* Specifies whether the module is enabled or not
  11035. * @values
  11036. * 0 -- disabled
  11037. * 1 -- enabled
  11038. */
  11039. u32 enable;
  11040. };
  11041. union asm_session_mtmx_strtr_param_config {
  11042. struct asm_session_mtmx_strtr_param_window_v2_t window_param;
  11043. struct asm_session_mtmx_strtr_param_render_mode_t render_param;
  11044. struct asm_session_mtmx_strtr_param_clk_rec_t clk_rec_param;
  11045. struct asm_session_mtmx_param_adjust_session_time_ctl_t adj_time_param;
  11046. } __packed;
  11047. struct asm_mtmx_strtr_params {
  11048. struct apr_hdr hdr;
  11049. struct asm_session_cmd_set_mtmx_strstr_params_v2 param;
  11050. struct param_hdr_v1 data;
  11051. union asm_session_mtmx_strtr_param_config config;
  11052. } __packed;
  11053. #define ASM_SESSION_CMD_GET_MTMX_STRTR_PARAMS_V2 0x00010DCF
  11054. #define ASM_SESSION_CMDRSP_GET_MTMX_STRTR_PARAMS_V2 0x00010DD0
  11055. #define ASM_SESSION_MTMX_STRTR_PARAM_SESSION_TIME_V3 0x00012F0B
  11056. #define ASM_SESSION_MTMX_STRTR_PARAM_STIME_TSTMP_FLG_BMASK (0x80000000UL)
  11057. struct asm_session_cmd_get_mtmx_strstr_params_v2 {
  11058. uint32_t data_payload_addr_lsw;
  11059. /* Lower 32 bits of the 64-bit data payload address. */
  11060. uint32_t data_payload_addr_msw;
  11061. /*
  11062. * Upper 32 bits of the 64-bit data payload address.
  11063. * If the address is not sent (NULL), the message is in the payload.
  11064. * If the address is sent (non-NULL), the parameter data payloads
  11065. * begin at the specified address.
  11066. */
  11067. uint32_t mem_map_handle;
  11068. /*
  11069. * Unique identifier for an address. This memory map handle is returned
  11070. * by the aDSP through the #ASM_CMD_SHARED_MEM_MAP_REGIONS command.
  11071. * values
  11072. * - NULL -- Parameter data payloads are within the message payload
  11073. * (in-band).
  11074. * - Non-NULL -- Parameter data payloads begin at the address specified
  11075. * in the data_payload_addr_lsw and data_payload_addr_msw fields
  11076. * (out-of-band).
  11077. */
  11078. uint32_t direction;
  11079. /*
  11080. * Direction of the entity (matrix mixer or stream router) on which
  11081. * the parameter is to be set.
  11082. * values
  11083. * - 0 -- Rx (for Rx stream router or Rx matrix mixer)
  11084. * - 1 -- Tx (for Tx stream router or Tx matrix mixer)
  11085. */
  11086. uint32_t module_id;
  11087. /* Unique module ID. */
  11088. uint32_t param_id;
  11089. /* Unique parameter ID. */
  11090. uint32_t param_max_size;
  11091. };
  11092. struct asm_session_mtmx_strtr_param_session_time_v3_t {
  11093. uint32_t session_time_lsw;
  11094. /* Lower 32 bits of the current session time in microseconds */
  11095. uint32_t session_time_msw;
  11096. /*
  11097. * Upper 32 bits of the current session time in microseconds.
  11098. * The 64-bit number formed by session_time_lsw and session_time_msw
  11099. * is treated as signed.
  11100. */
  11101. uint32_t absolute_time_lsw;
  11102. /*
  11103. * Lower 32 bits of the 64-bit absolute time in microseconds.
  11104. * This is the time when the sample corresponding to the
  11105. * session_time_lsw is rendered to the hardware. This absolute
  11106. * time can be slightly in the future or past.
  11107. */
  11108. uint32_t absolute_time_msw;
  11109. /*
  11110. * Upper 32 bits of the 64-bit absolute time in microseconds.
  11111. * This is the time when the sample corresponding to the
  11112. * session_time_msw is rendered to hardware. This absolute
  11113. * time can be slightly in the future or past. The 64-bit number
  11114. * formed by absolute_time_lsw and absolute_time_msw is treated as
  11115. * unsigned.
  11116. */
  11117. uint32_t time_stamp_lsw;
  11118. /* Lower 32 bits of the last processed timestamp in microseconds */
  11119. uint32_t time_stamp_msw;
  11120. /*
  11121. * Upper 32 bits of the last processed timestamp in microseconds.
  11122. * The 64-bit number formed by time_stamp_lsw and time_stamp_lsw
  11123. * is treated as unsigned.
  11124. */
  11125. uint32_t flags;
  11126. /*
  11127. * Keeps track of any additional flags needed.
  11128. * @values{for bit 31}
  11129. * - 0 -- Uninitialized/invalid
  11130. * - 1 -- Valid
  11131. * All other bits are reserved; clients must set them to zero.
  11132. */
  11133. };
  11134. union asm_session_mtmx_strtr_data_type {
  11135. struct asm_session_mtmx_strtr_param_session_time_v3_t session_time;
  11136. };
  11137. struct asm_mtmx_strtr_get_params {
  11138. struct apr_hdr hdr;
  11139. struct asm_session_cmd_get_mtmx_strstr_params_v2 param_info;
  11140. } __packed;
  11141. struct asm_mtmx_strtr_get_params_cmdrsp {
  11142. uint32_t err_code;
  11143. struct param_hdr_v1 param_info;
  11144. union asm_session_mtmx_strtr_data_type param_data;
  11145. } __packed;
  11146. #define AUDPROC_MODULE_ID_RESAMPLER 0x00010719
  11147. enum {
  11148. LEGACY_PCM = 0,
  11149. COMPRESSED_PASSTHROUGH,
  11150. COMPRESSED_PASSTHROUGH_CONVERT,
  11151. COMPRESSED_PASSTHROUGH_DSD,
  11152. LISTEN,
  11153. COMPRESSED_PASSTHROUGH_GEN,
  11154. COMPRESSED_PASSTHROUGH_IEC61937
  11155. };
  11156. #define AUDPROC_MODULE_ID_COMPRESSED_MUTE 0x00010770
  11157. #define AUDPROC_PARAM_ID_COMPRESSED_MUTE 0x00010771
  11158. struct adm_set_compressed_device_mute {
  11159. u32 mute_on;
  11160. } __packed;
  11161. #define AUDPROC_MODULE_ID_COMPRESSED_LATENCY 0x0001076E
  11162. #define AUDPROC_PARAM_ID_COMPRESSED_LATENCY 0x0001076F
  11163. struct adm_set_compressed_device_latency {
  11164. u32 latency;
  11165. } __packed;
  11166. #define VOICEPROC_MODULE_ID_GENERIC_TX 0x00010EF6
  11167. #define VOICEPROC_MODULE_ID_FLUENCE_PRO_VC_TX 0x00010F35
  11168. #define VOICEPROC_PARAM_ID_FLUENCE_SOUNDFOCUS 0x00010E37
  11169. #define VOICEPROC_PARAM_ID_FLUENCE_SOURCETRACKING 0x00010E38
  11170. #define MAX_SECTORS 8
  11171. #define MAX_NOISE_SOURCE_INDICATORS 3
  11172. #define MAX_POLAR_ACTIVITY_INDICATORS 360
  11173. #define MAX_DOA_TRACKING_ANGLES 2
  11174. struct sound_focus_param {
  11175. uint16_t start_angle[MAX_SECTORS];
  11176. uint8_t enable[MAX_SECTORS];
  11177. uint16_t gain_step;
  11178. } __packed;
  11179. struct source_tracking_param {
  11180. uint8_t vad[MAX_SECTORS];
  11181. uint16_t doa_speech;
  11182. uint16_t doa_noise[MAX_NOISE_SOURCE_INDICATORS];
  11183. uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
  11184. } __packed;
  11185. struct doa_tracking_mon_param {
  11186. uint16_t target_angle_L16[MAX_DOA_TRACKING_ANGLES];
  11187. uint16_t interf_angle_L16[MAX_DOA_TRACKING_ANGLES];
  11188. uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
  11189. } __packed;
  11190. struct adm_param_fluence_soundfocus_t {
  11191. uint16_t start_angles[MAX_SECTORS];
  11192. uint8_t enables[MAX_SECTORS];
  11193. uint16_t gain_step;
  11194. uint16_t reserved;
  11195. } __packed;
  11196. struct adm_param_fluence_sourcetracking_t {
  11197. uint8_t vad[MAX_SECTORS];
  11198. uint16_t doa_speech;
  11199. uint16_t doa_noise[MAX_NOISE_SOURCE_INDICATORS];
  11200. uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
  11201. } __packed;
  11202. struct adm_param_doa_tracking_mon_t {
  11203. uint16_t target_angle_L16[MAX_DOA_TRACKING_ANGLES];
  11204. uint16_t interf_angle_L16[MAX_DOA_TRACKING_ANGLES];
  11205. uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
  11206. } __packed;
  11207. struct afe_doa_tracking_mon_get_param_resp {
  11208. uint32_t status;
  11209. struct param_hdr_v3 pdata;
  11210. struct doa_tracking_mon_param doa;
  11211. } __packed;
  11212. #define AUDPROC_MODULE_ID_AUDIOSPHERE 0x00010916
  11213. #define AUDPROC_PARAM_ID_AUDIOSPHERE_ENABLE 0x00010917
  11214. #define AUDPROC_PARAM_ID_AUDIOSPHERE_STRENGTH 0x00010918
  11215. #define AUDPROC_PARAM_ID_AUDIOSPHERE_CONFIG_MODE 0x00010919
  11216. #define AUDPROC_PARAM_ID_AUDIOSPHERE_COEFFS_STEREO_INPUT 0x0001091A
  11217. #define AUDPROC_PARAM_ID_AUDIOSPHERE_COEFFS_MULTICHANNEL_INPUT 0x0001091B
  11218. #define AUDPROC_PARAM_ID_AUDIOSPHERE_DESIGN_STEREO_INPUT 0x0001091C
  11219. #define AUDPROC_PARAM_ID_AUDIOSPHERE_DESIGN_MULTICHANNEL_INPUT 0x0001091D
  11220. #define AUDPROC_PARAM_ID_AUDIOSPHERE_OPERATING_INPUT_MEDIA_INFO 0x0001091E
  11221. #define AUDPROC_MODULE_ID_VOICE_TX_SECNS 0x10027059
  11222. #define AUDPROC_PARAM_IDX_SEC_PRIMARY_MIC_CH 0x10014444
  11223. #define AUDPROC_MODULE_ID_FFECNS 0x00010952
  11224. #define AUDPROC_MODULE_ID_FFNS 0x00010962
  11225. #define AUDPROC_PARAM_ID_FFV_DOA_TRACKING_PARAM 0x0001097C
  11226. /*
  11227. * ID of the DTMF Detection Module.
  11228. */
  11229. #define AUDPROC_MODULE_ID_DTMF_DETECTION 0x00010940
  11230. #define AUDPROC_PARAM_ID_FFV_DOA_TRACKING_MONITOR 0x0001097D
  11231. struct admx_sec_primary_mic_ch {
  11232. uint16_t version;
  11233. uint16_t reserved;
  11234. uint16_t sec_primary_mic_ch;
  11235. uint16_t reserved1;
  11236. } __packed;
  11237. #define FFECNS_MODULE_ID 0x00010952
  11238. #define FLUENCE_CMN_GLOBAL_EFFECT_PARAM_ID 0x00010EAF
  11239. #define FFECNS_TOPOLOGY 0X10028003
  11240. struct ffecns_effect {
  11241. uint32_t payload;
  11242. };
  11243. /** ID of the Voice Activity Detection (VAD) module, which is used to
  11244. * configure AFE VAD.
  11245. */
  11246. #define AFE_MODULE_VAD 0x000102B9
  11247. /** ID of the parameter used by #AFE_MODULE_VAD to configure the VAD.
  11248. */
  11249. #define AFE_PARAM_ID_VAD_CFG 0x000102BA
  11250. #define AFE_API_VERSION_VAD_CFG 0x1
  11251. /* Payload of the AFE_PARAM_ID_VAD_CONFIG parameter used by
  11252. * AFE_MODULE_VAD.
  11253. */
  11254. struct afe_param_id_vad_cfg_t {
  11255. uint32_t vad_cfg_minor_version;
  11256. /** Tracks the configuration of this parameter.
  11257. * Supported Values: #AFE_API_VERSION_VAD_CFG
  11258. */
  11259. uint32_t pre_roll_in_ms;
  11260. /** Pre-roll period in ms.
  11261. * Supported Values: 0x0 to 0x3E8
  11262. */
  11263. } __packed;
  11264. #define AFE_PARAM_ID_VAD_CORE_CFG 0x000102BB
  11265. /**
  11266. * This parameter is should be used to configure the AFE TDM
  11267. * interface lane configuration.
  11268. * Regular TDM interface ports:
  11269. * This parameter ID must be used with module ID
  11270. * AFE_MODULE_AUDIO_DEV_INTERFACE and set using the AFE_PORT_CMD_SET_PARAM_V3
  11271. * command for the AFE TDM interface port IDs.
  11272. * Group device TDM interface ports:
  11273. * This parameter ID must be used with module ID AFE_MODULE_GROUP_DEVICE
  11274. * and set using the AFE_SVC_CMD_SET_PARAM_V2 command for the AFE TDM group IDs.
  11275. */
  11276. #define AFE_PARAM_ID_TDM_LANE_CONFIG 0x000102C1
  11277. /* Payload of the AFE_PARAM_ID_TDM_LANE_CONFIG parameter used by
  11278. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  11279. */
  11280. struct afe_param_id_tdm_lane_cfg {
  11281. uint16_t port_id;
  11282. /** ID of the TDM interface.
  11283. * For regular TDM interfaces value corresponds to valid port ID.
  11284. * For group devices TDM interface value corresponds to valid group device ID.
  11285. */
  11286. uint16_t lane_mask;
  11287. /** Position of the active lanes. Bits 0 to N correspond to lanes 0 to N.
  11288. * 1 to 2^N-1 When a bit is set, the corresponding lane is active.
  11289. * The number of active lanes can be inferred from the number of bits
  11290. * set in the mask.
  11291. */
  11292. };
  11293. #endif /*_APR_AUDIO_V2_H_ */