apr_audio-v2.h 374 KB

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