apr_audio-v2.h 331 KB

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