apr_audio-v2.h 329 KB

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