apr_audio-v2.h 359 KB

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