apr_audio-v2.h 343 KB

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