apr_audio-v2.h 364 KB

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