apr_audio-v2.h 378 KB

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