apr_audio-v2.h 378 KB

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