apr_audio-v2.h 391 KB

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