apr_audio-v2.h 327 KB

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