apr_audio-v2.h 336 KB

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