apr_audio-v2.h 373 KB

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