apr_audio-v2.h 391 KB

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