apr_audio-v2.h 335 KB

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