apr_audio-v2.h 363 KB

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