apr_audio-v2.h 392 KB

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