apr_audio-v2.h 327 KB

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