apr_audio-v2.h 329 KB

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