apr_audio-v2.h 345 KB

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