apr_audio-v2.h 363 KB

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