apr_audio-v2.h 322 KB

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