apr_audio-v2.h 363 KB

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