apr_audio-v2.h 327 KB

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