apr_audio-v2.h 318 KB

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