apr_audio-v2.h 328 KB

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