apr_audio-v2.h 395 KB

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