apr_audio-v2.h 329 KB

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