apr_audio-v2.h 363 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269
  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. /*
  3311. * Decoder buffer ID parameter for the #AVS_MODULE_ID_DECODER module.
  3312. * This parameter cannot be set runtime.
  3313. */
  3314. #define AFE_DECODER_PARAM_ID_CONGESTION_BUFFER_SIZE 0x000132ec
  3315. /*
  3316. * Data format to send compressed data
  3317. * is transmitted/received over Slimbus lines.
  3318. */
  3319. #define AFE_SB_DATA_FORMAT_GENERIC_COMPRESSED 0x3
  3320. /*
  3321. * ID for AFE port module. This will be used to define port properties.
  3322. * This module supports following parameter IDs:
  3323. * #AFE_PARAM_ID_PORT_MEDIA_TYPE
  3324. * To configure the port property, the client must use the
  3325. * #AFE_PORT_CMD_SET_PARAM_V2 command,
  3326. * and fill the module ID with the respective parameter IDs as listed above.
  3327. * @apr_hdr_fields
  3328. * Opcode -- AFE_MODULE_PORT
  3329. */
  3330. #define AFE_MODULE_PORT 0x000102a6
  3331. /*
  3332. * ID of the parameter used by #AFE_MODULE_PORT to set the port media type.
  3333. * parameter ID is currently supported using#AFE_PORT_CMD_SET_PARAM_V2 command.
  3334. */
  3335. #define AFE_PARAM_ID_PORT_MEDIA_TYPE 0x000102a7
  3336. /*
  3337. * Macros for defining the "data_format" field in the
  3338. * #AFE_PARAM_ID_PORT_MEDIA_TYPE
  3339. */
  3340. #define AFE_PORT_DATA_FORMAT_PCM 0x0
  3341. #define AFE_PORT_DATA_FORMAT_GENERIC_COMPRESSED 0x1
  3342. /*
  3343. * Macro for defining the "minor_version" field in the
  3344. * #AFE_PARAM_ID_PORT_MEDIA_TYPE
  3345. */
  3346. #define AFE_API_VERSION_PORT_MEDIA_TYPE 0x1
  3347. #define ASM_MEDIA_FMT_NONE 0x0
  3348. /*
  3349. * Media format ID for SBC encode configuration.
  3350. * @par SBC encode configuration (asm_sbc_enc_cfg_t)
  3351. * @table{weak__asm__sbc__enc__cfg__t}
  3352. */
  3353. #define ASM_MEDIA_FMT_SBC 0x00010BF2
  3354. /* SBC channel Mono mode.*/
  3355. #define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_MONO 1
  3356. /* SBC channel Stereo mode. */
  3357. #define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_STEREO 2
  3358. /* SBC channel Dual Mono mode. */
  3359. #define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_DUAL_MONO 8
  3360. /* SBC channel Joint Stereo mode. */
  3361. #define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_JOINT_STEREO 9
  3362. /* SBC bit allocation method = loudness. */
  3363. #define ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_LOUDNESS 0
  3364. /* SBC bit allocation method = SNR. */
  3365. #define ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_SNR 1
  3366. /*
  3367. * Payload of the SBC encoder configuration parameters in the
  3368. * #ASM_MEDIA_FMT_SBC media format.
  3369. */
  3370. struct asm_sbc_enc_cfg_t {
  3371. /*
  3372. * Number of subbands.
  3373. * @values 4, 8
  3374. */
  3375. uint32_t num_subbands;
  3376. /*
  3377. * Size of the encoded block in samples.
  3378. * @values 4, 8, 12, 16
  3379. */
  3380. uint32_t blk_len;
  3381. /*
  3382. * Mode used to allocate bits between channels.
  3383. * @values
  3384. * 0 (Native mode)
  3385. * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_MONO
  3386. * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_STEREO
  3387. * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_DUAL_MONO
  3388. * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_JOINT_STEREO
  3389. * Native mode indicates that encoding must be performed with the number
  3390. * of channels at the input.
  3391. * If postprocessing outputs one-channel data, Mono mode is used. If
  3392. * postprocessing outputs two-channel data, Stereo mode is used.
  3393. * The number of channels must not change during encoding.
  3394. */
  3395. uint32_t channel_mode;
  3396. /*
  3397. * Encoder bit allocation method.
  3398. * @values
  3399. * #ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_LOUDNESS
  3400. * #ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_SNR @tablebulletend
  3401. */
  3402. uint32_t alloc_method;
  3403. /*
  3404. * Number of encoded bits per second.
  3405. * @values
  3406. * Mono channel -- Maximum of 320 kbps
  3407. * Stereo channel -- Maximum of 512 kbps @tablebulletend
  3408. */
  3409. uint32_t bit_rate;
  3410. /*
  3411. * Number of samples per second.
  3412. * @values 0 (Native mode), 16000, 32000, 44100, 48000&nbsp;Hz
  3413. * Native mode indicates that encoding must be performed with the
  3414. * sampling rate at the input.
  3415. * The sampling rate must not change during encoding.
  3416. */
  3417. uint32_t sample_rate;
  3418. };
  3419. #define ASM_MEDIA_FMT_AAC_AOT_LC 2
  3420. #define ASM_MEDIA_FMT_AAC_AOT_SBR 5
  3421. #define ASM_MEDIA_FMT_AAC_AOT_PS 29
  3422. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS 0
  3423. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW 3
  3424. struct asm_aac_enc_cfg_v2_t {
  3425. /* Encoding rate in bits per second.*/
  3426. uint32_t bit_rate;
  3427. /*
  3428. * Encoding mode.
  3429. * Supported values:
  3430. * #ASM_MEDIA_FMT_AAC_AOT_LC
  3431. * #ASM_MEDIA_FMT_AAC_AOT_SBR
  3432. * #ASM_MEDIA_FMT_AAC_AOT_PS
  3433. */
  3434. uint32_t enc_mode;
  3435. /*
  3436. * AAC format flag.
  3437. * Supported values:
  3438. * #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
  3439. * #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
  3440. */
  3441. uint16_t aac_fmt_flag;
  3442. /*
  3443. * Number of channels to encode.
  3444. * Supported values:
  3445. * 0 - Native mode
  3446. * 1 - Mono
  3447. * 2 - Stereo
  3448. * Other values are not supported.
  3449. * @note1hang The eAAC+ encoder mode supports only stereo.
  3450. * Native mode indicates that encoding must be performed with the
  3451. * number of channels at the input.
  3452. * The number of channels must not change during encoding.
  3453. */
  3454. uint16_t channel_cfg;
  3455. /*
  3456. * Number of samples per second.
  3457. * Supported values: - 0 -- Native mode - For other values,
  3458. * Native mode indicates that encoding must be performed with the
  3459. * sampling rate at the input.
  3460. * The sampling rate must not change during encoding.
  3461. */
  3462. uint32_t sample_rate;
  3463. } __packed;
  3464. /* FMT ID for apt-X Classic */
  3465. #define ASM_MEDIA_FMT_APTX 0x000131ff
  3466. /* FMT ID for apt-X HD */
  3467. #define ASM_MEDIA_FMT_APTX_HD 0x00013200
  3468. /* FMT ID for apt-X Adaptive */
  3469. #define ASM_MEDIA_FMT_APTX_ADAPTIVE 0x00013204
  3470. #define PCM_CHANNEL_L 1
  3471. #define PCM_CHANNEL_R 2
  3472. #define PCM_CHANNEL_C 3
  3473. struct asm_custom_enc_cfg_t {
  3474. uint32_t sample_rate;
  3475. /* Mono or stereo */
  3476. uint16_t num_channels;
  3477. uint16_t reserved;
  3478. /* num_ch == 1, then PCM_CHANNEL_C,
  3479. * num_ch == 2, then {PCM_CHANNEL_L, PCM_CHANNEL_R}
  3480. */
  3481. uint8_t channel_mapping[8];
  3482. uint32_t custom_size;
  3483. } __packed;
  3484. struct asm_aptx_v2_enc_cfg_ext_t {
  3485. /*
  3486. * sync mode: 0x0 = stereo sync mode (default)
  3487. * 0x01 = dual mono sync mode
  3488. * 0x02 = dual mono with no sync on either L or R
  3489. */
  3490. uint32_t sync_mode;
  3491. } __packed;
  3492. struct asm_aptx_enc_cfg_t {
  3493. struct asm_custom_enc_cfg_t custom_cfg;
  3494. struct asm_aptx_v2_enc_cfg_ext_t aptx_v2_cfg;
  3495. } __packed;
  3496. struct asm_aptx_ad_enc_cfg_t
  3497. {
  3498. struct asm_custom_enc_cfg_t custom_cfg;
  3499. struct afe_id_aptx_adaptive_enc_init aptx_ad_cfg;
  3500. struct afe_abr_enc_cfg_t abr_cfg;
  3501. } __attribute__ ((packed));
  3502. #define ASM_MEDIA_FMT_CELT 0x00013221
  3503. struct asm_celt_specific_enc_cfg_t {
  3504. /*
  3505. * Bit rate used for encoding.
  3506. * This is used to calculate the upper threshold
  3507. * for bytes per frame if vbr_flag is 1.
  3508. * Or else, this will be used as a regular constant
  3509. * bit rate for encoder output.
  3510. * @Range : 32000 to 1536000
  3511. * @Default: 128
  3512. */
  3513. uint32_t bit_rate;
  3514. /*
  3515. * Frame size used for encoding.
  3516. * @Range : 64, 128, 256, 512
  3517. * @Default: 256
  3518. */
  3519. uint16_t frame_size;
  3520. /*
  3521. * complexity of algorithm.
  3522. * @Range : 0-10
  3523. * @Default: 3
  3524. */
  3525. uint16_t complexity;
  3526. /*
  3527. * Switch variable for prediction feature.
  3528. * Used to choose between the level of interframe
  3529. * predictions allowed while encoding.
  3530. * @Range:
  3531. * 0: Independent Frames.
  3532. * 1: Short Term interframe prediction allowed.
  3533. * 2: Long term prediction allowed.
  3534. * @Default: 2
  3535. */
  3536. uint16_t prediction_mode;
  3537. /*
  3538. * Variable Bit Rate flag.
  3539. * @Default: 0
  3540. */
  3541. uint16_t vbr_flag;
  3542. } __packed;
  3543. struct asm_celt_enc_cfg_t {
  3544. struct asm_custom_enc_cfg_t custom_config;
  3545. struct asm_celt_specific_enc_cfg_t celt_specific_config;
  3546. } __packed;
  3547. #define ASM_MEDIA_FMT_LDAC 0x00013224
  3548. #define ENC_CODEC_TYPE_LDAC 0x23000000
  3549. struct asm_ldac_specific_enc_cfg_t {
  3550. /*
  3551. * This is used to calculate the encoder output
  3552. * bytes per frame (i.e. bytes per packet).
  3553. * Bit rate also configures the EQMID.
  3554. * The min bit rate 303000 bps is calculated for
  3555. * 44.1 kHz and 88.2 KHz sampling frequencies with
  3556. * Mobile use Quality.
  3557. * The max bit rate of 990000 bps is calculated for
  3558. * 96kHz and 48 KHz with High Quality
  3559. * @Range(in bits per second)
  3560. * 303000 for Mobile use Quality
  3561. * 606000 for standard Quality
  3562. * 909000 for High Quality
  3563. */
  3564. uint32_t bit_rate;
  3565. /*
  3566. * The channel setting information for LDAC specification
  3567. * of Bluetooth A2DP which is determined by SRC and SNK
  3568. * devices in Bluetooth transmission.
  3569. * @Range:
  3570. * 0 for native mode
  3571. * 4 for mono
  3572. * 2 for dual channel
  3573. * 1 for stereo
  3574. */
  3575. uint16_t channel_mode;
  3576. /*
  3577. * Maximum Transmission Unit (MTU).
  3578. * The minimum MTU that a L2CAP implementation for LDAC shall
  3579. * support is 679 bytes, because LDAC is optimized with 2-DH5
  3580. * packet as its target.
  3581. * @Range : 679
  3582. * @Default: 679 for LDACBT_MTU_2DH5
  3583. */
  3584. uint16_t mtu;
  3585. } __packed;
  3586. struct asm_ldac_enc_cfg_t {
  3587. struct asm_custom_enc_cfg_t custom_config;
  3588. struct asm_ldac_specific_enc_cfg_t ldac_specific_config;
  3589. struct afe_abr_enc_cfg_t abr_config;
  3590. } __packed;
  3591. struct afe_enc_fmt_id_param_t {
  3592. /*
  3593. * Supported values:
  3594. * #ASM_MEDIA_FMT_SBC
  3595. * #ASM_MEDIA_FMT_AAC_V2
  3596. * Any OpenDSP supported values
  3597. */
  3598. uint32_t fmt_id;
  3599. } __packed;
  3600. struct afe_port_media_type_t {
  3601. /*
  3602. * Minor version
  3603. * @values #AFE_API_VERSION_PORT_MEDIA_TYPE.
  3604. */
  3605. uint32_t minor_version;
  3606. /*
  3607. * Sampling rate of the port.
  3608. * @values
  3609. * #AFE_PORT_SAMPLE_RATE_8K
  3610. * #AFE_PORT_SAMPLE_RATE_11_025K
  3611. * #AFE_PORT_SAMPLE_RATE_12K
  3612. * #AFE_PORT_SAMPLE_RATE_16K
  3613. * #AFE_PORT_SAMPLE_RATE_22_05K
  3614. * #AFE_PORT_SAMPLE_RATE_24K
  3615. * #AFE_PORT_SAMPLE_RATE_32K
  3616. * #AFE_PORT_SAMPLE_RATE_44_1K
  3617. * #AFE_PORT_SAMPLE_RATE_48K
  3618. * #AFE_PORT_SAMPLE_RATE_88_2K
  3619. * #AFE_PORT_SAMPLE_RATE_96K
  3620. * #AFE_PORT_SAMPLE_RATE_176_4K
  3621. * #AFE_PORT_SAMPLE_RATE_192K
  3622. * #AFE_PORT_SAMPLE_RATE_352_8K
  3623. * #AFE_PORT_SAMPLE_RATE_384K
  3624. */
  3625. uint32_t sample_rate;
  3626. /*
  3627. * Bit width of the sample.
  3628. * @values 16, 24
  3629. */
  3630. uint16_t bit_width;
  3631. /*
  3632. * Number of channels.
  3633. * @values 1 to #AFE_PORT_MAX_AUDIO_CHAN_CNT
  3634. */
  3635. uint16_t num_channels;
  3636. /*
  3637. * Data format supported by this port.
  3638. * If the port media type and device media type are different,
  3639. * it signifies a encoding/decoding use case
  3640. * @values
  3641. * #AFE_PORT_DATA_FORMAT_PCM
  3642. * #AFE_PORT_DATA_FORMAT_GENERIC_COMPRESSED
  3643. */
  3644. uint16_t data_format;
  3645. /*This field must be set to zero.*/
  3646. uint16_t reserved;
  3647. } __packed;
  3648. /*
  3649. * Payload of the SBC decoder configuration parameters in the
  3650. * #ASM_MEDIA_FMT_SBC media format.
  3651. */
  3652. struct asm_sbc_dec_cfg_t {
  3653. uint16_t channels;
  3654. /*
  3655. * Number of channels present in the SBC stream.
  3656. *
  3657. * @values
  3658. * - 1 -- Mono
  3659. * - 2 -- Stereo
  3660. */
  3661. uint32_t sample_rate;
  3662. /*
  3663. * Number of samples per second.
  3664. *
  3665. * @values 8000, 11025, 12000, 16000, 22050, 24000, 32000,
  3666. * 44100, 48000, 64000, 88200, 96000 Hz
  3667. */
  3668. } __packed;
  3669. /*
  3670. * Payload of the MP3 decoder configuration parameters in the
  3671. * #ASM_MEDIA_FMT_MP3 media format.
  3672. */
  3673. struct asm_mp3_dec_cfg_t {
  3674. /* All configuration is extracted from the stream */
  3675. } __packed;
  3676. struct asm_aac_dec_cfg_v2_t {
  3677. uint16_t aac_fmt_flag;
  3678. /*
  3679. * Bit stream format option.
  3680. *
  3681. * @values
  3682. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
  3683. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS
  3684. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF
  3685. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
  3686. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LATM
  3687. */
  3688. uint16_t audio_obj_type;
  3689. /*
  3690. * Audio Object Type (AOT) present in the AAC stream.
  3691. *
  3692. * @values
  3693. * - #ASM_MEDIA_FMT_AAC_AOT_LC
  3694. * - #ASM_MEDIA_FMT_AAC_AOT_SBR
  3695. * - #ASM_MEDIA_FMT_AAC_AOT_BSAC
  3696. * - #ASM_MEDIA_FMT_AAC_AOT_PS
  3697. *
  3698. * Other values are not supported.
  3699. */
  3700. uint16_t channel_config;
  3701. /*
  3702. * Number of channels present in the AAC stream.
  3703. *
  3704. * @values
  3705. * - 0 -- PCE
  3706. * - 1 -- Mono
  3707. * - 2 -- Stereo
  3708. * - 6 -- 5.1 content
  3709. */
  3710. uint16_t total_size_of_PCE_bits;
  3711. /*
  3712. * For RAW formats and if channel_config=0 (PCE),
  3713. * the client can send the bit stream containing PCE
  3714. * immediately following this structure (in band).
  3715. *
  3716. * @values @ge 0 (does not include the bits required
  3717. * for 32-bit alignment)
  3718. *
  3719. * If this field is set to 0, the PCE information is
  3720. * assumed to be available in the audio bit stream
  3721. * and not in band.
  3722. *
  3723. * If this field is greater than 0, the PCE information
  3724. * follows this structure. Additional bits might
  3725. * be required for 32-bit alignment.
  3726. */
  3727. uint32_t sample_rate;
  3728. /*
  3729. * Number of samples per second.
  3730. *
  3731. * @values 8000, 11025, 12000, 16000, 22050, 24000, 32000,
  3732. * 44100, 48000, 64000, 88200, 96000 Hz
  3733. *
  3734. * This field must be equal to the sample rate of the
  3735. * AAC-LC decoder output.
  3736. * - For MP4 or 3GP containers, this sample rate
  3737. * is indicated by the
  3738. * samplingFrequencyIndex field in the
  3739. * AudioSpecificConfig element.
  3740. * - For ADTS format, this sample rate is indicated by the
  3741. * samplingFrequencyIndex in the ADTS fixed header.
  3742. * - For ADIF format, this sample rate is indicated by the
  3743. * samplingFrequencyIndex in the program_config_element
  3744. * present in the ADIF header.
  3745. */
  3746. } __packed;
  3747. union afe_enc_config_data {
  3748. struct asm_sbc_enc_cfg_t sbc_config;
  3749. struct asm_aac_enc_cfg_v2_t aac_config;
  3750. struct asm_custom_enc_cfg_t custom_config;
  3751. struct asm_celt_enc_cfg_t celt_config;
  3752. struct asm_aptx_enc_cfg_t aptx_config;
  3753. struct asm_ldac_enc_cfg_t ldac_config;
  3754. struct asm_aptx_ad_enc_cfg_t aptx_ad_config;
  3755. };
  3756. struct afe_enc_config {
  3757. u32 format;
  3758. u32 scrambler_mode;
  3759. union afe_enc_config_data data;
  3760. };
  3761. union afe_dec_config_data {
  3762. struct asm_sbc_dec_cfg_t sbc_config;
  3763. struct asm_aac_dec_cfg_v2_t aac_config;
  3764. struct asm_mp3_dec_cfg_t mp3_config;
  3765. };
  3766. struct afe_dec_config {
  3767. u32 format;
  3768. struct afe_abr_dec_cfg_t abr_dec_cfg;
  3769. union afe_dec_config_data data;
  3770. };
  3771. struct afe_enc_cfg_blk_param_t {
  3772. uint32_t enc_cfg_blk_size;
  3773. /*
  3774. *Size of the encoder configuration block that follows this member
  3775. */
  3776. union afe_enc_config_data enc_blk_config;
  3777. };
  3778. /*
  3779. * Payload of the AVS_DECODER_PARAM_ID_DEC_MEDIA_FMT parameter used by
  3780. * AVS_MODULE_ID_DECODER.
  3781. */
  3782. struct afe_dec_media_fmt_t {
  3783. union afe_dec_config_data dec_media_config;
  3784. } __packed;
  3785. /*
  3786. * Payload of the AVS_ENCODER_PARAM_ID_PACKETIZER_ID parameter.
  3787. */
  3788. struct avs_enc_packetizer_id_param_t {
  3789. /*
  3790. * Supported values:
  3791. * #AVS_MODULE_ID_PACKETIZER_COP
  3792. * Any OpenDSP supported values
  3793. */
  3794. uint32_t enc_packetizer_id;
  3795. };
  3796. /*
  3797. * Payload of the AVS_ENCODER_PARAM_ID_ENABLE_SCRAMBLING parameter.
  3798. */
  3799. struct avs_enc_set_scrambler_param_t {
  3800. /*
  3801. * Supported values:
  3802. * 1 : enable scrambler
  3803. * 0 : disable scrambler
  3804. */
  3805. uint32_t enable_scrambler;
  3806. };
  3807. /*
  3808. * Payload of the AVS_ENCODER_PARAM_ID_BIT_RATE_LEVEL_MAP parameter.
  3809. */
  3810. struct afe_enc_level_to_bitrate_map_param_t {
  3811. /*
  3812. * Parameter for mapping link quality level to bitrate.
  3813. */
  3814. struct afe_quality_level_to_bitrate_info mapping_table;
  3815. };
  3816. /*
  3817. * Payload of the AVS_ENCDEC_PARAM_ID_DEC_TO_ENC_COMMUNICATION parameter.
  3818. */
  3819. struct afe_enc_dec_imc_info_param_t {
  3820. /*
  3821. * Parameter to set up Inter Module Communication (IMC) between
  3822. * AFE Decoder and Encoder.
  3823. */
  3824. struct afe_imc_dec_enc_info imc_info;
  3825. };
  3826. /*
  3827. * Payload of the AVS_DECODER_PARAM_ID_DEPACKETIZER_ID parameter.
  3828. */
  3829. struct avs_dec_depacketizer_id_param_t {
  3830. /*
  3831. * Supported values:
  3832. * #AFE_MODULE_ID_DEPACKETIZER_COP
  3833. * #AFE_MODULE_ID_DEPACKETIZER_COP_V1
  3834. * Any OpenDSP supported values
  3835. */
  3836. uint32_t dec_depacketizer_id;
  3837. };
  3838. struct avs_dec_congestion_buffer_param_t {
  3839. uint32_t version;
  3840. uint16_t max_nr_buffers;
  3841. /*
  3842. * Maximum number of 1ms buffers:
  3843. * 0 - 256
  3844. */
  3845. uint16_t pre_buffer_size;
  3846. /*
  3847. * Pre-buffering size in 1ms:
  3848. * 1 - 128
  3849. */
  3850. };
  3851. /*
  3852. * ID of the parameter used by #AVS_MODULE_ID_DECODER to configure
  3853. * the decoder mode for the AFE module.
  3854. * This parameter cannot be set at runtime.
  3855. */
  3856. #define AVS_DECODER_PARAM_ID_DEC_MEDIA_FMT 0x00013232
  3857. /* ID of the parameter used by #AFE_MODULE_AUDIO_DEV_INTERFACE to configure
  3858. * the island mode for a given AFE port.
  3859. */
  3860. #define AFE_PARAM_ID_ISLAND_CONFIG 0x000102B4
  3861. /* Version information used to handle future additions to codec DMA
  3862. * configuration (for backward compatibility).
  3863. */
  3864. #define AFE_API_VERSION_ISLAND_CONFIG 0x1
  3865. /* Payload of the AFE_PARAM_ID_ISLAND_CONFIG parameter used by
  3866. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  3867. */
  3868. struct afe_param_id_island_cfg_t {
  3869. uint32_t island_cfg_minor_version;
  3870. /* Tracks the configuration of this parameter.
  3871. * Supported values: #AFE_API_VERSION_ISLAND_CONFIG
  3872. */
  3873. uint32_t island_enable;
  3874. /* Specifies whether island mode should be enabled or disabled for the
  3875. * use-case being setup.
  3876. * Supported values: 0 - Disable, 1 - Enable
  3877. */
  3878. } __packed;
  3879. /* ID of the parameter used by #AFE_MODULE_AUDIO_DEV_INTERFACE to configure
  3880. * the Codec DMA interface.
  3881. */
  3882. #define AFE_PARAM_ID_CODEC_DMA_CONFIG 0x000102B8
  3883. /* Version information used to handle future additions to codec DMA
  3884. * configuration (for backward compatibility).
  3885. */
  3886. #define AFE_API_VERSION_CODEC_DMA_CONFIG 0x1
  3887. /* Payload of the AFE_PARAM_ID_CODEC_DMA_CONFIG parameter used by
  3888. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  3889. */
  3890. struct afe_param_id_cdc_dma_cfg_t {
  3891. uint32_t cdc_dma_cfg_minor_version;
  3892. /* Tracks the configuration of this parameter.
  3893. * Supported values: #AFE_API_VERSION_CODEC_DMA_CONFIG
  3894. */
  3895. uint32_t sample_rate;
  3896. /* Sampling rate of the port.
  3897. * Supported values:
  3898. * - #AFE_PORT_SAMPLE_RATE_8K
  3899. * - #AFE_PORT_SAMPLE_RATE_11_025K
  3900. * - #AFE_PORT_SAMPLE_RATE_12K
  3901. * - #AFE_PORT_SAMPLE_RATE_16K
  3902. * - #AFE_PORT_SAMPLE_RATE_22_05K
  3903. * - #AFE_PORT_SAMPLE_RATE_24K
  3904. * - #AFE_PORT_SAMPLE_RATE_32K
  3905. * - #AFE_PORT_SAMPLE_RATE_44_1K
  3906. * - #AFE_PORT_SAMPLE_RATE_48K
  3907. * - #AFE_PORT_SAMPLE_RATE_88_2K
  3908. * - #AFE_PORT_SAMPLE_RATE_96K
  3909. * - #AFE_PORT_SAMPLE_RATE_176_4K
  3910. * - #AFE_PORT_SAMPLE_RATE_192K
  3911. * - #AFE_PORT_SAMPLE_RATE_352_8K
  3912. * - #AFE_PORT_SAMPLE_RATE_384K
  3913. */
  3914. uint16_t bit_width;
  3915. /* Bit width of the sample.
  3916. * Supported values: 16, 24, 32
  3917. */
  3918. uint16_t data_format;
  3919. /* Data format supported by the codec DMA interface.
  3920. * Supported values:
  3921. * - #AFE_LINEAR_PCM_DATA
  3922. * - #AFE_LINEAR_PCM_DATA_PACKED_16BIT
  3923. */
  3924. uint16_t num_channels;
  3925. /* Number of channels.
  3926. * Supported values: 1 to Maximum number of channels supported
  3927. * for each interface
  3928. */
  3929. uint16_t active_channels_mask;
  3930. /* Active channels mask to denote the bit mask for active channels.
  3931. * Bits 0 to 7 denote channels 0 to 7. A 1 denotes the channel is active
  3932. * while a 0 denotes a channel is inactive.
  3933. * Supported values:
  3934. * Any mask with number of active bits equal to num_channels
  3935. */
  3936. } __packed;
  3937. union afe_port_config {
  3938. struct afe_param_id_pcm_cfg pcm;
  3939. struct afe_param_id_i2s_cfg i2s;
  3940. struct afe_param_id_hdmi_multi_chan_audio_cfg hdmi_multi_ch;
  3941. struct afe_param_id_slimbus_cfg slim_sch;
  3942. struct afe_param_id_rt_proxy_port_cfg rtproxy;
  3943. struct afe_param_id_internal_bt_fm_cfg int_bt_fm;
  3944. struct afe_param_id_pseudo_port_cfg pseudo_port;
  3945. struct afe_param_id_device_hw_delay_cfg hw_delay;
  3946. struct afe_param_id_spdif_cfg_v2 spdif;
  3947. struct afe_param_id_set_topology_cfg topology;
  3948. struct afe_param_id_tdm_cfg tdm;
  3949. struct afe_param_id_usb_audio_cfg usb_audio;
  3950. struct afe_param_id_aptx_sync_mode sync_mode_param;
  3951. struct afe_enc_fmt_id_param_t enc_fmt;
  3952. struct afe_port_media_type_t media_type;
  3953. struct afe_enc_cfg_blk_param_t enc_blk_param;
  3954. struct avs_enc_packetizer_id_param_t enc_pkt_id_param;
  3955. struct avs_enc_set_scrambler_param_t enc_set_scrambler_param;
  3956. struct avs_dec_depacketizer_id_param_t dec_depkt_id_param;
  3957. struct afe_dec_media_fmt_t dec_media_fmt;
  3958. struct afe_enc_level_to_bitrate_map_param_t map_param;
  3959. struct afe_enc_dec_imc_info_param_t imc_info_param;
  3960. struct afe_param_id_cdc_dma_cfg_t cdc_dma;
  3961. } __packed;
  3962. /*
  3963. * AFE event registration related APIs and corresponding payloads
  3964. */
  3965. #define AFE_SVC_CMD_EVENT_CFG 0x000100FE
  3966. #define AFE_CMD_APPS_WAKEUP_IRQ_REGISTER_MINOR_VERSION 0x1
  3967. /* Flag to indicate AFE to register APPS wakeup Interrupt */
  3968. #define AFE_APPS_WAKEUP_IRQ_REGISTER_FLAG 1
  3969. /* Flag to indicate AFE to de-register APPS wakeup Interrupt */
  3970. #define AFE_APPS_WAKEUP_IRQ_DEREGISTER_FLAG 0
  3971. /* Default interrupt trigger value. */
  3972. #define DEFAULT_SETTINGS 0x00000001
  3973. /* Interrupt is triggered only if the input signal at the source is high. */
  3974. #define LEVEL_HIGH_TRIGGER 0x00000002
  3975. /* Interrupt is triggered only if the input signal at the source is low. */
  3976. #define LEVEL_LOW_TRIGGER 0x00000003
  3977. /* Interrupt is triggered only if the input signal at the source transitions
  3978. *from low to high.
  3979. */
  3980. #define RISING_EDGE_TRIGGER 0x00000004
  3981. /* Interrupt is triggered only if the input signal at the source transitions
  3982. *from high to low.
  3983. */
  3984. #define FALLING_EDGE_TRIGGER 0x00000005
  3985. /* Macro for invalid trigger type. This should not be used. */
  3986. #define INVALID_TRIGGER 0x00000006
  3987. #define AFE_EVENT_ID_MBHC_DETECTION_SW_WA 0x1
  3988. /* @weakgroup weak_afe_svc_cmd_evt_cfg_payload
  3989. *
  3990. * This is payload of each event that is to be
  3991. * registered with AFE service.
  3992. */
  3993. struct afe_svc_cmd_evt_cfg_payload {
  3994. struct apr_hdr hdr;
  3995. uint32_t event_id;
  3996. /* Unique ID of the event.
  3997. *
  3998. * @values
  3999. * -# AFE_EVENT_ID_MBHC_DETECTION_SW_WA
  4000. */
  4001. uint32_t reg_flag;
  4002. /* Flag for registering or de-registering an event.
  4003. * @values
  4004. * - #AFE_SVC_REGISTER_EVENT_FLAG
  4005. * - #AFE_SVC_DEREGISTER_EVENT_FLAG
  4006. */
  4007. } __packed;
  4008. #define AFE_EVENT_MBHC_DETECTION_SW_WA 0x0001010F
  4009. #define AFE_PORT_CMD_DEVICE_START 0x000100E5
  4010. /* Payload of the #AFE_PORT_CMD_DEVICE_START.*/
  4011. struct afe_port_cmd_device_start {
  4012. struct apr_hdr hdr;
  4013. u16 port_id;
  4014. /* Port interface and direction (Rx or Tx) to start. An even
  4015. * number represents the Rx direction, and an odd number represents
  4016. * the Tx direction.
  4017. */
  4018. u16 reserved;
  4019. /* Reserved for 32-bit alignment. This field must be set to 0.*/
  4020. } __packed;
  4021. #define AFE_PORT_CMD_DEVICE_STOP 0x000100E6
  4022. /* Payload of the #AFE_PORT_CMD_DEVICE_STOP. */
  4023. struct afe_port_cmd_device_stop {
  4024. struct apr_hdr hdr;
  4025. u16 port_id;
  4026. /* Port interface and direction (Rx or Tx) to start. An even
  4027. * number represents the Rx direction, and an odd number represents
  4028. * the Tx direction.
  4029. */
  4030. u16 reserved;
  4031. /* Reserved for 32-bit alignment. This field must be set to 0.*/
  4032. } __packed;
  4033. #define AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS 0x000100EA
  4034. /* Memory map regions command payload used by the
  4035. * #AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS .
  4036. * This structure allows clients to map multiple shared memory
  4037. * regions in a single command. Following this structure are
  4038. * num_regions of afe_service_shared_map_region_payload.
  4039. */
  4040. struct afe_service_cmd_shared_mem_map_regions {
  4041. struct apr_hdr hdr;
  4042. u16 mem_pool_id;
  4043. /* Type of memory on which this memory region is mapped.
  4044. * Supported values:
  4045. * - #ADSP_MEMORY_MAP_EBI_POOL
  4046. * - #ADSP_MEMORY_MAP_SMI_POOL
  4047. * - #ADSP_MEMORY_MAP_SHMEM8_4K_POOL
  4048. * - Other values are reserved
  4049. *
  4050. * The memory pool ID implicitly defines the characteristics of the
  4051. * memory. Characteristics may include alignment type, permissions,
  4052. * etc.
  4053. *
  4054. * ADSP_MEMORY_MAP_EBI_POOL is External Buffer Interface type memory
  4055. * ADSP_MEMORY_MAP_SMI_POOL is Shared Memory Interface type memory
  4056. * ADSP_MEMORY_MAP_SHMEM8_4K_POOL is shared memory, byte
  4057. * addressable, and 4 KB aligned.
  4058. */
  4059. u16 num_regions;
  4060. /* Number of regions to map.
  4061. * Supported values:
  4062. * - Any value greater than zero
  4063. */
  4064. u32 property_flag;
  4065. /* Configures one common property for all the regions in the
  4066. * payload.
  4067. *
  4068. * Supported values: - 0x00000000 to 0x00000001
  4069. *
  4070. * b0 - bit 0 indicates physical or virtual mapping 0 Shared memory
  4071. * address provided in afe_service_shared_map_region_payloadis a
  4072. * physical address. The shared memory needs to be mapped( hardware
  4073. * TLB entry) and a software entry needs to be added for internal
  4074. * book keeping.
  4075. *
  4076. * 1 Shared memory address provided in
  4077. * afe_service_shared_map_region_payloadis a virtual address. The
  4078. * shared memory must not be mapped (since hardware TLB entry is
  4079. * already available) but a software entry needs to be added for
  4080. * internal book keeping. This can be useful if two services with in
  4081. * ADSP is communicating via APR. They can now directly communicate
  4082. * via the Virtual address instead of Physical address. The virtual
  4083. * regions must be contiguous. num_regions must be 1 in this case.
  4084. *
  4085. * b31-b1 - reserved bits. must be set to zero
  4086. */
  4087. } __packed;
  4088. /* Map region payload used by the
  4089. * afe_service_shared_map_region_payloadstructure.
  4090. */
  4091. struct afe_service_shared_map_region_payload {
  4092. u32 shm_addr_lsw;
  4093. /* least significant word of starting address in the memory
  4094. * region to map. It must be contiguous memory, and it must be 4 KB
  4095. * aligned.
  4096. * Supported values: - Any 32 bit value
  4097. */
  4098. u32 shm_addr_msw;
  4099. /* most significant word of startng address in the memory region
  4100. * to map. For 32 bit shared memory address, this field must be set
  4101. * to zero. For 36 bit shared memory address, bit31 to bit 4 must be
  4102. * set to zero
  4103. *
  4104. * Supported values: - For 32 bit shared memory address, this field
  4105. * must be set to zero. - For 36 bit shared memory address, bit31 to
  4106. * bit 4 must be set to zero - For 64 bit shared memory address, any
  4107. * 32 bit value
  4108. */
  4109. u32 mem_size_bytes;
  4110. /* Number of bytes in the region. The aDSP will always map the
  4111. * regions as virtual contiguous memory, but the memory size must be
  4112. * in multiples of 4 KB to avoid gaps in the virtually contiguous
  4113. * mapped memory.
  4114. *
  4115. * Supported values: - multiples of 4KB
  4116. */
  4117. } __packed;
  4118. #define AFE_SERVICE_CMDRSP_SHARED_MEM_MAP_REGIONS 0x000100EB
  4119. struct afe_service_cmdrsp_shared_mem_map_regions {
  4120. u32 mem_map_handle;
  4121. /* A memory map handle encapsulating shared memory attributes is
  4122. * returned iff AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS command is
  4123. * successful. In the case of failure , a generic APR error response
  4124. * is returned to the client.
  4125. *
  4126. * Supported Values: - Any 32 bit value
  4127. */
  4128. } __packed;
  4129. #define AFE_SERVICE_CMD_SHARED_MEM_UNMAP_REGIONS 0x000100EC
  4130. /* Memory unmap regions command payload used by the
  4131. * #AFE_SERVICE_CMD_SHARED_MEM_UNMAP_REGIONS
  4132. *
  4133. * This structure allows clients to unmap multiple shared memory
  4134. * regions in a single command.
  4135. */
  4136. struct afe_service_cmd_shared_mem_unmap_regions {
  4137. struct apr_hdr hdr;
  4138. u32 mem_map_handle;
  4139. /* memory map handle returned by
  4140. * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS commands
  4141. *
  4142. * Supported Values:
  4143. * - Any 32 bit value
  4144. */
  4145. } __packed;
  4146. /* Used by RTAC */
  4147. struct afe_rtac_get_param_v2 {
  4148. u16 port_id;
  4149. /* Port interface and direction (Rx or Tx) to start. */
  4150. u16 payload_size;
  4151. /* Maximum data size of the parameter ID/module ID combination.
  4152. * This is a multiple of four bytes
  4153. * Supported values: > 0
  4154. */
  4155. u32 payload_address_lsw;
  4156. /* LSW of 64 bit Payload address. Address should be 32-byte,
  4157. * 4kbyte aligned and must be contig memory.
  4158. */
  4159. u32 payload_address_msw;
  4160. /* MSW of 64 bit Payload address. In case of 32-bit shared
  4161. * memory address, this field must be set to zero. In case of 36-bit
  4162. * shared memory address, bit-4 to bit-31 must be set to zero.
  4163. * Address should be 32-byte, 4kbyte aligned and must be contiguous
  4164. * memory.
  4165. */
  4166. u32 mem_map_handle;
  4167. /* Memory map handle returned by
  4168. * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS commands.
  4169. * Supported Values: - NULL -- Message. The parameter data is
  4170. * in-band. - Non-NULL -- The parameter data is Out-band.Pointer to
  4171. * - the physical address in shared memory of the payload data.
  4172. * For detailed payload content, see the afe_port_param_data_v2
  4173. * structure
  4174. */
  4175. u32 module_id;
  4176. /* ID of the module to be queried.
  4177. * Supported values: Valid module ID
  4178. */
  4179. u32 param_id;
  4180. /* ID of the parameter to be queried.
  4181. * Supported values: Valid parameter ID
  4182. */
  4183. } __packed;
  4184. #define AFE_PORT_CMD_GET_PARAM_V2 0x000100F0
  4185. /* Payload of the #AFE_PORT_CMD_GET_PARAM_V2 command,
  4186. * which queries for one post/preprocessing parameter of a
  4187. * stream.
  4188. */
  4189. struct afe_port_cmd_get_param_v2 {
  4190. struct apr_hdr apr_hdr;
  4191. /* Port interface and direction (Rx or Tx) to start. */
  4192. u16 port_id;
  4193. /* Maximum data size of the parameter ID/module ID combination.
  4194. * This is a multiple of four bytes
  4195. * Supported values: > 0
  4196. */
  4197. u16 payload_size;
  4198. /* The memory mapping header to be used when requesting outband */
  4199. struct mem_mapping_hdr mem_hdr;
  4200. /* The module ID of the parameter data requested */
  4201. u32 module_id;
  4202. /* The parameter ID of the parameter data requested */
  4203. u32 param_id;
  4204. /* The header information for the parameter data */
  4205. struct param_hdr_v1 param_hdr;
  4206. } __packed;
  4207. #define AFE_PORT_CMDRSP_GET_PARAM_V2 0x00010106
  4208. /* Payload of the #AFE_PORT_CMDRSP_GET_PARAM_V2 message, which
  4209. * responds to an #AFE_PORT_CMD_GET_PARAM_V2 command.
  4210. *
  4211. * Immediately following this structure is the parameters structure
  4212. * (afe_port_param_data) containing the response(acknowledgment)
  4213. * parameter payload. This payload is included for an in-band
  4214. * scenario. For an address/shared memory-based set parameter, this
  4215. * payload is not needed.
  4216. */
  4217. struct afe_port_cmdrsp_get_param_v2 {
  4218. u32 status;
  4219. struct param_hdr_v1 param_hdr;
  4220. u8 param_data[0];
  4221. } __packed;
  4222. #define AFE_PORT_CMD_GET_PARAM_V3 0x000100FB
  4223. struct afe_port_cmd_get_param_v3 {
  4224. /* APR Header */
  4225. struct apr_hdr apr_hdr;
  4226. /* Port ID of the AFE port to configure. Port interface and direction
  4227. * (Rx or Tx) to configure. An even number represents the Rx direction,
  4228. * and an odd number represents the Tx direction.
  4229. */
  4230. u16 port_id;
  4231. /* Reserved. This field must be set to zero. */
  4232. u16 reserved;
  4233. /* The memory mapping header to be used when requesting outband */
  4234. struct mem_mapping_hdr mem_hdr;
  4235. /* The header information for the parameter data */
  4236. struct param_hdr_v3 param_hdr;
  4237. } __packed;
  4238. #define AFE_PORT_CMDRSP_GET_PARAM_V3 0x00010108
  4239. struct afe_port_cmdrsp_get_param_v3 {
  4240. /* The status of the command */
  4241. uint32_t status;
  4242. /* The header information for the parameter data */
  4243. struct param_hdr_v3 param_hdr;
  4244. /* The parameter data to be filled when sent inband */
  4245. u8 param_data[0];
  4246. } __packed;
  4247. #define AFE_PARAM_ID_LPASS_CORE_SHARED_CLOCK_CONFIG 0x0001028C
  4248. #define AFE_API_VERSION_LPASS_CORE_SHARED_CLK_CONFIG 0x1
  4249. /* Payload of the AFE_PARAM_ID_LPASS_CORE_SHARED_CLOCK_CONFIG parameter used by
  4250. * AFE_MODULE_AUDIO_DEV_INTERFACE.
  4251. */
  4252. struct afe_param_id_lpass_core_shared_clk_cfg {
  4253. u32 lpass_core_shared_clk_cfg_minor_version;
  4254. /*
  4255. * Minor version used for lpass core shared clock configuration
  4256. * Supported value: AFE_API_VERSION_LPASS_CORE_SHARED_CLK_CONFIG
  4257. */
  4258. u32 enable;
  4259. /*
  4260. * Specifies whether the lpass core shared clock is
  4261. * enabled (1) or disabled (0).
  4262. */
  4263. } __packed;
  4264. /* adsp_afe_service_commands.h */
  4265. #define ADSP_MEMORY_MAP_EBI_POOL 0
  4266. #define ADSP_MEMORY_MAP_SMI_POOL 1
  4267. #define ADSP_MEMORY_MAP_IMEM_POOL 2
  4268. #define ADSP_MEMORY_MAP_SHMEM8_4K_POOL 3
  4269. #define ADSP_MEMORY_MAP_MDF_SHMEM_4K_POOL 4
  4270. /* Definition of virtual memory flag */
  4271. #define ADSP_MEMORY_MAP_VIRTUAL_MEMORY 1
  4272. /* Definition of physical memory flag */
  4273. #define ADSP_MEMORY_MAP_PHYSICAL_MEMORY 0
  4274. #define NULL_POPP_TOPOLOGY 0x00010C68
  4275. #define NULL_COPP_TOPOLOGY 0x00010312
  4276. #define DEFAULT_COPP_TOPOLOGY 0x00010314
  4277. #define DEFAULT_POPP_TOPOLOGY 0x00010BE4
  4278. #define COMPRESSED_PASSTHROUGH_DEFAULT_TOPOLOGY 0x0001076B
  4279. #define COMPRESSED_PASSTHROUGH_NONE_TOPOLOGY 0x00010774
  4280. #define VPM_TX_SM_ECNS_V2_COPP_TOPOLOGY 0x00010F89
  4281. #define VPM_TX_VOICE_SMECNS_V2_COPP_TOPOLOGY 0x10000003
  4282. #define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72
  4283. #define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75
  4284. #define VPM_TX_DM_RFECNS_COPP_TOPOLOGY 0x00010F86
  4285. #define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX 0x10015002
  4286. #define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_AUDIOSPHERE 0x10028000
  4287. /* Memory map regions command payload used by the
  4288. * #ASM_CMD_SHARED_MEM_MAP_REGIONS ,#ADM_CMD_SHARED_MEM_MAP_REGIONS
  4289. * commands.
  4290. *
  4291. * This structure allows clients to map multiple shared memory
  4292. * regions in a single command. Following this structure are
  4293. * num_regions of avs_shared_map_region_payload.
  4294. */
  4295. struct avs_cmd_shared_mem_map_regions {
  4296. struct apr_hdr hdr;
  4297. u16 mem_pool_id;
  4298. /* Type of memory on which this memory region is mapped.
  4299. *
  4300. * Supported values: - #ADSP_MEMORY_MAP_EBI_POOL -
  4301. * #ADSP_MEMORY_MAP_SMI_POOL - #ADSP_MEMORY_MAP_IMEM_POOL
  4302. * (unsupported) - #ADSP_MEMORY_MAP_SHMEM8_4K_POOL - Other values
  4303. * are reserved
  4304. *
  4305. * The memory ID implicitly defines the characteristics of the
  4306. * memory. Characteristics may include alignment type, permissions,
  4307. * etc.
  4308. *
  4309. * SHMEM8_4K is shared memory, byte addressable, and 4 KB aligned.
  4310. */
  4311. u16 num_regions;
  4312. /* Number of regions to map.*/
  4313. u32 property_flag;
  4314. /* Configures one common property for all the regions in the
  4315. * payload. No two regions in the same memory map regions cmd can
  4316. * have differnt property. Supported values: - 0x00000000 to
  4317. * 0x00000001
  4318. *
  4319. * b0 - bit 0 indicates physical or virtual mapping 0 shared memory
  4320. * address provided in avs_shared_map_regions_payload is physical
  4321. * address. The shared memory needs to be mapped( hardware TLB
  4322. * entry)
  4323. *
  4324. * and a software entry needs to be added for internal book keeping.
  4325. *
  4326. * 1 Shared memory address provided in MayPayload[usRegions] is
  4327. * virtual address. The shared memory must not be mapped (since
  4328. * hardware TLB entry is already available) but a software entry
  4329. * needs to be added for internal book keeping. This can be useful
  4330. * if two services with in ADSP is communicating via APR. They can
  4331. * now directly communicate via the Virtual address instead of
  4332. * Physical address. The virtual regions must be contiguous.
  4333. *
  4334. * b31-b1 - reserved bits. must be set to zero
  4335. */
  4336. } __packed;
  4337. struct avs_shared_map_region_payload {
  4338. u32 shm_addr_lsw;
  4339. /* least significant word of shared memory address of the memory
  4340. * region to map. It must be contiguous memory, and it must be 4 KB
  4341. * aligned.
  4342. */
  4343. u32 shm_addr_msw;
  4344. /* most significant word of shared memory address of the memory
  4345. * region to map. For 32 bit shared memory address, this field must
  4346. * tbe set to zero. For 36 bit shared memory address, bit31 to bit 4
  4347. * must be set to zero
  4348. */
  4349. u32 mem_size_bytes;
  4350. /* Number of bytes in the region.
  4351. *
  4352. * The aDSP will always map the regions as virtual contiguous
  4353. * memory, but the memory size must be in multiples of 4 KB to avoid
  4354. * gaps in the virtually contiguous mapped memory.
  4355. */
  4356. } __packed;
  4357. struct avs_cmd_shared_mem_unmap_regions {
  4358. struct apr_hdr hdr;
  4359. u32 mem_map_handle;
  4360. /* memory map handle returned by ASM_CMD_SHARED_MEM_MAP_REGIONS
  4361. * , ADM_CMD_SHARED_MEM_MAP_REGIONS, commands
  4362. */
  4363. } __packed;
  4364. /* Memory map command response payload used by the
  4365. * #ASM_CMDRSP_SHARED_MEM_MAP_REGIONS
  4366. * ,#ADM_CMDRSP_SHARED_MEM_MAP_REGIONS
  4367. */
  4368. struct avs_cmdrsp_shared_mem_map_regions {
  4369. u32 mem_map_handle;
  4370. /* A memory map handle encapsulating shared memory attributes is
  4371. * returned
  4372. */
  4373. } __packed;
  4374. #define AVS_MDF_MDSP_PROC_ID 0x2
  4375. #define AVS_MDF_SSC_PROC_ID 0x3
  4376. #define AVS_MDF_CDSP_PROC_ID 0x4
  4377. /* Shared memory map command payload used by the
  4378. * #AVCS_CMD_MAP_MDF_SHARED_MEMORY.
  4379. *
  4380. * This structure allows clients to map multiple shared memory
  4381. * regions with remote processor ID. All mapped regions must be
  4382. * from the same memory pool. Following this structure are
  4383. * num_regions of avs_shared_map_region_payload.
  4384. */
  4385. struct avs_cmd_map_mdf_shared_memory {
  4386. struct apr_hdr hdr;
  4387. uint32_t mem_map_handle;
  4388. /* Unique identifier for the shared memory address.
  4389. *
  4390. * The aDSP returns this handle for
  4391. * #AVCS_CMD_SHARED_MEM_MAP_REGIONS
  4392. *
  4393. * Supported values:
  4394. * Any 32-bit value
  4395. *
  4396. * The aDSP uses this handle to retrieve the shared memory
  4397. * attributes. This handle can be an abstract representation
  4398. * of the shared memory regions that are being mapped.
  4399. */
  4400. uint32_t proc_id;
  4401. /* Supported values:
  4402. * #AVS_MDF_MDSP_PROC_ID
  4403. * #AVS_MDF_SSC_PROC_ID
  4404. * #AVS_MDF_CDSP_PROC_ID
  4405. */
  4406. uint32_t num_regions;
  4407. /* Number of regions to be mapped with the remote DSP processor
  4408. * mentioned by proc_id field.
  4409. *
  4410. * Array of structures of avs_shared_map_region_payload will follow.
  4411. * The address fields in those arrays should correspond to the remote
  4412. * processor mentioned by proc_id.
  4413. * In case of DSPs with SMMU enabled, the address should be IOVA.
  4414. * And for DSPs without SMMU, the address should be physical address.
  4415. */
  4416. } __packed;
  4417. /*adsp_audio_memmap_api.h*/
  4418. /* ASM related data structures */
  4419. struct asm_wma_cfg {
  4420. u16 format_tag;
  4421. u16 ch_cfg;
  4422. u32 sample_rate;
  4423. u32 avg_bytes_per_sec;
  4424. u16 block_align;
  4425. u16 valid_bits_per_sample;
  4426. u32 ch_mask;
  4427. u16 encode_opt;
  4428. u16 adv_encode_opt;
  4429. u32 adv_encode_opt2;
  4430. u32 drc_peak_ref;
  4431. u32 drc_peak_target;
  4432. u32 drc_ave_ref;
  4433. u32 drc_ave_target;
  4434. } __packed;
  4435. struct asm_wmapro_cfg {
  4436. u16 format_tag;
  4437. u16 ch_cfg;
  4438. u32 sample_rate;
  4439. u32 avg_bytes_per_sec;
  4440. u16 block_align;
  4441. u16 valid_bits_per_sample;
  4442. u32 ch_mask;
  4443. u16 encode_opt;
  4444. u16 adv_encode_opt;
  4445. u32 adv_encode_opt2;
  4446. u32 drc_peak_ref;
  4447. u32 drc_peak_target;
  4448. u32 drc_ave_ref;
  4449. u32 drc_ave_target;
  4450. } __packed;
  4451. struct asm_aac_cfg {
  4452. u16 format;
  4453. u16 aot;
  4454. u16 ep_config;
  4455. u16 section_data_resilience;
  4456. u16 scalefactor_data_resilience;
  4457. u16 spectral_data_resilience;
  4458. u16 ch_cfg;
  4459. u16 reserved;
  4460. u32 sample_rate;
  4461. } __packed;
  4462. struct asm_amrwbplus_cfg {
  4463. u32 size_bytes;
  4464. u32 version;
  4465. u32 num_channels;
  4466. u32 amr_band_mode;
  4467. u32 amr_dtx_mode;
  4468. u32 amr_frame_fmt;
  4469. u32 amr_lsf_idx;
  4470. } __packed;
  4471. struct asm_flac_cfg {
  4472. u32 sample_rate;
  4473. u32 ext_sample_rate;
  4474. u32 min_frame_size;
  4475. u32 max_frame_size;
  4476. u16 stream_info_present;
  4477. u16 min_blk_size;
  4478. u16 max_blk_size;
  4479. u16 ch_cfg;
  4480. u16 sample_size;
  4481. u16 md5_sum;
  4482. };
  4483. struct asm_alac_cfg {
  4484. u32 frame_length;
  4485. u8 compatible_version;
  4486. u8 bit_depth;
  4487. u8 pb;
  4488. u8 mb;
  4489. u8 kb;
  4490. u8 num_channels;
  4491. u16 max_run;
  4492. u32 max_frame_bytes;
  4493. u32 avg_bit_rate;
  4494. u32 sample_rate;
  4495. u32 channel_layout_tag;
  4496. };
  4497. struct asm_g711_dec_cfg {
  4498. u32 sample_rate;
  4499. };
  4500. struct asm_vorbis_cfg {
  4501. u32 bit_stream_fmt;
  4502. };
  4503. struct asm_ape_cfg {
  4504. u16 compatible_version;
  4505. u16 compression_level;
  4506. u32 format_flags;
  4507. u32 blocks_per_frame;
  4508. u32 final_frame_blocks;
  4509. u32 total_frames;
  4510. u16 bits_per_sample;
  4511. u16 num_channels;
  4512. u32 sample_rate;
  4513. u32 seek_table_present;
  4514. };
  4515. struct asm_dsd_cfg {
  4516. u16 num_version;
  4517. u16 is_bitwise_big_endian;
  4518. u16 dsd_channel_block_size;
  4519. u16 num_channels;
  4520. u8 channel_mapping[8];
  4521. u32 dsd_data_rate;
  4522. };
  4523. struct asm_softpause_params {
  4524. u32 enable;
  4525. u32 period;
  4526. u32 step;
  4527. u32 rampingcurve;
  4528. } __packed;
  4529. struct asm_softvolume_params {
  4530. u32 period;
  4531. u32 step;
  4532. u32 rampingcurve;
  4533. } __packed;
  4534. #define ASM_END_POINT_DEVICE_MATRIX 0
  4535. #define PCM_CHANNEL_NULL 0
  4536. /* Front left channel. */
  4537. #define PCM_CHANNEL_FL 1
  4538. /* Front right channel. */
  4539. #define PCM_CHANNEL_FR 2
  4540. /* Front center channel. */
  4541. #define PCM_CHANNEL_FC 3
  4542. /* Left surround channel.*/
  4543. #define PCM_CHANNEL_LS 4
  4544. /* Right surround channel.*/
  4545. #define PCM_CHANNEL_RS 5
  4546. /* Low frequency effect channel. */
  4547. #define PCM_CHANNEL_LFE 6
  4548. /* Center surround channel; Rear center channel. */
  4549. #define PCM_CHANNEL_CS 7
  4550. /* Left back channel; Rear left channel. */
  4551. #define PCM_CHANNEL_LB 8
  4552. /* Right back channel; Rear right channel. */
  4553. #define PCM_CHANNEL_RB 9
  4554. /* Top surround channel. */
  4555. #define PCM_CHANNELS 10
  4556. /* Center vertical height channel.*/
  4557. #define PCM_CHANNEL_CVH 11
  4558. /* Mono surround channel.*/
  4559. #define PCM_CHANNEL_MS 12
  4560. /* Front left of center. */
  4561. #define PCM_CHANNEL_FLC 13
  4562. /* Front right of center. */
  4563. #define PCM_CHANNEL_FRC 14
  4564. /* Rear left of center. */
  4565. #define PCM_CHANNEL_RLC 15
  4566. /* Rear right of center. */
  4567. #define PCM_CHANNEL_RRC 16
  4568. /* Second low frequency channel. */
  4569. #define PCM_CHANNEL_LFE2 17
  4570. /* Side left channel. */
  4571. #define PCM_CHANNEL_SL 18
  4572. /* Side right channel. */
  4573. #define PCM_CHANNEL_SR 19
  4574. /* Top front left channel. */
  4575. #define PCM_CHANNEL_TFL 20
  4576. /* Left vertical height channel. */
  4577. #define PCM_CHANNEL_LVH 20
  4578. /* Top front right channel. */
  4579. #define PCM_CHANNEL_TFR 21
  4580. /* Right vertical height channel. */
  4581. #define PCM_CHANNEL_RVH 21
  4582. /* Top center channel. */
  4583. #define PCM_CHANNEL_TC 22
  4584. /* Top back left channel. */
  4585. #define PCM_CHANNEL_TBL 23
  4586. /* Top back right channel. */
  4587. #define PCM_CHANNEL_TBR 24
  4588. /* Top side left channel. */
  4589. #define PCM_CHANNEL_TSL 25
  4590. /* Top side right channel. */
  4591. #define PCM_CHANNEL_TSR 26
  4592. /* Top back center channel. */
  4593. #define PCM_CHANNEL_TBC 27
  4594. /* Bottom front center channel. */
  4595. #define PCM_CHANNEL_BFC 28
  4596. /* Bottom front left channel. */
  4597. #define PCM_CHANNEL_BFL 29
  4598. /* Bottom front right channel. */
  4599. #define PCM_CHANNEL_BFR 30
  4600. /* Left wide channel. */
  4601. #define PCM_CHANNEL_LW 31
  4602. /* Right wide channel. */
  4603. #define PCM_CHANNEL_RW 32
  4604. /* Left side direct channel. */
  4605. #define PCM_CHANNEL_LSD 33
  4606. /* Right side direct channel. */
  4607. #define PCM_CHANNEL_RSD 34
  4608. #define PCM_FORMAT_MAX_NUM_CHANNEL 8
  4609. #define PCM_FORMAT_MAX_CHANNELS_9 9
  4610. /* Used for ADM_CMD_DEVICE_OPEN_V8 */
  4611. #define PCM_FORMAT_MAX_NUM_CHANNEL_V8 32
  4612. #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2 0x00010DA5
  4613. #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 0x00010DDC
  4614. #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 0x0001320C
  4615. #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 0x00013222
  4616. #define ASM_MEDIA_FMT_EVRCB_FS 0x00010BEF
  4617. #define ASM_MEDIA_FMT_EVRCWB_FS 0x00010BF0
  4618. #define ASM_MEDIA_FMT_GENERIC_COMPRESSED 0x00013212
  4619. #define ASM_MAX_EQ_BANDS 12
  4620. #define ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2 0x00010D98
  4621. struct asm_data_cmd_media_fmt_update_v2 {
  4622. u32 fmt_blk_size;
  4623. /* Media format block size in bytes.*/
  4624. } __packed;
  4625. struct asm_generic_compressed_fmt_blk_t {
  4626. struct apr_hdr hdr;
  4627. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  4628. /*
  4629. * Channel mapping array of bitstream output.
  4630. * Channel[i] mapping describes channel i inside the buffer, where
  4631. * i < num_channels. All valid used channels must be
  4632. * present at the beginning of the array.
  4633. */
  4634. uint8_t channel_mapping[8];
  4635. /*
  4636. * Number of channels of the incoming bitstream.
  4637. * Supported values: 1,2,3,4,5,6,7,8
  4638. */
  4639. uint16_t num_channels;
  4640. /*
  4641. * Nominal bits per sample value of the incoming bitstream.
  4642. * Supported values: 16, 32
  4643. */
  4644. uint16_t bits_per_sample;
  4645. /*
  4646. * Nominal sampling rate of the incoming bitstream.
  4647. * Supported values: 8000, 11025, 16000, 22050, 24000, 32000,
  4648. * 44100, 48000, 88200, 96000, 176400, 192000,
  4649. * 352800, 384000
  4650. */
  4651. uint32_t sampling_rate;
  4652. } __packed;
  4653. /* Command to send sample rate & channels for IEC61937 (compressed) or IEC60958
  4654. * (pcm) streams. Both audio standards use the same format and are used for
  4655. * HDMI or SPDIF output.
  4656. */
  4657. #define ASM_DATA_CMD_IEC_60958_MEDIA_FMT 0x0001321E
  4658. struct asm_iec_compressed_fmt_blk_t {
  4659. struct apr_hdr hdr;
  4660. /*
  4661. * Nominal sampling rate of the incoming bitstream.
  4662. * Supported values: 8000, 11025, 16000, 22050, 24000, 32000,
  4663. * 44100, 48000, 88200, 96000, 176400, 192000,
  4664. * 352800, 384000
  4665. */
  4666. uint32_t sampling_rate;
  4667. /*
  4668. * Number of channels of the incoming bitstream.
  4669. * Supported values: 1,2,3,4,5,6,7,8
  4670. */
  4671. uint32_t num_channels;
  4672. } __packed;
  4673. struct asm_multi_channel_pcm_fmt_blk_v2 {
  4674. struct apr_hdr hdr;
  4675. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  4676. u16 num_channels;
  4677. /* Number of channels. Supported values: 1 to 8 */
  4678. u16 bits_per_sample;
  4679. /* Number of bits per sample per channel. * Supported values:
  4680. * 16, 24 * When used for playback, the client must send 24-bit
  4681. * samples packed in 32-bit words. The 24-bit samples must be placed
  4682. * in the most significant 24 bits of the 32-bit word. When used for
  4683. * recording, the aDSP sends 24-bit samples packed in 32-bit words.
  4684. * The 24-bit samples are placed in the most significant 24 bits of
  4685. * the 32-bit word.
  4686. */
  4687. u32 sample_rate;
  4688. /* Number of samples per second (in Hertz).
  4689. * Supported values: 2000 to 48000
  4690. */
  4691. u16 is_signed;
  4692. /* Flag that indicates the samples are signed (1). */
  4693. u16 reserved;
  4694. /* reserved field for 32 bit alignment. must be set to zero. */
  4695. u8 channel_mapping[8];
  4696. /* Channel array of size 8.
  4697. * Supported values:
  4698. * - #PCM_CHANNEL_L
  4699. * - #PCM_CHANNEL_R
  4700. * - #PCM_CHANNEL_C
  4701. * - #PCM_CHANNEL_LS
  4702. * - #PCM_CHANNEL_RS
  4703. * - #PCM_CHANNEL_LFE
  4704. * - #PCM_CHANNEL_CS
  4705. * - #PCM_CHANNEL_LB
  4706. * - #PCM_CHANNEL_RB
  4707. * - #PCM_CHANNELS
  4708. * - #PCM_CHANNEL_CVH
  4709. * - #PCM_CHANNEL_MS
  4710. * - #PCM_CHANNEL_FLC
  4711. * - #PCM_CHANNEL_FRC
  4712. * - #PCM_CHANNEL_RLC
  4713. * - #PCM_CHANNEL_RRC
  4714. *
  4715. * Channel[i] mapping describes channel I. Each element i of the
  4716. * array describes channel I inside the buffer where 0 @le I <
  4717. * num_channels. An unused channel is set to zero.
  4718. */
  4719. } __packed;
  4720. struct asm_multi_channel_pcm_fmt_blk_v3 {
  4721. uint16_t num_channels;
  4722. /*
  4723. * Number of channels
  4724. * Supported values: 1 to 8
  4725. */
  4726. uint16_t bits_per_sample;
  4727. /*
  4728. * Number of bits per sample per channel
  4729. * Supported values: 16, 24
  4730. */
  4731. uint32_t sample_rate;
  4732. /*
  4733. * Number of samples per second
  4734. * Supported values: 2000 to 48000, 96000,192000 Hz
  4735. */
  4736. uint16_t is_signed;
  4737. /* Flag that indicates that PCM samples are signed (1) */
  4738. uint16_t sample_word_size;
  4739. /*
  4740. * Size in bits of the word that holds a sample of a channel.
  4741. * Supported values: 12,24,32
  4742. */
  4743. uint8_t channel_mapping[8];
  4744. /*
  4745. * Each element, i, in the array describes channel i inside the buffer where
  4746. * 0 <= i < num_channels. Unused channels are set to 0.
  4747. */
  4748. } __packed;
  4749. struct asm_multi_channel_pcm_fmt_blk_v4 {
  4750. uint16_t num_channels;
  4751. /*
  4752. * Number of channels
  4753. * Supported values: 1 to 8
  4754. */
  4755. uint16_t bits_per_sample;
  4756. /*
  4757. * Number of bits per sample per channel
  4758. * Supported values: 16, 24, 32
  4759. */
  4760. uint32_t sample_rate;
  4761. /*
  4762. * Number of samples per second
  4763. * Supported values: 2000 to 48000, 96000,192000 Hz
  4764. */
  4765. uint16_t is_signed;
  4766. /* Flag that indicates that PCM samples are signed (1) */
  4767. uint16_t sample_word_size;
  4768. /*
  4769. * Size in bits of the word that holds a sample of a channel.
  4770. * Supported values: 12,24,32
  4771. */
  4772. uint8_t channel_mapping[8];
  4773. /*
  4774. * Each element, i, in the array describes channel i inside the buffer where
  4775. * 0 <= i < num_channels. Unused channels are set to 0.
  4776. */
  4777. uint16_t endianness;
  4778. /*
  4779. * Flag to indicate the endianness of the pcm sample
  4780. * Supported values: 0 - Little endian (all other formats)
  4781. * 1 - Big endian (AIFF)
  4782. */
  4783. uint16_t mode;
  4784. /*
  4785. * Mode to provide additional info about the pcm input data.
  4786. * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
  4787. * Q31 for unpacked 24b or 32b)
  4788. * 15 - for 16 bit
  4789. * 23 - for 24b packed or 8.24 format
  4790. * 31 - for 24b unpacked or 32bit
  4791. */
  4792. } __packed;
  4793. struct asm_multi_channel_pcm_fmt_blk_v5 {
  4794. uint16_t num_channels;
  4795. /*
  4796. * Number of channels
  4797. * Supported values: 1 to 32
  4798. */
  4799. uint16_t bits_per_sample;
  4800. /*
  4801. * Number of bits per sample per channel
  4802. * Supported values: 16, 24, 32
  4803. */
  4804. uint32_t sample_rate;
  4805. /*
  4806. * Number of samples per second
  4807. * Supported values: 2000 to 48000, 96000,192000 Hz
  4808. */
  4809. uint16_t is_signed;
  4810. /* Flag that indicates that PCM samples are signed (1) */
  4811. uint16_t sample_word_size;
  4812. /*
  4813. * Size in bits of the word that holds a sample of a channel.
  4814. * Supported values: 12,24,32
  4815. */
  4816. uint16_t endianness;
  4817. /*
  4818. * Flag to indicate the endianness of the pcm sample
  4819. * Supported values: 0 - Little endian (all other formats)
  4820. * 1 - Big endian (AIFF)
  4821. */
  4822. uint16_t mode;
  4823. /*
  4824. * Mode to provide additional info about the pcm input data.
  4825. * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
  4826. * Q31 for unpacked 24b or 32b)
  4827. * 15 - for 16 bit
  4828. * 23 - for 24b packed or 8.24 format
  4829. * 31 - for 24b unpacked or 32bit
  4830. */
  4831. uint8_t channel_mapping[32];
  4832. /*
  4833. * Each element, i, in the array describes channel i inside the buffer where
  4834. * 0 <= i < num_channels. Unused channels are set to 0.
  4835. */
  4836. } __packed;
  4837. /*
  4838. * Payload of the multichannel PCM configuration parameters in
  4839. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 media format.
  4840. */
  4841. struct asm_multi_channel_pcm_fmt_blk_param_v3 {
  4842. struct apr_hdr hdr;
  4843. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  4844. struct asm_multi_channel_pcm_fmt_blk_v3 param;
  4845. } __packed;
  4846. /*
  4847. * Payload of the multichannel PCM configuration parameters in
  4848. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 media format.
  4849. */
  4850. struct asm_multi_channel_pcm_fmt_blk_param_v4 {
  4851. struct apr_hdr hdr;
  4852. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  4853. struct asm_multi_channel_pcm_fmt_blk_v4 param;
  4854. } __packed;
  4855. /*
  4856. * Payload of the multichannel PCM configuration parameters in
  4857. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 media format.
  4858. */
  4859. struct asm_multi_channel_pcm_fmt_blk_param_v5 {
  4860. struct apr_hdr hdr;
  4861. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  4862. struct asm_multi_channel_pcm_fmt_blk_v5 param;
  4863. } __packed;
  4864. struct asm_stream_cmd_set_encdec_param {
  4865. u32 param_id;
  4866. /* ID of the parameter. */
  4867. u32 param_size;
  4868. /* Data size of this parameter, in bytes. The size is a multiple
  4869. * of 4 bytes.
  4870. */
  4871. } __packed;
  4872. struct asm_enc_cfg_blk_param_v2 {
  4873. u32 frames_per_buf;
  4874. /* Number of encoded frames to pack into each buffer.
  4875. *
  4876. * @note1hang This is only guidance information for the aDSP. The
  4877. * number of encoded frames put into each buffer (specified by the
  4878. * client) is less than or equal to this number.
  4879. */
  4880. u32 enc_cfg_blk_size;
  4881. /* Size in bytes of the encoder configuration block that follows
  4882. * this member.
  4883. */
  4884. } __packed;
  4885. struct asm_custom_enc_cfg_t_v2 {
  4886. struct apr_hdr hdr;
  4887. struct asm_stream_cmd_set_encdec_param encdec;
  4888. struct asm_enc_cfg_blk_param_v2 encblk;
  4889. uint32_t sample_rate;
  4890. uint16_t num_channels;
  4891. uint16_t reserved;
  4892. /* num_ch == 1, then PCM_CHANNEL_C,
  4893. * num_ch == 2, then {PCM_CHANNEL_L, PCM_CHANNEL_R}
  4894. */
  4895. uint8_t channel_mapping[8];
  4896. uint32_t custom_size;
  4897. uint8_t custom_data[15];
  4898. } __packed;
  4899. /* @brief Dolby Digital Plus end point configuration structure
  4900. */
  4901. struct asm_dec_ddp_endp_param_v2 {
  4902. struct apr_hdr hdr;
  4903. struct asm_stream_cmd_set_encdec_param encdec;
  4904. int endp_param_value;
  4905. } __packed;
  4906. /*
  4907. * Payload of the multichannel PCM encoder configuration parameters in
  4908. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 media format.
  4909. */
  4910. struct asm_multi_channel_pcm_enc_cfg_v5 {
  4911. struct apr_hdr hdr;
  4912. struct asm_stream_cmd_set_encdec_param encdec;
  4913. struct asm_enc_cfg_blk_param_v2 encblk;
  4914. uint16_t num_channels;
  4915. /*
  4916. * Number of PCM channels.
  4917. * @values
  4918. * - 0 -- Native mode
  4919. * - 1 -- 8 channels
  4920. * Native mode indicates that encoding must be performed with the number
  4921. * of channels at the input.
  4922. */
  4923. uint16_t bits_per_sample;
  4924. /*
  4925. * Number of bits per sample per channel.
  4926. * @values 16, 24
  4927. */
  4928. uint32_t sample_rate;
  4929. /*
  4930. * Number of samples per second.
  4931. * @values 0, 8000 to 48000 Hz
  4932. * A value of 0 indicates the native sampling rate. Encoding is
  4933. * performed at the input sampling rate.
  4934. */
  4935. uint16_t is_signed;
  4936. /*
  4937. * Flag that indicates the PCM samples are signed (1). Currently, only
  4938. * signed PCM samples are supported.
  4939. */
  4940. uint16_t sample_word_size;
  4941. /*
  4942. * The size in bits of the word that holds a sample of a channel.
  4943. * @values 16, 24, 32
  4944. * 16-bit samples are always placed in 16-bit words:
  4945. * sample_word_size = 1.
  4946. * 24-bit samples can be placed in 32-bit words or in consecutive
  4947. * 24-bit words.
  4948. * - If sample_word_size = 32, 24-bit samples are placed in the
  4949. * most significant 24 bits of a 32-bit word.
  4950. * - If sample_word_size = 24, 24-bit samples are placed in
  4951. * 24-bit words. @tablebulletend
  4952. */
  4953. uint16_t endianness;
  4954. /*
  4955. * Flag to indicate the endianness of the pcm sample
  4956. * Supported values: 0 - Little endian (all other formats)
  4957. * 1 - Big endian (AIFF)
  4958. */
  4959. uint16_t mode;
  4960. /*
  4961. * Mode to provide additional info about the pcm input data.
  4962. * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
  4963. * Q31 for unpacked 24b or 32b)
  4964. * 15 - for 16 bit
  4965. * 23 - for 24b packed or 8.24 format
  4966. */
  4967. uint8_t channel_mapping[PCM_FORMAT_MAX_NUM_CHANNEL_V8];
  4968. /*
  4969. * Channel mapping array expected at the encoder output.
  4970. * Channel[i] mapping describes channel i inside the buffer, where
  4971. * 0 @le i < num_channels. All valid used channels must be present at
  4972. * the beginning of the array.
  4973. * If Native mode is set for the channels, this field is ignored.
  4974. * @values See Section @xref{dox:PcmChannelDefs}
  4975. */
  4976. } __packed;
  4977. /*
  4978. * Payload of the multichannel PCM encoder configuration parameters in
  4979. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 media format.
  4980. */
  4981. struct asm_multi_channel_pcm_enc_cfg_v4 {
  4982. struct apr_hdr hdr;
  4983. struct asm_stream_cmd_set_encdec_param encdec;
  4984. struct asm_enc_cfg_blk_param_v2 encblk;
  4985. uint16_t num_channels;
  4986. /*
  4987. * Number of PCM channels.
  4988. * @values
  4989. * - 0 -- Native mode
  4990. * - 1 -- 8 channels
  4991. * Native mode indicates that encoding must be performed with the number
  4992. * of channels at the input.
  4993. */
  4994. uint16_t bits_per_sample;
  4995. /*
  4996. * Number of bits per sample per channel.
  4997. * @values 16, 24
  4998. */
  4999. uint32_t sample_rate;
  5000. /*
  5001. * Number of samples per second.
  5002. * @values 0, 8000 to 48000 Hz
  5003. * A value of 0 indicates the native sampling rate. Encoding is
  5004. * performed at the input sampling rate.
  5005. */
  5006. uint16_t is_signed;
  5007. /*
  5008. * Flag that indicates the PCM samples are signed (1). Currently, only
  5009. * signed PCM samples are supported.
  5010. */
  5011. uint16_t sample_word_size;
  5012. /*
  5013. * The size in bits of the word that holds a sample of a channel.
  5014. * @values 16, 24, 32
  5015. * 16-bit samples are always placed in 16-bit words:
  5016. * sample_word_size = 1.
  5017. * 24-bit samples can be placed in 32-bit words or in consecutive
  5018. * 24-bit words.
  5019. * - If sample_word_size = 32, 24-bit samples are placed in the
  5020. * most significant 24 bits of a 32-bit word.
  5021. * - If sample_word_size = 24, 24-bit samples are placed in
  5022. * 24-bit words. @tablebulletend
  5023. */
  5024. uint8_t channel_mapping[8];
  5025. /*
  5026. * Channel mapping array expected at the encoder output.
  5027. * Channel[i] mapping describes channel i inside the buffer, where
  5028. * 0 @le i < num_channels. All valid used channels must be present at
  5029. * the beginning of the array.
  5030. * If Native mode is set for the channels, this field is ignored.
  5031. * @values See Section @xref{dox:PcmChannelDefs}
  5032. */
  5033. uint16_t endianness;
  5034. /*
  5035. * Flag to indicate the endianness of the pcm sample
  5036. * Supported values: 0 - Little endian (all other formats)
  5037. * 1 - Big endian (AIFF)
  5038. */
  5039. uint16_t mode;
  5040. /*
  5041. * Mode to provide additional info about the pcm input data.
  5042. * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
  5043. * Q31 for unpacked 24b or 32b)
  5044. * 15 - for 16 bit
  5045. * 23 - for 24b packed or 8.24 format
  5046. * 31 - for 24b unpacked or 32bit
  5047. */
  5048. } __packed;
  5049. /*
  5050. * Payload of the multichannel PCM encoder configuration parameters in
  5051. * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 media format.
  5052. */
  5053. struct asm_multi_channel_pcm_enc_cfg_v3 {
  5054. struct apr_hdr hdr;
  5055. struct asm_stream_cmd_set_encdec_param encdec;
  5056. struct asm_enc_cfg_blk_param_v2 encblk;
  5057. uint16_t num_channels;
  5058. /*
  5059. * Number of PCM channels.
  5060. * @values
  5061. * - 0 -- Native mode
  5062. * - 1 -- 8 channels
  5063. * Native mode indicates that encoding must be performed with the number
  5064. * of channels at the input.
  5065. */
  5066. uint16_t bits_per_sample;
  5067. /*
  5068. * Number of bits per sample per channel.
  5069. * @values 16, 24
  5070. */
  5071. uint32_t sample_rate;
  5072. /*
  5073. * Number of samples per second.
  5074. * @values 0, 8000 to 48000 Hz
  5075. * A value of 0 indicates the native sampling rate. Encoding is
  5076. * performed at the input sampling rate.
  5077. */
  5078. uint16_t is_signed;
  5079. /*
  5080. * Flag that indicates the PCM samples are signed (1). Currently, only
  5081. * signed PCM samples are supported.
  5082. */
  5083. uint16_t sample_word_size;
  5084. /*
  5085. * The size in bits of the word that holds a sample of a channel.
  5086. * @values 16, 24, 32
  5087. * 16-bit samples are always placed in 16-bit words:
  5088. * sample_word_size = 1.
  5089. * 24-bit samples can be placed in 32-bit words or in consecutive
  5090. * 24-bit words.
  5091. * - If sample_word_size = 32, 24-bit samples are placed in the
  5092. * most significant 24 bits of a 32-bit word.
  5093. * - If sample_word_size = 24, 24-bit samples are placed in
  5094. * 24-bit words. @tablebulletend
  5095. */
  5096. uint8_t channel_mapping[8];
  5097. /*
  5098. * Channel mapping array expected at the encoder output.
  5099. * Channel[i] mapping describes channel i inside the buffer, where
  5100. * 0 @le i < num_channels. All valid used channels must be present at
  5101. * the beginning of the array.
  5102. * If Native mode is set for the channels, this field is ignored.
  5103. * @values See Section @xref{dox:PcmChannelDefs}
  5104. */
  5105. };
  5106. /* @brief Multichannel PCM encoder configuration structure used
  5107. * in the #ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 command.
  5108. */
  5109. struct asm_multi_channel_pcm_enc_cfg_v2 {
  5110. struct apr_hdr hdr;
  5111. struct asm_stream_cmd_set_encdec_param encdec;
  5112. struct asm_enc_cfg_blk_param_v2 encblk;
  5113. uint16_t num_channels;
  5114. /*< Number of PCM channels.
  5115. *
  5116. * Supported values: - 0 -- Native mode - 1 -- 8 Native mode
  5117. * indicates that encoding must be performed with the number of
  5118. * channels at the input.
  5119. */
  5120. uint16_t bits_per_sample;
  5121. /*< Number of bits per sample per channel.
  5122. * Supported values: 16, 24
  5123. */
  5124. uint32_t sample_rate;
  5125. /*< Number of samples per second (in Hertz).
  5126. *
  5127. * Supported values: 0, 8000 to 48000 A value of 0 indicates the
  5128. * native sampling rate. Encoding is performed at the input sampling
  5129. * rate.
  5130. */
  5131. uint16_t is_signed;
  5132. /*< Specifies whether the samples are signed (1). Currently,
  5133. * only signed samples are supported.
  5134. */
  5135. uint16_t reserved;
  5136. /*< reserved field for 32 bit alignment. must be set to zero.*/
  5137. uint8_t channel_mapping[8];
  5138. } __packed;
  5139. #define ASM_MEDIA_FMT_MP3 0x00010BE9
  5140. #define ASM_MEDIA_FMT_AAC_V2 0x00010DA6
  5141. /* @xreflabel
  5142. * {hdr:AsmMediaFmtDolbyAac} Media format ID for the
  5143. * Dolby AAC decoder. This format ID is be used if the client wants
  5144. * to use the Dolby AAC decoder to decode MPEG2 and MPEG4 AAC
  5145. * contents.
  5146. */
  5147. #define ASM_MEDIA_FMT_DOLBY_AAC 0x00010D86
  5148. /* Enumeration for the audio data transport stream AAC format. */
  5149. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS 0
  5150. /* Enumeration for low overhead audio stream AAC format. */
  5151. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS 1
  5152. /* Enumeration for the audio data interchange format
  5153. * AAC format.
  5154. */
  5155. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF 2
  5156. /* Enumeration for the raw AAC format. */
  5157. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW 3
  5158. /* Enumeration for the AAC LATM format. */
  5159. #define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LATM 4
  5160. #define ASM_MEDIA_FMT_AAC_AOT_LC 2
  5161. #define ASM_MEDIA_FMT_AAC_AOT_SBR 5
  5162. #define ASM_MEDIA_FMT_AAC_AOT_PS 29
  5163. #define ASM_MEDIA_FMT_AAC_AOT_BSAC 22
  5164. struct asm_aac_fmt_blk_v2 {
  5165. struct apr_hdr hdr;
  5166. struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
  5167. u16 aac_fmt_flag;
  5168. /* Bitstream format option.
  5169. * Supported values:
  5170. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
  5171. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS
  5172. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF
  5173. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
  5174. */
  5175. u16 audio_objype;
  5176. /* Audio Object Type (AOT) present in the AAC stream.
  5177. * Supported values:
  5178. * - #ASM_MEDIA_FMT_AAC_AOT_LC
  5179. * - #ASM_MEDIA_FMT_AAC_AOT_SBR
  5180. * - #ASM_MEDIA_FMT_AAC_AOT_BSAC
  5181. * - #ASM_MEDIA_FMT_AAC_AOT_PS
  5182. * - Otherwise -- Not supported
  5183. */
  5184. u16 channel_config;
  5185. /* Number of channels present in the AAC stream.
  5186. * Supported values:
  5187. * - 1 -- Mono
  5188. * - 2 -- Stereo
  5189. * - 6 -- 5.1 content
  5190. */
  5191. u16 total_size_of_PCE_bits;
  5192. /* greater or equal to zero. * -In case of RAW formats and
  5193. * channel config = 0 (PCE), client can send * the bit stream
  5194. * containing PCE immediately following this structure * (in-band).
  5195. * -This number does not include bits included for 32 bit alignment.
  5196. * -If zero, then the PCE info is assumed to be available in the
  5197. * audio -bit stream & not in-band.
  5198. */
  5199. u32 sample_rate;
  5200. /* Number of samples per second (in Hertz).
  5201. *
  5202. * Supported values: 8000, 11025, 12000, 16000, 22050, 24000, 32000,
  5203. * 44100, 48000
  5204. *
  5205. * This field must be equal to the sample rate of the AAC-LC
  5206. * decoder's output. - For MP4 or 3GP containers, this is indicated
  5207. * by the samplingFrequencyIndex field in the AudioSpecificConfig
  5208. * element. - For ADTS format, this is indicated by the
  5209. * samplingFrequencyIndex in the ADTS fixed header. - For ADIF
  5210. * format, this is indicated by the samplingFrequencyIndex in the
  5211. * program_config_element present in the ADIF header.
  5212. */
  5213. } __packed;
  5214. struct asm_aac_enc_cfg_v2 {
  5215. struct apr_hdr hdr;
  5216. struct asm_stream_cmd_set_encdec_param encdec;
  5217. struct asm_enc_cfg_blk_param_v2 encblk;
  5218. u32 bit_rate;
  5219. /* Encoding rate in bits per second. */
  5220. u32 enc_mode;
  5221. /* Encoding mode.
  5222. * Supported values:
  5223. * - #ASM_MEDIA_FMT_AAC_AOT_LC
  5224. * - #ASM_MEDIA_FMT_AAC_AOT_SBR
  5225. * - #ASM_MEDIA_FMT_AAC_AOT_PS
  5226. */
  5227. u16 aac_fmt_flag;
  5228. /* AAC format flag.
  5229. * Supported values:
  5230. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
  5231. * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
  5232. */
  5233. u16 channel_cfg;
  5234. /* Number of channels to encode.
  5235. * Supported values:
  5236. * - 0 -- Native mode
  5237. * - 1 -- Mono
  5238. * - 2 -- Stereo
  5239. * - Other values are not supported.
  5240. * @note1hang The eAAC+ encoder mode supports only stereo.
  5241. * Native mode indicates that encoding must be performed with the
  5242. * number of channels at the input.
  5243. * The number of channels must not change during encoding.
  5244. */
  5245. u32 sample_rate;
  5246. /* Number of samples per second.
  5247. * Supported values: - 0 -- Native mode - For other values,
  5248. * Native mode indicates that encoding must be performed with the
  5249. * sampling rate at the input.
  5250. * The sampling rate must not change during encoding.
  5251. */
  5252. } __packed;
  5253. #define ASM_MEDIA_FMT_G711_ALAW_FS 0x00010BF7
  5254. #define ASM_MEDIA_FMT_G711_MLAW_FS 0x00010C2E
  5255. struct asm_g711_enc_cfg_v2 {
  5256. struct apr_hdr hdr;
  5257. struct asm_stream_cmd_set_encdec_param encdec;
  5258. struct asm_enc_cfg_blk_param_v2 encblk;
  5259. u32 sample_rate;
  5260. /*
  5261. * Number of samples per second.
  5262. * Supported values: 8000, 16000 Hz
  5263. */
  5264. } __packed;
  5265. struct asm_vorbis_fmt_blk_v2 {
  5266. struct apr_hdr hdr;
  5267. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5268. u32 bit_stream_fmt;
  5269. /* Bit stream format.
  5270. * Supported values:
  5271. * - 0 -- Raw bitstream
  5272. * - 1 -- Transcoded bitstream
  5273. *
  5274. * Transcoded bitstream containing the size of the frame as the first
  5275. * word in each frame.
  5276. */
  5277. } __packed;
  5278. struct asm_flac_fmt_blk_v2 {
  5279. struct apr_hdr hdr;
  5280. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5281. u16 is_stream_info_present;
  5282. /* Specifies whether stream information is present in the FLAC format
  5283. * block.
  5284. *
  5285. * Supported values:
  5286. * - 0 -- Stream information is not present in this message
  5287. * - 1 -- Stream information is present in this message
  5288. *
  5289. * When set to 1, the FLAC bitstream was successfully parsed by the
  5290. * client, and other fields in the FLAC format block can be read by the
  5291. * decoder to get metadata stream information.
  5292. */
  5293. u16 num_channels;
  5294. /* Number of channels for decoding.
  5295. * Supported values: 1 to 2
  5296. */
  5297. u16 min_blk_size;
  5298. /* Minimum block size (in samples) used in the stream. It must be less
  5299. * than or equal to max_blk_size.
  5300. */
  5301. u16 max_blk_size;
  5302. /* Maximum block size (in samples) used in the stream. If the
  5303. * minimum block size equals the maximum block size, a fixed block
  5304. * size stream is implied.
  5305. */
  5306. u16 md5_sum[8];
  5307. /* MD5 signature array of the unencoded audio data. This allows the
  5308. * decoder to determine if an error exists in the audio data, even when
  5309. * the error does not result in an invalid bitstream.
  5310. */
  5311. u32 sample_rate;
  5312. /* Number of samples per second.
  5313. * Supported values: 8000 to 48000 Hz
  5314. */
  5315. u32 min_frame_size;
  5316. /* Minimum frame size used in the stream.
  5317. * Supported values:
  5318. * - > 0 bytes
  5319. * - 0 -- The value is unknown
  5320. */
  5321. u32 max_frame_size;
  5322. /* Maximum frame size used in the stream.
  5323. * Supported values:
  5324. * -- > 0 bytes
  5325. * -- 0 . The value is unknown
  5326. */
  5327. u16 sample_size;
  5328. /* Bits per sample.Supported values: 8, 16 */
  5329. u16 reserved;
  5330. /* Clients must set this field to zero
  5331. */
  5332. } __packed;
  5333. struct asm_alac_fmt_blk_v2 {
  5334. struct apr_hdr hdr;
  5335. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5336. u32 frame_length;
  5337. u8 compatible_version;
  5338. u8 bit_depth;
  5339. u8 pb;
  5340. u8 mb;
  5341. u8 kb;
  5342. u8 num_channels;
  5343. u16 max_run;
  5344. u32 max_frame_bytes;
  5345. u32 avg_bit_rate;
  5346. u32 sample_rate;
  5347. u32 channel_layout_tag;
  5348. } __packed;
  5349. struct asm_g711_dec_fmt_blk_v2 {
  5350. struct apr_hdr hdr;
  5351. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5352. u32 sample_rate;
  5353. } __packed;
  5354. struct asm_ape_fmt_blk_v2 {
  5355. struct apr_hdr hdr;
  5356. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5357. u16 compatible_version;
  5358. u16 compression_level;
  5359. u32 format_flags;
  5360. u32 blocks_per_frame;
  5361. u32 final_frame_blocks;
  5362. u32 total_frames;
  5363. u16 bits_per_sample;
  5364. u16 num_channels;
  5365. u32 sample_rate;
  5366. u32 seek_table_present;
  5367. } __packed;
  5368. struct asm_dsd_fmt_blk_v2 {
  5369. struct apr_hdr hdr;
  5370. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5371. u16 num_version;
  5372. u16 is_bitwise_big_endian;
  5373. u16 dsd_channel_block_size;
  5374. u16 num_channels;
  5375. u8 channel_mapping[8];
  5376. u32 dsd_data_rate;
  5377. } __packed;
  5378. #define ASM_MEDIA_FMT_AMRNB_FS 0x00010BEB
  5379. /* Enumeration for 4.75 kbps AMR-NB Encoding mode. */
  5380. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MR475 0
  5381. /* Enumeration for 5.15 kbps AMR-NB Encoding mode. */
  5382. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MR515 1
  5383. /* Enumeration for 5.90 kbps AMR-NB Encoding mode. */
  5384. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR59 2
  5385. /* Enumeration for 6.70 kbps AMR-NB Encoding mode. */
  5386. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR67 3
  5387. /* Enumeration for 7.40 kbps AMR-NB Encoding mode. */
  5388. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR74 4
  5389. /* Enumeration for 7.95 kbps AMR-NB Encoding mode. */
  5390. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR795 5
  5391. /* Enumeration for 10.20 kbps AMR-NB Encoding mode. */
  5392. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR102 6
  5393. /* Enumeration for 12.20 kbps AMR-NB Encoding mode. */
  5394. #define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR122 7
  5395. /* Enumeration for AMR-NB Discontinuous Transmission mode off. */
  5396. #define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF 0
  5397. /* Enumeration for AMR-NB DTX mode VAD1. */
  5398. #define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1 1
  5399. /* Enumeration for AMR-NB DTX mode VAD2. */
  5400. #define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD2 2
  5401. /* Enumeration for AMR-NB DTX mode auto. */
  5402. #define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_AUTO 3
  5403. struct asm_amrnb_enc_cfg {
  5404. struct apr_hdr hdr;
  5405. struct asm_stream_cmd_set_encdec_param encdec;
  5406. struct asm_enc_cfg_blk_param_v2 encblk;
  5407. u16 enc_mode;
  5408. /* AMR-NB encoding rate.
  5409. * Supported values:
  5410. * Use the ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_*
  5411. * macros
  5412. */
  5413. u16 dtx_mode;
  5414. /* Specifies whether DTX mode is disabled or enabled.
  5415. * Supported values:
  5416. * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF
  5417. * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1
  5418. */
  5419. } __packed;
  5420. #define ASM_MEDIA_FMT_AMRWB_FS 0x00010BEC
  5421. /* Enumeration for 6.6 kbps AMR-WB Encoding mode. */
  5422. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR66 0
  5423. /* Enumeration for 8.85 kbps AMR-WB Encoding mode. */
  5424. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR885 1
  5425. /* Enumeration for 12.65 kbps AMR-WB Encoding mode. */
  5426. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1265 2
  5427. /* Enumeration for 14.25 kbps AMR-WB Encoding mode. */
  5428. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1425 3
  5429. /* Enumeration for 15.85 kbps AMR-WB Encoding mode. */
  5430. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1585 4
  5431. /* Enumeration for 18.25 kbps AMR-WB Encoding mode. */
  5432. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1825 5
  5433. /* Enumeration for 19.85 kbps AMR-WB Encoding mode. */
  5434. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1985 6
  5435. /* Enumeration for 23.05 kbps AMR-WB Encoding mode. */
  5436. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR2305 7
  5437. /* Enumeration for 23.85 kbps AMR-WB Encoding mode. */
  5438. #define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR2385 8
  5439. struct asm_amrwb_enc_cfg {
  5440. struct apr_hdr hdr;
  5441. struct asm_stream_cmd_set_encdec_param encdec;
  5442. struct asm_enc_cfg_blk_param_v2 encblk;
  5443. u16 enc_mode;
  5444. /* AMR-WB encoding rate.
  5445. * Suupported values:
  5446. * Use the ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_*
  5447. * macros
  5448. */
  5449. u16 dtx_mode;
  5450. /* Specifies whether DTX mode is disabled or enabled.
  5451. * Supported values:
  5452. * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF
  5453. * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1
  5454. */
  5455. } __packed;
  5456. #define ASM_MEDIA_FMT_V13K_FS 0x00010BED
  5457. /* Enumeration for 14.4 kbps V13K Encoding mode. */
  5458. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1440 0
  5459. /* Enumeration for 12.2 kbps V13K Encoding mode. */
  5460. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1220 1
  5461. /* Enumeration for 11.2 kbps V13K Encoding mode. */
  5462. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1120 2
  5463. /* Enumeration for 9.0 kbps V13K Encoding mode. */
  5464. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR90 3
  5465. /* Enumeration for 7.2 kbps V13K eEncoding mode. */
  5466. #define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR720 4
  5467. /* Enumeration for 1/8 vocoder rate.*/
  5468. #define ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE 1
  5469. /* Enumeration for 1/4 vocoder rate. */
  5470. #define ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE 2
  5471. /* Enumeration for 1/2 vocoder rate. */
  5472. #define ASM_MEDIA_FMT_VOC_HALF_RATE 3
  5473. /* Enumeration for full vocoder rate. */
  5474. #define ASM_MEDIA_FMT_VOC_FULL_RATE 4
  5475. struct asm_v13k_enc_cfg {
  5476. struct apr_hdr hdr;
  5477. struct asm_stream_cmd_set_encdec_param encdec;
  5478. struct asm_enc_cfg_blk_param_v2 encblk;
  5479. u16 max_rate;
  5480. /* Maximum allowed encoder frame rate.
  5481. * Supported values:
  5482. * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
  5483. * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
  5484. * - #ASM_MEDIA_FMT_VOC_HALF_RATE
  5485. * - #ASM_MEDIA_FMT_VOC_FULL_RATE
  5486. */
  5487. u16 min_rate;
  5488. /* Minimum allowed encoder frame rate.
  5489. * Supported values:
  5490. * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
  5491. * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
  5492. * - #ASM_MEDIA_FMT_VOC_HALF_RATE
  5493. * - #ASM_MEDIA_FMT_VOC_FULL_RATE
  5494. */
  5495. u16 reduced_rate_cmd;
  5496. /* Reduced rate command, used to change
  5497. * the average bitrate of the V13K
  5498. * vocoder.
  5499. * Supported values:
  5500. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1440 (Default)
  5501. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1220
  5502. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1120
  5503. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR90
  5504. * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR720
  5505. */
  5506. u16 rate_mod_cmd;
  5507. /* Rate modulation command. Default = 0.
  5508. *- If bit 0=1, rate control is enabled.
  5509. *- If bit 1=1, the maximum number of consecutive full rate
  5510. * frames is limited with numbers supplied in
  5511. * bits 2 to 10.
  5512. *- If bit 1=0, the minimum number of non-full rate frames
  5513. * in between two full rate frames is forced to
  5514. * the number supplied in bits 2 to 10. In both cases, if necessary,
  5515. * half rate is used to substitute full rate. - Bits 15 to 10 are
  5516. * reserved and must all be set to zero.
  5517. */
  5518. } __packed;
  5519. #define ASM_MEDIA_FMT_EVRC_FS 0x00010BEE
  5520. /* EVRC encoder configuration structure used in the
  5521. * #ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 command.
  5522. */
  5523. struct asm_evrc_enc_cfg {
  5524. struct apr_hdr hdr;
  5525. struct asm_stream_cmd_set_encdec_param encdec;
  5526. struct asm_enc_cfg_blk_param_v2 encblk;
  5527. u16 max_rate;
  5528. /* Maximum allowed encoder frame rate.
  5529. * Supported values:
  5530. * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
  5531. * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
  5532. * - #ASM_MEDIA_FMT_VOC_HALF_RATE
  5533. * - #ASM_MEDIA_FMT_VOC_FULL_RATE
  5534. */
  5535. u16 min_rate;
  5536. /* Minimum allowed encoder frame rate.
  5537. * Supported values:
  5538. * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
  5539. * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
  5540. * - #ASM_MEDIA_FMT_VOC_HALF_RATE
  5541. * - #ASM_MEDIA_FMT_VOC_FULL_RATE
  5542. */
  5543. u16 rate_mod_cmd;
  5544. /* Rate modulation command. Default: 0.
  5545. * - If bit 0=1, rate control is enabled.
  5546. * - If bit 1=1, the maximum number of consecutive full rate frames
  5547. * is limited with numbers supplied in bits 2 to 10.
  5548. *
  5549. * - If bit 1=0, the minimum number of non-full rate frames in
  5550. * between two full rate frames is forced to the number supplied in
  5551. * bits 2 to 10. In both cases, if necessary, half rate is used to
  5552. * substitute full rate.
  5553. *
  5554. * - Bits 15 to 10 are reserved and must all be set to zero.
  5555. */
  5556. u16 reserved;
  5557. /* Reserved. Clients must set this field to zero. */
  5558. } __packed;
  5559. #define ASM_MEDIA_FMT_WMA_V10PRO_V2 0x00010DA7
  5560. struct asm_wmaprov10_fmt_blk_v2 {
  5561. struct apr_hdr hdr;
  5562. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5563. u16 fmtag;
  5564. /* WMA format type.
  5565. * Supported values:
  5566. * - 0x162 -- WMA 9 Pro
  5567. * - 0x163 -- WMA 9 Pro Lossless
  5568. * - 0x166 -- WMA 10 Pro
  5569. * - 0x167 -- WMA 10 Pro Lossless
  5570. */
  5571. u16 num_channels;
  5572. /* Number of channels encoded in the input stream.
  5573. * Supported values: 1 to 8
  5574. */
  5575. u32 sample_rate;
  5576. /* Number of samples per second (in Hertz).
  5577. * Supported values: 11025, 16000, 22050, 32000, 44100, 48000,
  5578. * 88200, 96000
  5579. */
  5580. u32 avg_bytes_per_sec;
  5581. /* Bitrate expressed as the average bytes per second.
  5582. * Supported values: 2000 to 96000
  5583. */
  5584. u16 blk_align;
  5585. /* Size of the bitstream packet size in bytes. WMA Pro files
  5586. * have a payload of one block per bitstream packet.
  5587. * Supported values: @le 13376
  5588. */
  5589. u16 bits_per_sample;
  5590. /* Number of bits per sample in the encoded WMA stream.
  5591. * Supported values: 16, 24
  5592. */
  5593. u32 channel_mask;
  5594. /* Bit-packed double word (32-bits) that indicates the
  5595. * recommended speaker positions for each source channel.
  5596. */
  5597. u16 enc_options;
  5598. /* Bit-packed word with values that indicate whether certain
  5599. * features of the bitstream are used.
  5600. * Supported values: - 0x0001 -- ENCOPT3_PURE_LOSSLESS - 0x0006 --
  5601. * ENCOPT3_FRM_SIZE_MOD - 0x0038 -- ENCOPT3_SUBFRM_DIV - 0x0040 --
  5602. * ENCOPT3_WRITE_FRAMESIZE_IN_HDR - 0x0080 --
  5603. * ENCOPT3_GENERATE_DRC_PARAMS - 0x0100 -- ENCOPT3_RTMBITS
  5604. */
  5605. u16 usAdvancedEncodeOpt;
  5606. /* Advanced encoding option. */
  5607. u32 advanced_enc_options2;
  5608. /* Advanced encoding option 2. */
  5609. } __packed;
  5610. #define ASM_MEDIA_FMT_WMA_V9_V2 0x00010DA8
  5611. struct asm_wmastdv9_fmt_blk_v2 {
  5612. struct apr_hdr hdr;
  5613. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5614. u16 fmtag;
  5615. /* WMA format tag.
  5616. * Supported values: 0x161 (WMA 9 standard)
  5617. */
  5618. u16 num_channels;
  5619. /* Number of channels in the stream.
  5620. * Supported values: 1, 2
  5621. */
  5622. u32 sample_rate;
  5623. /* Number of samples per second (in Hertz).
  5624. * Supported values: 48000
  5625. */
  5626. u32 avg_bytes_per_sec;
  5627. /* Bitrate expressed as the average bytes per second. */
  5628. u16 blk_align;
  5629. /* Block align. All WMA files with a maximum packet size of
  5630. * 13376 are supported.
  5631. */
  5632. u16 bits_per_sample;
  5633. /* Number of bits per sample in the output.
  5634. * Supported values: 16
  5635. */
  5636. u32 channel_mask;
  5637. /* Channel mask.
  5638. * Supported values:
  5639. * - 3 -- Stereo (front left/front right)
  5640. * - 4 -- Mono (center)
  5641. */
  5642. u16 enc_options;
  5643. /* Options used during encoding. */
  5644. u16 reserved;
  5645. } __packed;
  5646. #define ASM_MEDIA_FMT_WMA_V8 0x00010D91
  5647. struct asm_wmastdv8_enc_cfg {
  5648. struct apr_hdr hdr;
  5649. struct asm_stream_cmd_set_encdec_param encdec;
  5650. struct asm_enc_cfg_blk_param_v2 encblk;
  5651. u32 bit_rate;
  5652. /* Encoding rate in bits per second. */
  5653. u32 sample_rate;
  5654. /* Number of samples per second.
  5655. *
  5656. * Supported values:
  5657. * - 0 -- Native mode
  5658. * - Other Supported values are 22050, 32000, 44100, and 48000.
  5659. *
  5660. * Native mode indicates that encoding must be performed with the
  5661. * sampling rate at the input.
  5662. * The sampling rate must not change during encoding.
  5663. */
  5664. u16 channel_cfg;
  5665. /* Number of channels to encode.
  5666. * Supported values:
  5667. * - 0 -- Native mode
  5668. * - 1 -- Mono
  5669. * - 2 -- Stereo
  5670. * - Other values are not supported.
  5671. *
  5672. * Native mode indicates that encoding must be performed with the
  5673. * number of channels at the input.
  5674. * The number of channels must not change during encoding.
  5675. */
  5676. u16 reserved;
  5677. /* Reserved. Clients must set this field to zero.*/
  5678. } __packed;
  5679. #define ASM_MEDIA_FMT_AMR_WB_PLUS_V2 0x00010DA9
  5680. struct asm_amrwbplus_fmt_blk_v2 {
  5681. struct apr_hdr hdr;
  5682. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  5683. u32 amr_frame_fmt;
  5684. /* AMR frame format.
  5685. * Supported values:
  5686. * - 6 -- Transport Interface Format (TIF)
  5687. * - Any other value -- File storage format (FSF)
  5688. *
  5689. * TIF stream contains 2-byte header for each frame within the
  5690. * superframe. FSF stream contains one 2-byte header per superframe.
  5691. */
  5692. } __packed;
  5693. #define ASM_MEDIA_FMT_AC3 0x00010DEE
  5694. #define ASM_MEDIA_FMT_EAC3 0x00010DEF
  5695. #define ASM_MEDIA_FMT_DTS 0x00010D88
  5696. #define ASM_MEDIA_FMT_MP2 0x00010DE9
  5697. #define ASM_MEDIA_FMT_FLAC 0x00010C16
  5698. #define ASM_MEDIA_FMT_ALAC 0x00012F31
  5699. #define ASM_MEDIA_FMT_VORBIS 0x00010C15
  5700. #define ASM_MEDIA_FMT_APE 0x00012F32
  5701. #define ASM_MEDIA_FMT_DSD 0x00012F3E
  5702. #define ASM_MEDIA_FMT_TRUEHD 0x00013215
  5703. /* 0x0 is used for fomat ID since ADSP dynamically determines the
  5704. * format encapsulated in the IEC61937 (compressed) or IEC60958
  5705. * (pcm) packets.
  5706. */
  5707. #define ASM_MEDIA_FMT_IEC 0x00000000
  5708. /* Media format ID for adaptive transform acoustic coding. This
  5709. * ID is used by the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED command
  5710. * only.
  5711. */
  5712. #define ASM_MEDIA_FMT_ATRAC 0x00010D89
  5713. /* Media format ID for metadata-enhanced audio transmission.
  5714. * This ID is used by the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED
  5715. * command only.
  5716. */
  5717. #define ASM_MEDIA_FMT_MAT 0x00010D8A
  5718. /* adsp_media_fmt.h */
  5719. #define ASM_DATA_CMD_WRITE_V2 0x00010DAB
  5720. struct asm_data_cmd_write_v2 {
  5721. struct apr_hdr hdr;
  5722. u32 buf_addr_lsw;
  5723. /* The 64 bit address msw-lsw should be a valid, mapped address.
  5724. * 64 bit address should be a multiple of 32 bytes
  5725. */
  5726. u32 buf_addr_msw;
  5727. /* The 64 bit address msw-lsw should be a valid, mapped address.
  5728. * 64 bit address should be a multiple of 32 bytes.
  5729. * -Address of the buffer containing the data to be decoded.
  5730. * The buffer should be aligned to a 32 byte boundary.
  5731. * -In the case of 32 bit Shared memory address, msw field must
  5732. * -be set to zero.
  5733. * -In the case of 36 bit shared memory address, bit 31 to bit 4
  5734. * -of msw must be set to zero.
  5735. */
  5736. u32 mem_map_handle;
  5737. /* memory map handle returned by DSP through
  5738. * ASM_CMD_SHARED_MEM_MAP_REGIONS command
  5739. */
  5740. u32 buf_size;
  5741. /* Number of valid bytes available in the buffer for decoding. The
  5742. * first byte starts at buf_addr.
  5743. */
  5744. u32 seq_id;
  5745. /* Optional buffer sequence ID. */
  5746. u32 timestamp_lsw;
  5747. /* Lower 32 bits of the 64-bit session time in microseconds of the
  5748. * first buffer sample.
  5749. */
  5750. u32 timestamp_msw;
  5751. /* Upper 32 bits of the 64-bit session time in microseconds of the
  5752. * first buffer sample.
  5753. */
  5754. u32 flags;
  5755. /* Bitfield of flags.
  5756. * Supported values for bit 31:
  5757. * - 1 -- Valid timestamp.
  5758. * - 0 -- Invalid timestamp.
  5759. * - Use #ASM_BIT_MASKIMESTAMP_VALID_FLAG as the bitmask and
  5760. * #ASM_SHIFTIMESTAMP_VALID_FLAG as the shift value to set this bit.
  5761. * Supported values for bit 30:
  5762. * - 1 -- Last buffer.
  5763. * - 0 -- Not the last buffer.
  5764. *
  5765. * Supported values for bit 29:
  5766. * - 1 -- Continue the timestamp from the previous buffer.
  5767. * - 0 -- Timestamp of the current buffer is not related
  5768. * to the timestamp of the previous buffer.
  5769. * - Use #ASM_BIT_MASKS_CONTINUE_FLAG and #ASM_SHIFTS_CONTINUE_FLAG
  5770. * to set this bit.
  5771. *
  5772. * Supported values for bit 4:
  5773. * - 1 -- End of the frame.
  5774. * - 0 -- Not the end of frame, or this information is not known.
  5775. * - Use #ASM_BIT_MASK_EOF_FLAG as the bitmask and #ASM_SHIFT_EOF_FLAG
  5776. * as the shift value to set this bit.
  5777. *
  5778. * All other bits are reserved and must be set to 0.
  5779. *
  5780. * If bit 31=0 and bit 29=1: The timestamp of the first sample in
  5781. * this buffer continues from the timestamp of the last sample in
  5782. * the previous buffer. If there is no previous buffer (i.e., this
  5783. * is the first buffer sent after opening the stream or after a
  5784. * flush operation), or if the previous buffer does not have a valid
  5785. * timestamp, the samples in the current buffer also do not have a
  5786. * valid timestamp. They are played out as soon as possible.
  5787. *
  5788. *
  5789. * If bit 31=0 and bit 29=0: No timestamp is associated with the
  5790. * first sample in this buffer. The samples are played out as soon
  5791. * as possible.
  5792. *
  5793. *
  5794. * If bit 31=1 and bit 29 is ignored: The timestamp specified in
  5795. * this payload is honored.
  5796. *
  5797. *
  5798. * If bit 30=0: Not the last buffer in the stream. This is useful
  5799. * in removing trailing samples.
  5800. *
  5801. *
  5802. * For bit 4: The client can set this flag for every buffer sent in
  5803. * which the last byte is the end of a frame. If this flag is set,
  5804. * the buffer can contain data from multiple frames, but it should
  5805. * always end at a frame boundary. Restrictions allow the aDSP to
  5806. * detect an end of frame without requiring additional processing.
  5807. */
  5808. } __packed;
  5809. #define ASM_DATA_CMD_READ_V2 0x00010DAC
  5810. struct asm_data_cmd_read_v2 {
  5811. struct apr_hdr hdr;
  5812. u32 buf_addr_lsw;
  5813. /* the 64 bit address msw-lsw should be a valid mapped address
  5814. * and should be a multiple of 32 bytes
  5815. */
  5816. u32 buf_addr_msw;
  5817. /* the 64 bit address msw-lsw should be a valid mapped address
  5818. * and should be a multiple of 32 bytes.
  5819. * - Address of the buffer where the DSP puts the encoded data,
  5820. * potentially, at an offset specified by the uOffset field in
  5821. * ASM_DATA_EVENT_READ_DONE structure. The buffer should be aligned
  5822. * to a 32 byte boundary.
  5823. * - In the case of 32 bit Shared memory address, msw field must
  5824. * - be set to zero.
  5825. * - In the case of 36 bit shared memory address, bit 31 to bit
  5826. * - 4 of msw must be set to zero.
  5827. */
  5828. u32 mem_map_handle;
  5829. /* memory map handle returned by DSP through
  5830. * ASM_CMD_SHARED_MEM_MAP_REGIONS command.
  5831. */
  5832. u32 buf_size;
  5833. /* Number of bytes available for the aDSP to write. The aDSP
  5834. * starts writing from buf_addr.
  5835. */
  5836. u32 seq_id;
  5837. /* Optional buffer sequence ID. */
  5838. } __packed;
  5839. #define ASM_DATA_CMD_EOS 0x00010BDB
  5840. #define ASM_DATA_EVENT_RENDERED_EOS 0x00010C1C
  5841. #define ASM_DATA_EVENT_EOS 0x00010BDD
  5842. #define ASM_DATA_EVENT_WRITE_DONE_V2 0x00010D99
  5843. struct asm_data_event_write_done_v2 {
  5844. u32 buf_addr_lsw;
  5845. /* lsw of the 64 bit address */
  5846. u32 buf_addr_msw;
  5847. /* msw of the 64 bit address. address given by the client in
  5848. * ASM_DATA_CMD_WRITE_V2 command.
  5849. */
  5850. u32 mem_map_handle;
  5851. /* memory map handle in the ASM_DATA_CMD_WRITE_V2 */
  5852. u32 status;
  5853. /* Status message (error code) that indicates whether the
  5854. * referenced buffer has been successfully consumed.
  5855. * Supported values: Refer to @xhyperref{Q3,[Q3]}
  5856. */
  5857. } __packed;
  5858. #define ASM_DATA_EVENT_READ_DONE_V2 0x00010D9A
  5859. /* Definition of the frame metadata flag bitmask.*/
  5860. #define ASM_BIT_MASK_FRAME_METADATA_FLAG (0x40000000UL)
  5861. /* Definition of the frame metadata flag shift value. */
  5862. #define ASM_SHIFT_FRAME_METADATA_FLAG 30
  5863. struct asm_data_event_read_done_v2 {
  5864. u32 status;
  5865. /* Status message (error code).
  5866. * Supported values: Refer to @xhyperref{Q3,[Q3]}
  5867. */
  5868. u32 buf_addr_lsw;
  5869. /* 64 bit address msw-lsw is a valid, mapped address. 64 bit
  5870. * address is a multiple of 32 bytes.
  5871. */
  5872. u32 buf_addr_msw;
  5873. /* 64 bit address msw-lsw is a valid, mapped address. 64 bit
  5874. * address is a multiple of 32 bytes.
  5875. *
  5876. * -Same address provided by the client in ASM_DATA_CMD_READ_V2
  5877. * -In the case of 32 bit Shared memory address, msw field is set to
  5878. * zero.
  5879. * -In the case of 36 bit shared memory address, bit 31 to bit 4
  5880. * -of msw is set to zero.
  5881. */
  5882. u32 mem_map_handle;
  5883. /* memory map handle in the ASM_DATA_CMD_READ_V2 */
  5884. u32 enc_framesotal_size;
  5885. /* Total size of the encoded frames in bytes.
  5886. * Supported values: >0
  5887. */
  5888. u32 offset;
  5889. /* Offset (from buf_addr) to the first byte of the first encoded
  5890. * frame. All encoded frames are consecutive, starting from this
  5891. * offset.
  5892. * Supported values: > 0
  5893. */
  5894. u32 timestamp_lsw;
  5895. /* Lower 32 bits of the 64-bit session time in microseconds of
  5896. * the first sample in the buffer. If Bit 5 of mode_flags flag of
  5897. * ASM_STREAM_CMD_OPEN_READ_V2 is 1 then the 64 bit timestamp is
  5898. * absolute capture time otherwise it is relative session time. The
  5899. * absolute timestamp doesn't reset unless the system is reset.
  5900. */
  5901. u32 timestamp_msw;
  5902. /* Upper 32 bits of the 64-bit session time in microseconds of
  5903. * the first sample in the buffer.
  5904. */
  5905. u32 flags;
  5906. /* Bitfield of flags. Bit 30 indicates whether frame metadata is
  5907. * present. If frame metadata is present, num_frames consecutive
  5908. * instances of @xhyperref{hdr:FrameMetaData,Frame metadata} start
  5909. * at the buffer address.
  5910. * Supported values for bit 31:
  5911. * - 1 -- Timestamp is valid.
  5912. * - 0 -- Timestamp is invalid.
  5913. * - Use #ASM_BIT_MASKIMESTAMP_VALID_FLAG and
  5914. * #ASM_SHIFTIMESTAMP_VALID_FLAG to set this bit.
  5915. *
  5916. * Supported values for bit 30:
  5917. * - 1 -- Frame metadata is present.
  5918. * - 0 -- Frame metadata is absent.
  5919. * - Use #ASM_BIT_MASK_FRAME_METADATA_FLAG and
  5920. * #ASM_SHIFT_FRAME_METADATA_FLAG to set this bit.
  5921. *
  5922. * All other bits are reserved; the aDSP sets them to 0.
  5923. */
  5924. u32 num_frames;
  5925. /* Number of encoded frames in the buffer. */
  5926. u32 seq_id;
  5927. /* Optional buffer sequence ID. */
  5928. } __packed;
  5929. struct asm_data_read_buf_metadata_v2 {
  5930. u32 offset;
  5931. /* Offset from buf_addr in #ASM_DATA_EVENT_READ_DONE_PAYLOAD to
  5932. * the frame associated with this metadata.
  5933. * Supported values: > 0
  5934. */
  5935. u32 frm_size;
  5936. /* Size of the encoded frame in bytes.
  5937. * Supported values: > 0
  5938. */
  5939. u32 num_encoded_pcm_samples;
  5940. /* Number of encoded PCM samples (per channel) in the frame
  5941. * associated with this metadata.
  5942. * Supported values: > 0
  5943. */
  5944. u32 timestamp_lsw;
  5945. /* Lower 32 bits of the 64-bit session time in microseconds of the
  5946. * first sample for this frame.
  5947. * If Bit 5 of mode_flags flag of ASM_STREAM_CMD_OPEN_READ_V2 is 1
  5948. * then the 64 bit timestamp is absolute capture time otherwise it
  5949. * is relative session time. The absolute timestamp doesn't reset
  5950. * unless the system is reset.
  5951. */
  5952. u32 timestamp_msw;
  5953. /* Lower 32 bits of the 64-bit session time in microseconds of the
  5954. * first sample for this frame.
  5955. */
  5956. u32 flags;
  5957. /* Frame flags.
  5958. * Supported values for bit 31:
  5959. * - 1 -- Time stamp is valid
  5960. * - 0 -- Time stamp is not valid
  5961. * - All other bits are reserved; the aDSP sets them to 0.
  5962. */
  5963. } __packed;
  5964. /* Notifies the client of a change in the data sampling rate or
  5965. * Channel mode. This event is raised by the decoder service. The
  5966. * event is enabled through the mode flags of
  5967. * #ASM_STREAM_CMD_OPEN_WRITE_V2 or
  5968. * #ASM_STREAM_CMD_OPEN_READWRITE_V2. - The decoder detects a change
  5969. * in the output sampling frequency or the number/positioning of
  5970. * output channels, or if it is the first frame decoded.The new
  5971. * sampling frequency or the new channel configuration is
  5972. * communicated back to the client asynchronously.
  5973. */
  5974. #define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
  5975. /* Payload of the #ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY event.
  5976. * This event is raised when the following conditions are both true:
  5977. * - The event is enabled through the mode_flags of
  5978. * #ASM_STREAM_CMD_OPEN_WRITE_V2 or
  5979. * #ASM_STREAM_CMD_OPEN_READWRITE_V2. - The decoder detects a change
  5980. * in either the output sampling frequency or the number/positioning
  5981. * of output channels, or if it is the first frame decoded.
  5982. * This event is not raised (even if enabled) if the decoder is
  5983. * MIDI, because
  5984. */
  5985. struct asm_data_event_sr_cm_change_notify {
  5986. u32 sample_rate;
  5987. /* New sampling rate (in Hertz) after detecting a change in the
  5988. * bitstream.
  5989. * Supported values: 2000 to 48000
  5990. */
  5991. u16 num_channels;
  5992. /* New number of channels after detecting a change in the
  5993. * bitstream.
  5994. * Supported values: 1 to 8
  5995. */
  5996. u16 reserved;
  5997. /* Reserved for future use. This field must be set to 0.*/
  5998. u8 channel_mapping[8];
  5999. } __packed;
  6000. /* Notifies the client of a data sampling rate or channel mode
  6001. * change. This event is raised by the encoder service.
  6002. * This event is raised when :
  6003. * - Native mode encoding was requested in the encoder
  6004. * configuration (i.e., the channel number was 0), the sample rate
  6005. * was 0, or both were 0.
  6006. *
  6007. * - The input data frame at the encoder is the first one, or the
  6008. * sampling rate/channel mode is different from the previous input
  6009. * data frame.
  6010. *
  6011. */
  6012. #define ASM_DATA_EVENT_ENC_SR_CM_CHANGE_NOTIFY 0x00010BDE
  6013. struct asm_data_event_enc_sr_cm_change_notify {
  6014. u32 sample_rate;
  6015. /* New sampling rate (in Hertz) after detecting a change in the
  6016. * input data.
  6017. * Supported values: 2000 to 48000
  6018. */
  6019. u16 num_channels;
  6020. /* New number of channels after detecting a change in the input
  6021. * data. Supported values: 1 to 8
  6022. */
  6023. u16 bits_per_sample;
  6024. /* New bits per sample after detecting a change in the input
  6025. * data.
  6026. * Supported values: 16, 24
  6027. */
  6028. u8 channel_mapping[8];
  6029. } __packed;
  6030. #define ASM_DATA_CMD_IEC_60958_FRAME_RATE 0x00010D87
  6031. /* Payload of the #ASM_DATA_CMD_IEC_60958_FRAME_RATE command,
  6032. * which is used to indicate the IEC 60958 frame rate of a given
  6033. * packetized audio stream.
  6034. */
  6035. struct asm_data_cmd_iec_60958_frame_rate {
  6036. u32 frame_rate;
  6037. /* IEC 60958 frame rate of the incoming IEC 61937 packetized stream.
  6038. * Supported values: Any valid frame rate
  6039. */
  6040. } __packed;
  6041. /* adsp_asm_data_commands.h*/
  6042. /* Definition of the stream ID bitmask.*/
  6043. #define ASM_BIT_MASK_STREAM_ID (0x000000FFUL)
  6044. /* Definition of the stream ID shift value.*/
  6045. #define ASM_SHIFT_STREAM_ID 0
  6046. /* Definition of the session ID bitmask.*/
  6047. #define ASM_BIT_MASK_SESSION_ID (0x0000FF00UL)
  6048. /* Definition of the session ID shift value.*/
  6049. #define ASM_SHIFT_SESSION_ID 8
  6050. /* Definition of the service ID bitmask.*/
  6051. #define ASM_BIT_MASK_SERVICE_ID (0x00FF0000UL)
  6052. /* Definition of the service ID shift value.*/
  6053. #define ASM_SHIFT_SERVICE_ID 16
  6054. /* Definition of the domain ID bitmask.*/
  6055. #define ASM_BIT_MASK_DOMAIN_ID (0xFF000000UL)
  6056. /* Definition of the domain ID shift value.*/
  6057. #define ASM_SHIFT_DOMAIN_ID 24
  6058. #define ASM_CMD_SHARED_MEM_MAP_REGIONS 0x00010D92
  6059. #define ASM_CMDRSP_SHARED_MEM_MAP_REGIONS 0x00010D93
  6060. #define ASM_CMD_SHARED_MEM_UNMAP_REGIONS 0x00010D94
  6061. /* adsp_asm_service_commands.h */
  6062. #define ASM_MAX_SESSION_ID (15)
  6063. /* Maximum number of sessions.*/
  6064. #define ASM_MAX_NUM_SESSIONS ASM_MAX_SESSION_ID
  6065. /* Maximum number of streams per session.*/
  6066. #define ASM_MAX_STREAMS_PER_SESSION (8)
  6067. #define ASM_SESSION_CMD_RUN_V2 0x00010DAA
  6068. #define ASM_SESSION_CMD_RUN_STARTIME_RUN_IMMEDIATE 0
  6069. #define ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_ABSOLUTEIME 1
  6070. #define ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_RELATIVEIME 2
  6071. #define ASM_SESSION_CMD_RUN_STARTIME_RUN_WITH_DELAY 3
  6072. #define ASM_BIT_MASK_RUN_STARTIME (0x00000003UL)
  6073. /* Bit shift value used to specify the start time for the
  6074. * ASM_SESSION_CMD_RUN_V2 command.
  6075. */
  6076. #define ASM_SHIFT_RUN_STARTIME 0
  6077. struct asm_session_cmd_run_v2 {
  6078. struct apr_hdr hdr;
  6079. u32 flags;
  6080. /* Specifies whether to run immediately or at a specific
  6081. * rendering time or with a specified delay. Run with delay is
  6082. * useful for delaying in case of ASM loopback opened through
  6083. * ASM_STREAM_CMD_OPEN_LOOPBACK_V2. Use #ASM_BIT_MASK_RUN_STARTIME
  6084. * and #ASM_SHIFT_RUN_STARTIME to set this 2-bit flag.
  6085. *
  6086. *
  6087. *Bits 0 and 1 can take one of four possible values:
  6088. *
  6089. *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_IMMEDIATE
  6090. *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_ABSOLUTEIME
  6091. *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_RELATIVEIME
  6092. *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_WITH_DELAY
  6093. *
  6094. *All other bits are reserved; clients must set them to zero.
  6095. */
  6096. u32 time_lsw;
  6097. /* Lower 32 bits of the time in microseconds used to align the
  6098. * session origin time. When bits 0-1 of flags is
  6099. * ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY, time lsw is the lsw of
  6100. * the delay in us. For ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY,
  6101. * maximum value of the 64 bit delay is 150 ms.
  6102. */
  6103. u32 time_msw;
  6104. /* Upper 32 bits of the time in microseconds used to align the
  6105. * session origin time. When bits 0-1 of flags is
  6106. * ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY, time msw is the msw of
  6107. * the delay in us. For ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY,
  6108. * maximum value of the 64 bit delay is 150 ms.
  6109. */
  6110. } __packed;
  6111. #define ASM_SESSION_CMD_PAUSE 0x00010BD3
  6112. #define ASM_SESSION_CMD_SUSPEND 0x00010DEC
  6113. #define ASM_SESSION_CMD_GET_SESSIONTIME_V3 0x00010D9D
  6114. #define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
  6115. struct asm_session_cmd_rgstr_rx_underflow {
  6116. struct apr_hdr hdr;
  6117. u16 enable_flag;
  6118. /* Specifies whether a client is to receive events when an Rx
  6119. * session underflows.
  6120. * Supported values:
  6121. * - 0 -- Do not send underflow events
  6122. * - 1 -- Send underflow events
  6123. */
  6124. u16 reserved;
  6125. /* Reserved. This field must be set to zero.*/
  6126. } __packed;
  6127. #define ASM_SESSION_CMD_REGISTER_FORX_OVERFLOW_EVENTS 0x00010BD6
  6128. struct asm_session_cmd_regx_overflow {
  6129. struct apr_hdr hdr;
  6130. u16 enable_flag;
  6131. /* Specifies whether a client is to receive events when a Tx
  6132. * session overflows.
  6133. * Supported values:
  6134. * - 0 -- Do not send overflow events
  6135. * - 1 -- Send overflow events
  6136. */
  6137. u16 reserved;
  6138. /* Reserved. This field must be set to zero.*/
  6139. } __packed;
  6140. #define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
  6141. #define ASM_SESSION_EVENTX_OVERFLOW 0x00010C18
  6142. #define ASM_SESSION_CMDRSP_GET_SESSIONTIME_V3 0x00010D9E
  6143. struct asm_session_cmdrsp_get_sessiontime_v3 {
  6144. u32 status;
  6145. /* Status message (error code).
  6146. * Supported values: Refer to @xhyperref{Q3,[Q3]}
  6147. */
  6148. u32 sessiontime_lsw;
  6149. /* Lower 32 bits of the current session time in microseconds.*/
  6150. u32 sessiontime_msw;
  6151. /* Upper 32 bits of the current session time in microseconds.*/
  6152. u32 absolutetime_lsw;
  6153. /* Lower 32 bits in micro seconds of the absolute time at which
  6154. * the * sample corresponding to the above session time gets
  6155. * rendered * to hardware. This absolute time may be slightly in the
  6156. * future or past.
  6157. */
  6158. u32 absolutetime_msw;
  6159. /* Upper 32 bits in micro seconds of the absolute time at which
  6160. * the * sample corresponding to the above session time gets
  6161. * rendered to * hardware. This absolute time may be slightly in the
  6162. * future or past.
  6163. */
  6164. } __packed;
  6165. #define ASM_SESSION_CMD_ADJUST_SESSION_CLOCK_V2 0x00010D9F
  6166. struct asm_session_cmd_adjust_session_clock_v2 {
  6167. struct apr_hdr hdr;
  6168. u32 adjustime_lsw;
  6169. /* Lower 32 bits of the signed 64-bit quantity that specifies the
  6170. * adjustment time in microseconds to the session clock.
  6171. *
  6172. * Positive values indicate advancement of the session clock.
  6173. * Negative values indicate delay of the session clock.
  6174. */
  6175. u32 adjustime_msw;
  6176. /* Upper 32 bits of the signed 64-bit quantity that specifies
  6177. * the adjustment time in microseconds to the session clock.
  6178. * Positive values indicate advancement of the session clock.
  6179. * Negative values indicate delay of the session clock.
  6180. */
  6181. } __packed;
  6182. #define ASM_SESSION_CMDRSP_ADJUST_SESSION_CLOCK_V2 0x00010DA0
  6183. struct asm_session_cmdrsp_adjust_session_clock_v2 {
  6184. u32 status;
  6185. /* Status message (error code).
  6186. * Supported values: Refer to @xhyperref{Q3,[Q3]}
  6187. * An error means the session clock is not adjusted. In this case,
  6188. * the next two fields are irrelevant.
  6189. */
  6190. u32 actual_adjustime_lsw;
  6191. /* Lower 32 bits of the signed 64-bit quantity that specifies
  6192. * the actual adjustment in microseconds performed by the aDSP.
  6193. * A positive value indicates advancement of the session clock. A
  6194. * negative value indicates delay of the session clock.
  6195. */
  6196. u32 actual_adjustime_msw;
  6197. /* Upper 32 bits of the signed 64-bit quantity that specifies
  6198. * the actual adjustment in microseconds performed by the aDSP.
  6199. * A positive value indicates advancement of the session clock. A
  6200. * negative value indicates delay of the session clock.
  6201. */
  6202. u32 cmd_latency_lsw;
  6203. /* Lower 32 bits of the unsigned 64-bit quantity that specifies
  6204. * the amount of time in microseconds taken to perform the session
  6205. * clock adjustment.
  6206. */
  6207. u32 cmd_latency_msw;
  6208. /* Upper 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. } __packed;
  6213. #define ASM_SESSION_CMD_GET_PATH_DELAY_V2 0x00010DAF
  6214. #define ASM_SESSION_CMDRSP_GET_PATH_DELAY_V2 0x00010DB0
  6215. struct asm_session_cmdrsp_get_path_delay_v2 {
  6216. u32 status;
  6217. /* Status message (error code). Whether this get delay operation
  6218. * is successful or not. Delay value is valid only if status is
  6219. * success.
  6220. * Supported values: Refer to @xhyperref{Q5,[Q5]}
  6221. */
  6222. u32 audio_delay_lsw;
  6223. /* Upper 32 bits of the aDSP delay in microseconds. */
  6224. u32 audio_delay_msw;
  6225. /* Lower 32 bits of the aDSP delay in microseconds. */
  6226. } __packed;
  6227. /* adsp_asm_session_command.h*/
  6228. #define ASM_STREAM_CMD_OPEN_WRITE_V3 0x00010DB3
  6229. #define ASM_LOW_LATENCY_STREAM_SESSION 0x10000000
  6230. #define ASM_ULTRA_LOW_LATENCY_STREAM_SESSION 0x20000000
  6231. #define ASM_ULL_POST_PROCESSING_STREAM_SESSION 0x40000000
  6232. #define ASM_LEGACY_STREAM_SESSION 0
  6233. struct asm_stream_cmd_open_write_v3 {
  6234. struct apr_hdr hdr;
  6235. uint32_t mode_flags;
  6236. /* Mode flags that configure the stream to notify the client
  6237. * whenever it detects an SR/CM change at the input to its POPP.
  6238. * Supported values for bits 0 to 1:
  6239. * - Reserved; clients must set them to zero.
  6240. * Supported values for bit 2:
  6241. * - 0 -- SR/CM change notification event is disabled.
  6242. * - 1 -- SR/CM change notification event is enabled.
  6243. * - Use #ASM_BIT_MASK_SR_CM_CHANGE_NOTIFY_FLAG and
  6244. * #ASM_SHIFT_SR_CM_CHANGE_NOTIFY_FLAG to set or get this bit.
  6245. *
  6246. * Supported values for bit 31:
  6247. * - 0 -- Stream to be opened in on-Gapless mode.
  6248. * - 1 -- Stream to be opened in Gapless mode. In Gapless mode,
  6249. * successive streams must be opened with same session ID but
  6250. * different stream IDs.
  6251. *
  6252. * - Use #ASM_BIT_MASK_GAPLESS_MODE_FLAG and
  6253. * #ASM_SHIFT_GAPLESS_MODE_FLAG to set or get this bit.
  6254. *
  6255. *
  6256. * @note1hang MIDI and DTMF streams cannot be opened in Gapless mode.
  6257. */
  6258. uint16_t sink_endpointype;
  6259. /*< Sink point type.
  6260. * Supported values:
  6261. * - 0 -- Device matrix
  6262. * - Other values are reserved.
  6263. *
  6264. * The device matrix is the gateway to the hardware ports.
  6265. */
  6266. uint16_t bits_per_sample;
  6267. /*< Number of bits per sample processed by ASM modules.
  6268. * Supported values: 16 and 24 bits per sample
  6269. */
  6270. uint32_t postprocopo_id;
  6271. /*< Specifies the topology (order of processing) of
  6272. * postprocessing algorithms. <i>None</i> means no postprocessing.
  6273. * Supported values:
  6274. * - #ASM_STREAM_POSTPROCOPO_ID_DEFAULT
  6275. * - #ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL
  6276. * - #ASM_STREAM_POSTPROCOPO_ID_NONE
  6277. *
  6278. * This field can also be enabled through SetParams flags.
  6279. */
  6280. uint32_t dec_fmt_id;
  6281. /*< Configuration ID of the decoder media format.
  6282. *
  6283. * Supported values:
  6284. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6285. * - #ASM_MEDIA_FMT_ADPCM
  6286. * - #ASM_MEDIA_FMT_MP3
  6287. * - #ASM_MEDIA_FMT_AAC_V2
  6288. * - #ASM_MEDIA_FMT_DOLBY_AAC
  6289. * - #ASM_MEDIA_FMT_AMRNB_FS
  6290. * - #ASM_MEDIA_FMT_AMRWB_FS
  6291. * - #ASM_MEDIA_FMT_AMR_WB_PLUS_V2
  6292. * - #ASM_MEDIA_FMT_V13K_FS
  6293. * - #ASM_MEDIA_FMT_EVRC_FS
  6294. * - #ASM_MEDIA_FMT_EVRCB_FS
  6295. * - #ASM_MEDIA_FMT_EVRCWB_FS
  6296. * - #ASM_MEDIA_FMT_SBC
  6297. * - #ASM_MEDIA_FMT_WMA_V10PRO_V2
  6298. * - #ASM_MEDIA_FMT_WMA_V9_V2
  6299. * - #ASM_MEDIA_FMT_AC3
  6300. * - #ASM_MEDIA_FMT_EAC3
  6301. * - #ASM_MEDIA_FMT_G711_ALAW_FS
  6302. * - #ASM_MEDIA_FMT_G711_MLAW_FS
  6303. * - #ASM_MEDIA_FMT_G729A_FS
  6304. * - #ASM_MEDIA_FMT_FR_FS
  6305. * - #ASM_MEDIA_FMT_VORBIS
  6306. * - #ASM_MEDIA_FMT_FLAC
  6307. * - #ASM_MEDIA_FMT_ALAC
  6308. * - #ASM_MEDIA_FMT_APE
  6309. * - #ASM_MEDIA_FMT_EXAMPLE
  6310. */
  6311. } __packed;
  6312. #define ASM_STREAM_CMD_OPEN_PULL_MODE_WRITE 0x00010DD9
  6313. /* Bitmask for the stream_perf_mode subfield. */
  6314. #define ASM_BIT_MASK_STREAM_PERF_FLAG_PULL_MODE_WRITE 0xE0000000UL
  6315. /* Bitmask for the stream_perf_mode subfield. */
  6316. #define ASM_SHIFT_STREAM_PERF_FLAG_PULL_MODE_WRITE 29
  6317. #define ASM_STREAM_CMD_OPEN_PUSH_MODE_READ 0x00010DDA
  6318. #define ASM_BIT_MASK_STREAM_PERF_FLAG_PUSH_MODE_READ 0xE0000000UL
  6319. #define ASM_SHIFT_STREAM_PERF_FLAG_PUSH_MODE_READ 29
  6320. #define ASM_DATA_EVENT_WATERMARK 0x00010DDB
  6321. struct asm_shared_position_buffer {
  6322. volatile uint32_t frame_counter;
  6323. /* Counter used to handle interprocessor synchronization issues.
  6324. * When frame_counter is 0: read_index, wall_clock_us_lsw, and
  6325. * wall_clock_us_msw are invalid.
  6326. * Supported values: >= 0.
  6327. */
  6328. volatile uint32_t index;
  6329. /* Index in bytes from where the aDSP is reading/writing.
  6330. * Supported values: 0 to circular buffer size - 1
  6331. */
  6332. volatile uint32_t wall_clock_us_lsw;
  6333. /* Lower 32 bits of the 64-bit wall clock time in microseconds when the
  6334. * read index was updated.
  6335. * Supported values: >= 0
  6336. */
  6337. volatile uint32_t wall_clock_us_msw;
  6338. /* Upper 32 bits of the 64 bit wall clock time in microseconds when the
  6339. * read index was updated
  6340. * Supported values: >= 0
  6341. */
  6342. } __packed;
  6343. struct asm_shared_watermark_level {
  6344. uint32_t watermark_level_bytes;
  6345. } __packed;
  6346. struct asm_stream_cmd_open_shared_io {
  6347. struct apr_hdr hdr;
  6348. uint32_t mode_flags;
  6349. uint16_t endpoint_type;
  6350. uint16_t topo_bits_per_sample;
  6351. uint32_t topo_id;
  6352. uint32_t fmt_id;
  6353. uint32_t shared_pos_buf_phy_addr_lsw;
  6354. uint32_t shared_pos_buf_phy_addr_msw;
  6355. uint16_t shared_pos_buf_mem_pool_id;
  6356. uint16_t shared_pos_buf_num_regions;
  6357. uint32_t shared_pos_buf_property_flag;
  6358. uint32_t shared_circ_buf_start_phy_addr_lsw;
  6359. uint32_t shared_circ_buf_start_phy_addr_msw;
  6360. uint32_t shared_circ_buf_size;
  6361. uint16_t shared_circ_buf_mem_pool_id;
  6362. uint16_t shared_circ_buf_num_regions;
  6363. uint32_t shared_circ_buf_property_flag;
  6364. uint32_t num_watermark_levels;
  6365. struct asm_multi_channel_pcm_fmt_blk_v3 fmt;
  6366. struct avs_shared_map_region_payload map_region_pos_buf;
  6367. struct avs_shared_map_region_payload map_region_circ_buf;
  6368. struct asm_shared_watermark_level watermark[0];
  6369. } __packed;
  6370. #define ASM_STREAM_CMD_OPEN_READ_V3 0x00010DB4
  6371. /* Definition of the timestamp type flag bitmask */
  6372. #define ASM_BIT_MASKIMESTAMPYPE_FLAG (0x00000020UL)
  6373. /* Definition of the timestamp type flag shift value. */
  6374. #define ASM_SHIFTIMESTAMPYPE_FLAG 5
  6375. /* Relative timestamp is identified by this value.*/
  6376. #define ASM_RELATIVEIMESTAMP 0
  6377. /* Absolute timestamp is identified by this value.*/
  6378. #define ASM_ABSOLUTEIMESTAMP 1
  6379. /* Bit value for Low Latency Tx stream subfield */
  6380. #define ASM_LOW_LATENCY_TX_STREAM_SESSION 1
  6381. /* Bit shift for the stream_perf_mode subfield. */
  6382. #define ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_READ 29
  6383. struct asm_stream_cmd_open_read_v3 {
  6384. struct apr_hdr hdr;
  6385. u32 mode_flags;
  6386. /* Mode flags that indicate whether meta information per encoded
  6387. * frame is to be provided.
  6388. * Supported values for bit 4:
  6389. *
  6390. * - 0 -- Return data buffer contains all encoded frames only; it
  6391. * does not contain frame metadata.
  6392. *
  6393. * - 1 -- Return data buffer contains an array of metadata and
  6394. * encoded frames.
  6395. *
  6396. * - Use #ASM_BIT_MASK_META_INFO_FLAG as the bitmask and
  6397. * #ASM_SHIFT_META_INFO_FLAG as the shift value for this bit.
  6398. *
  6399. *
  6400. * Supported values for bit 5:
  6401. *
  6402. * - ASM_RELATIVEIMESTAMP -- ASM_DATA_EVENT_READ_DONE_V2 will have
  6403. * - relative time-stamp.
  6404. * - ASM_ABSOLUTEIMESTAMP -- ASM_DATA_EVENT_READ_DONE_V2 will
  6405. * - have absolute time-stamp.
  6406. *
  6407. * - Use #ASM_BIT_MASKIMESTAMPYPE_FLAG as the bitmask and
  6408. * #ASM_SHIFTIMESTAMPYPE_FLAG as the shift value for this bit.
  6409. *
  6410. * All other bits are reserved; clients must set them to zero.
  6411. */
  6412. u32 src_endpointype;
  6413. /* Specifies the endpoint providing the input samples.
  6414. * Supported values:
  6415. * - 0 -- Device matrix
  6416. * - All other values are reserved; clients must set them to zero.
  6417. * Otherwise, an error is returned.
  6418. * The device matrix is the gateway from the tunneled Tx ports.
  6419. */
  6420. u32 preprocopo_id;
  6421. /* Specifies the topology (order of processing) of preprocessing
  6422. * algorithms. <i>None</i> means no preprocessing.
  6423. * Supported values:
  6424. * - #ASM_STREAM_PREPROCOPO_ID_DEFAULT
  6425. * - #ASM_STREAM_PREPROCOPO_ID_NONE
  6426. *
  6427. * This field can also be enabled through SetParams flags.
  6428. */
  6429. u32 enc_cfg_id;
  6430. /* Media configuration ID for encoded output.
  6431. * Supported values:
  6432. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6433. * - #ASM_MEDIA_FMT_AAC_V2
  6434. * - #ASM_MEDIA_FMT_AMRNB_FS
  6435. * - #ASM_MEDIA_FMT_AMRWB_FS
  6436. * - #ASM_MEDIA_FMT_V13K_FS
  6437. * - #ASM_MEDIA_FMT_EVRC_FS
  6438. * - #ASM_MEDIA_FMT_EVRCB_FS
  6439. * - #ASM_MEDIA_FMT_EVRCWB_FS
  6440. * - #ASM_MEDIA_FMT_SBC
  6441. * - #ASM_MEDIA_FMT_G711_ALAW_FS
  6442. * - #ASM_MEDIA_FMT_G711_MLAW_FS
  6443. * - #ASM_MEDIA_FMT_G729A_FS
  6444. * - #ASM_MEDIA_FMT_EXAMPLE
  6445. * - #ASM_MEDIA_FMT_WMA_V8
  6446. */
  6447. u16 bits_per_sample;
  6448. /* Number of bits per sample processed by ASM modules.
  6449. * Supported values: 16 and 24 bits per sample
  6450. */
  6451. u16 reserved;
  6452. /* Reserved for future use. This field must be set to zero.*/
  6453. } __packed;
  6454. #define ASM_POPP_OUTPUT_SR_NATIVE_RATE 0
  6455. /* Enumeration for the maximum sampling rate at the POPP output.*/
  6456. #define ASM_POPP_OUTPUT_SR_MAX_RATE 48000
  6457. #define ASM_STREAM_CMD_OPEN_READWRITE_V2 0x00010D8D
  6458. #define ASM_STREAM_CMD_OPEN_READWRITE_V2 0x00010D8D
  6459. struct asm_stream_cmd_open_readwrite_v2 {
  6460. struct apr_hdr hdr;
  6461. u32 mode_flags;
  6462. /* Mode flags.
  6463. * Supported values for bit 2:
  6464. * - 0 -- SR/CM change notification event is disabled.
  6465. * - 1 -- SR/CM change notification event is enabled. Use
  6466. * #ASM_BIT_MASK_SR_CM_CHANGE_NOTIFY_FLAG and
  6467. * #ASM_SHIFT_SR_CM_CHANGE_NOTIFY_FLAG to set or
  6468. * getting this flag.
  6469. *
  6470. * Supported values for bit 4:
  6471. * - 0 -- Return read data buffer contains all encoded frames only; it
  6472. * does not contain frame metadata.
  6473. * - 1 -- Return read data buffer contains an array of metadata and
  6474. * encoded frames.
  6475. *
  6476. * All other bits are reserved; clients must set them to zero.
  6477. */
  6478. u32 postprocopo_id;
  6479. /* Specifies the topology (order of processing) of postprocessing
  6480. * algorithms. <i>None</i> means no postprocessing.
  6481. *
  6482. * Supported values:
  6483. * - #ASM_STREAM_POSTPROCOPO_ID_DEFAULT
  6484. * - #ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL
  6485. * - #ASM_STREAM_POSTPROCOPO_ID_NONE
  6486. */
  6487. u32 dec_fmt_id;
  6488. /* Specifies the media type of the input data. PCM indicates that
  6489. * no decoding must be performed, e.g., this is an NT encoder
  6490. * session.
  6491. * Supported values:
  6492. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6493. * - #ASM_MEDIA_FMT_ADPCM
  6494. * - #ASM_MEDIA_FMT_MP3
  6495. * - #ASM_MEDIA_FMT_AAC_V2
  6496. * - #ASM_MEDIA_FMT_DOLBY_AAC
  6497. * - #ASM_MEDIA_FMT_AMRNB_FS
  6498. * - #ASM_MEDIA_FMT_AMRWB_FS
  6499. * - #ASM_MEDIA_FMT_V13K_FS
  6500. * - #ASM_MEDIA_FMT_EVRC_FS
  6501. * - #ASM_MEDIA_FMT_EVRCB_FS
  6502. * - #ASM_MEDIA_FMT_EVRCWB_FS
  6503. * - #ASM_MEDIA_FMT_SBC
  6504. * - #ASM_MEDIA_FMT_WMA_V10PRO_V2
  6505. * - #ASM_MEDIA_FMT_WMA_V9_V2
  6506. * - #ASM_MEDIA_FMT_AMR_WB_PLUS_V2
  6507. * - #ASM_MEDIA_FMT_AC3
  6508. * - #ASM_MEDIA_FMT_G711_ALAW_FS
  6509. * - #ASM_MEDIA_FMT_G711_MLAW_FS
  6510. * - #ASM_MEDIA_FMT_G729A_FS
  6511. * - #ASM_MEDIA_FMT_EXAMPLE
  6512. */
  6513. u32 enc_cfg_id;
  6514. /* Specifies the media type for the output of the stream. PCM
  6515. * indicates that no encoding must be performed, e.g., this is an NT
  6516. * decoder session.
  6517. * Supported values:
  6518. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6519. * - #ASM_MEDIA_FMT_AAC_V2
  6520. * - #ASM_MEDIA_FMT_AMRNB_FS
  6521. * - #ASM_MEDIA_FMT_AMRWB_FS
  6522. * - #ASM_MEDIA_FMT_V13K_FS
  6523. * - #ASM_MEDIA_FMT_EVRC_FS
  6524. * - #ASM_MEDIA_FMT_EVRCB_FS
  6525. * - #ASM_MEDIA_FMT_EVRCWB_FS
  6526. * - #ASM_MEDIA_FMT_SBC
  6527. * - #ASM_MEDIA_FMT_G711_ALAW_FS
  6528. * - #ASM_MEDIA_FMT_G711_MLAW_FS
  6529. * - #ASM_MEDIA_FMT_G729A_FS
  6530. * - #ASM_MEDIA_FMT_EXAMPLE
  6531. * - #ASM_MEDIA_FMT_WMA_V8
  6532. */
  6533. u16 bits_per_sample;
  6534. /* Number of bits per sample processed by ASM modules.
  6535. * Supported values: 16 and 24 bits per sample
  6536. */
  6537. u16 reserved;
  6538. /* Reserved for future use. This field must be set to zero.*/
  6539. } __packed;
  6540. #define ASM_STREAM_CMD_OPEN_LOOPBACK_V2 0x00010D8E
  6541. struct asm_stream_cmd_open_loopback_v2 {
  6542. struct apr_hdr hdr;
  6543. u32 mode_flags;
  6544. /* Mode flags.
  6545. * Bit 0-31: reserved; client should set these bits to 0
  6546. */
  6547. u16 src_endpointype;
  6548. /* Endpoint type. 0 = Tx Matrix */
  6549. u16 sink_endpointype;
  6550. /* Endpoint type. 0 = Rx Matrix */
  6551. u32 postprocopo_id;
  6552. /* Postprocessor topology ID. Specifies the topology of
  6553. * postprocessing algorithms.
  6554. */
  6555. u16 bits_per_sample;
  6556. /* The number of bits per sample processed by ASM modules
  6557. * Supported values: 16 and 24 bits per sample
  6558. */
  6559. u16 reserved;
  6560. /* Reserved for future use. This field must be set to zero. */
  6561. } __packed;
  6562. #define ASM_STREAM_CMD_OPEN_TRANSCODE_LOOPBACK 0x00010DBA
  6563. /* Bitmask for the stream's Performance mode. */
  6564. #define ASM_BIT_MASK_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK \
  6565. (0x70000000UL)
  6566. /* Bit shift for the stream's Performance mode. */
  6567. #define ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK 28
  6568. /* Bitmask for the decoder converter enable flag. */
  6569. #define ASM_BIT_MASK_DECODER_CONVERTER_FLAG (0x00000078UL)
  6570. /* Shift value for the decoder converter enable flag. */
  6571. #define ASM_SHIFT_DECODER_CONVERTER_FLAG 3
  6572. /* Converter mode is None (Default). */
  6573. #define ASM_CONVERTER_MODE_NONE 0
  6574. /* Converter mode is DDP-to-DD. */
  6575. #define ASM_DDP_DD_CONVERTER_MODE 1
  6576. /* Identifies a special converter mode where source and sink formats
  6577. * are the same but postprocessing must applied. Therefore, Decode
  6578. * @rarrow Re-encode is necessary.
  6579. */
  6580. #define ASM_POST_PROCESS_CONVERTER_MODE 2
  6581. struct asm_stream_cmd_open_transcode_loopback_t {
  6582. struct apr_hdr hdr;
  6583. u32 mode_flags;
  6584. /* Mode Flags specifies the performance mode in which this stream
  6585. * is to be opened.
  6586. * Supported values{for bits 30 to 28}(stream_perf_mode flag)
  6587. *
  6588. * #ASM_LEGACY_STREAM_SESSION -- This mode ensures backward
  6589. * compatibility to the original behavior
  6590. * of ASM_STREAM_CMD_OPEN_TRANSCODE_LOOPBACK
  6591. *
  6592. * #ASM_LOW_LATENCY_STREAM_SESSION -- Opens a loopback session by using
  6593. * shortened buffers in low latency POPP
  6594. * - Recommendation: Do not enable high latency algorithms. They might
  6595. * negate the benefits of opening a low latency stream, and they
  6596. * might also suffer quality degradation from unexpected jitter.
  6597. * - This Low Latency mode is supported only for PCM In and PCM Out
  6598. * loopbacks. An error is returned if Low Latency mode is opened for
  6599. * other transcode loopback modes.
  6600. * - To configure this subfield, use
  6601. * ASM_BIT_MASK_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK and
  6602. * ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK.
  6603. *
  6604. * Supported values{for bits 6 to 3} (decoder-converter compatibility)
  6605. * #ASM_CONVERTER_MODE_NONE (0x0) -- Default
  6606. * #ASM_DDP_DD_CONVERTER_MODE (0x1)
  6607. * #ASM_POST_PROCESS_CONVERTER_MODE (0x2)
  6608. * 0x3-0xF -- Reserved for future use
  6609. * - Use #ASM_BIT_MASK_DECODER_CONVERTER_FLAG and
  6610. * ASM_SHIFT_DECODER_CONVERTER_FLAG to set this bit
  6611. * All other bits are reserved; clients must set them to 0.
  6612. */
  6613. u32 src_format_id;
  6614. /* Specifies the media format of the input audio stream.
  6615. *
  6616. * Supported values
  6617. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6618. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3
  6619. * - #ASM_MEDIA_FMT_DTS
  6620. * - #ASM_MEDIA_FMT_EAC3_DEC
  6621. * - #ASM_MEDIA_FMT_EAC3
  6622. * - #ASM_MEDIA_FMT_AC3_DEC
  6623. * - #ASM_MEDIA_FMT_AC3
  6624. */
  6625. u32 sink_format_id;
  6626. /* Specifies the media format of the output stream.
  6627. *
  6628. * Supported values
  6629. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
  6630. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3
  6631. * - #ASM_MEDIA_FMT_DTS (not supported in Low Latency mode)
  6632. * - #ASM_MEDIA_FMT_EAC3_DEC (not supported in Low Latency mode)
  6633. * - #ASM_MEDIA_FMT_EAC3 (not supported in Low Latency mode)
  6634. * - #ASM_MEDIA_FMT_AC3_DEC (not supported in Low Latency mode)
  6635. * - #ASM_MEDIA_FMT_AC3 (not supported in Low Latency mode)
  6636. */
  6637. u32 audproc_topo_id;
  6638. /* Postprocessing topology ID, which specifies the topology (order of
  6639. * processing) of postprocessing algorithms.
  6640. *
  6641. * Supported values
  6642. * - #ASM_STREAM_POSTPROC_TOPO_ID_DEFAULT
  6643. * - #ASM_STREAM_POSTPROC_TOPO_ID_PEAKMETER
  6644. * - #ASM_STREAM_POSTPROC_TOPO_ID_MCH_PEAK_VOL
  6645. * - #ASM_STREAM_POSTPROC_TOPO_ID_NONE
  6646. * Topologies can be added through #ASM_CMD_ADD_TOPOLOGIES.
  6647. * This field is ignored for the Converter mode, in which no
  6648. * postprocessing is performed.
  6649. */
  6650. u16 src_endpoint_type;
  6651. /* Specifies the source endpoint that provides the input samples.
  6652. *
  6653. * Supported values
  6654. * - 0 -- Tx device matrix or stream router (gateway to the hardware
  6655. * ports)
  6656. * - All other values are reserved
  6657. * Clients must set this field to 0. Otherwise, an error is returned.
  6658. */
  6659. u16 sink_endpoint_type;
  6660. /* Specifies the sink endpoint type.
  6661. *
  6662. * Supported values
  6663. * - 0 -- Rx device matrix or stream router (gateway to the hardware
  6664. * ports)
  6665. * - All other values are reserved
  6666. * Clients must set this field to 0. Otherwise, an error is returned.
  6667. */
  6668. u16 bits_per_sample;
  6669. /* Number of bits per sample processed by the ASM modules.
  6670. * Supported values 16, 24
  6671. */
  6672. u16 reserved;
  6673. /* This field must be set to 0.
  6674. */
  6675. } __packed;
  6676. #define ASM_STREAM_CMD_CLOSE 0x00010BCD
  6677. #define ASM_STREAM_CMD_FLUSH 0x00010BCE
  6678. #define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
  6679. #define ASM_STREAM_CMD_SET_PP_PARAMS_V2 0x00010DA1
  6680. #define ASM_STREAM_CMD_SET_PP_PARAMS_V3 0x0001320D
  6681. /*
  6682. * Structure for the ASM Stream Set PP Params command. Parameter data must be
  6683. * pre-packed with the correct header for either V2 or V3 when sent in-band.
  6684. * Use q6core_pack_pp_params to pack the header and data correctly depending on
  6685. * Instance ID support.
  6686. */
  6687. struct asm_stream_cmd_set_pp_params {
  6688. /* APR Header */
  6689. struct apr_hdr apr_hdr;
  6690. /* The memory mapping header to be used when sending out of band */
  6691. struct mem_mapping_hdr mem_hdr;
  6692. /* The total size of the payload, including the parameter header */
  6693. u32 payload_size;
  6694. /* The parameter data to be filled when sent inband. Parameter data
  6695. * must be pre-packed with parameter header and then copied here. Use
  6696. * q6core_pack_pp_params to pack the header and param data correctly.
  6697. */
  6698. u32 param_data[0];
  6699. } __packed;
  6700. #define ASM_STREAM_CMD_GET_PP_PARAMS_V2 0x00010DA2
  6701. #define ASM_STREAM_CMD_GET_PP_PARAMS_V3 0x0001320E
  6702. struct asm_stream_cmd_get_pp_params_v2 {
  6703. u32 data_payload_addr_lsw;
  6704. /* LSW of the parameter data payload address. */
  6705. u32 data_payload_addr_msw;
  6706. /* MSW of the parameter data payload address.
  6707. * - Size of the shared memory, if specified, shall be large enough
  6708. * to contain the whole ParamData payload, including Module ID,
  6709. * Param ID, Param Size, and Param Values
  6710. * - Must be set to zero for in-band data
  6711. * - In the case of 32 bit Shared memory address, msw field must be
  6712. * set to zero.
  6713. * - In the case of 36 bit shared memory address, bit 31 to bit 4 of
  6714. * msw must be set to zero.
  6715. */
  6716. u32 mem_map_handle;
  6717. /* Supported Values: Any.
  6718. * memory map handle returned by DSP through ASM_CMD_SHARED_MEM_MAP_REGIONS
  6719. * command.
  6720. * if mmhandle is NULL, the ParamData payloads in the ACK are within the
  6721. * message payload (in-band).
  6722. * If mmhandle is non-NULL, the ParamData payloads in the ACK begin at the
  6723. * address specified in the address msw and lsw.
  6724. * (out-of-band).
  6725. */
  6726. u32 module_id;
  6727. /* Unique module ID. */
  6728. u32 param_id;
  6729. /* Unique parameter ID. */
  6730. u16 param_max_size;
  6731. /* Maximum data size of the module_id/param_id combination. This
  6732. * is a multiple of 4 bytes.
  6733. */
  6734. u16 reserved;
  6735. /* Reserved for backward compatibility. Clients must set this
  6736. * field to zero.
  6737. */
  6738. } __packed;
  6739. #define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
  6740. #define ASM_STREAM_CMD_SET_ENCDEC_PARAM_V2 0x00013218
  6741. struct asm_stream_cmd_set_encdec_param_v2 {
  6742. u16 service_id;
  6743. /* 0 - ASM_ENCODER_SVC; 1 - ASM_DECODER_SVC */
  6744. u16 reserved;
  6745. u32 param_id;
  6746. /* ID of the parameter. */
  6747. u32 param_size;
  6748. /*
  6749. * Data size of this parameter, in bytes. The size is a multiple
  6750. * of 4 bytes.
  6751. */
  6752. } __packed;
  6753. #define ASM_STREAM_CMD_REGISTER_ENCDEC_EVENTS 0x00013219
  6754. #define ASM_STREAM_CMD_ENCDEC_EVENTS 0x0001321A
  6755. #define AVS_PARAM_ID_RTIC_SHARED_MEMORY_ADDR 0x00013237
  6756. struct avs_rtic_shared_mem_addr {
  6757. struct apr_hdr hdr;
  6758. struct asm_stream_cmd_set_encdec_param_v2 encdec;
  6759. u32 shm_buf_addr_lsw;
  6760. /* Lower 32 bit of the RTIC shared memory */
  6761. u32 shm_buf_addr_msw;
  6762. /* Upper 32 bit of the RTIC shared memory */
  6763. u32 buf_size;
  6764. /* Size of buffer */
  6765. u16 shm_buf_mem_pool_id;
  6766. /* ADSP_MEMORY_MAP_SHMEM8_4K_POOL */
  6767. u16 shm_buf_num_regions;
  6768. /* number of regions to map */
  6769. u32 shm_buf_flag;
  6770. /* buffer property flag */
  6771. struct avs_shared_map_region_payload map_region;
  6772. /* memory map region*/
  6773. } __packed;
  6774. #define AVS_PARAM_ID_RTIC_EVENT_ACK 0x00013238
  6775. struct avs_param_rtic_event_ack {
  6776. struct apr_hdr hdr;
  6777. struct asm_stream_cmd_set_encdec_param_v2 encdec;
  6778. } __packed;
  6779. #define ASM_PARAM_ID_ENCDEC_BITRATE 0x00010C13
  6780. struct asm_bitrate_param {
  6781. u32 bitrate;
  6782. /* Maximum supported bitrate. Only the AAC encoder is supported.*/
  6783. } __packed;
  6784. #define ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 0x00010DA3
  6785. #define ASM_PARAM_ID_AAC_SBR_PS_FLAG 0x00010C63
  6786. /* Flag to turn off both SBR and PS processing, if they are
  6787. * present in the bitstream.
  6788. */
  6789. #define ASM_AAC_SBR_OFF_PS_OFF (2)
  6790. /* Flag to turn on SBR but turn off PS processing,if they are
  6791. * present in the bitstream.
  6792. */
  6793. #define ASM_AAC_SBR_ON_PS_OFF (1)
  6794. /* Flag to turn on both SBR and PS processing, if they are
  6795. * present in the bitstream (default behavior).
  6796. */
  6797. #define ASM_AAC_SBR_ON_PS_ON (0)
  6798. /* Structure for an AAC SBR PS processing flag. */
  6799. /* Payload of the #ASM_PARAM_ID_AAC_SBR_PS_FLAG parameter in the
  6800. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  6801. */
  6802. struct asm_aac_sbr_ps_flag_param {
  6803. struct apr_hdr hdr;
  6804. struct asm_stream_cmd_set_encdec_param encdec;
  6805. struct asm_enc_cfg_blk_param_v2 encblk;
  6806. u32 sbr_ps_flag;
  6807. /* Control parameter to enable or disable SBR/PS processing in
  6808. * the AAC bitstream. Use the following macros to set this field:
  6809. * - #ASM_AAC_SBR_OFF_PS_OFF -- Turn off both SBR and PS
  6810. * processing, if they are present in the bitstream.
  6811. * - #ASM_AAC_SBR_ON_PS_OFF -- Turn on SBR processing, but not PS
  6812. * processing, if they are present in the bitstream.
  6813. * - #ASM_AAC_SBR_ON_PS_ON -- Turn on both SBR and PS processing,
  6814. * if they are present in the bitstream (default behavior).
  6815. * - All other values are invalid.
  6816. * Changes are applied to the next decoded frame.
  6817. */
  6818. } __packed;
  6819. #define ASM_PARAM_ID_AAC_DUAL_MONO_MAPPING 0x00010C64
  6820. /* First single channel element in a dual mono bitstream.*/
  6821. #define ASM_AAC_DUAL_MONO_MAP_SCE_1 (1)
  6822. /* Second single channel element in a dual mono bitstream.*/
  6823. #define ASM_AAC_DUAL_MONO_MAP_SCE_2 (2)
  6824. /* Structure for AAC decoder dual mono channel mapping. */
  6825. struct asm_aac_dual_mono_mapping_param {
  6826. struct apr_hdr hdr;
  6827. struct asm_stream_cmd_set_encdec_param encdec;
  6828. u16 left_channel_sce;
  6829. u16 right_channel_sce;
  6830. } __packed;
  6831. #define ASM_STREAM_CMDRSP_GET_PP_PARAMS_V2 0x00010DA4
  6832. #define ASM_STREAM_CMDRSP_GET_PP_PARAMS_V3 0x0001320F
  6833. struct asm_stream_cmdrsp_get_pp_params_v2 {
  6834. u32 status;
  6835. } __packed;
  6836. #define ASM_PARAM_ID_AC3_KARAOKE_MODE 0x00010D73
  6837. /* Enumeration for both vocals in a karaoke stream.*/
  6838. #define AC3_KARAOKE_MODE_NO_VOCAL (0)
  6839. /* Enumeration for only the left vocal in a karaoke stream.*/
  6840. #define AC3_KARAOKE_MODE_LEFT_VOCAL (1)
  6841. /* Enumeration for only the right vocal in a karaoke stream.*/
  6842. #define AC3_KARAOKE_MODE_RIGHT_VOCAL (2)
  6843. /* Enumeration for both vocal channels in a karaoke stream.*/
  6844. #define AC3_KARAOKE_MODE_BOTH_VOCAL (3)
  6845. #define ASM_PARAM_ID_AC3_DRC_MODE 0x00010D74
  6846. /* Enumeration for the Custom Analog mode.*/
  6847. #define AC3_DRC_MODE_CUSTOM_ANALOG (0)
  6848. /* Enumeration for the Custom Digital mode.*/
  6849. #define AC3_DRC_MODE_CUSTOM_DIGITAL (1)
  6850. /* Enumeration for the Line Out mode (light compression).*/
  6851. #define AC3_DRC_MODE_LINE_OUT (2)
  6852. /* Enumeration for the RF remodulation mode (heavy compression).*/
  6853. #define AC3_DRC_MODE_RF_REMOD (3)
  6854. #define ASM_PARAM_ID_AC3_DUAL_MONO_MODE 0x00010D75
  6855. /* Enumeration for playing dual mono in stereo mode.*/
  6856. #define AC3_DUAL_MONO_MODE_STEREO (0)
  6857. /* Enumeration for playing left mono.*/
  6858. #define AC3_DUAL_MONO_MODE_LEFT_MONO (1)
  6859. /* Enumeration for playing right mono.*/
  6860. #define AC3_DUAL_MONO_MODE_RIGHT_MONO (2)
  6861. /* Enumeration for mixing both dual mono channels and playing them.*/
  6862. #define AC3_DUAL_MONO_MODE_MIXED_MONO (3)
  6863. #define ASM_PARAM_ID_AC3_STEREO_DOWNMIX_MODE 0x00010D76
  6864. /* Enumeration for using the Downmix mode indicated in the bitstream. */
  6865. #define AC3_STEREO_DOWNMIX_MODE_AUTO_DETECT (0)
  6866. /* Enumeration for Surround Compatible mode (preserves the
  6867. * surround information).
  6868. */
  6869. #define AC3_STEREO_DOWNMIX_MODE_LT_RT (1)
  6870. /* Enumeration for Mono Compatible mode (if the output is to be
  6871. * further downmixed to mono).
  6872. */
  6873. #define AC3_STEREO_DOWNMIX_MODE_LO_RO (2)
  6874. /* ID of the AC3 PCM scale factor parameter in the
  6875. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  6876. */
  6877. #define ASM_PARAM_ID_AC3_PCM_SCALEFACTOR 0x00010D78
  6878. /* ID of the AC3 DRC boost scale factor parameter in the
  6879. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  6880. */
  6881. #define ASM_PARAM_ID_AC3_DRC_BOOST_SCALEFACTOR 0x00010D79
  6882. /* ID of the AC3 DRC cut scale factor parameter in the
  6883. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  6884. */
  6885. #define ASM_PARAM_ID_AC3_DRC_CUT_SCALEFACTOR 0x00010D7A
  6886. /* Structure for AC3 Generic Parameter. */
  6887. /* Payload of the AC3 parameters in the
  6888. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  6889. */
  6890. struct asm_ac3_generic_param {
  6891. struct apr_hdr hdr;
  6892. struct asm_stream_cmd_set_encdec_param encdec;
  6893. struct asm_enc_cfg_blk_param_v2 encblk;
  6894. u32 generic_parameter;
  6895. /* AC3 generic parameter. Select from one of the following
  6896. * possible values.
  6897. *
  6898. * For #ASM_PARAM_ID_AC3_KARAOKE_MODE, supported values are:
  6899. * - AC3_KARAOKE_MODE_NO_VOCAL
  6900. * - AC3_KARAOKE_MODE_LEFT_VOCAL
  6901. * - AC3_KARAOKE_MODE_RIGHT_VOCAL
  6902. * - AC3_KARAOKE_MODE_BOTH_VOCAL
  6903. *
  6904. * For #ASM_PARAM_ID_AC3_DRC_MODE, supported values are:
  6905. * - AC3_DRC_MODE_CUSTOM_ANALOG
  6906. * - AC3_DRC_MODE_CUSTOM_DIGITAL
  6907. * - AC3_DRC_MODE_LINE_OUT
  6908. * - AC3_DRC_MODE_RF_REMOD
  6909. *
  6910. * For #ASM_PARAM_ID_AC3_DUAL_MONO_MODE, supported values are:
  6911. * - AC3_DUAL_MONO_MODE_STEREO
  6912. * - AC3_DUAL_MONO_MODE_LEFT_MONO
  6913. * - AC3_DUAL_MONO_MODE_RIGHT_MONO
  6914. * - AC3_DUAL_MONO_MODE_MIXED_MONO
  6915. *
  6916. * For #ASM_PARAM_ID_AC3_STEREO_DOWNMIX_MODE, supported values are:
  6917. * - AC3_STEREO_DOWNMIX_MODE_AUTO_DETECT
  6918. * - AC3_STEREO_DOWNMIX_MODE_LT_RT
  6919. * - AC3_STEREO_DOWNMIX_MODE_LO_RO
  6920. *
  6921. * For #ASM_PARAM_ID_AC3_PCM_SCALEFACTOR, supported values are
  6922. * 0 to 1 in Q31 format.
  6923. *
  6924. * For #ASM_PARAM_ID_AC3_DRC_BOOST_SCALEFACTOR, supported values are
  6925. * 0 to 1 in Q31 format.
  6926. *
  6927. * For #ASM_PARAM_ID_AC3_DRC_CUT_SCALEFACTOR, supported values are
  6928. * 0 to 1 in Q31 format.
  6929. */
  6930. } __packed;
  6931. /* Enumeration for Raw mode (no downmixing), which specifies
  6932. * that all channels in the bitstream are to be played out as is
  6933. * without any downmixing. (Default)
  6934. */
  6935. #define WMAPRO_CHANNEL_MASK_RAW (-1)
  6936. /* Enumeration for setting the channel mask to 0. The 7.1 mode
  6937. * (Home Theater) is assigned.
  6938. */
  6939. #define WMAPRO_CHANNEL_MASK_ZERO 0x0000
  6940. /* Speaker layout mask for one channel (Home Theater, mono).
  6941. * - Speaker front center
  6942. */
  6943. #define WMAPRO_CHANNEL_MASK_1_C 0x0004
  6944. /* Speaker layout mask for two channels (Home Theater, stereo).
  6945. * - Speaker front left
  6946. * - Speaker front right
  6947. */
  6948. #define WMAPRO_CHANNEL_MASK_2_L_R 0x0003
  6949. /* Speaker layout mask for three channels (Home Theater).
  6950. * - Speaker front left
  6951. * - Speaker front right
  6952. * - Speaker front center
  6953. */
  6954. #define WMAPRO_CHANNEL_MASK_3_L_C_R 0x0007
  6955. /* Speaker layout mask for two channels (stereo).
  6956. * - Speaker back left
  6957. * - Speaker back right
  6958. */
  6959. #define WMAPRO_CHANNEL_MASK_2_Bl_Br 0x0030
  6960. /* Speaker layout mask for four channels.
  6961. * - Speaker front left
  6962. * - Speaker front right
  6963. * - Speaker back left
  6964. * - Speaker back right
  6965. */
  6966. #define WMAPRO_CHANNEL_MASK_4_L_R_Bl_Br 0x0033
  6967. /* Speaker layout mask for four channels (Home Theater).
  6968. * - Speaker front left
  6969. * - Speaker front right
  6970. * - Speaker front center
  6971. * - Speaker back center
  6972. */
  6973. #define WMAPRO_CHANNEL_MASK_4_L_R_C_Bc_HT 0x0107
  6974. /* Speaker layout mask for five channels.
  6975. * - Speaker front left
  6976. * - Speaker front right
  6977. * - Speaker front center
  6978. * - Speaker back left
  6979. * - Speaker back right
  6980. */
  6981. #define WMAPRO_CHANNEL_MASK_5_L_C_R_Bl_Br 0x0037
  6982. /* Speaker layout mask for five channels (5 mode, Home Theater).
  6983. * - Speaker front left
  6984. * - Speaker front right
  6985. * - Speaker front center
  6986. * - Speaker side left
  6987. * - Speaker side right
  6988. */
  6989. #define WMAPRO_CHANNEL_MASK_5_L_C_R_Sl_Sr_HT 0x0607
  6990. /* Speaker layout mask for six channels (5.1 mode).
  6991. * - Speaker front left
  6992. * - Speaker front right
  6993. * - Speaker front center
  6994. * - Speaker low frequency
  6995. * - Speaker back left
  6996. * - Speaker back right
  6997. */
  6998. #define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Bl_Br_SLF 0x003F
  6999. /* Speaker layout mask for six channels (5.1 mode, Home Theater).
  7000. * - Speaker front left
  7001. * - Speaker front right
  7002. * - Speaker front center
  7003. * - Speaker low frequency
  7004. * - Speaker side left
  7005. * - Speaker side right
  7006. */
  7007. #define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Sl_Sr_SLF_HT 0x060F
  7008. /* Speaker layout mask for six channels (5.1 mode, no LFE).
  7009. * - Speaker front left
  7010. * - Speaker front right
  7011. * - Speaker front center
  7012. * - Speaker back left
  7013. * - Speaker back right
  7014. * - Speaker back center
  7015. */
  7016. #define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Bl_Br_Bc 0x0137
  7017. /* Speaker layout mask for six channels (5.1 mode, Home Theater,
  7018. * no LFE).
  7019. * - Speaker front left
  7020. * - Speaker front right
  7021. * - Speaker front center
  7022. * - Speaker back center
  7023. * - Speaker side left
  7024. * - Speaker side right
  7025. */
  7026. #define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Sl_Sr_Bc_HT 0x0707
  7027. /* Speaker layout mask for seven channels (6.1 mode).
  7028. * - Speaker front left
  7029. * - Speaker front right
  7030. * - Speaker front center
  7031. * - Speaker low frequency
  7032. * - Speaker back left
  7033. * - Speaker back right
  7034. * - Speaker back center
  7035. */
  7036. #define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Bl_Br_Bc_SLF 0x013F
  7037. /* Speaker layout mask for seven channels (6.1 mode, Home
  7038. * Theater).
  7039. * - Speaker front left
  7040. * - Speaker front right
  7041. * - Speaker front center
  7042. * - Speaker low frequency
  7043. * - Speaker back center
  7044. * - Speaker side left
  7045. * - Speaker side right
  7046. */
  7047. #define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Sl_Sr_Bc_SLF_HT 0x070F
  7048. /* Speaker layout mask for seven channels (6.1 mode, no LFE).
  7049. * - Speaker front left
  7050. * - Speaker front right
  7051. * - Speaker front center
  7052. * - Speaker back left
  7053. * - Speaker back right
  7054. * - Speaker front left of center
  7055. * - Speaker front right of center
  7056. */
  7057. #define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Bl_Br_SFLOC_SFROC 0x00F7
  7058. /* Speaker layout mask for seven channels (6.1 mode, Home
  7059. * Theater, no LFE).
  7060. * - Speaker front left
  7061. * - Speaker front right
  7062. * - Speaker front center
  7063. * - Speaker side left
  7064. * - Speaker side right
  7065. * - Speaker front left of center
  7066. * - Speaker front right of center
  7067. */
  7068. #define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Sl_Sr_SFLOC_SFROC_HT 0x0637
  7069. /* Speaker layout mask for eight channels (7.1 mode).
  7070. * - Speaker front left
  7071. * - Speaker front right
  7072. * - Speaker front center
  7073. * - Speaker back left
  7074. * - Speaker back right
  7075. * - Speaker low frequency
  7076. * - Speaker front left of center
  7077. * - Speaker front right of center
  7078. */
  7079. #define WMAPRO_CHANNEL_MASK_7DOT1_L_C_R_Bl_Br_SLF_SFLOC_SFROC \
  7080. 0x00FF
  7081. /* Speaker layout mask for eight channels (7.1 mode, Home Theater).
  7082. * - Speaker front left
  7083. * - Speaker front right
  7084. * - Speaker front center
  7085. * - Speaker side left
  7086. * - Speaker side right
  7087. * - Speaker low frequency
  7088. * - Speaker front left of center
  7089. * - Speaker front right of center
  7090. *
  7091. */
  7092. #define WMAPRO_CHANNEL_MASK_7DOT1_L_C_R_Sl_Sr_SLF_SFLOC_SFROC_HT \
  7093. 0x063F
  7094. #define ASM_PARAM_ID_DEC_OUTPUT_CHAN_MAP 0x00010D82
  7095. /* Maximum number of decoder output channels. */
  7096. #define MAX_CHAN_MAP_CHANNELS 16
  7097. /* Structure for decoder output channel mapping. */
  7098. /* Payload of the #ASM_PARAM_ID_DEC_OUTPUT_CHAN_MAP parameter in the
  7099. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  7100. */
  7101. struct asm_dec_out_chan_map_param {
  7102. struct apr_hdr hdr;
  7103. struct asm_stream_cmd_set_encdec_param encdec;
  7104. u32 num_channels;
  7105. /* Number of decoder output channels.
  7106. * Supported values: 0 to #MAX_CHAN_MAP_CHANNELS
  7107. *
  7108. * A value of 0 indicates native channel mapping, which is valid
  7109. * only for NT mode. This means the output of the decoder is to be
  7110. * preserved as is.
  7111. */
  7112. u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];
  7113. } __packed;
  7114. #define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84
  7115. /* Bitmask for the IEC 61937 enable flag.*/
  7116. #define ASM_BIT_MASK_IEC_61937_STREAM_FLAG (0x00000001UL)
  7117. /* Shift value for the IEC 61937 enable flag.*/
  7118. #define ASM_SHIFT_IEC_61937_STREAM_FLAG 0
  7119. /* Bitmask for the IEC 60958 enable flag.*/
  7120. #define ASM_BIT_MASK_IEC_60958_STREAM_FLAG (0x00000002UL)
  7121. /* Shift value for the IEC 60958 enable flag.*/
  7122. #define ASM_SHIFT_IEC_60958_STREAM_FLAG 1
  7123. /* Payload format for open write compressed command */
  7124. /* Payload format for the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED
  7125. * command, which opens a stream for a given session ID and stream ID
  7126. * to be rendered in the compressed format.
  7127. */
  7128. struct asm_stream_cmd_open_write_compressed {
  7129. struct apr_hdr hdr;
  7130. u32 flags;
  7131. /* Mode flags that configure the stream for a specific format.
  7132. * Supported values:
  7133. * - Bit 0 -- IEC 61937 compatibility
  7134. * - 0 -- Stream is not in IEC 61937 format
  7135. * - 1 -- Stream is in IEC 61937 format
  7136. * - Bit 1 -- IEC 60958 compatibility
  7137. * - 0 -- Stream is not in IEC 60958 format
  7138. * - 1 -- Stream is in IEC 60958 format
  7139. * - Bits 2 to 31 -- 0 (Reserved)
  7140. *
  7141. * For the same stream, bit 0 cannot be set to 0 and bit 1 cannot
  7142. * be set to 1. A compressed stream connot have IEC 60958
  7143. * packetization applied without IEC 61937 packetization.
  7144. * @note1hang Currently, IEC 60958 packetized input streams are not
  7145. * supported.
  7146. */
  7147. u32 fmt_id;
  7148. /* Specifies the media type of the HDMI stream to be opened.
  7149. * Supported values:
  7150. * - #ASM_MEDIA_FMT_AC3
  7151. * - #ASM_MEDIA_FMT_EAC3
  7152. * - #ASM_MEDIA_FMT_DTS
  7153. * - #ASM_MEDIA_FMT_ATRAC
  7154. * - #ASM_MEDIA_FMT_MAT
  7155. *
  7156. * @note1hang This field must be set to a valid media type even if
  7157. * IEC 61937 packetization is not performed by the aDSP.
  7158. */
  7159. } __packed;
  7160. /* Indicates the number of samples per channel to be removed from the
  7161. * beginning of the stream.
  7162. */
  7163. #define ASM_DATA_CMD_REMOVE_INITIAL_SILENCE 0x00010D67
  7164. /* Indicates the number of samples per channel to be removed from
  7165. * the end of the stream.
  7166. */
  7167. #define ASM_DATA_CMD_REMOVE_TRAILING_SILENCE 0x00010D68
  7168. struct asm_data_cmd_remove_silence {
  7169. struct apr_hdr hdr;
  7170. u32 num_samples_to_remove;
  7171. /* < Number of samples per channel to be removed.
  7172. * @values 0 to (2@sscr{32}-1)
  7173. */
  7174. } __packed;
  7175. #define ASM_STREAM_CMD_OPEN_READ_COMPRESSED 0x00010D95
  7176. /* Bitmask for the IEC 61937 to 61937 pass-through capture. */
  7177. #define ASM_BIT_MASK_IEC_61937_PASS_THROUGH_FLAG (0x00000001UL)
  7178. /* Shift value for the IEC 61937 to 61937 pass-through capture. */
  7179. #define ASM_SHIFT_IEC_61937_PASS_THROUGH_FLAG 0
  7180. struct asm_stream_cmd_open_read_compressed {
  7181. struct apr_hdr hdr;
  7182. u32 mode_flags;
  7183. /* Mode flags that indicate whether meta information per encoded
  7184. * frame is to be provided and packaging.
  7185. * Supported values for bit 0: (IEC 61937 pass-through mode)
  7186. * - 0 -- Unpack the IEC 61937 format stream to RAW compressed format
  7187. * - 1 -- Pass-through transfer of the IEC 61937 format stream
  7188. * - Use #ASM_BIT_MASK_IEC_61937_PASS_THROUGH_FLAG to set the bitmask
  7189. * and #ASM_SHIFT_IEC_61937_PASS_THROUGH_FLAG to set the shift value
  7190. * for this bit.
  7191. * Supported values for bit 4:
  7192. * - 0 -- Return data buffer contains all encoded frames only; it does
  7193. * not contain frame metadata.
  7194. * - 1 -- Return data buffer contains an array of metadata and encoded
  7195. * frames.
  7196. * - Use #ASM_BIT_MASK_META_INFO_FLAG to set the bitmask and
  7197. * #ASM_SHIFT_META_INFO_FLAG to set the shift value for this bit.
  7198. * All other bits are reserved; clients must set them to zero.
  7199. */
  7200. u32 frames_per_buf;
  7201. /* Indicates the number of frames that need to be returned per
  7202. * read buffer
  7203. * Supported values: should be greater than 0 for IEC to RAW compressed
  7204. * unpack mode.
  7205. * Value is don't care for IEC 61937 pass-through mode.
  7206. */
  7207. } __packed;
  7208. /* adsp_asm_stream_commands.h*/
  7209. /* adsp_asm_api.h (no changes)*/
  7210. #define ASM_STREAM_POSTPROCOPO_ID_DEFAULT \
  7211. 0x00010BE4
  7212. #define ASM_STREAM_POSTPROCOPO_ID_PEAKMETER \
  7213. 0x00010D83
  7214. #define ASM_STREAM_POSTPROCOPO_ID_NONE \
  7215. 0x00010C68
  7216. #define ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL \
  7217. 0x00010D8B
  7218. #define ASM_STREAM_PREPROCOPO_ID_DEFAULT \
  7219. ASM_STREAM_POSTPROCOPO_ID_DEFAULT
  7220. #define ASM_STREAM_PREPROCOPO_ID_NONE \
  7221. ASM_STREAM_POSTPROCOPO_ID_NONE
  7222. #define ADM_CMD_COPP_OPENOPOLOGY_ID_NONE_AUDIO_COPP \
  7223. 0x00010312
  7224. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MONO_AUDIO_COPP \
  7225. 0x00010313
  7226. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP \
  7227. 0x00010314
  7228. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_IIR_AUDIO_COPP\
  7229. 0x00010704
  7230. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MONO_AUDIO_COPP_MBDRCV2\
  7231. 0x0001070D
  7232. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP_MBDRCV2\
  7233. 0x0001070E
  7234. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_IIR_AUDIO_COPP_MBDRCV2\
  7235. 0x0001070F
  7236. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP_MBDRC_V3 \
  7237. 0x11000000
  7238. #define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MCH_PEAK_VOL \
  7239. 0x0001031B
  7240. #define ADM_CMD_COPP_OPENOPOLOGY_ID_MIC_MONO_AUDIO_COPP 0x00010315
  7241. #define ADM_CMD_COPP_OPENOPOLOGY_ID_MIC_STEREO_AUDIO_COPP 0x00010316
  7242. #define AUDPROC_COPPOPOLOGY_ID_MCHAN_IIR_AUDIO 0x00010715
  7243. #define ADM_CMD_COPP_OPENOPOLOGY_ID_DEFAULT_AUDIO_COPP 0x00010BE3
  7244. #define ADM_CMD_COPP_OPENOPOLOGY_ID_PEAKMETER_AUDIO_COPP 0x00010317
  7245. #define AUDPROC_MODULE_ID_AIG 0x00010716
  7246. #define AUDPROC_PARAM_ID_AIG_ENABLE 0x00010717
  7247. #define AUDPROC_PARAM_ID_AIG_CONFIG 0x00010718
  7248. struct Audio_AigParam {
  7249. uint16_t mode;
  7250. /*< Mode word for enabling AIG/SIG mode .
  7251. * Byte offset: 0
  7252. */
  7253. int16_t staticGainL16Q12;
  7254. /*< Static input gain when aigMode is set to 1.
  7255. * Byte offset: 2
  7256. */
  7257. int16_t initialGainDBL16Q7;
  7258. /*<Initial value that the adaptive gain update starts from dB
  7259. * Q7 Byte offset: 4
  7260. */
  7261. int16_t idealRMSDBL16Q7;
  7262. /*<Average RMS level that AIG attempts to achieve Q8.7
  7263. * Byte offset: 6
  7264. */
  7265. int32_t noiseGateL32;
  7266. /*Threshold below which signal is considered as noise and AIG
  7267. * Byte offset: 8
  7268. */
  7269. int32_t minGainL32Q15;
  7270. /*Minimum gain that can be provided by AIG Q16.15
  7271. * Byte offset: 12
  7272. */
  7273. int32_t maxGainL32Q15;
  7274. /*Maximum gain that can be provided by AIG Q16.15
  7275. * Byte offset: 16
  7276. */
  7277. uint32_t gainAtRtUL32Q31;
  7278. /*Attack/release time for AIG update Q1.31
  7279. * Byte offset: 20
  7280. */
  7281. uint32_t longGainAtRtUL32Q31;
  7282. /*Long attack/release time while updating gain for
  7283. * noise/silence Q1.31 Byte offset: 24
  7284. */
  7285. uint32_t rmsTavUL32Q32;
  7286. /* RMS smoothing time constant used for long-term RMS estimate
  7287. * Q0.32 Byte offset: 28
  7288. */
  7289. uint32_t gainUpdateStartTimMsUL32Q0;
  7290. /* The waiting time before which AIG starts to apply adaptive
  7291. * gain update Q32.0 Byte offset: 32
  7292. */
  7293. } __packed;
  7294. #define ADM_MODULE_ID_EANS 0x00010C4A
  7295. #define ADM_PARAM_ID_EANS_ENABLE 0x00010C4B
  7296. #define ADM_PARAM_ID_EANS_PARAMS 0x00010C4C
  7297. struct adm_eans_enable {
  7298. uint32_t enable_flag;
  7299. /*< Specifies whether EANS is disabled (0) or enabled
  7300. * (nonzero).
  7301. * This is supported only for sampling rates of 8, 12, 16, 24, 32,
  7302. * and 48 kHz. It is not supported for sampling rates of 11.025,
  7303. * 22.05, or 44.1 kHz.
  7304. */
  7305. } __packed;
  7306. struct adm_eans_params {
  7307. int16_t eans_mode;
  7308. /*< Mode word for enabling/disabling submodules.
  7309. * Byte offset: 0
  7310. */
  7311. int16_t eans_input_gain;
  7312. /*< Q2.13 input gain to the EANS module.
  7313. * Byte offset: 2
  7314. */
  7315. int16_t eans_output_gain;
  7316. /*< Q2.13 output gain to the EANS module.
  7317. * Byte offset: 4
  7318. */
  7319. int16_t eansarget_ns;
  7320. /*< Target noise suppression level in dB.
  7321. * Byte offset: 6
  7322. */
  7323. int16_t eans_s_alpha;
  7324. /*< Q3.12 over-subtraction factor for stationary noise
  7325. * suppression.
  7326. * Byte offset: 8
  7327. */
  7328. int16_t eans_n_alpha;
  7329. /* < Q3.12 over-subtraction factor for nonstationary noise
  7330. * suppression.
  7331. * Byte offset: 10
  7332. */
  7333. int16_t eans_n_alphamax;
  7334. /*< Q3.12 maximum over-subtraction factor for nonstationary
  7335. * noise suppression.
  7336. * Byte offset: 12
  7337. */
  7338. int16_t eans_e_alpha;
  7339. /*< Q15 scaling factor for excess noise suppression.
  7340. * Byte offset: 14
  7341. */
  7342. int16_t eans_ns_snrmax;
  7343. /*< Upper boundary in dB for SNR estimation.
  7344. * Byte offset: 16
  7345. */
  7346. int16_t eans_sns_block;
  7347. /*< Quarter block size for stationary noise suppression.
  7348. * Byte offset: 18
  7349. */
  7350. int16_t eans_ns_i;
  7351. /*< Initialization block size for noise suppression.
  7352. * Byte offset: 20
  7353. */
  7354. int16_t eans_np_scale;
  7355. /*< Power scale factor for nonstationary noise update.
  7356. * Byte offset: 22
  7357. */
  7358. int16_t eans_n_lambda;
  7359. /*< Smoothing factor for higher level nonstationary noise
  7360. * update.
  7361. * Byte offset: 24
  7362. */
  7363. int16_t eans_n_lambdaf;
  7364. /*< Medium averaging factor for noise update.
  7365. * Byte offset: 26
  7366. */
  7367. int16_t eans_gs_bias;
  7368. /*< Bias factor in dB for gain calculation.
  7369. * Byte offset: 28
  7370. */
  7371. int16_t eans_gs_max;
  7372. /*< SNR lower boundary in dB for aggressive gain calculation.
  7373. * Byte offset: 30
  7374. */
  7375. int16_t eans_s_alpha_hb;
  7376. /*< Q3.12 over-subtraction factor for high-band stationary
  7377. * noise suppression.
  7378. * Byte offset: 32
  7379. */
  7380. int16_t eans_n_alphamax_hb;
  7381. /*< Q3.12 maximum over-subtraction factor for high-band
  7382. * nonstationary noise suppression.
  7383. * Byte offset: 34
  7384. */
  7385. int16_t eans_e_alpha_hb;
  7386. /*< Q15 scaling factor for high-band excess noise suppression.
  7387. * Byte offset: 36
  7388. */
  7389. int16_t eans_n_lambda0;
  7390. /*< Smoothing factor for nonstationary noise update during
  7391. * speech activity.
  7392. * Byte offset: 38
  7393. */
  7394. int16_t thresh;
  7395. /*< Threshold for generating a binary VAD decision.
  7396. * Byte offset: 40
  7397. */
  7398. int16_t pwr_scale;
  7399. /*< Indirect lower boundary of the noise level estimate.
  7400. * Byte offset: 42
  7401. */
  7402. int16_t hangover_max;
  7403. /*< Avoids mid-speech clipping and reliably detects weak speech
  7404. * bursts at the end of speech activity.
  7405. * Byte offset: 44
  7406. */
  7407. int16_t alpha_snr;
  7408. /*< Controls responsiveness of the VAD.
  7409. * Byte offset: 46
  7410. */
  7411. int16_t snr_diff_max;
  7412. /*< Maximum SNR difference. Decreasing this parameter value may
  7413. * help in making correct decisions during abrupt changes; however,
  7414. * decreasing too much may increase false alarms during long
  7415. * pauses/silences.
  7416. * Byte offset: 48
  7417. */
  7418. int16_t snr_diff_min;
  7419. /*< Minimum SNR difference. Decreasing this parameter value may
  7420. * help in making correct decisions during abrupt changes; however,
  7421. * decreasing too much may increase false alarms during long
  7422. * pauses/silences.
  7423. * Byte offset: 50
  7424. */
  7425. int16_t init_length;
  7426. /*< Defines the number of frames for which a noise level
  7427. * estimate is set to a fixed value.
  7428. * Byte offset: 52
  7429. */
  7430. int16_t max_val;
  7431. /*< Defines the upper limit of the noise level.
  7432. * Byte offset: 54
  7433. */
  7434. int16_t init_bound;
  7435. /*< Defines the initial bounding value for the noise level
  7436. * estimate. This is used during the initial segment defined by the
  7437. * init_length parameter.
  7438. * Byte offset: 56
  7439. */
  7440. int16_t reset_bound;
  7441. /*< Reset boundary for noise tracking.
  7442. * Byte offset: 58
  7443. */
  7444. int16_t avar_scale;
  7445. /*< Defines the bias factor in noise estimation.
  7446. * Byte offset: 60
  7447. */
  7448. int16_t sub_nc;
  7449. /*< Defines the window length for noise estimation.
  7450. * Byte offset: 62
  7451. */
  7452. int16_t spow_min;
  7453. /*< Defines the minimum signal power required to update the
  7454. * boundaries for the noise floor estimate.
  7455. * Byte offset: 64
  7456. */
  7457. int16_t eans_gs_fast;
  7458. /*< Fast smoothing factor for postprocessor gain.
  7459. * Byte offset: 66
  7460. */
  7461. int16_t eans_gs_med;
  7462. /*< Medium smoothing factor for postprocessor gain.
  7463. * Byte offset: 68
  7464. */
  7465. int16_t eans_gs_slow;
  7466. /*< Slow smoothing factor for postprocessor gain.
  7467. * Byte offset: 70
  7468. */
  7469. int16_t eans_swb_salpha;
  7470. /*< Q3.12 super wideband aggressiveness factor for stationary
  7471. * noise suppression.
  7472. * Byte offset: 72
  7473. */
  7474. int16_t eans_swb_nalpha;
  7475. /*< Q3.12 super wideband aggressiveness factor for
  7476. * nonstationary noise suppression.
  7477. * Byte offset: 74
  7478. */
  7479. } __packed;
  7480. #define ADM_MODULE_IDX_MIC_GAIN_CTRL 0x00010C35
  7481. /* @addtogroup audio_pp_param_ids
  7482. * ID of the Tx mic gain control parameter used by the
  7483. * #ADM_MODULE_IDX_MIC_GAIN_CTRL module.
  7484. * @messagepayload
  7485. * @structure{admx_mic_gain}
  7486. * @tablespace
  7487. * @inputtable{Audio_Postproc_ADM_PARAM_IDX_MIC_GAIN.tex}
  7488. */
  7489. #define ADM_PARAM_IDX_MIC_GAIN 0x00010C36
  7490. /* Structure for a Tx mic gain parameter for the mic gain
  7491. * control module.
  7492. */
  7493. /* @brief Payload of the #ADM_PARAM_IDX_MIC_GAIN parameter in the
  7494. * Tx Mic Gain Control module.
  7495. */
  7496. struct admx_mic_gain {
  7497. uint16_t tx_mic_gain;
  7498. /*< Linear gain in Q13 format. */
  7499. uint16_t reserved;
  7500. /*< Clients must set this field to zero. */
  7501. } __packed;
  7502. /* end_addtogroup audio_pp_param_ids */
  7503. /* @ingroup audio_pp_module_ids
  7504. * ID of the Rx Codec Gain Control module.
  7505. *
  7506. * This module supports the following parameter ID:
  7507. * - #ADM_PARAM_ID_RX_CODEC_GAIN
  7508. */
  7509. #define ADM_MODULE_ID_RX_CODEC_GAIN_CTRL 0x00010C37
  7510. /* @addtogroup audio_pp_param_ids
  7511. * ID of the Rx codec gain control parameter used by the
  7512. * #ADM_MODULE_ID_RX_CODEC_GAIN_CTRL module.
  7513. *
  7514. * @messagepayload
  7515. * @structure{adm_rx_codec_gain}
  7516. * @tablespace
  7517. * @inputtable{Audio_Postproc_ADM_PARAM_ID_RX_CODEC_GAIN.tex}
  7518. */
  7519. #define ADM_PARAM_ID_RX_CODEC_GAIN 0x00010C38
  7520. /* Structure for the Rx common codec gain control module. */
  7521. /* @brief Payload of the #ADM_PARAM_ID_RX_CODEC_GAIN parameter
  7522. * in the Rx Codec Gain Control module.
  7523. */
  7524. struct adm_rx_codec_gain {
  7525. uint16_t rx_codec_gain;
  7526. /* Linear gain in Q13 format. */
  7527. uint16_t reserved;
  7528. /* Clients must set this field to zero.*/
  7529. } __packed;
  7530. /* end_addtogroup audio_pp_param_ids */
  7531. /* @ingroup audio_pp_module_ids
  7532. * ID of the HPF Tuning Filter module on the Tx path.
  7533. * This module supports the following parameter IDs:
  7534. * - #ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG
  7535. * - #ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN
  7536. * - #ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS
  7537. */
  7538. #define ADM_MODULE_ID_HPF_IIRX_FILTER 0x00010C3D
  7539. /* @addtogroup audio_pp_param_ids */
  7540. /* ID of the Tx HPF IIR filter enable parameter used by the
  7541. * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
  7542. * @parspace Message payload
  7543. * @structure{adm_hpfx_iir_filter_enable_cfg}
  7544. * @tablespace
  7545. * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG.tex}
  7546. */
  7547. #define ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG 0x00010C3E
  7548. /* ID of the Tx HPF IIR filter pregain parameter used by the
  7549. * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
  7550. * @parspace Message payload
  7551. * @structure{adm_hpfx_iir_filter_pre_gain}
  7552. * @tablespace
  7553. * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN.tex}
  7554. */
  7555. #define ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN 0x00010C3F
  7556. /* ID of the Tx HPF IIR filter configuration parameters used by the
  7557. * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
  7558. * @parspace Message payload
  7559. * @structure{adm_hpfx_iir_filter_cfg_params}
  7560. * @tablespace
  7561. * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PA
  7562. * RAMS.tex}
  7563. */
  7564. #define ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS 0x00010C40
  7565. /* Structure for enabling a configuration parameter for
  7566. * the HPF IIR tuning filter module on the Tx path.
  7567. */
  7568. /* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG
  7569. * parameter in the Tx path HPF Tuning Filter module.
  7570. */
  7571. struct adm_hpfx_iir_filter_enable_cfg {
  7572. uint32_t enable_flag;
  7573. /* Specifies whether the HPF tuning filter is disabled (0) or
  7574. * enabled (nonzero).
  7575. */
  7576. } __packed;
  7577. /* Structure for the pregain parameter for the HPF
  7578. * IIR tuning filter module on the Tx path.
  7579. */
  7580. /* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN parameter
  7581. * in the Tx path HPF Tuning Filter module.
  7582. */
  7583. struct adm_hpfx_iir_filter_pre_gain {
  7584. uint16_t pre_gain;
  7585. /* Linear gain in Q13 format. */
  7586. uint16_t reserved;
  7587. /* Clients must set this field to zero.*/
  7588. } __packed;
  7589. /* Structure for the configuration parameter for the
  7590. * HPF IIR tuning filter module on the Tx path.
  7591. */
  7592. /* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS
  7593. * parameters in the Tx path HPF Tuning Filter module. \n
  7594. * \n
  7595. * This structure is followed by tuning filter coefficients as follows: \n
  7596. * - Sequence of int32_t FilterCoeffs.
  7597. * Each band has five coefficients, each in int32_t format in the order of
  7598. * b0, b1, b2, a1, a2.
  7599. * - Sequence of int16_t NumShiftFactor.
  7600. * One int16_t per band. The numerator shift factor is related to the Q
  7601. * factor of the filter coefficients.
  7602. * - Sequence of uint16_t PanSetting.
  7603. * One uint16_t for each band to indicate application of the filter to
  7604. * left (0), right (1), or both (2) channels.
  7605. */
  7606. struct adm_hpfx_iir_filter_cfg_params {
  7607. uint16_t num_biquad_stages;
  7608. /*< Number of bands.
  7609. * Supported values: 0 to 20
  7610. */
  7611. uint16_t reserved;
  7612. /*< Clients must set this field to zero.*/
  7613. } __packed;
  7614. /* end_addtogroup audio_pp_module_ids */
  7615. /* @addtogroup audio_pp_module_ids */
  7616. /* ID of the Tx path IIR Tuning Filter module.
  7617. * This module supports the following parameter IDs:
  7618. * - #ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG
  7619. */
  7620. #define ADM_MODULE_IDX_IIR_FILTER 0x00010C41
  7621. /* ID of the Rx path IIR Tuning Filter module for the left channel.
  7622. * The parameter IDs of the IIR tuning filter module
  7623. * (#ASM_MODULE_ID_IIRUNING_FILTER) are used for the left IIR Rx tuning
  7624. * filter.
  7625. *
  7626. * Pan parameters are not required for this per-channel IIR filter; the pan
  7627. * parameters are ignored by this module.
  7628. */
  7629. #define ADM_MODULE_ID_LEFT_IIRUNING_FILTER 0x00010705
  7630. /* ID of the the Rx path IIR Tuning Filter module for the right
  7631. * channel.
  7632. * The parameter IDs of the IIR tuning filter module
  7633. * (#ASM_MODULE_ID_IIRUNING_FILTER) are used for the right IIR Rx
  7634. * tuning filter.
  7635. *
  7636. * Pan parameters are not required for this per-channel IIR filter;
  7637. * the pan parameters are ignored by this module.
  7638. */
  7639. #define ADM_MODULE_ID_RIGHT_IIRUNING_FILTER 0x00010706
  7640. /* end_addtogroup audio_pp_module_ids */
  7641. /* @addtogroup audio_pp_param_ids */
  7642. /* ID of the Tx IIR filter enable parameter used by the
  7643. * #ADM_MODULE_IDX_IIR_FILTER module.
  7644. * @parspace Message payload
  7645. * @structure{admx_iir_filter_enable_cfg}
  7646. * @tablespace
  7647. * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG.tex}
  7648. */
  7649. #define ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG 0x00010C42
  7650. /* ID of the Tx IIR filter pregain parameter used by the
  7651. * #ADM_MODULE_IDX_IIR_FILTER module.
  7652. * @parspace Message payload
  7653. * @structure{admx_iir_filter_pre_gain}
  7654. * @tablespace
  7655. * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN.tex}
  7656. */
  7657. #define ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN 0x00010C43
  7658. /* ID of the Tx IIR filter configuration parameters used by the
  7659. * #ADM_MODULE_IDX_IIR_FILTER module.
  7660. * @parspace Message payload
  7661. * @structure{admx_iir_filter_cfg_params}
  7662. * @tablespace
  7663. * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS.tex}
  7664. */
  7665. #define ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS 0x00010C44
  7666. /* Structure for enabling the configuration parameter for the
  7667. * IIR filter module on the Tx path.
  7668. */
  7669. /* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG
  7670. * parameter in the Tx Path IIR Tuning Filter module.
  7671. */
  7672. struct admx_iir_filter_enable_cfg {
  7673. uint32_t enable_flag;
  7674. /*< Specifies whether the IIR tuning filter is disabled (0) or
  7675. * enabled (nonzero).
  7676. */
  7677. } __packed;
  7678. /* Structure for the pregain parameter for the
  7679. * IIR filter module on the Tx path.
  7680. */
  7681. /* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN
  7682. * parameter in the Tx Path IIR Tuning Filter module.
  7683. */
  7684. struct admx_iir_filter_pre_gain {
  7685. uint16_t pre_gain;
  7686. /*< Linear gain in Q13 format. */
  7687. uint16_t reserved;
  7688. /*< Clients must set this field to zero.*/
  7689. } __packed;
  7690. /* Structure for the configuration parameter for the
  7691. * IIR filter module on the Tx path.
  7692. */
  7693. /* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS
  7694. * parameter in the Tx Path IIR Tuning Filter module. \n
  7695. * \n
  7696. * This structure is followed by the HPF IIR filter coefficients on
  7697. * the Tx path as follows: \n
  7698. * - Sequence of int32_t ulFilterCoeffs. Each band has five
  7699. * coefficients, each in int32_t format in the order of b0, b1, b2,
  7700. * a1, a2.
  7701. * - Sequence of int16_t sNumShiftFactor. One int16_t per band. The
  7702. * numerator shift factor is related to the Q factor of the filter
  7703. * coefficients.
  7704. * - Sequence of uint16_t usPanSetting. One uint16_t for each band
  7705. * to indicate if the filter is applied to left (0), right (1), or
  7706. * both (2) channels.
  7707. */
  7708. struct admx_iir_filter_cfg_params {
  7709. uint16_t num_biquad_stages;
  7710. /*< Number of bands.
  7711. * Supported values: 0 to 20
  7712. */
  7713. uint16_t reserved;
  7714. /*< Clients must set this field to zero.*/
  7715. } __packed;
  7716. /* end_addtogroup audio_pp_module_ids */
  7717. /* @ingroup audio_pp_module_ids
  7718. * ID of the QEnsemble module.
  7719. * This module supports the following parameter IDs:
  7720. * - #ADM_PARAM_ID_QENSEMBLE_ENABLE
  7721. * - #ADM_PARAM_ID_QENSEMBLE_BACKGAIN
  7722. * - #ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE
  7723. */
  7724. #define ADM_MODULE_ID_QENSEMBLE 0x00010C59
  7725. /* @addtogroup audio_pp_param_ids */
  7726. /* ID of the QEnsemble enable parameter used by the
  7727. * #ADM_MODULE_ID_QENSEMBLE module.
  7728. * @messagepayload
  7729. * @structure{adm_qensemble_enable}
  7730. * @tablespace
  7731. * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_ENABLE.tex}
  7732. */
  7733. #define ADM_PARAM_ID_QENSEMBLE_ENABLE 0x00010C60
  7734. /* ID of the QEnsemble back gain parameter used by the
  7735. * #ADM_MODULE_ID_QENSEMBLE module.
  7736. * @messagepayload
  7737. * @structure{adm_qensemble_param_backgain}
  7738. * @tablespace
  7739. * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_BACKGAIN.tex}
  7740. */
  7741. #define ADM_PARAM_ID_QENSEMBLE_BACKGAIN 0x00010C61
  7742. /* ID of the QEnsemble new angle parameter used by the
  7743. * #ADM_MODULE_ID_QENSEMBLE module.
  7744. * @messagepayload
  7745. * @structure{adm_qensemble_param_set_new_angle}
  7746. * @tablespace
  7747. * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE.tex}
  7748. */
  7749. #define ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE 0x00010C62
  7750. /* Structure for enabling the configuration parameter for the
  7751. * QEnsemble module.
  7752. */
  7753. /* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_ENABLE
  7754. * parameter used by the QEnsemble module.
  7755. */
  7756. struct adm_qensemble_enable {
  7757. uint32_t enable_flag;
  7758. /*< Specifies whether the QEnsemble module is disabled (0) or enabled
  7759. * (nonzero).
  7760. */
  7761. } __packed;
  7762. /* Structure for the background gain for the QEnsemble module. */
  7763. /* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_BACKGAIN
  7764. * parameter used by
  7765. * the QEnsemble module.
  7766. */
  7767. struct adm_qensemble_param_backgain {
  7768. int16_t back_gain;
  7769. /*< Linear gain in Q15 format.
  7770. * Supported values: 0 to 32767
  7771. */
  7772. uint16_t reserved;
  7773. /*< Clients must set this field to zero.*/
  7774. } __packed;
  7775. /* Structure for setting a new angle for the QEnsemble module. */
  7776. /* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE
  7777. * parameter used
  7778. * by the QEnsemble module.
  7779. */
  7780. struct adm_qensemble_param_set_new_angle {
  7781. int16_t new_angle;
  7782. /*< New angle in degrees.
  7783. * Supported values: 0 to 359
  7784. */
  7785. int16_t time_ms;
  7786. /*< Transition time in milliseconds to set the new angle.
  7787. * Supported values: 0 to 32767
  7788. */
  7789. } __packed;
  7790. #define ADM_CMD_GET_PP_TOPO_MODULE_LIST 0x00010349
  7791. #define ADM_CMDRSP_GET_PP_TOPO_MODULE_LIST 0x00010350
  7792. #define ADM_CMD_GET_PP_TOPO_MODULE_LIST_V2 0x00010360
  7793. #define ADM_CMDRSP_GET_PP_TOPO_MODULE_LIST_V2 0x00010361
  7794. #define AUDPROC_PARAM_ID_ENABLE 0x00010904
  7795. /*
  7796. * Payload of the ADM_CMD_GET_PP_TOPO_MODULE_LIST command.
  7797. */
  7798. struct adm_cmd_get_pp_topo_module_list {
  7799. struct apr_hdr apr_hdr;
  7800. /* The memory mapping header to be used when requesting out of band */
  7801. struct mem_mapping_hdr mem_hdr;
  7802. /*
  7803. * Maximum data size of the list of modules. This
  7804. * field is a multiple of 4 bytes.
  7805. */
  7806. uint32_t param_max_size;
  7807. } __packed;
  7808. struct audproc_topology_module_id_info_t {
  7809. uint32_t num_modules;
  7810. } __packed;
  7811. /* end_addtogroup audio_pp_module_ids */
  7812. /* @ingroup audio_pp_module_ids
  7813. * ID of the Volume Control module pre/postprocessing block.
  7814. * This module supports the following parameter IDs:
  7815. * - #ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
  7816. * - #ASM_PARAM_ID_MULTICHANNEL_GAIN
  7817. * - #ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG
  7818. * - #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
  7819. * - #ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS
  7820. * - #ASM_PARAM_ID_MULTICHANNEL_GAIN
  7821. * - #ASM_PARAM_ID_MULTICHANNEL_MUTE
  7822. */
  7823. #define ASM_MODULE_ID_VOL_CTRL 0x00010BFE
  7824. #define ASM_MODULE_ID_VOL_CTRL2 0x00010910
  7825. #define AUDPROC_MODULE_ID_VOL_CTRL ASM_MODULE_ID_VOL_CTRL
  7826. /* @addtogroup audio_pp_param_ids */
  7827. /* ID of the master gain parameter used by the #ASM_MODULE_ID_VOL_CTRL
  7828. * module.
  7829. * @messagepayload
  7830. * @structure{asm_volume_ctrl_master_gain}
  7831. * @tablespace
  7832. * @inputtable{Audio_Postproc_ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN.tex}
  7833. */
  7834. #define ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN 0x00010BFF
  7835. #define AUDPROC_PARAM_ID_VOL_CTRL_MASTER_GAIN ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
  7836. /* ID of the left/right channel gain parameter used by the
  7837. * #ASM_MODULE_ID_VOL_CTRL module.
  7838. * @messagepayload
  7839. * @structure{asm_volume_ctrl_lr_chan_gain}
  7840. * @tablespace
  7841. * @inputtable{Audio_Postproc_ASM_PARAM_ID_MULTICHANNEL_GAIN.tex}
  7842. */
  7843. #define ASM_PARAM_ID_VOL_CTRL_LR_CHANNEL_GAIN 0x00010C00
  7844. /* ID of the mute configuration parameter used by the
  7845. * #ASM_MODULE_ID_VOL_CTRL module.
  7846. * @messagepayload
  7847. * @structure{asm_volume_ctrl_mute_config}
  7848. * @tablespace
  7849. * @inputtable{Audio_Postproc_ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG.tex}
  7850. */
  7851. #define ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG 0x00010C01
  7852. /* ID of the soft stepping volume parameters used by the
  7853. * #ASM_MODULE_ID_VOL_CTRL module.
  7854. * @messagepayload
  7855. * @structure{asm_soft_step_volume_params}
  7856. * @tablespace
  7857. * @inputtable{Audio_Postproc_ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMET
  7858. * ERS.tex}
  7859. */
  7860. #define ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS 0x00010C29
  7861. #define AUDPROC_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS\
  7862. ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
  7863. /* ID of the soft pause parameters used by the #ASM_MODULE_ID_VOL_CTRL
  7864. * module.
  7865. */
  7866. #define ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS 0x00010D6A
  7867. /* ID of the multiple-channel volume control parameters used by the
  7868. * #ASM_MODULE_ID_VOL_CTRL module.
  7869. */
  7870. #define ASM_PARAM_ID_MULTICHANNEL_GAIN 0x00010713
  7871. /* ID of the multiple-channel mute configuration parameters used by the
  7872. * #ASM_MODULE_ID_VOL_CTRL module.
  7873. */
  7874. #define ASM_PARAM_ID_MULTICHANNEL_MUTE 0x00010714
  7875. /* Structure for the master gain parameter for a volume control
  7876. * module.
  7877. */
  7878. /* @brief Payload of the #ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
  7879. * parameter used by the Volume Control module.
  7880. */
  7881. struct asm_volume_ctrl_master_gain {
  7882. uint16_t master_gain;
  7883. /* Linear gain in Q13 format. */
  7884. uint16_t reserved;
  7885. /* Clients must set this field to zero. */
  7886. } __packed;
  7887. struct asm_volume_ctrl_lr_chan_gain {
  7888. uint16_t l_chan_gain;
  7889. /*< Linear gain in Q13 format for the left channel. */
  7890. uint16_t r_chan_gain;
  7891. /*< Linear gain in Q13 format for the right channel.*/
  7892. } __packed;
  7893. /* Structure for the mute configuration parameter for a
  7894. * volume control module.
  7895. */
  7896. /* @brief Payload of the #ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG
  7897. * parameter used by the Volume Control module.
  7898. */
  7899. struct asm_volume_ctrl_mute_config {
  7900. uint32_t mute_flag;
  7901. /*< Specifies whether mute is disabled (0) or enabled (nonzero).*/
  7902. } __packed;
  7903. /*
  7904. * Supported parameters for a soft stepping linear ramping curve.
  7905. */
  7906. #define ASM_PARAM_SVC_RAMPINGCURVE_LINEAR 0
  7907. /*
  7908. * Exponential ramping curve.
  7909. */
  7910. #define ASM_PARAM_SVC_RAMPINGCURVE_EXP 1
  7911. /*
  7912. * Logarithmic ramping curve.
  7913. */
  7914. #define ASM_PARAM_SVC_RAMPINGCURVE_LOG 2
  7915. /* Structure for holding soft stepping volume parameters. */
  7916. /* Payload of the #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
  7917. * parameters used by the Volume Control module.
  7918. */
  7919. struct asm_soft_step_volume_params {
  7920. uint32_t period;
  7921. /*< Period in milliseconds.
  7922. * Supported values: 0 to 15000
  7923. */
  7924. uint32_t step;
  7925. /*< Step in microseconds.
  7926. * Supported values: 0 to 15000000
  7927. */
  7928. uint32_t ramping_curve;
  7929. /*< Ramping curve type.
  7930. * Supported values:
  7931. * - #ASM_PARAM_SVC_RAMPINGCURVE_LINEAR
  7932. * - #ASM_PARAM_SVC_RAMPINGCURVE_EXP
  7933. * - #ASM_PARAM_SVC_RAMPINGCURVE_LOG
  7934. */
  7935. } __packed;
  7936. /* Structure for holding soft pause parameters. */
  7937. /* Payload of the #ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS
  7938. * parameters used by the Volume Control module.
  7939. */
  7940. struct asm_soft_pause_params {
  7941. uint32_t enable_flag;
  7942. /*< Specifies whether soft pause is disabled (0) or enabled
  7943. * (nonzero).
  7944. */
  7945. uint32_t period;
  7946. /*< Period in milliseconds.
  7947. * Supported values: 0 to 15000
  7948. */
  7949. uint32_t step;
  7950. /*< Step in microseconds.
  7951. * Supported values: 0 to 15000000
  7952. */
  7953. uint32_t ramping_curve;
  7954. /*< Ramping curve.
  7955. * Supported values:
  7956. * - #ASM_PARAM_SVC_RAMPINGCURVE_LINEAR
  7957. * - #ASM_PARAM_SVC_RAMPINGCURVE_EXP
  7958. * - #ASM_PARAM_SVC_RAMPINGCURVE_LOG
  7959. */
  7960. } __packed;
  7961. /* Maximum number of channels.*/
  7962. #define VOLUME_CONTROL_MAX_CHANNELS 8
  7963. /* Structure for holding one channel type - gain pair. */
  7964. /* Payload of the #ASM_PARAM_ID_MULTICHANNEL_GAIN channel
  7965. * type/gain pairs used by the Volume Control module. \n \n This
  7966. * structure immediately follows the
  7967. * asm_volume_ctrl_multichannel_gain structure.
  7968. */
  7969. struct asm_volume_ctrl_channeltype_gain_pair {
  7970. uint8_t channeltype;
  7971. /*
  7972. * Channel type for which the gain setting is to be applied.
  7973. * Supported values:
  7974. * - #PCM_CHANNEL_L
  7975. * - #PCM_CHANNEL_R
  7976. * - #PCM_CHANNEL_C
  7977. * - #PCM_CHANNEL_LS
  7978. * - #PCM_CHANNEL_RS
  7979. * - #PCM_CHANNEL_LFE
  7980. * - #PCM_CHANNEL_CS
  7981. * - #PCM_CHANNEL_LB
  7982. * - #PCM_CHANNEL_RB
  7983. * - #PCM_CHANNELS
  7984. * - #PCM_CHANNEL_CVH
  7985. * - #PCM_CHANNEL_MS
  7986. * - #PCM_CHANNEL_FLC
  7987. * - #PCM_CHANNEL_FRC
  7988. * - #PCM_CHANNEL_RLC
  7989. * - #PCM_CHANNEL_RRC
  7990. */
  7991. uint8_t reserved1;
  7992. /* Clients must set this field to zero. */
  7993. uint8_t reserved2;
  7994. /* Clients must set this field to zero. */
  7995. uint8_t reserved3;
  7996. /* Clients must set this field to zero. */
  7997. uint32_t gain;
  7998. /*
  7999. * Gain value for this channel in Q28 format.
  8000. * Supported values: Any
  8001. */
  8002. } __packed;
  8003. /* Structure for the multichannel gain command */
  8004. /* Payload of the #ASM_PARAM_ID_MULTICHANNEL_GAIN
  8005. * parameters used by the Volume Control module.
  8006. */
  8007. struct asm_volume_ctrl_multichannel_gain {
  8008. uint32_t num_channels;
  8009. /*
  8010. * Number of channels for which gain values are provided. Any
  8011. * channels present in the data for which gain is not provided are
  8012. * set to unity gain.
  8013. * Supported values: 1 to 8
  8014. */
  8015. struct asm_volume_ctrl_channeltype_gain_pair
  8016. gain_data[VOLUME_CONTROL_MAX_CHANNELS];
  8017. /* Array of channel type/gain pairs.*/
  8018. } __packed;
  8019. /* Structure for holding one channel type - mute pair. */
  8020. /* Payload of the #ASM_PARAM_ID_MULTICHANNEL_MUTE channel
  8021. * type/mute setting pairs used by the Volume Control module. \n \n
  8022. * This structure immediately follows the
  8023. * asm_volume_ctrl_multichannel_mute structure.
  8024. */
  8025. struct asm_volume_ctrl_channelype_mute_pair {
  8026. uint8_t channelype;
  8027. /*< Channel type for which the mute setting is to be applied.
  8028. * Supported values:
  8029. * - #PCM_CHANNEL_L
  8030. * - #PCM_CHANNEL_R
  8031. * - #PCM_CHANNEL_C
  8032. * - #PCM_CHANNEL_LS
  8033. * - #PCM_CHANNEL_RS
  8034. * - #PCM_CHANNEL_LFE
  8035. * - #PCM_CHANNEL_CS
  8036. * - #PCM_CHANNEL_LB
  8037. * - #PCM_CHANNEL_RB
  8038. * - #PCM_CHANNELS
  8039. * - #PCM_CHANNEL_CVH
  8040. * - #PCM_CHANNEL_MS
  8041. * - #PCM_CHANNEL_FLC
  8042. * - #PCM_CHANNEL_FRC
  8043. * - #PCM_CHANNEL_RLC
  8044. * - #PCM_CHANNEL_RRC
  8045. */
  8046. uint8_t reserved1;
  8047. /*< Clients must set this field to zero. */
  8048. uint8_t reserved2;
  8049. /*< Clients must set this field to zero. */
  8050. uint8_t reserved3;
  8051. /*< Clients must set this field to zero. */
  8052. uint32_t mute;
  8053. /*< Mute setting for this channel.
  8054. * Supported values:
  8055. * - 0 = Unmute
  8056. * - Nonzero = Mute
  8057. */
  8058. } __packed;
  8059. /* Structure for the multichannel mute command */
  8060. /* @brief Payload of the #ASM_PARAM_ID_MULTICHANNEL_MUTE
  8061. * parameters used by the Volume Control module.
  8062. */
  8063. struct asm_volume_ctrl_multichannel_mute {
  8064. uint32_t num_channels;
  8065. /*< Number of channels for which mute configuration is
  8066. * provided. Any channels present in the data for which mute
  8067. * configuration is not provided are set to unmute.
  8068. * Supported values: 1 to 8
  8069. */
  8070. struct asm_volume_ctrl_channelype_mute_pair
  8071. mute_data[VOLUME_CONTROL_MAX_CHANNELS];
  8072. /*< Array of channel type/mute setting pairs.*/
  8073. } __packed;
  8074. /* end_addtogroup audio_pp_param_ids */
  8075. /* audio_pp_module_ids
  8076. * ID of the IIR Tuning Filter module.
  8077. * This module supports the following parameter IDs:
  8078. * - #ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG
  8079. * - #ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN
  8080. * - #ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS
  8081. */
  8082. #define ASM_MODULE_ID_IIRUNING_FILTER 0x00010C02
  8083. /* @addtogroup audio_pp_param_ids */
  8084. /* ID of the IIR tuning filter enable parameter used by the
  8085. * #ASM_MODULE_ID_IIRUNING_FILTER module.
  8086. * @messagepayload
  8087. * @structure{asm_iiruning_filter_enable}
  8088. * @tablespace
  8089. * @inputtable{Audio_Postproc_ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CO
  8090. * NFIG.tex}
  8091. */
  8092. #define ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG 0x00010C03
  8093. /* ID of the IIR tuning filter pregain parameter used by the
  8094. * #ASM_MODULE_ID_IIRUNING_FILTER module.
  8095. */
  8096. #define ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN 0x00010C04
  8097. /* ID of the IIR tuning filter configuration parameters used by the
  8098. * #ASM_MODULE_ID_IIRUNING_FILTER module.
  8099. */
  8100. #define ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS 0x00010C05
  8101. /* Structure for an enable configuration parameter for an
  8102. * IIR tuning filter module.
  8103. */
  8104. /* @brief Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG
  8105. * parameter used by the IIR Tuning Filter module.
  8106. */
  8107. struct asm_iiruning_filter_enable {
  8108. uint32_t enable_flag;
  8109. /*< Specifies whether the IIR tuning filter is disabled (0) or
  8110. * enabled (1).
  8111. */
  8112. } __packed;
  8113. /* Structure for the pregain parameter for an IIR tuning filter module. */
  8114. /* Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN
  8115. * parameters used by the IIR Tuning Filter module.
  8116. */
  8117. struct asm_iiruning_filter_pregain {
  8118. uint16_t pregain;
  8119. /*< Linear gain in Q13 format. */
  8120. uint16_t reserved;
  8121. /*< Clients must set this field to zero.*/
  8122. } __packed;
  8123. /* Structure for the configuration parameter for an IIR tuning filter
  8124. * module.
  8125. */
  8126. /* @brief Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS
  8127. * parameters used by the IIR Tuning Filter module. \n
  8128. * \n
  8129. * This structure is followed by the IIR filter coefficients: \n
  8130. * - Sequence of int32_t FilterCoeffs \n
  8131. * Five coefficients for each band. Each coefficient is in int32_t format, in
  8132. * the order of b0, b1, b2, a1, a2.
  8133. * - Sequence of int16_t NumShiftFactor \n
  8134. * One int16_t per band. The numerator shift factor is related to the Q
  8135. * factor of the filter coefficients.
  8136. * - Sequence of uint16_t PanSetting \n
  8137. * One uint16_t per band, indicating if the filter is applied to left (0),
  8138. * right (1), or both (2) channels.
  8139. */
  8140. struct asm_iir_filter_config_params {
  8141. uint16_t num_biquad_stages;
  8142. /*< Number of bands.
  8143. * Supported values: 0 to 20
  8144. */
  8145. uint16_t reserved;
  8146. /*< Clients must set this field to zero.*/
  8147. } __packed;
  8148. /* audio_pp_module_ids
  8149. * ID of the Multiband Dynamic Range Control (MBDRC) module on the Tx/Rx
  8150. * paths.
  8151. * This module supports the following parameter IDs:
  8152. * - #ASM_PARAM_ID_MBDRC_ENABLE
  8153. * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
  8154. */
  8155. #define ASM_MODULE_ID_MBDRC 0x00010C06
  8156. /* audio_pp_param_ids */
  8157. /* ID of the MBDRC enable parameter used by the #ASM_MODULE_ID_MBDRC module.
  8158. * @messagepayload
  8159. * @structure{asm_mbdrc_enable}
  8160. * @tablespace
  8161. * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_ENABLE.tex}
  8162. */
  8163. #define ASM_PARAM_ID_MBDRC_ENABLE 0x00010C07
  8164. /* ID of the MBDRC configuration parameters used by the
  8165. * #ASM_MODULE_ID_MBDRC module.
  8166. * @messagepayload
  8167. * @structure{asm_mbdrc_config_params}
  8168. * @tablespace
  8169. * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_CONFIG_PARAMS.tex}
  8170. *
  8171. * @parspace Sub-band DRC configuration parameters
  8172. * @structure{asm_subband_drc_config_params}
  8173. * @tablespace
  8174. * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_subband_DRC.tex}
  8175. *
  8176. * @keep{6}
  8177. * To obtain legacy ADRC from MBDRC, use the calibration tool to:
  8178. *
  8179. * - Enable MBDRC (EnableFlag = TRUE)
  8180. * - Set number of bands to 1 (uiNumBands = 1)
  8181. * - Enable the first MBDRC band (DrcMode[0] = DRC_ENABLED = 1)
  8182. * - Clear the first band mute flag (MuteFlag[0] = 0)
  8183. * - Set the first band makeup gain to unity (compMakeUpGain[0] = 0x2000)
  8184. * - Use the legacy ADRC parameters to calibrate the rest of the MBDRC
  8185. * parameters.
  8186. */
  8187. #define ASM_PARAM_ID_MBDRC_CONFIG_PARAMS 0x00010C08
  8188. /* end_addtogroup audio_pp_param_ids */
  8189. /* audio_pp_module_ids
  8190. * ID of the MMBDRC module version 2 pre/postprocessing block.
  8191. * This module differs from the original MBDRC (#ASM_MODULE_ID_MBDRC) in
  8192. * the length of the filters used in each sub-band.
  8193. * This module supports the following parameter ID:
  8194. * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_IMPROVED_FILTBANK_V2
  8195. */
  8196. #define ASM_MODULE_ID_MBDRCV2 0x0001070B
  8197. /* @addtogroup audio_pp_param_ids */
  8198. /* ID of the configuration parameters used by the
  8199. * #ASM_MODULE_ID_MBDRCV2 module for the improved filter structure
  8200. * of the MBDRC v2 pre/postprocessing block.
  8201. * The update to this configuration structure from the original
  8202. * MBDRC is the number of filter coefficients in the filter
  8203. * structure. The sequence for is as follows:
  8204. * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
  8205. * - 2 bands = 141 FIR coefficients + 2 mute flags + uint16_t padding
  8206. * - 3 bands = 141+81 FIR coefficients + 3 mute flags + uint16_t padding
  8207. * - 4 bands = 141+81+61 FIR coefficients + 4 mute flags + uint16_t
  8208. * padding
  8209. * - 5 bands = 141+81+61+61 FIR coefficients + 5 mute flags +
  8210. * uint16_t padding
  8211. * This block uses the same parameter structure as
  8212. * #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS.
  8213. */
  8214. #define ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_IMPROVED_FILTBANK_V2 \
  8215. 0x0001070C
  8216. #define ASM_MODULE_ID_MBDRCV3 0x0001090B
  8217. /*
  8218. * ID of the MMBDRC module version 3 pre/postprocessing block.
  8219. * This module differs from MBDRCv2 (#ASM_MODULE_ID_MBDRCV2) in
  8220. * that it supports both 16- and 24-bit data.
  8221. * This module supports the following parameter ID:
  8222. * - #ASM_PARAM_ID_MBDRC_ENABLE
  8223. * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
  8224. * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_V3
  8225. * - #ASM_PARAM_ID_MBDRC_FILTER_XOVER_FREQS
  8226. */
  8227. /* Structure for the enable parameter for an MBDRC module. */
  8228. /* Payload of the #ASM_PARAM_ID_MBDRC_ENABLE parameter used by the
  8229. * MBDRC module.
  8230. */
  8231. struct asm_mbdrc_enable {
  8232. uint32_t enable_flag;
  8233. /*< Specifies whether MBDRC is disabled (0) or enabled (nonzero).*/
  8234. } __packed;
  8235. /* Structure for the configuration parameters for an MBDRC module. */
  8236. /* Payload of the #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
  8237. * parameters used by the MBDRC module. \n \n Following this
  8238. * structure is the payload for sub-band DRC configuration
  8239. * parameters (asm_subband_drc_config_params). This sub-band
  8240. * structure must be repeated for each band.
  8241. */
  8242. struct asm_mbdrc_config_params {
  8243. uint16_t num_bands;
  8244. /*< Number of bands.
  8245. * Supported values: 1 to 5
  8246. */
  8247. int16_t limiterhreshold;
  8248. /*< Threshold in decibels for the limiter output.
  8249. * Supported values: -72 to 18 \n
  8250. * Recommended value: 3994 (-0.22 db in Q3.12 format)
  8251. */
  8252. int16_t limiter_makeup_gain;
  8253. /*< Makeup gain in decibels for the limiter output.
  8254. * Supported values: -42 to 42 \n
  8255. * Recommended value: 256 (0 dB in Q7.8 format)
  8256. */
  8257. int16_t limiter_gc;
  8258. /*< Limiter gain recovery coefficient.
  8259. * Supported values: 0.5 to 0.99 \n
  8260. * Recommended value: 32440 (0.99 in Q15 format)
  8261. */
  8262. int16_t limiter_delay;
  8263. /*< Limiter delay in samples.
  8264. * Supported values: 0 to 10 \n
  8265. * Recommended value: 262 (0.008 samples in Q15 format)
  8266. */
  8267. int16_t limiter_max_wait;
  8268. /*< Maximum limiter waiting time in samples.
  8269. * Supported values: 0 to 10 \n
  8270. * Recommended value: 262 (0.008 samples in Q15 format)
  8271. */
  8272. } __packed;
  8273. /* DRC configuration structure for each sub-band of an MBDRC module. */
  8274. /* Payload of the #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS DRC
  8275. * configuration parameters for each sub-band in the MBDRC module.
  8276. * After this DRC structure is configured for valid bands, the next
  8277. * MBDRC setparams expects the sequence of sub-band MBDRC filter
  8278. * coefficients (the length depends on the number of bands) plus the
  8279. * mute flag for that band plus uint16_t padding.
  8280. *
  8281. * @keep{10}
  8282. * The filter coefficient and mute flag are of type int16_t:
  8283. * - FIR coefficient = int16_t firFilter
  8284. * - Mute flag = int16_t fMuteFlag
  8285. *
  8286. * The sequence is as follows:
  8287. * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
  8288. * - 2 bands = 97 FIR coefficients + 2 mute flags + uint16_t padding
  8289. * - 3 bands = 97+33 FIR coefficients + 3 mute flags + uint16_t padding
  8290. * - 4 bands = 97+33+33 FIR coefficients + 4 mute flags + uint16_t padding
  8291. * - 5 bands = 97+33+33+33 FIR coefficients + 5 mute flags + uint16_t padding
  8292. *
  8293. * For improved filterbank, the sequence is as follows:
  8294. * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
  8295. * - 2 bands = 141 FIR coefficients + 2 mute flags + uint16_t padding
  8296. * - 3 bands = 141+81 FIR coefficients + 3 mute flags + uint16_t padding
  8297. * - 4 bands = 141+81+61 FIR coefficients + 4 mute flags + uint16_t padding
  8298. * - 5 bands = 141+81+61+61 FIR coefficients + 5 mute flags + uint16_t padding
  8299. */
  8300. struct asm_subband_drc_config_params {
  8301. int16_t drc_stereo_linked_flag;
  8302. /*< Specifies whether all stereo channels have the same applied
  8303. * dynamics (1) or if they process their dynamics independently (0).
  8304. * Supported values:
  8305. * - 0 -- Not linked
  8306. * - 1 -- Linked
  8307. */
  8308. int16_t drc_mode;
  8309. /*< Specifies whether DRC mode is bypassed for sub-bands.
  8310. * Supported values:
  8311. * - 0 -- Disabled
  8312. * - 1 -- Enabled
  8313. */
  8314. int16_t drc_down_sample_level;
  8315. /*< DRC down sample level.
  8316. * Supported values: @ge 1
  8317. */
  8318. int16_t drc_delay;
  8319. /*< DRC delay in samples.
  8320. * Supported values: 0 to 1200
  8321. */
  8322. uint16_t drc_rmsime_avg_const;
  8323. /*< RMS signal energy time-averaging constant.
  8324. * Supported values: 0 to 2^16-1
  8325. */
  8326. uint16_t drc_makeup_gain;
  8327. /*< DRC makeup gain in decibels.
  8328. * Supported values: 258 to 64917
  8329. */
  8330. /* Down expander settings */
  8331. int16_t down_expdrhreshold;
  8332. /*< Down expander threshold.
  8333. * Supported Q7 format values: 1320 to up_cmpsrhreshold
  8334. */
  8335. int16_t down_expdr_slope;
  8336. /*< Down expander slope.
  8337. * Supported Q8 format values: -32768 to 0.
  8338. */
  8339. uint32_t down_expdr_attack;
  8340. /*< Down expander attack constant.
  8341. * Supported Q31 format values: 196844 to 2^31.
  8342. */
  8343. uint32_t down_expdr_release;
  8344. /*< Down expander release constant.
  8345. * Supported Q31 format values: 19685 to 2^31
  8346. */
  8347. uint16_t down_expdr_hysteresis;
  8348. /*< Down expander hysteresis constant.
  8349. * Supported Q14 format values: 1 to 32690
  8350. */
  8351. uint16_t reserved;
  8352. /*< Clients must set this field to zero. */
  8353. int32_t down_expdr_min_gain_db;
  8354. /*< Down expander minimum gain.
  8355. * Supported Q23 format values: -805306368 to 0.
  8356. */
  8357. /* Up compressor settings */
  8358. int16_t up_cmpsrhreshold;
  8359. /*< Up compressor threshold.
  8360. * Supported Q7 format values: down_expdrhreshold to
  8361. * down_cmpsrhreshold.
  8362. */
  8363. uint16_t up_cmpsr_slope;
  8364. /*< Up compressor slope.
  8365. * Supported Q16 format values: 0 to 64881.
  8366. */
  8367. uint32_t up_cmpsr_attack;
  8368. /*< Up compressor attack constant.
  8369. * Supported Q31 format values: 196844 to 2^31.
  8370. */
  8371. uint32_t up_cmpsr_release;
  8372. /*< Up compressor release constant.
  8373. * Supported Q31 format values: 19685 to 2^31.
  8374. */
  8375. uint16_t up_cmpsr_hysteresis;
  8376. /*< Up compressor hysteresis constant.
  8377. * Supported Q14 format values: 1 to 32690.
  8378. */
  8379. /* Down compressor settings */
  8380. int16_t down_cmpsrhreshold;
  8381. /*< Down compressor threshold.
  8382. * Supported Q7 format values: up_cmpsrhreshold to 11560.
  8383. */
  8384. uint16_t down_cmpsr_slope;
  8385. /*< Down compressor slope.
  8386. * Supported Q16 format values: 0 to 64881.
  8387. */
  8388. uint16_t reserved1;
  8389. /*< Clients must set this field to zero. */
  8390. uint32_t down_cmpsr_attack;
  8391. /*< Down compressor attack constant.
  8392. * Supported Q31 format values: 196844 to 2^31.
  8393. */
  8394. uint32_t down_cmpsr_release;
  8395. /*< Down compressor release constant.
  8396. * Supported Q31 format values: 19685 to 2^31.
  8397. */
  8398. uint16_t down_cmpsr_hysteresis;
  8399. /*< Down compressor hysteresis constant.
  8400. * Supported Q14 values: 1 to 32690.
  8401. */
  8402. uint16_t reserved2;
  8403. /*< Clients must set this field to zero.*/
  8404. } __packed;
  8405. #define ASM_MODULE_ID_EQUALIZER 0x00010C27
  8406. #define ASM_PARAM_ID_EQUALIZER_PARAMETERS 0x00010C28
  8407. #define ASM_MAX_EQ_BANDS 12
  8408. struct asm_eq_per_band_params {
  8409. uint32_t band_idx;
  8410. /*< Band index.
  8411. * Supported values: 0 to 11
  8412. */
  8413. uint32_t filterype;
  8414. /*< Type of filter.
  8415. * Supported values:
  8416. * - #ASM_PARAM_EQYPE_NONE
  8417. * - #ASM_PARAM_EQ_BASS_BOOST
  8418. * - #ASM_PARAM_EQ_BASS_CUT
  8419. * - #ASM_PARAM_EQREBLE_BOOST
  8420. * - #ASM_PARAM_EQREBLE_CUT
  8421. * - #ASM_PARAM_EQ_BAND_BOOST
  8422. * - #ASM_PARAM_EQ_BAND_CUT
  8423. */
  8424. uint32_t center_freq_hz;
  8425. /*< Filter band center frequency in Hertz. */
  8426. int32_t filter_gain;
  8427. /*< Filter band initial gain.
  8428. * Supported values: +12 to -12 dB in 1 dB increments
  8429. */
  8430. int32_t q_factor;
  8431. /*< Filter band quality factor expressed as a Q8 number, i.e., a
  8432. * fixed-point number with q factor of 8. For example, 3000/(2^8).
  8433. */
  8434. } __packed;
  8435. struct asm_eq_params {
  8436. uint32_t enable_flag;
  8437. /*< Specifies whether the equalizer module is disabled (0) or enabled
  8438. * (nonzero).
  8439. */
  8440. uint32_t num_bands;
  8441. /*< Number of bands.
  8442. * Supported values: 1 to 12
  8443. */
  8444. struct asm_eq_per_band_params eq_bands[ASM_MAX_EQ_BANDS];
  8445. } __packed;
  8446. /* No equalizer effect.*/
  8447. #define ASM_PARAM_EQYPE_NONE 0
  8448. /* Bass boost equalizer effect.*/
  8449. #define ASM_PARAM_EQ_BASS_BOOST 1
  8450. /*Bass cut equalizer effect.*/
  8451. #define ASM_PARAM_EQ_BASS_CUT 2
  8452. /* Treble boost equalizer effect */
  8453. #define ASM_PARAM_EQREBLE_BOOST 3
  8454. /* Treble cut equalizer effect.*/
  8455. #define ASM_PARAM_EQREBLE_CUT 4
  8456. /* Band boost equalizer effect.*/
  8457. #define ASM_PARAM_EQ_BAND_BOOST 5
  8458. /* Band cut equalizer effect.*/
  8459. #define ASM_PARAM_EQ_BAND_CUT 6
  8460. /* Get & set params */
  8461. #define VSS_ICOMMON_CMD_SET_PARAM_V2 0x0001133D
  8462. #define VSS_ICOMMON_CMD_GET_PARAM_V2 0x0001133E
  8463. #define VSS_ICOMMON_RSP_GET_PARAM 0x00011008
  8464. #define VSS_ICOMMON_CMD_SET_PARAM_V3 0x00013245
  8465. #define VSS_ICOMMON_CMD_GET_PARAM_V3 0x00013246
  8466. #define VSS_ICOMMON_RSP_GET_PARAM_V3 0x00013247
  8467. #define VSS_MAX_AVCS_NUM_SERVICES 25
  8468. /* ID of the Bass Boost module.
  8469. * This module supports the following parameter IDs:
  8470. * - #AUDPROC_PARAM_ID_BASS_BOOST_ENABLE
  8471. * - #AUDPROC_PARAM_ID_BASS_BOOST_MODE
  8472. * - #AUDPROC_PARAM_ID_BASS_BOOST_STRENGTH
  8473. */
  8474. #define AUDPROC_MODULE_ID_BASS_BOOST 0x000108A1
  8475. /* ID of the Bass Boost enable parameter used by
  8476. * AUDPROC_MODULE_ID_BASS_BOOST.
  8477. */
  8478. #define AUDPROC_PARAM_ID_BASS_BOOST_ENABLE 0x000108A2
  8479. /* ID of the Bass Boost mode parameter used by
  8480. * AUDPROC_MODULE_ID_BASS_BOOST.
  8481. */
  8482. #define AUDPROC_PARAM_ID_BASS_BOOST_MODE 0x000108A3
  8483. /* ID of the Bass Boost strength parameter used by
  8484. * AUDPROC_MODULE_ID_BASS_BOOST.
  8485. */
  8486. #define AUDPROC_PARAM_ID_BASS_BOOST_STRENGTH 0x000108A4
  8487. /* ID of the PBE module.
  8488. * This module supports the following parameter IDs:
  8489. * - #AUDPROC_PARAM_ID_PBE_ENABLE
  8490. * - #AUDPROC_PARAM_ID_PBE_PARAM_CONFIG
  8491. */
  8492. #define AUDPROC_MODULE_ID_PBE 0x00010C2A
  8493. /* ID of the Bass Boost enable parameter used by
  8494. * AUDPROC_MODULE_ID_BASS_BOOST.
  8495. */
  8496. #define AUDPROC_PARAM_ID_PBE_ENABLE 0x00010C2B
  8497. /* ID of the Bass Boost mode parameter used by
  8498. * AUDPROC_MODULE_ID_BASS_BOOST.
  8499. */
  8500. #define AUDPROC_PARAM_ID_PBE_PARAM_CONFIG 0x00010C49
  8501. /* ID of the Virtualizer module. This module supports the
  8502. * following parameter IDs:
  8503. * - #AUDPROC_PARAM_ID_VIRTUALIZER_ENABLE
  8504. * - #AUDPROC_PARAM_ID_VIRTUALIZER_STRENGTH
  8505. * - #AUDPROC_PARAM_ID_VIRTUALIZER_OUT_TYPE
  8506. * - #AUDPROC_PARAM_ID_VIRTUALIZER_GAIN_ADJUST
  8507. */
  8508. #define AUDPROC_MODULE_ID_VIRTUALIZER 0x000108A5
  8509. /* ID of the Virtualizer enable parameter used by
  8510. * AUDPROC_MODULE_ID_VIRTUALIZER.
  8511. */
  8512. #define AUDPROC_PARAM_ID_VIRTUALIZER_ENABLE 0x000108A6
  8513. /* ID of the Virtualizer strength parameter used by
  8514. * AUDPROC_MODULE_ID_VIRTUALIZER.
  8515. */
  8516. #define AUDPROC_PARAM_ID_VIRTUALIZER_STRENGTH 0x000108A7
  8517. /* ID of the Virtualizer out type parameter used by
  8518. * AUDPROC_MODULE_ID_VIRTUALIZER.
  8519. */
  8520. #define AUDPROC_PARAM_ID_VIRTUALIZER_OUT_TYPE 0x000108A8
  8521. /* ID of the Virtualizer out type parameter used by
  8522. * AUDPROC_MODULE_ID_VIRTUALIZER.
  8523. */
  8524. #define AUDPROC_PARAM_ID_VIRTUALIZER_GAIN_ADJUST 0x000108A9
  8525. /* ID of the Reverb module. This module supports the following
  8526. * parameter IDs:
  8527. * - #AUDPROC_PARAM_ID_REVERB_ENABLE
  8528. * - #AUDPROC_PARAM_ID_REVERB_MODE
  8529. * - #AUDPROC_PARAM_ID_REVERB_PRESET
  8530. * - #AUDPROC_PARAM_ID_REVERB_WET_MIX
  8531. * - #AUDPROC_PARAM_ID_REVERB_GAIN_ADJUST
  8532. * - #AUDPROC_PARAM_ID_REVERB_ROOM_LEVEL
  8533. * - #AUDPROC_PARAM_ID_REVERB_ROOM_HF_LEVEL
  8534. * - #AUDPROC_PARAM_ID_REVERB_DECAY_TIME
  8535. * - #AUDPROC_PARAM_ID_REVERB_DECAY_HF_RATIO
  8536. * - #AUDPROC_PARAM_ID_REVERB_REFLECTIONS_LEVEL
  8537. * - #AUDPROC_PARAM_ID_REVERB_REFLECTIONS_DELAY
  8538. * - #AUDPROC_PARAM_ID_REVERB_LEVEL
  8539. * - #AUDPROC_PARAM_ID_REVERB_DELAY
  8540. * - #AUDPROC_PARAM_ID_REVERB_DIFFUSION
  8541. * - #AUDPROC_PARAM_ID_REVERB_DENSITY
  8542. */
  8543. #define AUDPROC_MODULE_ID_REVERB 0x000108AA
  8544. /* ID of the Reverb enable parameter used by
  8545. * AUDPROC_MODULE_ID_REVERB.
  8546. */
  8547. #define AUDPROC_PARAM_ID_REVERB_ENABLE 0x000108AB
  8548. /* ID of the Reverb mode parameter used by
  8549. * AUDPROC_MODULE_ID_REVERB.
  8550. */
  8551. #define AUDPROC_PARAM_ID_REVERB_MODE 0x000108AC
  8552. /* ID of the Reverb preset parameter used by
  8553. * AUDPROC_MODULE_ID_REVERB.
  8554. */
  8555. #define AUDPROC_PARAM_ID_REVERB_PRESET 0x000108AD
  8556. /* ID of the Reverb wet mix parameter used by
  8557. * AUDPROC_MODULE_ID_REVERB.
  8558. */
  8559. #define AUDPROC_PARAM_ID_REVERB_WET_MIX 0x000108AE
  8560. /* ID of the Reverb gain adjust parameter used by
  8561. * AUDPROC_MODULE_ID_REVERB.
  8562. */
  8563. #define AUDPROC_PARAM_ID_REVERB_GAIN_ADJUST 0x000108AF
  8564. /* ID of the Reverb room level parameter used by
  8565. * AUDPROC_MODULE_ID_REVERB.
  8566. */
  8567. #define AUDPROC_PARAM_ID_REVERB_ROOM_LEVEL 0x000108B0
  8568. /* ID of the Reverb room hf level parameter used by
  8569. * AUDPROC_MODULE_ID_REVERB.
  8570. */
  8571. #define AUDPROC_PARAM_ID_REVERB_ROOM_HF_LEVEL 0x000108B1
  8572. /* ID of the Reverb decay time parameter used by
  8573. * AUDPROC_MODULE_ID_REVERB.
  8574. */
  8575. #define AUDPROC_PARAM_ID_REVERB_DECAY_TIME 0x000108B2
  8576. /* ID of the Reverb decay hf ratio parameter used by
  8577. * AUDPROC_MODULE_ID_REVERB.
  8578. */
  8579. #define AUDPROC_PARAM_ID_REVERB_DECAY_HF_RATIO 0x000108B3
  8580. /* ID of the Reverb reflections level parameter used by
  8581. * AUDPROC_MODULE_ID_REVERB.
  8582. */
  8583. #define AUDPROC_PARAM_ID_REVERB_REFLECTIONS_LEVEL 0x000108B4
  8584. /* ID of the Reverb reflections delay parameter used by
  8585. * AUDPROC_MODULE_ID_REVERB.
  8586. */
  8587. #define AUDPROC_PARAM_ID_REVERB_REFLECTIONS_DELAY 0x000108B5
  8588. /* ID of the Reverb level parameter used by
  8589. * AUDPROC_MODULE_ID_REVERB.
  8590. */
  8591. #define AUDPROC_PARAM_ID_REVERB_LEVEL 0x000108B6
  8592. /* ID of the Reverb delay parameter used by
  8593. * AUDPROC_MODULE_ID_REVERB.
  8594. */
  8595. #define AUDPROC_PARAM_ID_REVERB_DELAY 0x000108B7
  8596. /* ID of the Reverb diffusion parameter used by
  8597. * AUDPROC_MODULE_ID_REVERB.
  8598. */
  8599. #define AUDPROC_PARAM_ID_REVERB_DIFFUSION 0x000108B8
  8600. /* ID of the Reverb density parameter used by
  8601. * AUDPROC_MODULE_ID_REVERB.
  8602. */
  8603. #define AUDPROC_PARAM_ID_REVERB_DENSITY 0x000108B9
  8604. /* ID of the Popless Equalizer module. This module supports the
  8605. * following parameter IDs:
  8606. * - #AUDPROC_PARAM_ID_EQ_ENABLE
  8607. * - #AUDPROC_PARAM_ID_EQ_CONFIG
  8608. * - #AUDPROC_PARAM_ID_EQ_NUM_BANDS
  8609. * - #AUDPROC_PARAM_ID_EQ_BAND_LEVELS
  8610. * - #AUDPROC_PARAM_ID_EQ_BAND_LEVEL_RANGE
  8611. * - #AUDPROC_PARAM_ID_EQ_BAND_FREQS
  8612. * - #AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ_RANGE
  8613. * - #AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ
  8614. * - #AUDPROC_PARAM_ID_EQ_BAND_INDEX
  8615. * - #AUDPROC_PARAM_ID_EQ_PRESET_ID
  8616. * - #AUDPROC_PARAM_ID_EQ_NUM_PRESETS
  8617. * - #AUDPROC_PARAM_ID_EQ_GET_PRESET_NAME
  8618. */
  8619. #define AUDPROC_MODULE_ID_POPLESS_EQUALIZER 0x000108BA
  8620. /* ID of the Popless Equalizer enable parameter used by
  8621. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
  8622. */
  8623. #define AUDPROC_PARAM_ID_EQ_ENABLE 0x000108BB
  8624. /* ID of the Popless Equalizer config parameter used by
  8625. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
  8626. */
  8627. #define AUDPROC_PARAM_ID_EQ_CONFIG 0x000108BC
  8628. /* ID of the Popless Equalizer number of bands parameter used
  8629. * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
  8630. * used for get param only.
  8631. */
  8632. #define AUDPROC_PARAM_ID_EQ_NUM_BANDS 0x000108BD
  8633. /* ID of the Popless Equalizer band levels parameter used by
  8634. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
  8635. * used for get param only.
  8636. */
  8637. #define AUDPROC_PARAM_ID_EQ_BAND_LEVELS 0x000108BE
  8638. /* ID of the Popless Equalizer band level range parameter used
  8639. * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
  8640. * used for get param only.
  8641. */
  8642. #define AUDPROC_PARAM_ID_EQ_BAND_LEVEL_RANGE 0x000108BF
  8643. /* ID of the Popless Equalizer band frequencies 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_FREQS 0x000108C0
  8648. /* ID of the Popless Equalizer single band frequency range
  8649. * parameter used by AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
  8650. * This param ID is used for get param only.
  8651. */
  8652. #define AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ_RANGE 0x000108C1
  8653. /* ID of the Popless Equalizer single band frequency parameter
  8654. * used by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID
  8655. * is used for set param only.
  8656. */
  8657. #define AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ 0x000108C2
  8658. /* ID of the Popless Equalizer band index parameter used by
  8659. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
  8660. */
  8661. #define AUDPROC_PARAM_ID_EQ_BAND_INDEX 0x000108C3
  8662. /* ID of the Popless Equalizer preset id parameter used by
  8663. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
  8664. * for get param only.
  8665. */
  8666. #define AUDPROC_PARAM_ID_EQ_PRESET_ID 0x000108C4
  8667. /* ID of the Popless Equalizer number of presets parameter used
  8668. * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
  8669. * for get param only.
  8670. */
  8671. #define AUDPROC_PARAM_ID_EQ_NUM_PRESETS 0x000108C5
  8672. /* ID of the Popless Equalizer preset name parameter used by
  8673. * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
  8674. * for get param only.
  8675. */
  8676. #define AUDPROC_PARAM_ID_EQ_PRESET_NAME 0x000108C6
  8677. /* Set Q6 topologies */
  8678. #define ASM_CMD_ADD_TOPOLOGIES 0x00010DBE
  8679. #define ADM_CMD_ADD_TOPOLOGIES 0x00010335
  8680. #define AFE_CMD_ADD_TOPOLOGIES 0x000100f8
  8681. /* structure used for both ioctls */
  8682. struct cmd_set_topologies {
  8683. struct apr_hdr hdr;
  8684. u32 payload_addr_lsw;
  8685. /* LSW of parameter data payload address.*/
  8686. u32 payload_addr_msw;
  8687. /* MSW of parameter data payload address.*/
  8688. u32 mem_map_handle;
  8689. /* Memory map handle returned by mem map command */
  8690. u32 payload_size;
  8691. /* Size in bytes of the variable payload in shared memory */
  8692. } __packed;
  8693. /* This module represents the Rx processing of Feedback speaker protection.
  8694. * It contains the excursion control, thermal protection,
  8695. * analog clip manager features in it.
  8696. * This module id will support following param ids.
  8697. * - AFE_PARAM_ID_FBSP_MODE_RX_CFG
  8698. */
  8699. #define AFE_MODULE_FB_SPKR_PROT_RX 0x0001021C
  8700. #define AFE_MODULE_FB_SPKR_PROT_V2_RX 0x0001025F
  8701. #define AFE_PARAM_ID_SP_RX_LIMITER_TH 0x000102B1
  8702. #define AFE_PARAM_ID_FBSP_MODE_RX_CFG 0x0001021D
  8703. #define AFE_PARAM_ID_FBSP_PTONE_RAMP_CFG 0x00010260
  8704. struct asm_fbsp_mode_rx_cfg {
  8705. uint32_t minor_version;
  8706. uint32_t mode;
  8707. } __packed;
  8708. /* This module represents the VI processing of feedback speaker protection.
  8709. * It will receive Vsens and Isens from codec and generates necessary
  8710. * parameters needed by Rx processing.
  8711. * This module id will support following param ids.
  8712. * - AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG
  8713. * - AFE_PARAM_ID_CALIB_RES_CFG
  8714. * - AFE_PARAM_ID_FEEDBACK_PATH_CFG
  8715. */
  8716. #define AFE_MODULE_FB_SPKR_PROT_VI_PROC 0x00010226
  8717. #define AFE_MODULE_FB_SPKR_PROT_VI_PROC_V2 0x0001026A
  8718. #define AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG 0x0001022A
  8719. #define AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG_V2 0x0001026B
  8720. struct asm_spkr_calib_vi_proc_cfg {
  8721. uint32_t minor_version;
  8722. uint32_t operation_mode;
  8723. uint32_t r0_t0_selection_flag[SP_V2_NUM_MAX_SPKR];
  8724. int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
  8725. int16_t t0_cali_q6[SP_V2_NUM_MAX_SPKR];
  8726. uint32_t quick_calib_flag;
  8727. } __packed;
  8728. #define AFE_PARAM_ID_CALIB_RES_CFG 0x0001022B
  8729. #define AFE_PARAM_ID_CALIB_RES_CFG_V2 0x0001026E
  8730. struct asm_calib_res_cfg {
  8731. uint32_t minor_version;
  8732. int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
  8733. uint32_t th_vi_ca_state;
  8734. } __packed;
  8735. #define AFE_PARAM_ID_FEEDBACK_PATH_CFG 0x0001022C
  8736. #define AFE_MODULE_FEEDBACK 0x00010257
  8737. struct asm_feedback_path_cfg {
  8738. uint32_t minor_version;
  8739. int32_t dst_portid;
  8740. int32_t num_channels;
  8741. int32_t chan_info[4];
  8742. } __packed;
  8743. #define AFE_PARAM_ID_MODE_VI_PROC_CFG 0x00010227
  8744. struct asm_mode_vi_proc_cfg {
  8745. uint32_t minor_version;
  8746. uint32_t cal_mode;
  8747. } __packed;
  8748. #define AFE_MODULE_SPEAKER_PROTECTION_V2_TH_VI 0x0001026A
  8749. #define AFE_PARAM_ID_SP_V2_TH_VI_MODE_CFG 0x0001026B
  8750. #define AFE_PARAM_ID_SP_V2_TH_VI_FTM_CFG 0x0001029F
  8751. #define AFE_PARAM_ID_SP_V2_TH_VI_FTM_PARAMS 0x000102A0
  8752. struct afe_sp_th_vi_mode_cfg {
  8753. uint32_t minor_version;
  8754. uint32_t operation_mode;
  8755. /*
  8756. * Operation mode of thermal VI module.
  8757. * 0 -- Normal Running mode
  8758. * 1 -- Calibration mode
  8759. * 2 -- FTM mode
  8760. */
  8761. uint32_t r0t0_selection_flag[SP_V2_NUM_MAX_SPKR];
  8762. /*
  8763. * Specifies which set of R0, T0 values the algorithm will use.
  8764. * This field is valid only in Normal mode (operation_mode = 0).
  8765. * 0 -- Use calibrated R0, T0 value
  8766. * 1 -- Use safe R0, T0 value
  8767. */
  8768. int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
  8769. /*
  8770. * Calibration point resistance per device. This field is valid
  8771. * only in Normal mode (operation_mode = 0).
  8772. * values 33554432 to 1073741824 Ohms (in Q24 format)
  8773. */
  8774. int16_t t0_cali_q6[SP_V2_NUM_MAX_SPKR];
  8775. /*
  8776. * Calibration point temperature per device. This field is valid
  8777. * in both Normal mode and Calibration mode.
  8778. * values -1920 to 5120 degrees C (in Q6 format)
  8779. */
  8780. uint32_t quick_calib_flag;
  8781. /*
  8782. * Indicates whether calibration is to be done in quick mode or not.
  8783. * This field is valid only in Calibration mode (operation_mode = 1).
  8784. * 0 -- Disabled
  8785. * 1 -- Enabled
  8786. */
  8787. } __packed;
  8788. struct afe_sp_th_vi_ftm_cfg {
  8789. uint32_t minor_version;
  8790. uint32_t wait_time_ms[SP_V2_NUM_MAX_SPKR];
  8791. /*
  8792. * Wait time to heat up speaker before collecting statistics
  8793. * for ftm mode in ms.
  8794. * values 0 to 4294967295 ms
  8795. */
  8796. uint32_t ftm_time_ms[SP_V2_NUM_MAX_SPKR];
  8797. /*
  8798. * duration for which FTM statistics are collected in ms.
  8799. * values 0 to 2000 ms
  8800. */
  8801. } __packed;
  8802. struct afe_sp_th_vi_ftm_params {
  8803. uint32_t minor_version;
  8804. int32_t dc_res_q24[SP_V2_NUM_MAX_SPKR];
  8805. /*
  8806. * DC resistance value in q24 format
  8807. * values 0 to 2147483647 Ohms (in Q24 format)
  8808. */
  8809. int32_t temp_q22[SP_V2_NUM_MAX_SPKR];
  8810. /*
  8811. * temperature value in q22 format
  8812. * values -125829120 to 2147483647 degC (in Q22 format)
  8813. */
  8814. uint32_t status[SP_V2_NUM_MAX_SPKR];
  8815. /*
  8816. * FTM packet status
  8817. * 0 - Incorrect operation mode.This status is returned
  8818. * when GET_PARAM is called in non FTM Mode
  8819. * 1 - Inactive mode -- Port is not yet started.
  8820. * 2 - Wait state. wait_time_ms has not yet elapsed
  8821. * 3 - In progress state. ftm_time_ms has not yet elapsed.
  8822. * 4 - Success.
  8823. * 5 - Failed.
  8824. */
  8825. } __packed;
  8826. struct afe_sp_th_vi_get_param {
  8827. struct param_hdr_v3 pdata;
  8828. struct afe_sp_th_vi_ftm_params param;
  8829. } __packed;
  8830. struct afe_sp_th_vi_get_param_resp {
  8831. uint32_t status;
  8832. struct param_hdr_v3 pdata;
  8833. struct afe_sp_th_vi_ftm_params param;
  8834. } __packed;
  8835. #define AFE_MODULE_SPEAKER_PROTECTION_V2_EX_VI 0x0001026F
  8836. #define AFE_PARAM_ID_SP_V2_EX_VI_MODE_CFG 0x000102A1
  8837. #define AFE_PARAM_ID_SP_V2_EX_VI_FTM_CFG 0x000102A2
  8838. #define AFE_PARAM_ID_SP_V2_EX_VI_FTM_PARAMS 0x000102A3
  8839. struct afe_sp_ex_vi_mode_cfg {
  8840. uint32_t minor_version;
  8841. uint32_t operation_mode;
  8842. /*
  8843. * Operation mode of Excursion VI module.
  8844. * 0 - Normal Running mode
  8845. * 2 - FTM mode
  8846. */
  8847. } __packed;
  8848. struct afe_sp_ex_vi_ftm_cfg {
  8849. uint32_t minor_version;
  8850. uint32_t wait_time_ms[SP_V2_NUM_MAX_SPKR];
  8851. /*
  8852. * Wait time to heat up speaker before collecting statistics
  8853. * for ftm mode in ms.
  8854. * values 0 to 4294967295 ms
  8855. */
  8856. uint32_t ftm_time_ms[SP_V2_NUM_MAX_SPKR];
  8857. /*
  8858. * duration for which FTM statistics are collected in ms.
  8859. * values 0 to 2000 ms
  8860. */
  8861. } __packed;
  8862. struct afe_sp_ex_vi_ftm_params {
  8863. uint32_t minor_version;
  8864. int32_t freq_q20[SP_V2_NUM_MAX_SPKR];
  8865. /*
  8866. * Resonance frequency in q20 format
  8867. * values 0 to 2147483647 Hz (in Q20 format)
  8868. */
  8869. int32_t resis_q24[SP_V2_NUM_MAX_SPKR];
  8870. /*
  8871. * Mechanical resistance in q24 format
  8872. * values 0 to 2147483647 Ohms (in Q24 format)
  8873. */
  8874. int32_t qmct_q24[SP_V2_NUM_MAX_SPKR];
  8875. /*
  8876. * Mechanical Qfactor in q24 format
  8877. * values 0 to 2147483647 (in Q24 format)
  8878. */
  8879. uint32_t status[SP_V2_NUM_MAX_SPKR];
  8880. /*
  8881. * FTM packet status
  8882. * 0 - Incorrect operation mode.This status is returned
  8883. * when GET_PARAM is called in non FTM Mode.
  8884. * 1 - Inactive mode -- Port is not yet started.
  8885. * 2 - Wait state. wait_time_ms has not yet elapsed
  8886. * 3 - In progress state. ftm_time_ms has not yet elapsed.
  8887. * 4 - Success.
  8888. * 5 - Failed.
  8889. */
  8890. } __packed;
  8891. struct afe_sp_ex_vi_get_param {
  8892. struct param_hdr_v3 pdata;
  8893. struct afe_sp_ex_vi_ftm_params param;
  8894. } __packed;
  8895. struct afe_sp_ex_vi_get_param_resp {
  8896. uint32_t status;
  8897. struct param_hdr_v3 pdata;
  8898. struct afe_sp_ex_vi_ftm_params param;
  8899. } __packed;
  8900. struct afe_sp_rx_limiter_th_param {
  8901. uint32_t minor_version;
  8902. uint32_t lim_thr_per_calib_q27[SP_V2_NUM_MAX_SPKR];
  8903. } __packed;
  8904. union afe_spkr_prot_config {
  8905. struct asm_fbsp_mode_rx_cfg mode_rx_cfg;
  8906. struct asm_spkr_calib_vi_proc_cfg vi_proc_cfg;
  8907. struct asm_feedback_path_cfg feedback_path_cfg;
  8908. struct asm_mode_vi_proc_cfg mode_vi_proc_cfg;
  8909. struct afe_sp_th_vi_mode_cfg th_vi_mode_cfg;
  8910. struct afe_sp_th_vi_ftm_cfg th_vi_ftm_cfg;
  8911. struct afe_sp_ex_vi_mode_cfg ex_vi_mode_cfg;
  8912. struct afe_sp_ex_vi_ftm_cfg ex_vi_ftm_cfg;
  8913. struct afe_sp_rx_limiter_th_param limiter_th_cfg;
  8914. } __packed;
  8915. struct afe_spkr_prot_get_vi_calib {
  8916. struct apr_hdr hdr;
  8917. struct mem_mapping_hdr mem_hdr;
  8918. struct param_hdr_v3 pdata;
  8919. struct asm_calib_res_cfg res_cfg;
  8920. } __packed;
  8921. struct afe_spkr_prot_calib_get_resp {
  8922. uint32_t status;
  8923. struct param_hdr_v3 pdata;
  8924. struct asm_calib_res_cfg res_cfg;
  8925. } __packed;
  8926. /* SRS TRUMEDIA start */
  8927. /* topology */
  8928. #define SRS_TRUMEDIA_TOPOLOGY_ID 0x00010D90
  8929. /* module */
  8930. #define SRS_TRUMEDIA_MODULE_ID 0x10005010
  8931. /* parameters */
  8932. #define SRS_TRUMEDIA_PARAMS 0x10005011
  8933. #define SRS_TRUMEDIA_PARAMS_WOWHD 0x10005012
  8934. #define SRS_TRUMEDIA_PARAMS_CSHP 0x10005013
  8935. #define SRS_TRUMEDIA_PARAMS_HPF 0x10005014
  8936. #define SRS_TRUMEDIA_PARAMS_AEQ 0x10005015
  8937. #define SRS_TRUMEDIA_PARAMS_HL 0x10005016
  8938. #define SRS_TRUMEDIA_PARAMS_GEQ 0x10005017
  8939. #define SRS_ID_GLOBAL 0x00000001
  8940. #define SRS_ID_WOWHD 0x00000002
  8941. #define SRS_ID_CSHP 0x00000003
  8942. #define SRS_ID_HPF 0x00000004
  8943. #define SRS_ID_AEQ 0x00000005
  8944. #define SRS_ID_HL 0x00000006
  8945. #define SRS_ID_GEQ 0x00000007
  8946. #define SRS_CMD_UPLOAD 0x7FFF0000
  8947. #define SRS_PARAM_OFFSET_MASK 0x3FFF0000
  8948. #define SRS_PARAM_VALUE_MASK 0x0000FFFF
  8949. struct srs_trumedia_params_GLOBAL {
  8950. uint8_t v1;
  8951. uint8_t v2;
  8952. uint8_t v3;
  8953. uint8_t v4;
  8954. uint8_t v5;
  8955. uint8_t v6;
  8956. uint8_t v7;
  8957. uint8_t v8;
  8958. uint16_t v9;
  8959. } __packed;
  8960. struct srs_trumedia_params_WOWHD {
  8961. uint32_t v1;
  8962. uint16_t v2;
  8963. uint16_t v3;
  8964. uint16_t v4;
  8965. uint16_t v5;
  8966. uint16_t v6;
  8967. uint16_t v7;
  8968. uint16_t v8;
  8969. uint16_t v____A1;
  8970. uint32_t v9;
  8971. uint16_t v10;
  8972. uint16_t v11;
  8973. uint32_t v12[16];
  8974. uint32_t v13[16];
  8975. uint32_t v14[16];
  8976. uint32_t v15[16];
  8977. uint32_t v16;
  8978. uint16_t v17;
  8979. uint16_t v18;
  8980. } __packed;
  8981. struct srs_trumedia_params_CSHP {
  8982. uint32_t v1;
  8983. uint16_t v2;
  8984. uint16_t v3;
  8985. uint16_t v4;
  8986. uint16_t v5;
  8987. uint16_t v6;
  8988. uint16_t v____A1;
  8989. uint32_t v7;
  8990. uint16_t v8;
  8991. uint16_t v9;
  8992. uint32_t v10[16];
  8993. } __packed;
  8994. struct srs_trumedia_params_HPF {
  8995. uint32_t v1;
  8996. uint32_t v2[26];
  8997. } __packed;
  8998. struct srs_trumedia_params_AEQ {
  8999. uint32_t v1;
  9000. uint16_t v2;
  9001. uint16_t v3;
  9002. uint16_t v4;
  9003. uint16_t v____A1;
  9004. uint32_t v5[74];
  9005. uint32_t v6[74];
  9006. uint16_t v7[2048];
  9007. } __packed;
  9008. struct srs_trumedia_params_HL {
  9009. uint16_t v1;
  9010. uint16_t v2;
  9011. uint16_t v3;
  9012. uint16_t v____A1;
  9013. int32_t v4;
  9014. uint32_t v5;
  9015. uint16_t v6;
  9016. uint16_t v____A2;
  9017. uint32_t v7;
  9018. } __packed;
  9019. struct srs_trumedia_params_GEQ {
  9020. int16_t v1[10];
  9021. } __packed;
  9022. struct srs_trumedia_params {
  9023. struct srs_trumedia_params_GLOBAL global;
  9024. struct srs_trumedia_params_WOWHD wowhd;
  9025. struct srs_trumedia_params_CSHP cshp;
  9026. struct srs_trumedia_params_HPF hpf;
  9027. struct srs_trumedia_params_AEQ aeq;
  9028. struct srs_trumedia_params_HL hl;
  9029. struct srs_trumedia_params_GEQ geq;
  9030. } __packed;
  9031. /* SRS TruMedia end */
  9032. #define AUDPROC_PARAM_ID_ENABLE 0x00010904
  9033. #define ASM_STREAM_POSTPROC_TOPO_ID_SA_PLUS 0x1000FFFF
  9034. /* DTS Eagle */
  9035. #define AUDPROC_MODULE_ID_DTS_HPX_PREMIX 0x0001077C
  9036. #define AUDPROC_MODULE_ID_DTS_HPX_POSTMIX 0x0001077B
  9037. #define ASM_STREAM_POSTPROC_TOPO_ID_DTS_HPX 0x00010DED
  9038. #define ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS 0x10015000
  9039. #define ASM_STREAM_POSTPROC_TOPO_ID_HPX_MASTER 0x10015001
  9040. /* Opcode to set BT address and license for aptx decoder */
  9041. #define APTX_DECODER_BT_ADDRESS 0x00013201
  9042. #define APTX_CLASSIC_DEC_LICENSE_ID 0x00013202
  9043. struct aptx_dec_bt_addr_cfg {
  9044. uint32_t lap;
  9045. uint32_t uap;
  9046. uint32_t nap;
  9047. } __packed;
  9048. struct aptx_dec_bt_dev_addr {
  9049. struct apr_hdr hdr;
  9050. struct asm_stream_cmd_set_encdec_param encdec;
  9051. struct aptx_dec_bt_addr_cfg bt_addr_cfg;
  9052. } __packed;
  9053. struct asm_aptx_dec_fmt_blk_v2 {
  9054. struct apr_hdr hdr;
  9055. struct asm_data_cmd_media_fmt_update_v2 fmtblk;
  9056. u32 sample_rate;
  9057. /* Number of samples per second.
  9058. * Supported values: 44100 and 48000 Hz
  9059. */
  9060. } __packed;
  9061. /* Q6Core Specific */
  9062. #define AVCS_CMD_GET_FWK_VERSION (0x0001292C)
  9063. #define AVCS_CMDRSP_GET_FWK_VERSION (0x0001292D)
  9064. #define AVCS_SERVICE_ID_ALL (0xFFFFFFFF)
  9065. #define APRV2_IDS_SERVICE_ID_ADSP_CVP_V (0xB)
  9066. #define APRV2_IDS_SERVICE_ID_ADSP_AFE_V (0x4)
  9067. struct avcs_get_fwk_version {
  9068. /*
  9069. * Indicates the major version of the AVS build.
  9070. * This value is incremented on chipset family boundaries.
  9071. */
  9072. uint32_t build_major_version;
  9073. /*
  9074. * Minor version of the AVS build.
  9075. * This value represents the mainline to which the AVS build belongs.
  9076. */
  9077. uint32_t build_minor_version;
  9078. /* Indicates the AVS branch version to which the image belongs. */
  9079. uint32_t build_branch_version;
  9080. /* Indicates the AVS sub-branch or customer product line information. */
  9081. uint32_t build_subbranch_version;
  9082. /* Number of supported AVS services in the current build. */
  9083. uint32_t num_services;
  9084. };
  9085. struct avs_svc_api_info {
  9086. /*
  9087. * APRV2 service IDs for the individual static services.
  9088. *
  9089. * @values
  9090. * - APRV2_IDS_SERVICE_ID_ADSP_CORE_V
  9091. * - APRV2_IDS_SERVICE_ID_ADSP_AFE_V
  9092. * - APRV2_IDS_SERVICE_ID_ADSP_ASM_V
  9093. * - APRV2_IDS_SERVICE_ID_ADSP_ADM_V
  9094. * - APRV2_IDS_SERVICE_ID_ADSP_MVM_V
  9095. * - APRV2_IDS_SERVICE_ID_ADSP_CVS_V
  9096. * - APRV2_IDS_SERVICE_ID_ADSP_CVP_V
  9097. * - APRV2_IDS_SERVICE_ID_ADSP_LSM_V
  9098. */
  9099. uint32_t service_id;
  9100. /*
  9101. * Indicates the API version of the service.
  9102. *
  9103. * Each new API update that warrants a change on the HLOS side triggers
  9104. * an increment in the version.
  9105. */
  9106. uint32_t api_version;
  9107. /*
  9108. * Indicates the API increments on a sub-branch (not on the mainline).
  9109. *
  9110. * API branch version numbers can increment independently on different
  9111. * sub-branches.
  9112. */
  9113. uint32_t api_branch_version;
  9114. };
  9115. struct avcs_fwk_ver_info {
  9116. struct avcs_get_fwk_version avcs_fwk_version;
  9117. struct avs_svc_api_info services[0];
  9118. } __packed;
  9119. /* LSM Specific */
  9120. #define VW_FEAT_DIM (39)
  9121. #define APRV2_IDS_SERVICE_ID_ADSP_ASM_V (0x7)
  9122. #define APRV2_IDS_SERVICE_ID_ADSP_ADM_V (0x8)
  9123. #define APRV2_IDS_SERVICE_ID_ADSP_LSM_V (0xD)
  9124. #define APRV2_IDS_DOMAIN_ID_ADSP_V (0x4)
  9125. #define APRV2_IDS_DOMAIN_ID_APPS_V (0x5)
  9126. #define LSM_SESSION_CMD_SHARED_MEM_MAP_REGIONS (0x00012A7F)
  9127. #define LSM_SESSION_CMDRSP_SHARED_MEM_MAP_REGIONS (0x00012A80)
  9128. #define LSM_SESSION_CMD_SHARED_MEM_UNMAP_REGIONS (0x00012A81)
  9129. #define LSM_SESSION_CMD_OPEN_TX (0x00012A82)
  9130. #define LSM_SESSION_CMD_CLOSE_TX (0x00012A88)
  9131. #define LSM_SESSION_CMD_SET_PARAMS (0x00012A83)
  9132. #define LSM_SESSION_CMD_SET_PARAMS_V2 (0x00012A8F)
  9133. #define LSM_SESSION_CMD_SET_PARAMS_V3 (0x00012A92)
  9134. #define LSM_SESSION_CMD_REGISTER_SOUND_MODEL (0x00012A84)
  9135. #define LSM_SESSION_CMD_DEREGISTER_SOUND_MODEL (0x00012A85)
  9136. #define LSM_SESSION_CMD_START (0x00012A86)
  9137. #define LSM_SESSION_CMD_STOP (0x00012A87)
  9138. #define LSM_SESSION_CMD_EOB (0x00012A89)
  9139. #define LSM_SESSION_CMD_READ (0x00012A8A)
  9140. #define LSM_SESSION_CMD_OPEN_TX_V2 (0x00012A8B)
  9141. #define LSM_SESSION_CMD_OPEN_TX_V3 (0x00012A95)
  9142. #define LSM_CMD_ADD_TOPOLOGIES (0x00012A8C)
  9143. #define LSM_SESSION_EVENT_DETECTION_STATUS (0x00012B00)
  9144. #define LSM_SESSION_EVENT_DETECTION_STATUS_V2 (0x00012B01)
  9145. #define LSM_DATA_EVENT_READ_DONE (0x00012B02)
  9146. #define LSM_DATA_EVENT_STATUS (0x00012B03)
  9147. #define LSM_SESSION_EVENT_DETECTION_STATUS_V3 (0x00012B04)
  9148. #define LSM_SESSION_DETECTION_ENGINE_GENERIC_EVENT (0x00012B06)
  9149. #define LSM_MODULE_ID_VOICE_WAKEUP (0x00012C00)
  9150. #define LSM_PARAM_ID_ENDPOINT_DETECT_THRESHOLD (0x00012C01)
  9151. #define LSM_PARAM_ID_OPERATION_MODE (0x00012C02)
  9152. #define LSM_PARAM_ID_GAIN (0x00012C03)
  9153. #define LSM_PARAM_ID_CONNECT_TO_PORT (0x00012C04)
  9154. #define LSM_PARAM_ID_FEATURE_COMPENSATION_DATA (0x00012C07)
  9155. #define LSM_PARAM_ID_MIN_CONFIDENCE_LEVELS (0x00012C07)
  9156. #define LSM_MODULE_ID_LAB (0x00012C08)
  9157. #define LSM_PARAM_ID_LAB_ENABLE (0x00012C09)
  9158. #define LSM_PARAM_ID_LAB_CONFIG (0x00012C0A)
  9159. #define LSM_MODULE_ID_FRAMEWORK (0x00012C0E)
  9160. #define LSM_PARAM_ID_SWMAD_CFG (0x00012C18)
  9161. #define LSM_PARAM_ID_SWMAD_MODEL (0x00012C19)
  9162. #define LSM_PARAM_ID_SWMAD_ENABLE (0x00012C1A)
  9163. #define LSM_PARAM_ID_POLLING_ENABLE (0x00012C1B)
  9164. #define LSM_PARAM_ID_MEDIA_FMT (0x00012C1E)
  9165. #define LSM_PARAM_ID_FWK_MODE_CONFIG (0x00012C27)
  9166. #define LSM_PARAM_ID_MEDIA_FMT_V2 (0x00012C32)
  9167. #define LSM_PARAM_ID_LAB_OUTPUT_CHANNEL_CONFIG (0x00012C2D)
  9168. /* HW MAD specific */
  9169. #define AFE_MODULE_HW_MAD (0x00010230)
  9170. #define AFE_PARAM_ID_HW_MAD_CFG (0x00010231)
  9171. #define AFE_PARAM_ID_HW_MAD_CTRL (0x00010232)
  9172. #define AFE_PARAM_ID_SLIMBUS_SLAVE_PORT_CFG (0x00010233)
  9173. /* SW MAD specific */
  9174. #define AFE_MODULE_SW_MAD (0x0001022D)
  9175. #define AFE_PARAM_ID_SW_MAD_CFG (0x0001022E)
  9176. #define AFE_PARAM_ID_SVM_MODEL (0x0001022F)
  9177. /* Commands/Params to pass the codec/slimbus data to DSP */
  9178. #define AFE_SVC_CMD_SET_PARAM (0x000100f3)
  9179. #define AFE_SVC_CMD_SET_PARAM_V2 (0x000100fc)
  9180. #define AFE_MODULE_CDC_DEV_CFG (0x00010234)
  9181. #define AFE_PARAM_ID_CDC_SLIMBUS_SLAVE_CFG (0x00010235)
  9182. #define AFE_PARAM_ID_CDC_REG_CFG (0x00010236)
  9183. #define AFE_PARAM_ID_CDC_REG_CFG_INIT (0x00010237)
  9184. #define AFE_PARAM_ID_CDC_REG_PAGE_CFG (0x00010296)
  9185. #define AFE_MAX_CDC_REGISTERS_TO_CONFIG (20)
  9186. /* AANC Port Config Specific */
  9187. #define AFE_PARAM_ID_AANC_PORT_CONFIG (0x00010215)
  9188. #define AFE_API_VERSION_AANC_PORT_CONFIG (0x1)
  9189. #define AANC_TX_MIC_UNUSED (0)
  9190. #define AANC_TX_VOICE_MIC (1)
  9191. #define AANC_TX_ERROR_MIC (2)
  9192. #define AANC_TX_NOISE_MIC (3)
  9193. #define AFE_PORT_MAX_CHANNEL_CNT (8)
  9194. #define AFE_MODULE_AANC (0x00010214)
  9195. #define AFE_PARAM_ID_CDC_AANC_VERSION (0x0001023A)
  9196. #define AFE_API_VERSION_CDC_AANC_VERSION (0x1)
  9197. #define AANC_HW_BLOCK_VERSION_1 (1)
  9198. #define AANC_HW_BLOCK_VERSION_2 (2)
  9199. /*Clip bank selection*/
  9200. #define AFE_API_VERSION_CLIP_BANK_SEL_CFG 0x1
  9201. #define AFE_CLIP_MAX_BANKS 4
  9202. #define AFE_PARAM_ID_CLIP_BANK_SEL_CFG 0x00010242
  9203. struct afe_param_aanc_port_cfg {
  9204. /* Minor version used for tracking the version of the module's
  9205. * source port configuration.
  9206. */
  9207. uint32_t aanc_port_cfg_minor_version;
  9208. /* Sampling rate of the source Tx port. 8k - 192k*/
  9209. uint32_t tx_port_sample_rate;
  9210. /* Channel mapping for the Tx port signal carrying Noise (X),
  9211. * Error (E), and Voice (V) signals.
  9212. */
  9213. uint8_t tx_port_channel_map[AFE_PORT_MAX_CHANNEL_CNT];
  9214. /* Number of channels on the source Tx port. */
  9215. uint16_t tx_port_num_channels;
  9216. /* Port ID of the Rx path reference signal. */
  9217. uint16_t rx_path_ref_port_id;
  9218. /* Sampling rate of the reference port. 8k - 192k*/
  9219. uint32_t ref_port_sample_rate;
  9220. } __packed;
  9221. struct afe_param_id_cdc_aanc_version {
  9222. /* Minor version used for tracking the version of the module's
  9223. * hw version
  9224. */
  9225. uint32_t cdc_aanc_minor_version;
  9226. /* HW version. */
  9227. uint32_t aanc_hw_version;
  9228. } __packed;
  9229. #define AFE_PARAM_ID_AANC_NOISE_REDUCTION 0x000102AB
  9230. struct afe_param_id_aanc_noise_reduction {
  9231. /* Minor version used for tracking the version of the module's
  9232. * hw version
  9233. */
  9234. uint32_t minor_version;
  9235. /* Target noise level */
  9236. int32_t ad_beta;
  9237. } __packed;
  9238. struct afe_param_id_clip_bank_sel {
  9239. /* Minor version used for tracking the version of the module's
  9240. * hw version
  9241. */
  9242. uint32_t minor_version;
  9243. /* Number of banks to be read */
  9244. uint32_t num_banks;
  9245. uint32_t bank_map[AFE_CLIP_MAX_BANKS];
  9246. } __packed;
  9247. /* ERROR CODES */
  9248. /* Success. The operation completed with no errors. */
  9249. #define ADSP_EOK 0x00000000
  9250. /* General failure. */
  9251. #define ADSP_EFAILED 0x00000001
  9252. /* Bad operation parameter. */
  9253. #define ADSP_EBADPARAM 0x00000002
  9254. /* Unsupported routine or operation. */
  9255. #define ADSP_EUNSUPPORTED 0x00000003
  9256. /* Unsupported version. */
  9257. #define ADSP_EVERSION 0x00000004
  9258. /* Unexpected problem encountered. */
  9259. #define ADSP_EUNEXPECTED 0x00000005
  9260. /* Unhandled problem occurred. */
  9261. #define ADSP_EPANIC 0x00000006
  9262. /* Unable to allocate resource. */
  9263. #define ADSP_ENORESOURCE 0x00000007
  9264. /* Invalid handle. */
  9265. #define ADSP_EHANDLE 0x00000008
  9266. /* Operation is already processed. */
  9267. #define ADSP_EALREADY 0x00000009
  9268. /* Operation is not ready to be processed. */
  9269. #define ADSP_ENOTREADY 0x0000000A
  9270. /* Operation is pending completion. */
  9271. #define ADSP_EPENDING 0x0000000B
  9272. /* Operation could not be accepted or processed. */
  9273. #define ADSP_EBUSY 0x0000000C
  9274. /* Operation aborted due to an error. */
  9275. #define ADSP_EABORTED 0x0000000D
  9276. /* Operation preempted by a higher priority. */
  9277. #define ADSP_EPREEMPTED 0x0000000E
  9278. /* Operation requests intervention to complete. */
  9279. #define ADSP_ECONTINUE 0x0000000F
  9280. /* Operation requests immediate intervention to complete. */
  9281. #define ADSP_EIMMEDIATE 0x00000010
  9282. /* Operation is not implemented. */
  9283. #define ADSP_ENOTIMPL 0x00000011
  9284. /* Operation needs more data or resources. */
  9285. #define ADSP_ENEEDMORE 0x00000012
  9286. /* Operation does not have memory. */
  9287. #define ADSP_ENOMEMORY 0x00000014
  9288. /* Item does not exist. */
  9289. #define ADSP_ENOTEXIST 0x00000015
  9290. /* Max count for adsp error code sent to HLOS*/
  9291. #define ADSP_ERR_MAX (ADSP_ENOTEXIST + 1)
  9292. /* Operation is finished. */
  9293. #define ADSP_ETERMINATED 0x00011174
  9294. /*bharath, adsp_error_codes.h */
  9295. /* LPASS clock for I2S Interface */
  9296. /* Supported OSR clock values */
  9297. #define Q6AFE_LPASS_OSR_CLK_12_P288_MHZ 0xBB8000
  9298. #define Q6AFE_LPASS_OSR_CLK_11_P2896_MHZ 0xAC4400
  9299. #define Q6AFE_LPASS_OSR_CLK_9_P600_MHZ 0x927C00
  9300. #define Q6AFE_LPASS_OSR_CLK_8_P192_MHZ 0x7D0000
  9301. #define Q6AFE_LPASS_OSR_CLK_6_P144_MHZ 0x5DC000
  9302. #define Q6AFE_LPASS_OSR_CLK_4_P096_MHZ 0x3E8000
  9303. #define Q6AFE_LPASS_OSR_CLK_3_P072_MHZ 0x2EE000
  9304. #define Q6AFE_LPASS_OSR_CLK_2_P048_MHZ 0x1F4000
  9305. #define Q6AFE_LPASS_OSR_CLK_1_P536_MHZ 0x177000
  9306. #define Q6AFE_LPASS_OSR_CLK_1_P024_MHZ 0xFA000
  9307. #define Q6AFE_LPASS_OSR_CLK_768_kHZ 0xBB800
  9308. #define Q6AFE_LPASS_OSR_CLK_512_kHZ 0x7D000
  9309. #define Q6AFE_LPASS_OSR_CLK_DISABLE 0x0
  9310. /* Supported Bit clock values */
  9311. #define Q6AFE_LPASS_IBIT_CLK_12_P288_MHZ 0xBB8000
  9312. #define Q6AFE_LPASS_IBIT_CLK_11_P2896_MHZ 0xAC4400
  9313. #define Q6AFE_LPASS_IBIT_CLK_8_P192_MHZ 0x7D0000
  9314. #define Q6AFE_LPASS_IBIT_CLK_6_P144_MHZ 0x5DC000
  9315. #define Q6AFE_LPASS_IBIT_CLK_4_P096_MHZ 0x3E8000
  9316. #define Q6AFE_LPASS_IBIT_CLK_3_P072_MHZ 0x2EE000
  9317. #define Q6AFE_LPASS_IBIT_CLK_2_P8224_MHZ 0x2b1100
  9318. #define Q6AFE_LPASS_IBIT_CLK_2_P048_MHZ 0x1F4000
  9319. #define Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ 0x177000
  9320. #define Q6AFE_LPASS_IBIT_CLK_1_P4112_MHZ 0x158880
  9321. #define Q6AFE_LPASS_IBIT_CLK_1_P024_MHZ 0xFA000
  9322. #define Q6AFE_LPASS_IBIT_CLK_768_KHZ 0xBB800
  9323. #define Q6AFE_LPASS_IBIT_CLK_512_KHZ 0x7D000
  9324. #define Q6AFE_LPASS_IBIT_CLK_256_KHZ 0x3E800
  9325. #define Q6AFE_LPASS_IBIT_CLK_DISABLE 0x0
  9326. /* Supported LPASS CLK sources */
  9327. #define Q6AFE_LPASS_CLK_SRC_EXTERNAL 0
  9328. #define Q6AFE_LPASS_CLK_SRC_INTERNAL 1
  9329. /* Supported LPASS CLK root*/
  9330. #define Q6AFE_LPASS_CLK_ROOT_DEFAULT 0
  9331. enum afe_lpass_clk_mode {
  9332. Q6AFE_LPASS_MODE_BOTH_INVALID,
  9333. Q6AFE_LPASS_MODE_CLK1_VALID,
  9334. Q6AFE_LPASS_MODE_CLK2_VALID,
  9335. Q6AFE_LPASS_MODE_BOTH_VALID,
  9336. } __packed;
  9337. /* Clock ID Enumeration Define. */
  9338. /* Clock ID for Primary I2S IBIT */
  9339. #define Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT 0x100
  9340. /* Clock ID for Primary I2S EBIT */
  9341. #define Q6AFE_LPASS_CLK_ID_PRI_MI2S_EBIT 0x101
  9342. /* Clock ID for Secondary I2S IBIT */
  9343. #define Q6AFE_LPASS_CLK_ID_SEC_MI2S_IBIT 0x102
  9344. /* Clock ID for Secondary I2S EBIT */
  9345. #define Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT 0x103
  9346. /* Clock ID for Tertiary I2S IBIT */
  9347. #define Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT 0x104
  9348. /* Clock ID for Tertiary I2S EBIT */
  9349. #define Q6AFE_LPASS_CLK_ID_TER_MI2S_EBIT 0x105
  9350. /* Clock ID for Quartnery I2S IBIT */
  9351. #define Q6AFE_LPASS_CLK_ID_QUAD_MI2S_IBIT 0x106
  9352. /* Clock ID for Quartnery I2S EBIT */
  9353. #define Q6AFE_LPASS_CLK_ID_QUAD_MI2S_EBIT 0x107
  9354. /* Clock ID for Speaker I2S IBIT */
  9355. #define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_IBIT 0x108
  9356. /* Clock ID for Speaker I2S EBIT */
  9357. #define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_EBIT 0x109
  9358. /* Clock ID for Speaker I2S OSR */
  9359. #define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_OSR 0x10A
  9360. /* Clock ID for QUINARY I2S IBIT */
  9361. #define Q6AFE_LPASS_CLK_ID_QUI_MI2S_IBIT 0x10B
  9362. /* Clock ID for QUINARY I2S EBIT */
  9363. #define Q6AFE_LPASS_CLK_ID_QUI_MI2S_EBIT 0x10C
  9364. /* Clock ID for SENARY I2S IBIT */
  9365. #define Q6AFE_LPASS_CLK_ID_SEN_MI2S_IBIT 0x10D
  9366. /* Clock ID for SENARY I2S EBIT */
  9367. #define Q6AFE_LPASS_CLK_ID_SEN_MI2S_EBIT 0x10E
  9368. /* Clock ID for INT0 I2S IBIT */
  9369. #define Q6AFE_LPASS_CLK_ID_INT0_MI2S_IBIT 0x10F
  9370. /* Clock ID for INT1 I2S IBIT */
  9371. #define Q6AFE_LPASS_CLK_ID_INT1_MI2S_IBIT 0x110
  9372. /* Clock ID for INT2 I2S IBIT */
  9373. #define Q6AFE_LPASS_CLK_ID_INT2_MI2S_IBIT 0x111
  9374. /* Clock ID for INT3 I2S IBIT */
  9375. #define Q6AFE_LPASS_CLK_ID_INT3_MI2S_IBIT 0x112
  9376. /* Clock ID for INT4 I2S IBIT */
  9377. #define Q6AFE_LPASS_CLK_ID_INT4_MI2S_IBIT 0x113
  9378. /* Clock ID for INT5 I2S IBIT */
  9379. #define Q6AFE_LPASS_CLK_ID_INT5_MI2S_IBIT 0x114
  9380. /* Clock ID for INT6 I2S IBIT */
  9381. #define Q6AFE_LPASS_CLK_ID_INT6_MI2S_IBIT 0x115
  9382. /* Clock ID for QUINARY MI2S OSR CLK */
  9383. #define Q6AFE_LPASS_CLK_ID_QUI_MI2S_OSR 0x116
  9384. /* Clock ID for Primary PCM IBIT */
  9385. #define Q6AFE_LPASS_CLK_ID_PRI_PCM_IBIT 0x200
  9386. /* Clock ID for Primary PCM EBIT */
  9387. #define Q6AFE_LPASS_CLK_ID_PRI_PCM_EBIT 0x201
  9388. /* Clock ID for Secondary PCM IBIT */
  9389. #define Q6AFE_LPASS_CLK_ID_SEC_PCM_IBIT 0x202
  9390. /* Clock ID for Secondary PCM EBIT */
  9391. #define Q6AFE_LPASS_CLK_ID_SEC_PCM_EBIT 0x203
  9392. /* Clock ID for Tertiary PCM IBIT */
  9393. #define Q6AFE_LPASS_CLK_ID_TER_PCM_IBIT 0x204
  9394. /* Clock ID for Tertiary PCM EBIT */
  9395. #define Q6AFE_LPASS_CLK_ID_TER_PCM_EBIT 0x205
  9396. /* Clock ID for Quartery PCM IBIT */
  9397. #define Q6AFE_LPASS_CLK_ID_QUAD_PCM_IBIT 0x206
  9398. /* Clock ID for Quartery PCM EBIT */
  9399. #define Q6AFE_LPASS_CLK_ID_QUAD_PCM_EBIT 0x207
  9400. /* Clock ID for Quinary PCM IBIT */
  9401. #define Q6AFE_LPASS_CLK_ID_QUIN_PCM_IBIT 0x208
  9402. /* Clock ID for Quinary PCM EBIT */
  9403. #define Q6AFE_LPASS_CLK_ID_QUIN_PCM_EBIT 0x209
  9404. /* Clock ID for QUINARY PCM OSR */
  9405. #define Q6AFE_LPASS_CLK_ID_QUI_PCM_OSR 0x20A
  9406. /* Clock ID for Senary PCM IBIT */
  9407. #define Q6AFE_LPASS_CLK_ID_SEN_PCM_IBIT 0x20B
  9408. /* Clock ID for Senary PCM EBIT */
  9409. #define Q6AFE_LPASS_CLK_ID_SEN_PCM_EBIT 0x20C
  9410. /** Clock ID for Primary TDM IBIT */
  9411. #define Q6AFE_LPASS_CLK_ID_PRI_TDM_IBIT 0x200
  9412. /** Clock ID for Primary TDM EBIT */
  9413. #define Q6AFE_LPASS_CLK_ID_PRI_TDM_EBIT 0x201
  9414. /** Clock ID for Secondary TDM IBIT */
  9415. #define Q6AFE_LPASS_CLK_ID_SEC_TDM_IBIT 0x202
  9416. /** Clock ID for Secondary TDM EBIT */
  9417. #define Q6AFE_LPASS_CLK_ID_SEC_TDM_EBIT 0x203
  9418. /** Clock ID for Tertiary TDM IBIT */
  9419. #define Q6AFE_LPASS_CLK_ID_TER_TDM_IBIT 0x204
  9420. /** Clock ID for Tertiary TDM EBIT */
  9421. #define Q6AFE_LPASS_CLK_ID_TER_TDM_EBIT 0x205
  9422. /** Clock ID for Quartery TDM IBIT */
  9423. #define Q6AFE_LPASS_CLK_ID_QUAD_TDM_IBIT 0x206
  9424. /** Clock ID for Quartery TDM EBIT */
  9425. #define Q6AFE_LPASS_CLK_ID_QUAD_TDM_EBIT 0x207
  9426. /** Clock ID for Quinary TDM IBIT */
  9427. #define Q6AFE_LPASS_CLK_ID_QUIN_TDM_IBIT 0x208
  9428. /** Clock ID for Quinary TDM EBIT */
  9429. #define Q6AFE_LPASS_CLK_ID_QUIN_TDM_EBIT 0x209
  9430. /** Clock ID for Quinary TDM OSR */
  9431. #define Q6AFE_LPASS_CLK_ID_QUIN_TDM_OSR 0x20A
  9432. /* Clock ID for MCLK1 */
  9433. #define Q6AFE_LPASS_CLK_ID_MCLK_1 0x300
  9434. /* Clock ID for MCLK2 */
  9435. #define Q6AFE_LPASS_CLK_ID_MCLK_2 0x301
  9436. /* Clock ID for MCLK3 */
  9437. #define Q6AFE_LPASS_CLK_ID_MCLK_3 0x302
  9438. /* Clock ID for MCLK4 */
  9439. #define Q6AFE_LPASS_CLK_ID_MCLK_4 0x304
  9440. /* Clock ID for Internal Digital Codec Core */
  9441. #define Q6AFE_LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE 0x303
  9442. /* Clock ID for INT MCLK0 */
  9443. #define Q6AFE_LPASS_CLK_ID_INT_MCLK_0 0x305
  9444. /* Clock ID for INT MCLK1 */
  9445. #define Q6AFE_LPASS_CLK_ID_INT_MCLK_1 0x306
  9446. /*
  9447. * Clock ID for soundwire NPL.
  9448. * This is the clock to be used to enable NPL clock for internal Soundwire.
  9449. */
  9450. #define AFE_CLOCK_SET_CLOCK_ID_SWR_NPL_CLK 0x307
  9451. /* Clock ID for MCLK5 */
  9452. #define Q6AFE_LPASS_CLK_ID_MCLK_5 0x308
  9453. /* Clock ID for AHB HDMI input */
  9454. #define Q6AFE_LPASS_CLK_ID_AHB_HDMI_INPUT 0x400
  9455. /* Clock ID for the primary SPDIF output core. */
  9456. #define AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_OUTPUT_CORE 0x500
  9457. /* Clock ID for the secondary SPDIF output core. */
  9458. #define AFE_CLOCK_SET_CLOCK_ID_SEC_SPDIF_OUTPUT_CORE 0x501
  9459. /* Clock ID for the primary SPDIF input core. */
  9460. #define AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_INPUT_CORE 0x502
  9461. /* Clock ID for the secondary SPDIF input core. */
  9462. #define AFE_CLOCK_SET_CLOCK_ID_SEC_SPDIF_INPUT_CORE 0x503
  9463. /* Clock ID for the secondary SPDIF output NPL clk. */
  9464. #define AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_OUTPUT_NPL 0x504
  9465. /* Clock ID for the primary SPDIF output NPL clk. */
  9466. #define AFE_CLOCK_SET_CLOCK_ID_SEC_SPDIF_OUTPUT_NPL 0x505
  9467. /* Clock attribute for invalid use (reserved for internal usage) */
  9468. #define Q6AFE_LPASS_CLK_ATTRIBUTE_INVALID 0x0
  9469. /* Clock attribute for no couple case */
  9470. #define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO 0x1
  9471. /* Clock attribute for dividend couple case */
  9472. #define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVIDEND 0x2
  9473. /* Clock attribute for divisor couple case */
  9474. #define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR 0x3
  9475. /* Clock attribute for invert and no couple case */
  9476. #define Q6AFE_LPASS_CLK_ATTRIBUTE_INVERT_COUPLE_NO 0x4
  9477. /* Clock set API version */
  9478. #define Q6AFE_LPASS_CLK_CONFIG_API_VERSION 0x1
  9479. struct afe_clk_set {
  9480. /*
  9481. * Minor version used for tracking clock set.
  9482. * @values #AFE_API_VERSION_CLOCK_SET
  9483. */
  9484. uint32_t clk_set_minor_version;
  9485. /*
  9486. * Clock ID
  9487. * @values
  9488. * - 0x100 to 0x10A - MSM8996
  9489. * - 0x200 to 0x207 - MSM8996
  9490. * - 0x300 to 0x302 - MSM8996 @tablebulletend
  9491. */
  9492. uint32_t clk_id;
  9493. /*
  9494. * Clock frequency (in Hertz) to be set.
  9495. * @values
  9496. * - >= 0 for clock frequency to set @tablebulletend
  9497. */
  9498. uint32_t clk_freq_in_hz;
  9499. /* Use to specific divider for two clocks if needed.
  9500. * Set to Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO for no divider
  9501. * relation clocks
  9502. * @values
  9503. * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO
  9504. * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVIDEND
  9505. * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR @tablebulletend
  9506. */
  9507. uint16_t clk_attri;
  9508. /*
  9509. * Specifies the root clock source.
  9510. * Currently, only Q6AFE_LPASS_CLK_ROOT_DEFAULT is valid
  9511. * @values
  9512. * - 0 @tablebulletend
  9513. */
  9514. uint16_t clk_root;
  9515. /*
  9516. * for enable and disable clock.
  9517. * "clk_freq_in_hz", "clk_attri", and "clk_root"
  9518. * are ignored in disable clock case.
  9519. * @values 
  9520. * - 0 -- Disabled
  9521. * - 1 -- Enabled @tablebulletend
  9522. */
  9523. uint32_t enable;
  9524. };
  9525. struct afe_clk_cfg {
  9526. /* Minor version used for tracking the version of the I2S
  9527. * configuration interface.
  9528. * Supported values: #AFE_API_VERSION_I2S_CONFIG
  9529. */
  9530. u32 i2s_cfg_minor_version;
  9531. /* clk value 1 in MHz. */
  9532. u32 clk_val1;
  9533. /* clk value 2 in MHz. */
  9534. u32 clk_val2;
  9535. /* clk_src
  9536. * #Q6AFE_LPASS_CLK_SRC_EXTERNAL
  9537. * #Q6AFE_LPASS_CLK_SRC_INTERNAL
  9538. */
  9539. u16 clk_src;
  9540. /* clk_root -0 for default */
  9541. u16 clk_root;
  9542. /* clk_set_mode
  9543. * #Q6AFE_LPASS_MODE_BOTH_INVALID
  9544. * #Q6AFE_LPASS_MODE_CLK1_VALID
  9545. * #Q6AFE_LPASS_MODE_CLK2_VALID
  9546. * #Q6AFE_LPASS_MODE_BOTH_VALID
  9547. */
  9548. u16 clk_set_mode;
  9549. /* This param id is used to configure I2S clk */
  9550. u16 reserved;
  9551. } __packed;
  9552. /* This param id is used to configure I2S clk */
  9553. #define AFE_PARAM_ID_LPAIF_CLK_CONFIG 0x00010238
  9554. #define AFE_MODULE_CLOCK_SET 0x0001028F
  9555. #define AFE_PARAM_ID_CLOCK_SET 0x00010290
  9556. enum afe_lpass_digital_clk_src {
  9557. Q6AFE_LPASS_DIGITAL_ROOT_INVALID,
  9558. Q6AFE_LPASS_DIGITAL_ROOT_PRI_MI2S_OSR,
  9559. Q6AFE_LPASS_DIGITAL_ROOT_SEC_MI2S_OSR,
  9560. Q6AFE_LPASS_DIGITAL_ROOT_TER_MI2S_OSR,
  9561. Q6AFE_LPASS_DIGITAL_ROOT_QUAD_MI2S_OSR,
  9562. Q6AFE_LPASS_DIGITAL_ROOT_CDC_ROOT_CLK,
  9563. } __packed;
  9564. /* This param id is used to configure internal clk */
  9565. #define AFE_PARAM_ID_INTERNAL_DIGIATL_CDC_CLK_CONFIG 0x00010239
  9566. struct afe_digital_clk_cfg {
  9567. /* Minor version used for tracking the version of the I2S
  9568. * configuration interface.
  9569. * Supported values: #AFE_API_VERSION_I2S_CONFIG
  9570. */
  9571. u32 i2s_cfg_minor_version;
  9572. /* clk value in MHz. */
  9573. u32 clk_val;
  9574. /* INVALID
  9575. * PRI_MI2S_OSR
  9576. * SEC_MI2S_OSR
  9577. * TER_MI2S_OSR
  9578. * QUAD_MI2S_OSR
  9579. * DIGT_CDC_ROOT
  9580. */
  9581. u16 clk_root;
  9582. /* This field must be set to zero. */
  9583. u16 reserved;
  9584. } __packed;
  9585. /*
  9586. * Opcode for AFE to start DTMF.
  9587. */
  9588. #define AFE_PORTS_CMD_DTMF_CTL 0x00010102
  9589. /** DTMF payload.*/
  9590. struct afe_dtmf_generation_command {
  9591. struct apr_hdr hdr;
  9592. /*
  9593. * Duration of the DTMF tone in ms.
  9594. * -1 -> continuous,
  9595. * 0 -> disable
  9596. */
  9597. int64_t duration_in_ms;
  9598. /*
  9599. * The DTMF high tone frequency.
  9600. */
  9601. uint16_t high_freq;
  9602. /*
  9603. * The DTMF low tone frequency.
  9604. */
  9605. uint16_t low_freq;
  9606. /*
  9607. * The DTMF volume setting
  9608. */
  9609. uint16_t gain;
  9610. /*
  9611. * The number of ports to enable/disable on.
  9612. */
  9613. uint16_t num_ports;
  9614. /*
  9615. * The Destination ports - array .
  9616. * For DTMF on multiple ports, portIds needs to
  9617. * be populated numPorts times.
  9618. */
  9619. uint16_t port_ids;
  9620. /*
  9621. * variable for 32 bit alignment of APR packet.
  9622. */
  9623. uint16_t reserved;
  9624. } __packed;
  9625. enum afe_config_type {
  9626. AFE_SLIMBUS_SLAVE_PORT_CONFIG,
  9627. AFE_SLIMBUS_SLAVE_CONFIG,
  9628. AFE_CDC_REGISTERS_CONFIG,
  9629. AFE_AANC_VERSION,
  9630. AFE_CDC_CLIP_REGISTERS_CONFIG,
  9631. AFE_CLIP_BANK_SEL,
  9632. AFE_CDC_REGISTER_PAGE_CONFIG,
  9633. AFE_MAX_CONFIG_TYPES,
  9634. };
  9635. struct afe_param_slimbus_slave_port_cfg {
  9636. uint32_t minor_version;
  9637. uint16_t slimbus_dev_id;
  9638. uint16_t slave_dev_pgd_la;
  9639. uint16_t slave_dev_intfdev_la;
  9640. uint16_t bit_width;
  9641. uint16_t data_format;
  9642. uint16_t num_channels;
  9643. uint16_t slave_port_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT];
  9644. } __packed;
  9645. struct afe_param_cdc_slimbus_slave_cfg {
  9646. uint32_t minor_version;
  9647. uint32_t device_enum_addr_lsw;
  9648. uint32_t device_enum_addr_msw;
  9649. uint16_t tx_slave_port_offset;
  9650. uint16_t rx_slave_port_offset;
  9651. } __packed;
  9652. struct afe_param_cdc_reg_cfg {
  9653. uint32_t minor_version;
  9654. uint32_t reg_logical_addr;
  9655. uint32_t reg_field_type;
  9656. uint32_t reg_field_bit_mask;
  9657. uint16_t reg_bit_width;
  9658. uint16_t reg_offset_scale;
  9659. } __packed;
  9660. #define AFE_API_VERSION_CDC_REG_PAGE_CFG 1
  9661. enum {
  9662. AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_0 = 0,
  9663. AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_1,
  9664. AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_2,
  9665. AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_3,
  9666. };
  9667. struct afe_param_cdc_reg_page_cfg {
  9668. uint32_t minor_version;
  9669. uint32_t enable;
  9670. uint32_t proc_id;
  9671. } __packed;
  9672. struct afe_param_cdc_reg_cfg_data {
  9673. uint32_t num_registers;
  9674. struct afe_param_cdc_reg_cfg *reg_data;
  9675. } __packed;
  9676. struct afe_svc_cmd_set_param_v1 {
  9677. /* APR Header */
  9678. struct apr_hdr apr_hdr;
  9679. /* The total size of the payload, including param_hdr_v3 */
  9680. uint32_t payload_size;
  9681. /* The memory mapping header to be used when sending outband */
  9682. struct mem_mapping_hdr mem_hdr;
  9683. /* The parameter data to be filled when sent inband */
  9684. u32 param_data[0];
  9685. } __packed;
  9686. struct afe_svc_cmd_set_param_v2 {
  9687. /* APR Header */
  9688. struct apr_hdr apr_hdr;
  9689. /* The memory mapping header to be used when sending outband */
  9690. struct mem_mapping_hdr mem_hdr;
  9691. /* The total size of the payload, including param_hdr_v3 */
  9692. u32 payload_size;
  9693. /* The parameter data to be filled when sent inband */
  9694. u32 param_data[0];
  9695. } __packed;
  9696. struct afe_param_hw_mad_ctrl {
  9697. uint32_t minor_version;
  9698. uint16_t mad_type;
  9699. uint16_t mad_enable;
  9700. } __packed;
  9701. struct afe_port_cmd_set_aanc_acdb_table {
  9702. struct apr_hdr hdr;
  9703. struct mem_mapping_hdr mem_hdr;
  9704. } __packed;
  9705. /* Dolby DAP topology */
  9706. #define DOLBY_ADM_COPP_TOPOLOGY_ID 0x0001033B
  9707. #define DS2_ADM_COPP_TOPOLOGY_ID 0x1301033B
  9708. /* RMS value from DSP */
  9709. #define RMS_MODULEID_APPI_PASSTHRU 0x10009011
  9710. #define RMS_PARAM_FIRST_SAMPLE 0x10009012
  9711. #define RMS_PAYLOAD_LEN 4
  9712. /* Customized mixing in matix mixer */
  9713. #define MTMX_MODULE_ID_DEFAULT_CHMIXER 0x00010341
  9714. #define DEFAULT_CHMIXER_PARAM_ID_COEFF 0x00010342
  9715. #define CUSTOM_STEREO_PAYLOAD_SIZE 9
  9716. #define CUSTOM_STEREO_CMD_PARAM_SIZE 24
  9717. #define CUSTOM_STEREO_NUM_OUT_CH 0x0002
  9718. #define CUSTOM_STEREO_NUM_IN_CH 0x0002
  9719. #define CUSTOM_STEREO_INDEX_PARAM 0x0002
  9720. #define Q14_GAIN_ZERO_POINT_FIVE 0x2000
  9721. #define Q14_GAIN_UNITY 0x4000
  9722. /* Ultrasound supported formats */
  9723. #define US_POINT_EPOS_FORMAT_V2 0x0001272D
  9724. #define US_RAW_FORMAT_V2 0x0001272C
  9725. #define US_PROX_FORMAT_V4 0x0001273B
  9726. #define US_RAW_SYNC_FORMAT 0x0001272F
  9727. #define US_GES_SYNC_FORMAT 0x00012730
  9728. #define AFE_MODULE_GROUP_DEVICE 0x00010254
  9729. #define AFE_PARAM_ID_GROUP_DEVICE_CFG 0x00010255
  9730. #define AFE_PARAM_ID_GROUP_DEVICE_ENABLE 0x00010256
  9731. #define AFE_GROUP_DEVICE_ID_SECONDARY_MI2S_RX 0x1102
  9732. /* Payload of the #AFE_PARAM_ID_GROUP_DEVICE_CFG
  9733. * parameter, which configures max of 8 AFE ports
  9734. * into a group.
  9735. * The fixed size of this structure is sixteen bytes.
  9736. */
  9737. struct afe_group_device_group_cfg {
  9738. u32 minor_version;
  9739. u16 group_id;
  9740. u16 num_channels;
  9741. u16 port_id[8];
  9742. } __packed;
  9743. #define AFE_GROUP_DEVICE_ID_PRIMARY_TDM_RX \
  9744. (AFE_PORT_ID_PRIMARY_TDM_RX + 0x100)
  9745. #define AFE_GROUP_DEVICE_ID_PRIMARY_TDM_TX \
  9746. (AFE_PORT_ID_PRIMARY_TDM_TX + 0x100)
  9747. #define AFE_GROUP_DEVICE_ID_SECONDARY_TDM_RX \
  9748. (AFE_PORT_ID_SECONDARY_TDM_RX + 0x100)
  9749. #define AFE_GROUP_DEVICE_ID_SECONDARY_TDM_TX \
  9750. (AFE_PORT_ID_SECONDARY_TDM_TX + 0x100)
  9751. #define AFE_GROUP_DEVICE_ID_TERTIARY_TDM_RX \
  9752. (AFE_PORT_ID_TERTIARY_TDM_RX + 0x100)
  9753. #define AFE_GROUP_DEVICE_ID_TERTIARY_TDM_TX \
  9754. (AFE_PORT_ID_TERTIARY_TDM_TX + 0x100)
  9755. #define AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_RX \
  9756. (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x100)
  9757. #define AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_TX \
  9758. (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x100)
  9759. #define AFE_GROUP_DEVICE_ID_QUINARY_TDM_RX \
  9760. (AFE_PORT_ID_QUINARY_TDM_RX + 0x100)
  9761. #define AFE_GROUP_DEVICE_ID_QUINARY_TDM_TX \
  9762. (AFE_PORT_ID_QUINARY_TDM_TX + 0x100)
  9763. /* ID of the parameter used by #AFE_MODULE_GROUP_DEVICE to configure the
  9764. * group device. #AFE_SVC_CMD_SET_PARAM can use this parameter ID.
  9765. *
  9766. * Requirements:
  9767. * - Configure the group before the member ports in the group are
  9768. * configured and started.
  9769. * - Enable the group only after it is configured.
  9770. * - Stop all member ports in the group before disabling the group.
  9771. */
  9772. #define AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG 0x0001029E
  9773. /* Version information used to handle future additions to
  9774. * AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG processing (for backward compatibility).
  9775. */
  9776. #define AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG 0x1
  9777. /* Number of AFE ports in group device */
  9778. #define AFE_GROUP_DEVICE_NUM_PORTS 8
  9779. /* Payload of the AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG parameter ID
  9780. * used by AFE_MODULE_GROUP_DEVICE.
  9781. */
  9782. struct afe_param_id_group_device_tdm_cfg {
  9783. u32 group_device_cfg_minor_version;
  9784. /* Minor version used to track group device configuration.
  9785. * @values #AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG
  9786. */
  9787. u16 group_id;
  9788. /* ID for the group device.
  9789. * @values
  9790. * - #AFE_GROUP_DEVICE_ID_PRIMARY_TDM_RX
  9791. * - #AFE_GROUP_DEVICE_ID_PRIMARY_TDM_TX
  9792. * - #AFE_GROUP_DEVICE_ID_SECONDARY_TDM_RX
  9793. * - #AFE_GROUP_DEVICE_ID_SECONDARY_TDM_TX
  9794. * - #AFE_GROUP_DEVICE_ID_TERTIARY_TDM_RX
  9795. * - #AFE_GROUP_DEVICE_ID_TERTIARY_TDM_TX
  9796. * - #AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_RX
  9797. * - #AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_TX
  9798. */
  9799. u16 reserved;
  9800. /* 0 */
  9801. u16 port_id[AFE_GROUP_DEVICE_NUM_PORTS];
  9802. /* Array of member port IDs of this group.
  9803. * @values
  9804. * - #AFE_PORT_ID_PRIMARY_TDM_RX
  9805. * - #AFE_PORT_ID_PRIMARY_TDM_RX_1
  9806. * - #AFE_PORT_ID_PRIMARY_TDM_RX_2
  9807. * - #AFE_PORT_ID_PRIMARY_TDM_RX_3
  9808. * - #AFE_PORT_ID_PRIMARY_TDM_RX_4
  9809. * - #AFE_PORT_ID_PRIMARY_TDM_RX_5
  9810. * - #AFE_PORT_ID_PRIMARY_TDM_RX_6
  9811. * - #AFE_PORT_ID_PRIMARY_TDM_RX_7
  9812. * - #AFE_PORT_ID_PRIMARY_TDM_TX
  9813. * - #AFE_PORT_ID_PRIMARY_TDM_TX_1
  9814. * - #AFE_PORT_ID_PRIMARY_TDM_TX_2
  9815. * - #AFE_PORT_ID_PRIMARY_TDM_TX_3
  9816. * - #AFE_PORT_ID_PRIMARY_TDM_TX_4
  9817. * - #AFE_PORT_ID_PRIMARY_TDM_TX_5
  9818. * - #AFE_PORT_ID_PRIMARY_TDM_TX_6
  9819. * - #AFE_PORT_ID_PRIMARY_TDM_TX_7
  9820. * - #AFE_PORT_ID_SECONDARY_TDM_RX
  9821. * - #AFE_PORT_ID_SECONDARY_TDM_RX_1
  9822. * - #AFE_PORT_ID_SECONDARY_TDM_RX_2
  9823. * - #AFE_PORT_ID_SECONDARY_TDM_RX_3
  9824. * - #AFE_PORT_ID_SECONDARY_TDM_RX_4
  9825. * - #AFE_PORT_ID_SECONDARY_TDM_RX_5
  9826. * - #AFE_PORT_ID_SECONDARY_TDM_RX_6
  9827. * - #AFE_PORT_ID_SECONDARY_TDM_RX_7
  9828. * - #AFE_PORT_ID_SECONDARY_TDM_TX
  9829. * - #AFE_PORT_ID_SECONDARY_TDM_TX_1
  9830. * - #AFE_PORT_ID_SECONDARY_TDM_TX_2
  9831. * - #AFE_PORT_ID_SECONDARY_TDM_TX_3
  9832. * - #AFE_PORT_ID_SECONDARY_TDM_TX_4
  9833. * - #AFE_PORT_ID_SECONDARY_TDM_TX_5
  9834. * - #AFE_PORT_ID_SECONDARY_TDM_TX_6
  9835. * - #AFE_PORT_ID_SECONDARY_TDM_TX_7
  9836. * - #AFE_PORT_ID_TERTIARY_TDM_RX
  9837. * - #AFE_PORT_ID_TERTIARY_TDM_RX_1
  9838. * - #AFE_PORT_ID_TERTIARY_TDM_RX_2
  9839. * - #AFE_PORT_ID_TERTIARY_TDM_RX_3
  9840. * - #AFE_PORT_ID_TERTIARY_TDM_RX_4
  9841. * - #AFE_PORT_ID_TERTIARY_TDM_RX_5
  9842. * - #AFE_PORT_ID_TERTIARY_TDM_RX_6
  9843. * - #AFE_PORT_ID_TERTIARY_TDM_RX_7
  9844. * - #AFE_PORT_ID_TERTIARY_TDM_TX
  9845. * - #AFE_PORT_ID_TERTIARY_TDM_TX_1
  9846. * - #AFE_PORT_ID_TERTIARY_TDM_TX_2
  9847. * - #AFE_PORT_ID_TERTIARY_TDM_TX_3
  9848. * - #AFE_PORT_ID_TERTIARY_TDM_TX_4
  9849. * - #AFE_PORT_ID_TERTIARY_TDM_TX_5
  9850. * - #AFE_PORT_ID_TERTIARY_TDM_TX_6
  9851. * - #AFE_PORT_ID_TERTIARY_TDM_TX_7
  9852. * - #AFE_PORT_ID_QUATERNARY_TDM_RX
  9853. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_1
  9854. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_2
  9855. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_3
  9856. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_4
  9857. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_5
  9858. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_6
  9859. * - #AFE_PORT_ID_QUATERNARY_TDM_RX_7
  9860. * - #AFE_PORT_ID_QUATERNARY_TDM_TX
  9861. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_1
  9862. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_2
  9863. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_3
  9864. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_4
  9865. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_5
  9866. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_6
  9867. * - #AFE_PORT_ID_QUATERNARY_TDM_TX_7
  9868. * @tablebulletend
  9869. */
  9870. u32 num_channels;
  9871. /* Number of enabled slots for TDM frame.
  9872. * @values 1 to 8
  9873. */
  9874. u32 sample_rate;
  9875. /* Sampling rate of the port.
  9876. * @values
  9877. * - #AFE_PORT_SAMPLE_RATE_8K
  9878. * - #AFE_PORT_SAMPLE_RATE_16K
  9879. * - #AFE_PORT_SAMPLE_RATE_24K
  9880. * - #AFE_PORT_SAMPLE_RATE_32K
  9881. * - #AFE_PORT_SAMPLE_RATE_48K @tablebulletend
  9882. */
  9883. u32 bit_width;
  9884. /* Bit width of the sample.
  9885. * @values 16, 24, (32)
  9886. */
  9887. u16 nslots_per_frame;
  9888. /* Number of slots per frame. Typical : 1, 2, 4, 8, 16, 32.
  9889. * @values 1 - 32
  9890. */
  9891. u16 slot_width;
  9892. /* Slot width of the slot in a TDM frame. (slot_width >= bit_width)
  9893. * have to be satisfied.
  9894. * @values 16, 24, 32
  9895. */
  9896. u32 slot_mask;
  9897. /* Position of active slots. When that bit is set, that paricular
  9898. * slot is active.
  9899. * Number of active slots can be inferred by number of bits set in
  9900. * the mask. Only 8 individual bits can be enabled.
  9901. * Bits 0..31 corresponding to slot 0..31
  9902. * @values 1 to 2^32 -1
  9903. */
  9904. } __packed;
  9905. /* Payload of the #AFE_PARAM_ID_GROUP_DEVICE_ENABLE
  9906. * parameter, which enables or
  9907. * disables any module.
  9908. * The fixed size of this structure is four bytes.
  9909. */
  9910. struct afe_group_device_enable {
  9911. u16 group_id;
  9912. /* valid value is AFE_GROUP_DEVICE_ID_SECONDARY_MI2S_RX */
  9913. u16 enable;
  9914. /* Enables (1) or disables (0) the module. */
  9915. } __packed;
  9916. union afe_port_group_config {
  9917. struct afe_group_device_group_cfg group_cfg;
  9918. struct afe_group_device_enable group_enable;
  9919. struct afe_param_id_group_device_tdm_cfg tdm_cfg;
  9920. } __packed;
  9921. /* ID of the parameter used by #AFE_MODULE_AUDIO_DEV_INTERFACE to specify
  9922. * the timing statistics of the corresponding device interface.
  9923. * Client can periodically query for the device time statistics to help adjust
  9924. * the PLL based on the drift value. The get param command must be sent to
  9925. * AFE port ID corresponding to device interface
  9926. * This parameter ID supports following get param commands:
  9927. * #AFE_PORT_CMD_GET_PARAM_V2 and
  9928. * #AFE_PORT_CMD_GET_PARAM_V3.
  9929. */
  9930. #define AFE_PARAM_ID_DEV_TIMING_STATS 0x000102AD
  9931. /* Version information used to handle future additions to AFE device
  9932. * interface timing statistics (for backward compatibility).
  9933. */
  9934. #define AFE_API_VERSION_DEV_TIMING_STATS 0x1
  9935. /* Enumeration for specifying a sink(Rx) device */
  9936. #define AFE_SINK_DEVICE 0x0
  9937. /* Enumeration for specifying a source(Tx) device */
  9938. #define AFE_SOURCE_DEVICE 0x1
  9939. /* Enumeration for specifying the drift reference is of type AV Timer */
  9940. #define AFE_REF_TIMER_TYPE_AVTIMER 0x0
  9941. /* Message payload structure for the
  9942. * AFE_PARAM_ID_DEV_TIMING_STATS parameter.
  9943. */
  9944. struct afe_param_id_dev_timing_stats {
  9945. /* Minor version used to track the version of device interface timing
  9946. * statistics. Currently, the supported version is 1.
  9947. * @values #AFE_API_VERSION_DEV_TIMING_STATS
  9948. */
  9949. u32 minor_version;
  9950. /* Indicates the device interface direction as either
  9951. * source (Tx) or sink (Rx).
  9952. * @values
  9953. * #AFE_SINK_DEVICE
  9954. * #AFE_SOURCE_DEVICE
  9955. */
  9956. u16 device_direction;
  9957. /* Reference timer for drift accumulation and time stamp information.
  9958. * @values
  9959. * #AFE_REF_TIMER_TYPE_AVTIMER @tablebulletend
  9960. */
  9961. u16 reference_timer;
  9962. /*
  9963. * Flag to indicate if resync is required on the client side for
  9964. * drift correction. Flag is set to TRUE for the first get_param
  9965. * response after device interface starts. This flag value can be
  9966. * used by client to identify if device interface restart has
  9967. * happened and if any re-sync is required at their end for drift
  9968. * correction.
  9969. * @values
  9970. * 0: FALSE (Resync not required)
  9971. * 1: TRUE (Resync required) @tablebulletend
  9972. */
  9973. u32 resync_flag;
  9974. /* Accumulated drift value in microseconds. This value is updated
  9975. * every 100th ms.
  9976. * Positive drift value indicates AV timer is running faster than device
  9977. * Negative drift value indicates AV timer is running slower than device
  9978. * @values Any valid int32 number
  9979. */
  9980. s32 acc_drift_value;
  9981. /* Lower 32 bits of the 64-bit absolute timestamp of reference
  9982. * timer in microseconds.
  9983. * This timestamp corresponds to the time when the drift values
  9984. * are accumlated for every 100th ms.
  9985. * @values Any valid uint32 number
  9986. */
  9987. u32 ref_timer_abs_ts_lsw;
  9988. /* Upper 32 bits of the 64-bit absolute timestamp of reference
  9989. * timer in microseconds.
  9990. * This timestamp corresponds to the time when the drift values
  9991. * are accumlated for every 100th ms.
  9992. * @values Any valid uint32 number
  9993. */
  9994. u32 ref_timer_abs_ts_msw;
  9995. } __packed;
  9996. struct afe_av_dev_drift_get_param_resp {
  9997. uint32_t status;
  9998. struct param_hdr_v3 pdata;
  9999. struct afe_param_id_dev_timing_stats timing_stats;
  10000. } __packed;
  10001. /* Command for Matrix or Stream Router */
  10002. #define ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2 0x00010DCE
  10003. /* Module for AVSYNC */
  10004. #define ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC 0x00010DC6
  10005. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to specify the
  10006. * render window start value. This parameter is supported only for a Set
  10007. * command (not a Get command) in the Rx direction
  10008. * (#ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2).
  10009. * Render window start is a value (session time minus timestamp, or ST-TS)
  10010. * below which frames are held, and after which frames are immediately
  10011. * rendered.
  10012. */
  10013. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_START_V2 0x00010DD1
  10014. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to specify the
  10015. * render window end value. This parameter is supported only for a Set
  10016. * command (not a Get command) in the Rx direction
  10017. * (#ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2). Render window end is a value
  10018. * (session time minus timestamp) above which frames are dropped, and below
  10019. * which frames are immediately rendered.
  10020. */
  10021. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_END_V2 0x00010DD2
  10022. /* Generic payload of the window parameters in the
  10023. * #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC module.
  10024. * This payload is supported only for a Set command
  10025. * (not a Get command) on the Rx path.
  10026. */
  10027. struct asm_session_mtmx_strtr_param_window_v2_t {
  10028. u32 window_lsw;
  10029. /* Lower 32 bits of the render window start value. */
  10030. u32 window_msw;
  10031. /* Upper 32 bits of the render window start value.
  10032. *
  10033. * The 64-bit number formed by window_lsw and window_msw specifies a
  10034. * signed 64-bit window value in microseconds. The sign extension is
  10035. * necessary. This value is used by the following parameter IDs:
  10036. * #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_START_V2
  10037. * #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_END_V2
  10038. * #ASM_SESSION_MTMX_STRTR_PARAM_STAT_WINDOW_START_V2
  10039. * #ASM_SESSION_MTMX_STRTR_PARAM_STAT_WINDOW_END_V2
  10040. * The value depends on which parameter ID is used.
  10041. * The aDSP honors the windows at a granularity of 1 ms.
  10042. */
  10043. };
  10044. struct asm_session_cmd_set_mtmx_strstr_params_v2 {
  10045. uint32_t data_payload_addr_lsw;
  10046. /* Lower 32 bits of the 64-bit data payload address. */
  10047. uint32_t data_payload_addr_msw;
  10048. /* Upper 32 bits of the 64-bit data payload address.
  10049. * If the address is not sent (NULL), the message is in the payload.
  10050. * If the address is sent (non-NULL), the parameter data payloads
  10051. * begin at the specified address.
  10052. */
  10053. uint32_t mem_map_handle;
  10054. /* Unique identifier for an address. This memory map handle is returned
  10055. * by the aDSP through the #ASM_CMD_SHARED_MEM_MAP_REGIONS command.
  10056. * values
  10057. * - NULL -- Parameter data payloads are within the message payload
  10058. * (in-band).
  10059. * - Non-NULL -- Parameter data payloads begin at the address specified
  10060. * in the data_payload_addr_lsw and data_payload_addr_msw fields
  10061. * (out-of-band).
  10062. */
  10063. uint32_t data_payload_size;
  10064. /* Actual size of the variable payload accompanying the message, or in
  10065. * shared memory. This field is used for parsing the parameter payload.
  10066. * values > 0 bytes
  10067. */
  10068. uint32_t direction;
  10069. /* Direction of the entity (matrix mixer or stream router) on which
  10070. * the parameter is to be set.
  10071. * values
  10072. * - 0 -- Rx (for Rx stream router or Rx matrix mixer)
  10073. * - 1 -- Tx (for Tx stream router or Tx matrix mixer)
  10074. */
  10075. };
  10076. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC which allows the
  10077. * audio client choose the rendering decision that the audio DSP should use.
  10078. */
  10079. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_MODE_CMD 0x00012F0D
  10080. /* Indicates that rendering decision will be based on default rate
  10081. * (session clock based rendering, device driven).
  10082. * 1. The default session clock based rendering is inherently driven
  10083. * by the timing of the device.
  10084. * 2. After the initial decision is made (first buffer after a run
  10085. * command), subsequent data rendering decisions are made with
  10086. * respect to the rate at which the device is rendering, thus deriving
  10087. * its timing from the device.
  10088. * 3. While this decision making is simple, it has some inherent limitations
  10089. * (mentioned in the next section).
  10090. * 4. If this API is not set, the session clock based rendering will be assumed
  10091. * and this will ensure that the DSP is backward compatible.
  10092. */
  10093. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_DEFAULT 0
  10094. /* Indicates that rendering decision will be based on local clock rate.
  10095. * 1. In the DSP loopback/client loopback use cases (frame based
  10096. * inputs), the incoming data into audio DSP is time-stamped at the
  10097. * local clock rate (STC).
  10098. * 2. This TS rate may match the incoming data rate or maybe different
  10099. * from the incoming data rate.
  10100. * 3. Regardless, the data will be time-stamped with local STC and
  10101. * therefore, the client is recommended to set this mode for these
  10102. * use cases. This method is inherently more robust to sequencing
  10103. * (AFE Start/Stop) and device switches, among other benefits.
  10104. * 4. This API will inform the DSP to compare every incoming buffer TS
  10105. * against local STC.
  10106. * 5. DSP will continue to honor render windows APIs, as before.
  10107. */
  10108. #define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_LOCAL_STC 1
  10109. /* Structure for rendering decision parameter */
  10110. struct asm_session_mtmx_strtr_param_render_mode_t {
  10111. /* Specifies the type of rendering decision the audio DSP should use.
  10112. *
  10113. * @values
  10114. * - #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_DEFAULT
  10115. * - #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_LOCAL_STC
  10116. */
  10117. u32 flags;
  10118. } __packed;
  10119. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC which allows the
  10120. * audio client to specify the clock recovery mechanism that the audio DSP
  10121. * should use.
  10122. */
  10123. #define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_CMD 0x00012F0E
  10124. /* Indicates that default clock recovery will be used (no clock recovery).
  10125. * If the client wishes that no clock recovery be done, the client can
  10126. * choose this. This means that no attempt will made by the DSP to try and
  10127. * match the rates of the input and output audio.
  10128. */
  10129. #define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_NONE 0
  10130. /* Indicates that independent clock recovery needs to be used.
  10131. * 1. In the DSP loopback/client loopback use cases (frame based inputs),
  10132. * the client should choose the independent clock recovery option.
  10133. * 2. This basically de-couples the audio and video from knowing each others
  10134. * clock sources and lets the audio DSP independently rate match the input
  10135. * and output rates.
  10136. * 3. After drift detection, the drift correction is achieved by either pulling
  10137. * the PLLs (if applicable) or by stream to device rate matching
  10138. * (for PCM use cases) by comparing drift with respect to STC.
  10139. * 4. For passthrough use cases, since the PLL pulling is the only option,
  10140. * a best effort will be made.
  10141. * If PLL pulling is not possible / available, the rendering will be
  10142. * done without rate matching.
  10143. */
  10144. #define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_AUTO 1
  10145. /* Payload of the #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC parameter.
  10146. */
  10147. struct asm_session_mtmx_strtr_param_clk_rec_t {
  10148. /* Specifies the type of clock recovery that the audio DSP should
  10149. * use for rate matching.
  10150. */
  10151. /* @values
  10152. * #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_DEFAULT
  10153. * #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_INDEPENDENT
  10154. */
  10155. u32 flags;
  10156. } __packed;
  10157. /* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to
  10158. * realize smoother adjustment of audio session clock for a specified session.
  10159. * The desired audio session clock adjustment(in micro seconds) is specified
  10160. * using the command #ASM_SESSION_CMD_ADJUST_SESSION_CLOCK_V2.
  10161. * Delaying/Advancing the session clock would be implemented by inserting
  10162. * interpolated/dropping audio samples in the playback path respectively.
  10163. * Also, this parameter has to be configured before the Audio Session is put
  10164. * to RUN state to avoid cold start latency/glitches in the playback.
  10165. */
  10166. #define ASM_SESSION_MTMX_PARAM_ADJUST_SESSION_TIME_CTL 0x00013217
  10167. struct asm_session_mtmx_param_adjust_session_time_ctl_t {
  10168. /* Specifies whether the module is enabled or not
  10169. * @values
  10170. * 0 -- disabled
  10171. * 1 -- enabled
  10172. */
  10173. u32 enable;
  10174. };
  10175. union asm_session_mtmx_strtr_param_config {
  10176. struct asm_session_mtmx_strtr_param_window_v2_t window_param;
  10177. struct asm_session_mtmx_strtr_param_render_mode_t render_param;
  10178. struct asm_session_mtmx_strtr_param_clk_rec_t clk_rec_param;
  10179. struct asm_session_mtmx_param_adjust_session_time_ctl_t adj_time_param;
  10180. } __packed;
  10181. struct asm_mtmx_strtr_params {
  10182. struct apr_hdr hdr;
  10183. struct asm_session_cmd_set_mtmx_strstr_params_v2 param;
  10184. struct param_hdr_v1 data;
  10185. union asm_session_mtmx_strtr_param_config config;
  10186. } __packed;
  10187. #define ASM_SESSION_CMD_GET_MTMX_STRTR_PARAMS_V2 0x00010DCF
  10188. #define ASM_SESSION_CMDRSP_GET_MTMX_STRTR_PARAMS_V2 0x00010DD0
  10189. #define ASM_SESSION_MTMX_STRTR_PARAM_SESSION_TIME_V3 0x00012F0B
  10190. #define ASM_SESSION_MTMX_STRTR_PARAM_STIME_TSTMP_FLG_BMASK (0x80000000UL)
  10191. struct asm_session_cmd_get_mtmx_strstr_params_v2 {
  10192. uint32_t data_payload_addr_lsw;
  10193. /* Lower 32 bits of the 64-bit data payload address. */
  10194. uint32_t data_payload_addr_msw;
  10195. /*
  10196. * Upper 32 bits of the 64-bit data payload address.
  10197. * If the address is not sent (NULL), the message is in the payload.
  10198. * If the address is sent (non-NULL), the parameter data payloads
  10199. * begin at the specified address.
  10200. */
  10201. uint32_t mem_map_handle;
  10202. /*
  10203. * Unique identifier for an address. This memory map handle is returned
  10204. * by the aDSP through the #ASM_CMD_SHARED_MEM_MAP_REGIONS command.
  10205. * values
  10206. * - NULL -- Parameter data payloads are within the message payload
  10207. * (in-band).
  10208. * - Non-NULL -- Parameter data payloads begin at the address specified
  10209. * in the data_payload_addr_lsw and data_payload_addr_msw fields
  10210. * (out-of-band).
  10211. */
  10212. uint32_t direction;
  10213. /*
  10214. * Direction of the entity (matrix mixer or stream router) on which
  10215. * the parameter is to be set.
  10216. * values
  10217. * - 0 -- Rx (for Rx stream router or Rx matrix mixer)
  10218. * - 1 -- Tx (for Tx stream router or Tx matrix mixer)
  10219. */
  10220. uint32_t module_id;
  10221. /* Unique module ID. */
  10222. uint32_t param_id;
  10223. /* Unique parameter ID. */
  10224. uint32_t param_max_size;
  10225. };
  10226. struct asm_session_mtmx_strtr_param_session_time_v3_t {
  10227. uint32_t session_time_lsw;
  10228. /* Lower 32 bits of the current session time in microseconds */
  10229. uint32_t session_time_msw;
  10230. /*
  10231. * Upper 32 bits of the current session time in microseconds.
  10232. * The 64-bit number formed by session_time_lsw and session_time_msw
  10233. * is treated as signed.
  10234. */
  10235. uint32_t absolute_time_lsw;
  10236. /*
  10237. * Lower 32 bits of the 64-bit absolute time in microseconds.
  10238. * This is the time when the sample corresponding to the
  10239. * session_time_lsw is rendered to the hardware. This absolute
  10240. * time can be slightly in the future or past.
  10241. */
  10242. uint32_t absolute_time_msw;
  10243. /*
  10244. * Upper 32 bits of the 64-bit absolute time in microseconds.
  10245. * This is the time when the sample corresponding to the
  10246. * session_time_msw is rendered to hardware. This absolute
  10247. * time can be slightly in the future or past. The 64-bit number
  10248. * formed by absolute_time_lsw and absolute_time_msw is treated as
  10249. * unsigned.
  10250. */
  10251. uint32_t time_stamp_lsw;
  10252. /* Lower 32 bits of the last processed timestamp in microseconds */
  10253. uint32_t time_stamp_msw;
  10254. /*
  10255. * Upper 32 bits of the last processed timestamp in microseconds.
  10256. * The 64-bit number formed by time_stamp_lsw and time_stamp_lsw
  10257. * is treated as unsigned.
  10258. */
  10259. uint32_t flags;
  10260. /*
  10261. * Keeps track of any additional flags needed.
  10262. * @values{for bit 31}
  10263. * - 0 -- Uninitialized/invalid
  10264. * - 1 -- Valid
  10265. * All other bits are reserved; clients must set them to zero.
  10266. */
  10267. };
  10268. union asm_session_mtmx_strtr_data_type {
  10269. struct asm_session_mtmx_strtr_param_session_time_v3_t session_time;
  10270. };
  10271. struct asm_mtmx_strtr_get_params {
  10272. struct apr_hdr hdr;
  10273. struct asm_session_cmd_get_mtmx_strstr_params_v2 param_info;
  10274. } __packed;
  10275. struct asm_mtmx_strtr_get_params_cmdrsp {
  10276. uint32_t err_code;
  10277. struct param_hdr_v1 param_info;
  10278. union asm_session_mtmx_strtr_data_type param_data;
  10279. } __packed;
  10280. #define AUDPROC_MODULE_ID_RESAMPLER 0x00010719
  10281. enum {
  10282. LEGACY_PCM = 0,
  10283. COMPRESSED_PASSTHROUGH,
  10284. COMPRESSED_PASSTHROUGH_CONVERT,
  10285. COMPRESSED_PASSTHROUGH_DSD,
  10286. LISTEN,
  10287. COMPRESSED_PASSTHROUGH_GEN,
  10288. COMPRESSED_PASSTHROUGH_IEC61937
  10289. };
  10290. #define AUDPROC_MODULE_ID_COMPRESSED_MUTE 0x00010770
  10291. #define AUDPROC_PARAM_ID_COMPRESSED_MUTE 0x00010771
  10292. struct adm_set_compressed_device_mute {
  10293. u32 mute_on;
  10294. } __packed;
  10295. #define AUDPROC_MODULE_ID_COMPRESSED_LATENCY 0x0001076E
  10296. #define AUDPROC_PARAM_ID_COMPRESSED_LATENCY 0x0001076F
  10297. struct adm_set_compressed_device_latency {
  10298. u32 latency;
  10299. } __packed;
  10300. #define VOICEPROC_MODULE_ID_GENERIC_TX 0x00010EF6
  10301. #define VOICEPROC_MODULE_ID_FLUENCE_PRO_VC_TX 0x00010F35
  10302. #define VOICEPROC_PARAM_ID_FLUENCE_SOUNDFOCUS 0x00010E37
  10303. #define VOICEPROC_PARAM_ID_FLUENCE_SOURCETRACKING 0x00010E38
  10304. #define MAX_SECTORS 8
  10305. #define MAX_NOISE_SOURCE_INDICATORS 3
  10306. #define MAX_POLAR_ACTIVITY_INDICATORS 360
  10307. struct sound_focus_param {
  10308. uint16_t start_angle[MAX_SECTORS];
  10309. uint8_t enable[MAX_SECTORS];
  10310. uint16_t gain_step;
  10311. } __packed;
  10312. struct source_tracking_param {
  10313. uint8_t vad[MAX_SECTORS];
  10314. uint16_t doa_speech;
  10315. uint16_t doa_noise[MAX_NOISE_SOURCE_INDICATORS];
  10316. uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
  10317. } __packed;
  10318. struct adm_param_fluence_soundfocus_t {
  10319. uint16_t start_angles[MAX_SECTORS];
  10320. uint8_t enables[MAX_SECTORS];
  10321. uint16_t gain_step;
  10322. uint16_t reserved;
  10323. } __packed;
  10324. struct adm_param_fluence_sourcetracking_t {
  10325. uint8_t vad[MAX_SECTORS];
  10326. uint16_t doa_speech;
  10327. uint16_t doa_noise[MAX_NOISE_SOURCE_INDICATORS];
  10328. uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
  10329. } __packed;
  10330. #define AUDPROC_MODULE_ID_AUDIOSPHERE 0x00010916
  10331. #define AUDPROC_PARAM_ID_AUDIOSPHERE_ENABLE 0x00010917
  10332. #define AUDPROC_PARAM_ID_AUDIOSPHERE_STRENGTH 0x00010918
  10333. #define AUDPROC_PARAM_ID_AUDIOSPHERE_CONFIG_MODE 0x00010919
  10334. #define AUDPROC_PARAM_ID_AUDIOSPHERE_COEFFS_STEREO_INPUT 0x0001091A
  10335. #define AUDPROC_PARAM_ID_AUDIOSPHERE_COEFFS_MULTICHANNEL_INPUT 0x0001091B
  10336. #define AUDPROC_PARAM_ID_AUDIOSPHERE_DESIGN_STEREO_INPUT 0x0001091C
  10337. #define AUDPROC_PARAM_ID_AUDIOSPHERE_DESIGN_MULTICHANNEL_INPUT 0x0001091D
  10338. #define AUDPROC_PARAM_ID_AUDIOSPHERE_OPERATING_INPUT_MEDIA_INFO 0x0001091E
  10339. #define AUDPROC_MODULE_ID_VOICE_TX_SECNS 0x10027059
  10340. #define AUDPROC_PARAM_IDX_SEC_PRIMARY_MIC_CH 0x10014444
  10341. struct admx_sec_primary_mic_ch {
  10342. uint16_t version;
  10343. uint16_t reserved;
  10344. uint16_t sec_primary_mic_ch;
  10345. uint16_t reserved1;
  10346. } __packed;
  10347. /** ID of the Voice Activity Detection (VAD) module, which is used to
  10348. * configure AFE VAD.
  10349. */
  10350. #define AFE_MODULE_VAD 0x000102B9
  10351. /** ID of the parameter used by #AFE_MODULE_VAD to configure the VAD.
  10352. */
  10353. #define AFE_PARAM_ID_VAD_CFG 0x000102BA
  10354. #define AFE_API_VERSION_VAD_CFG 0x1
  10355. /* Payload of the AFE_PARAM_ID_VAD_CONFIG parameter used by
  10356. * AFE_MODULE_VAD.
  10357. */
  10358. struct afe_param_id_vad_cfg_t {
  10359. uint32_t vad_cfg_minor_version;
  10360. /** Tracks the configuration of this parameter.
  10361. * Supported Values: #AFE_API_VERSION_VAD_CFG
  10362. */
  10363. uint32_t pre_roll_in_ms;
  10364. /** Pre-roll period in ms.
  10365. * Supported Values: 0x0 to 0x3E8
  10366. */
  10367. } __packed;
  10368. #define AFE_PARAM_ID_VAD_CORE_CFG 0x000102BB
  10369. #endif /*_APR_AUDIO_V2_H_ */