apr_audio-v2.h 388 KB

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