apr_audio-v2.h 343 KB

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