apr_audio-v2.h 365 KB

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