apr_audio-v2.h 390 KB

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