apr_audio-v2.h 392 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290
  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 <audio/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_API_VERSION_TOPOLOGY_V1 0x1
  3360. struct afe_param_id_set_topology_cfg {
  3361. /*
  3362. * Minor version used for tracking afe topology id configuration.
  3363. * @values #AFE_API_VERSION_TOPOLOGY_V1
  3364. */
  3365. u32 minor_version;
  3366. /*
  3367. * Id of the topology for the afe session.
  3368. * @values Any valid AFE topology ID
  3369. */
  3370. u32 topology_id;
  3371. } __packed;
  3372. #define AFE_PARAM_ID_CODEC_DMA_DATA_ALIGN 0x000102EA
  3373. struct afe_param_id_cdc_dma_data_align {
  3374. uint32_t cdc_dma_data_align;
  3375. } __packed;
  3376. #define MAX_ABR_LEVELS 5
  3377. struct afe_bit_rate_level_map_t {
  3378. /*
  3379. * Key value pair for link quality level to bitrate
  3380. * mapping in AFE
  3381. */
  3382. uint32_t link_quality_level;
  3383. uint32_t bitrate;
  3384. } __packed;
  3385. struct afe_quality_level_to_bitrate_info {
  3386. /*
  3387. * Number of quality levels being mapped.
  3388. * This will be equal to the size of mapping table.
  3389. */
  3390. uint32_t num_levels;
  3391. /*
  3392. * Quality level to bitrate mapping table
  3393. */
  3394. struct afe_bit_rate_level_map_t bit_rate_level_map[MAX_ABR_LEVELS];
  3395. } __packed;
  3396. struct afe_imc_dec_enc_info {
  3397. /*
  3398. * Decoder to encoder communication direction.
  3399. * Transmit = 0 / Receive = 1
  3400. */
  3401. uint32_t direction;
  3402. /*
  3403. * Enable / disable IMC between decoder and encoder
  3404. */
  3405. uint32_t enable;
  3406. /*
  3407. * Purpose of IMC being set up between decoder and encoder.
  3408. * Param ID defined for link quality feedback in LPASS will
  3409. * be the default value sent as purpose.
  3410. * Supported values:
  3411. * AFE_ENCDEC_PURPOSE_ID_BT_INFO
  3412. */
  3413. uint32_t purpose;
  3414. /*
  3415. * Unique communication instance ID.
  3416. * Data type a2dp_abr_instance used to set instance ID.
  3417. * purpose and comm_instance together form the actual key
  3418. * used in IMC registration, which must be the same for
  3419. * encoder and decoder for which IMC is being set up.
  3420. */
  3421. uint32_t comm_instance;
  3422. } __packed;
  3423. struct afe_abr_dec_cfg_t {
  3424. struct afe_imc_dec_enc_info imc_info;
  3425. bool is_abr_enabled;
  3426. } __packed;
  3427. struct afe_abr_enc_cfg_t {
  3428. /*
  3429. * Link quality level to bitrate mapping info sent to DSP.
  3430. */
  3431. struct afe_quality_level_to_bitrate_info mapping_info;
  3432. /*
  3433. * Information to set up IMC between decoder and encoder.
  3434. */
  3435. struct afe_imc_dec_enc_info imc_info;
  3436. /*
  3437. * Flag to indicate whether ABR is enabled.
  3438. */
  3439. bool is_abr_enabled;
  3440. } __packed;
  3441. #define AFE_PARAM_ID_APTX_SYNC_MODE 0x00013205
  3442. struct afe_param_id_aptx_sync_mode {
  3443. /*
  3444. * sync mode: 0x0 = stereo sync mode (default)
  3445. * 0x01 = dual mono sync mode
  3446. * 0x02 = dual mono with no sync on either L or R
  3447. */
  3448. uint32_t sync_mode;
  3449. } __packed;
  3450. #define AFE_ID_APTX_ADAPTIVE_ENC_INIT 0x00013324
  3451. struct afe_id_aptx_adaptive_enc_init
  3452. {
  3453. uint32_t sampling_freq;
  3454. uint32_t mtu;
  3455. uint32_t channel_mode;
  3456. uint32_t min_sink_modeA;
  3457. uint32_t max_sink_modeA;
  3458. uint32_t min_sink_modeB;
  3459. uint32_t max_sink_modeB;
  3460. uint32_t min_sink_modeC;
  3461. uint32_t max_sink_modeC;
  3462. uint32_t mode;
  3463. uint32_t input_mode;
  3464. uint32_t fade_duration;
  3465. uint8_t sink_cap[11];
  3466. } __attribute__ ((packed));
  3467. /*
  3468. * Generic encoder module ID.
  3469. * This module supports the following parameter IDs:
  3470. * #AVS_ENCODER_PARAM_ID_ENC_FMT_ID (cannot be set run time)
  3471. * #AVS_ENCODER_PARAM_ID_ENC_CFG_BLK (may be set run time)
  3472. * #AVS_ENCODER_PARAM_ID_ENC_BITRATE (may be set run time)
  3473. * #AVS_ENCODER_PARAM_ID_PACKETIZER_ID (cannot be set run time)
  3474. * Opcode - AVS_MODULE_ID_ENCODER
  3475. * AFE Command AFE_PORT_CMD_SET_PARAM_V2 supports this module ID.
  3476. */
  3477. #define AFE_MODULE_ID_ENCODER 0x00013229
  3478. /* Macro for defining the packetizer ID: COP. */
  3479. #define AFE_MODULE_ID_PACKETIZER_COP 0x0001322A
  3480. /*
  3481. * Packetizer type parameter for the #AVS_MODULE_ID_ENCODER module.
  3482. * This parameter cannot be set runtime.
  3483. */
  3484. #define AFE_ENCODER_PARAM_ID_PACKETIZER_ID 0x0001322E
  3485. /*
  3486. * Encoder config block parameter for the #AVS_MODULE_ID_ENCODER module.
  3487. * This parameter may be set runtime.
  3488. */
  3489. #define AFE_ENCODER_PARAM_ID_ENC_CFG_BLK 0x0001322C
  3490. /*
  3491. * Encoder format ID parameter for the #AVS_MODULE_ID_ENCODER module.
  3492. * This parameter cannot be set runtime.
  3493. */
  3494. #define AFE_ENCODER_PARAM_ID_ENC_FMT_ID 0x0001322B
  3495. /*
  3496. * Decoder format ID parameter for the #AVS_MODULE_ID_DECODER module.
  3497. * This parameter cannot be set runtime.
  3498. */
  3499. #define AFE_DECODER_PARAM_ID_DEC_FMT_ID 0x00013234
  3500. /*
  3501. * Encoder scrambler parameter for the #AVS_MODULE_ID_ENCODER module.
  3502. * This parameter cannot be set runtime.
  3503. */
  3504. #define AFE_ENCODER_PARAM_ID_ENABLE_SCRAMBLING 0x0001323C
  3505. /*
  3506. * Link quality level to bitrate mapping info sent to AFE Encoder.
  3507. * This parameter may be set runtime.
  3508. */
  3509. #define AFE_ENCODER_PARAM_ID_BIT_RATE_LEVEL_MAP 0x000132E1
  3510. /*
  3511. * Parameter to set up Inter Module Communication (IMC) between
  3512. * AFE Decoder and Encoder.
  3513. * This parameter may be set runtime.
  3514. */
  3515. #define AFE_ENCDEC_PARAM_ID_DEC_TO_ENC_COMMUNICATION 0x0001323D
  3516. /*
  3517. * This is needed to be used only for SWB voice call use case.
  3518. * This is needed to be issued for each direction (RX AFE and TX AFE)
  3519. * along with AFE_PARAM_ID_PORT_MEDIA_TYPE
  3520. * (Issuing AF_PARAM_ID_RATE_MATCHED_PORT param alone is not useful).
  3521. */
  3522. #define AFE_PARAM_ID_RATE_MATCHED_PORT 0x000102BE
  3523. /*
  3524. * Purpose of IMC set up between encoder and decoder.
  3525. * Communication instance and purpose together form the
  3526. * actual key used for IMC registration.
  3527. */
  3528. #define AFE_ENCDEC_PURPOSE_ID_BT_INFO 0x000132E2
  3529. #define AFE_MODULE_ID_DECODER 0x00013231
  3530. /*
  3531. * Macro for defining the depacketizer ID: COP.
  3532. */
  3533. #define AFE_MODULE_ID_DEPACKETIZER_COP 0x00013233
  3534. #define AFE_MODULE_ID_DEPACKETIZER_COP_V1 0x000132E9
  3535. /* Macros for dynamic loading of modules by AVCS */
  3536. #define AVS_MODULE_ID_PACKETIZER_COP 0x0001322A
  3537. #define AVS_MODULE_ID_PACKETIZER_COP_V1 0x000132E8
  3538. #define AVS_MODULE_ID_DEPACKETIZER_COP 0x00013233
  3539. #define AVS_MODULE_ID_DEPACKETIZER_COP_V1 0x000132E9
  3540. /*
  3541. * Depacketizer type parameter for the #AVS_MODULE_ID_DECODER module.
  3542. * This parameter cannot be set runtime.
  3543. */
  3544. #define AFE_DECODER_PARAM_ID_DEPACKETIZER_ID 0x00013235
  3545. #define CAPI_V2_PARAM_ID_APTX_ENC_SWITCH_TO_MONO 0x0001332A
  3546. #define CAPI_V2_PARAM_ID_APTX_AD_ENC_SWITCH_TO_MONO 0x00013354
  3547. struct aptx_channel_mode_param_t {
  3548. u32 channel_mode;
  3549. } __packed;
  3550. /*
  3551. * Decoder buffer ID parameter for the #AVS_MODULE_ID_DECODER module.
  3552. * This parameter cannot be set runtime.
  3553. */
  3554. #define AFE_DECODER_PARAM_ID_CONGESTION_BUFFER_SIZE 0x000132ec
  3555. /*
  3556. * Data format to send compressed data
  3557. * is transmitted/received over Slimbus lines.
  3558. */
  3559. #define AFE_SB_DATA_FORMAT_GENERIC_COMPRESSED 0x3
  3560. /*
  3561. * Parameter to send frame control size
  3562. * to DSP for AAC encoder in AFE.
  3563. */
  3564. #define AFE_PARAM_ID_AAC_FRM_SIZE_CONTROL 0x000132EA
  3565. /*
  3566. * ID for AFE port module. This will be used to define port properties.
  3567. * This module supports following parameter IDs:
  3568. * #AFE_PARAM_ID_PORT_MEDIA_TYPE
  3569. * To configure the port property, the client must use the
  3570. * #AFE_PORT_CMD_SET_PARAM_V2 command,
  3571. * and fill the module ID with the respective parameter IDs as listed above.
  3572. * @apr_hdr_fields
  3573. * Opcode -- AFE_MODULE_PORT
  3574. */
  3575. #define AFE_MODULE_PORT 0x000102a6
  3576. /*
  3577. * ID of the parameter used by #AFE_MODULE_PORT to set the port media type.
  3578. * parameter ID is currently supported using#AFE_PORT_CMD_SET_PARAM_V2 command.
  3579. */
  3580. #define AFE_PARAM_ID_PORT_MEDIA_TYPE 0x000102a7
  3581. /*
  3582. * Macros for defining the "data_format" field in the
  3583. * #AFE_PARAM_ID_PORT_MEDIA_TYPE
  3584. */
  3585. #define AFE_PORT_DATA_FORMAT_PCM 0x0
  3586. #define AFE_PORT_DATA_FORMAT_GENERIC_COMPRESSED 0x1
  3587. /*
  3588. * Macro for defining the "minor_version" field in the
  3589. * #AFE_PARAM_ID_PORT_MEDIA_TYPE
  3590. */
  3591. #define AFE_API_VERSION_PORT_MEDIA_TYPE 0x1
  3592. #define ASM_MEDIA_FMT_NONE 0x0
  3593. /*
  3594. * Media format ID for SBC encode configuration.
  3595. * @par SBC encode configuration (asm_sbc_enc_cfg_t)
  3596. * @table{weak__asm__sbc__enc__cfg__t}
  3597. */
  3598. #define ASM_MEDIA_FMT_SBC 0x00010BF2
  3599. /* SBC channel Mono mode.*/
  3600. #define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_MONO 1
  3601. /* SBC channel Stereo mode. */
  3602. #define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_STEREO 2
  3603. /* SBC channel Dual Mono mode. */
  3604. #define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_DUAL_MONO 8
  3605. /* SBC channel Joint Stereo mode. */
  3606. #define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_JOINT_STEREO 9
  3607. /* SBC bit allocation method = loudness. */
  3608. #define ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_LOUDNESS 0
  3609. /* SBC bit allocation method = SNR. */
  3610. #define ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_SNR 1
  3611. /*
  3612. * Payload of the SBC encoder configuration parameters in the
  3613. * #ASM_MEDIA_FMT_SBC media format.
  3614. */
  3615. struct asm_sbc_enc_cfg_t {
  3616. /*
  3617. * Number of subbands.
  3618. * @values 4, 8
  3619. */
  3620. uint32_t num_subbands;
  3621. /*
  3622. * Size of the encoded block in samples.
  3623. * @values 4, 8, 12, 16
  3624. */
  3625. uint32_t blk_len;
  3626. /*
  3627. * Mode used to allocate bits between channels.
  3628. * @values
  3629. * 0 (Native mode)
  3630. * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_MONO
  3631. * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_STEREO
  3632. * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_DUAL_MONO
  3633. * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_JOINT_STEREO
  3634. * Native mode indicates that encoding must be performed with the number
  3635. * of channels at the input.
  3636. * If postprocessing outputs one-channel data, Mono mode is used. If
  3637. * postprocessing outputs two-channel data, Stereo mode is used.
  3638. * The number of channels must not change during encoding.
  3639. */
  3640. uint32_t channel_mode;
  3641. /*
  3642. * Encoder bit allocation method.
  3643. * @values
  3644. * #ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_LOUDNESS
  3645. * #ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_SNR @tablebulletend
  3646. */
  3647. uint32_t alloc_method;
  3648. /*
  3649. * Number of encoded bits per second.
  3650. * @values
  3651. * Mono channel -- Maximum of 320 kbps
  3652. * Stereo channel -- Maximum of 512 kbps @tablebulletend
  3653. */
  3654. uint32_t bit_rate;
  3655. /*
  3656. * Number of samples per second.
  3657. * @values 0 (Native mode), 16000, 32000, 44100, 48000&nbsp;Hz
  3658. * Native mode indicates that encoding must be performed with the
  3659. * sampling rate at the input.
  3660. * The sampling rate must not change during encoding.
  3661. */
  3662. uint32_t sample_rate;
  3663. };
  3664. #define ASM_MEDIA_FMT_AAC_AOT_LC 2
  3665. #define ASM_MEDIA_FMT_AAC_AOT_SBR 5
  3666. #define ASM_MEDIA_FMT_AAC_AOT_PS 29
  3667. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS 0
  3668. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW 3
  3669. struct asm_aac_enc_cfg_v2_t {
  3670. /* Encoding rate in bits per second.*/
  3671. uint32_t bit_rate;
  3672. /*
  3673. * Encoding mode.
  3674. * Supported values:
  3675. * #ASM_MEDIA_FMT_AAC_AOT_LC
  3676. * #ASM_MEDIA_FMT_AAC_AOT_SBR
  3677. * #ASM_MEDIA_FMT_AAC_AOT_PS
  3678. */
  3679. uint32_t enc_mode;
  3680. /*
  3681. * AAC format flag.
  3682. * Supported values:
  3683. * #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
  3684. * #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
  3685. */
  3686. uint16_t aac_fmt_flag;
  3687. /*
  3688. * Number of channels to encode.
  3689. * Supported values:
  3690. * 0 - Native mode
  3691. * 1 - Mono
  3692. * 2 - Stereo
  3693. * Other values are not supported.
  3694. * @note1hang The eAAC+ encoder mode supports only stereo.
  3695. * Native mode indicates that encoding must be performed with the
  3696. * number of channels at the input.
  3697. * The number of channels must not change during encoding.
  3698. */
  3699. uint16_t channel_cfg;
  3700. /*
  3701. * Number of samples per second.
  3702. * Supported values: - 0 -- Native mode - For other values,
  3703. * Native mode indicates that encoding must be performed with the
  3704. * sampling rate at the input.
  3705. * The sampling rate must not change during encoding.
  3706. */
  3707. uint32_t sample_rate;
  3708. } __packed;
  3709. /* Structure to control frame size of AAC encoded frames. */
  3710. struct asm_aac_frame_size_control_t {
  3711. /* Type of frame size control: MTU_SIZE / PEAK_BIT_RATE*/
  3712. uint32_t ctl_type;
  3713. /*
  3714. * Control value
  3715. * MTU_SIZE: MTU size in bytes
  3716. * PEAK_BIT_RATE: Peak bitrate in bits per second.
  3717. */
  3718. uint32_t ctl_value;
  3719. } __packed;
  3720. struct asm_aac_enc_cfg_t {
  3721. struct asm_aac_enc_cfg_v2_t aac_cfg;
  3722. struct asm_aac_frame_size_control_t frame_ctl;
  3723. struct asm_aac_frame_size_control_t frame_ctl_v2;
  3724. } __packed;
  3725. /* FMT ID for apt-X Classic */
  3726. #define ASM_MEDIA_FMT_APTX 0x000131ff
  3727. /* FMT ID for apt-X HD */
  3728. #define ASM_MEDIA_FMT_APTX_HD 0x00013200
  3729. /* FMT ID for apt-X Adaptive */
  3730. #define ASM_MEDIA_FMT_APTX_ADAPTIVE 0x00013204
  3731. /* FMT ID for apt-X Adaptive speech */
  3732. #define ASM_MEDIA_FMT_APTX_AD_SPEECH 0x00013208
  3733. #define PCM_CHANNEL_L 1
  3734. #define PCM_CHANNEL_R 2
  3735. #define PCM_CHANNEL_C 3
  3736. struct asm_custom_enc_cfg_t {
  3737. uint32_t sample_rate;
  3738. /* Mono or stereo */
  3739. uint16_t num_channels;
  3740. uint16_t reserved;
  3741. /* num_ch == 1, then PCM_CHANNEL_C,
  3742. * num_ch == 2, then {PCM_CHANNEL_L, PCM_CHANNEL_R}
  3743. */
  3744. uint8_t channel_mapping[8];
  3745. uint32_t custom_size;
  3746. } __packed;
  3747. struct asm_aptx_ad_speech_mode_cfg_t
  3748. {
  3749. uint32_t speech_mode;
  3750. /*
  3751. * speech mode of codec.
  3752. *
  3753. * @values 0x0(swb), 0x4(sswb)
  3754. */
  3755. uint32_t swapping;
  3756. /*
  3757. * byte swapping of codec.
  3758. *
  3759. * @values 0x1, enable swapping
  3760. */
  3761. } __packed;
  3762. struct asm_aptx_v2_enc_cfg_ext_t {
  3763. /*
  3764. * sync mode: 0x0 = stereo sync mode (default)
  3765. * 0x01 = dual mono sync mode
  3766. * 0x02 = dual mono with no sync on either L or R
  3767. */
  3768. uint32_t sync_mode;
  3769. } __packed;
  3770. struct asm_aptx_enc_cfg_t {
  3771. struct asm_custom_enc_cfg_t custom_cfg;
  3772. struct asm_aptx_v2_enc_cfg_ext_t aptx_v2_cfg;
  3773. } __packed;
  3774. struct asm_aptx_ad_enc_cfg_t
  3775. {
  3776. struct asm_custom_enc_cfg_t custom_cfg;
  3777. struct afe_id_aptx_adaptive_enc_init aptx_ad_cfg;
  3778. struct afe_abr_enc_cfg_t abr_cfg;
  3779. } __attribute__ ((packed));
  3780. struct asm_aptx_ad_speech_enc_cfg_t
  3781. {
  3782. struct asm_custom_enc_cfg_t custom_cfg;
  3783. struct afe_imc_dec_enc_info imc_info;
  3784. struct asm_aptx_ad_speech_mode_cfg_t speech_mode;
  3785. } __attribute__ ((packed));
  3786. struct afe_matched_port_t
  3787. {
  3788. uint32_t minor_version;
  3789. uint32_t enable;
  3790. } __attribute__ ((packed));
  3791. #define ASM_MEDIA_FMT_CELT 0x00013221
  3792. struct asm_celt_specific_enc_cfg_t {
  3793. /*
  3794. * Bit rate used for encoding.
  3795. * This is used to calculate the upper threshold
  3796. * for bytes per frame if vbr_flag is 1.
  3797. * Or else, this will be used as a regular constant
  3798. * bit rate for encoder output.
  3799. * @Range : 32000 to 1536000
  3800. * @Default: 128
  3801. */
  3802. uint32_t bit_rate;
  3803. /*
  3804. * Frame size used for encoding.
  3805. * @Range : 64, 128, 256, 512
  3806. * @Default: 256
  3807. */
  3808. uint16_t frame_size;
  3809. /*
  3810. * complexity of algorithm.
  3811. * @Range : 0-10
  3812. * @Default: 3
  3813. */
  3814. uint16_t complexity;
  3815. /*
  3816. * Switch variable for prediction feature.
  3817. * Used to choose between the level of interframe
  3818. * predictions allowed while encoding.
  3819. * @Range:
  3820. * 0: Independent Frames.
  3821. * 1: Short Term interframe prediction allowed.
  3822. * 2: Long term prediction allowed.
  3823. * @Default: 2
  3824. */
  3825. uint16_t prediction_mode;
  3826. /*
  3827. * Variable Bit Rate flag.
  3828. * @Default: 0
  3829. */
  3830. uint16_t vbr_flag;
  3831. } __packed;
  3832. struct asm_celt_enc_cfg_t {
  3833. struct asm_custom_enc_cfg_t custom_config;
  3834. struct asm_celt_specific_enc_cfg_t celt_specific_config;
  3835. } __packed;
  3836. #define ASM_MEDIA_FMT_LDAC 0x00013224
  3837. #define ENC_CODEC_TYPE_LDAC 0x23000000
  3838. struct asm_ldac_specific_enc_cfg_t {
  3839. /*
  3840. * This is used to calculate the encoder output
  3841. * bytes per frame (i.e. bytes per packet).
  3842. * Bit rate also configures the EQMID.
  3843. * The min bit rate 303000 bps is calculated for
  3844. * 44.1 kHz and 88.2 KHz sampling frequencies with
  3845. * Mobile use Quality.
  3846. * The max bit rate of 990000 bps is calculated for
  3847. * 96kHz and 48 KHz with High Quality
  3848. * @Range(in bits per second)
  3849. * 303000 for Mobile use Quality
  3850. * 606000 for standard Quality
  3851. * 909000 for High Quality
  3852. */
  3853. uint32_t bit_rate;
  3854. /*
  3855. * The channel setting information for LDAC specification
  3856. * of Bluetooth A2DP which is determined by SRC and SNK
  3857. * devices in Bluetooth transmission.
  3858. * @Range:
  3859. * 0 for native mode
  3860. * 4 for mono
  3861. * 2 for dual channel
  3862. * 1 for stereo
  3863. */
  3864. uint16_t channel_mode;
  3865. /*
  3866. * Maximum Transmission Unit (MTU).
  3867. * The minimum MTU that a L2CAP implementation for LDAC shall
  3868. * support is 679 bytes, because LDAC is optimized with 2-DH5
  3869. * packet as its target.
  3870. * @Range : 679
  3871. * @Default: 679 for LDACBT_MTU_2DH5
  3872. */
  3873. uint16_t mtu;
  3874. } __packed;
  3875. struct asm_ldac_enc_cfg_t {
  3876. struct asm_custom_enc_cfg_t custom_config;
  3877. struct asm_ldac_specific_enc_cfg_t ldac_specific_config;
  3878. struct afe_abr_enc_cfg_t abr_config;
  3879. } __packed;
  3880. struct afe_enc_fmt_id_param_t {
  3881. /*
  3882. * Supported values:
  3883. * #ASM_MEDIA_FMT_SBC
  3884. * #ASM_MEDIA_FMT_AAC_V2
  3885. * Any OpenDSP supported values
  3886. */
  3887. uint32_t fmt_id;
  3888. } __packed;
  3889. struct afe_port_media_type_t {
  3890. /*
  3891. * Minor version
  3892. * @values #AFE_API_VERSION_PORT_MEDIA_TYPE.
  3893. */
  3894. uint32_t minor_version;
  3895. /*
  3896. * Sampling rate of the port.
  3897. * @values
  3898. * #AFE_PORT_SAMPLE_RATE_8K
  3899. * #AFE_PORT_SAMPLE_RATE_11_025K
  3900. * #AFE_PORT_SAMPLE_RATE_12K
  3901. * #AFE_PORT_SAMPLE_RATE_16K
  3902. * #AFE_PORT_SAMPLE_RATE_22_05K
  3903. * #AFE_PORT_SAMPLE_RATE_24K
  3904. * #AFE_PORT_SAMPLE_RATE_32K
  3905. * #AFE_PORT_SAMPLE_RATE_44_1K
  3906. * #AFE_PORT_SAMPLE_RATE_48K
  3907. * #AFE_PORT_SAMPLE_RATE_88_2K
  3908. * #AFE_PORT_SAMPLE_RATE_96K
  3909. * #AFE_PORT_SAMPLE_RATE_176_4K
  3910. * #AFE_PORT_SAMPLE_RATE_192K
  3911. * #AFE_PORT_SAMPLE_RATE_352_8K
  3912. * #AFE_PORT_SAMPLE_RATE_384K
  3913. */
  3914. uint32_t sample_rate;
  3915. /*
  3916. * Bit width of the sample.
  3917. * @values 16, 24
  3918. */
  3919. uint16_t bit_width;
  3920. /*
  3921. * Number of channels.
  3922. * @values 1 to #AFE_PORT_MAX_AUDIO_CHAN_CNT
  3923. */
  3924. uint16_t num_channels;
  3925. /*
  3926. * Data format supported by this port.
  3927. * If the port media type and device media type are different,
  3928. * it signifies a encoding/decoding use case
  3929. * @values
  3930. * #AFE_PORT_DATA_FORMAT_PCM
  3931. * #AFE_PORT_DATA_FORMAT_GENERIC_COMPRESSED
  3932. */
  3933. uint16_t data_format;
  3934. /*This field must be set to zero.*/
  3935. uint16_t reserved;
  3936. } __packed;
  3937. /*
  3938. * Payload of the SBC decoder configuration parameters in the
  3939. * #ASM_MEDIA_FMT_SBC media format.
  3940. */
  3941. struct asm_sbc_dec_cfg_t {
  3942. uint16_t channels;
  3943. /*
  3944. * Number of channels present in the SBC stream.
  3945. *
  3946. * @values
  3947. * - 1 -- Mono
  3948. * - 2 -- Stereo
  3949. */
  3950. uint32_t sample_rate;
  3951. /*
  3952. * Number of samples per second.
  3953. *
  3954. * @values 8000, 11025, 12000, 16000, 22050, 24000, 32000,
  3955. * 44100, 48000, 64000, 88200, 96000 Hz
  3956. */
  3957. } __packed;
  3958. /*
  3959. * Payload of the MP3 decoder configuration parameters in the
  3960. * #ASM_MEDIA_FMT_MP3 media format.
  3961. */
  3962. struct asm_mp3_dec_cfg_t {
  3963. /* All configuration is extracted from the stream */
  3964. } __packed;
  3965. struct asm_aac_dec_cfg_v2_t {
  3966. uint16_t aac_fmt_flag;
  3967. /*
  3968. * Bit stream format option.
  3969. *
  3970. * @values
  3971. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
  3972. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS
  3973. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF
  3974. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
  3975. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LATM
  3976. */
  3977. uint16_t audio_obj_type;
  3978. /*
  3979. * Audio Object Type (AOT) present in the AAC stream.
  3980. *
  3981. * @values
  3982. * - #ASM_MEDIA_FMT_AAC_AOT_LC
  3983. * - #ASM_MEDIA_FMT_AAC_AOT_SBR
  3984. * - #ASM_MEDIA_FMT_AAC_AOT_BSAC
  3985. * - #ASM_MEDIA_FMT_AAC_AOT_PS
  3986. *
  3987. * Other values are not supported.
  3988. */
  3989. uint16_t channel_config;
  3990. /*
  3991. * Number of channels present in the AAC stream.
  3992. *
  3993. * @values
  3994. * - 0 -- PCE
  3995. * - 1 -- Mono
  3996. * - 2 -- Stereo
  3997. * - 6 -- 5.1 content
  3998. */
  3999. uint16_t total_size_of_PCE_bits;
  4000. /*
  4001. * For RAW formats and if channel_config=0 (PCE),
  4002. * the client can send the bit stream containing PCE
  4003. * immediately following this structure (in band).
  4004. *
  4005. * @values @ge 0 (does not include the bits required
  4006. * for 32-bit alignment)
  4007. *
  4008. * If this field is set to 0, the PCE information is
  4009. * assumed to be available in the audio bit stream
  4010. * and not in band.
  4011. *
  4012. * If this field is greater than 0, the PCE information
  4013. * follows this structure. Additional bits might
  4014. * be required for 32-bit alignment.
  4015. */
  4016. uint32_t sample_rate;
  4017. /*
  4018. * Number of samples per second.
  4019. *
  4020. * @values 8000, 11025, 12000, 16000, 22050, 24000, 32000,
  4021. * 44100, 48000, 64000, 88200, 96000 Hz
  4022. *
  4023. * This field must be equal to the sample rate of the
  4024. * AAC-LC decoder output.
  4025. * - For MP4 or 3GP containers, this sample rate
  4026. * is indicated by the
  4027. * samplingFrequencyIndex field in the
  4028. * AudioSpecificConfig element.
  4029. * - For ADTS format, this sample rate is indicated by the
  4030. * samplingFrequencyIndex in the ADTS fixed header.
  4031. * - For ADIF format, this sample rate is indicated by the
  4032. * samplingFrequencyIndex in the program_config_element
  4033. * present in the ADIF header.
  4034. */
  4035. } __packed;
  4036. /*
  4037. * Payload of the APTX AD decoder configuration parameters in the
  4038. * #ASM_MEDIA_FMT_APTX_ADAPTIVE media format.
  4039. */
  4040. struct asm_aptx_ad_dec_cfg_t {
  4041. uint32_t sample_rate;
  4042. /*
  4043. * Number of samples per second.
  4044. *
  4045. * @values 0x0(48000Hz), 0x1(44100Hz)
  4046. */
  4047. } __packed;
  4048. struct asm_aptx_ad_speech_dec_cfg_t {
  4049. struct asm_aptx_ad_speech_mode_cfg_t speech_mode;
  4050. };
  4051. union afe_enc_config_data {
  4052. struct asm_sbc_enc_cfg_t sbc_config;
  4053. struct asm_aac_enc_cfg_t aac_config;
  4054. struct asm_custom_enc_cfg_t custom_config;
  4055. struct asm_celt_enc_cfg_t celt_config;
  4056. struct asm_aptx_enc_cfg_t aptx_config;
  4057. struct asm_ldac_enc_cfg_t ldac_config;
  4058. struct asm_aptx_ad_enc_cfg_t aptx_ad_config;
  4059. struct asm_aptx_ad_speech_enc_cfg_t aptx_ad_speech_config;
  4060. };
  4061. struct afe_enc_config {
  4062. u32 format;
  4063. u32 scrambler_mode;
  4064. u32 mono_mode;
  4065. union afe_enc_config_data data;
  4066. };
  4067. /*
  4068. * Enable TTP generator in AFE.
  4069. */
  4070. #define AVS_DEPACKETIZER_PARAM_ID_TTP_GEN_STATE 0x000132EF
  4071. /*
  4072. * Configure TTP generator params in AFE.
  4073. */
  4074. #define AVS_DEPACKETIZER_PARAM_ID_TTP_GEN_CFG 0x000132F0
  4075. #define MAX_TTP_OFFSET_PAIRS 4
  4076. struct afe_ttp_gen_enable_t {
  4077. uint16_t enable;
  4078. uint16_t reserved;
  4079. } __packed;
  4080. struct afe_ttp_ssrc_offset_pair_t {
  4081. uint32_t ssrc;
  4082. uint32_t offset;
  4083. } __packed;
  4084. struct afe_ttp_gen_cfg_t {
  4085. uint32_t ttp_offset_default;
  4086. /*
  4087. * TTP offset uses for all other cases
  4088. * where no valid SSRC is received.
  4089. */
  4090. uint32_t settling_time;
  4091. /*
  4092. * If settling_mode==0x00: time in [us]
  4093. * after first received packet until
  4094. * packets are no longer dropped.
  4095. */
  4096. uint16_t settling_mode;
  4097. /*
  4098. * 0x00(Drop), 0x01(Settle)
  4099. */
  4100. uint16_t num_ssrc_offsets;
  4101. /*
  4102. * Number of SSRC/TTPOFFSET pairs to follow
  4103. */
  4104. struct afe_ttp_ssrc_offset_pair_t ssrc_ttp_offset[MAX_TTP_OFFSET_PAIRS];
  4105. /*
  4106. * Array of ssrc/offset pairs
  4107. */
  4108. } __packed;
  4109. struct afe_ttp_config {
  4110. struct afe_ttp_gen_enable_t ttp_gen_enable;
  4111. struct afe_ttp_gen_cfg_t ttp_gen_cfg;
  4112. };
  4113. union afe_dec_config_data {
  4114. struct asm_sbc_dec_cfg_t sbc_config;
  4115. struct asm_aac_dec_cfg_v2_t aac_config;
  4116. struct asm_mp3_dec_cfg_t mp3_config;
  4117. struct asm_aptx_ad_dec_cfg_t aptx_ad_config;
  4118. struct asm_aptx_ad_speech_dec_cfg_t aptx_ad_speech_config;
  4119. };
  4120. struct afe_dec_config {
  4121. u32 format;
  4122. struct afe_abr_dec_cfg_t abr_dec_cfg;
  4123. union afe_dec_config_data data;
  4124. };
  4125. struct afe_enc_cfg_blk_param_t {
  4126. uint32_t enc_cfg_blk_size;
  4127. /*
  4128. *Size of the encoder configuration block that follows this member
  4129. */
  4130. union afe_enc_config_data enc_blk_config;
  4131. };
  4132. struct afe_enc_aptx_ad_speech_cfg_blk_param_t {
  4133. uint32_t enc_cfg_blk_size;
  4134. /*
  4135. * Size of the encoder configuration block that follows this member
  4136. */
  4137. struct asm_custom_enc_cfg_t custom_cfg;
  4138. };
  4139. /*
  4140. * Payload of the AVS_DECODER_PARAM_ID_DEC_MEDIA_FMT parameter used by
  4141. * AVS_MODULE_ID_DECODER.
  4142. */
  4143. struct afe_dec_media_fmt_t {
  4144. union afe_dec_config_data dec_media_config;
  4145. } __packed;
  4146. /*
  4147. * Payload of the AVS_ENCODER_PARAM_ID_PACKETIZER_ID parameter.
  4148. */
  4149. struct avs_enc_packetizer_id_param_t {
  4150. /*
  4151. * Supported values:
  4152. * #AVS_MODULE_ID_PACKETIZER_COP
  4153. * Any OpenDSP supported values
  4154. */
  4155. uint32_t enc_packetizer_id;
  4156. };
  4157. /*
  4158. * Payload of the AVS_ENCODER_PARAM_ID_ENABLE_SCRAMBLING parameter.
  4159. */
  4160. struct avs_enc_set_scrambler_param_t {
  4161. /*
  4162. * Supported values:
  4163. * 1 : enable scrambler
  4164. * 0 : disable scrambler
  4165. */
  4166. uint32_t enable_scrambler;
  4167. };
  4168. /*
  4169. * Payload of the AVS_ENCODER_PARAM_ID_BIT_RATE_LEVEL_MAP parameter.
  4170. */
  4171. struct afe_enc_level_to_bitrate_map_param_t {
  4172. /*
  4173. * Parameter for mapping link quality level to bitrate.
  4174. */
  4175. struct afe_quality_level_to_bitrate_info mapping_table;
  4176. };
  4177. /*
  4178. * Payload of the AVS_ENCDEC_PARAM_ID_DEC_TO_ENC_COMMUNICATION parameter.
  4179. */
  4180. struct afe_enc_dec_imc_info_param_t {
  4181. /*
  4182. * Parameter to set up Inter Module Communication (IMC) between
  4183. * AFE Decoder and Encoder.
  4184. */
  4185. struct afe_imc_dec_enc_info imc_info;
  4186. };
  4187. /*
  4188. * Payload of the AVS_DECODER_PARAM_ID_DEPACKETIZER_ID parameter.
  4189. */
  4190. struct avs_dec_depacketizer_id_param_t {
  4191. /*
  4192. * Supported values:
  4193. * #AFE_MODULE_ID_DEPACKETIZER_COP
  4194. * #AFE_MODULE_ID_DEPACKETIZER_COP_V1
  4195. * Any OpenDSP supported values
  4196. */
  4197. uint32_t dec_depacketizer_id;
  4198. };
  4199. struct avs_dec_congestion_buffer_param_t {
  4200. uint32_t version;
  4201. uint16_t max_nr_buffers;
  4202. /*
  4203. * Maximum number of 1ms buffers:
  4204. * 0 - 256
  4205. */
  4206. uint16_t pre_buffer_size;
  4207. /*
  4208. * Pre-buffering size in 1ms:
  4209. * 1 - 128
  4210. */
  4211. };
  4212. /*
  4213. * ID of the parameter used by #AVS_MODULE_ID_DECODER to configure
  4214. * the decoder mode for the AFE module.
  4215. * This parameter cannot be set at runtime.
  4216. */
  4217. #define AVS_DECODER_PARAM_ID_DEC_MEDIA_FMT 0x00013232
  4218. /*
  4219. * ID of the parameter used by #AVS_MODULE_ID_DECODER to configure
  4220. * the decoder mode of adaptive speech and byte swap mode
  4221. */
  4222. #define AVS_DECODER_PARAM_ID_APTX_AD_SPEECH_DEC_INIT 0x0001334D
  4223. /*
  4224. * ID of the parameter used by #AVS_MODULE_ID_ENCODER to configure
  4225. * the encoder mode of adaptive speech and byte swap mode
  4226. */
  4227. #define AVS_DECODER_PARAM_ID_APTX_AD_SPEECH_ENC_INIT 0x0001332B
  4228. /* ID of the parameter used by #AFE_MODULE_AUDIO_DEV_INTERFACE to configure
  4229. * the island mode for a given AFE port.
  4230. */
  4231. #define AFE_PARAM_ID_ISLAND_CONFIG 0x000102B4
  4232. /* Version information used to handle future additions to codec DMA
  4233. * configuration (for backward compatibility).
  4234. */
  4235. #define AFE_API_VERSION_ISLAND_CONFIG 0x1
  4236. /* Payload of the AFE_PARAM_ID_ISLAND_CONFIG parameter used by
  4237. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  4238. */
  4239. #define AFE_PARAM_ID_POWER_MODE_CONFIG 0x0002002c
  4240. #define AFE_API_VERSION_POWER_MODE_CONFIG 0x1
  4241. struct afe_param_id_island_cfg_t {
  4242. uint32_t island_cfg_minor_version;
  4243. /* Tracks the configuration of this parameter.
  4244. * Supported values: #AFE_API_VERSION_ISLAND_CONFIG
  4245. */
  4246. uint32_t island_enable;
  4247. /* Specifies whether island mode should be enabled or disabled for the
  4248. * use-case being setup.
  4249. * Supported values: 0 - Disable, 1 - Enable
  4250. */
  4251. } __packed;
  4252. struct afe_param_id_power_mode_cfg_t {
  4253. uint32_t power_mode_cfg_minor_version;
  4254. /* Tracks the configuration of this parameter
  4255. * Supported values: #AFE_API_VERSION_POWER_MODE_CONFIG
  4256. */
  4257. uint32_t power_mode_enable;
  4258. /* Specifies whether island mode should be enabled or disabled for the
  4259. * use-case being setup.
  4260. * Supported values: 0 - Disable, 1 - Enable
  4261. */
  4262. } __packed;
  4263. /* ID of the parameter used by #AFE_MODULE_AUDIO_DEV_INTERFACE to configure
  4264. * the Codec DMA interface.
  4265. */
  4266. #define AFE_PARAM_ID_CODEC_DMA_CONFIG 0x000102B8
  4267. /* Version information used to handle future additions to codec DMA
  4268. * configuration (for backward compatibility).
  4269. */
  4270. #define AFE_API_VERSION_CODEC_DMA_CONFIG 0x1
  4271. /* Payload of the AFE_PARAM_ID_CODEC_DMA_CONFIG parameter used by
  4272. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  4273. */
  4274. struct afe_param_id_cdc_dma_cfg_t {
  4275. uint32_t cdc_dma_cfg_minor_version;
  4276. /* Tracks the configuration of this parameter.
  4277. * Supported values: #AFE_API_VERSION_CODEC_DMA_CONFIG
  4278. */
  4279. uint32_t sample_rate;
  4280. /* Sampling rate of the port.
  4281. * Supported values:
  4282. * - #AFE_PORT_SAMPLE_RATE_8K
  4283. * - #AFE_PORT_SAMPLE_RATE_11_025K
  4284. * - #AFE_PORT_SAMPLE_RATE_12K
  4285. * - #AFE_PORT_SAMPLE_RATE_16K
  4286. * - #AFE_PORT_SAMPLE_RATE_22_05K
  4287. * - #AFE_PORT_SAMPLE_RATE_24K
  4288. * - #AFE_PORT_SAMPLE_RATE_32K
  4289. * - #AFE_PORT_SAMPLE_RATE_44_1K
  4290. * - #AFE_PORT_SAMPLE_RATE_48K
  4291. * - #AFE_PORT_SAMPLE_RATE_88_2K
  4292. * - #AFE_PORT_SAMPLE_RATE_96K
  4293. * - #AFE_PORT_SAMPLE_RATE_176_4K
  4294. * - #AFE_PORT_SAMPLE_RATE_192K
  4295. * - #AFE_PORT_SAMPLE_RATE_352_8K
  4296. * - #AFE_PORT_SAMPLE_RATE_384K
  4297. */
  4298. uint16_t bit_width;
  4299. /* Bit width of the sample.
  4300. * Supported values: 16, 24, 32
  4301. */
  4302. uint16_t data_format;
  4303. /* Data format supported by the codec DMA interface.
  4304. * Supported values:
  4305. * - #AFE_LINEAR_PCM_DATA
  4306. * - #AFE_LINEAR_PCM_DATA_PACKED_16BIT
  4307. */
  4308. uint16_t num_channels;
  4309. /* Number of channels.
  4310. * Supported values: 1 to Maximum number of channels supported
  4311. * for each interface
  4312. */
  4313. uint16_t active_channels_mask;
  4314. /* Active channels mask to denote the bit mask for active channels.
  4315. * Bits 0 to 7 denote channels 0 to 7. A 1 denotes the channel is active
  4316. * while a 0 denotes a channel is inactive.
  4317. * Supported values:
  4318. * Any mask with number of active bits equal to num_channels
  4319. */
  4320. } __packed;
  4321. union afe_port_config {
  4322. struct afe_param_id_pcm_cfg pcm;
  4323. struct afe_param_id_i2s_cfg i2s;
  4324. struct afe_param_id_meta_i2s_cfg meta_i2s;
  4325. struct afe_param_id_hdmi_multi_chan_audio_cfg hdmi_multi_ch;
  4326. struct afe_param_id_slimbus_cfg slim_sch;
  4327. struct afe_param_id_rt_proxy_port_cfg rtproxy;
  4328. struct afe_param_id_internal_bt_fm_cfg int_bt_fm;
  4329. struct afe_param_id_pseudo_port_cfg pseudo_port;
  4330. struct afe_param_id_device_hw_delay_cfg hw_delay;
  4331. struct afe_param_id_spdif_cfg_v2 spdif;
  4332. struct afe_param_id_set_topology_cfg topology;
  4333. struct afe_param_id_tdm_cfg tdm;
  4334. struct afe_param_id_usb_audio_cfg usb_audio;
  4335. struct afe_param_id_aptx_sync_mode sync_mode_param;
  4336. struct asm_aac_frame_size_control_t frame_ctl_param;
  4337. struct afe_enc_fmt_id_param_t enc_fmt;
  4338. struct afe_port_media_type_t media_type;
  4339. struct afe_enc_cfg_blk_param_t enc_blk_param;
  4340. struct avs_enc_packetizer_id_param_t enc_pkt_id_param;
  4341. struct avs_enc_set_scrambler_param_t enc_set_scrambler_param;
  4342. struct avs_dec_depacketizer_id_param_t dec_depkt_id_param;
  4343. struct afe_dec_media_fmt_t dec_media_fmt;
  4344. struct afe_enc_level_to_bitrate_map_param_t map_param;
  4345. struct afe_enc_dec_imc_info_param_t imc_info_param;
  4346. struct afe_param_id_cdc_dma_cfg_t cdc_dma;
  4347. } __packed;
  4348. /*
  4349. * AFE event registration related APIs and corresponding payloads
  4350. */
  4351. #define AFE_SVC_CMD_EVENT_CFG 0x000100FE
  4352. #define AFE_CMD_APPS_WAKEUP_IRQ_REGISTER_MINOR_VERSION 0x1
  4353. /* Flag to indicate AFE to register APPS wakeup Interrupt */
  4354. #define AFE_APPS_WAKEUP_IRQ_REGISTER_FLAG 1
  4355. /* Flag to indicate AFE to de-register APPS wakeup Interrupt */
  4356. #define AFE_APPS_WAKEUP_IRQ_DEREGISTER_FLAG 0
  4357. /* Default interrupt trigger value. */
  4358. #define DEFAULT_SETTINGS 0x00000001
  4359. /* Interrupt is triggered only if the input signal at the source is high. */
  4360. #define LEVEL_HIGH_TRIGGER 0x00000002
  4361. /* Interrupt is triggered only if the input signal at the source is low. */
  4362. #define LEVEL_LOW_TRIGGER 0x00000003
  4363. /* Interrupt is triggered only if the input signal at the source transitions
  4364. *from low to high.
  4365. */
  4366. #define RISING_EDGE_TRIGGER 0x00000004
  4367. /* Interrupt is triggered only if the input signal at the source transitions
  4368. *from high to low.
  4369. */
  4370. #define FALLING_EDGE_TRIGGER 0x00000005
  4371. /* Macro for invalid trigger type. This should not be used. */
  4372. #define INVALID_TRIGGER 0x00000006
  4373. #define AFE_EVENT_ID_MBHC_DETECTION_SW_WA 0x1
  4374. /* @weakgroup weak_afe_svc_cmd_evt_cfg_payload
  4375. *
  4376. * This is payload of each event that is to be
  4377. * registered with AFE service.
  4378. */
  4379. struct afe_svc_cmd_evt_cfg_payload {
  4380. struct apr_hdr hdr;
  4381. uint32_t event_id;
  4382. /* Unique ID of the event.
  4383. *
  4384. * @values
  4385. * -# AFE_EVENT_ID_MBHC_DETECTION_SW_WA
  4386. */
  4387. uint32_t reg_flag;
  4388. /* Flag for registering or de-registering an event.
  4389. * @values
  4390. * - #AFE_SVC_REGISTER_EVENT_FLAG
  4391. * - #AFE_SVC_DEREGISTER_EVENT_FLAG
  4392. */
  4393. } __packed;
  4394. #define AFE_EVENT_MBHC_DETECTION_SW_WA 0x0001010F
  4395. #define AFE_PORT_CMD_DEVICE_START 0x000100E5
  4396. /* Payload of the #AFE_PORT_CMD_DEVICE_START.*/
  4397. struct afe_port_cmd_device_start {
  4398. struct apr_hdr hdr;
  4399. u16 port_id;
  4400. /* Port interface and direction (Rx or Tx) to start. An even
  4401. * number represents the Rx direction, and an odd number represents
  4402. * the Tx direction.
  4403. */
  4404. u16 reserved;
  4405. /* Reserved for 32-bit alignment. This field must be set to 0.*/
  4406. } __packed;
  4407. #define AFE_PORT_CMD_DEVICE_STOP 0x000100E6
  4408. /* Payload of the #AFE_PORT_CMD_DEVICE_STOP. */
  4409. struct afe_port_cmd_device_stop {
  4410. struct apr_hdr hdr;
  4411. u16 port_id;
  4412. /* Port interface and direction (Rx or Tx) to start. An even
  4413. * number represents the Rx direction, and an odd number represents
  4414. * the Tx direction.
  4415. */
  4416. u16 reserved;
  4417. /* Reserved for 32-bit alignment. This field must be set to 0.*/
  4418. } __packed;
  4419. #define AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS 0x000100EA
  4420. /* Memory map regions command payload used by the
  4421. * #AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS .
  4422. * This structure allows clients to map multiple shared memory
  4423. * regions in a single command. Following this structure are
  4424. * num_regions of afe_service_shared_map_region_payload.
  4425. */
  4426. struct afe_service_cmd_shared_mem_map_regions {
  4427. struct apr_hdr hdr;
  4428. u16 mem_pool_id;
  4429. /* Type of memory on which this memory region is mapped.
  4430. * Supported values:
  4431. * - #ADSP_MEMORY_MAP_EBI_POOL
  4432. * - #ADSP_MEMORY_MAP_SMI_POOL
  4433. * - #ADSP_MEMORY_MAP_SHMEM8_4K_POOL
  4434. * - Other values are reserved
  4435. *
  4436. * The memory pool ID implicitly defines the characteristics of the
  4437. * memory. Characteristics may include alignment type, permissions,
  4438. * etc.
  4439. *
  4440. * ADSP_MEMORY_MAP_EBI_POOL is External Buffer Interface type memory
  4441. * ADSP_MEMORY_MAP_SMI_POOL is Shared Memory Interface type memory
  4442. * ADSP_MEMORY_MAP_SHMEM8_4K_POOL is shared memory, byte
  4443. * addressable, and 4 KB aligned.
  4444. */
  4445. u16 num_regions;
  4446. /* Number of regions to map.
  4447. * Supported values:
  4448. * - Any value greater than zero
  4449. */
  4450. u32 property_flag;
  4451. /* Configures one common property for all the regions in the
  4452. * payload.
  4453. *
  4454. * Supported values: - 0x00000000 to 0x00000001
  4455. *
  4456. * b0 - bit 0 indicates physical or virtual mapping 0 Shared memory
  4457. * address provided in afe_service_shared_map_region_payloadis a
  4458. * physical address. The shared memory needs to be mapped( hardware
  4459. * TLB entry) and a software entry needs to be added for internal
  4460. * book keeping.
  4461. *
  4462. * 1 Shared memory address provided in
  4463. * afe_service_shared_map_region_payloadis a virtual address. The
  4464. * shared memory must not be mapped (since hardware TLB entry is
  4465. * already available) but a software entry needs to be added for
  4466. * internal book keeping. This can be useful if two services with in
  4467. * ADSP is communicating via APR. They can now directly communicate
  4468. * via the Virtual address instead of Physical address. The virtual
  4469. * regions must be contiguous. num_regions must be 1 in this case.
  4470. *
  4471. * b31-b1 - reserved bits. must be set to zero
  4472. */
  4473. } __packed;
  4474. /* Map region payload used by the
  4475. * afe_service_shared_map_region_payloadstructure.
  4476. */
  4477. struct afe_service_shared_map_region_payload {
  4478. u32 shm_addr_lsw;
  4479. /* least significant word of starting address in the memory
  4480. * region to map. It must be contiguous memory, and it must be 4 KB
  4481. * aligned.
  4482. * Supported values: - Any 32 bit value
  4483. */
  4484. u32 shm_addr_msw;
  4485. /* most significant word of startng address in the memory region
  4486. * to map. For 32 bit shared memory address, this field must be set
  4487. * to zero. For 36 bit shared memory address, bit31 to bit 4 must be
  4488. * set to zero
  4489. *
  4490. * Supported values: - For 32 bit shared memory address, this field
  4491. * must be set to zero. - For 36 bit shared memory address, bit31 to
  4492. * bit 4 must be set to zero - For 64 bit shared memory address, any
  4493. * 32 bit value
  4494. */
  4495. u32 mem_size_bytes;
  4496. /* Number of bytes in the region. The aDSP will always map the
  4497. * regions as virtual contiguous memory, but the memory size must be
  4498. * in multiples of 4 KB to avoid gaps in the virtually contiguous
  4499. * mapped memory.
  4500. *
  4501. * Supported values: - multiples of 4KB
  4502. */
  4503. } __packed;
  4504. #define AFE_SERVICE_CMDRSP_SHARED_MEM_MAP_REGIONS 0x000100EB
  4505. struct afe_service_cmdrsp_shared_mem_map_regions {
  4506. u32 mem_map_handle;
  4507. /* A memory map handle encapsulating shared memory attributes is
  4508. * returned iff AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS command is
  4509. * successful. In the case of failure , a generic APR error response
  4510. * is returned to the client.
  4511. *
  4512. * Supported Values: - Any 32 bit value
  4513. */
  4514. } __packed;
  4515. #define AFE_SERVICE_CMD_SHARED_MEM_UNMAP_REGIONS 0x000100EC
  4516. /* Memory unmap regions command payload used by the
  4517. * #AFE_SERVICE_CMD_SHARED_MEM_UNMAP_REGIONS
  4518. *
  4519. * This structure allows clients to unmap multiple shared memory
  4520. * regions in a single command.
  4521. */
  4522. struct afe_service_cmd_shared_mem_unmap_regions {
  4523. struct apr_hdr hdr;
  4524. u32 mem_map_handle;
  4525. /* memory map handle returned by
  4526. * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS commands
  4527. *
  4528. * Supported Values:
  4529. * - Any 32 bit value
  4530. */
  4531. } __packed;
  4532. /* Used by RTAC */
  4533. struct afe_rtac_get_param_v2 {
  4534. u16 port_id;
  4535. /* Port interface and direction (Rx or Tx) to start. */
  4536. u16 payload_size;
  4537. /* Maximum data size of the parameter ID/module ID combination.
  4538. * This is a multiple of four bytes
  4539. * Supported values: > 0
  4540. */
  4541. u32 payload_address_lsw;
  4542. /* LSW of 64 bit Payload address. Address should be 32-byte,
  4543. * 4kbyte aligned and must be contig memory.
  4544. */
  4545. u32 payload_address_msw;
  4546. /* MSW of 64 bit Payload address. In case of 32-bit shared
  4547. * memory address, this field must be set to zero. In case of 36-bit
  4548. * shared memory address, bit-4 to bit-31 must be set to zero.
  4549. * Address should be 32-byte, 4kbyte aligned and must be contiguous
  4550. * memory.
  4551. */
  4552. u32 mem_map_handle;
  4553. /* Memory map handle returned by
  4554. * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS commands.
  4555. * Supported Values: - NULL -- Message. The parameter data is
  4556. * in-band. - Non-NULL -- The parameter data is Out-band.Pointer to
  4557. * - the physical address in shared memory of the payload data.
  4558. * For detailed payload content, see the afe_port_param_data_v2
  4559. * structure
  4560. */
  4561. u32 module_id;
  4562. /* ID of the module to be queried.
  4563. * Supported values: Valid module ID
  4564. */
  4565. u32 param_id;
  4566. /* ID of the parameter to be queried.
  4567. * Supported values: Valid parameter ID
  4568. */
  4569. } __packed;
  4570. #define AFE_PORT_CMD_GET_PARAM_V2 0x000100F0
  4571. /* Payload of the #AFE_PORT_CMD_GET_PARAM_V2 command,
  4572. * which queries for one post/preprocessing parameter of a
  4573. * stream.
  4574. */
  4575. struct afe_port_cmd_get_param_v2 {
  4576. struct apr_hdr apr_hdr;
  4577. /* Port interface and direction (Rx or Tx) to start. */
  4578. u16 port_id;
  4579. /* Maximum data size of the parameter ID/module ID combination.
  4580. * This is a multiple of four bytes
  4581. * Supported values: > 0
  4582. */
  4583. u16 payload_size;
  4584. /* The memory mapping header to be used when requesting outband */
  4585. struct mem_mapping_hdr mem_hdr;
  4586. /* The module ID of the parameter data requested */
  4587. u32 module_id;
  4588. /* The parameter ID of the parameter data requested */
  4589. u32 param_id;
  4590. /* The header information for the parameter data */
  4591. struct param_hdr_v1 param_hdr;
  4592. } __packed;
  4593. #define AFE_PORT_CMDRSP_GET_PARAM_V2 0x00010106
  4594. /* Payload of the #AFE_PORT_CMDRSP_GET_PARAM_V2 message, which
  4595. * responds to an #AFE_PORT_CMD_GET_PARAM_V2 command.
  4596. *
  4597. * Immediately following this structure is the parameters structure
  4598. * (afe_port_param_data) containing the response(acknowledgment)
  4599. * parameter payload. This payload is included for an in-band
  4600. * scenario. For an address/shared memory-based set parameter, this
  4601. * payload is not needed.
  4602. */
  4603. struct afe_port_cmdrsp_get_param_v2 {
  4604. u32 status;
  4605. struct param_hdr_v1 param_hdr;
  4606. u8 param_data[0];
  4607. } __packed;
  4608. #define AFE_PORT_CMD_GET_PARAM_V3 0x000100FB
  4609. struct afe_port_cmd_get_param_v3 {
  4610. /* APR Header */
  4611. struct apr_hdr apr_hdr;
  4612. /* Port ID of the AFE port to configure. Port interface and direction
  4613. * (Rx or Tx) to configure. An even number represents the Rx direction,
  4614. * and an odd number represents the Tx direction.
  4615. */
  4616. u16 port_id;
  4617. /* Reserved. This field must be set to zero. */
  4618. u16 reserved;
  4619. /* The memory mapping header to be used when requesting outband */
  4620. struct mem_mapping_hdr mem_hdr;
  4621. /* The header information for the parameter data */
  4622. struct param_hdr_v3 param_hdr;
  4623. } __packed;
  4624. #define AFE_PORT_CMDRSP_GET_PARAM_V3 0x00010108
  4625. struct afe_port_cmdrsp_get_param_v3 {
  4626. /* The status of the command */
  4627. uint32_t status;
  4628. /* The header information for the parameter data */
  4629. struct param_hdr_v3 param_hdr;
  4630. /* The parameter data to be filled when sent inband */
  4631. u8 param_data[0];
  4632. } __packed;
  4633. #define AFE_PARAM_ID_LPASS_CORE_SHARED_CLOCK_CONFIG 0x0001028C
  4634. #define AFE_API_VERSION_LPASS_CORE_SHARED_CLK_CONFIG 0x1
  4635. /* Payload of the AFE_PARAM_ID_LPASS_CORE_SHARED_CLOCK_CONFIG parameter used by
  4636. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  4637. */
  4638. struct afe_param_id_lpass_core_shared_clk_cfg {
  4639. u32 lpass_core_shared_clk_cfg_minor_version;
  4640. /*
  4641. * Minor version used for lpass core shared clock configuration
  4642. * Supported value: AFE_API_VERSION_LPASS_CORE_SHARED_CLK_CONFIG
  4643. */
  4644. u32 enable;
  4645. /*
  4646. * Specifies whether the lpass core shared clock is
  4647. * enabled (1) or disabled (0).
  4648. */
  4649. } __packed;
  4650. /* adsp_afe_service_commands.h */
  4651. #define ADSP_MEMORY_MAP_EBI_POOL 0
  4652. #define ADSP_MEMORY_MAP_SMI_POOL 1
  4653. #define ADSP_MEMORY_MAP_IMEM_POOL 2
  4654. #define ADSP_MEMORY_MAP_SHMEM8_4K_POOL 3
  4655. #define ADSP_MEMORY_MAP_MDF_SHMEM_4K_POOL 4
  4656. /* Definition of virtual memory flag */
  4657. #define ADSP_MEMORY_MAP_VIRTUAL_MEMORY 1
  4658. /* Definition of physical memory flag */
  4659. #define ADSP_MEMORY_MAP_PHYSICAL_MEMORY 0
  4660. #define NULL_POPP_TOPOLOGY 0x00010C68
  4661. #define NULL_COPP_TOPOLOGY 0x00010312
  4662. #define DEFAULT_COPP_TOPOLOGY 0x00010314
  4663. #define DEFAULT_POPP_TOPOLOGY 0x00010BE4
  4664. #define COMPRESSED_PASSTHROUGH_DEFAULT_TOPOLOGY 0x0001076B
  4665. #define COMPRESSED_PASSTHROUGH_NONE_TOPOLOGY 0x00010774
  4666. #define VPM_TX_SM_ECNS_V2_COPP_TOPOLOGY 0x00010F89
  4667. #define VPM_TX_VOICE_SMECNS_V2_COPP_TOPOLOGY 0x10000003
  4668. #define VPM_TX_VOICE_FLUENCE_SM_COPP_TOPOLOGY 0x10000004
  4669. #define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72
  4670. #define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75
  4671. #define VPM_TX_DM_RFECNS_COPP_TOPOLOGY 0x00010F86
  4672. #define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX 0x10015002
  4673. #define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_AUDIOSPHERE 0x10028000
  4674. #define VPM_TX_DM_FLUENCE_EF_COPP_TOPOLOGY 0x10000005
  4675. /* Memory map regions command payload used by the
  4676. * #ASM_CMD_SHARED_MEM_MAP_REGIONS ,#ADM_CMD_SHARED_MEM_MAP_REGIONS
  4677. * commands.
  4678. *
  4679. * This structure allows clients to map multiple shared memory
  4680. * regions in a single command. Following this structure are
  4681. * num_regions of avs_shared_map_region_payload.
  4682. */
  4683. struct avs_cmd_shared_mem_map_regions {
  4684. struct apr_hdr hdr;
  4685. u16 mem_pool_id;
  4686. /* Type of memory on which this memory region is mapped.
  4687. *
  4688. * Supported values: - #ADSP_MEMORY_MAP_EBI_POOL -
  4689. * #ADSP_MEMORY_MAP_SMI_POOL - #ADSP_MEMORY_MAP_IMEM_POOL
  4690. * (unsupported) - #ADSP_MEMORY_MAP_SHMEM8_4K_POOL - Other values
  4691. * are reserved
  4692. *
  4693. * The memory ID implicitly defines the characteristics of the
  4694. * memory. Characteristics may include alignment type, permissions,
  4695. * etc.
  4696. *
  4697. * SHMEM8_4K is shared memory, byte addressable, and 4 KB aligned.
  4698. */
  4699. u16 num_regions;
  4700. /* Number of regions to map.*/
  4701. u32 property_flag;
  4702. /* Configures one common property for all the regions in the
  4703. * payload. No two regions in the same memory map regions cmd can
  4704. * have differnt property. Supported values: - 0x00000000 to
  4705. * 0x00000001
  4706. *
  4707. * b0 - bit 0 indicates physical or virtual mapping 0 shared memory
  4708. * address provided in avs_shared_map_regions_payload is physical
  4709. * address. The shared memory needs to be mapped( hardware TLB
  4710. * entry)
  4711. *
  4712. * and a software entry needs to be added for internal book keeping.
  4713. *
  4714. * 1 Shared memory address provided in MayPayload[usRegions] is
  4715. * virtual address. The shared memory must not be mapped (since
  4716. * hardware TLB entry is already available) but a software entry
  4717. * needs to be added for internal book keeping. This can be useful
  4718. * if two services with in ADSP is communicating via APR. They can
  4719. * now directly communicate via the Virtual address instead of
  4720. * Physical address. The virtual regions must be contiguous.
  4721. *
  4722. * b31-b1 - reserved bits. must be set to zero
  4723. */
  4724. } __packed;
  4725. struct avs_shared_map_region_payload {
  4726. u32 shm_addr_lsw;
  4727. /* least significant word of shared memory address of the memory
  4728. * region to map. It must be contiguous memory, and it must be 4 KB
  4729. * aligned.
  4730. */
  4731. u32 shm_addr_msw;
  4732. /* most significant word of shared memory address of the memory
  4733. * region to map. For 32 bit shared memory address, this field must
  4734. * tbe set to zero. For 36 bit shared memory address, bit31 to bit 4
  4735. * must be set to zero
  4736. */
  4737. u32 mem_size_bytes;
  4738. /* Number of bytes in the region.
  4739. *
  4740. * The aDSP will always map the regions as virtual contiguous
  4741. * memory, but the memory size must be in multiples of 4 KB to avoid
  4742. * gaps in the virtually contiguous mapped memory.
  4743. */
  4744. } __packed;
  4745. struct avs_cmd_shared_mem_unmap_regions {
  4746. struct apr_hdr hdr;
  4747. u32 mem_map_handle;
  4748. /* memory map handle returned by ASM_CMD_SHARED_MEM_MAP_REGIONS
  4749. * , ADM_CMD_SHARED_MEM_MAP_REGIONS, commands
  4750. */
  4751. } __packed;
  4752. /* Memory map command response payload used by the
  4753. * #ASM_CMDRSP_SHARED_MEM_MAP_REGIONS
  4754. * ,#ADM_CMDRSP_SHARED_MEM_MAP_REGIONS
  4755. */
  4756. struct avs_cmdrsp_shared_mem_map_regions {
  4757. u32 mem_map_handle;
  4758. /* A memory map handle encapsulating shared memory attributes is
  4759. * returned
  4760. */
  4761. } __packed;
  4762. #define AVS_MDF_MDSP_PROC_ID 0x2
  4763. #define AVS_MDF_SSC_PROC_ID 0x3
  4764. #define AVS_MDF_CDSP_PROC_ID 0x4
  4765. /* Shared memory map command payload used by the
  4766. * #AVCS_CMD_MAP_MDF_SHARED_MEMORY.
  4767. *
  4768. * This structure allows clients to map multiple shared memory
  4769. * regions with remote processor ID. All mapped regions must be
  4770. * from the same memory pool. Following this structure are
  4771. * num_regions of avs_shared_map_region_payload.
  4772. */
  4773. struct avs_cmd_map_mdf_shared_memory {
  4774. struct apr_hdr hdr;
  4775. uint32_t mem_map_handle;
  4776. /* Unique identifier for the shared memory address.
  4777. *
  4778. * The aDSP returns this handle for
  4779. * #AVCS_CMD_SHARED_MEM_MAP_REGIONS
  4780. *
  4781. * Supported values:
  4782. * Any 32-bit value
  4783. *
  4784. * The aDSP uses this handle to retrieve the shared memory
  4785. * attributes. This handle can be an abstract representation
  4786. * of the shared memory regions that are being mapped.
  4787. */
  4788. uint32_t proc_id;
  4789. /* Supported values:
  4790. * #AVS_MDF_MDSP_PROC_ID
  4791. * #AVS_MDF_SSC_PROC_ID
  4792. * #AVS_MDF_CDSP_PROC_ID
  4793. */
  4794. uint32_t num_regions;
  4795. /* Number of regions to be mapped with the remote DSP processor
  4796. * mentioned by proc_id field.
  4797. *
  4798. * Array of structures of avs_shared_map_region_payload will follow.
  4799. * The address fields in those arrays should correspond to the remote
  4800. * processor mentioned by proc_id.
  4801. * In case of DSPs with SMMU enabled, the address should be IOVA.
  4802. * And for DSPs without SMMU, the address should be physical address.
  4803. */
  4804. } __packed;
  4805. /*adsp_audio_memmap_api.h*/
  4806. /* ASM related data structures */
  4807. struct asm_wma_cfg {
  4808. u16 format_tag;
  4809. u16 ch_cfg;
  4810. u32 sample_rate;
  4811. u32 avg_bytes_per_sec;
  4812. u16 block_align;
  4813. u16 valid_bits_per_sample;
  4814. u32 ch_mask;
  4815. u16 encode_opt;
  4816. u16 adv_encode_opt;
  4817. u32 adv_encode_opt2;
  4818. u32 drc_peak_ref;
  4819. u32 drc_peak_target;
  4820. u32 drc_ave_ref;
  4821. u32 drc_ave_target;
  4822. } __packed;
  4823. struct asm_wmapro_cfg {
  4824. u16 format_tag;
  4825. u16 ch_cfg;
  4826. u32 sample_rate;
  4827. u32 avg_bytes_per_sec;
  4828. u16 block_align;
  4829. u16 valid_bits_per_sample;
  4830. u32 ch_mask;
  4831. u16 encode_opt;
  4832. u16 adv_encode_opt;
  4833. u32 adv_encode_opt2;
  4834. u32 drc_peak_ref;
  4835. u32 drc_peak_target;
  4836. u32 drc_ave_ref;
  4837. u32 drc_ave_target;
  4838. } __packed;
  4839. struct asm_aac_cfg {
  4840. u16 format;
  4841. u16 aot;
  4842. u16 ep_config;
  4843. u16 section_data_resilience;
  4844. u16 scalefactor_data_resilience;
  4845. u16 spectral_data_resilience;
  4846. u16 ch_cfg;
  4847. u16 reserved;
  4848. u32 sample_rate;
  4849. } __packed;
  4850. struct asm_amrwbplus_cfg {
  4851. u32 size_bytes;
  4852. u32 version;
  4853. u32 num_channels;
  4854. u32 amr_band_mode;
  4855. u32 amr_dtx_mode;
  4856. u32 amr_frame_fmt;
  4857. u32 amr_lsf_idx;
  4858. } __packed;
  4859. struct asm_flac_cfg {
  4860. u32 sample_rate;
  4861. u32 ext_sample_rate;
  4862. u32 min_frame_size;
  4863. u32 max_frame_size;
  4864. u16 stream_info_present;
  4865. u16 min_blk_size;
  4866. u16 max_blk_size;
  4867. u16 ch_cfg;
  4868. u16 sample_size;
  4869. u16 md5_sum;
  4870. };
  4871. struct asm_alac_cfg {
  4872. u32 frame_length;
  4873. u8 compatible_version;
  4874. u8 bit_depth;
  4875. u8 pb;
  4876. u8 mb;
  4877. u8 kb;
  4878. u8 num_channels;
  4879. u16 max_run;
  4880. u32 max_frame_bytes;
  4881. u32 avg_bit_rate;
  4882. u32 sample_rate;
  4883. u32 channel_layout_tag;
  4884. };
  4885. struct asm_g711_dec_cfg {
  4886. u32 sample_rate;
  4887. };
  4888. struct asm_vorbis_cfg {
  4889. u32 bit_stream_fmt;
  4890. };
  4891. struct asm_ape_cfg {
  4892. u16 compatible_version;
  4893. u16 compression_level;
  4894. u32 format_flags;
  4895. u32 blocks_per_frame;
  4896. u32 final_frame_blocks;
  4897. u32 total_frames;
  4898. u16 bits_per_sample;
  4899. u16 num_channels;
  4900. u32 sample_rate;
  4901. u32 seek_table_present;
  4902. };
  4903. struct asm_dsd_cfg {
  4904. u16 num_version;
  4905. u16 is_bitwise_big_endian;
  4906. u16 dsd_channel_block_size;
  4907. u16 num_channels;
  4908. u8 channel_mapping[8];
  4909. u32 dsd_data_rate;
  4910. };
  4911. struct asm_softpause_params {
  4912. u32 enable;
  4913. u32 period;
  4914. u32 step;
  4915. u32 rampingcurve;
  4916. } __packed;
  4917. struct asm_softvolume_params {
  4918. u32 period;
  4919. u32 step;
  4920. u32 rampingcurve;
  4921. } __packed;
  4922. #define ASM_END_POINT_DEVICE_MATRIX 0
  4923. #define PCM_CHANNEL_NULL 0
  4924. /* Front left channel. */
  4925. #define PCM_CHANNEL_FL 1
  4926. /* Front right channel. */
  4927. #define PCM_CHANNEL_FR 2
  4928. /* Front center channel. */
  4929. #define PCM_CHANNEL_FC 3
  4930. /* Left surround channel.*/
  4931. #define PCM_CHANNEL_LS 4
  4932. /* Right surround channel.*/
  4933. #define PCM_CHANNEL_RS 5
  4934. /* Low frequency effect channel. */
  4935. #define PCM_CHANNEL_LFE 6
  4936. /* Center surround channel; Rear center channel. */
  4937. #define PCM_CHANNEL_CS 7
  4938. /* Left back channel; Rear left channel. */
  4939. #define PCM_CHANNEL_LB 8
  4940. /* Right back channel; Rear right channel. */
  4941. #define PCM_CHANNEL_RB 9
  4942. /* Top surround channel. */
  4943. #define PCM_CHANNEL_TS 10
  4944. /* Center vertical height channel.*/
  4945. #define PCM_CHANNEL_CVH 11
  4946. /* Mono surround channel.*/
  4947. #define PCM_CHANNEL_MS 12
  4948. /* Front left of center. */
  4949. #define PCM_CHANNEL_FLC 13
  4950. /* Front right of center. */
  4951. #define PCM_CHANNEL_FRC 14
  4952. /* Rear left of center. */
  4953. #define PCM_CHANNEL_RLC 15
  4954. /* Rear right of center. */
  4955. #define PCM_CHANNEL_RRC 16
  4956. /* Second low frequency channel. */
  4957. #define PCM_CHANNEL_LFE2 17
  4958. /* Side left channel. */
  4959. #define PCM_CHANNEL_SL 18
  4960. /* Side right channel. */
  4961. #define PCM_CHANNEL_SR 19
  4962. /* Top front left channel. */
  4963. #define PCM_CHANNEL_TFL 20
  4964. /* Left vertical height channel. */
  4965. #define PCM_CHANNEL_LVH 20
  4966. /* Top front right channel. */
  4967. #define PCM_CHANNEL_TFR 21
  4968. /* Right vertical height channel. */
  4969. #define PCM_CHANNEL_RVH 21
  4970. /* Top center channel. */
  4971. #define PCM_CHANNEL_TC 22
  4972. /* Top back left channel. */
  4973. #define PCM_CHANNEL_TBL 23
  4974. /* Top back right channel. */
  4975. #define PCM_CHANNEL_TBR 24
  4976. /* Top side left channel. */
  4977. #define PCM_CHANNEL_TSL 25
  4978. /* Top side right channel. */
  4979. #define PCM_CHANNEL_TSR 26
  4980. /* Top back center channel. */
  4981. #define PCM_CHANNEL_TBC 27
  4982. /* Bottom front center channel. */
  4983. #define PCM_CHANNEL_BFC 28
  4984. /* Bottom front left channel. */
  4985. #define PCM_CHANNEL_BFL 29
  4986. /* Bottom front right channel. */
  4987. #define PCM_CHANNEL_BFR 30
  4988. /* Left wide channel. */
  4989. #define PCM_CHANNEL_LW 31
  4990. /* Right wide channel. */
  4991. #define PCM_CHANNEL_RW 32
  4992. /* Left side direct channel. */
  4993. #define PCM_CHANNEL_LSD 33
  4994. /* Right side direct channel. */
  4995. #define PCM_CHANNEL_RSD 34
  4996. /* Mark unused channel. */
  4997. #define PCM_CHANNEL_UNUSED 47
  4998. #define PCM_CUSTOM_CHANNEL_MAP_1 48
  4999. #define PCM_CUSTOM_CHANNEL_MAP_2 49
  5000. #define PCM_CUSTOM_CHANNEL_MAP_3 50
  5001. #define PCM_CUSTOM_CHANNEL_MAP_4 51
  5002. #define PCM_CUSTOM_CHANNEL_MAP_5 52
  5003. #define PCM_CUSTOM_CHANNEL_MAP_6 53
  5004. #define PCM_CUSTOM_CHANNEL_MAP_7 54
  5005. #define PCM_CUSTOM_CHANNEL_MAP_8 55
  5006. #define PCM_CUSTOM_CHANNEL_MAP_9 56
  5007. #define PCM_CUSTOM_CHANNEL_MAP_10 57
  5008. #define PCM_CUSTOM_CHANNEL_MAP_11 58
  5009. #define PCM_CUSTOM_CHANNEL_MAP_12 59
  5010. #define PCM_CUSTOM_CHANNEL_MAP_13 60
  5011. #define PCM_CUSTOM_CHANNEL_MAP_14 61
  5012. #define PCM_CUSTOM_CHANNEL_MAP_15 62
  5013. #define PCM_CUSTOM_CHANNEL_MAP_16 63
  5014. #define PCM_MAX_CHANNEL_MAP 63
  5015. /* Max valid channel map index */
  5016. #define PCM_MAX_CHMAP_ID PCM_MAX_CHANNEL_MAP
  5017. #define PCM_FORMAT_MAX_NUM_CHANNEL 8
  5018. #define PCM_FORMAT_MAX_CHANNELS_9 9
  5019. /* Used for ADM_CMD_DEVICE_OPEN_V8 */
  5020. #define PCM_FORMAT_MAX_NUM_CHANNEL_V8 32
  5021. #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2 0x00010DA5
  5022. #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 0x00010DDC
  5023. #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 0x0001320C
  5024. #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 0x00013222
  5025. #define ASM_MEDIA_FMT_EVRCB_FS 0x00010BEF
  5026. #define ASM_MEDIA_FMT_EVRCWB_FS 0x00010BF0
  5027. #define ASM_MEDIA_FMT_GENERIC_COMPRESSED 0x00013212
  5028. #define ASM_MAX_EQ_BANDS 12
  5029. #define ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2 0x00010D98
  5030. struct asm_data_cmd_media_fmt_update_v2 {
  5031. u32 fmt_blk_size;
  5032. /* Media format block size in bytes.*/
  5033. } __packed;
  5034. struct asm_generic_compressed_fmt_blk_t {
  5035. struct apr_hdr hdr;
  5036. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5037. /*
  5038. * Channel mapping array of bitstream output.
  5039. * Channel[i] mapping describes channel i inside the buffer, where
  5040. * i < num_channels. All valid used channels must be
  5041. * present at the beginning of the array.
  5042. */
  5043. uint8_t channel_mapping[8];
  5044. /*
  5045. * Number of channels of the incoming bitstream.
  5046. * Supported values: 1,2,3,4,5,6,7,8
  5047. */
  5048. uint16_t num_channels;
  5049. /*
  5050. * Nominal bits per sample value of the incoming bitstream.
  5051. * Supported values: 16, 32
  5052. */
  5053. uint16_t bits_per_sample;
  5054. /*
  5055. * Nominal sampling rate of the incoming bitstream.
  5056. * Supported values: 8000, 11025, 16000, 22050, 24000, 32000,
  5057. * 44100, 48000, 88200, 96000, 176400, 192000,
  5058. * 352800, 384000
  5059. */
  5060. uint32_t sampling_rate;
  5061. } __packed;
  5062. /* Command to send sample rate & channels for IEC61937 (compressed) or IEC60958
  5063. * (pcm) streams. Both audio standards use the same format and are used for
  5064. * HDMI or SPDIF output.
  5065. */
  5066. #define ASM_DATA_CMD_IEC_60958_MEDIA_FMT 0x0001321E
  5067. struct asm_iec_compressed_fmt_blk_t {
  5068. struct apr_hdr hdr;
  5069. /*
  5070. * Nominal sampling rate of the incoming bitstream.
  5071. * Supported values: 8000, 11025, 16000, 22050, 24000, 32000,
  5072. * 44100, 48000, 88200, 96000, 176400, 192000,
  5073. * 352800, 384000
  5074. */
  5075. uint32_t sampling_rate;
  5076. /*
  5077. * Number of channels of the incoming bitstream.
  5078. * Supported values: 1,2,3,4,5,6,7,8
  5079. */
  5080. uint32_t num_channels;
  5081. } __packed;
  5082. struct asm_multi_channel_pcm_fmt_blk_v2 {
  5083. struct apr_hdr hdr;
  5084. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5085. u16 num_channels;
  5086. /* Number of channels. Supported values: 1 to 8 */
  5087. u16 bits_per_sample;
  5088. /* Number of bits per sample per channel. * Supported values:
  5089. * 16, 24 * When used for playback, the client must send 24-bit
  5090. * samples packed in 32-bit words. The 24-bit samples must be placed
  5091. * in the most significant 24 bits of the 32-bit word. When used for
  5092. * recording, the aDSP sends 24-bit samples packed in 32-bit words.
  5093. * The 24-bit samples are placed in the most significant 24 bits of
  5094. * the 32-bit word.
  5095. */
  5096. u32 sample_rate;
  5097. /* Number of samples per second (in Hertz).
  5098. * Supported values: 2000 to 48000
  5099. */
  5100. u16 is_signed;
  5101. /* Flag that indicates the samples are signed (1). */
  5102. u16 reserved;
  5103. /* reserved field for 32 bit alignment. must be set to zero. */
  5104. u8 channel_mapping[8];
  5105. /* Channel array of size 8.
  5106. * Supported values:
  5107. * - #PCM_CHANNEL_L
  5108. * - #PCM_CHANNEL_R
  5109. * - #PCM_CHANNEL_C
  5110. * - #PCM_CHANNEL_LS
  5111. * - #PCM_CHANNEL_RS
  5112. * - #PCM_CHANNEL_LFE
  5113. * - #PCM_CHANNEL_CS
  5114. * - #PCM_CHANNEL_LB
  5115. * - #PCM_CHANNEL_RB
  5116. * - #PCM_CHANNEL_TS
  5117. * - #PCM_CHANNEL_CVH
  5118. * - #PCM_CHANNEL_MS
  5119. * - #PCM_CHANNEL_FLC
  5120. * - #PCM_CHANNEL_FRC
  5121. * - #PCM_CHANNEL_RLC
  5122. * - #PCM_CHANNEL_RRC
  5123. *
  5124. * Channel[i] mapping describes channel I. Each element i of the
  5125. * array describes channel I inside the buffer where 0 @le I <
  5126. * num_channels. An unused channel is set to zero.
  5127. */
  5128. } __packed;
  5129. struct asm_multi_channel_pcm_fmt_blk_v3 {
  5130. uint16_t num_channels;
  5131. /*
  5132. * Number of channels
  5133. * Supported values: 1 to 8
  5134. */
  5135. uint16_t bits_per_sample;
  5136. /*
  5137. * Number of bits per sample per channel
  5138. * Supported values: 16, 24
  5139. */
  5140. uint32_t sample_rate;
  5141. /*
  5142. * Number of samples per second
  5143. * Supported values: 2000 to 48000, 96000,192000 Hz
  5144. */
  5145. uint16_t is_signed;
  5146. /* Flag that indicates that PCM samples are signed (1) */
  5147. uint16_t sample_word_size;
  5148. /*
  5149. * Size in bits of the word that holds a sample of a channel.
  5150. * Supported values: 12,24,32
  5151. */
  5152. uint8_t channel_mapping[8];
  5153. /*
  5154. * Each element, i, in the array describes channel i inside the buffer where
  5155. * 0 <= i < num_channels. Unused channels are set to 0.
  5156. */
  5157. } __packed;
  5158. struct asm_multi_channel_pcm_fmt_blk_v4 {
  5159. uint16_t num_channels;
  5160. /*
  5161. * Number of channels
  5162. * Supported values: 1 to 8
  5163. */
  5164. uint16_t bits_per_sample;
  5165. /*
  5166. * Number of bits per sample per channel
  5167. * Supported values: 16, 24, 32
  5168. */
  5169. uint32_t sample_rate;
  5170. /*
  5171. * Number of samples per second
  5172. * Supported values: 2000 to 48000, 96000,192000 Hz
  5173. */
  5174. uint16_t is_signed;
  5175. /* Flag that indicates that PCM samples are signed (1) */
  5176. uint16_t sample_word_size;
  5177. /*
  5178. * Size in bits of the word that holds a sample of a channel.
  5179. * Supported values: 12,24,32
  5180. */
  5181. uint8_t channel_mapping[8];
  5182. /*
  5183. * Each element, i, in the array describes channel i inside the buffer where
  5184. * 0 <= i < num_channels. Unused channels are set to 0.
  5185. */
  5186. uint16_t endianness;
  5187. /*
  5188. * Flag to indicate the endianness of the pcm sample
  5189. * Supported values: 0 - Little endian (all other formats)
  5190. * 1 - Big endian (AIFF)
  5191. */
  5192. uint16_t mode;
  5193. /*
  5194. * Mode to provide additional info about the pcm input data.
  5195. * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
  5196. * Q31 for unpacked 24b or 32b)
  5197. * 15 - for 16 bit
  5198. * 23 - for 24b packed or 8.24 format
  5199. * 31 - for 24b unpacked or 32bit
  5200. */
  5201. } __packed;
  5202. struct asm_multi_channel_pcm_fmt_blk_v5 {
  5203. uint16_t num_channels;
  5204. /*
  5205. * Number of channels
  5206. * Supported values: 1 to 32
  5207. */
  5208. uint16_t bits_per_sample;
  5209. /*
  5210. * Number of bits per sample per channel
  5211. * Supported values: 16, 24, 32
  5212. */
  5213. uint32_t sample_rate;
  5214. /*
  5215. * Number of samples per second
  5216. * Supported values: 2000 to 48000, 96000,192000 Hz
  5217. */
  5218. uint16_t is_signed;
  5219. /* Flag that indicates that PCM samples are signed (1) */
  5220. uint16_t sample_word_size;
  5221. /*
  5222. * Size in bits of the word that holds a sample of a channel.
  5223. * Supported values: 12,24,32
  5224. */
  5225. uint16_t endianness;
  5226. /*
  5227. * Flag to indicate the endianness of the pcm sample
  5228. * Supported values: 0 - Little endian (all other formats)
  5229. * 1 - Big endian (AIFF)
  5230. */
  5231. uint16_t mode;
  5232. /*
  5233. * Mode to provide additional info about the pcm input data.
  5234. * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
  5235. * Q31 for unpacked 24b or 32b)
  5236. * 15 - for 16 bit
  5237. * 23 - for 24b packed or 8.24 format
  5238. * 31 - for 24b unpacked or 32bit
  5239. */
  5240. uint8_t channel_mapping[32];
  5241. /*
  5242. * Each element, i, in the array describes channel i inside the buffer where
  5243. * 0 <= i < num_channels. Unused channels are set to 0.
  5244. */
  5245. } __packed;
  5246. /*
  5247. * Payload of the multichannel PCM configuration parameters in
  5248. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 media format.
  5249. */
  5250. struct asm_multi_channel_pcm_fmt_blk_param_v3 {
  5251. struct apr_hdr hdr;
  5252. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5253. struct asm_multi_channel_pcm_fmt_blk_v3 param;
  5254. } __packed;
  5255. /*
  5256. * Payload of the multichannel PCM configuration parameters in
  5257. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 media format.
  5258. */
  5259. struct asm_multi_channel_pcm_fmt_blk_param_v4 {
  5260. struct apr_hdr hdr;
  5261. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5262. struct asm_multi_channel_pcm_fmt_blk_v4 param;
  5263. } __packed;
  5264. /*
  5265. * Payload of the multichannel PCM configuration parameters in
  5266. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 media format.
  5267. */
  5268. struct asm_multi_channel_pcm_fmt_blk_param_v5 {
  5269. struct apr_hdr hdr;
  5270. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5271. struct asm_multi_channel_pcm_fmt_blk_v5 param;
  5272. } __packed;
  5273. struct asm_stream_cmd_set_encdec_param {
  5274. u32 param_id;
  5275. /* ID of the parameter. */
  5276. u32 param_size;
  5277. /* Data size of this parameter, in bytes. The size is a multiple
  5278. * of 4 bytes.
  5279. */
  5280. } __packed;
  5281. struct asm_enc_cfg_blk_param_v2 {
  5282. u32 frames_per_buf;
  5283. /* Number of encoded frames to pack into each buffer.
  5284. *
  5285. * @note1hang This is only guidance information for the aDSP. The
  5286. * number of encoded frames put into each buffer (specified by the
  5287. * client) is less than or equal to this number.
  5288. */
  5289. u32 enc_cfg_blk_size;
  5290. /* Size in bytes of the encoder configuration block that follows
  5291. * this member.
  5292. */
  5293. } __packed;
  5294. struct asm_custom_enc_cfg_t_v2 {
  5295. struct apr_hdr hdr;
  5296. struct asm_stream_cmd_set_encdec_param encdec;
  5297. struct asm_enc_cfg_blk_param_v2 encblk;
  5298. uint32_t sample_rate;
  5299. uint16_t num_channels;
  5300. uint16_t reserved;
  5301. /* num_ch == 1, then PCM_CHANNEL_C,
  5302. * num_ch == 2, then {PCM_CHANNEL_L, PCM_CHANNEL_R}
  5303. */
  5304. uint8_t channel_mapping[8];
  5305. uint32_t custom_size;
  5306. uint8_t custom_data[15];
  5307. } __packed;
  5308. /* @brief Dolby Digital Plus end point configuration structure
  5309. */
  5310. struct asm_dec_ddp_endp_param_v2 {
  5311. struct apr_hdr hdr;
  5312. struct asm_stream_cmd_set_encdec_param encdec;
  5313. int endp_param_value;
  5314. } __packed;
  5315. /*
  5316. * Payload of the multichannel PCM encoder configuration parameters in
  5317. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 media format.
  5318. */
  5319. struct asm_multi_channel_pcm_enc_cfg_v5 {
  5320. struct apr_hdr hdr;
  5321. struct asm_stream_cmd_set_encdec_param encdec;
  5322. struct asm_enc_cfg_blk_param_v2 encblk;
  5323. uint16_t num_channels;
  5324. /*
  5325. * Number of PCM channels.
  5326. * @values
  5327. * - 0 -- Native mode
  5328. * - 1 -- 8 channels
  5329. * Native mode indicates that encoding must be performed with the number
  5330. * of channels at the input.
  5331. */
  5332. uint16_t bits_per_sample;
  5333. /*
  5334. * Number of bits per sample per channel.
  5335. * @values 16, 24
  5336. */
  5337. uint32_t sample_rate;
  5338. /*
  5339. * Number of samples per second.
  5340. * @values 0, 8000 to 48000 Hz
  5341. * A value of 0 indicates the native sampling rate. Encoding is
  5342. * performed at the input sampling rate.
  5343. */
  5344. uint16_t is_signed;
  5345. /*
  5346. * Flag that indicates the PCM samples are signed (1). Currently, only
  5347. * signed PCM samples are supported.
  5348. */
  5349. uint16_t sample_word_size;
  5350. /*
  5351. * The size in bits of the word that holds a sample of a channel.
  5352. * @values 16, 24, 32
  5353. * 16-bit samples are always placed in 16-bit words:
  5354. * sample_word_size = 1.
  5355. * 24-bit samples can be placed in 32-bit words or in consecutive
  5356. * 24-bit words.
  5357. * - If sample_word_size = 32, 24-bit samples are placed in the
  5358. * most significant 24 bits of a 32-bit word.
  5359. * - If sample_word_size = 24, 24-bit samples are placed in
  5360. * 24-bit words. @tablebulletend
  5361. */
  5362. uint16_t endianness;
  5363. /*
  5364. * Flag to indicate the endianness of the pcm sample
  5365. * Supported values: 0 - Little endian (all other formats)
  5366. * 1 - Big endian (AIFF)
  5367. */
  5368. uint16_t mode;
  5369. /*
  5370. * Mode to provide additional info about the pcm input data.
  5371. * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
  5372. * Q31 for unpacked 24b or 32b)
  5373. * 15 - for 16 bit
  5374. * 23 - for 24b packed or 8.24 format
  5375. */
  5376. uint8_t channel_mapping[PCM_FORMAT_MAX_NUM_CHANNEL_V8];
  5377. /*
  5378. * Channel mapping array expected at the encoder output.
  5379. * Channel[i] mapping describes channel i inside the buffer, where
  5380. * 0 @le i < num_channels. All valid used channels must be present at
  5381. * the beginning of the array.
  5382. * If Native mode is set for the channels, this field is ignored.
  5383. * @values See Section @xref{dox:PcmChannelDefs}
  5384. */
  5385. } __packed;
  5386. /*
  5387. * Payload of the multichannel PCM encoder configuration parameters in
  5388. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 media format.
  5389. */
  5390. struct asm_multi_channel_pcm_enc_cfg_v4 {
  5391. struct apr_hdr hdr;
  5392. struct asm_stream_cmd_set_encdec_param encdec;
  5393. struct asm_enc_cfg_blk_param_v2 encblk;
  5394. uint16_t num_channels;
  5395. /*
  5396. * Number of PCM channels.
  5397. * @values
  5398. * - 0 -- Native mode
  5399. * - 1 -- 8 channels
  5400. * Native mode indicates that encoding must be performed with the number
  5401. * of channels at the input.
  5402. */
  5403. uint16_t bits_per_sample;
  5404. /*
  5405. * Number of bits per sample per channel.
  5406. * @values 16, 24
  5407. */
  5408. uint32_t sample_rate;
  5409. /*
  5410. * Number of samples per second.
  5411. * @values 0, 8000 to 48000 Hz
  5412. * A value of 0 indicates the native sampling rate. Encoding is
  5413. * performed at the input sampling rate.
  5414. */
  5415. uint16_t is_signed;
  5416. /*
  5417. * Flag that indicates the PCM samples are signed (1). Currently, only
  5418. * signed PCM samples are supported.
  5419. */
  5420. uint16_t sample_word_size;
  5421. /*
  5422. * The size in bits of the word that holds a sample of a channel.
  5423. * @values 16, 24, 32
  5424. * 16-bit samples are always placed in 16-bit words:
  5425. * sample_word_size = 1.
  5426. * 24-bit samples can be placed in 32-bit words or in consecutive
  5427. * 24-bit words.
  5428. * - If sample_word_size = 32, 24-bit samples are placed in the
  5429. * most significant 24 bits of a 32-bit word.
  5430. * - If sample_word_size = 24, 24-bit samples are placed in
  5431. * 24-bit words. @tablebulletend
  5432. */
  5433. uint8_t channel_mapping[8];
  5434. /*
  5435. * Channel mapping array expected at the encoder output.
  5436. * Channel[i] mapping describes channel i inside the buffer, where
  5437. * 0 @le i < num_channels. All valid used channels must be present at
  5438. * the beginning of the array.
  5439. * If Native mode is set for the channels, this field is ignored.
  5440. * @values See Section @xref{dox:PcmChannelDefs}
  5441. */
  5442. uint16_t endianness;
  5443. /*
  5444. * Flag to indicate the endianness of the pcm sample
  5445. * Supported values: 0 - Little endian (all other formats)
  5446. * 1 - Big endian (AIFF)
  5447. */
  5448. uint16_t mode;
  5449. /*
  5450. * Mode to provide additional info about the pcm input data.
  5451. * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
  5452. * Q31 for unpacked 24b or 32b)
  5453. * 15 - for 16 bit
  5454. * 23 - for 24b packed or 8.24 format
  5455. * 31 - for 24b unpacked or 32bit
  5456. */
  5457. } __packed;
  5458. /*
  5459. * Payload of the multichannel PCM encoder configuration parameters in
  5460. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 media format.
  5461. */
  5462. struct asm_multi_channel_pcm_enc_cfg_v3 {
  5463. struct apr_hdr hdr;
  5464. struct asm_stream_cmd_set_encdec_param encdec;
  5465. struct asm_enc_cfg_blk_param_v2 encblk;
  5466. uint16_t num_channels;
  5467. /*
  5468. * Number of PCM channels.
  5469. * @values
  5470. * - 0 -- Native mode
  5471. * - 1 -- 8 channels
  5472. * Native mode indicates that encoding must be performed with the number
  5473. * of channels at the input.
  5474. */
  5475. uint16_t bits_per_sample;
  5476. /*
  5477. * Number of bits per sample per channel.
  5478. * @values 16, 24
  5479. */
  5480. uint32_t sample_rate;
  5481. /*
  5482. * Number of samples per second.
  5483. * @values 0, 8000 to 48000 Hz
  5484. * A value of 0 indicates the native sampling rate. Encoding is
  5485. * performed at the input sampling rate.
  5486. */
  5487. uint16_t is_signed;
  5488. /*
  5489. * Flag that indicates the PCM samples are signed (1). Currently, only
  5490. * signed PCM samples are supported.
  5491. */
  5492. uint16_t sample_word_size;
  5493. /*
  5494. * The size in bits of the word that holds a sample of a channel.
  5495. * @values 16, 24, 32
  5496. * 16-bit samples are always placed in 16-bit words:
  5497. * sample_word_size = 1.
  5498. * 24-bit samples can be placed in 32-bit words or in consecutive
  5499. * 24-bit words.
  5500. * - If sample_word_size = 32, 24-bit samples are placed in the
  5501. * most significant 24 bits of a 32-bit word.
  5502. * - If sample_word_size = 24, 24-bit samples are placed in
  5503. * 24-bit words. @tablebulletend
  5504. */
  5505. uint8_t channel_mapping[8];
  5506. /*
  5507. * Channel mapping array expected at the encoder output.
  5508. * Channel[i] mapping describes channel i inside the buffer, where
  5509. * 0 @le i < num_channels. All valid used channels must be present at
  5510. * the beginning of the array.
  5511. * If Native mode is set for the channels, this field is ignored.
  5512. * @values See Section @xref{dox:PcmChannelDefs}
  5513. */
  5514. };
  5515. /* @brief Multichannel PCM encoder configuration structure used
  5516. * in the #ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 command.
  5517. */
  5518. struct asm_multi_channel_pcm_enc_cfg_v2 {
  5519. struct apr_hdr hdr;
  5520. struct asm_stream_cmd_set_encdec_param encdec;
  5521. struct asm_enc_cfg_blk_param_v2 encblk;
  5522. uint16_t num_channels;
  5523. /*< Number of PCM channels.
  5524. *
  5525. * Supported values: - 0 -- Native mode - 1 -- 8 Native mode
  5526. * indicates that encoding must be performed with the number of
  5527. * channels at the input.
  5528. */
  5529. uint16_t bits_per_sample;
  5530. /*< Number of bits per sample per channel.
  5531. * Supported values: 16, 24
  5532. */
  5533. uint32_t sample_rate;
  5534. /*< Number of samples per second (in Hertz).
  5535. *
  5536. * Supported values: 0, 8000 to 48000 A value of 0 indicates the
  5537. * native sampling rate. Encoding is performed at the input sampling
  5538. * rate.
  5539. */
  5540. uint16_t is_signed;
  5541. /*< Specifies whether the samples are signed (1). Currently,
  5542. * only signed samples are supported.
  5543. */
  5544. uint16_t reserved;
  5545. /*< reserved field for 32 bit alignment. must be set to zero.*/
  5546. uint8_t channel_mapping[8];
  5547. } __packed;
  5548. #define ASM_MEDIA_FMT_MP3 0x00010BE9
  5549. #define ASM_MEDIA_FMT_AAC_V2 0x00010DA6
  5550. /* @xreflabel
  5551. * {hdr:AsmMediaFmtDolbyAac} Media format ID for the
  5552. * Dolby AAC decoder. This format ID is be used if the client wants
  5553. * to use the Dolby AAC decoder to decode MPEG2 and MPEG4 AAC
  5554. * contents.
  5555. */
  5556. #define ASM_MEDIA_FMT_DOLBY_AAC 0x00010D86
  5557. /* Enumeration for the audio data transport stream AAC format. */
  5558. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS 0
  5559. /* Enumeration for low overhead audio stream AAC format. */
  5560. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS 1
  5561. /* Enumeration for the audio data interchange format
  5562. * AAC format.
  5563. */
  5564. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF 2
  5565. /* Enumeration for the raw AAC format. */
  5566. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW 3
  5567. /* Enumeration for the AAC LATM format. */
  5568. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LATM 4
  5569. #define ASM_MEDIA_FMT_AAC_AOT_LC 2
  5570. #define ASM_MEDIA_FMT_AAC_AOT_SBR 5
  5571. #define ASM_MEDIA_FMT_AAC_AOT_PS 29
  5572. #define ASM_MEDIA_FMT_AAC_AOT_BSAC 22
  5573. struct asm_aac_fmt_blk_v2 {
  5574. struct apr_hdr hdr;
  5575. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5576. u16 aac_fmt_flag;
  5577. /* Bitstream format option.
  5578. * Supported values:
  5579. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
  5580. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS
  5581. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF
  5582. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
  5583. */
  5584. u16 audio_objype;
  5585. /* Audio Object Type (AOT) present in the AAC stream.
  5586. * Supported values:
  5587. * - #ASM_MEDIA_FMT_AAC_AOT_LC
  5588. * - #ASM_MEDIA_FMT_AAC_AOT_SBR
  5589. * - #ASM_MEDIA_FMT_AAC_AOT_BSAC
  5590. * - #ASM_MEDIA_FMT_AAC_AOT_PS
  5591. * - Otherwise -- Not supported
  5592. */
  5593. u16 channel_config;
  5594. /* Number of channels present in the AAC stream.
  5595. * Supported values:
  5596. * - 1 -- Mono
  5597. * - 2 -- Stereo
  5598. * - 6 -- 5.1 content
  5599. */
  5600. u16 total_size_of_PCE_bits;
  5601. /* greater or equal to zero. * -In case of RAW formats and
  5602. * channel config = 0 (PCE), client can send * the bit stream
  5603. * containing PCE immediately following this structure * (in-band).
  5604. * -This number does not include bits included for 32 bit alignment.
  5605. * -If zero, then the PCE info is assumed to be available in the
  5606. * audio -bit stream & not in-band.
  5607. */
  5608. u32 sample_rate;
  5609. /* Number of samples per second (in Hertz).
  5610. *
  5611. * Supported values: 8000, 11025, 12000, 16000, 22050, 24000, 32000,
  5612. * 44100, 48000
  5613. *
  5614. * This field must be equal to the sample rate of the AAC-LC
  5615. * decoder's output. - For MP4 or 3GP containers, this is indicated
  5616. * by the samplingFrequencyIndex field in the AudioSpecificConfig
  5617. * element. - For ADTS format, this is indicated by the
  5618. * samplingFrequencyIndex in the ADTS fixed header. - For ADIF
  5619. * format, this is indicated by the samplingFrequencyIndex in the
  5620. * program_config_element present in the ADIF header.
  5621. */
  5622. } __packed;
  5623. struct asm_aac_enc_cfg_v2 {
  5624. struct apr_hdr hdr;
  5625. struct asm_stream_cmd_set_encdec_param encdec;
  5626. struct asm_enc_cfg_blk_param_v2 encblk;
  5627. u32 bit_rate;
  5628. /* Encoding rate in bits per second. */
  5629. u32 enc_mode;
  5630. /* Encoding mode.
  5631. * Supported values:
  5632. * - #ASM_MEDIA_FMT_AAC_AOT_LC
  5633. * - #ASM_MEDIA_FMT_AAC_AOT_SBR
  5634. * - #ASM_MEDIA_FMT_AAC_AOT_PS
  5635. */
  5636. u16 aac_fmt_flag;
  5637. /* AAC format flag.
  5638. * Supported values:
  5639. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
  5640. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
  5641. */
  5642. u16 channel_cfg;
  5643. /* Number of channels to encode.
  5644. * Supported values:
  5645. * - 0 -- Native mode
  5646. * - 1 -- Mono
  5647. * - 2 -- Stereo
  5648. * - Other values are not supported.
  5649. * @note1hang The eAAC+ encoder mode supports only stereo.
  5650. * Native mode indicates that encoding must be performed with the
  5651. * number of channels at the input.
  5652. * The number of channels must not change during encoding.
  5653. */
  5654. u32 sample_rate;
  5655. /* Number of samples per second.
  5656. * Supported values: - 0 -- Native mode - For other values,
  5657. * Native mode indicates that encoding must be performed with the
  5658. * sampling rate at the input.
  5659. * The sampling rate must not change during encoding.
  5660. */
  5661. } __packed;
  5662. #define ASM_MEDIA_FMT_G711_ALAW_FS 0x00010BF7
  5663. #define ASM_MEDIA_FMT_G711_MLAW_FS 0x00010C2E
  5664. struct asm_g711_enc_cfg_v2 {
  5665. struct apr_hdr hdr;
  5666. struct asm_stream_cmd_set_encdec_param encdec;
  5667. struct asm_enc_cfg_blk_param_v2 encblk;
  5668. u32 sample_rate;
  5669. /*
  5670. * Number of samples per second.
  5671. * Supported values: 8000, 16000 Hz
  5672. */
  5673. } __packed;
  5674. struct asm_vorbis_fmt_blk_v2 {
  5675. struct apr_hdr hdr;
  5676. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5677. u32 bit_stream_fmt;
  5678. /* Bit stream format.
  5679. * Supported values:
  5680. * - 0 -- Raw bitstream
  5681. * - 1 -- Transcoded bitstream
  5682. *
  5683. * Transcoded bitstream containing the size of the frame as the first
  5684. * word in each frame.
  5685. */
  5686. } __packed;
  5687. struct asm_flac_fmt_blk_v2 {
  5688. struct apr_hdr hdr;
  5689. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5690. u16 is_stream_info_present;
  5691. /* Specifies whether stream information is present in the FLAC format
  5692. * block.
  5693. *
  5694. * Supported values:
  5695. * - 0 -- Stream information is not present in this message
  5696. * - 1 -- Stream information is present in this message
  5697. *
  5698. * When set to 1, the FLAC bitstream was successfully parsed by the
  5699. * client, and other fields in the FLAC format block can be read by the
  5700. * decoder to get metadata stream information.
  5701. */
  5702. u16 num_channels;
  5703. /* Number of channels for decoding.
  5704. * Supported values: 1 to 2
  5705. */
  5706. u16 min_blk_size;
  5707. /* Minimum block size (in samples) used in the stream. It must be less
  5708. * than or equal to max_blk_size.
  5709. */
  5710. u16 max_blk_size;
  5711. /* Maximum block size (in samples) used in the stream. If the
  5712. * minimum block size equals the maximum block size, a fixed block
  5713. * size stream is implied.
  5714. */
  5715. u16 md5_sum[8];
  5716. /* MD5 signature array of the unencoded audio data. This allows the
  5717. * decoder to determine if an error exists in the audio data, even when
  5718. * the error does not result in an invalid bitstream.
  5719. */
  5720. u32 sample_rate;
  5721. /* Number of samples per second.
  5722. * Supported values: 8000 to 48000 Hz
  5723. */
  5724. u32 min_frame_size;
  5725. /* Minimum frame size used in the stream.
  5726. * Supported values:
  5727. * - > 0 bytes
  5728. * - 0 -- The value is unknown
  5729. */
  5730. u32 max_frame_size;
  5731. /* Maximum frame size used in the stream.
  5732. * Supported values:
  5733. * -- > 0 bytes
  5734. * -- 0 . The value is unknown
  5735. */
  5736. u16 sample_size;
  5737. /* Bits per sample.Supported values: 8, 16 */
  5738. u16 reserved;
  5739. /* Clients must set this field to zero
  5740. */
  5741. } __packed;
  5742. struct asm_alac_fmt_blk_v2 {
  5743. struct apr_hdr hdr;
  5744. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5745. u32 frame_length;
  5746. u8 compatible_version;
  5747. u8 bit_depth;
  5748. u8 pb;
  5749. u8 mb;
  5750. u8 kb;
  5751. u8 num_channels;
  5752. u16 max_run;
  5753. u32 max_frame_bytes;
  5754. u32 avg_bit_rate;
  5755. u32 sample_rate;
  5756. u32 channel_layout_tag;
  5757. } __packed;
  5758. struct asm_g711_dec_fmt_blk_v2 {
  5759. struct apr_hdr hdr;
  5760. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5761. u32 sample_rate;
  5762. } __packed;
  5763. struct asm_ape_fmt_blk_v2 {
  5764. struct apr_hdr hdr;
  5765. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5766. u16 compatible_version;
  5767. u16 compression_level;
  5768. u32 format_flags;
  5769. u32 blocks_per_frame;
  5770. u32 final_frame_blocks;
  5771. u32 total_frames;
  5772. u16 bits_per_sample;
  5773. u16 num_channels;
  5774. u32 sample_rate;
  5775. u32 seek_table_present;
  5776. } __packed;
  5777. struct asm_dsd_fmt_blk_v2 {
  5778. struct apr_hdr hdr;
  5779. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5780. u16 num_version;
  5781. u16 is_bitwise_big_endian;
  5782. u16 dsd_channel_block_size;
  5783. u16 num_channels;
  5784. u8 channel_mapping[8];
  5785. u32 dsd_data_rate;
  5786. } __packed;
  5787. #define ASM_MEDIA_FMT_AMRNB_FS 0x00010BEB
  5788. /* Enumeration for 4.75 kbps AMR-NB Encoding mode. */
  5789. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MR475 0
  5790. /* Enumeration for 5.15 kbps AMR-NB Encoding mode. */
  5791. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MR515 1
  5792. /* Enumeration for 5.90 kbps AMR-NB Encoding mode. */
  5793. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR59 2
  5794. /* Enumeration for 6.70 kbps AMR-NB Encoding mode. */
  5795. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR67 3
  5796. /* Enumeration for 7.40 kbps AMR-NB Encoding mode. */
  5797. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR74 4
  5798. /* Enumeration for 7.95 kbps AMR-NB Encoding mode. */
  5799. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR795 5
  5800. /* Enumeration for 10.20 kbps AMR-NB Encoding mode. */
  5801. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR102 6
  5802. /* Enumeration for 12.20 kbps AMR-NB Encoding mode. */
  5803. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR122 7
  5804. /* Enumeration for AMR-NB Discontinuous Transmission mode off. */
  5805. #define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF 0
  5806. /* Enumeration for AMR-NB DTX mode VAD1. */
  5807. #define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1 1
  5808. /* Enumeration for AMR-NB DTX mode VAD2. */
  5809. #define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD2 2
  5810. /* Enumeration for AMR-NB DTX mode auto. */
  5811. #define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_AUTO 3
  5812. struct asm_amrnb_enc_cfg {
  5813. struct apr_hdr hdr;
  5814. struct asm_stream_cmd_set_encdec_param encdec;
  5815. struct asm_enc_cfg_blk_param_v2 encblk;
  5816. u16 enc_mode;
  5817. /* AMR-NB encoding rate.
  5818. * Supported values:
  5819. * Use the ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_*
  5820. * macros
  5821. */
  5822. u16 dtx_mode;
  5823. /* Specifies whether DTX mode is disabled or enabled.
  5824. * Supported values:
  5825. * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF
  5826. * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1
  5827. */
  5828. } __packed;
  5829. #define ASM_MEDIA_FMT_AMRWB_FS 0x00010BEC
  5830. /* Enumeration for 6.6 kbps AMR-WB Encoding mode. */
  5831. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR66 0
  5832. /* Enumeration for 8.85 kbps AMR-WB Encoding mode. */
  5833. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR885 1
  5834. /* Enumeration for 12.65 kbps AMR-WB Encoding mode. */
  5835. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1265 2
  5836. /* Enumeration for 14.25 kbps AMR-WB Encoding mode. */
  5837. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1425 3
  5838. /* Enumeration for 15.85 kbps AMR-WB Encoding mode. */
  5839. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1585 4
  5840. /* Enumeration for 18.25 kbps AMR-WB Encoding mode. */
  5841. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1825 5
  5842. /* Enumeration for 19.85 kbps AMR-WB Encoding mode. */
  5843. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1985 6
  5844. /* Enumeration for 23.05 kbps AMR-WB Encoding mode. */
  5845. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR2305 7
  5846. /* Enumeration for 23.85 kbps AMR-WB Encoding mode. */
  5847. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR2385 8
  5848. struct asm_amrwb_enc_cfg {
  5849. struct apr_hdr hdr;
  5850. struct asm_stream_cmd_set_encdec_param encdec;
  5851. struct asm_enc_cfg_blk_param_v2 encblk;
  5852. u16 enc_mode;
  5853. /* AMR-WB encoding rate.
  5854. * Suupported values:
  5855. * Use the ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_*
  5856. * macros
  5857. */
  5858. u16 dtx_mode;
  5859. /* Specifies whether DTX mode is disabled or enabled.
  5860. * Supported values:
  5861. * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF
  5862. * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1
  5863. */
  5864. } __packed;
  5865. #define ASM_MEDIA_FMT_V13K_FS 0x00010BED
  5866. /* Enumeration for 14.4 kbps V13K Encoding mode. */
  5867. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1440 0
  5868. /* Enumeration for 12.2 kbps V13K Encoding mode. */
  5869. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1220 1
  5870. /* Enumeration for 11.2 kbps V13K Encoding mode. */
  5871. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1120 2
  5872. /* Enumeration for 9.0 kbps V13K Encoding mode. */
  5873. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR90 3
  5874. /* Enumeration for 7.2 kbps V13K eEncoding mode. */
  5875. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR720 4
  5876. /* Enumeration for 1/8 vocoder rate.*/
  5877. #define ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE 1
  5878. /* Enumeration for 1/4 vocoder rate. */
  5879. #define ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE 2
  5880. /* Enumeration for 1/2 vocoder rate. */
  5881. #define ASM_MEDIA_FMT_VOC_HALF_RATE 3
  5882. /* Enumeration for full vocoder rate. */
  5883. #define ASM_MEDIA_FMT_VOC_FULL_RATE 4
  5884. struct asm_v13k_enc_cfg {
  5885. struct apr_hdr hdr;
  5886. struct asm_stream_cmd_set_encdec_param encdec;
  5887. struct asm_enc_cfg_blk_param_v2 encblk;
  5888. u16 max_rate;
  5889. /* Maximum allowed encoder frame rate.
  5890. * Supported values:
  5891. * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
  5892. * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
  5893. * - #ASM_MEDIA_FMT_VOC_HALF_RATE
  5894. * - #ASM_MEDIA_FMT_VOC_FULL_RATE
  5895. */
  5896. u16 min_rate;
  5897. /* Minimum allowed encoder frame rate.
  5898. * Supported values:
  5899. * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
  5900. * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
  5901. * - #ASM_MEDIA_FMT_VOC_HALF_RATE
  5902. * - #ASM_MEDIA_FMT_VOC_FULL_RATE
  5903. */
  5904. u16 reduced_rate_cmd;
  5905. /* Reduced rate command, used to change
  5906. * the average bitrate of the V13K
  5907. * vocoder.
  5908. * Supported values:
  5909. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1440 (Default)
  5910. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1220
  5911. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1120
  5912. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR90
  5913. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR720
  5914. */
  5915. u16 rate_mod_cmd;
  5916. /* Rate modulation command. Default = 0.
  5917. *- If bit 0=1, rate control is enabled.
  5918. *- If bit 1=1, the maximum number of consecutive full rate
  5919. * frames is limited with numbers supplied in
  5920. * bits 2 to 10.
  5921. *- If bit 1=0, the minimum number of non-full rate frames
  5922. * in between two full rate frames is forced to
  5923. * the number supplied in bits 2 to 10. In both cases, if necessary,
  5924. * half rate is used to substitute full rate. - Bits 15 to 10 are
  5925. * reserved and must all be set to zero.
  5926. */
  5927. } __packed;
  5928. #define ASM_MEDIA_FMT_EVRC_FS 0x00010BEE
  5929. /* EVRC encoder configuration structure used in the
  5930. * #ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 command.
  5931. */
  5932. struct asm_evrc_enc_cfg {
  5933. struct apr_hdr hdr;
  5934. struct asm_stream_cmd_set_encdec_param encdec;
  5935. struct asm_enc_cfg_blk_param_v2 encblk;
  5936. u16 max_rate;
  5937. /* Maximum allowed encoder frame rate.
  5938. * Supported values:
  5939. * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
  5940. * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
  5941. * - #ASM_MEDIA_FMT_VOC_HALF_RATE
  5942. * - #ASM_MEDIA_FMT_VOC_FULL_RATE
  5943. */
  5944. u16 min_rate;
  5945. /* Minimum allowed encoder frame rate.
  5946. * Supported values:
  5947. * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
  5948. * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
  5949. * - #ASM_MEDIA_FMT_VOC_HALF_RATE
  5950. * - #ASM_MEDIA_FMT_VOC_FULL_RATE
  5951. */
  5952. u16 rate_mod_cmd;
  5953. /* Rate modulation command. Default: 0.
  5954. * - If bit 0=1, rate control is enabled.
  5955. * - If bit 1=1, the maximum number of consecutive full rate frames
  5956. * is limited with numbers supplied in bits 2 to 10.
  5957. *
  5958. * - If bit 1=0, the minimum number of non-full rate frames in
  5959. * between two full rate frames is forced to the number supplied in
  5960. * bits 2 to 10. In both cases, if necessary, half rate is used to
  5961. * substitute full rate.
  5962. *
  5963. * - Bits 15 to 10 are reserved and must all be set to zero.
  5964. */
  5965. u16 reserved;
  5966. /* Reserved. Clients must set this field to zero. */
  5967. } __packed;
  5968. #define ASM_MEDIA_FMT_WMA_V10PRO_V2 0x00010DA7
  5969. struct asm_wmaprov10_fmt_blk_v2 {
  5970. struct apr_hdr hdr;
  5971. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5972. u16 fmtag;
  5973. /* WMA format type.
  5974. * Supported values:
  5975. * - 0x162 -- WMA 9 Pro
  5976. * - 0x163 -- WMA 9 Pro Lossless
  5977. * - 0x166 -- WMA 10 Pro
  5978. * - 0x167 -- WMA 10 Pro Lossless
  5979. */
  5980. u16 num_channels;
  5981. /* Number of channels encoded in the input stream.
  5982. * Supported values: 1 to 8
  5983. */
  5984. u32 sample_rate;
  5985. /* Number of samples per second (in Hertz).
  5986. * Supported values: 11025, 16000, 22050, 32000, 44100, 48000,
  5987. * 88200, 96000
  5988. */
  5989. u32 avg_bytes_per_sec;
  5990. /* Bitrate expressed as the average bytes per second.
  5991. * Supported values: 2000 to 96000
  5992. */
  5993. u16 blk_align;
  5994. /* Size of the bitstream packet size in bytes. WMA Pro files
  5995. * have a payload of one block per bitstream packet.
  5996. * Supported values: @le 13376
  5997. */
  5998. u16 bits_per_sample;
  5999. /* Number of bits per sample in the encoded WMA stream.
  6000. * Supported values: 16, 24
  6001. */
  6002. u32 channel_mask;
  6003. /* Bit-packed double word (32-bits) that indicates the
  6004. * recommended speaker positions for each source channel.
  6005. */
  6006. u16 enc_options;
  6007. /* Bit-packed word with values that indicate whether certain
  6008. * features of the bitstream are used.
  6009. * Supported values: - 0x0001 -- ENCOPT3_PURE_LOSSLESS - 0x0006 --
  6010. * ENCOPT3_FRM_SIZE_MOD - 0x0038 -- ENCOPT3_SUBFRM_DIV - 0x0040 --
  6011. * ENCOPT3_WRITE_FRAMESIZE_IN_HDR - 0x0080 --
  6012. * ENCOPT3_GENERATE_DRC_PARAMS - 0x0100 -- ENCOPT3_RTMBITS
  6013. */
  6014. u16 usAdvancedEncodeOpt;
  6015. /* Advanced encoding option. */
  6016. u32 advanced_enc_options2;
  6017. /* Advanced encoding option 2. */
  6018. } __packed;
  6019. #define ASM_MEDIA_FMT_WMA_V9_V2 0x00010DA8
  6020. struct asm_wmastdv9_fmt_blk_v2 {
  6021. struct apr_hdr hdr;
  6022. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  6023. u16 fmtag;
  6024. /* WMA format tag.
  6025. * Supported values: 0x161 (WMA 9 standard)
  6026. */
  6027. u16 num_channels;
  6028. /* Number of channels in the stream.
  6029. * Supported values: 1, 2
  6030. */
  6031. u32 sample_rate;
  6032. /* Number of samples per second (in Hertz).
  6033. * Supported values: 48000
  6034. */
  6035. u32 avg_bytes_per_sec;
  6036. /* Bitrate expressed as the average bytes per second. */
  6037. u16 blk_align;
  6038. /* Block align. All WMA files with a maximum packet size of
  6039. * 13376 are supported.
  6040. */
  6041. u16 bits_per_sample;
  6042. /* Number of bits per sample in the output.
  6043. * Supported values: 16
  6044. */
  6045. u32 channel_mask;
  6046. /* Channel mask.
  6047. * Supported values:
  6048. * - 3 -- Stereo (front left/front right)
  6049. * - 4 -- Mono (center)
  6050. */
  6051. u16 enc_options;
  6052. /* Options used during encoding. */
  6053. u16 reserved;
  6054. } __packed;
  6055. #define ASM_MEDIA_FMT_WMA_V8 0x00010D91
  6056. struct asm_wmastdv8_enc_cfg {
  6057. struct apr_hdr hdr;
  6058. struct asm_stream_cmd_set_encdec_param encdec;
  6059. struct asm_enc_cfg_blk_param_v2 encblk;
  6060. u32 bit_rate;
  6061. /* Encoding rate in bits per second. */
  6062. u32 sample_rate;
  6063. /* Number of samples per second.
  6064. *
  6065. * Supported values:
  6066. * - 0 -- Native mode
  6067. * - Other Supported values are 22050, 32000, 44100, and 48000.
  6068. *
  6069. * Native mode indicates that encoding must be performed with the
  6070. * sampling rate at the input.
  6071. * The sampling rate must not change during encoding.
  6072. */
  6073. u16 channel_cfg;
  6074. /* Number of channels to encode.
  6075. * Supported values:
  6076. * - 0 -- Native mode
  6077. * - 1 -- Mono
  6078. * - 2 -- Stereo
  6079. * - Other values are not supported.
  6080. *
  6081. * Native mode indicates that encoding must be performed with the
  6082. * number of channels at the input.
  6083. * The number of channels must not change during encoding.
  6084. */
  6085. u16 reserved;
  6086. /* Reserved. Clients must set this field to zero.*/
  6087. } __packed;
  6088. #define ASM_MEDIA_FMT_AMR_WB_PLUS_V2 0x00010DA9
  6089. struct asm_amrwbplus_fmt_blk_v2 {
  6090. struct apr_hdr hdr;
  6091. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  6092. u32 amr_frame_fmt;
  6093. /* AMR frame format.
  6094. * Supported values:
  6095. * - 6 -- Transport Interface Format (TIF)
  6096. * - Any other value -- File storage format (FSF)
  6097. *
  6098. * TIF stream contains 2-byte header for each frame within the
  6099. * superframe. FSF stream contains one 2-byte header per superframe.
  6100. */
  6101. } __packed;
  6102. #define ASM_MEDIA_FMT_AC3 0x00010DEE
  6103. #define ASM_MEDIA_FMT_EAC3 0x00010DEF
  6104. #define ASM_MEDIA_FMT_DTS 0x00010D88
  6105. #define ASM_MEDIA_FMT_MP2 0x00010DE9
  6106. #define ASM_MEDIA_FMT_FLAC 0x00010C16
  6107. #define ASM_MEDIA_FMT_ALAC 0x00012F31
  6108. #define ASM_MEDIA_FMT_VORBIS 0x00010C15
  6109. #define ASM_MEDIA_FMT_APE 0x00012F32
  6110. #define ASM_MEDIA_FMT_DSD 0x00012F3E
  6111. #define ASM_MEDIA_FMT_TRUEHD 0x00013215
  6112. /* 0x0 is used for fomat ID since ADSP dynamically determines the
  6113. * format encapsulated in the IEC61937 (compressed) or IEC60958
  6114. * (pcm) packets.
  6115. */
  6116. #define ASM_MEDIA_FMT_IEC 0x00000000
  6117. /* Media format ID for adaptive transform acoustic coding. This
  6118. * ID is used by the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED command
  6119. * only.
  6120. */
  6121. #define ASM_MEDIA_FMT_ATRAC 0x00010D89
  6122. /* Media format ID for metadata-enhanced audio transmission.
  6123. * This ID is used by the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED
  6124. * command only.
  6125. */
  6126. #define ASM_MEDIA_FMT_MAT 0x00010D8A
  6127. /* adsp_media_fmt.h */
  6128. #define ASM_DATA_CMD_WRITE_V2 0x00010DAB
  6129. struct asm_data_cmd_write_v2 {
  6130. struct apr_hdr hdr;
  6131. u32 buf_addr_lsw;
  6132. /* The 64 bit address msw-lsw should be a valid, mapped address.
  6133. * 64 bit address should be a multiple of 32 bytes
  6134. */
  6135. u32 buf_addr_msw;
  6136. /* The 64 bit address msw-lsw should be a valid, mapped address.
  6137. * 64 bit address should be a multiple of 32 bytes.
  6138. * -Address of the buffer containing the data to be decoded.
  6139. * The buffer should be aligned to a 32 byte boundary.
  6140. * -In the case of 32 bit Shared memory address, msw field must
  6141. * -be set to zero.
  6142. * -In the case of 36 bit shared memory address, bit 31 to bit 4
  6143. * -of msw must be set to zero.
  6144. */
  6145. u32 mem_map_handle;
  6146. /* memory map handle returned by DSP through
  6147. * ASM_CMD_SHARED_MEM_MAP_REGIONS command
  6148. */
  6149. u32 buf_size;
  6150. /* Number of valid bytes available in the buffer for decoding. The
  6151. * first byte starts at buf_addr.
  6152. */
  6153. u32 seq_id;
  6154. /* Optional buffer sequence ID. */
  6155. u32 timestamp_lsw;
  6156. /* Lower 32 bits of the 64-bit session time in microseconds of the
  6157. * first buffer sample.
  6158. */
  6159. u32 timestamp_msw;
  6160. /* Upper 32 bits of the 64-bit session time in microseconds of the
  6161. * first buffer sample.
  6162. */
  6163. u32 flags;
  6164. /* Bitfield of flags.
  6165. * Supported values for bit 31:
  6166. * - 1 -- Valid timestamp.
  6167. * - 0 -- Invalid timestamp.
  6168. * - Use #ASM_BIT_MASKIMESTAMP_VALID_FLAG as the bitmask and
  6169. * #ASM_SHIFTIMESTAMP_VALID_FLAG as the shift value to set this bit.
  6170. * Supported values for bit 30:
  6171. * - 1 -- Last buffer.
  6172. * - 0 -- Not the last buffer.
  6173. *
  6174. * Supported values for bit 29:
  6175. * - 1 -- Continue the timestamp from the previous buffer.
  6176. * - 0 -- Timestamp of the current buffer is not related
  6177. * to the timestamp of the previous buffer.
  6178. * - Use #ASM_BIT_MASKS_CONTINUE_FLAG and #ASM_SHIFTS_CONTINUE_FLAG
  6179. * to set this bit.
  6180. *
  6181. * Supported values for bit 4:
  6182. * - 1 -- End of the frame.
  6183. * - 0 -- Not the end of frame, or this information is not known.
  6184. * - Use #ASM_BIT_MASK_EOF_FLAG as the bitmask and #ASM_SHIFT_EOF_FLAG
  6185. * as the shift value to set this bit.
  6186. *
  6187. * All other bits are reserved and must be set to 0.
  6188. *
  6189. * If bit 31=0 and bit 29=1: The timestamp of the first sample in
  6190. * this buffer continues from the timestamp of the last sample in
  6191. * the previous buffer. If there is no previous buffer (i.e., this
  6192. * is the first buffer sent after opening the stream or after a
  6193. * flush operation), or if the previous buffer does not have a valid
  6194. * timestamp, the samples in the current buffer also do not have a
  6195. * valid timestamp. They are played out as soon as possible.
  6196. *
  6197. *
  6198. * If bit 31=0 and bit 29=0: No timestamp is associated with the
  6199. * first sample in this buffer. The samples are played out as soon
  6200. * as possible.
  6201. *
  6202. *
  6203. * If bit 31=1 and bit 29 is ignored: The timestamp specified in
  6204. * this payload is honored.
  6205. *
  6206. *
  6207. * If bit 30=0: Not the last buffer in the stream. This is useful
  6208. * in removing trailing samples.
  6209. *
  6210. *
  6211. * For bit 4: The client can set this flag for every buffer sent in
  6212. * which the last byte is the end of a frame. If this flag is set,
  6213. * the buffer can contain data from multiple frames, but it should
  6214. * always end at a frame boundary. Restrictions allow the aDSP to
  6215. * detect an end of frame without requiring additional processing.
  6216. */
  6217. } __packed;
  6218. #define ASM_DATA_CMD_READ_V2 0x00010DAC
  6219. struct asm_data_cmd_read_v2 {
  6220. struct apr_hdr hdr;
  6221. u32 buf_addr_lsw;
  6222. /* the 64 bit address msw-lsw should be a valid mapped address
  6223. * and should be a multiple of 32 bytes
  6224. */
  6225. u32 buf_addr_msw;
  6226. /* the 64 bit address msw-lsw should be a valid mapped address
  6227. * and should be a multiple of 32 bytes.
  6228. * - Address of the buffer where the DSP puts the encoded data,
  6229. * potentially, at an offset specified by the uOffset field in
  6230. * ASM_DATA_EVENT_READ_DONE structure. The buffer should be aligned
  6231. * to a 32 byte boundary.
  6232. * - In the case of 32 bit Shared memory address, msw field must
  6233. * - be set to zero.
  6234. * - In the case of 36 bit shared memory address, bit 31 to bit
  6235. * - 4 of msw must be set to zero.
  6236. */
  6237. u32 mem_map_handle;
  6238. /* memory map handle returned by DSP through
  6239. * ASM_CMD_SHARED_MEM_MAP_REGIONS command.
  6240. */
  6241. u32 buf_size;
  6242. /* Number of bytes available for the aDSP to write. The aDSP
  6243. * starts writing from buf_addr.
  6244. */
  6245. u32 seq_id;
  6246. /* Optional buffer sequence ID. */
  6247. } __packed;
  6248. #define ASM_DATA_CMD_EOS 0x00010BDB
  6249. #define ASM_DATA_EVENT_RENDERED_EOS 0x00010C1C
  6250. #define ASM_DATA_EVENT_EOS 0x00010BDD
  6251. #define ASM_DATA_CMD_EOS_V2 0x00012F3C
  6252. #define ASM_DATA_EVENT_RENDERED_EOS_V2 0x00012F3D
  6253. #define ASM_DATA_EVENT_WRITE_DONE_V2 0x00010D99
  6254. struct asm_data_event_write_done_v2 {
  6255. u32 buf_addr_lsw;
  6256. /* lsw of the 64 bit address */
  6257. u32 buf_addr_msw;
  6258. /* msw of the 64 bit address. address given by the client in
  6259. * ASM_DATA_CMD_WRITE_V2 command.
  6260. */
  6261. u32 mem_map_handle;
  6262. /* memory map handle in the ASM_DATA_CMD_WRITE_V2 */
  6263. u32 status;
  6264. /* Status message (error code) that indicates whether the
  6265. * referenced buffer has been successfully consumed.
  6266. * Supported values: Refer to @xhyperref{Q3,[Q3]}
  6267. */
  6268. } __packed;
  6269. #define ASM_DATA_EVENT_READ_DONE_V2 0x00010D9A
  6270. /* Definition of the frame metadata flag bitmask.*/
  6271. #define ASM_BIT_MASK_FRAME_METADATA_FLAG (0x40000000UL)
  6272. /* Definition of the frame metadata flag shift value. */
  6273. #define ASM_SHIFT_FRAME_METADATA_FLAG 30
  6274. struct asm_data_event_read_done_v2 {
  6275. u32 status;
  6276. /* Status message (error code).
  6277. * Supported values: Refer to @xhyperref{Q3,[Q3]}
  6278. */
  6279. u32 buf_addr_lsw;
  6280. /* 64 bit address msw-lsw is a valid, mapped address. 64 bit
  6281. * address is a multiple of 32 bytes.
  6282. */
  6283. u32 buf_addr_msw;
  6284. /* 64 bit address msw-lsw is a valid, mapped address. 64 bit
  6285. * address is a multiple of 32 bytes.
  6286. *
  6287. * -Same address provided by the client in ASM_DATA_CMD_READ_V2
  6288. * -In the case of 32 bit Shared memory address, msw field is set to
  6289. * zero.
  6290. * -In the case of 36 bit shared memory address, bit 31 to bit 4
  6291. * -of msw is set to zero.
  6292. */
  6293. u32 mem_map_handle;
  6294. /* memory map handle in the ASM_DATA_CMD_READ_V2 */
  6295. u32 enc_framesotal_size;
  6296. /* Total size of the encoded frames in bytes.
  6297. * Supported values: >0
  6298. */
  6299. u32 offset;
  6300. /* Offset (from buf_addr) to the first byte of the first encoded
  6301. * frame. All encoded frames are consecutive, starting from this
  6302. * offset.
  6303. * Supported values: > 0
  6304. */
  6305. u32 timestamp_lsw;
  6306. /* Lower 32 bits of the 64-bit session time in microseconds of
  6307. * the first sample in the buffer. If Bit 5 of mode_flags flag of
  6308. * ASM_STREAM_CMD_OPEN_READ_V2 is 1 then the 64 bit timestamp is
  6309. * absolute capture time otherwise it is relative session time. The
  6310. * absolute timestamp doesn't reset unless the system is reset.
  6311. */
  6312. u32 timestamp_msw;
  6313. /* Upper 32 bits of the 64-bit session time in microseconds of
  6314. * the first sample in the buffer.
  6315. */
  6316. u32 flags;
  6317. /* Bitfield of flags. Bit 30 indicates whether frame metadata is
  6318. * present. If frame metadata is present, num_frames consecutive
  6319. * instances of @xhyperref{hdr:FrameMetaData,Frame metadata} start
  6320. * at the buffer address.
  6321. * Supported values for bit 31:
  6322. * - 1 -- Timestamp is valid.
  6323. * - 0 -- Timestamp is invalid.
  6324. * - Use #ASM_BIT_MASKIMESTAMP_VALID_FLAG and
  6325. * #ASM_SHIFTIMESTAMP_VALID_FLAG to set this bit.
  6326. *
  6327. * Supported values for bit 30:
  6328. * - 1 -- Frame metadata is present.
  6329. * - 0 -- Frame metadata is absent.
  6330. * - Use #ASM_BIT_MASK_FRAME_METADATA_FLAG and
  6331. * #ASM_SHIFT_FRAME_METADATA_FLAG to set this bit.
  6332. *
  6333. * All other bits are reserved; the aDSP sets them to 0.
  6334. */
  6335. u32 num_frames;
  6336. /* Number of encoded frames in the buffer. */
  6337. u32 seq_id;
  6338. /* Optional buffer sequence ID. */
  6339. } __packed;
  6340. struct asm_data_read_buf_metadata_v2 {
  6341. u32 offset;
  6342. /* Offset from buf_addr in #ASM_DATA_EVENT_READ_DONE_PAYLOAD to
  6343. * the frame associated with this metadata.
  6344. * Supported values: > 0
  6345. */
  6346. u32 frm_size;
  6347. /* Size of the encoded frame in bytes.
  6348. * Supported values: > 0
  6349. */
  6350. u32 num_encoded_pcm_samples;
  6351. /* Number of encoded PCM samples (per channel) in the frame
  6352. * associated with this metadata.
  6353. * Supported values: > 0
  6354. */
  6355. u32 timestamp_lsw;
  6356. /* Lower 32 bits of the 64-bit session time in microseconds of the
  6357. * first sample for this frame.
  6358. * If Bit 5 of mode_flags flag of ASM_STREAM_CMD_OPEN_READ_V2 is 1
  6359. * then the 64 bit timestamp is absolute capture time otherwise it
  6360. * is relative session time. The absolute timestamp doesn't reset
  6361. * unless the system is reset.
  6362. */
  6363. u32 timestamp_msw;
  6364. /* Lower 32 bits of the 64-bit session time in microseconds of the
  6365. * first sample for this frame.
  6366. */
  6367. u32 flags;
  6368. /* Frame flags.
  6369. * Supported values for bit 31:
  6370. * - 1 -- Time stamp is valid
  6371. * - 0 -- Time stamp is not valid
  6372. * - All other bits are reserved; the aDSP sets them to 0.
  6373. */
  6374. } __packed;
  6375. /* Notifies the client of a change in the data sampling rate or
  6376. * Channel mode. This event is raised by the decoder service. The
  6377. * event is enabled through the mode flags of
  6378. * #ASM_STREAM_CMD_OPEN_WRITE_V2 or
  6379. * #ASM_STREAM_CMD_OPEN_READWRITE_V2. - The decoder detects a change
  6380. * in the output sampling frequency or the number/positioning of
  6381. * output channels, or if it is the first frame decoded.The new
  6382. * sampling frequency or the new channel configuration is
  6383. * communicated back to the client asynchronously.
  6384. */
  6385. #define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
  6386. /* Payload of the #ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY event.
  6387. * This event is raised when the following conditions are both true:
  6388. * - The event is enabled through the mode_flags of
  6389. * #ASM_STREAM_CMD_OPEN_WRITE_V2 or
  6390. * #ASM_STREAM_CMD_OPEN_READWRITE_V2. - The decoder detects a change
  6391. * in either the output sampling frequency or the number/positioning
  6392. * of output channels, or if it is the first frame decoded.
  6393. * This event is not raised (even if enabled) if the decoder is
  6394. * MIDI, because
  6395. */
  6396. struct asm_data_event_sr_cm_change_notify {
  6397. u32 sample_rate;
  6398. /* New sampling rate (in Hertz) after detecting a change in the
  6399. * bitstream.
  6400. * Supported values: 2000 to 48000
  6401. */
  6402. u16 num_channels;
  6403. /* New number of channels after detecting a change in the
  6404. * bitstream.
  6405. * Supported values: 1 to 8
  6406. */
  6407. u16 reserved;
  6408. /* Reserved for future use. This field must be set to 0.*/
  6409. u8 channel_mapping[8];
  6410. } __packed;
  6411. /* Notifies the client of a data sampling rate or channel mode
  6412. * change. This event is raised by the encoder service.
  6413. * This event is raised when :
  6414. * - Native mode encoding was requested in the encoder
  6415. * configuration (i.e., the channel number was 0), the sample rate
  6416. * was 0, or both were 0.
  6417. *
  6418. * - The input data frame at the encoder is the first one, or the
  6419. * sampling rate/channel mode is different from the previous input
  6420. * data frame.
  6421. *
  6422. */
  6423. #define ASM_DATA_EVENT_ENC_SR_CM_CHANGE_NOTIFY 0x00010BDE
  6424. struct asm_data_event_enc_sr_cm_change_notify {
  6425. u32 sample_rate;
  6426. /* New sampling rate (in Hertz) after detecting a change in the
  6427. * input data.
  6428. * Supported values: 2000 to 48000
  6429. */
  6430. u16 num_channels;
  6431. /* New number of channels after detecting a change in the input
  6432. * data. Supported values: 1 to 8
  6433. */
  6434. u16 bits_per_sample;
  6435. /* New bits per sample after detecting a change in the input
  6436. * data.
  6437. * Supported values: 16, 24
  6438. */
  6439. u8 channel_mapping[8];
  6440. } __packed;
  6441. #define ASM_DATA_CMD_IEC_60958_FRAME_RATE 0x00010D87
  6442. /* Payload of the #ASM_DATA_CMD_IEC_60958_FRAME_RATE command,
  6443. * which is used to indicate the IEC 60958 frame rate of a given
  6444. * packetized audio stream.
  6445. */
  6446. struct asm_data_cmd_iec_60958_frame_rate {
  6447. u32 frame_rate;
  6448. /* IEC 60958 frame rate of the incoming IEC 61937 packetized stream.
  6449. * Supported values: Any valid frame rate
  6450. */
  6451. } __packed;
  6452. /* adsp_asm_data_commands.h*/
  6453. /* Definition of the stream ID bitmask.*/
  6454. #define ASM_BIT_MASK_STREAM_ID (0x000000FFUL)
  6455. /* Definition of the stream ID shift value.*/
  6456. #define ASM_SHIFT_STREAM_ID 0
  6457. /* Definition of the session ID bitmask.*/
  6458. #define ASM_BIT_MASK_SESSION_ID (0x0000FF00UL)
  6459. /* Definition of the session ID shift value.*/
  6460. #define ASM_SHIFT_SESSION_ID 8
  6461. /* Definition of the service ID bitmask.*/
  6462. #define ASM_BIT_MASK_SERVICE_ID (0x00FF0000UL)
  6463. /* Definition of the service ID shift value.*/
  6464. #define ASM_SHIFT_SERVICE_ID 16
  6465. /* Definition of the domain ID bitmask.*/
  6466. #define ASM_BIT_MASK_DOMAIN_ID (0xFF000000UL)
  6467. /* Definition of the domain ID shift value.*/
  6468. #define ASM_SHIFT_DOMAIN_ID 24
  6469. #define ASM_CMD_SHARED_MEM_MAP_REGIONS 0x00010D92
  6470. #define ASM_CMDRSP_SHARED_MEM_MAP_REGIONS 0x00010D93
  6471. #define ASM_CMD_SHARED_MEM_UNMAP_REGIONS 0x00010D94
  6472. /* adsp_asm_service_commands.h */
  6473. #define ASM_MAX_SESSION_ID (15)
  6474. /* Maximum number of sessions.*/
  6475. #define ASM_MAX_NUM_SESSIONS ASM_MAX_SESSION_ID
  6476. /* Maximum number of streams per session.*/
  6477. #define ASM_MAX_STREAMS_PER_SESSION (8)
  6478. #define ASM_SESSION_CMD_RUN_V2 0x00010DAA
  6479. #define ASM_SESSION_CMD_RUN_STARTIME_RUN_IMMEDIATE 0
  6480. #define ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_ABSOLUTEIME 1
  6481. #define ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_RELATIVEIME 2
  6482. #define ASM_SESSION_CMD_RUN_STARTIME_RUN_WITH_DELAY 3
  6483. #define ASM_BIT_MASK_RUN_STARTIME (0x00000003UL)
  6484. /* Bit shift value used to specify the start time for the
  6485. * ASM_SESSION_CMD_RUN_V2 command.
  6486. */
  6487. #define ASM_SHIFT_RUN_STARTIME 0
  6488. struct asm_session_cmd_run_v2 {
  6489. struct apr_hdr hdr;
  6490. u32 flags;
  6491. /* Specifies whether to run immediately or at a specific
  6492. * rendering time or with a specified delay. Run with delay is
  6493. * useful for delaying in case of ASM loopback opened through
  6494. * ASM_STREAM_CMD_OPEN_LOOPBACK_V2. Use #ASM_BIT_MASK_RUN_STARTIME
  6495. * and #ASM_SHIFT_RUN_STARTIME to set this 2-bit flag.
  6496. *
  6497. *
  6498. *Bits 0 and 1 can take one of four possible values:
  6499. *
  6500. *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_IMMEDIATE
  6501. *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_ABSOLUTEIME
  6502. *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_RELATIVEIME
  6503. *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_WITH_DELAY
  6504. *
  6505. *All other bits are reserved; clients must set them to zero.
  6506. */
  6507. u32 time_lsw;
  6508. /* Lower 32 bits of the time in microseconds used to align the
  6509. * session origin time. When bits 0-1 of flags is
  6510. * ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY, time lsw is the lsw of
  6511. * the delay in us. For ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY,
  6512. * maximum value of the 64 bit delay is 150 ms.
  6513. */
  6514. u32 time_msw;
  6515. /* Upper 32 bits of the time in microseconds used to align the
  6516. * session origin time. When bits 0-1 of flags is
  6517. * ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY, time msw is the msw of
  6518. * the delay in us. For ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY,
  6519. * maximum value of the 64 bit delay is 150 ms.
  6520. */
  6521. } __packed;
  6522. #define ASM_SESSION_CMD_PAUSE 0x00010BD3
  6523. #define ASM_SESSION_CMD_SUSPEND 0x00010DEC
  6524. #define ASM_SESSION_CMD_GET_SESSIONTIME_V3 0x00010D9D
  6525. #define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
  6526. struct asm_session_cmd_rgstr_rx_underflow {
  6527. struct apr_hdr hdr;
  6528. u16 enable_flag;
  6529. /* Specifies whether a client is to receive events when an Rx
  6530. * session underflows.
  6531. * Supported values:
  6532. * - 0 -- Do not send underflow events
  6533. * - 1 -- Send underflow events
  6534. */
  6535. u16 reserved;
  6536. /* Reserved. This field must be set to zero.*/
  6537. } __packed;
  6538. #define ASM_SESSION_CMD_REGISTER_FORX_OVERFLOW_EVENTS 0x00010BD6
  6539. struct asm_session_cmd_regx_overflow {
  6540. struct apr_hdr hdr;
  6541. u16 enable_flag;
  6542. /* Specifies whether a client is to receive events when a Tx
  6543. * session overflows.
  6544. * Supported values:
  6545. * - 0 -- Do not send overflow events
  6546. * - 1 -- Send overflow events
  6547. */
  6548. u16 reserved;
  6549. /* Reserved. This field must be set to zero.*/
  6550. } __packed;
  6551. #define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
  6552. #define ASM_SESSION_EVENTX_OVERFLOW 0x00010C18
  6553. #define ASM_SESSION_CMDRSP_GET_SESSIONTIME_V3 0x00010D9E
  6554. struct asm_session_cmdrsp_get_sessiontime_v3 {
  6555. u32 status;
  6556. /* Status message (error code).
  6557. * Supported values: Refer to @xhyperref{Q3,[Q3]}
  6558. */
  6559. u32 sessiontime_lsw;
  6560. /* Lower 32 bits of the current session time in microseconds.*/
  6561. u32 sessiontime_msw;
  6562. /* Upper 32 bits of the current session time in microseconds.*/
  6563. u32 absolutetime_lsw;
  6564. /* Lower 32 bits in micro seconds of the absolute time at which
  6565. * the * sample corresponding to the above session time gets
  6566. * rendered * to hardware. This absolute time may be slightly in the
  6567. * future or past.
  6568. */
  6569. u32 absolutetime_msw;
  6570. /* Upper 32 bits in micro seconds of the absolute time at which
  6571. * the * sample corresponding to the above session time gets
  6572. * rendered to * hardware. This absolute time may be slightly in the
  6573. * future or past.
  6574. */
  6575. } __packed;
  6576. #define ASM_SESSION_CMD_ADJUST_SESSION_CLOCK_V2 0x00010D9F
  6577. struct asm_session_cmd_adjust_session_clock_v2 {
  6578. struct apr_hdr hdr;
  6579. u32 adjustime_lsw;
  6580. /* Lower 32 bits of the signed 64-bit quantity that specifies the
  6581. * adjustment time in microseconds to the session clock.
  6582. *
  6583. * Positive values indicate advancement of the session clock.
  6584. * Negative values indicate delay of the session clock.
  6585. */
  6586. u32 adjustime_msw;
  6587. /* Upper 32 bits of the signed 64-bit quantity that specifies
  6588. * the adjustment time in microseconds to the session clock.
  6589. * Positive values indicate advancement of the session clock.
  6590. * Negative values indicate delay of the session clock.
  6591. */
  6592. } __packed;
  6593. #define ASM_SESSION_CMDRSP_ADJUST_SESSION_CLOCK_V2 0x00010DA0
  6594. struct asm_session_cmdrsp_adjust_session_clock_v2 {
  6595. u32 status;
  6596. /* Status message (error code).
  6597. * Supported values: Refer to @xhyperref{Q3,[Q3]}
  6598. * An error means the session clock is not adjusted. In this case,
  6599. * the next two fields are irrelevant.
  6600. */
  6601. u32 actual_adjustime_lsw;
  6602. /* Lower 32 bits of the signed 64-bit quantity that specifies
  6603. * the actual adjustment in microseconds performed by the aDSP.
  6604. * A positive value indicates advancement of the session clock. A
  6605. * negative value indicates delay of the session clock.
  6606. */
  6607. u32 actual_adjustime_msw;
  6608. /* Upper 32 bits of the signed 64-bit quantity that specifies
  6609. * the actual adjustment in microseconds performed by the aDSP.
  6610. * A positive value indicates advancement of the session clock. A
  6611. * negative value indicates delay of the session clock.
  6612. */
  6613. u32 cmd_latency_lsw;
  6614. /* Lower 32 bits of the unsigned 64-bit quantity that specifies
  6615. * the amount of time in microseconds taken to perform the session
  6616. * clock adjustment.
  6617. */
  6618. u32 cmd_latency_msw;
  6619. /* Upper 32 bits of the unsigned 64-bit quantity that specifies
  6620. * the amount of time in microseconds taken to perform the session
  6621. * clock adjustment.
  6622. */
  6623. } __packed;
  6624. #define ASM_SESSION_CMD_GET_PATH_DELAY_V2 0x00010DAF
  6625. #define ASM_SESSION_CMDRSP_GET_PATH_DELAY_V2 0x00010DB0
  6626. struct asm_session_cmdrsp_get_path_delay_v2 {
  6627. u32 status;
  6628. /* Status message (error code). Whether this get delay operation
  6629. * is successful or not. Delay value is valid only if status is
  6630. * success.
  6631. * Supported values: Refer to @xhyperref{Q5,[Q5]}
  6632. */
  6633. u32 audio_delay_lsw;
  6634. /* Upper 32 bits of the aDSP delay in microseconds. */
  6635. u32 audio_delay_msw;
  6636. /* Lower 32 bits of the aDSP delay in microseconds. */
  6637. } __packed;
  6638. /* adsp_asm_session_command.h*/
  6639. #define ASM_STREAM_CMD_OPEN_WRITE_V3 0x00010DB3
  6640. #define ASM_LOW_LATENCY_STREAM_SESSION 0x10000000
  6641. #define ASM_ULTRA_LOW_LATENCY_STREAM_SESSION 0x20000000
  6642. #define ASM_ULL_POST_PROCESSING_STREAM_SESSION 0x40000000
  6643. #define ASM_LEGACY_STREAM_SESSION 0
  6644. struct asm_stream_cmd_open_write_v3 {
  6645. struct apr_hdr hdr;
  6646. uint32_t mode_flags;
  6647. /* Mode flags that configure the stream to notify the client
  6648. * whenever it detects an SR/CM change at the input to its POPP.
  6649. * Supported values for bits 0 to 1:
  6650. * - Reserved; clients must set them to zero.
  6651. * Supported values for bit 2:
  6652. * - 0 -- SR/CM change notification event is disabled.
  6653. * - 1 -- SR/CM change notification event is enabled.
  6654. * - Use #ASM_BIT_MASK_SR_CM_CHANGE_NOTIFY_FLAG and
  6655. * #ASM_SHIFT_SR_CM_CHANGE_NOTIFY_FLAG to set or get this bit.
  6656. *
  6657. * Supported values for bit 31:
  6658. * - 0 -- Stream to be opened in on-Gapless mode.
  6659. * - 1 -- Stream to be opened in Gapless mode. In Gapless mode,
  6660. * successive streams must be opened with same session ID but
  6661. * different stream IDs.
  6662. *
  6663. * - Use #ASM_BIT_MASK_GAPLESS_MODE_FLAG and
  6664. * #ASM_SHIFT_GAPLESS_MODE_FLAG to set or get this bit.
  6665. *
  6666. *
  6667. * @note1hang MIDI and DTMF streams cannot be opened in Gapless mode.
  6668. */
  6669. uint16_t sink_endpointype;
  6670. /*< Sink point type.
  6671. * Supported values:
  6672. * - 0 -- Device matrix
  6673. * - Other values are reserved.
  6674. *
  6675. * The device matrix is the gateway to the hardware ports.
  6676. */
  6677. uint16_t bits_per_sample;
  6678. /*< Number of bits per sample processed by ASM modules.
  6679. * Supported values: 16 and 24 bits per sample
  6680. */
  6681. uint32_t postprocopo_id;
  6682. /*< Specifies the topology (order of processing) of
  6683. * postprocessing algorithms. <i>None</i> means no postprocessing.
  6684. * Supported values:
  6685. * - #ASM_STREAM_POSTPROCOPO_ID_DEFAULT
  6686. * - #ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL
  6687. * - #ASM_STREAM_POSTPROCOPO_ID_NONE
  6688. *
  6689. * This field can also be enabled through SetParams flags.
  6690. */
  6691. uint32_t dec_fmt_id;
  6692. /*< Configuration ID of the decoder media format.
  6693. *
  6694. * Supported values:
  6695. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6696. * - #ASM_MEDIA_FMT_ADPCM
  6697. * - #ASM_MEDIA_FMT_MP3
  6698. * - #ASM_MEDIA_FMT_AAC_V2
  6699. * - #ASM_MEDIA_FMT_DOLBY_AAC
  6700. * - #ASM_MEDIA_FMT_AMRNB_FS
  6701. * - #ASM_MEDIA_FMT_AMRWB_FS
  6702. * - #ASM_MEDIA_FMT_AMR_WB_PLUS_V2
  6703. * - #ASM_MEDIA_FMT_V13K_FS
  6704. * - #ASM_MEDIA_FMT_EVRC_FS
  6705. * - #ASM_MEDIA_FMT_EVRCB_FS
  6706. * - #ASM_MEDIA_FMT_EVRCWB_FS
  6707. * - #ASM_MEDIA_FMT_SBC
  6708. * - #ASM_MEDIA_FMT_WMA_V10PRO_V2
  6709. * - #ASM_MEDIA_FMT_WMA_V9_V2
  6710. * - #ASM_MEDIA_FMT_AC3
  6711. * - #ASM_MEDIA_FMT_EAC3
  6712. * - #ASM_MEDIA_FMT_G711_ALAW_FS
  6713. * - #ASM_MEDIA_FMT_G711_MLAW_FS
  6714. * - #ASM_MEDIA_FMT_G729A_FS
  6715. * - #ASM_MEDIA_FMT_FR_FS
  6716. * - #ASM_MEDIA_FMT_VORBIS
  6717. * - #ASM_MEDIA_FMT_FLAC
  6718. * - #ASM_MEDIA_FMT_ALAC
  6719. * - #ASM_MEDIA_FMT_APE
  6720. * - #ASM_MEDIA_FMT_EXAMPLE
  6721. */
  6722. } __packed;
  6723. #define ASM_STREAM_CMD_OPEN_PULL_MODE_WRITE 0x00010DD9
  6724. /* Bitmask for the stream_perf_mode subfield. */
  6725. #define ASM_BIT_MASK_STREAM_PERF_FLAG_PULL_MODE_WRITE 0xE0000000UL
  6726. /* Bitmask for the stream_perf_mode subfield. */
  6727. #define ASM_SHIFT_STREAM_PERF_FLAG_PULL_MODE_WRITE 29
  6728. #define ASM_STREAM_CMD_OPEN_PUSH_MODE_READ 0x00010DDA
  6729. #define ASM_BIT_MASK_STREAM_PERF_FLAG_PUSH_MODE_READ 0xE0000000UL
  6730. #define ASM_SHIFT_STREAM_PERF_FLAG_PUSH_MODE_READ 29
  6731. #define ASM_DATA_EVENT_WATERMARK 0x00010DDB
  6732. struct asm_shared_position_buffer {
  6733. volatile uint32_t frame_counter;
  6734. /* Counter used to handle interprocessor synchronization issues.
  6735. * When frame_counter is 0: read_index, wall_clock_us_lsw, and
  6736. * wall_clock_us_msw are invalid.
  6737. * Supported values: >= 0.
  6738. */
  6739. volatile uint32_t index;
  6740. /* Index in bytes from where the aDSP is reading/writing.
  6741. * Supported values: 0 to circular buffer size - 1
  6742. */
  6743. volatile uint32_t wall_clock_us_lsw;
  6744. /* Lower 32 bits of the 64-bit wall clock time in microseconds when the
  6745. * read index was updated.
  6746. * Supported values: >= 0
  6747. */
  6748. volatile uint32_t wall_clock_us_msw;
  6749. /* Upper 32 bits of the 64 bit wall clock time in microseconds when the
  6750. * read index was updated
  6751. * Supported values: >= 0
  6752. */
  6753. } __packed;
  6754. struct asm_shared_watermark_level {
  6755. uint32_t watermark_level_bytes;
  6756. } __packed;
  6757. struct asm_stream_cmd_open_shared_io {
  6758. struct apr_hdr hdr;
  6759. uint32_t mode_flags;
  6760. uint16_t endpoint_type;
  6761. uint16_t topo_bits_per_sample;
  6762. uint32_t topo_id;
  6763. uint32_t fmt_id;
  6764. uint32_t shared_pos_buf_phy_addr_lsw;
  6765. uint32_t shared_pos_buf_phy_addr_msw;
  6766. uint16_t shared_pos_buf_mem_pool_id;
  6767. uint16_t shared_pos_buf_num_regions;
  6768. uint32_t shared_pos_buf_property_flag;
  6769. uint32_t shared_circ_buf_start_phy_addr_lsw;
  6770. uint32_t shared_circ_buf_start_phy_addr_msw;
  6771. uint32_t shared_circ_buf_size;
  6772. uint16_t shared_circ_buf_mem_pool_id;
  6773. uint16_t shared_circ_buf_num_regions;
  6774. uint32_t shared_circ_buf_property_flag;
  6775. uint32_t num_watermark_levels;
  6776. struct asm_multi_channel_pcm_fmt_blk_v3 fmt;
  6777. struct avs_shared_map_region_payload map_region_pos_buf;
  6778. struct avs_shared_map_region_payload map_region_circ_buf;
  6779. struct asm_shared_watermark_level watermark[0];
  6780. } __packed;
  6781. #define ASM_STREAM_CMD_OPEN_READ_V3 0x00010DB4
  6782. /* Definition of the timestamp type flag bitmask */
  6783. #define ASM_BIT_MASKIMESTAMPYPE_FLAG (0x00000020UL)
  6784. /* Definition of the timestamp type flag shift value. */
  6785. #define ASM_SHIFTIMESTAMPYPE_FLAG 5
  6786. /* Relative timestamp is identified by this value.*/
  6787. #define ASM_RELATIVEIMESTAMP 0
  6788. /* Absolute timestamp is identified by this value.*/
  6789. #define ASM_ABSOLUTEIMESTAMP 1
  6790. /* Bit value for Low Latency Tx stream subfield */
  6791. #define ASM_LOW_LATENCY_TX_STREAM_SESSION 1
  6792. /* Bit shift for the stream_perf_mode subfield. */
  6793. #define ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_READ 29
  6794. struct asm_stream_cmd_open_read_v3 {
  6795. struct apr_hdr hdr;
  6796. u32 mode_flags;
  6797. /* Mode flags that indicate whether meta information per encoded
  6798. * frame is to be provided.
  6799. * Supported values for bit 4:
  6800. *
  6801. * - 0 -- Return data buffer contains all encoded frames only; it
  6802. * does not contain frame metadata.
  6803. *
  6804. * - 1 -- Return data buffer contains an array of metadata and
  6805. * encoded frames.
  6806. *
  6807. * - Use #ASM_BIT_MASK_META_INFO_FLAG as the bitmask and
  6808. * #ASM_SHIFT_META_INFO_FLAG as the shift value for this bit.
  6809. *
  6810. *
  6811. * Supported values for bit 5:
  6812. *
  6813. * - ASM_RELATIVEIMESTAMP -- ASM_DATA_EVENT_READ_DONE_V2 will have
  6814. * - relative time-stamp.
  6815. * - ASM_ABSOLUTEIMESTAMP -- ASM_DATA_EVENT_READ_DONE_V2 will
  6816. * - have absolute time-stamp.
  6817. *
  6818. * - Use #ASM_BIT_MASKIMESTAMPYPE_FLAG as the bitmask and
  6819. * #ASM_SHIFTIMESTAMPYPE_FLAG as the shift value for this bit.
  6820. *
  6821. * All other bits are reserved; clients must set them to zero.
  6822. */
  6823. u32 src_endpointype;
  6824. /* Specifies the endpoint providing the input samples.
  6825. * Supported values:
  6826. * - 0 -- Device matrix
  6827. * - All other values are reserved; clients must set them to zero.
  6828. * Otherwise, an error is returned.
  6829. * The device matrix is the gateway from the tunneled Tx ports.
  6830. */
  6831. u32 preprocopo_id;
  6832. /* Specifies the topology (order of processing) of preprocessing
  6833. * algorithms. <i>None</i> means no preprocessing.
  6834. * Supported values:
  6835. * - #ASM_STREAM_PREPROCOPO_ID_DEFAULT
  6836. * - #ASM_STREAM_PREPROCOPO_ID_NONE
  6837. *
  6838. * This field can also be enabled through SetParams flags.
  6839. */
  6840. u32 enc_cfg_id;
  6841. /* Media configuration ID for encoded output.
  6842. * Supported values:
  6843. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6844. * - #ASM_MEDIA_FMT_AAC_V2
  6845. * - #ASM_MEDIA_FMT_AMRNB_FS
  6846. * - #ASM_MEDIA_FMT_AMRWB_FS
  6847. * - #ASM_MEDIA_FMT_V13K_FS
  6848. * - #ASM_MEDIA_FMT_EVRC_FS
  6849. * - #ASM_MEDIA_FMT_EVRCB_FS
  6850. * - #ASM_MEDIA_FMT_EVRCWB_FS
  6851. * - #ASM_MEDIA_FMT_SBC
  6852. * - #ASM_MEDIA_FMT_G711_ALAW_FS
  6853. * - #ASM_MEDIA_FMT_G711_MLAW_FS
  6854. * - #ASM_MEDIA_FMT_G729A_FS
  6855. * - #ASM_MEDIA_FMT_EXAMPLE
  6856. * - #ASM_MEDIA_FMT_WMA_V8
  6857. */
  6858. u16 bits_per_sample;
  6859. /* Number of bits per sample processed by ASM modules.
  6860. * Supported values: 16 and 24 bits per sample
  6861. */
  6862. u16 reserved;
  6863. /* Reserved for future use. This field must be set to zero.*/
  6864. } __packed;
  6865. #define ASM_POPP_OUTPUT_SR_NATIVE_RATE 0
  6866. /* Enumeration for the maximum sampling rate at the POPP output.*/
  6867. #define ASM_POPP_OUTPUT_SR_MAX_RATE 48000
  6868. #define ASM_STREAM_CMD_OPEN_READWRITE_V2 0x00010D8D
  6869. #define ASM_STREAM_CMD_OPEN_READWRITE_V2 0x00010D8D
  6870. struct asm_stream_cmd_open_readwrite_v2 {
  6871. struct apr_hdr hdr;
  6872. u32 mode_flags;
  6873. /* Mode flags.
  6874. * Supported values for bit 2:
  6875. * - 0 -- SR/CM change notification event is disabled.
  6876. * - 1 -- SR/CM change notification event is enabled. Use
  6877. * #ASM_BIT_MASK_SR_CM_CHANGE_NOTIFY_FLAG and
  6878. * #ASM_SHIFT_SR_CM_CHANGE_NOTIFY_FLAG to set or
  6879. * getting this flag.
  6880. *
  6881. * Supported values for bit 4:
  6882. * - 0 -- Return read data buffer contains all encoded frames only; it
  6883. * does not contain frame metadata.
  6884. * - 1 -- Return read data buffer contains an array of metadata and
  6885. * encoded frames.
  6886. *
  6887. * All other bits are reserved; clients must set them to zero.
  6888. */
  6889. u32 postprocopo_id;
  6890. /* Specifies the topology (order of processing) of postprocessing
  6891. * algorithms. <i>None</i> means no postprocessing.
  6892. *
  6893. * Supported values:
  6894. * - #ASM_STREAM_POSTPROCOPO_ID_DEFAULT
  6895. * - #ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL
  6896. * - #ASM_STREAM_POSTPROCOPO_ID_NONE
  6897. */
  6898. u32 dec_fmt_id;
  6899. /* Specifies the media type of the input data. PCM indicates that
  6900. * no decoding must be performed, e.g., this is an NT encoder
  6901. * session.
  6902. * Supported values:
  6903. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6904. * - #ASM_MEDIA_FMT_ADPCM
  6905. * - #ASM_MEDIA_FMT_MP3
  6906. * - #ASM_MEDIA_FMT_AAC_V2
  6907. * - #ASM_MEDIA_FMT_DOLBY_AAC
  6908. * - #ASM_MEDIA_FMT_AMRNB_FS
  6909. * - #ASM_MEDIA_FMT_AMRWB_FS
  6910. * - #ASM_MEDIA_FMT_V13K_FS
  6911. * - #ASM_MEDIA_FMT_EVRC_FS
  6912. * - #ASM_MEDIA_FMT_EVRCB_FS
  6913. * - #ASM_MEDIA_FMT_EVRCWB_FS
  6914. * - #ASM_MEDIA_FMT_SBC
  6915. * - #ASM_MEDIA_FMT_WMA_V10PRO_V2
  6916. * - #ASM_MEDIA_FMT_WMA_V9_V2
  6917. * - #ASM_MEDIA_FMT_AMR_WB_PLUS_V2
  6918. * - #ASM_MEDIA_FMT_AC3
  6919. * - #ASM_MEDIA_FMT_G711_ALAW_FS
  6920. * - #ASM_MEDIA_FMT_G711_MLAW_FS
  6921. * - #ASM_MEDIA_FMT_G729A_FS
  6922. * - #ASM_MEDIA_FMT_EXAMPLE
  6923. */
  6924. u32 enc_cfg_id;
  6925. /* Specifies the media type for the output of the stream. PCM
  6926. * indicates that no encoding must be performed, e.g., this is an NT
  6927. * decoder session.
  6928. * Supported values:
  6929. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6930. * - #ASM_MEDIA_FMT_AAC_V2
  6931. * - #ASM_MEDIA_FMT_AMRNB_FS
  6932. * - #ASM_MEDIA_FMT_AMRWB_FS
  6933. * - #ASM_MEDIA_FMT_V13K_FS
  6934. * - #ASM_MEDIA_FMT_EVRC_FS
  6935. * - #ASM_MEDIA_FMT_EVRCB_FS
  6936. * - #ASM_MEDIA_FMT_EVRCWB_FS
  6937. * - #ASM_MEDIA_FMT_SBC
  6938. * - #ASM_MEDIA_FMT_G711_ALAW_FS
  6939. * - #ASM_MEDIA_FMT_G711_MLAW_FS
  6940. * - #ASM_MEDIA_FMT_G729A_FS
  6941. * - #ASM_MEDIA_FMT_EXAMPLE
  6942. * - #ASM_MEDIA_FMT_WMA_V8
  6943. */
  6944. u16 bits_per_sample;
  6945. /* Number of bits per sample processed by ASM modules.
  6946. * Supported values: 16 and 24 bits per sample
  6947. */
  6948. u16 reserved;
  6949. /* Reserved for future use. This field must be set to zero.*/
  6950. } __packed;
  6951. #define ASM_STREAM_CMD_OPEN_LOOPBACK_V2 0x00010D8E
  6952. struct asm_stream_cmd_open_loopback_v2 {
  6953. struct apr_hdr hdr;
  6954. u32 mode_flags;
  6955. /* Mode flags.
  6956. * Bit 0-31: reserved; client should set these bits to 0
  6957. */
  6958. u16 src_endpointype;
  6959. /* Endpoint type. 0 = Tx Matrix */
  6960. u16 sink_endpointype;
  6961. /* Endpoint type. 0 = Rx Matrix */
  6962. u32 postprocopo_id;
  6963. /* Postprocessor topology ID. Specifies the topology of
  6964. * postprocessing algorithms.
  6965. */
  6966. u16 bits_per_sample;
  6967. /* The number of bits per sample processed by ASM modules
  6968. * Supported values: 16 and 24 bits per sample
  6969. */
  6970. u16 reserved;
  6971. /* Reserved for future use. This field must be set to zero. */
  6972. } __packed;
  6973. #define ASM_STREAM_CMD_OPEN_TRANSCODE_LOOPBACK 0x00010DBA
  6974. /* Bitmask for the stream's Performance mode. */
  6975. #define ASM_BIT_MASK_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK \
  6976. (0x70000000UL)
  6977. /* Bit shift for the stream's Performance mode. */
  6978. #define ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK 28
  6979. /* Bitmask for the decoder converter enable flag. */
  6980. #define ASM_BIT_MASK_DECODER_CONVERTER_FLAG (0x00000078UL)
  6981. /* Shift value for the decoder converter enable flag. */
  6982. #define ASM_SHIFT_DECODER_CONVERTER_FLAG 3
  6983. /* Converter mode is None (Default). */
  6984. #define ASM_CONVERTER_MODE_NONE 0
  6985. /* Converter mode is DDP-to-DD. */
  6986. #define ASM_DDP_DD_CONVERTER_MODE 1
  6987. /* Identifies a special converter mode where source and sink formats
  6988. * are the same but postprocessing must applied. Therefore, Decode
  6989. * @rarrow Re-encode is necessary.
  6990. */
  6991. #define ASM_POST_PROCESS_CONVERTER_MODE 2
  6992. struct asm_stream_cmd_open_transcode_loopback_t {
  6993. struct apr_hdr hdr;
  6994. u32 mode_flags;
  6995. /* Mode Flags specifies the performance mode in which this stream
  6996. * is to be opened.
  6997. * Supported values{for bits 30 to 28}(stream_perf_mode flag)
  6998. *
  6999. * #ASM_LEGACY_STREAM_SESSION -- This mode ensures backward
  7000. * compatibility to the original behavior
  7001. * of ASM_STREAM_CMD_OPEN_TRANSCODE_LOOPBACK
  7002. *
  7003. * #ASM_LOW_LATENCY_STREAM_SESSION -- Opens a loopback session by using
  7004. * shortened buffers in low latency POPP
  7005. * - Recommendation: Do not enable high latency algorithms. They might
  7006. * negate the benefits of opening a low latency stream, and they
  7007. * might also suffer quality degradation from unexpected jitter.
  7008. * - This Low Latency mode is supported only for PCM In and PCM Out
  7009. * loopbacks. An error is returned if Low Latency mode is opened for
  7010. * other transcode loopback modes.
  7011. * - To configure this subfield, use
  7012. * ASM_BIT_MASK_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK and
  7013. * ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK.
  7014. *
  7015. * Supported values{for bits 6 to 3} (decoder-converter compatibility)
  7016. * #ASM_CONVERTER_MODE_NONE (0x0) -- Default
  7017. * #ASM_DDP_DD_CONVERTER_MODE (0x1)
  7018. * #ASM_POST_PROCESS_CONVERTER_MODE (0x2)
  7019. * 0x3-0xF -- Reserved for future use
  7020. * - Use #ASM_BIT_MASK_DECODER_CONVERTER_FLAG and
  7021. * ASM_SHIFT_DECODER_CONVERTER_FLAG to set this bit
  7022. * All other bits are reserved; clients must set them to 0.
  7023. */
  7024. u32 src_format_id;
  7025. /* Specifies the media format of the input audio stream.
  7026. *
  7027. * Supported values
  7028. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  7029. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3
  7030. * - #ASM_MEDIA_FMT_DTS
  7031. * - #ASM_MEDIA_FMT_EAC3_DEC
  7032. * - #ASM_MEDIA_FMT_EAC3
  7033. * - #ASM_MEDIA_FMT_AC3_DEC
  7034. * - #ASM_MEDIA_FMT_AC3
  7035. */
  7036. u32 sink_format_id;
  7037. /* Specifies the media format of the output stream.
  7038. *
  7039. * Supported values
  7040. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  7041. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3
  7042. * - #ASM_MEDIA_FMT_DTS (not supported in Low Latency mode)
  7043. * - #ASM_MEDIA_FMT_EAC3_DEC (not supported in Low Latency mode)
  7044. * - #ASM_MEDIA_FMT_EAC3 (not supported in Low Latency mode)
  7045. * - #ASM_MEDIA_FMT_AC3_DEC (not supported in Low Latency mode)
  7046. * - #ASM_MEDIA_FMT_AC3 (not supported in Low Latency mode)
  7047. */
  7048. u32 audproc_topo_id;
  7049. /* Postprocessing topology ID, which specifies the topology (order of
  7050. * processing) of postprocessing algorithms.
  7051. *
  7052. * Supported values
  7053. * - #ASM_STREAM_POSTPROC_TOPO_ID_DEFAULT
  7054. * - #ASM_STREAM_POSTPROC_TOPO_ID_PEAKMETER
  7055. * - #ASM_STREAM_POSTPROC_TOPO_ID_MCH_PEAK_VOL
  7056. * - #ASM_STREAM_POSTPROC_TOPO_ID_NONE
  7057. * Topologies can be added through #ASM_CMD_ADD_TOPOLOGIES.
  7058. * This field is ignored for the Converter mode, in which no
  7059. * postprocessing is performed.
  7060. */
  7061. u16 src_endpoint_type;
  7062. /* Specifies the source endpoint that provides the input samples.
  7063. *
  7064. * Supported values
  7065. * - 0 -- Tx device matrix or stream router (gateway to the hardware
  7066. * ports)
  7067. * - All other values are reserved
  7068. * Clients must set this field to 0. Otherwise, an error is returned.
  7069. */
  7070. u16 sink_endpoint_type;
  7071. /* Specifies the sink endpoint type.
  7072. *
  7073. * Supported values
  7074. * - 0 -- Rx device matrix or stream router (gateway to the hardware
  7075. * ports)
  7076. * - All other values are reserved
  7077. * Clients must set this field to 0. Otherwise, an error is returned.
  7078. */
  7079. u16 bits_per_sample;
  7080. /* Number of bits per sample processed by the ASM modules.
  7081. * Supported values 16, 24
  7082. */
  7083. u16 reserved;
  7084. /* This field must be set to 0.
  7085. */
  7086. } __packed;
  7087. #define ASM_STREAM_CMD_CLOSE 0x00010BCD
  7088. #define ASM_STREAM_CMD_FLUSH 0x00010BCE
  7089. #define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
  7090. #define ASM_STREAM_CMD_SET_PP_PARAMS_V2 0x00010DA1
  7091. #define ASM_STREAM_CMD_SET_PP_PARAMS_V3 0x0001320D
  7092. /*
  7093. * Structure for the ASM Stream Set PP Params command. Parameter data must be
  7094. * pre-packed with the correct header for either V2 or V3 when sent in-band.
  7095. * Use q6core_pack_pp_params to pack the header and data correctly depending on
  7096. * Instance ID support.
  7097. */
  7098. struct asm_stream_cmd_set_pp_params {
  7099. /* APR Header */
  7100. struct apr_hdr apr_hdr;
  7101. /* The memory mapping header to be used when sending out of band */
  7102. struct mem_mapping_hdr mem_hdr;
  7103. /* The total size of the payload, including the parameter header */
  7104. u32 payload_size;
  7105. /* The parameter data to be filled when sent inband. Parameter data
  7106. * must be pre-packed with parameter header and then copied here. Use
  7107. * q6core_pack_pp_params to pack the header and param data correctly.
  7108. */
  7109. u32 param_data[0];
  7110. } __packed;
  7111. #define ASM_STREAM_CMD_GET_PP_PARAMS_V2 0x00010DA2
  7112. #define ASM_STREAM_CMD_GET_PP_PARAMS_V3 0x0001320E
  7113. struct asm_stream_cmd_get_pp_params_v2 {
  7114. u32 data_payload_addr_lsw;
  7115. /* LSW of the parameter data payload address. */
  7116. u32 data_payload_addr_msw;
  7117. /* MSW of the parameter data payload address.
  7118. * - Size of the shared memory, if specified, shall be large enough
  7119. * to contain the whole ParamData payload, including Module ID,
  7120. * Param ID, Param Size, and Param Values
  7121. * - Must be set to zero for in-band data
  7122. * - In the case of 32 bit Shared memory address, msw field must be
  7123. * set to zero.
  7124. * - In the case of 36 bit shared memory address, bit 31 to bit 4 of
  7125. * msw must be set to zero.
  7126. */
  7127. u32 mem_map_handle;
  7128. /* Supported Values: Any.
  7129. * memory map handle returned by DSP through ASM_CMD_SHARED_MEM_MAP_REGIONS
  7130. * command.
  7131. * if mmhandle is NULL, the ParamData payloads in the ACK are within the
  7132. * message payload (in-band).
  7133. * If mmhandle is non-NULL, the ParamData payloads in the ACK begin at the
  7134. * address specified in the address msw and lsw.
  7135. * (out-of-band).
  7136. */
  7137. u32 module_id;
  7138. /* Unique module ID. */
  7139. u32 param_id;
  7140. /* Unique parameter ID. */
  7141. u16 param_max_size;
  7142. /* Maximum data size of the module_id/param_id combination. This
  7143. * is a multiple of 4 bytes.
  7144. */
  7145. u16 reserved;
  7146. /* Reserved for backward compatibility. Clients must set this
  7147. * field to zero.
  7148. */
  7149. } __packed;
  7150. #define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
  7151. #define ASM_STREAM_CMD_SET_ENCDEC_PARAM_V2 0x00013218
  7152. struct asm_stream_cmd_set_encdec_param_v2 {
  7153. u16 service_id;
  7154. /* 0 - ASM_ENCODER_SVC; 1 - ASM_DECODER_SVC */
  7155. u16 reserved;
  7156. u32 param_id;
  7157. /* ID of the parameter. */
  7158. u32 param_size;
  7159. /*
  7160. * Data size of this parameter, in bytes. The size is a multiple
  7161. * of 4 bytes.
  7162. */
  7163. } __packed;
  7164. #define ASM_STREAM_CMD_REGISTER_ENCDEC_EVENTS 0x00013219
  7165. #define ASM_STREAM_CMD_ENCDEC_EVENTS 0x0001321A
  7166. #define AVS_PARAM_ID_RTIC_SHARED_MEMORY_ADDR 0x00013237
  7167. struct avs_rtic_shared_mem_addr {
  7168. struct apr_hdr hdr;
  7169. struct asm_stream_cmd_set_encdec_param_v2 encdec;
  7170. u32 shm_buf_addr_lsw;
  7171. /* Lower 32 bit of the RTIC shared memory */
  7172. u32 shm_buf_addr_msw;
  7173. /* Upper 32 bit of the RTIC shared memory */
  7174. u32 buf_size;
  7175. /* Size of buffer */
  7176. u16 shm_buf_mem_pool_id;
  7177. /* ADSP_MEMORY_MAP_SHMEM8_4K_POOL */
  7178. u16 shm_buf_num_regions;
  7179. /* number of regions to map */
  7180. u32 shm_buf_flag;
  7181. /* buffer property flag */
  7182. struct avs_shared_map_region_payload map_region;
  7183. /* memory map region*/
  7184. } __packed;
  7185. #define AVS_PARAM_ID_RTIC_EVENT_ACK 0x00013238
  7186. struct avs_param_rtic_event_ack {
  7187. struct apr_hdr hdr;
  7188. struct asm_stream_cmd_set_encdec_param_v2 encdec;
  7189. } __packed;
  7190. #define ASM_PARAM_ID_ENCDEC_BITRATE 0x00010C13
  7191. struct asm_bitrate_param {
  7192. u32 bitrate;
  7193. /* Maximum supported bitrate. Only the AAC encoder is supported.*/
  7194. } __packed;
  7195. #define ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 0x00010DA3
  7196. #define ASM_PARAM_ID_AAC_SBR_PS_FLAG 0x00010C63
  7197. /* Flag to turn off both SBR and PS processing, if they are
  7198. * present in the bitstream.
  7199. */
  7200. #define ASM_AAC_SBR_OFF_PS_OFF (2)
  7201. /* Flag to turn on SBR but turn off PS processing,if they are
  7202. * present in the bitstream.
  7203. */
  7204. #define ASM_AAC_SBR_ON_PS_OFF (1)
  7205. /* Flag to turn on both SBR and PS processing, if they are
  7206. * present in the bitstream (default behavior).
  7207. */
  7208. #define ASM_AAC_SBR_ON_PS_ON (0)
  7209. /* Structure for an AAC SBR PS processing flag. */
  7210. /* Payload of the #ASM_PARAM_ID_AAC_SBR_PS_FLAG parameter in the
  7211. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7212. */
  7213. struct asm_aac_sbr_ps_flag_param {
  7214. struct apr_hdr hdr;
  7215. struct asm_stream_cmd_set_encdec_param encdec;
  7216. struct asm_enc_cfg_blk_param_v2 encblk;
  7217. u32 sbr_ps_flag;
  7218. /* Control parameter to enable or disable SBR/PS processing in
  7219. * the AAC bitstream. Use the following macros to set this field:
  7220. * - #ASM_AAC_SBR_OFF_PS_OFF -- Turn off both SBR and PS
  7221. * processing, if they are present in the bitstream.
  7222. * - #ASM_AAC_SBR_ON_PS_OFF -- Turn on SBR processing, but not PS
  7223. * processing, if they are present in the bitstream.
  7224. * - #ASM_AAC_SBR_ON_PS_ON -- Turn on both SBR and PS processing,
  7225. * if they are present in the bitstream (default behavior).
  7226. * - All other values are invalid.
  7227. * Changes are applied to the next decoded frame.
  7228. */
  7229. } __packed;
  7230. #define ASM_PARAM_ID_AAC_DUAL_MONO_MAPPING 0x00010C64
  7231. /* First single channel element in a dual mono bitstream.*/
  7232. #define ASM_AAC_DUAL_MONO_MAP_SCE_1 (1)
  7233. /* Second single channel element in a dual mono bitstream.*/
  7234. #define ASM_AAC_DUAL_MONO_MAP_SCE_2 (2)
  7235. /* Structure for AAC decoder dual mono channel mapping. */
  7236. struct asm_aac_dual_mono_mapping_param {
  7237. struct apr_hdr hdr;
  7238. struct asm_stream_cmd_set_encdec_param encdec;
  7239. u16 left_channel_sce;
  7240. u16 right_channel_sce;
  7241. } __packed;
  7242. #define ASM_STREAM_CMDRSP_GET_PP_PARAMS_V2 0x00010DA4
  7243. #define ASM_STREAM_CMDRSP_GET_PP_PARAMS_V3 0x0001320F
  7244. struct asm_stream_cmdrsp_get_pp_params_v2 {
  7245. u32 status;
  7246. } __packed;
  7247. #define ASM_PARAM_ID_AC3_KARAOKE_MODE 0x00010D73
  7248. /* Enumeration for both vocals in a karaoke stream.*/
  7249. #define AC3_KARAOKE_MODE_NO_VOCAL (0)
  7250. /* Enumeration for only the left vocal in a karaoke stream.*/
  7251. #define AC3_KARAOKE_MODE_LEFT_VOCAL (1)
  7252. /* Enumeration for only the right vocal in a karaoke stream.*/
  7253. #define AC3_KARAOKE_MODE_RIGHT_VOCAL (2)
  7254. /* Enumeration for both vocal channels in a karaoke stream.*/
  7255. #define AC3_KARAOKE_MODE_BOTH_VOCAL (3)
  7256. #define ASM_PARAM_ID_AC3_DRC_MODE 0x00010D74
  7257. /* Enumeration for the Custom Analog mode.*/
  7258. #define AC3_DRC_MODE_CUSTOM_ANALOG (0)
  7259. /* Enumeration for the Custom Digital mode.*/
  7260. #define AC3_DRC_MODE_CUSTOM_DIGITAL (1)
  7261. /* Enumeration for the Line Out mode (light compression).*/
  7262. #define AC3_DRC_MODE_LINE_OUT (2)
  7263. /* Enumeration for the RF remodulation mode (heavy compression).*/
  7264. #define AC3_DRC_MODE_RF_REMOD (3)
  7265. #define ASM_PARAM_ID_AC3_DUAL_MONO_MODE 0x00010D75
  7266. /* Enumeration for playing dual mono in stereo mode.*/
  7267. #define AC3_DUAL_MONO_MODE_STEREO (0)
  7268. /* Enumeration for playing left mono.*/
  7269. #define AC3_DUAL_MONO_MODE_LEFT_MONO (1)
  7270. /* Enumeration for playing right mono.*/
  7271. #define AC3_DUAL_MONO_MODE_RIGHT_MONO (2)
  7272. /* Enumeration for mixing both dual mono channels and playing them.*/
  7273. #define AC3_DUAL_MONO_MODE_MIXED_MONO (3)
  7274. #define ASM_PARAM_ID_AC3_STEREO_DOWNMIX_MODE 0x00010D76
  7275. /* Enumeration for using the Downmix mode indicated in the bitstream. */
  7276. #define AC3_STEREO_DOWNMIX_MODE_AUTO_DETECT (0)
  7277. /* Enumeration for Surround Compatible mode (preserves the
  7278. * surround information).
  7279. */
  7280. #define AC3_STEREO_DOWNMIX_MODE_LT_RT (1)
  7281. /* Enumeration for Mono Compatible mode (if the output is to be
  7282. * further downmixed to mono).
  7283. */
  7284. #define AC3_STEREO_DOWNMIX_MODE_LO_RO (2)
  7285. /* ID of the AC3 PCM scale factor parameter in the
  7286. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7287. */
  7288. #define ASM_PARAM_ID_AC3_PCM_SCALEFACTOR 0x00010D78
  7289. /* ID of the AC3 DRC boost scale factor parameter in the
  7290. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7291. */
  7292. #define ASM_PARAM_ID_AC3_DRC_BOOST_SCALEFACTOR 0x00010D79
  7293. /* ID of the AC3 DRC cut scale factor parameter in the
  7294. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7295. */
  7296. #define ASM_PARAM_ID_AC3_DRC_CUT_SCALEFACTOR 0x00010D7A
  7297. /* Structure for AC3 Generic Parameter. */
  7298. /* Payload of the AC3 parameters in the
  7299. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7300. */
  7301. struct asm_ac3_generic_param {
  7302. struct apr_hdr hdr;
  7303. struct asm_stream_cmd_set_encdec_param encdec;
  7304. struct asm_enc_cfg_blk_param_v2 encblk;
  7305. u32 generic_parameter;
  7306. /* AC3 generic parameter. Select from one of the following
  7307. * possible values.
  7308. *
  7309. * For #ASM_PARAM_ID_AC3_KARAOKE_MODE, supported values are:
  7310. * - AC3_KARAOKE_MODE_NO_VOCAL
  7311. * - AC3_KARAOKE_MODE_LEFT_VOCAL
  7312. * - AC3_KARAOKE_MODE_RIGHT_VOCAL
  7313. * - AC3_KARAOKE_MODE_BOTH_VOCAL
  7314. *
  7315. * For #ASM_PARAM_ID_AC3_DRC_MODE, supported values are:
  7316. * - AC3_DRC_MODE_CUSTOM_ANALOG
  7317. * - AC3_DRC_MODE_CUSTOM_DIGITAL
  7318. * - AC3_DRC_MODE_LINE_OUT
  7319. * - AC3_DRC_MODE_RF_REMOD
  7320. *
  7321. * For #ASM_PARAM_ID_AC3_DUAL_MONO_MODE, supported values are:
  7322. * - AC3_DUAL_MONO_MODE_STEREO
  7323. * - AC3_DUAL_MONO_MODE_LEFT_MONO
  7324. * - AC3_DUAL_MONO_MODE_RIGHT_MONO
  7325. * - AC3_DUAL_MONO_MODE_MIXED_MONO
  7326. *
  7327. * For #ASM_PARAM_ID_AC3_STEREO_DOWNMIX_MODE, supported values are:
  7328. * - AC3_STEREO_DOWNMIX_MODE_AUTO_DETECT
  7329. * - AC3_STEREO_DOWNMIX_MODE_LT_RT
  7330. * - AC3_STEREO_DOWNMIX_MODE_LO_RO
  7331. *
  7332. * For #ASM_PARAM_ID_AC3_PCM_SCALEFACTOR, supported values are
  7333. * 0 to 1 in Q31 format.
  7334. *
  7335. * For #ASM_PARAM_ID_AC3_DRC_BOOST_SCALEFACTOR, supported values are
  7336. * 0 to 1 in Q31 format.
  7337. *
  7338. * For #ASM_PARAM_ID_AC3_DRC_CUT_SCALEFACTOR, supported values are
  7339. * 0 to 1 in Q31 format.
  7340. */
  7341. } __packed;
  7342. /* Enumeration for Raw mode (no downmixing), which specifies
  7343. * that all channels in the bitstream are to be played out as is
  7344. * without any downmixing. (Default)
  7345. */
  7346. #define WMAPRO_CHANNEL_MASK_RAW (-1)
  7347. /* Enumeration for setting the channel mask to 0. The 7.1 mode
  7348. * (Home Theater) is assigned.
  7349. */
  7350. #define WMAPRO_CHANNEL_MASK_ZERO 0x0000
  7351. /* Speaker layout mask for one channel (Home Theater, mono).
  7352. * - Speaker front center
  7353. */
  7354. #define WMAPRO_CHANNEL_MASK_1_C 0x0004
  7355. /* Speaker layout mask for two channels (Home Theater, stereo).
  7356. * - Speaker front left
  7357. * - Speaker front right
  7358. */
  7359. #define WMAPRO_CHANNEL_MASK_2_L_R 0x0003
  7360. /* Speaker layout mask for three channels (Home Theater).
  7361. * - Speaker front left
  7362. * - Speaker front right
  7363. * - Speaker front center
  7364. */
  7365. #define WMAPRO_CHANNEL_MASK_3_L_C_R 0x0007
  7366. /* Speaker layout mask for two channels (stereo).
  7367. * - Speaker back left
  7368. * - Speaker back right
  7369. */
  7370. #define WMAPRO_CHANNEL_MASK_2_Bl_Br 0x0030
  7371. /* Speaker layout mask for four channels.
  7372. * - Speaker front left
  7373. * - Speaker front right
  7374. * - Speaker back left
  7375. * - Speaker back right
  7376. */
  7377. #define WMAPRO_CHANNEL_MASK_4_L_R_Bl_Br 0x0033
  7378. /* Speaker layout mask for four channels (Home Theater).
  7379. * - Speaker front left
  7380. * - Speaker front right
  7381. * - Speaker front center
  7382. * - Speaker back center
  7383. */
  7384. #define WMAPRO_CHANNEL_MASK_4_L_R_C_Bc_HT 0x0107
  7385. /* Speaker layout mask for five channels.
  7386. * - Speaker front left
  7387. * - Speaker front right
  7388. * - Speaker front center
  7389. * - Speaker back left
  7390. * - Speaker back right
  7391. */
  7392. #define WMAPRO_CHANNEL_MASK_5_L_C_R_Bl_Br 0x0037
  7393. /* Speaker layout mask for five channels (5 mode, Home Theater).
  7394. * - Speaker front left
  7395. * - Speaker front right
  7396. * - Speaker front center
  7397. * - Speaker side left
  7398. * - Speaker side right
  7399. */
  7400. #define WMAPRO_CHANNEL_MASK_5_L_C_R_Sl_Sr_HT 0x0607
  7401. /* Speaker layout mask for six channels (5.1 mode).
  7402. * - Speaker front left
  7403. * - Speaker front right
  7404. * - Speaker front center
  7405. * - Speaker low frequency
  7406. * - Speaker back left
  7407. * - Speaker back right
  7408. */
  7409. #define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Bl_Br_SLF 0x003F
  7410. /* Speaker layout mask for six channels (5.1 mode, Home Theater).
  7411. * - Speaker front left
  7412. * - Speaker front right
  7413. * - Speaker front center
  7414. * - Speaker low frequency
  7415. * - Speaker side left
  7416. * - Speaker side right
  7417. */
  7418. #define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Sl_Sr_SLF_HT 0x060F
  7419. /* Speaker layout mask for six channels (5.1 mode, no LFE).
  7420. * - Speaker front left
  7421. * - Speaker front right
  7422. * - Speaker front center
  7423. * - Speaker back left
  7424. * - Speaker back right
  7425. * - Speaker back center
  7426. */
  7427. #define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Bl_Br_Bc 0x0137
  7428. /* Speaker layout mask for six channels (5.1 mode, Home Theater,
  7429. * no LFE).
  7430. * - Speaker front left
  7431. * - Speaker front right
  7432. * - Speaker front center
  7433. * - Speaker back center
  7434. * - Speaker side left
  7435. * - Speaker side right
  7436. */
  7437. #define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Sl_Sr_Bc_HT 0x0707
  7438. /* Speaker layout mask for seven channels (6.1 mode).
  7439. * - Speaker front left
  7440. * - Speaker front right
  7441. * - Speaker front center
  7442. * - Speaker low frequency
  7443. * - Speaker back left
  7444. * - Speaker back right
  7445. * - Speaker back center
  7446. */
  7447. #define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Bl_Br_Bc_SLF 0x013F
  7448. /* Speaker layout mask for seven channels (6.1 mode, Home
  7449. * Theater).
  7450. * - Speaker front left
  7451. * - Speaker front right
  7452. * - Speaker front center
  7453. * - Speaker low frequency
  7454. * - Speaker back center
  7455. * - Speaker side left
  7456. * - Speaker side right
  7457. */
  7458. #define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Sl_Sr_Bc_SLF_HT 0x070F
  7459. /* Speaker layout mask for seven channels (6.1 mode, no LFE).
  7460. * - Speaker front left
  7461. * - Speaker front right
  7462. * - Speaker front center
  7463. * - Speaker back left
  7464. * - Speaker back right
  7465. * - Speaker front left of center
  7466. * - Speaker front right of center
  7467. */
  7468. #define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Bl_Br_SFLOC_SFROC 0x00F7
  7469. /* Speaker layout mask for seven channels (6.1 mode, Home
  7470. * Theater, no LFE).
  7471. * - Speaker front left
  7472. * - Speaker front right
  7473. * - Speaker front center
  7474. * - Speaker side left
  7475. * - Speaker side right
  7476. * - Speaker front left of center
  7477. * - Speaker front right of center
  7478. */
  7479. #define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Sl_Sr_SFLOC_SFROC_HT 0x0637
  7480. /* Speaker layout mask for eight channels (7.1 mode).
  7481. * - Speaker front left
  7482. * - Speaker front right
  7483. * - Speaker front center
  7484. * - Speaker back left
  7485. * - Speaker back right
  7486. * - Speaker low frequency
  7487. * - Speaker front left of center
  7488. * - Speaker front right of center
  7489. */
  7490. #define WMAPRO_CHANNEL_MASK_7DOT1_L_C_R_Bl_Br_SLF_SFLOC_SFROC \
  7491. 0x00FF
  7492. /* Speaker layout mask for eight channels (7.1 mode, Home Theater).
  7493. * - Speaker front left
  7494. * - Speaker front right
  7495. * - Speaker front center
  7496. * - Speaker side left
  7497. * - Speaker side right
  7498. * - Speaker low frequency
  7499. * - Speaker front left of center
  7500. * - Speaker front right of center
  7501. *
  7502. */
  7503. #define WMAPRO_CHANNEL_MASK_7DOT1_L_C_R_Sl_Sr_SLF_SFLOC_SFROC_HT \
  7504. 0x063F
  7505. #define ASM_PARAM_ID_DEC_OUTPUT_CHAN_MAP 0x00010D82
  7506. /* Maximum number of decoder output channels. */
  7507. #define MAX_CHAN_MAP_CHANNELS 16
  7508. /* Structure for decoder output channel mapping. */
  7509. /* Payload of the #ASM_PARAM_ID_DEC_OUTPUT_CHAN_MAP parameter in the
  7510. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7511. */
  7512. struct asm_dec_out_chan_map_param {
  7513. struct apr_hdr hdr;
  7514. struct asm_stream_cmd_set_encdec_param encdec;
  7515. u32 num_channels;
  7516. /* Number of decoder output channels.
  7517. * Supported values: 0 to #MAX_CHAN_MAP_CHANNELS
  7518. *
  7519. * A value of 0 indicates native channel mapping, which is valid
  7520. * only for NT mode. This means the output of the decoder is to be
  7521. * preserved as is.
  7522. */
  7523. u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];
  7524. } __packed;
  7525. #define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84
  7526. /* Bitmask for the IEC 61937 enable flag.*/
  7527. #define ASM_BIT_MASK_IEC_61937_STREAM_FLAG (0x00000001UL)
  7528. /* Shift value for the IEC 61937 enable flag.*/
  7529. #define ASM_SHIFT_IEC_61937_STREAM_FLAG 0
  7530. /* Bitmask for the IEC 60958 enable flag.*/
  7531. #define ASM_BIT_MASK_IEC_60958_STREAM_FLAG (0x00000002UL)
  7532. /* Shift value for the IEC 60958 enable flag.*/
  7533. #define ASM_SHIFT_IEC_60958_STREAM_FLAG 1
  7534. /* Payload format for open write compressed command */
  7535. /* Payload format for the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED
  7536. * command, which opens a stream for a given session ID and stream ID
  7537. * to be rendered in the compressed format.
  7538. */
  7539. struct asm_stream_cmd_open_write_compressed {
  7540. struct apr_hdr hdr;
  7541. u32 flags;
  7542. /* Mode flags that configure the stream for a specific format.
  7543. * Supported values:
  7544. * - Bit 0 -- IEC 61937 compatibility
  7545. * - 0 -- Stream is not in IEC 61937 format
  7546. * - 1 -- Stream is in IEC 61937 format
  7547. * - Bit 1 -- IEC 60958 compatibility
  7548. * - 0 -- Stream is not in IEC 60958 format
  7549. * - 1 -- Stream is in IEC 60958 format
  7550. * - Bits 2 to 31 -- 0 (Reserved)
  7551. *
  7552. * For the same stream, bit 0 cannot be set to 0 and bit 1 cannot
  7553. * be set to 1. A compressed stream connot have IEC 60958
  7554. * packetization applied without IEC 61937 packetization.
  7555. * @note1hang Currently, IEC 60958 packetized input streams are not
  7556. * supported.
  7557. */
  7558. u32 fmt_id;
  7559. /* Specifies the media type of the HDMI stream to be opened.
  7560. * Supported values:
  7561. * - #ASM_MEDIA_FMT_AC3
  7562. * - #ASM_MEDIA_FMT_EAC3
  7563. * - #ASM_MEDIA_FMT_DTS
  7564. * - #ASM_MEDIA_FMT_ATRAC
  7565. * - #ASM_MEDIA_FMT_MAT
  7566. *
  7567. * @note1hang This field must be set to a valid media type even if
  7568. * IEC 61937 packetization is not performed by the aDSP.
  7569. */
  7570. } __packed;
  7571. /* Indicates the number of samples per channel to be removed from the
  7572. * beginning of the stream.
  7573. */
  7574. #define ASM_DATA_CMD_REMOVE_INITIAL_SILENCE 0x00010D67
  7575. /* Indicates the number of samples per channel to be removed from
  7576. * the end of the stream.
  7577. */
  7578. #define ASM_DATA_CMD_REMOVE_TRAILING_SILENCE 0x00010D68
  7579. struct asm_data_cmd_remove_silence {
  7580. struct apr_hdr hdr;
  7581. u32 num_samples_to_remove;
  7582. /* < Number of samples per channel to be removed.
  7583. * @values 0 to (2@sscr{32}-1)
  7584. */
  7585. } __packed;
  7586. #define ASM_STREAM_CMD_OPEN_READ_COMPRESSED 0x00010D95
  7587. /* Bitmask for the IEC 61937 to 61937 pass-through capture. */
  7588. #define ASM_BIT_MASK_IEC_61937_PASS_THROUGH_FLAG (0x00000001UL)
  7589. /* Shift value for the IEC 61937 to 61937 pass-through capture. */
  7590. #define ASM_SHIFT_IEC_61937_PASS_THROUGH_FLAG 0
  7591. /* Bitmask for the DSD pass-through capture. */
  7592. #define ASM_BIT_MASK_COMPRESSED_FORMAT_FLAG (0x00000003UL)
  7593. /* Shift value for the DSD pass-through capture. */
  7594. #define ASM_SHIFT_DSD_COMPRESSED_FORMAT_FLAG 0
  7595. #define ASM_DSD_FORMAT_FLAG 2
  7596. struct asm_stream_cmd_open_read_compressed {
  7597. struct apr_hdr hdr;
  7598. u32 mode_flags;
  7599. /* Mode flags that indicate whether meta information per encoded
  7600. * frame is to be provided and packaging.
  7601. * Supported values for bit 0: (IEC 61937 pass-through mode)
  7602. * - 0 -- Unpack the IEC 61937 format stream to RAW compressed format
  7603. * - 1 -- Pass-through transfer of the IEC 61937 format stream
  7604. * - Use #ASM_BIT_MASK_IEC_61937_PASS_THROUGH_FLAG to set the bitmask
  7605. * and #ASM_SHIFT_IEC_61937_PASS_THROUGH_FLAG to set the shift value
  7606. * for this bit.
  7607. * Supported values for bit 1: (DSD native pass-through mode)
  7608. * 0 -- non DSD operation
  7609. * 1 -- Pass-through transfer of the DSD format stream
  7610. * To set this bit, use #ASM_BIT_MASK_DSD_PASS_THROUGH_FLAG and
  7611. * use #ASM_SHIFT_DSD_PASS_THROUGH_FLAG to set the shift value for
  7612. * this bit
  7613. * Supported values for bit 4:
  7614. * - 0 -- Return data buffer contains all encoded frames only; it does
  7615. * not contain frame metadata.
  7616. * - 1 -- Return data buffer contains an array of metadata and encoded
  7617. * frames.
  7618. * - Use #ASM_BIT_MASK_META_INFO_FLAG to set the bitmask and
  7619. * #ASM_SHIFT_META_INFO_FLAG to set the shift value for this bit.
  7620. * All other bits are reserved; clients must set them to zero.
  7621. */
  7622. u32 frames_per_buf;
  7623. /* Indicates the number of frames that need to be returned per
  7624. * read buffer
  7625. * Supported values: should be greater than 0 for IEC to RAW compressed
  7626. * unpack mode.
  7627. * Value is don't care for IEC 61937 pass-through mode.
  7628. * @values
  7629. * - >0 -- For IEC 61937-to-RAW Compressed Unpack mode
  7630. * - 1 -- For IEC 61937 or DSD Pass-through mode
  7631. */
  7632. } __packed;
  7633. /* adsp_asm_stream_commands.h*/
  7634. /* adsp_asm_api.h (no changes)*/
  7635. #define ASM_STREAM_POSTPROCOPO_ID_DEFAULT \
  7636. 0x00010BE4
  7637. #define ASM_STREAM_POSTPROCOPO_ID_PEAKMETER \
  7638. 0x00010D83
  7639. #define ASM_STREAM_POSTPROCOPO_ID_NONE \
  7640. 0x00010C68
  7641. #define ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL \
  7642. 0x00010D8B
  7643. #define ASM_STREAM_PREPROCOPO_ID_DEFAULT \
  7644. ASM_STREAM_POSTPROCOPO_ID_DEFAULT
  7645. #define ASM_STREAM_PREPROCOPO_ID_NONE \
  7646. ASM_STREAM_POSTPROCOPO_ID_NONE
  7647. #define ADM_CMD_COPP_OPENOPOLOGY_ID_NONE_AUDIO_COPP \
  7648. 0x00010312
  7649. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MONO_AUDIO_COPP \
  7650. 0x00010313
  7651. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP \
  7652. 0x00010314
  7653. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_IIR_AUDIO_COPP\
  7654. 0x00010704
  7655. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MONO_AUDIO_COPP_MBDRCV2\
  7656. 0x0001070D
  7657. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP_MBDRCV2\
  7658. 0x0001070E
  7659. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_IIR_AUDIO_COPP_MBDRCV2\
  7660. 0x0001070F
  7661. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP_MBDRC_V3 \
  7662. 0x11000000
  7663. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MCH_PEAK_VOL \
  7664. 0x0001031B
  7665. #define ADM_CMD_COPP_OPENOPOLOGY_ID_MIC_MONO_AUDIO_COPP 0x00010315
  7666. #define ADM_CMD_COPP_OPENOPOLOGY_ID_MIC_STEREO_AUDIO_COPP 0x00010316
  7667. #define AUDPROC_COPPOPOLOGY_ID_MCHAN_IIR_AUDIO 0x00010715
  7668. #define ADM_CMD_COPP_OPENOPOLOGY_ID_DEFAULT_AUDIO_COPP 0x00010BE3
  7669. #define ADM_CMD_COPP_OPENOPOLOGY_ID_PEAKMETER_AUDIO_COPP 0x00010317
  7670. #define AUDPROC_MODULE_ID_AIG 0x00010716
  7671. #define AUDPROC_PARAM_ID_AIG_ENABLE 0x00010717
  7672. #define AUDPROC_PARAM_ID_AIG_CONFIG 0x00010718
  7673. struct Audio_AigParam {
  7674. uint16_t mode;
  7675. /*< Mode word for enabling AIG/SIG mode .
  7676. * Byte offset: 0
  7677. */
  7678. int16_t staticGainL16Q12;
  7679. /*< Static input gain when aigMode is set to 1.
  7680. * Byte offset: 2
  7681. */
  7682. int16_t initialGainDBL16Q7;
  7683. /*<Initial value that the adaptive gain update starts from dB
  7684. * Q7 Byte offset: 4
  7685. */
  7686. int16_t idealRMSDBL16Q7;
  7687. /*<Average RMS level that AIG attempts to achieve Q8.7
  7688. * Byte offset: 6
  7689. */
  7690. int32_t noiseGateL32;
  7691. /*Threshold below which signal is considered as noise and AIG
  7692. * Byte offset: 8
  7693. */
  7694. int32_t minGainL32Q15;
  7695. /*Minimum gain that can be provided by AIG Q16.15
  7696. * Byte offset: 12
  7697. */
  7698. int32_t maxGainL32Q15;
  7699. /*Maximum gain that can be provided by AIG Q16.15
  7700. * Byte offset: 16
  7701. */
  7702. uint32_t gainAtRtUL32Q31;
  7703. /*Attack/release time for AIG update Q1.31
  7704. * Byte offset: 20
  7705. */
  7706. uint32_t longGainAtRtUL32Q31;
  7707. /*Long attack/release time while updating gain for
  7708. * noise/silence Q1.31 Byte offset: 24
  7709. */
  7710. uint32_t rmsTavUL32Q32;
  7711. /* RMS smoothing time constant used for long-term RMS estimate
  7712. * Q0.32 Byte offset: 28
  7713. */
  7714. uint32_t gainUpdateStartTimMsUL32Q0;
  7715. /* The waiting time before which AIG starts to apply adaptive
  7716. * gain update Q32.0 Byte offset: 32
  7717. */
  7718. } __packed;
  7719. #define ADM_MODULE_ID_EANS 0x00010C4A
  7720. #define ADM_PARAM_ID_EANS_ENABLE 0x00010C4B
  7721. #define ADM_PARAM_ID_EANS_PARAMS 0x00010C4C
  7722. struct adm_eans_enable {
  7723. uint32_t enable_flag;
  7724. /*< Specifies whether EANS is disabled (0) or enabled
  7725. * (nonzero).
  7726. * This is supported only for sampling rates of 8, 12, 16, 24, 32,
  7727. * and 48 kHz. It is not supported for sampling rates of 11.025,
  7728. * 22.05, or 44.1 kHz.
  7729. */
  7730. } __packed;
  7731. struct adm_eans_params {
  7732. int16_t eans_mode;
  7733. /*< Mode word for enabling/disabling submodules.
  7734. * Byte offset: 0
  7735. */
  7736. int16_t eans_input_gain;
  7737. /*< Q2.13 input gain to the EANS module.
  7738. * Byte offset: 2
  7739. */
  7740. int16_t eans_output_gain;
  7741. /*< Q2.13 output gain to the EANS module.
  7742. * Byte offset: 4
  7743. */
  7744. int16_t eansarget_ns;
  7745. /*< Target noise suppression level in dB.
  7746. * Byte offset: 6
  7747. */
  7748. int16_t eans_s_alpha;
  7749. /*< Q3.12 over-subtraction factor for stationary noise
  7750. * suppression.
  7751. * Byte offset: 8
  7752. */
  7753. int16_t eans_n_alpha;
  7754. /* < Q3.12 over-subtraction factor for nonstationary noise
  7755. * suppression.
  7756. * Byte offset: 10
  7757. */
  7758. int16_t eans_n_alphamax;
  7759. /*< Q3.12 maximum over-subtraction factor for nonstationary
  7760. * noise suppression.
  7761. * Byte offset: 12
  7762. */
  7763. int16_t eans_e_alpha;
  7764. /*< Q15 scaling factor for excess noise suppression.
  7765. * Byte offset: 14
  7766. */
  7767. int16_t eans_ns_snrmax;
  7768. /*< Upper boundary in dB for SNR estimation.
  7769. * Byte offset: 16
  7770. */
  7771. int16_t eans_sns_block;
  7772. /*< Quarter block size for stationary noise suppression.
  7773. * Byte offset: 18
  7774. */
  7775. int16_t eans_ns_i;
  7776. /*< Initialization block size for noise suppression.
  7777. * Byte offset: 20
  7778. */
  7779. int16_t eans_np_scale;
  7780. /*< Power scale factor for nonstationary noise update.
  7781. * Byte offset: 22
  7782. */
  7783. int16_t eans_n_lambda;
  7784. /*< Smoothing factor for higher level nonstationary noise
  7785. * update.
  7786. * Byte offset: 24
  7787. */
  7788. int16_t eans_n_lambdaf;
  7789. /*< Medium averaging factor for noise update.
  7790. * Byte offset: 26
  7791. */
  7792. int16_t eans_gs_bias;
  7793. /*< Bias factor in dB for gain calculation.
  7794. * Byte offset: 28
  7795. */
  7796. int16_t eans_gs_max;
  7797. /*< SNR lower boundary in dB for aggressive gain calculation.
  7798. * Byte offset: 30
  7799. */
  7800. int16_t eans_s_alpha_hb;
  7801. /*< Q3.12 over-subtraction factor for high-band stationary
  7802. * noise suppression.
  7803. * Byte offset: 32
  7804. */
  7805. int16_t eans_n_alphamax_hb;
  7806. /*< Q3.12 maximum over-subtraction factor for high-band
  7807. * nonstationary noise suppression.
  7808. * Byte offset: 34
  7809. */
  7810. int16_t eans_e_alpha_hb;
  7811. /*< Q15 scaling factor for high-band excess noise suppression.
  7812. * Byte offset: 36
  7813. */
  7814. int16_t eans_n_lambda0;
  7815. /*< Smoothing factor for nonstationary noise update during
  7816. * speech activity.
  7817. * Byte offset: 38
  7818. */
  7819. int16_t thresh;
  7820. /*< Threshold for generating a binary VAD decision.
  7821. * Byte offset: 40
  7822. */
  7823. int16_t pwr_scale;
  7824. /*< Indirect lower boundary of the noise level estimate.
  7825. * Byte offset: 42
  7826. */
  7827. int16_t hangover_max;
  7828. /*< Avoids mid-speech clipping and reliably detects weak speech
  7829. * bursts at the end of speech activity.
  7830. * Byte offset: 44
  7831. */
  7832. int16_t alpha_snr;
  7833. /*< Controls responsiveness of the VAD.
  7834. * Byte offset: 46
  7835. */
  7836. int16_t snr_diff_max;
  7837. /*< Maximum SNR difference. Decreasing this parameter value may
  7838. * help in making correct decisions during abrupt changes; however,
  7839. * decreasing too much may increase false alarms during long
  7840. * pauses/silences.
  7841. * Byte offset: 48
  7842. */
  7843. int16_t snr_diff_min;
  7844. /*< Minimum SNR difference. Decreasing this parameter value may
  7845. * help in making correct decisions during abrupt changes; however,
  7846. * decreasing too much may increase false alarms during long
  7847. * pauses/silences.
  7848. * Byte offset: 50
  7849. */
  7850. int16_t init_length;
  7851. /*< Defines the number of frames for which a noise level
  7852. * estimate is set to a fixed value.
  7853. * Byte offset: 52
  7854. */
  7855. int16_t max_val;
  7856. /*< Defines the upper limit of the noise level.
  7857. * Byte offset: 54
  7858. */
  7859. int16_t init_bound;
  7860. /*< Defines the initial bounding value for the noise level
  7861. * estimate. This is used during the initial segment defined by the
  7862. * init_length parameter.
  7863. * Byte offset: 56
  7864. */
  7865. int16_t reset_bound;
  7866. /*< Reset boundary for noise tracking.
  7867. * Byte offset: 58
  7868. */
  7869. int16_t avar_scale;
  7870. /*< Defines the bias factor in noise estimation.
  7871. * Byte offset: 60
  7872. */
  7873. int16_t sub_nc;
  7874. /*< Defines the window length for noise estimation.
  7875. * Byte offset: 62
  7876. */
  7877. int16_t spow_min;
  7878. /*< Defines the minimum signal power required to update the
  7879. * boundaries for the noise floor estimate.
  7880. * Byte offset: 64
  7881. */
  7882. int16_t eans_gs_fast;
  7883. /*< Fast smoothing factor for postprocessor gain.
  7884. * Byte offset: 66
  7885. */
  7886. int16_t eans_gs_med;
  7887. /*< Medium smoothing factor for postprocessor gain.
  7888. * Byte offset: 68
  7889. */
  7890. int16_t eans_gs_slow;
  7891. /*< Slow smoothing factor for postprocessor gain.
  7892. * Byte offset: 70
  7893. */
  7894. int16_t eans_swb_salpha;
  7895. /*< Q3.12 super wideband aggressiveness factor for stationary
  7896. * noise suppression.
  7897. * Byte offset: 72
  7898. */
  7899. int16_t eans_swb_nalpha;
  7900. /*< Q3.12 super wideband aggressiveness factor for
  7901. * nonstationary noise suppression.
  7902. * Byte offset: 74
  7903. */
  7904. } __packed;
  7905. #define ADM_MODULE_IDX_MIC_GAIN_CTRL 0x00010C35
  7906. /* @addtogroup audio_pp_param_ids
  7907. * ID of the Tx mic gain control parameter used by the
  7908. * #ADM_MODULE_IDX_MIC_GAIN_CTRL module.
  7909. * @messagepayload
  7910. * @structure{admx_mic_gain}
  7911. * @tablespace
  7912. * @inputtable{Audio_Postproc_ADM_PARAM_IDX_MIC_GAIN.tex}
  7913. */
  7914. #define ADM_PARAM_IDX_MIC_GAIN 0x00010C36
  7915. /* Structure for a Tx mic gain parameter for the mic gain
  7916. * control module.
  7917. */
  7918. /* @brief Payload of the #ADM_PARAM_IDX_MIC_GAIN parameter in the
  7919. * Tx Mic Gain Control module.
  7920. */
  7921. struct admx_mic_gain {
  7922. uint16_t tx_mic_gain;
  7923. /*< Linear gain in Q13 format. */
  7924. uint16_t reserved;
  7925. /*< Clients must set this field to zero. */
  7926. } __packed;
  7927. /* end_addtogroup audio_pp_param_ids */
  7928. /* @ingroup audio_pp_module_ids
  7929. * ID of the Rx Codec Gain Control module.
  7930. *
  7931. * This module supports the following parameter ID:
  7932. * - #ADM_PARAM_ID_RX_CODEC_GAIN
  7933. */
  7934. #define ADM_MODULE_ID_RX_CODEC_GAIN_CTRL 0x00010C37
  7935. /* @addtogroup audio_pp_param_ids
  7936. * ID of the Rx codec gain control parameter used by the
  7937. * #ADM_MODULE_ID_RX_CODEC_GAIN_CTRL module.
  7938. *
  7939. * @messagepayload
  7940. * @structure{adm_rx_codec_gain}
  7941. * @tablespace
  7942. * @inputtable{Audio_Postproc_ADM_PARAM_ID_RX_CODEC_GAIN.tex}
  7943. */
  7944. #define ADM_PARAM_ID_RX_CODEC_GAIN 0x00010C38
  7945. /* Structure for the Rx common codec gain control module. */
  7946. /* @brief Payload of the #ADM_PARAM_ID_RX_CODEC_GAIN parameter
  7947. * in the Rx Codec Gain Control module.
  7948. */
  7949. struct adm_rx_codec_gain {
  7950. uint16_t rx_codec_gain;
  7951. /* Linear gain in Q13 format. */
  7952. uint16_t reserved;
  7953. /* Clients must set this field to zero.*/
  7954. } __packed;
  7955. /* end_addtogroup audio_pp_param_ids */
  7956. /* @ingroup audio_pp_module_ids
  7957. * ID of the HPF Tuning Filter module on the Tx path.
  7958. * This module supports the following parameter IDs:
  7959. * - #ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG
  7960. * - #ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN
  7961. * - #ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS
  7962. */
  7963. #define ADM_MODULE_ID_HPF_IIRX_FILTER 0x00010C3D
  7964. /* @addtogroup audio_pp_param_ids */
  7965. /* ID of the Tx HPF IIR filter enable parameter used by the
  7966. * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
  7967. * @parspace Message payload
  7968. * @structure{adm_hpfx_iir_filter_enable_cfg}
  7969. * @tablespace
  7970. * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG.tex}
  7971. */
  7972. #define ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG 0x00010C3E
  7973. /* ID of the Tx HPF IIR filter pregain parameter used by the
  7974. * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
  7975. * @parspace Message payload
  7976. * @structure{adm_hpfx_iir_filter_pre_gain}
  7977. * @tablespace
  7978. * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN.tex}
  7979. */
  7980. #define ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN 0x00010C3F
  7981. /* ID of the Tx HPF IIR filter configuration parameters used by the
  7982. * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
  7983. * @parspace Message payload
  7984. * @structure{adm_hpfx_iir_filter_cfg_params}
  7985. * @tablespace
  7986. * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PA
  7987. * RAMS.tex}
  7988. */
  7989. #define ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS 0x00010C40
  7990. /* Structure for enabling a configuration parameter for
  7991. * the HPF IIR tuning filter module on the Tx path.
  7992. */
  7993. /* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG
  7994. * parameter in the Tx path HPF Tuning Filter module.
  7995. */
  7996. struct adm_hpfx_iir_filter_enable_cfg {
  7997. uint32_t enable_flag;
  7998. /* Specifies whether the HPF tuning filter is disabled (0) or
  7999. * enabled (nonzero).
  8000. */
  8001. } __packed;
  8002. /* Structure for the pregain parameter for the HPF
  8003. * IIR tuning filter module on the Tx path.
  8004. */
  8005. /* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN parameter
  8006. * in the Tx path HPF Tuning Filter module.
  8007. */
  8008. struct adm_hpfx_iir_filter_pre_gain {
  8009. uint16_t pre_gain;
  8010. /* Linear gain in Q13 format. */
  8011. uint16_t reserved;
  8012. /* Clients must set this field to zero.*/
  8013. } __packed;
  8014. /* Structure for the configuration parameter for the
  8015. * HPF IIR tuning filter module on the Tx path.
  8016. */
  8017. /* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS
  8018. * parameters in the Tx path HPF Tuning Filter module. \n
  8019. * \n
  8020. * This structure is followed by tuning filter coefficients as follows: \n
  8021. * - Sequence of int32_t FilterCoeffs.
  8022. * Each band has five coefficients, each in int32_t format in the order of
  8023. * b0, b1, b2, a1, a2.
  8024. * - Sequence of int16_t NumShiftFactor.
  8025. * One int16_t per band. The numerator shift factor is related to the Q
  8026. * factor of the filter coefficients.
  8027. * - Sequence of uint16_t PanSetting.
  8028. * One uint16_t for each band to indicate application of the filter to
  8029. * left (0), right (1), or both (2) channels.
  8030. */
  8031. struct adm_hpfx_iir_filter_cfg_params {
  8032. uint16_t num_biquad_stages;
  8033. /*< Number of bands.
  8034. * Supported values: 0 to 20
  8035. */
  8036. uint16_t reserved;
  8037. /*< Clients must set this field to zero.*/
  8038. } __packed;
  8039. /* end_addtogroup audio_pp_module_ids */
  8040. /* @addtogroup audio_pp_module_ids */
  8041. /* ID of the Tx path IIR Tuning Filter module.
  8042. * This module supports the following parameter IDs:
  8043. * - #ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG
  8044. */
  8045. #define ADM_MODULE_IDX_IIR_FILTER 0x00010C41
  8046. /* ID of the Rx path IIR Tuning Filter module for the left channel.
  8047. * The parameter IDs of the IIR tuning filter module
  8048. * (#ASM_MODULE_ID_IIRUNING_FILTER) are used for the left IIR Rx tuning
  8049. * filter.
  8050. *
  8051. * Pan parameters are not required for this per-channel IIR filter; the pan
  8052. * parameters are ignored by this module.
  8053. */
  8054. #define ADM_MODULE_ID_LEFT_IIRUNING_FILTER 0x00010705
  8055. /* ID of the the Rx path IIR Tuning Filter module for the right
  8056. * channel.
  8057. * The parameter IDs of the IIR tuning filter module
  8058. * (#ASM_MODULE_ID_IIRUNING_FILTER) are used for the right IIR Rx
  8059. * tuning filter.
  8060. *
  8061. * Pan parameters are not required for this per-channel IIR filter;
  8062. * the pan parameters are ignored by this module.
  8063. */
  8064. #define ADM_MODULE_ID_RIGHT_IIRUNING_FILTER 0x00010706
  8065. /* end_addtogroup audio_pp_module_ids */
  8066. /* @addtogroup audio_pp_param_ids */
  8067. /* ID of the Tx IIR filter enable parameter used by the
  8068. * #ADM_MODULE_IDX_IIR_FILTER module.
  8069. * @parspace Message payload
  8070. * @structure{admx_iir_filter_enable_cfg}
  8071. * @tablespace
  8072. * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG.tex}
  8073. */
  8074. #define ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG 0x00010C42
  8075. /* ID of the Tx IIR filter pregain parameter used by the
  8076. * #ADM_MODULE_IDX_IIR_FILTER module.
  8077. * @parspace Message payload
  8078. * @structure{admx_iir_filter_pre_gain}
  8079. * @tablespace
  8080. * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN.tex}
  8081. */
  8082. #define ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN 0x00010C43
  8083. /* ID of the Tx IIR filter configuration parameters used by the
  8084. * #ADM_MODULE_IDX_IIR_FILTER module.
  8085. * @parspace Message payload
  8086. * @structure{admx_iir_filter_cfg_params}
  8087. * @tablespace
  8088. * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS.tex}
  8089. */
  8090. #define ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS 0x00010C44
  8091. /* Structure for enabling the configuration parameter for the
  8092. * IIR filter module on the Tx path.
  8093. */
  8094. /* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG
  8095. * parameter in the Tx Path IIR Tuning Filter module.
  8096. */
  8097. struct admx_iir_filter_enable_cfg {
  8098. uint32_t enable_flag;
  8099. /*< Specifies whether the IIR tuning filter is disabled (0) or
  8100. * enabled (nonzero).
  8101. */
  8102. } __packed;
  8103. /* Structure for the pregain parameter for the
  8104. * IIR filter module on the Tx path.
  8105. */
  8106. /* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN
  8107. * parameter in the Tx Path IIR Tuning Filter module.
  8108. */
  8109. struct admx_iir_filter_pre_gain {
  8110. uint16_t pre_gain;
  8111. /*< Linear gain in Q13 format. */
  8112. uint16_t reserved;
  8113. /*< Clients must set this field to zero.*/
  8114. } __packed;
  8115. /* Structure for the configuration parameter for the
  8116. * IIR filter module on the Tx path.
  8117. */
  8118. /* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS
  8119. * parameter in the Tx Path IIR Tuning Filter module. \n
  8120. * \n
  8121. * This structure is followed by the HPF IIR filter coefficients on
  8122. * the Tx path as follows: \n
  8123. * - Sequence of int32_t ulFilterCoeffs. Each band has five
  8124. * coefficients, each in int32_t format in the order of b0, b1, b2,
  8125. * a1, a2.
  8126. * - Sequence of int16_t sNumShiftFactor. One int16_t per band. The
  8127. * numerator shift factor is related to the Q factor of the filter
  8128. * coefficients.
  8129. * - Sequence of uint16_t usPanSetting. One uint16_t for each band
  8130. * to indicate if the filter is applied to left (0), right (1), or
  8131. * both (2) channels.
  8132. */
  8133. struct admx_iir_filter_cfg_params {
  8134. uint16_t num_biquad_stages;
  8135. /*< Number of bands.
  8136. * Supported values: 0 to 20
  8137. */
  8138. uint16_t reserved;
  8139. /*< Clients must set this field to zero.*/
  8140. } __packed;
  8141. /* end_addtogroup audio_pp_module_ids */
  8142. /* @ingroup audio_pp_module_ids
  8143. * ID of the QEnsemble module.
  8144. * This module supports the following parameter IDs:
  8145. * - #ADM_PARAM_ID_QENSEMBLE_ENABLE
  8146. * - #ADM_PARAM_ID_QENSEMBLE_BACKGAIN
  8147. * - #ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE
  8148. */
  8149. #define ADM_MODULE_ID_QENSEMBLE 0x00010C59
  8150. /* @addtogroup audio_pp_param_ids */
  8151. /* ID of the QEnsemble enable parameter used by the
  8152. * #ADM_MODULE_ID_QENSEMBLE module.
  8153. * @messagepayload
  8154. * @structure{adm_qensemble_enable}
  8155. * @tablespace
  8156. * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_ENABLE.tex}
  8157. */
  8158. #define ADM_PARAM_ID_QENSEMBLE_ENABLE 0x00010C60
  8159. /* ID of the QEnsemble back gain parameter used by the
  8160. * #ADM_MODULE_ID_QENSEMBLE module.
  8161. * @messagepayload
  8162. * @structure{adm_qensemble_param_backgain}
  8163. * @tablespace
  8164. * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_BACKGAIN.tex}
  8165. */
  8166. #define ADM_PARAM_ID_QENSEMBLE_BACKGAIN 0x00010C61
  8167. /* ID of the QEnsemble new angle parameter used by the
  8168. * #ADM_MODULE_ID_QENSEMBLE module.
  8169. * @messagepayload
  8170. * @structure{adm_qensemble_param_set_new_angle}
  8171. * @tablespace
  8172. * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE.tex}
  8173. */
  8174. #define ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE 0x00010C62
  8175. /* Structure for enabling the configuration parameter for the
  8176. * QEnsemble module.
  8177. */
  8178. /* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_ENABLE
  8179. * parameter used by the QEnsemble module.
  8180. */
  8181. struct adm_qensemble_enable {
  8182. uint32_t enable_flag;
  8183. /*< Specifies whether the QEnsemble module is disabled (0) or enabled
  8184. * (nonzero).
  8185. */
  8186. } __packed;
  8187. /* Structure for the background gain for the QEnsemble module. */
  8188. /* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_BACKGAIN
  8189. * parameter used by
  8190. * the QEnsemble module.
  8191. */
  8192. struct adm_qensemble_param_backgain {
  8193. int16_t back_gain;
  8194. /*< Linear gain in Q15 format.
  8195. * Supported values: 0 to 32767
  8196. */
  8197. uint16_t reserved;
  8198. /*< Clients must set this field to zero.*/
  8199. } __packed;
  8200. /* Structure for setting a new angle for the QEnsemble module. */
  8201. /* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE
  8202. * parameter used
  8203. * by the QEnsemble module.
  8204. */
  8205. struct adm_qensemble_param_set_new_angle {
  8206. int16_t new_angle;
  8207. /*< New angle in degrees.
  8208. * Supported values: 0 to 359
  8209. */
  8210. int16_t time_ms;
  8211. /*< Transition time in milliseconds to set the new angle.
  8212. * Supported values: 0 to 32767
  8213. */
  8214. } __packed;
  8215. #define ADM_CMD_GET_PP_TOPO_MODULE_LIST 0x00010349
  8216. #define ADM_CMDRSP_GET_PP_TOPO_MODULE_LIST 0x00010350
  8217. #define ADM_CMD_GET_PP_TOPO_MODULE_LIST_V2 0x00010360
  8218. #define ADM_CMDRSP_GET_PP_TOPO_MODULE_LIST_V2 0x00010361
  8219. #define AUDPROC_PARAM_ID_ENABLE 0x00010904
  8220. /*
  8221. * Payload of the ADM_CMD_GET_PP_TOPO_MODULE_LIST command.
  8222. */
  8223. struct adm_cmd_get_pp_topo_module_list {
  8224. struct apr_hdr apr_hdr;
  8225. /* The memory mapping header to be used when requesting out of band */
  8226. struct mem_mapping_hdr mem_hdr;
  8227. /*
  8228. * Maximum data size of the list of modules. This
  8229. * field is a multiple of 4 bytes.
  8230. */
  8231. uint32_t param_max_size;
  8232. } __packed;
  8233. struct audproc_topology_module_id_info_t {
  8234. uint32_t num_modules;
  8235. } __packed;
  8236. /* end_addtogroup audio_pp_module_ids */
  8237. /* @ingroup audio_pp_module_ids
  8238. * ID of the Volume Control module pre/postprocessing block.
  8239. * This module supports the following parameter IDs:
  8240. * - #ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
  8241. * - #ASM_PARAM_ID_MULTICHANNEL_GAIN
  8242. * - #ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG
  8243. * - #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
  8244. * - #ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS
  8245. * - #ASM_PARAM_ID_MULTICHANNEL_GAIN
  8246. * - #ASM_PARAM_ID_MULTICHANNEL_MUTE
  8247. */
  8248. #define ASM_MODULE_ID_VOL_CTRL 0x00010BFE
  8249. #define ASM_MODULE_ID_VOL_CTRL2 0x00010910
  8250. #define AUDPROC_MODULE_ID_VOL_CTRL ASM_MODULE_ID_VOL_CTRL
  8251. /* @addtogroup audio_pp_param_ids */
  8252. /* ID of the master gain parameter used by the #ASM_MODULE_ID_VOL_CTRL
  8253. * module.
  8254. * @messagepayload
  8255. * @structure{asm_volume_ctrl_master_gain}
  8256. * @tablespace
  8257. * @inputtable{Audio_Postproc_ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN.tex}
  8258. */
  8259. #define ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN 0x00010BFF
  8260. #define AUDPROC_PARAM_ID_VOL_CTRL_MASTER_GAIN ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
  8261. /* ID of the left/right channel gain parameter used by the
  8262. * #ASM_MODULE_ID_VOL_CTRL module.
  8263. * @messagepayload
  8264. * @structure{asm_volume_ctrl_lr_chan_gain}
  8265. * @tablespace
  8266. * @inputtable{Audio_Postproc_ASM_PARAM_ID_MULTICHANNEL_GAIN.tex}
  8267. */
  8268. #define ASM_PARAM_ID_VOL_CTRL_LR_CHANNEL_GAIN 0x00010C00
  8269. /* ID of the mute configuration parameter used by the
  8270. * #ASM_MODULE_ID_VOL_CTRL module.
  8271. * @messagepayload
  8272. * @structure{asm_volume_ctrl_mute_config}
  8273. * @tablespace
  8274. * @inputtable{Audio_Postproc_ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG.tex}
  8275. */
  8276. #define ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG 0x00010C01
  8277. /* ID of the soft stepping volume parameters used by the
  8278. * #ASM_MODULE_ID_VOL_CTRL module.
  8279. * @messagepayload
  8280. * @structure{asm_soft_step_volume_params}
  8281. * @tablespace
  8282. * @inputtable{Audio_Postproc_ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMET
  8283. * ERS.tex}
  8284. */
  8285. #define ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS 0x00010C29
  8286. #define AUDPROC_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS\
  8287. ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
  8288. /* ID of the soft pause parameters used by the #ASM_MODULE_ID_VOL_CTRL
  8289. * module.
  8290. */
  8291. #define ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS 0x00010D6A
  8292. /* ID of the multiple-channel volume control parameters used by the
  8293. * #ASM_MODULE_ID_VOL_CTRL module.
  8294. */
  8295. #define ASM_PARAM_ID_MULTICHANNEL_GAIN 0x00010713
  8296. /* ID of the multiple-channel mute configuration parameters used by the
  8297. * #ASM_MODULE_ID_VOL_CTRL module.
  8298. */
  8299. #define ASM_PARAM_ID_MULTICHANNEL_MUTE 0x00010714
  8300. /* Structure for the master gain parameter for a volume control
  8301. * module.
  8302. */
  8303. /* @brief Payload of the #ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
  8304. * parameter used by the Volume Control module.
  8305. */
  8306. struct asm_volume_ctrl_master_gain {
  8307. uint16_t master_gain;
  8308. /* Linear gain in Q13 format. */
  8309. uint16_t reserved;
  8310. /* Clients must set this field to zero. */
  8311. } __packed;
  8312. struct asm_volume_ctrl_lr_chan_gain {
  8313. uint16_t l_chan_gain;
  8314. /*< Linear gain in Q13 format for the left channel. */
  8315. uint16_t r_chan_gain;
  8316. /*< Linear gain in Q13 format for the right channel.*/
  8317. } __packed;
  8318. /* Structure for the mute configuration parameter for a
  8319. * volume control module.
  8320. */
  8321. /* @brief Payload of the #ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG
  8322. * parameter used by the Volume Control module.
  8323. */
  8324. struct asm_volume_ctrl_mute_config {
  8325. uint32_t mute_flag;
  8326. /*< Specifies whether mute is disabled (0) or enabled (nonzero).*/
  8327. } __packed;
  8328. /*
  8329. * Supported parameters for a soft stepping linear ramping curve.
  8330. */
  8331. #define ASM_PARAM_SVC_RAMPINGCURVE_LINEAR 0
  8332. /*
  8333. * Exponential ramping curve.
  8334. */
  8335. #define ASM_PARAM_SVC_RAMPINGCURVE_EXP 1
  8336. /*
  8337. * Logarithmic ramping curve.
  8338. */
  8339. #define ASM_PARAM_SVC_RAMPINGCURVE_LOG 2
  8340. /* Structure for holding soft stepping volume parameters. */
  8341. /* Payload of the #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
  8342. * parameters used by the Volume Control module.
  8343. */
  8344. struct asm_soft_step_volume_params {
  8345. uint32_t period;
  8346. /*< Period in milliseconds.
  8347. * Supported values: 0 to 15000
  8348. */
  8349. uint32_t step;
  8350. /*< Step in microseconds.
  8351. * Supported values: 0 to 15000000
  8352. */
  8353. uint32_t ramping_curve;
  8354. /*< Ramping curve type.
  8355. * Supported values:
  8356. * - #ASM_PARAM_SVC_RAMPINGCURVE_LINEAR
  8357. * - #ASM_PARAM_SVC_RAMPINGCURVE_EXP
  8358. * - #ASM_PARAM_SVC_RAMPINGCURVE_LOG
  8359. */
  8360. } __packed;
  8361. /* Structure for holding soft pause parameters. */
  8362. /* Payload of the #ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS
  8363. * parameters used by the Volume Control module.
  8364. */
  8365. struct asm_soft_pause_params {
  8366. uint32_t enable_flag;
  8367. /*< Specifies whether soft pause is disabled (0) or enabled
  8368. * (nonzero).
  8369. */
  8370. uint32_t period;
  8371. /*< Period in milliseconds.
  8372. * Supported values: 0 to 15000
  8373. */
  8374. uint32_t step;
  8375. /*< Step in microseconds.
  8376. * Supported values: 0 to 15000000
  8377. */
  8378. uint32_t ramping_curve;
  8379. /*< Ramping curve.
  8380. * Supported values:
  8381. * - #ASM_PARAM_SVC_RAMPINGCURVE_LINEAR
  8382. * - #ASM_PARAM_SVC_RAMPINGCURVE_EXP
  8383. * - #ASM_PARAM_SVC_RAMPINGCURVE_LOG
  8384. */
  8385. } __packed;
  8386. /* Maximum number of channels.*/
  8387. #define VOLUME_CONTROL_MAX_CHANNELS 8
  8388. /* Structure for holding one channel type - gain pair. */
  8389. /* Payload of the #ASM_PARAM_ID_MULTICHANNEL_GAIN channel
  8390. * type/gain pairs used by the Volume Control module. \n \n This
  8391. * structure immediately follows the
  8392. * asm_volume_ctrl_multichannel_gain structure.
  8393. */
  8394. struct asm_volume_ctrl_channeltype_gain_pair {
  8395. uint8_t channeltype;
  8396. /*
  8397. * Channel type for which the gain setting is to be applied.
  8398. * Supported values:
  8399. * - #PCM_CHANNEL_L
  8400. * - #PCM_CHANNEL_R
  8401. * - #PCM_CHANNEL_C
  8402. * - #PCM_CHANNEL_LS
  8403. * - #PCM_CHANNEL_RS
  8404. * - #PCM_CHANNEL_LFE
  8405. * - #PCM_CHANNEL_CS
  8406. * - #PCM_CHANNEL_LB
  8407. * - #PCM_CHANNEL_RB
  8408. * - #PCM_CHANNEL_TS
  8409. * - #PCM_CHANNEL_CVH
  8410. * - #PCM_CHANNEL_MS
  8411. * - #PCM_CHANNEL_FLC
  8412. * - #PCM_CHANNEL_FRC
  8413. * - #PCM_CHANNEL_RLC
  8414. * - #PCM_CHANNEL_RRC
  8415. */
  8416. uint8_t reserved1;
  8417. /* Clients must set this field to zero. */
  8418. uint8_t reserved2;
  8419. /* Clients must set this field to zero. */
  8420. uint8_t reserved3;
  8421. /* Clients must set this field to zero. */
  8422. uint32_t gain;
  8423. /*
  8424. * Gain value for this channel in Q28 format.
  8425. * Supported values: Any
  8426. */
  8427. } __packed;
  8428. /* Structure for the multichannel gain command */
  8429. /* Payload of the #ASM_PARAM_ID_MULTICHANNEL_GAIN
  8430. * parameters used by the Volume Control module.
  8431. */
  8432. struct asm_volume_ctrl_multichannel_gain {
  8433. uint32_t num_channels;
  8434. /*
  8435. * Number of channels for which gain values are provided. Any
  8436. * channels present in the data for which gain is not provided are
  8437. * set to unity gain.
  8438. * Supported values: 1 to 8
  8439. */
  8440. struct asm_volume_ctrl_channeltype_gain_pair
  8441. gain_data[VOLUME_CONTROL_MAX_CHANNELS];
  8442. /* Array of channel type/gain pairs.*/
  8443. } __packed;
  8444. /* Structure for holding one channel type - mute pair. */
  8445. /* Payload of the #ASM_PARAM_ID_MULTICHANNEL_MUTE channel
  8446. * type/mute setting pairs used by the Volume Control module. \n \n
  8447. * This structure immediately follows the
  8448. * asm_volume_ctrl_multichannel_mute structure.
  8449. */
  8450. struct asm_volume_ctrl_channelype_mute_pair {
  8451. uint8_t channelype;
  8452. /*< Channel type for which the mute setting is to be applied.
  8453. * Supported values:
  8454. * - #PCM_CHANNEL_L
  8455. * - #PCM_CHANNEL_R
  8456. * - #PCM_CHANNEL_C
  8457. * - #PCM_CHANNEL_LS
  8458. * - #PCM_CHANNEL_RS
  8459. * - #PCM_CHANNEL_LFE
  8460. * - #PCM_CHANNEL_CS
  8461. * - #PCM_CHANNEL_LB
  8462. * - #PCM_CHANNEL_RB
  8463. * - #PCM_CHANNEL_TS
  8464. * - #PCM_CHANNEL_CVH
  8465. * - #PCM_CHANNEL_MS
  8466. * - #PCM_CHANNEL_FLC
  8467. * - #PCM_CHANNEL_FRC
  8468. * - #PCM_CHANNEL_RLC
  8469. * - #PCM_CHANNEL_RRC
  8470. */
  8471. uint8_t reserved1;
  8472. /*< Clients must set this field to zero. */
  8473. uint8_t reserved2;
  8474. /*< Clients must set this field to zero. */
  8475. uint8_t reserved3;
  8476. /*< Clients must set this field to zero. */
  8477. uint32_t mute;
  8478. /*< Mute setting for this channel.
  8479. * Supported values:
  8480. * - 0 = Unmute
  8481. * - Nonzero = Mute
  8482. */
  8483. } __packed;
  8484. /* Structure for the multichannel mute command */
  8485. /* @brief Payload of the #ASM_PARAM_ID_MULTICHANNEL_MUTE
  8486. * parameters used by the Volume Control module.
  8487. */
  8488. struct asm_volume_ctrl_multichannel_mute {
  8489. uint32_t num_channels;
  8490. /*< Number of channels for which mute configuration is
  8491. * provided. Any channels present in the data for which mute
  8492. * configuration is not provided are set to unmute.
  8493. * Supported values: 1 to 8
  8494. */
  8495. struct asm_volume_ctrl_channelype_mute_pair
  8496. mute_data[VOLUME_CONTROL_MAX_CHANNELS];
  8497. /*< Array of channel type/mute setting pairs.*/
  8498. } __packed;
  8499. /* end_addtogroup audio_pp_param_ids */
  8500. /* audio_pp_module_ids
  8501. * ID of the IIR Tuning Filter module.
  8502. * This module supports the following parameter IDs:
  8503. * - #ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG
  8504. * - #ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN
  8505. * - #ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS
  8506. */
  8507. #define ASM_MODULE_ID_IIRUNING_FILTER 0x00010C02
  8508. /* @addtogroup audio_pp_param_ids */
  8509. /* ID of the IIR tuning filter enable parameter used by the
  8510. * #ASM_MODULE_ID_IIRUNING_FILTER module.
  8511. * @messagepayload
  8512. * @structure{asm_iiruning_filter_enable}
  8513. * @tablespace
  8514. * @inputtable{Audio_Postproc_ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CO
  8515. * NFIG.tex}
  8516. */
  8517. #define ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG 0x00010C03
  8518. /* ID of the IIR tuning filter pregain parameter used by the
  8519. * #ASM_MODULE_ID_IIRUNING_FILTER module.
  8520. */
  8521. #define ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN 0x00010C04
  8522. /* ID of the IIR tuning filter configuration parameters used by the
  8523. * #ASM_MODULE_ID_IIRUNING_FILTER module.
  8524. */
  8525. #define ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS 0x00010C05
  8526. /* Structure for an enable configuration parameter for an
  8527. * IIR tuning filter module.
  8528. */
  8529. /* @brief Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG
  8530. * parameter used by the IIR Tuning Filter module.
  8531. */
  8532. struct asm_iiruning_filter_enable {
  8533. uint32_t enable_flag;
  8534. /*< Specifies whether the IIR tuning filter is disabled (0) or
  8535. * enabled (1).
  8536. */
  8537. } __packed;
  8538. /* Structure for the pregain parameter for an IIR tuning filter module. */
  8539. /* Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN
  8540. * parameters used by the IIR Tuning Filter module.
  8541. */
  8542. struct asm_iiruning_filter_pregain {
  8543. uint16_t pregain;
  8544. /*< Linear gain in Q13 format. */
  8545. uint16_t reserved;
  8546. /*< Clients must set this field to zero.*/
  8547. } __packed;
  8548. /* Structure for the configuration parameter for an IIR tuning filter
  8549. * module.
  8550. */
  8551. /* @brief Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS
  8552. * parameters used by the IIR Tuning Filter module. \n
  8553. * \n
  8554. * This structure is followed by the IIR filter coefficients: \n
  8555. * - Sequence of int32_t FilterCoeffs \n
  8556. * Five coefficients for each band. Each coefficient is in int32_t format, in
  8557. * the order of b0, b1, b2, a1, a2.
  8558. * - Sequence of int16_t NumShiftFactor \n
  8559. * One int16_t per band. The numerator shift factor is related to the Q
  8560. * factor of the filter coefficients.
  8561. * - Sequence of uint16_t PanSetting \n
  8562. * One uint16_t per band, indicating if the filter is applied to left (0),
  8563. * right (1), or both (2) channels.
  8564. */
  8565. struct asm_iir_filter_config_params {
  8566. uint16_t num_biquad_stages;
  8567. /*< Number of bands.
  8568. * Supported values: 0 to 20
  8569. */
  8570. uint16_t reserved;
  8571. /*< Clients must set this field to zero.*/
  8572. } __packed;
  8573. /* audio_pp_module_ids
  8574. * ID of the Multiband Dynamic Range Control (MBDRC) module on the Tx/Rx
  8575. * paths.
  8576. * This module supports the following parameter IDs:
  8577. * - #ASM_PARAM_ID_MBDRC_ENABLE
  8578. * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
  8579. */
  8580. #define ASM_MODULE_ID_MBDRC 0x00010C06
  8581. /* audio_pp_param_ids */
  8582. /* ID of the MBDRC enable parameter used by the #ASM_MODULE_ID_MBDRC module.
  8583. * @messagepayload
  8584. * @structure{asm_mbdrc_enable}
  8585. * @tablespace
  8586. * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_ENABLE.tex}
  8587. */
  8588. #define ASM_PARAM_ID_MBDRC_ENABLE 0x00010C07
  8589. /* ID of the MBDRC configuration parameters used by the
  8590. * #ASM_MODULE_ID_MBDRC module.
  8591. * @messagepayload
  8592. * @structure{asm_mbdrc_config_params}
  8593. * @tablespace
  8594. * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_CONFIG_PARAMS.tex}
  8595. *
  8596. * @parspace Sub-band DRC configuration parameters
  8597. * @structure{asm_subband_drc_config_params}
  8598. * @tablespace
  8599. * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_subband_DRC.tex}
  8600. *
  8601. * @keep{6}
  8602. * To obtain legacy ADRC from MBDRC, use the calibration tool to:
  8603. *
  8604. * - Enable MBDRC (EnableFlag = TRUE)
  8605. * - Set number of bands to 1 (uiNumBands = 1)
  8606. * - Enable the first MBDRC band (DrcMode[0] = DRC_ENABLED = 1)
  8607. * - Clear the first band mute flag (MuteFlag[0] = 0)
  8608. * - Set the first band makeup gain to unity (compMakeUpGain[0] = 0x2000)
  8609. * - Use the legacy ADRC parameters to calibrate the rest of the MBDRC
  8610. * parameters.
  8611. */
  8612. #define ASM_PARAM_ID_MBDRC_CONFIG_PARAMS 0x00010C08
  8613. /* end_addtogroup audio_pp_param_ids */
  8614. /* audio_pp_module_ids
  8615. * ID of the MMBDRC module version 2 pre/postprocessing block.
  8616. * This module differs from the original MBDRC (#ASM_MODULE_ID_MBDRC) in
  8617. * the length of the filters used in each sub-band.
  8618. * This module supports the following parameter ID:
  8619. * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_IMPROVED_FILTBANK_V2
  8620. */
  8621. #define ASM_MODULE_ID_MBDRCV2 0x0001070B
  8622. /* @addtogroup audio_pp_param_ids */
  8623. /* ID of the configuration parameters used by the
  8624. * #ASM_MODULE_ID_MBDRCV2 module for the improved filter structure
  8625. * of the MBDRC v2 pre/postprocessing block.
  8626. * The update to this configuration structure from the original
  8627. * MBDRC is the number of filter coefficients in the filter
  8628. * structure. The sequence for is as follows:
  8629. * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
  8630. * - 2 bands = 141 FIR coefficients + 2 mute flags + uint16_t padding
  8631. * - 3 bands = 141+81 FIR coefficients + 3 mute flags + uint16_t padding
  8632. * - 4 bands = 141+81+61 FIR coefficients + 4 mute flags + uint16_t
  8633. * padding
  8634. * - 5 bands = 141+81+61+61 FIR coefficients + 5 mute flags +
  8635. * uint16_t padding
  8636. * This block uses the same parameter structure as
  8637. * #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS.
  8638. */
  8639. #define ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_IMPROVED_FILTBANK_V2 \
  8640. 0x0001070C
  8641. #define ASM_MODULE_ID_MBDRCV3 0x0001090B
  8642. /*
  8643. * ID of the MMBDRC module version 3 pre/postprocessing block.
  8644. * This module differs from MBDRCv2 (#ASM_MODULE_ID_MBDRCV2) in
  8645. * that it supports both 16- and 24-bit data.
  8646. * This module supports the following parameter ID:
  8647. * - #ASM_PARAM_ID_MBDRC_ENABLE
  8648. * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
  8649. * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_V3
  8650. * - #ASM_PARAM_ID_MBDRC_FILTER_XOVER_FREQS
  8651. */
  8652. /* Structure for the enable parameter for an MBDRC module. */
  8653. /* Payload of the #ASM_PARAM_ID_MBDRC_ENABLE parameter used by the
  8654. * MBDRC module.
  8655. */
  8656. struct asm_mbdrc_enable {
  8657. uint32_t enable_flag;
  8658. /*< Specifies whether MBDRC is disabled (0) or enabled (nonzero).*/
  8659. } __packed;
  8660. /* Structure for the configuration parameters for an MBDRC module. */
  8661. /* Payload of the #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
  8662. * parameters used by the MBDRC module. \n \n Following this
  8663. * structure is the payload for sub-band DRC configuration
  8664. * parameters (asm_subband_drc_config_params). This sub-band
  8665. * structure must be repeated for each band.
  8666. */
  8667. struct asm_mbdrc_config_params {
  8668. uint16_t num_bands;
  8669. /*< Number of bands.
  8670. * Supported values: 1 to 5
  8671. */
  8672. int16_t limiterhreshold;
  8673. /*< Threshold in decibels for the limiter output.
  8674. * Supported values: -72 to 18 \n
  8675. * Recommended value: 3994 (-0.22 db in Q3.12 format)
  8676. */
  8677. int16_t limiter_makeup_gain;
  8678. /*< Makeup gain in decibels for the limiter output.
  8679. * Supported values: -42 to 42 \n
  8680. * Recommended value: 256 (0 dB in Q7.8 format)
  8681. */
  8682. int16_t limiter_gc;
  8683. /*< Limiter gain recovery coefficient.
  8684. * Supported values: 0.5 to 0.99 \n
  8685. * Recommended value: 32440 (0.99 in Q15 format)
  8686. */
  8687. int16_t limiter_delay;
  8688. /*< Limiter delay in samples.
  8689. * Supported values: 0 to 10 \n
  8690. * Recommended value: 262 (0.008 samples in Q15 format)
  8691. */
  8692. int16_t limiter_max_wait;
  8693. /*< Maximum limiter waiting time in samples.
  8694. * Supported values: 0 to 10 \n
  8695. * Recommended value: 262 (0.008 samples in Q15 format)
  8696. */
  8697. } __packed;
  8698. /* DRC configuration structure for each sub-band of an MBDRC module. */
  8699. /* Payload of the #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS DRC
  8700. * configuration parameters for each sub-band in the MBDRC module.
  8701. * After this DRC structure is configured for valid bands, the next
  8702. * MBDRC setparams expects the sequence of sub-band MBDRC filter
  8703. * coefficients (the length depends on the number of bands) plus the
  8704. * mute flag for that band plus uint16_t padding.
  8705. *
  8706. * @keep{10}
  8707. * The filter coefficient and mute flag are of type int16_t:
  8708. * - FIR coefficient = int16_t firFilter
  8709. * - Mute flag = int16_t fMuteFlag
  8710. *
  8711. * The sequence is as follows:
  8712. * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
  8713. * - 2 bands = 97 FIR coefficients + 2 mute flags + uint16_t padding
  8714. * - 3 bands = 97+33 FIR coefficients + 3 mute flags + uint16_t padding
  8715. * - 4 bands = 97+33+33 FIR coefficients + 4 mute flags + uint16_t padding
  8716. * - 5 bands = 97+33+33+33 FIR coefficients + 5 mute flags + uint16_t padding
  8717. *
  8718. * For improved filterbank, the sequence is as follows:
  8719. * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
  8720. * - 2 bands = 141 FIR coefficients + 2 mute flags + uint16_t padding
  8721. * - 3 bands = 141+81 FIR coefficients + 3 mute flags + uint16_t padding
  8722. * - 4 bands = 141+81+61 FIR coefficients + 4 mute flags + uint16_t padding
  8723. * - 5 bands = 141+81+61+61 FIR coefficients + 5 mute flags + uint16_t padding
  8724. */
  8725. struct asm_subband_drc_config_params {
  8726. int16_t drc_stereo_linked_flag;
  8727. /*< Specifies whether all stereo channels have the same applied
  8728. * dynamics (1) or if they process their dynamics independently (0).
  8729. * Supported values:
  8730. * - 0 -- Not linked
  8731. * - 1 -- Linked
  8732. */
  8733. int16_t drc_mode;
  8734. /*< Specifies whether DRC mode is bypassed for sub-bands.
  8735. * Supported values:
  8736. * - 0 -- Disabled
  8737. * - 1 -- Enabled
  8738. */
  8739. int16_t drc_down_sample_level;
  8740. /*< DRC down sample level.
  8741. * Supported values: @ge 1
  8742. */
  8743. int16_t drc_delay;
  8744. /*< DRC delay in samples.
  8745. * Supported values: 0 to 1200
  8746. */
  8747. uint16_t drc_rmsime_avg_const;
  8748. /*< RMS signal energy time-averaging constant.
  8749. * Supported values: 0 to 2^16-1
  8750. */
  8751. uint16_t drc_makeup_gain;
  8752. /*< DRC makeup gain in decibels.
  8753. * Supported values: 258 to 64917
  8754. */
  8755. /* Down expander settings */
  8756. int16_t down_expdrhreshold;
  8757. /*< Down expander threshold.
  8758. * Supported Q7 format values: 1320 to up_cmpsrhreshold
  8759. */
  8760. int16_t down_expdr_slope;
  8761. /*< Down expander slope.
  8762. * Supported Q8 format values: -32768 to 0.
  8763. */
  8764. uint32_t down_expdr_attack;
  8765. /*< Down expander attack constant.
  8766. * Supported Q31 format values: 196844 to 2^31.
  8767. */
  8768. uint32_t down_expdr_release;
  8769. /*< Down expander release constant.
  8770. * Supported Q31 format values: 19685 to 2^31
  8771. */
  8772. uint16_t down_expdr_hysteresis;
  8773. /*< Down expander hysteresis constant.
  8774. * Supported Q14 format values: 1 to 32690
  8775. */
  8776. uint16_t reserved;
  8777. /*< Clients must set this field to zero. */
  8778. int32_t down_expdr_min_gain_db;
  8779. /*< Down expander minimum gain.
  8780. * Supported Q23 format values: -805306368 to 0.
  8781. */
  8782. /* Up compressor settings */
  8783. int16_t up_cmpsrhreshold;
  8784. /*< Up compressor threshold.
  8785. * Supported Q7 format values: down_expdrhreshold to
  8786. * down_cmpsrhreshold.
  8787. */
  8788. uint16_t up_cmpsr_slope;
  8789. /*< Up compressor slope.
  8790. * Supported Q16 format values: 0 to 64881.
  8791. */
  8792. uint32_t up_cmpsr_attack;
  8793. /*< Up compressor attack constant.
  8794. * Supported Q31 format values: 196844 to 2^31.
  8795. */
  8796. uint32_t up_cmpsr_release;
  8797. /*< Up compressor release constant.
  8798. * Supported Q31 format values: 19685 to 2^31.
  8799. */
  8800. uint16_t up_cmpsr_hysteresis;
  8801. /*< Up compressor hysteresis constant.
  8802. * Supported Q14 format values: 1 to 32690.
  8803. */
  8804. /* Down compressor settings */
  8805. int16_t down_cmpsrhreshold;
  8806. /*< Down compressor threshold.
  8807. * Supported Q7 format values: up_cmpsrhreshold to 11560.
  8808. */
  8809. uint16_t down_cmpsr_slope;
  8810. /*< Down compressor slope.
  8811. * Supported Q16 format values: 0 to 64881.
  8812. */
  8813. uint16_t reserved1;
  8814. /*< Clients must set this field to zero. */
  8815. uint32_t down_cmpsr_attack;
  8816. /*< Down compressor attack constant.
  8817. * Supported Q31 format values: 196844 to 2^31.
  8818. */
  8819. uint32_t down_cmpsr_release;
  8820. /*< Down compressor release constant.
  8821. * Supported Q31 format values: 19685 to 2^31.
  8822. */
  8823. uint16_t down_cmpsr_hysteresis;
  8824. /*< Down compressor hysteresis constant.
  8825. * Supported Q14 values: 1 to 32690.
  8826. */
  8827. uint16_t reserved2;
  8828. /*< Clients must set this field to zero.*/
  8829. } __packed;
  8830. #define ASM_MODULE_ID_EQUALIZER 0x00010C27
  8831. #define ASM_PARAM_ID_EQUALIZER_PARAMETERS 0x00010C28
  8832. #define ASM_MAX_EQ_BANDS 12
  8833. struct asm_eq_per_band_params {
  8834. uint32_t band_idx;
  8835. /*< Band index.
  8836. * Supported values: 0 to 11
  8837. */
  8838. uint32_t filterype;
  8839. /*< Type of filter.
  8840. * Supported values:
  8841. * - #ASM_PARAM_EQYPE_NONE
  8842. * - #ASM_PARAM_EQ_BASS_BOOST
  8843. * - #ASM_PARAM_EQ_BASS_CUT
  8844. * - #ASM_PARAM_EQREBLE_BOOST
  8845. * - #ASM_PARAM_EQREBLE_CUT
  8846. * - #ASM_PARAM_EQ_BAND_BOOST
  8847. * - #ASM_PARAM_EQ_BAND_CUT
  8848. */
  8849. uint32_t center_freq_hz;
  8850. /*< Filter band center frequency in Hertz. */
  8851. int32_t filter_gain;
  8852. /*< Filter band initial gain.
  8853. * Supported values: +12 to -12 dB in 1 dB increments
  8854. */
  8855. int32_t q_factor;
  8856. /*< Filter band quality factor expressed as a Q8 number, i.e., a
  8857. * fixed-point number with q factor of 8. For example, 3000/(2^8).
  8858. */
  8859. } __packed;
  8860. struct asm_eq_params {
  8861. uint32_t enable_flag;
  8862. /*< Specifies whether the equalizer module is disabled (0) or enabled
  8863. * (nonzero).
  8864. */
  8865. uint32_t num_bands;
  8866. /*< Number of bands.
  8867. * Supported values: 1 to 12
  8868. */
  8869. struct asm_eq_per_band_params eq_bands[ASM_MAX_EQ_BANDS];
  8870. } __packed;
  8871. /* No equalizer effect.*/
  8872. #define ASM_PARAM_EQYPE_NONE 0
  8873. /* Bass boost equalizer effect.*/
  8874. #define ASM_PARAM_EQ_BASS_BOOST 1
  8875. /*Bass cut equalizer effect.*/
  8876. #define ASM_PARAM_EQ_BASS_CUT 2
  8877. /* Treble boost equalizer effect */
  8878. #define ASM_PARAM_EQREBLE_BOOST 3
  8879. /* Treble cut equalizer effect.*/
  8880. #define ASM_PARAM_EQREBLE_CUT 4
  8881. /* Band boost equalizer effect.*/
  8882. #define ASM_PARAM_EQ_BAND_BOOST 5
  8883. /* Band cut equalizer effect.*/
  8884. #define ASM_PARAM_EQ_BAND_CUT 6
  8885. /* Get & set params */
  8886. #define VSS_ICOMMON_CMD_SET_PARAM_V2 0x0001133D
  8887. #define VSS_ICOMMON_CMD_GET_PARAM_V2 0x0001133E
  8888. #define VSS_ICOMMON_RSP_GET_PARAM 0x00011008
  8889. #define VSS_ICOMMON_CMD_SET_PARAM_V3 0x00013245
  8890. #define VSS_ICOMMON_CMD_GET_PARAM_V3 0x00013246
  8891. #define VSS_ICOMMON_RSP_GET_PARAM_V3 0x00013247
  8892. #define VSS_MAX_AVCS_NUM_SERVICES 25
  8893. /* ID of the Bass Boost module.
  8894. * This module supports the following parameter IDs:
  8895. * - #AUDPROC_PARAM_ID_BASS_BOOST_ENABLE
  8896. * - #AUDPROC_PARAM_ID_BASS_BOOST_MODE
  8897. * - #AUDPROC_PARAM_ID_BASS_BOOST_STRENGTH
  8898. */
  8899. #define AUDPROC_MODULE_ID_BASS_BOOST 0x000108A1
  8900. /* ID of the Bass Boost enable parameter used by
  8901. * AUDPROC_MODULE_ID_BASS_BOOST.
  8902. */
  8903. #define AUDPROC_PARAM_ID_BASS_BOOST_ENABLE 0x000108A2
  8904. /* ID of the Bass Boost mode parameter used by
  8905. * AUDPROC_MODULE_ID_BASS_BOOST.
  8906. */
  8907. #define AUDPROC_PARAM_ID_BASS_BOOST_MODE 0x000108A3
  8908. /* ID of the Bass Boost strength parameter used by
  8909. * AUDPROC_MODULE_ID_BASS_BOOST.
  8910. */
  8911. #define AUDPROC_PARAM_ID_BASS_BOOST_STRENGTH 0x000108A4
  8912. /* ID of the PBE module.
  8913. * This module supports the following parameter IDs:
  8914. * - #AUDPROC_PARAM_ID_PBE_ENABLE
  8915. * - #AUDPROC_PARAM_ID_PBE_PARAM_CONFIG
  8916. */
  8917. #define AUDPROC_MODULE_ID_PBE 0x00010C2A
  8918. /* ID of the Bass Boost enable parameter used by
  8919. * AUDPROC_MODULE_ID_BASS_BOOST.
  8920. */
  8921. #define AUDPROC_PARAM_ID_PBE_ENABLE 0x00010C2B
  8922. /* ID of the Bass Boost mode parameter used by
  8923. * AUDPROC_MODULE_ID_BASS_BOOST.
  8924. */
  8925. #define AUDPROC_PARAM_ID_PBE_PARAM_CONFIG 0x00010C49
  8926. /* ID of the Virtualizer module. This module supports the
  8927. * following parameter IDs:
  8928. * - #AUDPROC_PARAM_ID_VIRTUALIZER_ENABLE
  8929. * - #AUDPROC_PARAM_ID_VIRTUALIZER_STRENGTH
  8930. * - #AUDPROC_PARAM_ID_VIRTUALIZER_OUT_TYPE
  8931. * - #AUDPROC_PARAM_ID_VIRTUALIZER_GAIN_ADJUST
  8932. */
  8933. #define AUDPROC_MODULE_ID_VIRTUALIZER 0x000108A5
  8934. /* ID of the Virtualizer enable parameter used by
  8935. * AUDPROC_MODULE_ID_VIRTUALIZER.
  8936. */
  8937. #define AUDPROC_PARAM_ID_VIRTUALIZER_ENABLE 0x000108A6
  8938. /* ID of the Virtualizer strength parameter used by
  8939. * AUDPROC_MODULE_ID_VIRTUALIZER.
  8940. */
  8941. #define AUDPROC_PARAM_ID_VIRTUALIZER_STRENGTH 0x000108A7
  8942. /* ID of the Virtualizer out type parameter used by
  8943. * AUDPROC_MODULE_ID_VIRTUALIZER.
  8944. */
  8945. #define AUDPROC_PARAM_ID_VIRTUALIZER_OUT_TYPE 0x000108A8
  8946. /* ID of the Virtualizer out type parameter used by
  8947. * AUDPROC_MODULE_ID_VIRTUALIZER.
  8948. */
  8949. #define AUDPROC_PARAM_ID_VIRTUALIZER_GAIN_ADJUST 0x000108A9
  8950. /* ID of the Reverb module. This module supports the following
  8951. * parameter IDs:
  8952. * - #AUDPROC_PARAM_ID_REVERB_ENABLE
  8953. * - #AUDPROC_PARAM_ID_REVERB_MODE
  8954. * - #AUDPROC_PARAM_ID_REVERB_PRESET
  8955. * - #AUDPROC_PARAM_ID_REVERB_WET_MIX
  8956. * - #AUDPROC_PARAM_ID_REVERB_GAIN_ADJUST
  8957. * - #AUDPROC_PARAM_ID_REVERB_ROOM_LEVEL
  8958. * - #AUDPROC_PARAM_ID_REVERB_ROOM_HF_LEVEL
  8959. * - #AUDPROC_PARAM_ID_REVERB_DECAY_TIME
  8960. * - #AUDPROC_PARAM_ID_REVERB_DECAY_HF_RATIO
  8961. * - #AUDPROC_PARAM_ID_REVERB_REFLECTIONS_LEVEL
  8962. * - #AUDPROC_PARAM_ID_REVERB_REFLECTIONS_DELAY
  8963. * - #AUDPROC_PARAM_ID_REVERB_LEVEL
  8964. * - #AUDPROC_PARAM_ID_REVERB_DELAY
  8965. * - #AUDPROC_PARAM_ID_REVERB_DIFFUSION
  8966. * - #AUDPROC_PARAM_ID_REVERB_DENSITY
  8967. */
  8968. #define AUDPROC_MODULE_ID_REVERB 0x000108AA
  8969. /* ID of the Reverb enable parameter used by
  8970. * AUDPROC_MODULE_ID_REVERB.
  8971. */
  8972. #define AUDPROC_PARAM_ID_REVERB_ENABLE 0x000108AB
  8973. /* ID of the Reverb mode parameter used by
  8974. * AUDPROC_MODULE_ID_REVERB.
  8975. */
  8976. #define AUDPROC_PARAM_ID_REVERB_MODE 0x000108AC
  8977. /* ID of the Reverb preset parameter used by
  8978. * AUDPROC_MODULE_ID_REVERB.
  8979. */
  8980. #define AUDPROC_PARAM_ID_REVERB_PRESET 0x000108AD
  8981. /* ID of the Reverb wet mix parameter used by
  8982. * AUDPROC_MODULE_ID_REVERB.
  8983. */
  8984. #define AUDPROC_PARAM_ID_REVERB_WET_MIX 0x000108AE
  8985. /* ID of the Reverb gain adjust parameter used by
  8986. * AUDPROC_MODULE_ID_REVERB.
  8987. */
  8988. #define AUDPROC_PARAM_ID_REVERB_GAIN_ADJUST 0x000108AF
  8989. /* ID of the Reverb room level parameter used by
  8990. * AUDPROC_MODULE_ID_REVERB.
  8991. */
  8992. #define AUDPROC_PARAM_ID_REVERB_ROOM_LEVEL 0x000108B0
  8993. /* ID of the Reverb room hf level parameter used by
  8994. * AUDPROC_MODULE_ID_REVERB.
  8995. */
  8996. #define AUDPROC_PARAM_ID_REVERB_ROOM_HF_LEVEL 0x000108B1
  8997. /* ID of the Reverb decay time parameter used by
  8998. * AUDPROC_MODULE_ID_REVERB.
  8999. */
  9000. #define AUDPROC_PARAM_ID_REVERB_DECAY_TIME 0x000108B2
  9001. /* ID of the Reverb decay hf ratio parameter used by
  9002. * AUDPROC_MODULE_ID_REVERB.
  9003. */
  9004. #define AUDPROC_PARAM_ID_REVERB_DECAY_HF_RATIO 0x000108B3
  9005. /* ID of the Reverb reflections level parameter used by
  9006. * AUDPROC_MODULE_ID_REVERB.
  9007. */
  9008. #define AUDPROC_PARAM_ID_REVERB_REFLECTIONS_LEVEL 0x000108B4
  9009. /* ID of the Reverb reflections delay parameter used by
  9010. * AUDPROC_MODULE_ID_REVERB.
  9011. */
  9012. #define AUDPROC_PARAM_ID_REVERB_REFLECTIONS_DELAY 0x000108B5
  9013. /* ID of the Reverb level parameter used by
  9014. * AUDPROC_MODULE_ID_REVERB.
  9015. */
  9016. #define AUDPROC_PARAM_ID_REVERB_LEVEL 0x000108B6
  9017. /* ID of the Reverb delay parameter used by
  9018. * AUDPROC_MODULE_ID_REVERB.
  9019. */
  9020. #define AUDPROC_PARAM_ID_REVERB_DELAY 0x000108B7
  9021. /* ID of the Reverb diffusion parameter used by
  9022. * AUDPROC_MODULE_ID_REVERB.
  9023. */
  9024. #define AUDPROC_PARAM_ID_REVERB_DIFFUSION 0x000108B8
  9025. /* ID of the Reverb density parameter used by
  9026. * AUDPROC_MODULE_ID_REVERB.
  9027. */
  9028. #define AUDPROC_PARAM_ID_REVERB_DENSITY 0x000108B9
  9029. /* ID of the Popless Equalizer module. This module supports the
  9030. * following parameter IDs:
  9031. * - #AUDPROC_PARAM_ID_EQ_ENABLE
  9032. * - #AUDPROC_PARAM_ID_EQ_CONFIG
  9033. * - #AUDPROC_PARAM_ID_EQ_NUM_BANDS
  9034. * - #AUDPROC_PARAM_ID_EQ_BAND_LEVELS
  9035. * - #AUDPROC_PARAM_ID_EQ_BAND_LEVEL_RANGE
  9036. * - #AUDPROC_PARAM_ID_EQ_BAND_FREQS
  9037. * - #AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ_RANGE
  9038. * - #AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ
  9039. * - #AUDPROC_PARAM_ID_EQ_BAND_INDEX
  9040. * - #AUDPROC_PARAM_ID_EQ_PRESET_ID
  9041. * - #AUDPROC_PARAM_ID_EQ_NUM_PRESETS
  9042. * - #AUDPROC_PARAM_ID_EQ_GET_PRESET_NAME
  9043. */
  9044. #define AUDPROC_MODULE_ID_POPLESS_EQUALIZER 0x000108BA
  9045. /* ID of the Popless Equalizer enable parameter used by
  9046. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
  9047. */
  9048. #define AUDPROC_PARAM_ID_EQ_ENABLE 0x000108BB
  9049. /* ID of the Popless Equalizer config parameter used by
  9050. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
  9051. */
  9052. #define AUDPROC_PARAM_ID_EQ_CONFIG 0x000108BC
  9053. /* ID of the Popless Equalizer number of bands parameter used
  9054. * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
  9055. * used for get param only.
  9056. */
  9057. #define AUDPROC_PARAM_ID_EQ_NUM_BANDS 0x000108BD
  9058. /* ID of the Popless Equalizer band levels parameter used by
  9059. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
  9060. * used for get param only.
  9061. */
  9062. #define AUDPROC_PARAM_ID_EQ_BAND_LEVELS 0x000108BE
  9063. /* ID of the Popless Equalizer band level range parameter used
  9064. * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
  9065. * used for get param only.
  9066. */
  9067. #define AUDPROC_PARAM_ID_EQ_BAND_LEVEL_RANGE 0x000108BF
  9068. /* ID of the Popless Equalizer band frequencies parameter used
  9069. * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
  9070. * used for get param only.
  9071. */
  9072. #define AUDPROC_PARAM_ID_EQ_BAND_FREQS 0x000108C0
  9073. /* ID of the Popless Equalizer single band frequency range
  9074. * parameter used by AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
  9075. * This param ID is used for get param only.
  9076. */
  9077. #define AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ_RANGE 0x000108C1
  9078. /* ID of the Popless Equalizer single band frequency parameter
  9079. * used by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID
  9080. * is used for set param only.
  9081. */
  9082. #define AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ 0x000108C2
  9083. /* ID of the Popless Equalizer band index parameter used by
  9084. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
  9085. */
  9086. #define AUDPROC_PARAM_ID_EQ_BAND_INDEX 0x000108C3
  9087. /* ID of the Popless Equalizer preset id parameter used by
  9088. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
  9089. * for get param only.
  9090. */
  9091. #define AUDPROC_PARAM_ID_EQ_PRESET_ID 0x000108C4
  9092. /* ID of the Popless Equalizer number of presets parameter used
  9093. * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
  9094. * for get param only.
  9095. */
  9096. #define AUDPROC_PARAM_ID_EQ_NUM_PRESETS 0x000108C5
  9097. /* ID of the Popless Equalizer preset name parameter used by
  9098. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
  9099. * for get param only.
  9100. */
  9101. #define AUDPROC_PARAM_ID_EQ_PRESET_NAME 0x000108C6
  9102. /* Set Q6 topologies */
  9103. #define ASM_CMD_ADD_TOPOLOGIES 0x00010DBE
  9104. #define ADM_CMD_ADD_TOPOLOGIES 0x00010335
  9105. #define AFE_CMD_ADD_TOPOLOGIES 0x000100f8
  9106. /* structure used for both ioctls */
  9107. struct cmd_set_topologies {
  9108. struct apr_hdr hdr;
  9109. u32 payload_addr_lsw;
  9110. /* LSW of parameter data payload address.*/
  9111. u32 payload_addr_msw;
  9112. /* MSW of parameter data payload address.*/
  9113. u32 mem_map_handle;
  9114. /* Memory map handle returned by mem map command */
  9115. u32 payload_size;
  9116. /* Size in bytes of the variable payload in shared memory */
  9117. } __packed;
  9118. /* This module represents the Rx processing of Feedback speaker protection.
  9119. * It contains the excursion control, thermal protection,
  9120. * analog clip manager features in it.
  9121. * This module id will support following param ids.
  9122. * - AFE_PARAM_ID_FBSP_MODE_RX_CFG
  9123. */
  9124. #define AFE_MODULE_FB_SPKR_PROT_RX 0x0001021C
  9125. #define AFE_MODULE_FB_SPKR_PROT_V2_RX 0x0001025F
  9126. #define AFE_PARAM_ID_SP_RX_LIMITER_TH 0x000102B1
  9127. #define AFE_PARAM_ID_FBSP_MODE_RX_CFG 0x0001021D
  9128. #define AFE_PARAM_ID_FBSP_PTONE_RAMP_CFG 0x00010260
  9129. #define AFE_PARAM_ID_SP_RX_TMAX_XMAX_LOGGING 0x000102BC
  9130. #define AFE_PARAM_ID_CPS_LPASS_HW_INTF_CFG 0x000102EF
  9131. struct asm_fbsp_mode_rx_cfg {
  9132. uint32_t minor_version;
  9133. uint32_t mode;
  9134. } __packed;
  9135. /* This module represents the VI processing of feedback speaker protection.
  9136. * It will receive Vsens and Isens from codec and generates necessary
  9137. * parameters needed by Rx processing.
  9138. * This module id will support following param ids.
  9139. * - AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG
  9140. * - AFE_PARAM_ID_CALIB_RES_CFG
  9141. * - AFE_PARAM_ID_FEEDBACK_PATH_CFG
  9142. */
  9143. #define AFE_MODULE_FB_SPKR_PROT_VI_PROC 0x00010226
  9144. #define AFE_MODULE_FB_SPKR_PROT_VI_PROC_V2 0x0001026A
  9145. #define AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG 0x0001022A
  9146. #define AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG_V2 0x0001026B
  9147. struct asm_spkr_calib_vi_proc_cfg {
  9148. uint32_t minor_version;
  9149. uint32_t operation_mode;
  9150. uint32_t r0_t0_selection_flag[SP_V2_NUM_MAX_SPKR];
  9151. int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
  9152. int16_t t0_cali_q6[SP_V2_NUM_MAX_SPKR];
  9153. uint32_t quick_calib_flag;
  9154. } __packed;
  9155. #define AFE_PARAM_ID_CALIB_RES_CFG 0x0001022B
  9156. #define AFE_PARAM_ID_CALIB_RES_CFG_V2 0x0001026E
  9157. struct asm_calib_res_cfg {
  9158. uint32_t minor_version;
  9159. int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
  9160. uint32_t th_vi_ca_state;
  9161. } __packed;
  9162. #define AFE_PARAM_ID_FEEDBACK_PATH_CFG 0x0001022C
  9163. #define AFE_MODULE_FEEDBACK 0x00010257
  9164. struct asm_feedback_path_cfg {
  9165. uint32_t minor_version;
  9166. int32_t dst_portid;
  9167. int32_t num_channels;
  9168. int32_t chan_info[4];
  9169. } __packed;
  9170. #define AFE_PARAM_ID_MODE_VI_PROC_CFG 0x00010227
  9171. struct asm_mode_vi_proc_cfg {
  9172. uint32_t minor_version;
  9173. uint32_t cal_mode;
  9174. } __packed;
  9175. #define AFE_MODULE_SPEAKER_PROTECTION_V2_TH_VI 0x0001026A
  9176. #define AFE_PARAM_ID_SP_V2_TH_VI_MODE_CFG 0x0001026B
  9177. #define AFE_PARAM_ID_SP_V2_TH_VI_FTM_CFG 0x0001029F
  9178. #define AFE_PARAM_ID_SP_V2_TH_VI_FTM_PARAMS 0x000102A0
  9179. #define AFE_PARAM_ID_SP_V2_TH_VI_V_VALI_CFG 0x000102BF
  9180. #define AFE_PARAM_ID_SP_V2_TH_VI_V_VALI_PARAMS 0x000102C0
  9181. struct afe_sp_th_vi_mode_cfg {
  9182. uint32_t minor_version;
  9183. uint32_t operation_mode;
  9184. /*
  9185. * Operation mode of thermal VI module.
  9186. * 0 -- Normal Running mode
  9187. * 1 -- Calibration mode
  9188. * 2 -- FTM mode
  9189. */
  9190. uint32_t r0t0_selection_flag[SP_V2_NUM_MAX_SPKR];
  9191. /*
  9192. * Specifies which set of R0, T0 values the algorithm will use.
  9193. * This field is valid only in Normal mode (operation_mode = 0).
  9194. * 0 -- Use calibrated R0, T0 value
  9195. * 1 -- Use safe R0, T0 value
  9196. */
  9197. int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
  9198. /*
  9199. * Calibration point resistance per device. This field is valid
  9200. * only in Normal mode (operation_mode = 0).
  9201. * values 33554432 to 1073741824 Ohms (in Q24 format)
  9202. */
  9203. int16_t t0_cali_q6[SP_V2_NUM_MAX_SPKR];
  9204. /*
  9205. * Calibration point temperature per device. This field is valid
  9206. * in both Normal mode and Calibration mode.
  9207. * values -1920 to 5120 degrees C (in Q6 format)
  9208. */
  9209. uint32_t quick_calib_flag;
  9210. /*
  9211. * Indicates whether calibration is to be done in quick mode or not.
  9212. * This field is valid only in Calibration mode (operation_mode = 1).
  9213. * 0 -- Disabled
  9214. * 1 -- Enabled
  9215. */
  9216. } __packed;
  9217. struct afe_sp_th_vi_ftm_cfg {
  9218. uint32_t minor_version;
  9219. uint32_t wait_time_ms[SP_V2_NUM_MAX_SPKR];
  9220. /*
  9221. * Wait time to heat up speaker before collecting statistics
  9222. * for ftm mode in ms.
  9223. * values 0 to 4294967295 ms
  9224. */
  9225. uint32_t ftm_time_ms[SP_V2_NUM_MAX_SPKR];
  9226. /*
  9227. * duration for which FTM statistics are collected in ms.
  9228. * values 0 to 2000 ms
  9229. */
  9230. } __packed;
  9231. struct afe_sp_th_vi_ftm_params {
  9232. uint32_t minor_version;
  9233. int32_t dc_res_q24[SP_V2_NUM_MAX_SPKR];
  9234. /*
  9235. * DC resistance value in q24 format
  9236. * values 0 to 2147483647 Ohms (in Q24 format)
  9237. */
  9238. int32_t temp_q22[SP_V2_NUM_MAX_SPKR];
  9239. /*
  9240. * temperature value in q22 format
  9241. * values -125829120 to 2147483647 degC (in Q22 format)
  9242. */
  9243. uint32_t status[SP_V2_NUM_MAX_SPKR];
  9244. /*
  9245. * FTM packet status
  9246. * 0 - Incorrect operation mode.This status is returned
  9247. * when GET_PARAM is called in non FTM Mode
  9248. * 1 - Inactive mode -- Port is not yet started.
  9249. * 2 - Wait state. wait_time_ms has not yet elapsed
  9250. * 3 - In progress state. ftm_time_ms has not yet elapsed.
  9251. * 4 - Success.
  9252. * 5 - Failed.
  9253. */
  9254. } __packed;
  9255. struct afe_sp_th_vi_get_param {
  9256. struct param_hdr_v3 pdata;
  9257. struct afe_sp_th_vi_ftm_params param;
  9258. } __packed;
  9259. struct afe_sp_th_vi_get_param_resp {
  9260. uint32_t status;
  9261. struct param_hdr_v3 pdata;
  9262. struct afe_sp_th_vi_ftm_params param;
  9263. } __packed;
  9264. struct afe_sp_th_vi_v_vali_cfg {
  9265. uint32_t minor_version;
  9266. uint32_t wait_time_ms[SP_V2_NUM_MAX_SPKR];
  9267. /*
  9268. * Wait time to heat up speaker before collecting statistics
  9269. * for V validation mode in ms.
  9270. * values 100 to 1000 ms
  9271. */
  9272. uint32_t vali_time_ms[SP_V2_NUM_MAX_SPKR];
  9273. /*
  9274. * duration for which V VALIDATION statistics are collected in ms.
  9275. * values 1000 to 3000 ms
  9276. */
  9277. } __packed;
  9278. struct afe_sp_th_vi_v_vali_params {
  9279. uint32_t minor_version;
  9280. uint32_t vrms_q24[SP_V2_NUM_MAX_SPKR];
  9281. /*
  9282. * Vrms value in q24 format
  9283. * values [0 33554432] Q24 (0 - 2Vrms)
  9284. */
  9285. uint32_t status[SP_V2_NUM_MAX_SPKR];
  9286. /*
  9287. * v-vali packet status
  9288. * 0 - Failed.
  9289. * 1 - Success.
  9290. * 2 - Incorrect operation mode.This status is returned
  9291. * when GET_PARAM is called in non v-vali Mode
  9292. * 3 - Inactive mode -- Port is not yet started.
  9293. * 4 - Wait state. wait_time_ms has not yet elapsed
  9294. * 5 - In progress state. ftm_time_ms has not yet elapsed.
  9295. */
  9296. } __packed;
  9297. struct afe_sp_th_vi_v_vali_get_param {
  9298. struct param_hdr_v3 pdata;
  9299. struct afe_sp_th_vi_v_vali_params param;
  9300. } __packed;
  9301. struct afe_sp_th_vi_v_vali_get_param_resp {
  9302. uint32_t status;
  9303. struct param_hdr_v3 pdata;
  9304. struct afe_sp_th_vi_v_vali_params param;
  9305. } __packed;
  9306. #define AFE_MODULE_SPEAKER_PROTECTION_V2_EX_VI 0x0001026F
  9307. #define AFE_PARAM_ID_SP_V2_EX_VI_MODE_CFG 0x000102A1
  9308. #define AFE_PARAM_ID_SP_V2_EX_VI_FTM_CFG 0x000102A2
  9309. #define AFE_PARAM_ID_SP_V2_EX_VI_FTM_PARAMS 0x000102A3
  9310. struct afe_sp_ex_vi_mode_cfg {
  9311. uint32_t minor_version;
  9312. uint32_t operation_mode;
  9313. /*
  9314. * Operation mode of Excursion VI module.
  9315. * 0 - Normal Running mode
  9316. * 2 - FTM mode
  9317. */
  9318. } __packed;
  9319. struct afe_sp_ex_vi_ftm_cfg {
  9320. uint32_t minor_version;
  9321. uint32_t wait_time_ms[SP_V2_NUM_MAX_SPKR];
  9322. /*
  9323. * Wait time to heat up speaker before collecting statistics
  9324. * for ftm mode in ms.
  9325. * values 0 to 4294967295 ms
  9326. */
  9327. uint32_t ftm_time_ms[SP_V2_NUM_MAX_SPKR];
  9328. /*
  9329. * duration for which FTM statistics are collected in ms.
  9330. * values 0 to 2000 ms
  9331. */
  9332. } __packed;
  9333. struct afe_sp_ex_vi_ftm_params {
  9334. uint32_t minor_version;
  9335. int32_t freq_q20[SP_V2_NUM_MAX_SPKR];
  9336. /*
  9337. * Resonance frequency in q20 format
  9338. * values 0 to 2147483647 Hz (in Q20 format)
  9339. */
  9340. int32_t resis_q24[SP_V2_NUM_MAX_SPKR];
  9341. /*
  9342. * Mechanical resistance in q24 format
  9343. * values 0 to 2147483647 Ohms (in Q24 format)
  9344. */
  9345. int32_t qmct_q24[SP_V2_NUM_MAX_SPKR];
  9346. /*
  9347. * Mechanical Qfactor in q24 format
  9348. * values 0 to 2147483647 (in Q24 format)
  9349. */
  9350. uint32_t status[SP_V2_NUM_MAX_SPKR];
  9351. /*
  9352. * FTM packet status
  9353. * 0 - Incorrect operation mode.This status is returned
  9354. * when GET_PARAM is called in non FTM Mode.
  9355. * 1 - Inactive mode -- Port is not yet started.
  9356. * 2 - Wait state. wait_time_ms has not yet elapsed
  9357. * 3 - In progress state. ftm_time_ms has not yet elapsed.
  9358. * 4 - Success.
  9359. * 5 - Failed.
  9360. */
  9361. } __packed;
  9362. struct afe_sp_rx_tmax_xmax_logging_param {
  9363. /*
  9364. * Maximum excursion since the last grasp of xmax in mm.
  9365. */
  9366. int32_t max_excursion[SP_V2_NUM_MAX_SPKR];
  9367. /*
  9368. * Number of periods when the monitored excursion exceeds to and
  9369. * stays at Xmax during logging_count_period.
  9370. */
  9371. uint32_t count_exceeded_excursion[SP_V2_NUM_MAX_SPKR];
  9372. /*
  9373. * Maximum temperature since the last grasp of tmax in C.
  9374. */
  9375. int32_t max_temperature[SP_V2_NUM_MAX_SPKR];
  9376. /*
  9377. * Number of periods when the monitored temperature exceeds to and
  9378. * stays at Tmax during logging_count_period
  9379. */
  9380. uint32_t count_exceeded_temperature[SP_V2_NUM_MAX_SPKR];
  9381. } __packed;
  9382. struct afe_sp_rx_tmax_xmax_logging_resp {
  9383. uint32_t status;
  9384. struct param_hdr_v3 pdata;
  9385. struct afe_sp_rx_tmax_xmax_logging_param param;
  9386. } __packed;
  9387. struct afe_sp_ex_vi_get_param {
  9388. struct param_hdr_v3 pdata;
  9389. struct afe_sp_ex_vi_ftm_params param;
  9390. } __packed;
  9391. struct afe_sp_ex_vi_get_param_resp {
  9392. uint32_t status;
  9393. struct param_hdr_v3 pdata;
  9394. struct afe_sp_ex_vi_ftm_params param;
  9395. } __packed;
  9396. struct afe_sp_rx_limiter_th_param {
  9397. uint32_t minor_version;
  9398. uint32_t lim_thr_per_calib_q27[SP_V2_NUM_MAX_SPKR];
  9399. } __packed;
  9400. struct afe_spkr_prot_get_vi_calib {
  9401. struct apr_hdr hdr;
  9402. struct mem_mapping_hdr mem_hdr;
  9403. struct param_hdr_v3 pdata;
  9404. struct asm_calib_res_cfg res_cfg;
  9405. } __packed;
  9406. struct afe_spkr_prot_calib_get_resp {
  9407. uint32_t status;
  9408. struct param_hdr_v3 pdata;
  9409. struct asm_calib_res_cfg res_cfg;
  9410. } __packed;
  9411. #define AFE_MODULE_SPEAKER_PROTECTION_V4_RX 0x000102C7
  9412. #define AFE_PARAM_ID_SP_V4_OP_MODE 0x000102C9
  9413. #define AFE_PARAM_ID_SP_V4_RX_TMAX_XMAX_LOGGING 0x000102D2
  9414. struct afe_sp_v4_param_op_mode {
  9415. uint32_t mode;
  9416. } __packed;
  9417. struct afe_sp_v4_channel_tmax_xmax_params {
  9418. /*
  9419. * Maximum excursion since the last grasp of xmax in mm.
  9420. */
  9421. int32_t max_excursion;
  9422. /*
  9423. * Number of periods when the monitored excursion exceeds to and
  9424. * stays at Xmax during logging_count_period.
  9425. */
  9426. uint32_t count_exceeded_excursion;
  9427. /*
  9428. * Maximum temperature since the last grasp of tmax in C.
  9429. */
  9430. int32_t max_temperature;
  9431. /*
  9432. * Number of periods when the monitored temperature exceeds to and
  9433. * stays at Tmax during logging_count_period
  9434. */
  9435. uint32_t count_exceeded_temperature;
  9436. } __packed;
  9437. /* This structure is followed by 'num_ch' number of structures of
  9438. * type afe_sp_v4_channel_tmax_xmax_params.
  9439. */
  9440. struct afe_sp_v4_param_tmax_xmax_logging {
  9441. uint32_t num_ch;
  9442. /* Number of channels for Rx signal.
  9443. */
  9444. struct afe_sp_v4_channel_tmax_xmax_params ch_tmax_xmax[0];
  9445. } __packed;
  9446. #define AFE_MODULE_SPEAKER_PROTECTION_V4_VI 0x000102D3
  9447. #define AFE_PARAM_ID_SP_V4_VI_OP_MODE_CFG 0x000102D4
  9448. #define AFE_PARAM_ID_SP_V4_VI_R0T0_CFG 0x000102D5
  9449. #define AFE_PARAM_ID_SP_V4_CALIB_RES_CFG 0x000102D8
  9450. #define AFE_PARAM_ID_SP_V4_TH_VI_FTM_CFG 0x000102D9
  9451. #define AFE_PARAM_ID_SP_V4_TH_VI_FTM_PARAMS 0x000102DA
  9452. #define AFE_PARAM_ID_SP_V4_TH_VI_V_VALI_CFG 0x000102DB
  9453. #define AFE_PARAM_ID_SP_V4_TH_VI_V_VALI_PARAMS 0x000102DC
  9454. #define AFE_PARAM_ID_SP_V4_EX_VI_MODE_CFG 0x000102DF
  9455. #define AFE_PARAM_ID_SP_V4_EX_VI_FTM_CFG 0x000102E0
  9456. #define AFE_PARAM_ID_SP_V4_EX_VI_FTM_PARAMS 0x000102E1
  9457. #define AFE_PARAM_ID_SP_V4_VI_CHANNEL_MAP_CFG 0x000102E5
  9458. struct afe_sp_v4_param_vi_op_mode_cfg {
  9459. uint32_t num_speakers;
  9460. /* Number of channels for Rx signal.
  9461. */
  9462. uint32_t th_operation_mode;
  9463. /*
  9464. * Operation mode of thermal VI module.
  9465. * 0 -- Normal Running mode
  9466. * 1 -- Calibration mode
  9467. * 2 -- FTM mode
  9468. * 3 -- V-Validation mode
  9469. */
  9470. uint32_t th_quick_calib_flag;
  9471. /*
  9472. * Indicates whether calibration is to be done in quick mode or not.
  9473. * This field is valid only in Calibration mode (operation_mode = 1).
  9474. * 0 -- Disabled
  9475. * 1 -- Enabled
  9476. */
  9477. uint32_t th_r0t0_selection_flag[SP_V2_NUM_MAX_SPKR];
  9478. /*
  9479. * Specifies which set of R0, T0 values the algorithm will use.
  9480. * This field is valid only in Normal mode (operation_mode = 0).
  9481. * 0 -- Use calibrated R0, T0 value
  9482. * 1 -- Use safe R0, T0 value
  9483. */
  9484. } __packed;
  9485. struct afe_sp_v4_channel_r0t0 {
  9486. int32_t r0_cali_q24;
  9487. /*
  9488. * Calibration point resistance per device. This field is valid
  9489. * only in Normal mode (operation_mode = 0).
  9490. * values 33554432 to 1073741824 Ohms (in Q24 format)
  9491. */
  9492. int16_t t0_cali_q6;
  9493. /*
  9494. * Calibration point temperature per device. This field is valid
  9495. * in both Normal mode and Calibration mode.
  9496. * values -1920 to 5120 degrees C (in Q6 format)
  9497. */
  9498. uint16_t reserved;
  9499. } __packed;
  9500. /* Followed by this structure are 'num_speaakers' number of structures
  9501. * of type afe_sp_v4_channel_r0t0.
  9502. */
  9503. struct afe_sp_v4_param_th_vi_r0t0_cfg {
  9504. uint32_t num_speakers;
  9505. /* Number of channels for Rx signal.
  9506. */
  9507. struct afe_sp_v4_channel_r0t0 ch_r0t0[0];
  9508. } __packed;
  9509. struct afe_sp_v4_param_th_vi_calib_res_cfg {
  9510. uint32_t num_ch;
  9511. /* Number of channels for Rx signal.
  9512. */
  9513. uint32_t th_vi_ca_state;
  9514. /*
  9515. * Represents the calibration state for both speakers.
  9516. * 0 -- Incorrect operation mode.
  9517. * 1 -- Inactive mode.
  9518. * 2 -- Wait state.
  9519. * 3 -- Calibration in progress state.
  9520. * 4 -- Calibration success.
  9521. * 5 -- Calibration failed.
  9522. */
  9523. int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
  9524. /* Calibration resistance per device.
  9525. */
  9526. } __packed;
  9527. struct afe_sp_v4_th_vi_calib_resp {
  9528. uint32_t status;
  9529. struct param_hdr_v3 pdata;
  9530. struct afe_sp_v4_param_th_vi_calib_res_cfg res_cfg;
  9531. } __packed;
  9532. struct afe_sp_v4_channel_ftm_cfg {
  9533. uint32_t wait_time_ms;
  9534. /*
  9535. * Wait time to heat up speaker before collecting statistics
  9536. * for ftm mode in ms.
  9537. * values 0 to 4294967295 ms
  9538. */
  9539. uint32_t ftm_time_ms;
  9540. /*
  9541. * duration for which FTM statistics are collected in ms.
  9542. * values 0 to 2000 ms
  9543. */
  9544. } __packed;
  9545. /* This structure is followed by 'num_ch' number of structures
  9546. * of type afe_sp_v4_channel_ftm_cfg.
  9547. */
  9548. struct afe_sp_v4_param_th_vi_ftm_cfg {
  9549. uint32_t num_ch;
  9550. /* Number of channels for Rx signal.
  9551. */
  9552. struct afe_sp_v4_channel_ftm_cfg ch_ftm_cfg[0];
  9553. } __packed;
  9554. struct afe_sp_v4_channel_ftm_params {
  9555. int32_t dc_res_q24;
  9556. /*
  9557. * DC resistance value in q24 format
  9558. * values 0 to 2147483647 Ohms (in Q24 format)
  9559. */
  9560. int32_t temp_q22;
  9561. /*
  9562. * temperature value in q22 format
  9563. * values -125829120 to 2147483647 degC (in Q22 format)
  9564. */
  9565. uint32_t status;
  9566. /*
  9567. * FTM packet status
  9568. * 0 - Incorrect operation mode.This status is returned
  9569. * when GET_PARAM is called in non FTM Mode
  9570. * 1 - Inactive mode -- Port is not yet started.
  9571. * 2 - Wait state. wait_time_ms has not yet elapsed
  9572. * 3 - In progress state. ftm_time_ms has not yet elapsed.
  9573. * 4 - Success.
  9574. * 5 - Failed.
  9575. */
  9576. } __packed;
  9577. /* This structure is followed by 'num_ch' number of structures
  9578. * of type afe_sp_v4_channel_ftm_params.
  9579. */
  9580. struct afe_sp_v4_param_th_vi_ftm_params {
  9581. uint32_t num_ch;
  9582. /* Number of channels for Rx signal.
  9583. */
  9584. struct afe_sp_v4_channel_ftm_params ch_ftm_params[0];
  9585. } __packed;
  9586. struct afe_sp_v4_gen_get_param_resp {
  9587. uint32_t status;
  9588. struct param_hdr_v3 pdata;
  9589. } __packed;
  9590. struct afe_sp_v4_channel_v_vali_cfg {
  9591. uint32_t wait_time_ms;
  9592. /*
  9593. * Wait time to heat up speaker before collecting statistics
  9594. * for V validation mode in ms.
  9595. * values 100 to 1000 ms
  9596. */
  9597. uint32_t vali_time_ms;
  9598. /*
  9599. * duration for which V VALIDATION statistics are collected in ms.
  9600. * values 1000 to 3000 ms
  9601. */
  9602. } __packed;
  9603. /* This structure is followed by 'num_ch' number of structures
  9604. * of type afe_sp_v4_channel_v_vali_cfg.
  9605. */
  9606. struct afe_sp_v4_param_th_vi_v_vali_cfg {
  9607. uint32_t num_ch;
  9608. /* Number of channels for Rx signal.
  9609. */
  9610. struct afe_sp_v4_channel_v_vali_cfg ch_v_vali_cfg[0];
  9611. } __packed;
  9612. struct afe_sp_v4_channel_v_vali_params {
  9613. uint32_t vrms_q24;
  9614. /*
  9615. * Vrms value in q24 format
  9616. * values [0 33554432] Q24 (0 - 2Vrms)
  9617. */
  9618. uint32_t status;
  9619. /*
  9620. * v-vali packet status
  9621. * 0 - Failed.
  9622. * 1 - Success.
  9623. * 2 - Incorrect operation mode.This status is returned
  9624. * when GET_PARAM is called in non v-vali Mode
  9625. * 3 - Inactive mode -- Port is not yet started.
  9626. * 4 - Wait state. wait_time_ms has not yet elapsed
  9627. * 5 - In progress state. ftm_time_ms has not yet elapsed.
  9628. */
  9629. } __packed;
  9630. /* This structure is followed by 'num_ch' number of structures
  9631. * of type afe_sp_v4_channel_v_vali_params.
  9632. */
  9633. struct afe_sp_v4_param_th_vi_v_vali_params {
  9634. uint32_t num_ch;
  9635. /* Number of channels for Rx signal.
  9636. */
  9637. struct afe_sp_v4_channel_v_vali_params ch_v_vali_params[0];
  9638. } __packed;
  9639. struct afe_sp_v4_param_ex_vi_mode_cfg {
  9640. uint32_t operation_mode;
  9641. /*
  9642. * Operation mode of Excursion VI module.
  9643. * 0 - Normal Running mode
  9644. * 2 - FTM mode
  9645. */
  9646. } __packed;
  9647. struct afe_sp_v4_channel_ex_vi_ftm {
  9648. uint32_t wait_time_ms;
  9649. /*
  9650. * Wait time to heat up speaker before collecting statistics
  9651. * for ftm mode in ms.
  9652. * values 0 to 4294967295 ms
  9653. */
  9654. uint32_t ftm_time_ms;
  9655. /*
  9656. * duration for which FTM statistics are collected in ms.
  9657. * values 0 to 2000 ms
  9658. */
  9659. } __packed;
  9660. /* This structure is followed by 'num_ch' number of structures
  9661. * of type afe_sp_v4_channel_ex_vi_ftm.
  9662. */
  9663. struct afe_sp_v4_param_ex_vi_ftm_cfg {
  9664. uint32_t num_ch;
  9665. /* Number of channels for Rx signal.
  9666. */
  9667. struct afe_sp_v4_channel_ex_vi_ftm ch_ex_vi_ftm[0];
  9668. } __packed;
  9669. struct afe_sp_v4_channel_ex_vi_ftm_params {
  9670. int32_t ftm_re_q24;
  9671. /*
  9672. * DC resistance of voice coil at room temperature
  9673. * or small signal level in Ohm.
  9674. */
  9675. int32_t ftm_Bl_q24;
  9676. /* Force factor.
  9677. */
  9678. int32_t ftm_Rms_q24;
  9679. /* Mechanical damping or resistance of loudspeaker in Kg/sec.
  9680. */
  9681. int32_t ftm_Kms_q24;
  9682. /* Mechanical stiffness of driver suspension in N/mm.
  9683. */
  9684. int32_t ftm_Fres_q20;
  9685. /* Resonance frequency in Hz.
  9686. */
  9687. int32_t ftm_Qms_q24;
  9688. /* Mechanical Q-factor.
  9689. */
  9690. uint32_t status;
  9691. /*
  9692. * FTM packet status
  9693. * 0 - Incorrect operation mode.This status is returned
  9694. * when GET_PARAM is called in non FTM Mode.
  9695. * 1 - Inactive mode -- Port is not yet started.
  9696. * 2 - Wait state. wait_time_ms has not yet elapsed
  9697. * 3 - In progress state. ftm_time_ms has not yet elapsed.
  9698. * 4 - Success.
  9699. * 5 - Failed.
  9700. */
  9701. } __packed;
  9702. /* This structure is followed by 'num_ch' number of structures of
  9703. * type afe_sp_v4_channel_ex_vi_ftm_params.
  9704. */
  9705. struct afe_sp_v4_param_ex_vi_ftm_params {
  9706. uint32_t num_ch;
  9707. /* Number of channels for Rx signal.
  9708. */
  9709. struct afe_sp_v4_channel_ex_vi_ftm_params ch_ex_vi_ftm_params[0];
  9710. } __packed;
  9711. struct afe_sp_v4_param_vi_channel_map_cfg {
  9712. int32_t num_channels;
  9713. int32_t chan_info[4];
  9714. } __packed;
  9715. union afe_spkr_prot_config {
  9716. struct asm_fbsp_mode_rx_cfg mode_rx_cfg;
  9717. struct asm_spkr_calib_vi_proc_cfg vi_proc_cfg;
  9718. struct asm_feedback_path_cfg feedback_path_cfg;
  9719. struct asm_mode_vi_proc_cfg mode_vi_proc_cfg;
  9720. struct afe_sp_th_vi_mode_cfg th_vi_mode_cfg;
  9721. struct afe_sp_th_vi_ftm_cfg th_vi_ftm_cfg;
  9722. struct afe_sp_th_vi_v_vali_cfg th_vi_v_vali_cfg;
  9723. struct afe_sp_ex_vi_mode_cfg ex_vi_mode_cfg;
  9724. struct afe_sp_ex_vi_ftm_cfg ex_vi_ftm_cfg;
  9725. struct afe_sp_rx_limiter_th_param limiter_th_cfg;
  9726. struct afe_sp_v4_param_op_mode v4_op_mode;
  9727. struct afe_sp_v4_param_vi_op_mode_cfg v4_vi_op_mode;
  9728. struct afe_sp_v4_param_th_vi_r0t0_cfg v4_r0t0_cfg;
  9729. struct afe_sp_v4_param_th_vi_ftm_cfg v4_th_vi_ftm_cfg;
  9730. struct afe_sp_v4_param_th_vi_v_vali_cfg v4_v_vali_cfg;
  9731. struct afe_sp_v4_param_ex_vi_mode_cfg v4_ex_vi_mode_cfg;
  9732. struct afe_sp_v4_param_ex_vi_ftm_cfg v4_ex_vi_ftm_cfg;
  9733. struct afe_sp_v4_param_vi_channel_map_cfg v4_ch_map_cfg;
  9734. } __packed;
  9735. /* SRS TRUMEDIA start */
  9736. /* topology */
  9737. #define SRS_TRUMEDIA_TOPOLOGY_ID 0x00010D90
  9738. /* module */
  9739. #define SRS_TRUMEDIA_MODULE_ID 0x10005010
  9740. /* parameters */
  9741. #define SRS_TRUMEDIA_PARAMS 0x10005011
  9742. #define SRS_TRUMEDIA_PARAMS_WOWHD 0x10005012
  9743. #define SRS_TRUMEDIA_PARAMS_CSHP 0x10005013
  9744. #define SRS_TRUMEDIA_PARAMS_HPF 0x10005014
  9745. #define SRS_TRUMEDIA_PARAMS_AEQ 0x10005015
  9746. #define SRS_TRUMEDIA_PARAMS_HL 0x10005016
  9747. #define SRS_TRUMEDIA_PARAMS_GEQ 0x10005017
  9748. #define SRS_ID_GLOBAL 0x00000001
  9749. #define SRS_ID_WOWHD 0x00000002
  9750. #define SRS_ID_CSHP 0x00000003
  9751. #define SRS_ID_HPF 0x00000004
  9752. #define SRS_ID_AEQ 0x00000005
  9753. #define SRS_ID_HL 0x00000006
  9754. #define SRS_ID_GEQ 0x00000007
  9755. #define SRS_CMD_UPLOAD 0x7FFF0000
  9756. #define SRS_PARAM_OFFSET_MASK 0x3FFF0000
  9757. #define SRS_PARAM_VALUE_MASK 0x0000FFFF
  9758. struct srs_trumedia_params_GLOBAL {
  9759. uint8_t v1;
  9760. uint8_t v2;
  9761. uint8_t v3;
  9762. uint8_t v4;
  9763. uint8_t v5;
  9764. uint8_t v6;
  9765. uint8_t v7;
  9766. uint8_t v8;
  9767. uint16_t v9;
  9768. } __packed;
  9769. struct srs_trumedia_params_WOWHD {
  9770. uint32_t v1;
  9771. uint16_t v2;
  9772. uint16_t v3;
  9773. uint16_t v4;
  9774. uint16_t v5;
  9775. uint16_t v6;
  9776. uint16_t v7;
  9777. uint16_t v8;
  9778. uint16_t v____A1;
  9779. uint32_t v9;
  9780. uint16_t v10;
  9781. uint16_t v11;
  9782. uint32_t v12[16];
  9783. uint32_t v13[16];
  9784. uint32_t v14[16];
  9785. uint32_t v15[16];
  9786. uint32_t v16;
  9787. uint16_t v17;
  9788. uint16_t v18;
  9789. } __packed;
  9790. struct srs_trumedia_params_CSHP {
  9791. uint32_t v1;
  9792. uint16_t v2;
  9793. uint16_t v3;
  9794. uint16_t v4;
  9795. uint16_t v5;
  9796. uint16_t v6;
  9797. uint16_t v____A1;
  9798. uint32_t v7;
  9799. uint16_t v8;
  9800. uint16_t v9;
  9801. uint32_t v10[16];
  9802. } __packed;
  9803. struct srs_trumedia_params_HPF {
  9804. uint32_t v1;
  9805. uint32_t v2[26];
  9806. } __packed;
  9807. struct srs_trumedia_params_AEQ {
  9808. uint32_t v1;
  9809. uint16_t v2;
  9810. uint16_t v3;
  9811. uint16_t v4;
  9812. uint16_t v____A1;
  9813. uint32_t v5[74];
  9814. uint32_t v6[74];
  9815. uint16_t v7[2048];
  9816. } __packed;
  9817. struct srs_trumedia_params_HL {
  9818. uint16_t v1;
  9819. uint16_t v2;
  9820. uint16_t v3;
  9821. uint16_t v____A1;
  9822. int32_t v4;
  9823. uint32_t v5;
  9824. uint16_t v6;
  9825. uint16_t v____A2;
  9826. uint32_t v7;
  9827. } __packed;
  9828. struct srs_trumedia_params_GEQ {
  9829. int16_t v1[10];
  9830. } __packed;
  9831. struct srs_trumedia_params {
  9832. struct srs_trumedia_params_GLOBAL global;
  9833. struct srs_trumedia_params_WOWHD wowhd;
  9834. struct srs_trumedia_params_CSHP cshp;
  9835. struct srs_trumedia_params_HPF hpf;
  9836. struct srs_trumedia_params_AEQ aeq;
  9837. struct srs_trumedia_params_HL hl;
  9838. struct srs_trumedia_params_GEQ geq;
  9839. } __packed;
  9840. /* SRS TruMedia end */
  9841. #define AUDPROC_PARAM_ID_ENABLE 0x00010904
  9842. #define ASM_STREAM_POSTPROC_TOPO_ID_SA_PLUS 0x1000FFFF
  9843. /* DTS Eagle */
  9844. #define AUDPROC_MODULE_ID_DTS_HPX_PREMIX 0x0001077C
  9845. #define AUDPROC_MODULE_ID_DTS_HPX_POSTMIX 0x0001077B
  9846. #define ASM_STREAM_POSTPROC_TOPO_ID_DTS_HPX 0x00010DED
  9847. #define ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS 0x10015000
  9848. #define ASM_STREAM_POSTPROC_TOPO_ID_HPX_MASTER 0x10015001
  9849. /* Opcode to set BT address and license for aptx decoder */
  9850. #define APTX_DECODER_BT_ADDRESS 0x00013201
  9851. #define APTX_CLASSIC_DEC_LICENSE_ID 0x00013202
  9852. struct aptx_dec_bt_addr_cfg {
  9853. uint32_t lap;
  9854. uint32_t uap;
  9855. uint32_t nap;
  9856. } __packed;
  9857. struct aptx_dec_bt_dev_addr {
  9858. struct apr_hdr hdr;
  9859. struct asm_stream_cmd_set_encdec_param encdec;
  9860. struct aptx_dec_bt_addr_cfg bt_addr_cfg;
  9861. } __packed;
  9862. struct asm_aptx_dec_fmt_blk_v2 {
  9863. struct apr_hdr hdr;
  9864. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  9865. u32 sample_rate;
  9866. /* Number of samples per second.
  9867. * Supported values: 44100 and 48000 Hz
  9868. */
  9869. } __packed;
  9870. /* Q6Core Specific */
  9871. #define AVCS_CMD_GET_FWK_VERSION (0x0001292C)
  9872. #define AVCS_CMDRSP_GET_FWK_VERSION (0x0001292D)
  9873. #define AVCS_SERVICE_ID_ALL (0xFFFFFFFF)
  9874. #define APRV2_IDS_SERVICE_ID_ADSP_CVP_V (0xB)
  9875. #define APRV2_IDS_SERVICE_ID_ADSP_AFE_V (0x4)
  9876. struct avcs_get_fwk_version {
  9877. /*
  9878. * Indicates the major version of the AVS build.
  9879. * This value is incremented on chipset family boundaries.
  9880. */
  9881. uint32_t build_major_version;
  9882. /*
  9883. * Minor version of the AVS build.
  9884. * This value represents the mainline to which the AVS build belongs.
  9885. */
  9886. uint32_t build_minor_version;
  9887. /* Indicates the AVS branch version to which the image belongs. */
  9888. uint32_t build_branch_version;
  9889. /* Indicates the AVS sub-branch or customer product line information. */
  9890. uint32_t build_subbranch_version;
  9891. /* Number of supported AVS services in the current build. */
  9892. uint32_t num_services;
  9893. };
  9894. struct avs_svc_api_info {
  9895. /*
  9896. * APRV2 service IDs for the individual static services.
  9897. *
  9898. * @values
  9899. * - APRV2_IDS_SERVICE_ID_ADSP_CORE_V
  9900. * - APRV2_IDS_SERVICE_ID_ADSP_AFE_V
  9901. * - APRV2_IDS_SERVICE_ID_ADSP_ASM_V
  9902. * - APRV2_IDS_SERVICE_ID_ADSP_ADM_V
  9903. * - APRV2_IDS_SERVICE_ID_ADSP_MVM_V
  9904. * - APRV2_IDS_SERVICE_ID_ADSP_CVS_V
  9905. * - APRV2_IDS_SERVICE_ID_ADSP_CVP_V
  9906. * - APRV2_IDS_SERVICE_ID_ADSP_LSM_V
  9907. */
  9908. uint32_t service_id;
  9909. /*
  9910. * Indicates the API version of the service.
  9911. *
  9912. * Each new API update that warrants a change on the HLOS side triggers
  9913. * an increment in the version.
  9914. */
  9915. uint32_t api_version;
  9916. /*
  9917. * Indicates the API increments on a sub-branch (not on the mainline).
  9918. *
  9919. * API branch version numbers can increment independently on different
  9920. * sub-branches.
  9921. */
  9922. uint32_t api_branch_version;
  9923. };
  9924. struct avcs_fwk_ver_info {
  9925. struct avcs_get_fwk_version avcs_fwk_version;
  9926. struct avs_svc_api_info services[0];
  9927. } __packed;
  9928. /* LSM Specific */
  9929. #define VW_FEAT_DIM (39)
  9930. #define APRV2_IDS_SERVICE_ID_ADSP_ASM_V (0x7)
  9931. #define APRV2_IDS_SERVICE_ID_ADSP_ADM_V (0x8)
  9932. #define APRV2_IDS_SERVICE_ID_ADSP_LSM_V (0xD)
  9933. #define APRV2_IDS_DOMAIN_ID_ADSP_V (0x4)
  9934. #define APRV2_IDS_DOMAIN_ID_APPS_V (0x5)
  9935. #define LSM_SESSION_CMD_SHARED_MEM_MAP_REGIONS (0x00012A7F)
  9936. #define LSM_SESSION_CMDRSP_SHARED_MEM_MAP_REGIONS (0x00012A80)
  9937. #define LSM_SESSION_CMD_SHARED_MEM_UNMAP_REGIONS (0x00012A81)
  9938. #define LSM_SESSION_CMD_OPEN_TX (0x00012A82)
  9939. #define LSM_SESSION_CMD_CLOSE_TX (0x00012A88)
  9940. #define LSM_SESSION_CMD_SET_PARAMS (0x00012A83)
  9941. #define LSM_SESSION_CMD_SET_PARAMS_V2 (0x00012A8F)
  9942. #define LSM_SESSION_CMD_SET_PARAMS_V3 (0x00012A92)
  9943. #define LSM_SESSION_CMD_GET_PARAMS_V2 (0x00012A90)
  9944. #define LSM_SESSION_CMDRSP_GET_PARAMS_V2 (0x00012A91)
  9945. #define LSM_SESSION_CMD_GET_PARAMS_V3 (0x00012A93)
  9946. #define LSM_SESSION_CMDRSP_GET_PARAMS_V3 (0x00012A94)
  9947. #define LSM_SESSION_CMD_REGISTER_SOUND_MODEL (0x00012A84)
  9948. #define LSM_SESSION_CMD_DEREGISTER_SOUND_MODEL (0x00012A85)
  9949. #define LSM_SESSION_CMD_START (0x00012A86)
  9950. #define LSM_SESSION_CMD_STOP (0x00012A87)
  9951. #define LSM_SESSION_CMD_EOB (0x00012A89)
  9952. #define LSM_SESSION_CMD_READ (0x00012A8A)
  9953. #define LSM_SESSION_CMD_OPEN_TX_V2 (0x00012A8B)
  9954. #define LSM_SESSION_CMD_OPEN_TX_V3 (0x00012A95)
  9955. #define LSM_CMD_ADD_TOPOLOGIES (0x00012A8C)
  9956. #define LSM_SESSION_EVENT_DETECTION_STATUS (0x00012B00)
  9957. #define LSM_SESSION_EVENT_DETECTION_STATUS_V2 (0x00012B01)
  9958. #define LSM_DATA_EVENT_READ_DONE (0x00012B02)
  9959. #define LSM_DATA_EVENT_STATUS (0x00012B03)
  9960. #define LSM_SESSION_EVENT_DETECTION_STATUS_V3 (0x00012B04)
  9961. #define LSM_SESSION_DETECTION_ENGINE_GENERIC_EVENT (0x00012B06)
  9962. #define LSM_MODULE_ID_VOICE_WAKEUP (0x00012C00)
  9963. #define LSM_PARAM_ID_ENDPOINT_DETECT_THRESHOLD (0x00012C01)
  9964. #define LSM_PARAM_ID_OPERATION_MODE (0x00012C02)
  9965. #define LSM_PARAM_ID_GAIN (0x00012C03)
  9966. #define LSM_PARAM_ID_CONNECT_TO_PORT (0x00012C04)
  9967. #define LSM_PARAM_ID_FEATURE_COMPENSATION_DATA (0x00012C07)
  9968. #define LSM_PARAM_ID_MIN_CONFIDENCE_LEVELS (0x00012C07)
  9969. #define LSM_MODULE_ID_LAB (0x00012C08)
  9970. #define LSM_PARAM_ID_LAB_ENABLE (0x00012C09)
  9971. #define LSM_PARAM_ID_LAB_CONFIG (0x00012C0A)
  9972. #define LSM_MODULE_ID_FRAMEWORK (0x00012C0E)
  9973. #define LSM_PARAM_ID_SWMAD_CFG (0x00012C18)
  9974. #define LSM_PARAM_ID_SWMAD_MODEL (0x00012C19)
  9975. #define LSM_PARAM_ID_SWMAD_ENABLE (0x00012C1A)
  9976. #define LSM_PARAM_ID_POLLING_ENABLE (0x00012C1B)
  9977. #define LSM_PARAM_ID_MEDIA_FMT (0x00012C1E)
  9978. #define LSM_PARAM_ID_FWK_MODE_CONFIG (0x00012C27)
  9979. #define LSM_PARAM_ID_MEDIA_FMT_V2 (0x00012C32)
  9980. #define LSM_PARAM_ID_LAB_OUTPUT_CHANNEL_CONFIG (0x00012C2D)
  9981. /* HW MAD specific */
  9982. #define AFE_MODULE_HW_MAD (0x00010230)
  9983. #define AFE_PARAM_ID_HW_MAD_CFG (0x00010231)
  9984. #define AFE_PARAM_ID_HW_MAD_CTRL (0x00010232)
  9985. #define AFE_PARAM_ID_SLIMBUS_SLAVE_PORT_CFG (0x00010233)
  9986. /* SW MAD specific */
  9987. #define AFE_MODULE_SW_MAD (0x0001022D)
  9988. #define AFE_PARAM_ID_SW_MAD_CFG (0x0001022E)
  9989. #define AFE_PARAM_ID_SVM_MODEL (0x0001022F)
  9990. /* Commands/Params to pass the codec/slimbus data to DSP */
  9991. #define AFE_SVC_CMD_SET_PARAM (0x000100f3)
  9992. #define AFE_SVC_CMD_SET_PARAM_V2 (0x000100fc)
  9993. #define AFE_MODULE_CDC_DEV_CFG (0x00010234)
  9994. #define AFE_PARAM_ID_CDC_SLIMBUS_SLAVE_CFG (0x00010235)
  9995. #define AFE_PARAM_ID_CDC_REG_CFG (0x00010236)
  9996. #define AFE_PARAM_ID_CDC_REG_CFG_INIT (0x00010237)
  9997. #define AFE_PARAM_ID_CDC_REG_PAGE_CFG (0x00010296)
  9998. #define AFE_MAX_CDC_REGISTERS_TO_CONFIG (20)
  9999. /* AANC Port Config Specific */
  10000. #define AFE_PARAM_ID_AANC_PORT_CONFIG (0x00010215)
  10001. #define AFE_API_VERSION_AANC_PORT_CONFIG (0x1)
  10002. #define AANC_TX_MIC_UNUSED (0)
  10003. #define AANC_TX_VOICE_MIC (1)
  10004. #define AANC_TX_ERROR_MIC (2)
  10005. #define AANC_TX_NOISE_MIC (3)
  10006. #define AFE_PORT_MAX_CHANNEL_CNT (8)
  10007. #define AFE_MODULE_AANC (0x00010214)
  10008. #define AFE_PARAM_ID_CDC_AANC_VERSION (0x0001023A)
  10009. #define AFE_API_VERSION_CDC_AANC_VERSION (0x1)
  10010. #define AANC_HW_BLOCK_VERSION_1 (1)
  10011. #define AANC_HW_BLOCK_VERSION_2 (2)
  10012. /*Clip bank selection*/
  10013. #define AFE_API_VERSION_CLIP_BANK_SEL_CFG 0x1
  10014. #define AFE_CLIP_MAX_BANKS 4
  10015. #define AFE_PARAM_ID_CLIP_BANK_SEL_CFG 0x00010242
  10016. struct afe_param_aanc_port_cfg {
  10017. /* Minor version used for tracking the version of the module's
  10018. * source port configuration.
  10019. */
  10020. uint32_t aanc_port_cfg_minor_version;
  10021. /* Sampling rate of the source Tx port. 8k - 192k*/
  10022. uint32_t tx_port_sample_rate;
  10023. /* Channel mapping for the Tx port signal carrying Noise (X),
  10024. * Error (E), and Voice (V) signals.
  10025. */
  10026. uint8_t tx_port_channel_map[AFE_PORT_MAX_CHANNEL_CNT];
  10027. /* Number of channels on the source Tx port. */
  10028. uint16_t tx_port_num_channels;
  10029. /* Port ID of the Rx path reference signal. */
  10030. uint16_t rx_path_ref_port_id;
  10031. /* Sampling rate of the reference port. 8k - 192k*/
  10032. uint32_t ref_port_sample_rate;
  10033. } __packed;
  10034. struct afe_param_id_cdc_aanc_version {
  10035. /* Minor version used for tracking the version of the module's
  10036. * hw version
  10037. */
  10038. uint32_t cdc_aanc_minor_version;
  10039. /* HW version. */
  10040. uint32_t aanc_hw_version;
  10041. } __packed;
  10042. #define AFE_PARAM_ID_AANC_NOISE_REDUCTION 0x000102AB
  10043. struct afe_param_id_aanc_noise_reduction {
  10044. /* Minor version used for tracking the version of the module's
  10045. * hw version
  10046. */
  10047. uint32_t minor_version;
  10048. /* Target noise level */
  10049. int32_t ad_beta;
  10050. } __packed;
  10051. struct afe_param_id_clip_bank_sel {
  10052. /* Minor version used for tracking the version of the module's
  10053. * hw version
  10054. */
  10055. uint32_t minor_version;
  10056. /* Number of banks to be read */
  10057. uint32_t num_banks;
  10058. uint32_t bank_map[AFE_CLIP_MAX_BANKS];
  10059. } __packed;
  10060. /* ERROR CODES */
  10061. /* Success. The operation completed with no errors. */
  10062. #define ADSP_EOK 0x00000000
  10063. /* General failure. */
  10064. #define ADSP_EFAILED 0x00000001
  10065. /* Bad operation parameter. */
  10066. #define ADSP_EBADPARAM 0x00000002
  10067. /* Unsupported routine or operation. */
  10068. #define ADSP_EUNSUPPORTED 0x00000003
  10069. /* Unsupported version. */
  10070. #define ADSP_EVERSION 0x00000004
  10071. /* Unexpected problem encountered. */
  10072. #define ADSP_EUNEXPECTED 0x00000005
  10073. /* Unhandled problem occurred. */
  10074. #define ADSP_EPANIC 0x00000006
  10075. /* Unable to allocate resource. */
  10076. #define ADSP_ENORESOURCE 0x00000007
  10077. /* Invalid handle. */
  10078. #define ADSP_EHANDLE 0x00000008
  10079. /* Operation is already processed. */
  10080. #define ADSP_EALREADY 0x00000009
  10081. /* Operation is not ready to be processed. */
  10082. #define ADSP_ENOTREADY 0x0000000A
  10083. /* Operation is pending completion. */
  10084. #define ADSP_EPENDING 0x0000000B
  10085. /* Operation could not be accepted or processed. */
  10086. #define ADSP_EBUSY 0x0000000C
  10087. /* Operation aborted due to an error. */
  10088. #define ADSP_EABORTED 0x0000000D
  10089. /* Operation preempted by a higher priority. */
  10090. #define ADSP_EPREEMPTED 0x0000000E
  10091. /* Operation requests intervention to complete. */
  10092. #define ADSP_ECONTINUE 0x0000000F
  10093. /* Operation requests immediate intervention to complete. */
  10094. #define ADSP_EIMMEDIATE 0x00000010
  10095. /* Operation is not implemented. */
  10096. #define ADSP_ENOTIMPL 0x00000011
  10097. /* Operation needs more data or resources. */
  10098. #define ADSP_ENEEDMORE 0x00000012
  10099. /* Operation does not have memory. */
  10100. #define ADSP_ENOMEMORY 0x00000014
  10101. /* Item does not exist. */
  10102. #define ADSP_ENOTEXIST 0x00000015
  10103. /* Max count for adsp error code sent to HLOS*/
  10104. #define ADSP_ERR_MAX (ADSP_ENOTEXIST + 1)
  10105. /* Operation is finished. */
  10106. #define ADSP_ETERMINATED 0x00011174
  10107. /*bharath, adsp_error_codes.h */
  10108. /* LPASS clock for I2S Interface */
  10109. /* Supported OSR clock values */
  10110. #define Q6AFE_LPASS_OSR_CLK_12_P288_MHZ 0xBB8000
  10111. #define Q6AFE_LPASS_OSR_CLK_11_P2896_MHZ 0xAC4400
  10112. #define Q6AFE_LPASS_OSR_CLK_9_P600_MHZ 0x927C00
  10113. #define Q6AFE_LPASS_OSR_CLK_8_P192_MHZ 0x7D0000
  10114. #define Q6AFE_LPASS_OSR_CLK_6_P144_MHZ 0x5DC000
  10115. #define Q6AFE_LPASS_OSR_CLK_4_P096_MHZ 0x3E8000
  10116. #define Q6AFE_LPASS_OSR_CLK_3_P072_MHZ 0x2EE000
  10117. #define Q6AFE_LPASS_OSR_CLK_2_P048_MHZ 0x1F4000
  10118. #define Q6AFE_LPASS_OSR_CLK_1_P536_MHZ 0x177000
  10119. #define Q6AFE_LPASS_OSR_CLK_1_P024_MHZ 0xFA000
  10120. #define Q6AFE_LPASS_OSR_CLK_768_kHZ 0xBB800
  10121. #define Q6AFE_LPASS_OSR_CLK_512_kHZ 0x7D000
  10122. #define Q6AFE_LPASS_OSR_CLK_DISABLE 0x0
  10123. /* Supported Bit clock values */
  10124. #define Q6AFE_LPASS_IBIT_CLK_12_P288_MHZ 0xBB8000
  10125. #define Q6AFE_LPASS_IBIT_CLK_11_P2896_MHZ 0xAC4400
  10126. #define Q6AFE_LPASS_IBIT_CLK_8_P192_MHZ 0x7D0000
  10127. #define Q6AFE_LPASS_IBIT_CLK_6_P144_MHZ 0x5DC000
  10128. #define Q6AFE_LPASS_IBIT_CLK_4_P096_MHZ 0x3E8000
  10129. #define Q6AFE_LPASS_IBIT_CLK_3_P072_MHZ 0x2EE000
  10130. #define Q6AFE_LPASS_IBIT_CLK_2_P8224_MHZ 0x2b1100
  10131. #define Q6AFE_LPASS_IBIT_CLK_2_P048_MHZ 0x1F4000
  10132. #define Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ 0x177000
  10133. #define Q6AFE_LPASS_IBIT_CLK_1_P4112_MHZ 0x158880
  10134. #define Q6AFE_LPASS_IBIT_CLK_1_P024_MHZ 0xFA000
  10135. #define Q6AFE_LPASS_IBIT_CLK_768_KHZ 0xBB800
  10136. #define Q6AFE_LPASS_IBIT_CLK_512_KHZ 0x7D000
  10137. #define Q6AFE_LPASS_IBIT_CLK_256_KHZ 0x3E800
  10138. #define Q6AFE_LPASS_IBIT_CLK_DISABLE 0x0
  10139. /* Supported LPASS CLK sources */
  10140. #define Q6AFE_LPASS_CLK_SRC_EXTERNAL 0
  10141. #define Q6AFE_LPASS_CLK_SRC_INTERNAL 1
  10142. /* Supported LPASS CLK root*/
  10143. #define Q6AFE_LPASS_CLK_ROOT_DEFAULT 0
  10144. enum afe_lpass_clk_mode {
  10145. Q6AFE_LPASS_MODE_BOTH_INVALID,
  10146. Q6AFE_LPASS_MODE_CLK1_VALID,
  10147. Q6AFE_LPASS_MODE_CLK2_VALID,
  10148. Q6AFE_LPASS_MODE_BOTH_VALID,
  10149. } __packed;
  10150. /* Clock ID Enumeration Define. */
  10151. /* Clock ID for Primary I2S IBIT */
  10152. #define Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT 0x100
  10153. /* Clock ID for Primary I2S EBIT */
  10154. #define Q6AFE_LPASS_CLK_ID_PRI_MI2S_EBIT 0x101
  10155. /* Clock ID for Secondary I2S IBIT */
  10156. #define Q6AFE_LPASS_CLK_ID_SEC_MI2S_IBIT 0x102
  10157. /* Clock ID for Secondary I2S EBIT */
  10158. #define Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT 0x103
  10159. /* Clock ID for Tertiary I2S IBIT */
  10160. #define Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT 0x104
  10161. /* Clock ID for Tertiary I2S EBIT */
  10162. #define Q6AFE_LPASS_CLK_ID_TER_MI2S_EBIT 0x105
  10163. /* Clock ID for Quartnery I2S IBIT */
  10164. #define Q6AFE_LPASS_CLK_ID_QUAD_MI2S_IBIT 0x106
  10165. /* Clock ID for Quartnery I2S EBIT */
  10166. #define Q6AFE_LPASS_CLK_ID_QUAD_MI2S_EBIT 0x107
  10167. /* Clock ID for Speaker I2S IBIT */
  10168. #define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_IBIT 0x108
  10169. /* Clock ID for Speaker I2S EBIT */
  10170. #define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_EBIT 0x109
  10171. /* Clock ID for Speaker I2S OSR */
  10172. #define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_OSR 0x10A
  10173. /* Clock ID for QUINARY I2S IBIT */
  10174. #define Q6AFE_LPASS_CLK_ID_QUI_MI2S_IBIT 0x10B
  10175. /* Clock ID for QUINARY I2S EBIT */
  10176. #define Q6AFE_LPASS_CLK_ID_QUI_MI2S_EBIT 0x10C
  10177. /* Clock ID for SENARY I2S IBIT */
  10178. #define Q6AFE_LPASS_CLK_ID_SEN_MI2S_IBIT 0x10D
  10179. /* Clock ID for SENARY I2S EBIT */
  10180. #define Q6AFE_LPASS_CLK_ID_SEN_MI2S_EBIT 0x10E
  10181. /* Clock ID for INT0 I2S IBIT */
  10182. #define Q6AFE_LPASS_CLK_ID_INT0_MI2S_IBIT 0x10F
  10183. /* Clock ID for INT1 I2S IBIT */
  10184. #define Q6AFE_LPASS_CLK_ID_INT1_MI2S_IBIT 0x110
  10185. /* Clock ID for INT2 I2S IBIT */
  10186. #define Q6AFE_LPASS_CLK_ID_INT2_MI2S_IBIT 0x111
  10187. /* Clock ID for INT3 I2S IBIT */
  10188. #define Q6AFE_LPASS_CLK_ID_INT3_MI2S_IBIT 0x112
  10189. /* Clock ID for INT4 I2S IBIT */
  10190. #define Q6AFE_LPASS_CLK_ID_INT4_MI2S_IBIT 0x113
  10191. /* Clock ID for INT5 I2S IBIT */
  10192. #define Q6AFE_LPASS_CLK_ID_INT5_MI2S_IBIT 0x114
  10193. /* Clock ID for INT6 I2S IBIT */
  10194. #define Q6AFE_LPASS_CLK_ID_INT6_MI2S_IBIT 0x115
  10195. /* Clock ID for QUINARY MI2S OSR CLK */
  10196. #define Q6AFE_LPASS_CLK_ID_QUI_MI2S_OSR 0x116
  10197. /* Clock ID for Primary PCM IBIT */
  10198. #define Q6AFE_LPASS_CLK_ID_PRI_PCM_IBIT 0x200
  10199. /* Clock ID for Primary PCM EBIT */
  10200. #define Q6AFE_LPASS_CLK_ID_PRI_PCM_EBIT 0x201
  10201. /* Clock ID for Secondary PCM IBIT */
  10202. #define Q6AFE_LPASS_CLK_ID_SEC_PCM_IBIT 0x202
  10203. /* Clock ID for Secondary PCM EBIT */
  10204. #define Q6AFE_LPASS_CLK_ID_SEC_PCM_EBIT 0x203
  10205. /* Clock ID for Tertiary PCM IBIT */
  10206. #define Q6AFE_LPASS_CLK_ID_TER_PCM_IBIT 0x204
  10207. /* Clock ID for Tertiary PCM EBIT */
  10208. #define Q6AFE_LPASS_CLK_ID_TER_PCM_EBIT 0x205
  10209. /* Clock ID for Quartery PCM IBIT */
  10210. #define Q6AFE_LPASS_CLK_ID_QUAD_PCM_IBIT 0x206
  10211. /* Clock ID for Quartery PCM EBIT */
  10212. #define Q6AFE_LPASS_CLK_ID_QUAD_PCM_EBIT 0x207
  10213. /* Clock ID for Quinary PCM IBIT */
  10214. #define Q6AFE_LPASS_CLK_ID_QUIN_PCM_IBIT 0x208
  10215. /* Clock ID for Quinary PCM EBIT */
  10216. #define Q6AFE_LPASS_CLK_ID_QUIN_PCM_EBIT 0x209
  10217. /* Clock ID for QUINARY PCM OSR */
  10218. #define Q6AFE_LPASS_CLK_ID_QUI_PCM_OSR 0x20A
  10219. /* Clock ID for Senary PCM IBIT */
  10220. #define Q6AFE_LPASS_CLK_ID_SEN_PCM_IBIT 0x20B
  10221. /* Clock ID for Senary PCM EBIT */
  10222. #define Q6AFE_LPASS_CLK_ID_SEN_PCM_EBIT 0x20C
  10223. /** Clock ID for Primary TDM IBIT */
  10224. #define Q6AFE_LPASS_CLK_ID_PRI_TDM_IBIT 0x200
  10225. /** Clock ID for Primary TDM EBIT */
  10226. #define Q6AFE_LPASS_CLK_ID_PRI_TDM_EBIT 0x201
  10227. /** Clock ID for Secondary TDM IBIT */
  10228. #define Q6AFE_LPASS_CLK_ID_SEC_TDM_IBIT 0x202
  10229. /** Clock ID for Secondary TDM EBIT */
  10230. #define Q6AFE_LPASS_CLK_ID_SEC_TDM_EBIT 0x203
  10231. /** Clock ID for Tertiary TDM IBIT */
  10232. #define Q6AFE_LPASS_CLK_ID_TER_TDM_IBIT 0x204
  10233. /** Clock ID for Tertiary TDM EBIT */
  10234. #define Q6AFE_LPASS_CLK_ID_TER_TDM_EBIT 0x205
  10235. /** Clock ID for Quartery TDM IBIT */
  10236. #define Q6AFE_LPASS_CLK_ID_QUAD_TDM_IBIT 0x206
  10237. /** Clock ID for Quartery TDM EBIT */
  10238. #define Q6AFE_LPASS_CLK_ID_QUAD_TDM_EBIT 0x207
  10239. /** Clock ID for Quinary TDM IBIT */
  10240. #define Q6AFE_LPASS_CLK_ID_QUIN_TDM_IBIT 0x208
  10241. /** Clock ID for Quinary TDM EBIT */
  10242. #define Q6AFE_LPASS_CLK_ID_QUIN_TDM_EBIT 0x209
  10243. /** Clock ID for Quinary TDM OSR */
  10244. #define Q6AFE_LPASS_CLK_ID_QUIN_TDM_OSR 0x20A
  10245. /** Clock ID for Senary TDM IBIT */
  10246. #define Q6AFE_LPASS_CLK_ID_SEN_TDM_IBIT 0x20B
  10247. /** Clock ID for Senary TDM EBIT */
  10248. #define Q6AFE_LPASS_CLK_ID_SEN_TDM_EBIT 0x20C
  10249. /* Clock ID for MCLK1 */
  10250. #define Q6AFE_LPASS_CLK_ID_MCLK_1 0x300
  10251. /* Clock ID for MCLK2 */
  10252. #define Q6AFE_LPASS_CLK_ID_MCLK_2 0x301
  10253. /* Clock ID for MCLK3 */
  10254. #define Q6AFE_LPASS_CLK_ID_MCLK_3 0x302
  10255. /* Clock ID for MCLK4 */
  10256. #define Q6AFE_LPASS_CLK_ID_MCLK_4 0x304
  10257. /* Clock ID for Internal Digital Codec Core */
  10258. #define Q6AFE_LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE 0x303
  10259. /* Clock ID for INT MCLK0 */
  10260. #define Q6AFE_LPASS_CLK_ID_INT_MCLK_0 0x305
  10261. /* Clock ID for INT MCLK1 */
  10262. #define Q6AFE_LPASS_CLK_ID_INT_MCLK_1 0x306
  10263. /*
  10264. * Clock ID for soundwire NPL.
  10265. * This is the clock to be used to enable NPL clock for internal Soundwire.
  10266. */
  10267. #define AFE_CLOCK_SET_CLOCK_ID_SWR_NPL_CLK 0x307
  10268. /* Clock ID for MCLK5 */
  10269. #define Q6AFE_LPASS_CLK_ID_MCLK_5 0x308
  10270. /* Clock ID for AHB HDMI input */
  10271. #define Q6AFE_LPASS_CLK_ID_AHB_HDMI_INPUT 0x400
  10272. /* Clock ID for the primary SPDIF output core. */
  10273. #define AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_OUTPUT_CORE 0x500
  10274. /* Clock ID for the secondary SPDIF output core. */
  10275. #define AFE_CLOCK_SET_CLOCK_ID_SEC_SPDIF_OUTPUT_CORE 0x501
  10276. /* Clock ID for the primary SPDIF input core. */
  10277. #define AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_INPUT_CORE 0x502
  10278. /* Clock ID for the secondary SPDIF input core. */
  10279. #define AFE_CLOCK_SET_CLOCK_ID_SEC_SPDIF_INPUT_CORE 0x503
  10280. /* Clock ID for the secondary SPDIF output NPL clk. */
  10281. #define AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_OUTPUT_NPL 0x504
  10282. /* Clock ID for the primary SPDIF output NPL clk. */
  10283. #define AFE_CLOCK_SET_CLOCK_ID_SEC_SPDIF_OUTPUT_NPL 0x505
  10284. /* Clock attribute for invalid use (reserved for internal usage) */
  10285. #define Q6AFE_LPASS_CLK_ATTRIBUTE_INVALID 0x0
  10286. /* Clock attribute for no couple case */
  10287. #define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO 0x1
  10288. /* Clock attribute for dividend couple case */
  10289. #define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVIDEND 0x2
  10290. /* Clock attribute for divisor couple case */
  10291. #define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR 0x3
  10292. /* Clock attribute for invert and no couple case */
  10293. #define Q6AFE_LPASS_CLK_ATTRIBUTE_INVERT_COUPLE_NO 0x4
  10294. /* Clock set API version */
  10295. #define Q6AFE_LPASS_CLK_CONFIG_API_VERSION 0x1
  10296. struct afe_clk_set {
  10297. /*
  10298. * Minor version used for tracking clock set.
  10299. * @values #AFE_API_VERSION_CLOCK_SET
  10300. */
  10301. uint32_t clk_set_minor_version;
  10302. /*
  10303. * Clock ID
  10304. * @values
  10305. * - 0x100 to 0x10A - MSM8996
  10306. * - 0x200 to 0x207 - MSM8996
  10307. * - 0x300 to 0x302 - MSM8996 @tablebulletend
  10308. */
  10309. uint32_t clk_id;
  10310. /*
  10311. * Clock frequency (in Hertz) to be set.
  10312. * @values
  10313. * - >= 0 for clock frequency to set @tablebulletend
  10314. */
  10315. uint32_t clk_freq_in_hz;
  10316. /* Use to specific divider for two clocks if needed.
  10317. * Set to Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO for no divider
  10318. * relation clocks
  10319. * @values
  10320. * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO
  10321. * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVIDEND
  10322. * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR @tablebulletend
  10323. */
  10324. uint16_t clk_attri;
  10325. /*
  10326. * Specifies the root clock source.
  10327. * Currently, only Q6AFE_LPASS_CLK_ROOT_DEFAULT is valid
  10328. * @values
  10329. * - 0 @tablebulletend
  10330. */
  10331. uint16_t clk_root;
  10332. /*
  10333. * for enable and disable clock.
  10334. * "clk_freq_in_hz", "clk_attri", and "clk_root"
  10335. * are ignored in disable clock case.
  10336. * @values
  10337. * - 0 -- Disabled
  10338. * - 1 -- Enabled @tablebulletend
  10339. */
  10340. uint32_t enable;
  10341. };
  10342. struct afe_clk_cfg {
  10343. /* Minor version used for tracking the version of the I2S
  10344. * configuration interface.
  10345. * Supported values: #AFE_API_VERSION_I2S_CONFIG
  10346. */
  10347. u32 i2s_cfg_minor_version;
  10348. /* clk value 1 in MHz. */
  10349. u32 clk_val1;
  10350. /* clk value 2 in MHz. */
  10351. u32 clk_val2;
  10352. /* clk_src
  10353. * #Q6AFE_LPASS_CLK_SRC_EXTERNAL
  10354. * #Q6AFE_LPASS_CLK_SRC_INTERNAL
  10355. */
  10356. u16 clk_src;
  10357. /* clk_root -0 for default */
  10358. u16 clk_root;
  10359. /* clk_set_mode
  10360. * #Q6AFE_LPASS_MODE_BOTH_INVALID
  10361. * #Q6AFE_LPASS_MODE_CLK1_VALID
  10362. * #Q6AFE_LPASS_MODE_CLK2_VALID
  10363. * #Q6AFE_LPASS_MODE_BOTH_VALID
  10364. */
  10365. u16 clk_set_mode;
  10366. /* This param id is used to configure I2S clk */
  10367. u16 reserved;
  10368. } __packed;
  10369. /* This param id is used to configure I2S clk */
  10370. #define AFE_PARAM_ID_LPAIF_CLK_CONFIG 0x00010238
  10371. #define AFE_MODULE_CLOCK_SET 0x0001028F
  10372. #define AFE_PARAM_ID_CLOCK_SET 0x00010290
  10373. struct afe_set_clk_drift {
  10374. /*
  10375. * Clock ID
  10376. * @values
  10377. * - 0x100 to 0x10E
  10378. * - 0x200 to 0x20C
  10379. * - 0x500 to 0x505
  10380. */
  10381. uint32_t clk_id;
  10382. /*
  10383. * Clock drift (in PPB) to be set.
  10384. * @values
  10385. * - need to get values from DSP team
  10386. */
  10387. int32_t clk_drift;
  10388. /*
  10389. * Clock rest.
  10390. * @values
  10391. * - 1 -- Reset PLL with the original frequency
  10392. * - 0 -- Adjust the clock with the clk drift value
  10393. */
  10394. uint32_t clk_reset;
  10395. } __packed;
  10396. /* This param id is used to adjust audio interface PLL*/
  10397. #define AFE_PARAM_ID_CLOCK_ADJUST 0x000102C6
  10398. enum afe_lpass_digital_clk_src {
  10399. Q6AFE_LPASS_DIGITAL_ROOT_INVALID,
  10400. Q6AFE_LPASS_DIGITAL_ROOT_PRI_MI2S_OSR,
  10401. Q6AFE_LPASS_DIGITAL_ROOT_SEC_MI2S_OSR,
  10402. Q6AFE_LPASS_DIGITAL_ROOT_TER_MI2S_OSR,
  10403. Q6AFE_LPASS_DIGITAL_ROOT_QUAD_MI2S_OSR,
  10404. Q6AFE_LPASS_DIGITAL_ROOT_CDC_ROOT_CLK,
  10405. } __packed;
  10406. /* This param id is used to configure internal clk */
  10407. #define AFE_PARAM_ID_INTERNAL_DIGIATL_CDC_CLK_CONFIG 0x00010239
  10408. struct afe_digital_clk_cfg {
  10409. /* Minor version used for tracking the version of the I2S
  10410. * configuration interface.
  10411. * Supported values: #AFE_API_VERSION_I2S_CONFIG
  10412. */
  10413. u32 i2s_cfg_minor_version;
  10414. /* clk value in MHz. */
  10415. u32 clk_val;
  10416. /* INVALID
  10417. * PRI_MI2S_OSR
  10418. * SEC_MI2S_OSR
  10419. * TER_MI2S_OSR
  10420. * QUAD_MI2S_OSR
  10421. * DIGT_CDC_ROOT
  10422. */
  10423. u16 clk_root;
  10424. /* This field must be set to zero. */
  10425. u16 reserved;
  10426. } __packed;
  10427. /*
  10428. * Opcode for AFE to start DTMF.
  10429. */
  10430. #define AFE_PORTS_CMD_DTMF_CTL 0x00010102
  10431. /** DTMF payload.*/
  10432. struct afe_dtmf_generation_command {
  10433. struct apr_hdr hdr;
  10434. /*
  10435. * Duration of the DTMF tone in ms.
  10436. * -1 -> continuous,
  10437. * 0 -> disable
  10438. */
  10439. int64_t duration_in_ms;
  10440. /*
  10441. * The DTMF high tone frequency.
  10442. */
  10443. uint16_t high_freq;
  10444. /*
  10445. * The DTMF low tone frequency.
  10446. */
  10447. uint16_t low_freq;
  10448. /*
  10449. * The DTMF volume setting
  10450. */
  10451. uint16_t gain;
  10452. /*
  10453. * The number of ports to enable/disable on.
  10454. */
  10455. uint16_t num_ports;
  10456. /*
  10457. * The Destination ports - array .
  10458. * For DTMF on multiple ports, portIds needs to
  10459. * be populated numPorts times.
  10460. */
  10461. uint16_t port_ids;
  10462. /*
  10463. * variable for 32 bit alignment of APR packet.
  10464. */
  10465. uint16_t reserved;
  10466. } __packed;
  10467. enum afe_config_type {
  10468. AFE_SLIMBUS_SLAVE_PORT_CONFIG,
  10469. AFE_SLIMBUS_SLAVE_CONFIG,
  10470. AFE_CDC_REGISTERS_CONFIG,
  10471. AFE_AANC_VERSION,
  10472. AFE_CDC_CLIP_REGISTERS_CONFIG,
  10473. AFE_CLIP_BANK_SEL,
  10474. AFE_CDC_REGISTER_PAGE_CONFIG,
  10475. AFE_MAX_CONFIG_TYPES,
  10476. };
  10477. struct afe_param_slimbus_slave_port_cfg {
  10478. uint32_t minor_version;
  10479. uint16_t slimbus_dev_id;
  10480. uint16_t slave_dev_pgd_la;
  10481. uint16_t slave_dev_intfdev_la;
  10482. uint16_t bit_width;
  10483. uint16_t data_format;
  10484. uint16_t num_channels;
  10485. uint16_t slave_port_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT];
  10486. } __packed;
  10487. struct afe_param_cdc_slimbus_slave_cfg {
  10488. uint32_t minor_version;
  10489. uint32_t device_enum_addr_lsw;
  10490. uint32_t device_enum_addr_msw;
  10491. uint16_t tx_slave_port_offset;
  10492. uint16_t rx_slave_port_offset;
  10493. } __packed;
  10494. struct afe_param_cdc_reg_cfg {
  10495. uint32_t minor_version;
  10496. uint32_t reg_logical_addr;
  10497. uint32_t reg_field_type;
  10498. uint32_t reg_field_bit_mask;
  10499. uint16_t reg_bit_width;
  10500. uint16_t reg_offset_scale;
  10501. } __packed;
  10502. #define AFE_API_VERSION_CDC_REG_PAGE_CFG 1
  10503. enum {
  10504. AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_0 = 0,
  10505. AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_1,
  10506. AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_2,
  10507. AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_3,
  10508. };
  10509. struct afe_param_cdc_reg_page_cfg {
  10510. uint32_t minor_version;
  10511. uint32_t enable;
  10512. uint32_t proc_id;
  10513. } __packed;
  10514. struct afe_param_cdc_reg_cfg_data {
  10515. uint32_t num_registers;
  10516. struct afe_param_cdc_reg_cfg *reg_data;
  10517. } __packed;
  10518. struct afe_svc_cmd_set_param_v1 {
  10519. /* APR Header */
  10520. struct apr_hdr apr_hdr;
  10521. /* The total size of the payload, including param_hdr_v3 */
  10522. uint32_t payload_size;
  10523. /* The memory mapping header to be used when sending outband */
  10524. struct mem_mapping_hdr mem_hdr;
  10525. /* The parameter data to be filled when sent inband */
  10526. u32 param_data[0];
  10527. } __packed;
  10528. struct afe_svc_cmd_set_param_v2 {
  10529. /* APR Header */
  10530. struct apr_hdr apr_hdr;
  10531. /* The memory mapping header to be used when sending outband */
  10532. struct mem_mapping_hdr mem_hdr;
  10533. /* The total size of the payload, including param_hdr_v3 */
  10534. u32 payload_size;
  10535. /* The parameter data to be filled when sent inband */
  10536. u32 param_data[0];
  10537. } __packed;
  10538. struct afe_param_hw_mad_ctrl {
  10539. uint32_t minor_version;
  10540. uint16_t mad_type;
  10541. uint16_t mad_enable;
  10542. } __packed;
  10543. struct afe_port_cmd_set_aanc_acdb_table {
  10544. struct apr_hdr hdr;
  10545. struct mem_mapping_hdr mem_hdr;
  10546. } __packed;
  10547. /* Dolby DAP topology */
  10548. #define DOLBY_ADM_COPP_TOPOLOGY_ID 0x0001033B
  10549. #define DS2_ADM_COPP_TOPOLOGY_ID 0x1301033B
  10550. /* RMS value from DSP */
  10551. #define RMS_MODULEID_APPI_PASSTHRU 0x10009011
  10552. #define RMS_PARAM_FIRST_SAMPLE 0x10009012
  10553. #define RMS_PAYLOAD_LEN 4
  10554. /* Customized mixing in matix mixer */
  10555. #define MTMX_MODULE_ID_DEFAULT_CHMIXER 0x00010341
  10556. #define DEFAULT_CHMIXER_PARAM_ID_COEFF 0x00010342
  10557. #define CUSTOM_STEREO_PAYLOAD_SIZE 9
  10558. #define CUSTOM_STEREO_CMD_PARAM_SIZE 24
  10559. #define CUSTOM_STEREO_NUM_OUT_CH 0x0002
  10560. #define CUSTOM_STEREO_NUM_IN_CH 0x0002
  10561. #define CUSTOM_STEREO_INDEX_PARAM 0x0002
  10562. #define Q14_GAIN_ZERO_POINT_FIVE 0x2000
  10563. #define Q14_GAIN_UNITY 0x4000
  10564. /* Ultrasound supported formats */
  10565. #define US_POINT_EPOS_FORMAT_V2 0x0001272D
  10566. #define US_RAW_FORMAT_V2 0x0001272C
  10567. #define US_PROX_FORMAT_V4 0x0001273B
  10568. #define US_RAW_SYNC_FORMAT 0x0001272F
  10569. #define US_GES_SYNC_FORMAT 0x00012730
  10570. #define AFE_MODULE_GROUP_DEVICE 0x00010254
  10571. #define AFE_PARAM_ID_GROUP_DEVICE_CFG 0x00010255
  10572. #define AFE_PARAM_ID_GROUP_DEVICE_ENABLE 0x00010256
  10573. #define AFE_GROUP_DEVICE_ID_SECONDARY_MI2S_RX 0x1102
  10574. /* Payload of the #AFE_PARAM_ID_GROUP_DEVICE_CFG
  10575. * parameter, which configures max of 8 AFE ports
  10576. * into a group.
  10577. * The fixed size of this structure is sixteen bytes.
  10578. */
  10579. struct afe_group_device_group_cfg {
  10580. u32 minor_version;
  10581. u16 group_id;
  10582. u16 num_channels;
  10583. u16 port_id[8];
  10584. } __packed;
  10585. #define AFE_GROUP_DEVICE_ID_PRIMARY_TDM_RX \
  10586. (AFE_PORT_ID_PRIMARY_TDM_RX + 0x100)
  10587. #define AFE_GROUP_DEVICE_ID_PRIMARY_TDM_TX \
  10588. (AFE_PORT_ID_PRIMARY_TDM_TX + 0x100)
  10589. #define AFE_GROUP_DEVICE_ID_SECONDARY_TDM_RX \
  10590. (AFE_PORT_ID_SECONDARY_TDM_RX + 0x100)
  10591. #define AFE_GROUP_DEVICE_ID_SECONDARY_TDM_TX \
  10592. (AFE_PORT_ID_SECONDARY_TDM_TX + 0x100)
  10593. #define AFE_GROUP_DEVICE_ID_TERTIARY_TDM_RX \
  10594. (AFE_PORT_ID_TERTIARY_TDM_RX + 0x100)
  10595. #define AFE_GROUP_DEVICE_ID_TERTIARY_TDM_TX \
  10596. (AFE_PORT_ID_TERTIARY_TDM_TX + 0x100)
  10597. #define AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_RX \
  10598. (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x100)
  10599. #define AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_TX \
  10600. (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x100)
  10601. #define AFE_GROUP_DEVICE_ID_QUINARY_TDM_RX \
  10602. (AFE_PORT_ID_QUINARY_TDM_RX + 0x100)
  10603. #define AFE_GROUP_DEVICE_ID_QUINARY_TDM_TX \
  10604. (AFE_PORT_ID_QUINARY_TDM_TX + 0x100)
  10605. #define AFE_GROUP_DEVICE_ID_SENARY_TDM_RX \
  10606. (AFE_PORT_ID_SENARY_TDM_RX + 0x100)
  10607. #define AFE_GROUP_DEVICE_ID_SENARY_TDM_TX \
  10608. (AFE_PORT_ID_SENARY_TDM_TX + 0x100)
  10609. /* ID of the parameter used by #AFE_MODULE_GROUP_DEVICE to configure the
  10610. * group device. #AFE_SVC_CMD_SET_PARAM can use this parameter ID.
  10611. *
  10612. * Requirements:
  10613. * - Configure the group before the member ports in the group are
  10614. * configured and started.
  10615. * - Enable the group only after it is configured.
  10616. * - Stop all member ports in the group before disabling the group.
  10617. */
  10618. #define AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG 0x0001029E
  10619. /* Version information used to handle future additions to
  10620. * AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG processing (for backward compatibility).
  10621. */
  10622. #define AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG 0x1
  10623. /* Number of AFE ports in group device */
  10624. #define AFE_GROUP_DEVICE_NUM_PORTS 8
  10625. /* Payload of the AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG parameter ID
  10626. * used by AFE_MODULE_GROUP_DEVICE.
  10627. */
  10628. struct afe_param_id_group_device_tdm_cfg {
  10629. u32 group_device_cfg_minor_version;
  10630. /* Minor version used to track group device configuration.
  10631. * @values #AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG
  10632. */
  10633. u16 group_id;
  10634. /* ID for the group device.
  10635. * @values
  10636. * - #AFE_GROUP_DEVICE_ID_PRIMARY_TDM_RX
  10637. * - #AFE_GROUP_DEVICE_ID_PRIMARY_TDM_TX
  10638. * - #AFE_GROUP_DEVICE_ID_SECONDARY_TDM_RX
  10639. * - #AFE_GROUP_DEVICE_ID_SECONDARY_TDM_TX
  10640. * - #AFE_GROUP_DEVICE_ID_TERTIARY_TDM_RX
  10641. * - #AFE_GROUP_DEVICE_ID_TERTIARY_TDM_TX
  10642. * - #AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_RX
  10643. * - #AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_TX
  10644. */
  10645. u16 reserved;
  10646. /* 0 */
  10647. u16 port_id[AFE_GROUP_DEVICE_NUM_PORTS];
  10648. /* Array of member port IDs of this group.
  10649. * @values
  10650. * - #AFE_PORT_ID_PRIMARY_TDM_RX
  10651. * - #AFE_PORT_ID_PRIMARY_TDM_RX_1
  10652. * - #AFE_PORT_ID_PRIMARY_TDM_RX_2
  10653. * - #AFE_PORT_ID_PRIMARY_TDM_RX_3
  10654. * - #AFE_PORT_ID_PRIMARY_TDM_RX_4
  10655. * - #AFE_PORT_ID_PRIMARY_TDM_RX_5
  10656. * - #AFE_PORT_ID_PRIMARY_TDM_RX_6
  10657. * - #AFE_PORT_ID_PRIMARY_TDM_RX_7
  10658. * - #AFE_PORT_ID_PRIMARY_TDM_TX
  10659. * - #AFE_PORT_ID_PRIMARY_TDM_TX_1
  10660. * - #AFE_PORT_ID_PRIMARY_TDM_TX_2
  10661. * - #AFE_PORT_ID_PRIMARY_TDM_TX_3
  10662. * - #AFE_PORT_ID_PRIMARY_TDM_TX_4
  10663. * - #AFE_PORT_ID_PRIMARY_TDM_TX_5
  10664. * - #AFE_PORT_ID_PRIMARY_TDM_TX_6
  10665. * - #AFE_PORT_ID_PRIMARY_TDM_TX_7
  10666. * - #AFE_PORT_ID_SECONDARY_TDM_RX
  10667. * - #AFE_PORT_ID_SECONDARY_TDM_RX_1
  10668. * - #AFE_PORT_ID_SECONDARY_TDM_RX_2
  10669. * - #AFE_PORT_ID_SECONDARY_TDM_RX_3
  10670. * - #AFE_PORT_ID_SECONDARY_TDM_RX_4
  10671. * - #AFE_PORT_ID_SECONDARY_TDM_RX_5
  10672. * - #AFE_PORT_ID_SECONDARY_TDM_RX_6
  10673. * - #AFE_PORT_ID_SECONDARY_TDM_RX_7
  10674. * - #AFE_PORT_ID_SECONDARY_TDM_TX
  10675. * - #AFE_PORT_ID_SECONDARY_TDM_TX_1
  10676. * - #AFE_PORT_ID_SECONDARY_TDM_TX_2
  10677. * - #AFE_PORT_ID_SECONDARY_TDM_TX_3
  10678. * - #AFE_PORT_ID_SECONDARY_TDM_TX_4
  10679. * - #AFE_PORT_ID_SECONDARY_TDM_TX_5
  10680. * - #AFE_PORT_ID_SECONDARY_TDM_TX_6
  10681. * - #AFE_PORT_ID_SECONDARY_TDM_TX_7
  10682. * - #AFE_PORT_ID_TERTIARY_TDM_RX
  10683. * - #AFE_PORT_ID_TERTIARY_TDM_RX_1
  10684. * - #AFE_PORT_ID_TERTIARY_TDM_RX_2
  10685. * - #AFE_PORT_ID_TERTIARY_TDM_RX_3
  10686. * - #AFE_PORT_ID_TERTIARY_TDM_RX_4
  10687. * - #AFE_PORT_ID_TERTIARY_TDM_RX_5
  10688. * - #AFE_PORT_ID_TERTIARY_TDM_RX_6
  10689. * - #AFE_PORT_ID_TERTIARY_TDM_RX_7
  10690. * - #AFE_PORT_ID_TERTIARY_TDM_TX
  10691. * - #AFE_PORT_ID_TERTIARY_TDM_TX_1
  10692. * - #AFE_PORT_ID_TERTIARY_TDM_TX_2
  10693. * - #AFE_PORT_ID_TERTIARY_TDM_TX_3
  10694. * - #AFE_PORT_ID_TERTIARY_TDM_TX_4
  10695. * - #AFE_PORT_ID_TERTIARY_TDM_TX_5
  10696. * - #AFE_PORT_ID_TERTIARY_TDM_TX_6
  10697. * - #AFE_PORT_ID_TERTIARY_TDM_TX_7
  10698. * - #AFE_PORT_ID_QUATERNARY_TDM_RX
  10699. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_1
  10700. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_2
  10701. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_3
  10702. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_4
  10703. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_5
  10704. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_6
  10705. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_7
  10706. * - #AFE_PORT_ID_QUATERNARY_TDM_TX
  10707. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_1
  10708. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_2
  10709. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_3
  10710. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_4
  10711. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_5
  10712. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_6
  10713. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_7
  10714. * @tablebulletend
  10715. */
  10716. u32 num_channels;
  10717. /* Number of enabled slots for TDM frame.
  10718. * @values 1 to 8
  10719. */
  10720. u32 sample_rate;
  10721. /* Sampling rate of the port.
  10722. * @values
  10723. * - #AFE_PORT_SAMPLE_RATE_8K
  10724. * - #AFE_PORT_SAMPLE_RATE_16K
  10725. * - #AFE_PORT_SAMPLE_RATE_24K
  10726. * - #AFE_PORT_SAMPLE_RATE_32K
  10727. * - #AFE_PORT_SAMPLE_RATE_48K @tablebulletend
  10728. */
  10729. u32 bit_width;
  10730. /* Bit width of the sample.
  10731. * @values 16, 24, (32)
  10732. */
  10733. u16 nslots_per_frame;
  10734. /* Number of slots per frame. Typical : 1, 2, 4, 8, 16, 32.
  10735. * @values 1 - 32
  10736. */
  10737. u16 slot_width;
  10738. /* Slot width of the slot in a TDM frame. (slot_width >= bit_width)
  10739. * have to be satisfied.
  10740. * @values 16, 24, 32
  10741. */
  10742. u32 slot_mask;
  10743. /* Position of active slots. When that bit is set, that paricular
  10744. * slot is active.
  10745. * Number of active slots can be inferred by number of bits set in
  10746. * the mask. Only 8 individual bits can be enabled.
  10747. * Bits 0..31 corresponding to slot 0..31
  10748. * @values 1 to 2^32 -1
  10749. */
  10750. } __packed;
  10751. /* Payload of the #AFE_PARAM_ID_GROUP_DEVICE_ENABLE
  10752. * parameter, which enables or
  10753. * disables any module.
  10754. * The fixed size of this structure is four bytes.
  10755. */
  10756. struct afe_group_device_enable {
  10757. u16 group_id;
  10758. /* valid value is AFE_GROUP_DEVICE_ID_SECONDARY_MI2S_RX */
  10759. u16 enable;
  10760. /* Enables (1) or disables (0) the module. */
  10761. } __packed;
  10762. union afe_port_group_config {
  10763. struct afe_group_device_group_cfg group_cfg;
  10764. struct afe_group_device_enable group_enable;
  10765. struct afe_param_id_group_device_tdm_cfg tdm_cfg;
  10766. } __packed;
  10767. /* ID of the parameter used by #AFE_MODULE_AUDIO_DEV_INTERFACE to specify
  10768. * the timing statistics of the corresponding device interface.
  10769. * Client can periodically query for the device time statistics to help adjust
  10770. * the PLL based on the drift value. The get param command must be sent to
  10771. * AFE port ID corresponding to device interface
  10772. * This parameter ID supports following get param commands:
  10773. * #AFE_PORT_CMD_GET_PARAM_V2 and
  10774. * #AFE_PORT_CMD_GET_PARAM_V3.
  10775. */
  10776. #define AFE_PARAM_ID_DEV_TIMING_STATS 0x000102AD
  10777. /* Version information used to handle future additions to AFE device
  10778. * interface timing statistics (for backward compatibility).
  10779. */
  10780. #define AFE_API_VERSION_DEV_TIMING_STATS 0x1
  10781. /* Enumeration for specifying a sink(Rx) device */
  10782. #define AFE_SINK_DEVICE 0x0
  10783. /* Enumeration for specifying a source(Tx) device */
  10784. #define AFE_SOURCE_DEVICE 0x1
  10785. /* Enumeration for specifying the drift reference is of type AV Timer */
  10786. #define AFE_REF_TIMER_TYPE_AVTIMER 0x0
  10787. /* Message payload structure for the
  10788. * AFE_PARAM_ID_DEV_TIMING_STATS parameter.
  10789. */
  10790. struct afe_param_id_dev_timing_stats {
  10791. /* Minor version used to track the version of device interface timing
  10792. * statistics. Currently, the supported version is 1.
  10793. * @values #AFE_API_VERSION_DEV_TIMING_STATS
  10794. */
  10795. u32 minor_version;
  10796. /* Indicates the device interface direction as either
  10797. * source (Tx) or sink (Rx).
  10798. * @values
  10799. * #AFE_SINK_DEVICE
  10800. * #AFE_SOURCE_DEVICE
  10801. */
  10802. u16 device_direction;
  10803. /* Reference timer for drift accumulation and time stamp information.
  10804. * @values
  10805. * #AFE_REF_TIMER_TYPE_AVTIMER @tablebulletend
  10806. */
  10807. u16 reference_timer;
  10808. /*
  10809. * Flag to indicate if resync is required on the client side for
  10810. * drift correction. Flag is set to TRUE for the first get_param
  10811. * response after device interface starts. This flag value can be
  10812. * used by client to identify if device interface restart has
  10813. * happened and if any re-sync is required at their end for drift
  10814. * correction.
  10815. * @values
  10816. * 0: FALSE (Resync not required)
  10817. * 1: TRUE (Resync required) @tablebulletend
  10818. */
  10819. u32 resync_flag;
  10820. /* Accumulated drift value in microseconds. This value is updated
  10821. * every 100th ms.
  10822. * Positive drift value indicates AV timer is running faster than device
  10823. * Negative drift value indicates AV timer is running slower than device
  10824. * @values Any valid int32 number
  10825. */
  10826. s32 acc_drift_value;
  10827. /* Lower 32 bits of the 64-bit absolute timestamp of reference
  10828. * timer in microseconds.
  10829. * This timestamp corresponds to the time when the drift values
  10830. * are accumlated for every 100th ms.
  10831. * @values Any valid uint32 number
  10832. */
  10833. u32 ref_timer_abs_ts_lsw;
  10834. /* Upper 32 bits of the 64-bit absolute timestamp of reference
  10835. * timer in microseconds.
  10836. * This timestamp corresponds to the time when the drift values
  10837. * are accumlated for every 100th ms.
  10838. * @values Any valid uint32 number
  10839. */
  10840. u32 ref_timer_abs_ts_msw;
  10841. } __packed;
  10842. struct afe_av_dev_drift_get_param_resp {
  10843. uint32_t status;
  10844. struct param_hdr_v3 pdata;
  10845. struct afe_param_id_dev_timing_stats timing_stats;
  10846. } __packed;
  10847. /* Command for Matrix or Stream Router */
  10848. #define ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2 0x00010DCE
  10849. /* Module for AVSYNC */
  10850. #define ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC 0x00010DC6
  10851. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to specify the
  10852. * render window start value. This parameter is supported only for a Set
  10853. * command (not a Get command) in the Rx direction
  10854. * (#ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2).
  10855. * Render window start is a value (session time minus timestamp, or ST-TS)
  10856. * below which frames are held, and after which frames are immediately
  10857. * rendered.
  10858. */
  10859. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_START_V2 0x00010DD1
  10860. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to specify the
  10861. * render window end value. This parameter is supported only for a Set
  10862. * command (not a Get command) in the Rx direction
  10863. * (#ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2). Render window end is a value
  10864. * (session time minus timestamp) above which frames are dropped, and below
  10865. * which frames are immediately rendered.
  10866. */
  10867. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_END_V2 0x00010DD2
  10868. /* Generic payload of the window parameters in the
  10869. * #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC module.
  10870. * This payload is supported only for a Set command
  10871. * (not a Get command) on the Rx path.
  10872. */
  10873. struct asm_session_mtmx_strtr_param_window_v2_t {
  10874. u32 window_lsw;
  10875. /* Lower 32 bits of the render window start value. */
  10876. u32 window_msw;
  10877. /* Upper 32 bits of the render window start value.
  10878. *
  10879. * The 64-bit number formed by window_lsw and window_msw specifies a
  10880. * signed 64-bit window value in microseconds. The sign extension is
  10881. * necessary. This value is used by the following parameter IDs:
  10882. * #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_START_V2
  10883. * #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_END_V2
  10884. * #ASM_SESSION_MTMX_STRTR_PARAM_STAT_WINDOW_START_V2
  10885. * #ASM_SESSION_MTMX_STRTR_PARAM_STAT_WINDOW_END_V2
  10886. * The value depends on which parameter ID is used.
  10887. * The aDSP honors the windows at a granularity of 1 ms.
  10888. */
  10889. };
  10890. struct asm_session_cmd_set_mtmx_strstr_params_v2 {
  10891. uint32_t data_payload_addr_lsw;
  10892. /* Lower 32 bits of the 64-bit data payload address. */
  10893. uint32_t data_payload_addr_msw;
  10894. /* Upper 32 bits of the 64-bit data payload address.
  10895. * If the address is not sent (NULL), the message is in the payload.
  10896. * If the address is sent (non-NULL), the parameter data payloads
  10897. * begin at the specified address.
  10898. */
  10899. uint32_t mem_map_handle;
  10900. /* Unique identifier for an address. This memory map handle is returned
  10901. * by the aDSP through the #ASM_CMD_SHARED_MEM_MAP_REGIONS command.
  10902. * values
  10903. * - NULL -- Parameter data payloads are within the message payload
  10904. * (in-band).
  10905. * - Non-NULL -- Parameter data payloads begin at the address specified
  10906. * in the data_payload_addr_lsw and data_payload_addr_msw fields
  10907. * (out-of-band).
  10908. */
  10909. uint32_t data_payload_size;
  10910. /* Actual size of the variable payload accompanying the message, or in
  10911. * shared memory. This field is used for parsing the parameter payload.
  10912. * values > 0 bytes
  10913. */
  10914. uint32_t direction;
  10915. /* Direction of the entity (matrix mixer or stream router) on which
  10916. * the parameter is to be set.
  10917. * values
  10918. * - 0 -- Rx (for Rx stream router or Rx matrix mixer)
  10919. * - 1 -- Tx (for Tx stream router or Tx matrix mixer)
  10920. */
  10921. };
  10922. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC which allows the
  10923. * audio client choose the rendering decision that the audio DSP should use.
  10924. */
  10925. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_MODE_CMD 0x00012F0D
  10926. /* Indicates that rendering decision will be based on default rate
  10927. * (session clock based rendering, device driven).
  10928. * 1. The default session clock based rendering is inherently driven
  10929. * by the timing of the device.
  10930. * 2. After the initial decision is made (first buffer after a run
  10931. * command), subsequent data rendering decisions are made with
  10932. * respect to the rate at which the device is rendering, thus deriving
  10933. * its timing from the device.
  10934. * 3. While this decision making is simple, it has some inherent limitations
  10935. * (mentioned in the next section).
  10936. * 4. If this API is not set, the session clock based rendering will be assumed
  10937. * and this will ensure that the DSP is backward compatible.
  10938. */
  10939. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_DEFAULT 0
  10940. /* Indicates that rendering decision will be based on local clock rate.
  10941. * 1. In the DSP loopback/client loopback use cases (frame based
  10942. * inputs), the incoming data into audio DSP is time-stamped at the
  10943. * local clock rate (STC).
  10944. * 2. This TS rate may match the incoming data rate or maybe different
  10945. * from the incoming data rate.
  10946. * 3. Regardless, the data will be time-stamped with local STC and
  10947. * therefore, the client is recommended to set this mode for these
  10948. * use cases. This method is inherently more robust to sequencing
  10949. * (AFE Start/Stop) and device switches, among other benefits.
  10950. * 4. This API will inform the DSP to compare every incoming buffer TS
  10951. * against local STC.
  10952. * 5. DSP will continue to honor render windows APIs, as before.
  10953. */
  10954. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_LOCAL_STC 1
  10955. /* Structure for rendering decision parameter */
  10956. struct asm_session_mtmx_strtr_param_render_mode_t {
  10957. /* Specifies the type of rendering decision the audio DSP should use.
  10958. *
  10959. * @values
  10960. * - #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_DEFAULT
  10961. * - #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_LOCAL_STC
  10962. */
  10963. u32 flags;
  10964. } __packed;
  10965. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC which allows the
  10966. * audio client to specify the clock recovery mechanism that the audio DSP
  10967. * should use.
  10968. */
  10969. #define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_CMD 0x00012F0E
  10970. /* Indicates that default clock recovery will be used (no clock recovery).
  10971. * If the client wishes that no clock recovery be done, the client can
  10972. * choose this. This means that no attempt will made by the DSP to try and
  10973. * match the rates of the input and output audio.
  10974. */
  10975. #define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_NONE 0
  10976. /* Indicates that independent clock recovery needs to be used.
  10977. * 1. In the DSP loopback/client loopback use cases (frame based inputs),
  10978. * the client should choose the independent clock recovery option.
  10979. * 2. This basically de-couples the audio and video from knowing each others
  10980. * clock sources and lets the audio DSP independently rate match the input
  10981. * and output rates.
  10982. * 3. After drift detection, the drift correction is achieved by either pulling
  10983. * the PLLs (if applicable) or by stream to device rate matching
  10984. * (for PCM use cases) by comparing drift with respect to STC.
  10985. * 4. For passthrough use cases, since the PLL pulling is the only option,
  10986. * a best effort will be made.
  10987. * If PLL pulling is not possible / available, the rendering will be
  10988. * done without rate matching.
  10989. */
  10990. #define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_AUTO 1
  10991. /* Payload of the #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC parameter.
  10992. */
  10993. struct asm_session_mtmx_strtr_param_clk_rec_t {
  10994. /* Specifies the type of clock recovery that the audio DSP should
  10995. * use for rate matching.
  10996. */
  10997. /* @values
  10998. * #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_DEFAULT
  10999. * #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_INDEPENDENT
  11000. */
  11001. u32 flags;
  11002. } __packed;
  11003. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to
  11004. * realize smoother adjustment of audio session clock for a specified session.
  11005. * The desired audio session clock adjustment(in micro seconds) is specified
  11006. * using the command #ASM_SESSION_CMD_ADJUST_SESSION_CLOCK_V2.
  11007. * Delaying/Advancing the session clock would be implemented by inserting
  11008. * interpolated/dropping audio samples in the playback path respectively.
  11009. * Also, this parameter has to be configured before the Audio Session is put
  11010. * to RUN state to avoid cold start latency/glitches in the playback.
  11011. */
  11012. #define ASM_SESSION_MTMX_PARAM_ADJUST_SESSION_TIME_CTL 0x00013217
  11013. struct asm_session_mtmx_param_adjust_session_time_ctl_t {
  11014. /* Specifies whether the module is enabled or not
  11015. * @values
  11016. * 0 -- disabled
  11017. * 1 -- enabled
  11018. */
  11019. u32 enable;
  11020. };
  11021. union asm_session_mtmx_strtr_param_config {
  11022. struct asm_session_mtmx_strtr_param_window_v2_t window_param;
  11023. struct asm_session_mtmx_strtr_param_render_mode_t render_param;
  11024. struct asm_session_mtmx_strtr_param_clk_rec_t clk_rec_param;
  11025. struct asm_session_mtmx_param_adjust_session_time_ctl_t adj_time_param;
  11026. } __packed;
  11027. struct asm_mtmx_strtr_params {
  11028. struct apr_hdr hdr;
  11029. struct asm_session_cmd_set_mtmx_strstr_params_v2 param;
  11030. struct param_hdr_v1 data;
  11031. union asm_session_mtmx_strtr_param_config config;
  11032. } __packed;
  11033. #define ASM_SESSION_CMD_GET_MTMX_STRTR_PARAMS_V2 0x00010DCF
  11034. #define ASM_SESSION_CMDRSP_GET_MTMX_STRTR_PARAMS_V2 0x00010DD0
  11035. #define ASM_SESSION_MTMX_STRTR_PARAM_SESSION_TIME_V3 0x00012F0B
  11036. #define ASM_SESSION_MTMX_STRTR_PARAM_STIME_TSTMP_FLG_BMASK (0x80000000UL)
  11037. struct asm_session_cmd_get_mtmx_strstr_params_v2 {
  11038. uint32_t data_payload_addr_lsw;
  11039. /* Lower 32 bits of the 64-bit data payload address. */
  11040. uint32_t data_payload_addr_msw;
  11041. /*
  11042. * Upper 32 bits of the 64-bit data payload address.
  11043. * If the address is not sent (NULL), the message is in the payload.
  11044. * If the address is sent (non-NULL), the parameter data payloads
  11045. * begin at the specified address.
  11046. */
  11047. uint32_t mem_map_handle;
  11048. /*
  11049. * Unique identifier for an address. This memory map handle is returned
  11050. * by the aDSP through the #ASM_CMD_SHARED_MEM_MAP_REGIONS command.
  11051. * values
  11052. * - NULL -- Parameter data payloads are within the message payload
  11053. * (in-band).
  11054. * - Non-NULL -- Parameter data payloads begin at the address specified
  11055. * in the data_payload_addr_lsw and data_payload_addr_msw fields
  11056. * (out-of-band).
  11057. */
  11058. uint32_t direction;
  11059. /*
  11060. * Direction of the entity (matrix mixer or stream router) on which
  11061. * the parameter is to be set.
  11062. * values
  11063. * - 0 -- Rx (for Rx stream router or Rx matrix mixer)
  11064. * - 1 -- Tx (for Tx stream router or Tx matrix mixer)
  11065. */
  11066. uint32_t module_id;
  11067. /* Unique module ID. */
  11068. uint32_t param_id;
  11069. /* Unique parameter ID. */
  11070. uint32_t param_max_size;
  11071. };
  11072. struct asm_session_mtmx_strtr_param_session_time_v3_t {
  11073. uint32_t session_time_lsw;
  11074. /* Lower 32 bits of the current session time in microseconds */
  11075. uint32_t session_time_msw;
  11076. /*
  11077. * Upper 32 bits of the current session time in microseconds.
  11078. * The 64-bit number formed by session_time_lsw and session_time_msw
  11079. * is treated as signed.
  11080. */
  11081. uint32_t absolute_time_lsw;
  11082. /*
  11083. * Lower 32 bits of the 64-bit absolute time in microseconds.
  11084. * This is the time when the sample corresponding to the
  11085. * session_time_lsw is rendered to the hardware. This absolute
  11086. * time can be slightly in the future or past.
  11087. */
  11088. uint32_t absolute_time_msw;
  11089. /*
  11090. * Upper 32 bits of the 64-bit absolute time in microseconds.
  11091. * This is the time when the sample corresponding to the
  11092. * session_time_msw is rendered to hardware. This absolute
  11093. * time can be slightly in the future or past. The 64-bit number
  11094. * formed by absolute_time_lsw and absolute_time_msw is treated as
  11095. * unsigned.
  11096. */
  11097. uint32_t time_stamp_lsw;
  11098. /* Lower 32 bits of the last processed timestamp in microseconds */
  11099. uint32_t time_stamp_msw;
  11100. /*
  11101. * Upper 32 bits of the last processed timestamp in microseconds.
  11102. * The 64-bit number formed by time_stamp_lsw and time_stamp_lsw
  11103. * is treated as unsigned.
  11104. */
  11105. uint32_t flags;
  11106. /*
  11107. * Keeps track of any additional flags needed.
  11108. * @values{for bit 31}
  11109. * - 0 -- Uninitialized/invalid
  11110. * - 1 -- Valid
  11111. * All other bits are reserved; clients must set them to zero.
  11112. */
  11113. };
  11114. union asm_session_mtmx_strtr_data_type {
  11115. struct asm_session_mtmx_strtr_param_session_time_v3_t session_time;
  11116. };
  11117. struct asm_mtmx_strtr_get_params {
  11118. struct apr_hdr hdr;
  11119. struct asm_session_cmd_get_mtmx_strstr_params_v2 param_info;
  11120. } __packed;
  11121. struct asm_mtmx_strtr_get_params_cmdrsp {
  11122. uint32_t err_code;
  11123. struct param_hdr_v1 param_info;
  11124. union asm_session_mtmx_strtr_data_type param_data;
  11125. } __packed;
  11126. #define AUDPROC_MODULE_ID_RESAMPLER 0x00010719
  11127. enum {
  11128. LEGACY_PCM = 0,
  11129. COMPRESSED_PASSTHROUGH,
  11130. COMPRESSED_PASSTHROUGH_CONVERT,
  11131. COMPRESSED_PASSTHROUGH_DSD,
  11132. LISTEN,
  11133. COMPRESSED_PASSTHROUGH_GEN,
  11134. COMPRESSED_PASSTHROUGH_IEC61937
  11135. };
  11136. #define AUDPROC_MODULE_ID_COMPRESSED_MUTE 0x00010770
  11137. #define AUDPROC_PARAM_ID_COMPRESSED_MUTE 0x00010771
  11138. struct adm_set_compressed_device_mute {
  11139. u32 mute_on;
  11140. } __packed;
  11141. #define AUDPROC_MODULE_ID_COMPRESSED_LATENCY 0x0001076E
  11142. #define AUDPROC_PARAM_ID_COMPRESSED_LATENCY 0x0001076F
  11143. struct adm_set_compressed_device_latency {
  11144. u32 latency;
  11145. } __packed;
  11146. #define VOICEPROC_MODULE_ID_GENERIC_TX 0x00010EF6
  11147. #define VOICEPROC_MODULE_ID_FLUENCE_PRO_VC_TX 0x00010F35
  11148. #define VOICEPROC_PARAM_ID_FLUENCE_SOUNDFOCUS 0x00010E37
  11149. #define VOICEPROC_PARAM_ID_FLUENCE_SOURCETRACKING 0x00010E38
  11150. #define MAX_SECTORS 8
  11151. #define MAX_NOISE_SOURCE_INDICATORS 3
  11152. #define MAX_POLAR_ACTIVITY_INDICATORS 360
  11153. #define MAX_DOA_TRACKING_ANGLES 2
  11154. struct sound_focus_param {
  11155. uint16_t start_angle[MAX_SECTORS];
  11156. uint8_t enable[MAX_SECTORS];
  11157. uint16_t gain_step;
  11158. } __packed;
  11159. struct source_tracking_param {
  11160. uint8_t vad[MAX_SECTORS];
  11161. uint16_t doa_speech;
  11162. uint16_t doa_noise[MAX_NOISE_SOURCE_INDICATORS];
  11163. uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
  11164. } __packed;
  11165. struct doa_tracking_mon_param {
  11166. uint16_t target_angle_L16[MAX_DOA_TRACKING_ANGLES];
  11167. uint16_t interf_angle_L16[MAX_DOA_TRACKING_ANGLES];
  11168. uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
  11169. } __packed;
  11170. struct adm_param_fluence_soundfocus_t {
  11171. uint16_t start_angles[MAX_SECTORS];
  11172. uint8_t enables[MAX_SECTORS];
  11173. uint16_t gain_step;
  11174. uint16_t reserved;
  11175. } __packed;
  11176. struct adm_param_fluence_sourcetracking_t {
  11177. uint8_t vad[MAX_SECTORS];
  11178. uint16_t doa_speech;
  11179. uint16_t doa_noise[MAX_NOISE_SOURCE_INDICATORS];
  11180. uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
  11181. } __packed;
  11182. struct adm_param_doa_tracking_mon_t {
  11183. uint16_t target_angle_L16[MAX_DOA_TRACKING_ANGLES];
  11184. uint16_t interf_angle_L16[MAX_DOA_TRACKING_ANGLES];
  11185. uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
  11186. } __packed;
  11187. struct afe_doa_tracking_mon_get_param_resp {
  11188. uint32_t status;
  11189. struct param_hdr_v3 pdata;
  11190. struct doa_tracking_mon_param doa;
  11191. } __packed;
  11192. #define AUDPROC_MODULE_ID_AUDIOSPHERE 0x00010916
  11193. #define AUDPROC_PARAM_ID_AUDIOSPHERE_ENABLE 0x00010917
  11194. #define AUDPROC_PARAM_ID_AUDIOSPHERE_STRENGTH 0x00010918
  11195. #define AUDPROC_PARAM_ID_AUDIOSPHERE_CONFIG_MODE 0x00010919
  11196. #define AUDPROC_PARAM_ID_AUDIOSPHERE_COEFFS_STEREO_INPUT 0x0001091A
  11197. #define AUDPROC_PARAM_ID_AUDIOSPHERE_COEFFS_MULTICHANNEL_INPUT 0x0001091B
  11198. #define AUDPROC_PARAM_ID_AUDIOSPHERE_DESIGN_STEREO_INPUT 0x0001091C
  11199. #define AUDPROC_PARAM_ID_AUDIOSPHERE_DESIGN_MULTICHANNEL_INPUT 0x0001091D
  11200. #define AUDPROC_PARAM_ID_AUDIOSPHERE_OPERATING_INPUT_MEDIA_INFO 0x0001091E
  11201. #define AUDPROC_MODULE_ID_VOICE_TX_SECNS 0x10027059
  11202. #define AUDPROC_PARAM_IDX_SEC_PRIMARY_MIC_CH 0x10014444
  11203. #define AUDPROC_MODULE_ID_FFECNS 0x00010952
  11204. #define AUDPROC_MODULE_ID_FFNS 0x00010962
  11205. #define AUDPROC_PARAM_ID_FFV_DOA_TRACKING_PARAM 0x0001097C
  11206. /*
  11207. * ID of the DTMF Detection Module.
  11208. */
  11209. #define AUDPROC_MODULE_ID_DTMF_DETECTION 0x00010940
  11210. #define AUDPROC_PARAM_ID_FFV_DOA_TRACKING_MONITOR 0x0001097D
  11211. struct admx_sec_primary_mic_ch {
  11212. uint16_t version;
  11213. uint16_t reserved;
  11214. uint16_t sec_primary_mic_ch;
  11215. uint16_t reserved1;
  11216. } __packed;
  11217. #define FFECNS_MODULE_ID 0x00010952
  11218. #define FLUENCE_CMN_GLOBAL_EFFECT_PARAM_ID 0x00010EAF
  11219. #define FFECNS_TOPOLOGY 0X10028003
  11220. struct ffecns_effect {
  11221. uint32_t payload;
  11222. };
  11223. /** ID of the Voice Activity Detection (VAD) module, which is used to
  11224. * configure AFE VAD.
  11225. */
  11226. #define AFE_MODULE_VAD 0x000102B9
  11227. /** ID of the parameter used by #AFE_MODULE_VAD to configure the VAD.
  11228. */
  11229. #define AFE_PARAM_ID_VAD_CFG 0x000102BA
  11230. #define AFE_API_VERSION_VAD_CFG 0x1
  11231. /* Payload of the AFE_PARAM_ID_VAD_CONFIG parameter used by
  11232. * AFE_MODULE_VAD.
  11233. */
  11234. struct afe_param_id_vad_cfg_t {
  11235. uint32_t vad_cfg_minor_version;
  11236. /** Tracks the configuration of this parameter.
  11237. * Supported Values: #AFE_API_VERSION_VAD_CFG
  11238. */
  11239. uint32_t pre_roll_in_ms;
  11240. /** Pre-roll period in ms.
  11241. * Supported Values: 0x0 to 0x3E8
  11242. */
  11243. } __packed;
  11244. #define AFE_PARAM_ID_VAD_CORE_CFG 0x000102BB
  11245. /**
  11246. * This parameter is should be used to configure the AFE TDM
  11247. * interface lane configuration.
  11248. * Regular TDM interface ports:
  11249. * This parameter ID must be used with module ID
  11250. * AFE_MODULE_AUDIO_DEV_INTERFACE and set using the AFE_PORT_CMD_SET_PARAM_V3
  11251. * command for the AFE TDM interface port IDs.
  11252. * Group device TDM interface ports:
  11253. * This parameter ID must be used with module ID AFE_MODULE_GROUP_DEVICE
  11254. * and set using the AFE_SVC_CMD_SET_PARAM_V2 command for the AFE TDM group IDs.
  11255. */
  11256. #define AFE_PARAM_ID_TDM_LANE_CONFIG 0x000102C1
  11257. /* Payload of the AFE_PARAM_ID_TDM_LANE_CONFIG parameter used by
  11258. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  11259. */
  11260. struct afe_param_id_tdm_lane_cfg {
  11261. uint16_t port_id;
  11262. /** ID of the TDM interface.
  11263. * For regular TDM interfaces value corresponds to valid port ID.
  11264. * For group devices TDM interface value corresponds to valid group device ID.
  11265. */
  11266. uint16_t lane_mask;
  11267. /** Position of the active lanes. Bits 0 to N correspond to lanes 0 to N.
  11268. * 1 to 2^N-1 When a bit is set, the corresponding lane is active.
  11269. * The number of active lanes can be inferred from the number of bits
  11270. * set in the mask.
  11271. */
  11272. };
  11273. #endif /*_APR_AUDIO_V2_H_ */