camss.c 125 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * camss.c
  4. *
  5. * Qualcomm MSM Camera Subsystem - Core
  6. *
  7. * Copyright (c) 2015, The Linux Foundation. All rights reserved.
  8. * Copyright (C) 2015-2018 Linaro Ltd.
  9. */
  10. #include <linux/clk.h>
  11. #include <linux/interconnect.h>
  12. #include <linux/media-bus-format.h>
  13. #include <linux/media.h>
  14. #include <linux/module.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/of.h>
  17. #include <linux/of_device.h>
  18. #include <linux/of_graph.h>
  19. #include <linux/pm_runtime.h>
  20. #include <linux/pm_domain.h>
  21. #include <linux/slab.h>
  22. #include <linux/videodev2.h>
  23. #include <media/media-device.h>
  24. #include <media/v4l2-async.h>
  25. #include <media/v4l2-device.h>
  26. #include <media/v4l2-mc.h>
  27. #include <media/v4l2-fwnode.h>
  28. #include "camss.h"
  29. #define CAMSS_CLOCK_MARGIN_NUMERATOR 105
  30. #define CAMSS_CLOCK_MARGIN_DENOMINATOR 100
  31. static const struct parent_dev_ops vfe_parent_dev_ops;
  32. static const struct camss_subdev_resources csiphy_res_8x16[] = {
  33. /* CSIPHY0 */
  34. {
  35. .regulators = {},
  36. .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy0_timer" },
  37. .clock_rate = { { 0 },
  38. { 0 },
  39. { 0 },
  40. { 100000000, 200000000 } },
  41. .reg = { "csiphy0", "csiphy0_clk_mux" },
  42. .interrupt = { "csiphy0" },
  43. .csiphy = {
  44. .id = 0,
  45. .hw_ops = &csiphy_ops_2ph_1_0,
  46. .formats = &csiphy_formats_8x16
  47. }
  48. },
  49. /* CSIPHY1 */
  50. {
  51. .regulators = {},
  52. .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy1_timer" },
  53. .clock_rate = { { 0 },
  54. { 0 },
  55. { 0 },
  56. { 100000000, 200000000 } },
  57. .reg = { "csiphy1", "csiphy1_clk_mux" },
  58. .interrupt = { "csiphy1" },
  59. .csiphy = {
  60. .id = 1,
  61. .hw_ops = &csiphy_ops_2ph_1_0,
  62. .formats = &csiphy_formats_8x16
  63. }
  64. }
  65. };
  66. static const struct camss_subdev_resources csid_res_8x16[] = {
  67. /* CSID0 */
  68. {
  69. .regulators = {
  70. { .supply = "vdda", .init_load_uA = 40000 }
  71. },
  72. .clock = { "top_ahb", "ispif_ahb", "csi0_ahb", "ahb",
  73. "csi0", "csi0_phy", "csi0_pix", "csi0_rdi" },
  74. .clock_rate = { { 0 },
  75. { 0 },
  76. { 0 },
  77. { 0 },
  78. { 100000000, 200000000 },
  79. { 0 },
  80. { 0 },
  81. { 0 } },
  82. .reg = { "csid0" },
  83. .interrupt = { "csid0" },
  84. .csid = {
  85. .hw_ops = &csid_ops_4_1,
  86. .parent_dev_ops = &vfe_parent_dev_ops,
  87. .formats = &csid_formats_4_1
  88. }
  89. },
  90. /* CSID1 */
  91. {
  92. .regulators = {
  93. { .supply = "vdda", .init_load_uA = 40000 }
  94. },
  95. .clock = { "top_ahb", "ispif_ahb", "csi1_ahb", "ahb",
  96. "csi1", "csi1_phy", "csi1_pix", "csi1_rdi" },
  97. .clock_rate = { { 0 },
  98. { 0 },
  99. { 0 },
  100. { 0 },
  101. { 100000000, 200000000 },
  102. { 0 },
  103. { 0 },
  104. { 0 } },
  105. .reg = { "csid1" },
  106. .interrupt = { "csid1" },
  107. .csid = {
  108. .hw_ops = &csid_ops_4_1,
  109. .parent_dev_ops = &vfe_parent_dev_ops,
  110. .formats = &csid_formats_4_1
  111. }
  112. },
  113. };
  114. static const struct camss_subdev_resources ispif_res_8x16 = {
  115. /* ISPIF */
  116. .clock = { "top_ahb", "ahb", "ispif_ahb",
  117. "csi0", "csi0_pix", "csi0_rdi",
  118. "csi1", "csi1_pix", "csi1_rdi" },
  119. .clock_for_reset = { "vfe0", "csi_vfe0" },
  120. .reg = { "ispif", "csi_clk_mux" },
  121. .interrupt = { "ispif" },
  122. };
  123. static const struct camss_subdev_resources vfe_res_8x16[] = {
  124. /* VFE0 */
  125. {
  126. .regulators = {},
  127. .clock = { "top_ahb", "vfe0", "csi_vfe0",
  128. "vfe_ahb", "vfe_axi", "ahb" },
  129. .clock_rate = { { 0 },
  130. { 50000000, 80000000, 100000000, 160000000,
  131. 177780000, 200000000, 266670000, 320000000,
  132. 400000000, 465000000 },
  133. { 0 },
  134. { 0 },
  135. { 0 },
  136. { 0 },
  137. { 0 },
  138. { 0 },
  139. { 0 } },
  140. .reg = { "vfe0" },
  141. .interrupt = { "vfe0" },
  142. .vfe = {
  143. .line_num = 3,
  144. .hw_ops = &vfe_ops_4_1,
  145. .formats_rdi = &vfe_formats_rdi_8x16,
  146. .formats_pix = &vfe_formats_pix_8x16
  147. }
  148. }
  149. };
  150. static const struct camss_subdev_resources csiphy_res_8x39[] = {
  151. /* CSIPHY0 */
  152. {
  153. .regulators = {
  154. { .supply = "vdda", .init_load_uA = 40000 }
  155. },
  156. .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy0_timer" },
  157. .clock_rate = { { 0 },
  158. { 40000000, 80000000 },
  159. { 0 },
  160. { 100000000, 200000000 } },
  161. .reg = { "csiphy0", "csiphy0_clk_mux" },
  162. .interrupt = { "csiphy0" },
  163. .csiphy = {
  164. .id = 0,
  165. .hw_ops = &csiphy_ops_2ph_1_0,
  166. .formats = &csiphy_formats_8x16
  167. }
  168. },
  169. /* CSIPHY1 */
  170. {
  171. .regulators = {
  172. { .supply = "vdda", .init_load_uA = 40000 }
  173. },
  174. .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy1_timer" },
  175. .clock_rate = { { 0 },
  176. { 40000000, 80000000 },
  177. { 0 },
  178. { 100000000, 200000000 } },
  179. .reg = { "csiphy1", "csiphy1_clk_mux" },
  180. .interrupt = { "csiphy1" },
  181. .csiphy = {
  182. .id = 1,
  183. .hw_ops = &csiphy_ops_2ph_1_0,
  184. .formats = &csiphy_formats_8x16
  185. }
  186. }
  187. };
  188. static const struct camss_subdev_resources csid_res_8x39[] = {
  189. /* CSID0 */
  190. {
  191. .regulators = {},
  192. .clock = { "top_ahb", "ispif_ahb", "csi0_ahb", "ahb",
  193. "csi0", "csi0_phy", "csi0_pix", "csi0_rdi" },
  194. .clock_rate = { { 0 },
  195. { 40000000, 80000000 },
  196. { 0 },
  197. { 0 },
  198. { 100000000, 200000000 },
  199. { 0 },
  200. { 0 },
  201. { 0 } },
  202. .reg = { "csid0" },
  203. .interrupt = { "csid0" },
  204. .csid = {
  205. .hw_ops = &csid_ops_4_1,
  206. .parent_dev_ops = &vfe_parent_dev_ops,
  207. .formats = &csid_formats_4_1
  208. }
  209. },
  210. /* CSID1 */
  211. {
  212. .regulators = {},
  213. .clock = { "top_ahb", "ispif_ahb", "csi1_ahb", "ahb",
  214. "csi1", "csi1_phy", "csi1_pix", "csi1_rdi" },
  215. .clock_rate = { { 0 },
  216. { 40000000, 80000000 },
  217. { 0 },
  218. { 0 },
  219. { 100000000, 200000000 },
  220. { 0 },
  221. { 0 },
  222. { 0 } },
  223. .reg = { "csid1" },
  224. .interrupt = { "csid1" },
  225. .csid = {
  226. .hw_ops = &csid_ops_4_1,
  227. .parent_dev_ops = &vfe_parent_dev_ops,
  228. .formats = &csid_formats_4_1
  229. }
  230. },
  231. /* CSID2 */
  232. {
  233. .regulators = {},
  234. .clock = { "top_ahb", "ispif_ahb", "csi2_ahb", "ahb",
  235. "csi2", "csi2_phy", "csi2_pix", "csi2_rdi" },
  236. .clock_rate = { { 0 },
  237. { 40000000, 80000000 },
  238. { 0 },
  239. { 0 },
  240. { 100000000, 200000000 },
  241. { 0 },
  242. { 0 },
  243. { 0 } },
  244. .reg = { "csid2" },
  245. .interrupt = { "csid2" },
  246. .csid = {
  247. .hw_ops = &csid_ops_4_1,
  248. .parent_dev_ops = &vfe_parent_dev_ops,
  249. .formats = &csid_formats_4_1
  250. }
  251. },
  252. };
  253. static const struct camss_subdev_resources ispif_res_8x39 = {
  254. /* ISPIF */
  255. .clock = { "top_ahb", "ispif_ahb", "ahb",
  256. "csi0", "csi0_pix", "csi0_rdi",
  257. "csi1", "csi1_pix", "csi1_rdi",
  258. "csi2", "csi2_pix", "csi2_rdi" },
  259. .clock_for_reset = { "vfe0", "csi_vfe0" },
  260. .reg = { "ispif", "csi_clk_mux" },
  261. .interrupt = { "ispif" },
  262. };
  263. static const struct camss_subdev_resources vfe_res_8x39[] = {
  264. /* VFE0 */
  265. {
  266. .regulators = {},
  267. .clock = { "top_ahb", "ispif_ahb", "vfe0", "csi_vfe0",
  268. "vfe_ahb", "vfe_axi", "ahb" },
  269. .clock_rate = { { 0 },
  270. { 40000000, 80000000 },
  271. { 50000000, 80000000, 100000000, 160000000,
  272. 177780000, 200000000, 266670000, 320000000,
  273. 400000000, 465000000, 480000000, 600000000 },
  274. { 0 },
  275. { 0 },
  276. { 0 },
  277. { 0 } },
  278. .reg = { "vfe0" },
  279. .interrupt = { "vfe0" },
  280. .vfe = {
  281. .line_num = 3,
  282. .has_vbif = true,
  283. .vbif_name = "vfe0_vbif",
  284. .hw_ops = &vfe_ops_4_1,
  285. .formats_rdi = &vfe_formats_rdi_8x16,
  286. .formats_pix = &vfe_formats_pix_8x16
  287. }
  288. }
  289. };
  290. static const struct camss_subdev_resources csid_res_8x53[] = {
  291. /* CSID0 */
  292. {
  293. .regulators = {
  294. { .supply = "vdda", .init_load_uA = 9900 }
  295. },
  296. .clock = { "top_ahb", "ispif_ahb", "csi0_ahb", "ahb",
  297. "csi0", "csi0_phy", "csi0_pix", "csi0_rdi" },
  298. .clock_rate = { { 0 },
  299. { 0 },
  300. { 0 },
  301. { 0 },
  302. { 100000000, 200000000, 310000000,
  303. 400000000, 465000000 },
  304. { 0 },
  305. { 0 },
  306. { 0 } },
  307. .reg = { "csid0" },
  308. .interrupt = { "csid0" },
  309. .csid = {
  310. .hw_ops = &csid_ops_4_7,
  311. .parent_dev_ops = &vfe_parent_dev_ops,
  312. .formats = &csid_formats_4_7
  313. }
  314. },
  315. /* CSID1 */
  316. {
  317. .regulators = {
  318. { .supply = "vdda", .init_load_uA = 9900 }
  319. },
  320. .clock = { "top_ahb", "ispif_ahb", "csi1_ahb", "ahb",
  321. "csi1", "csi1_phy", "csi1_pix", "csi1_rdi" },
  322. .clock_rate = { { 0 },
  323. { 0 },
  324. { 0 },
  325. { 0 },
  326. { 100000000, 200000000, 310000000,
  327. 400000000, 465000000 },
  328. { 0 },
  329. { 0 },
  330. { 0 } },
  331. .reg = { "csid1" },
  332. .interrupt = { "csid1" },
  333. .csid = {
  334. .hw_ops = &csid_ops_4_7,
  335. .parent_dev_ops = &vfe_parent_dev_ops,
  336. .formats = &csid_formats_4_7
  337. }
  338. },
  339. /* CSID2 */
  340. {
  341. .regulators = {
  342. { .supply = "vdda", .init_load_uA = 9900 }
  343. },
  344. .clock = { "top_ahb", "ispif_ahb", "csi2_ahb", "ahb",
  345. "csi2", "csi2_phy", "csi2_pix", "csi2_rdi" },
  346. .clock_rate = { { 0 },
  347. { 0 },
  348. { 0 },
  349. { 0 },
  350. { 100000000, 200000000, 310000000,
  351. 400000000, 465000000 },
  352. { 0 },
  353. { 0 },
  354. { 0 } },
  355. .reg = { "csid2" },
  356. .interrupt = { "csid2" },
  357. .csid = {
  358. .hw_ops = &csid_ops_4_7,
  359. .parent_dev_ops = &vfe_parent_dev_ops,
  360. .formats = &csid_formats_4_7
  361. }
  362. },
  363. };
  364. static const struct camss_subdev_resources ispif_res_8x53 = {
  365. /* ISPIF */
  366. .clock = { "top_ahb", "ahb", "ispif_ahb",
  367. "csi0", "csi0_pix", "csi0_rdi",
  368. "csi1", "csi1_pix", "csi1_rdi",
  369. "csi2", "csi2_pix", "csi2_rdi" },
  370. .clock_for_reset = { "vfe0", "csi_vfe0", "vfe1", "csi_vfe1" },
  371. .reg = { "ispif", "csi_clk_mux" },
  372. .interrupt = { "ispif" },
  373. };
  374. static const struct camss_subdev_resources vfe_res_8x53[] = {
  375. /* VFE0 */
  376. {
  377. .regulators = {},
  378. .clock = { "top_ahb", "ahb", "ispif_ahb",
  379. "vfe0", "csi_vfe0", "vfe0_ahb", "vfe0_axi" },
  380. .clock_rate = { { 0 },
  381. { 0 },
  382. { 0 },
  383. { 50000000, 100000000, 133330000,
  384. 160000000, 200000000, 266670000,
  385. 310000000, 400000000, 465000000 },
  386. { 0 },
  387. { 0 },
  388. { 0 } },
  389. .reg = { "vfe0" },
  390. .interrupt = { "vfe0" },
  391. .vfe = {
  392. .line_num = 3,
  393. .has_pd = true,
  394. .pd_name = "vfe0",
  395. .hw_ops = &vfe_ops_4_1,
  396. .formats_rdi = &vfe_formats_rdi_8x16,
  397. .formats_pix = &vfe_formats_pix_8x16
  398. }
  399. },
  400. /* VFE1 */
  401. {
  402. .regulators = {},
  403. .clock = { "top_ahb", "ahb", "ispif_ahb",
  404. "vfe1", "csi_vfe1", "vfe1_ahb", "vfe1_axi" },
  405. .clock_rate = { { 0 },
  406. { 0 },
  407. { 0 },
  408. { 50000000, 100000000, 133330000,
  409. 160000000, 200000000, 266670000,
  410. 310000000, 400000000, 465000000 },
  411. { 0 },
  412. { 0 },
  413. { 0 } },
  414. .reg = { "vfe1" },
  415. .interrupt = { "vfe1" },
  416. .vfe = {
  417. .line_num = 3,
  418. .has_pd = true,
  419. .pd_name = "vfe1",
  420. .hw_ops = &vfe_ops_4_1,
  421. .formats_rdi = &vfe_formats_rdi_8x16,
  422. .formats_pix = &vfe_formats_pix_8x16
  423. }
  424. }
  425. };
  426. static const struct resources_icc icc_res_8x53[] = {
  427. {
  428. .name = "cam_ahb",
  429. .icc_bw_tbl.avg = 38400,
  430. .icc_bw_tbl.peak = 76800,
  431. },
  432. {
  433. .name = "cam_vfe0_mem",
  434. .icc_bw_tbl.avg = 939524,
  435. .icc_bw_tbl.peak = 1342177,
  436. },
  437. {
  438. .name = "cam_vfe1_mem",
  439. .icc_bw_tbl.avg = 939524,
  440. .icc_bw_tbl.peak = 1342177,
  441. },
  442. };
  443. static const struct camss_subdev_resources csiphy_res_8x96[] = {
  444. /* CSIPHY0 */
  445. {
  446. .regulators = {},
  447. .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy0_timer" },
  448. .clock_rate = { { 0 },
  449. { 0 },
  450. { 0 },
  451. { 100000000, 200000000, 266666667 } },
  452. .reg = { "csiphy0", "csiphy0_clk_mux" },
  453. .interrupt = { "csiphy0" },
  454. .csiphy = {
  455. .id = 0,
  456. .hw_ops = &csiphy_ops_3ph_1_0,
  457. .formats = &csiphy_formats_8x96
  458. }
  459. },
  460. /* CSIPHY1 */
  461. {
  462. .regulators = {},
  463. .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy1_timer" },
  464. .clock_rate = { { 0 },
  465. { 0 },
  466. { 0 },
  467. { 100000000, 200000000, 266666667 } },
  468. .reg = { "csiphy1", "csiphy1_clk_mux" },
  469. .interrupt = { "csiphy1" },
  470. .csiphy = {
  471. .id = 1,
  472. .hw_ops = &csiphy_ops_3ph_1_0,
  473. .formats = &csiphy_formats_8x96
  474. }
  475. },
  476. /* CSIPHY2 */
  477. {
  478. .regulators = {},
  479. .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy2_timer" },
  480. .clock_rate = { { 0 },
  481. { 0 },
  482. { 0 },
  483. { 100000000, 200000000, 266666667 } },
  484. .reg = { "csiphy2", "csiphy2_clk_mux" },
  485. .interrupt = { "csiphy2" },
  486. .csiphy = {
  487. .id = 2,
  488. .hw_ops = &csiphy_ops_3ph_1_0,
  489. .formats = &csiphy_formats_8x96
  490. }
  491. }
  492. };
  493. static const struct camss_subdev_resources csid_res_8x96[] = {
  494. /* CSID0 */
  495. {
  496. .regulators = {
  497. { .supply = "vdda", .init_load_uA = 80160 }
  498. },
  499. .clock = { "top_ahb", "ispif_ahb", "csi0_ahb", "ahb",
  500. "csi0", "csi0_phy", "csi0_pix", "csi0_rdi" },
  501. .clock_rate = { { 0 },
  502. { 0 },
  503. { 0 },
  504. { 0 },
  505. { 100000000, 200000000, 266666667 },
  506. { 0 },
  507. { 0 },
  508. { 0 } },
  509. .reg = { "csid0" },
  510. .interrupt = { "csid0" },
  511. .csid = {
  512. .hw_ops = &csid_ops_4_7,
  513. .parent_dev_ops = &vfe_parent_dev_ops,
  514. .formats = &csid_formats_4_7
  515. }
  516. },
  517. /* CSID1 */
  518. {
  519. .regulators = {
  520. { .supply = "vdda", .init_load_uA = 80160 }
  521. },
  522. .clock = { "top_ahb", "ispif_ahb", "csi1_ahb", "ahb",
  523. "csi1", "csi1_phy", "csi1_pix", "csi1_rdi" },
  524. .clock_rate = { { 0 },
  525. { 0 },
  526. { 0 },
  527. { 0 },
  528. { 100000000, 200000000, 266666667 },
  529. { 0 },
  530. { 0 },
  531. { 0 } },
  532. .reg = { "csid1" },
  533. .interrupt = { "csid1" },
  534. .csid = {
  535. .hw_ops = &csid_ops_4_7,
  536. .parent_dev_ops = &vfe_parent_dev_ops,
  537. .formats = &csid_formats_4_7
  538. }
  539. },
  540. /* CSID2 */
  541. {
  542. .regulators = {
  543. { .supply = "vdda", .init_load_uA = 80160 }
  544. },
  545. .clock = { "top_ahb", "ispif_ahb", "csi2_ahb", "ahb",
  546. "csi2", "csi2_phy", "csi2_pix", "csi2_rdi" },
  547. .clock_rate = { { 0 },
  548. { 0 },
  549. { 0 },
  550. { 0 },
  551. { 100000000, 200000000, 266666667 },
  552. { 0 },
  553. { 0 },
  554. { 0 } },
  555. .reg = { "csid2" },
  556. .interrupt = { "csid2" },
  557. .csid = {
  558. .hw_ops = &csid_ops_4_7,
  559. .parent_dev_ops = &vfe_parent_dev_ops,
  560. .formats = &csid_formats_4_7
  561. }
  562. },
  563. /* CSID3 */
  564. {
  565. .regulators = {
  566. { .supply = "vdda", .init_load_uA = 80160 }
  567. },
  568. .clock = { "top_ahb", "ispif_ahb", "csi3_ahb", "ahb",
  569. "csi3", "csi3_phy", "csi3_pix", "csi3_rdi" },
  570. .clock_rate = { { 0 },
  571. { 0 },
  572. { 0 },
  573. { 0 },
  574. { 100000000, 200000000, 266666667 },
  575. { 0 },
  576. { 0 },
  577. { 0 } },
  578. .reg = { "csid3" },
  579. .interrupt = { "csid3" },
  580. .csid = {
  581. .hw_ops = &csid_ops_4_7,
  582. .parent_dev_ops = &vfe_parent_dev_ops,
  583. .formats = &csid_formats_4_7
  584. }
  585. }
  586. };
  587. static const struct camss_subdev_resources ispif_res_8x96 = {
  588. /* ISPIF */
  589. .clock = { "top_ahb", "ahb", "ispif_ahb",
  590. "csi0", "csi0_pix", "csi0_rdi",
  591. "csi1", "csi1_pix", "csi1_rdi",
  592. "csi2", "csi2_pix", "csi2_rdi",
  593. "csi3", "csi3_pix", "csi3_rdi" },
  594. .clock_for_reset = { "vfe0", "csi_vfe0", "vfe1", "csi_vfe1" },
  595. .reg = { "ispif", "csi_clk_mux" },
  596. .interrupt = { "ispif" },
  597. };
  598. static const struct camss_subdev_resources vfe_res_8x96[] = {
  599. /* VFE0 */
  600. {
  601. .regulators = {},
  602. .clock = { "top_ahb", "ahb", "vfe0", "csi_vfe0", "vfe_ahb",
  603. "vfe0_ahb", "vfe_axi", "vfe0_stream"},
  604. .clock_rate = { { 0 },
  605. { 0 },
  606. { 75000000, 100000000, 300000000,
  607. 320000000, 480000000, 600000000 },
  608. { 0 },
  609. { 0 },
  610. { 0 },
  611. { 0 },
  612. { 0 } },
  613. .reg = { "vfe0" },
  614. .interrupt = { "vfe0" },
  615. .vfe = {
  616. .line_num = 3,
  617. .has_pd = true,
  618. .hw_ops = &vfe_ops_4_7,
  619. .formats_rdi = &vfe_formats_rdi_8x96,
  620. .formats_pix = &vfe_formats_pix_8x96
  621. }
  622. },
  623. /* VFE1 */
  624. {
  625. .regulators = {},
  626. .clock = { "top_ahb", "ahb", "vfe1", "csi_vfe1", "vfe_ahb",
  627. "vfe1_ahb", "vfe_axi", "vfe1_stream"},
  628. .clock_rate = { { 0 },
  629. { 0 },
  630. { 75000000, 100000000, 300000000,
  631. 320000000, 480000000, 600000000 },
  632. { 0 },
  633. { 0 },
  634. { 0 },
  635. { 0 },
  636. { 0 } },
  637. .reg = { "vfe1" },
  638. .interrupt = { "vfe1" },
  639. .vfe = {
  640. .line_num = 3,
  641. .has_pd = true,
  642. .hw_ops = &vfe_ops_4_7,
  643. .formats_rdi = &vfe_formats_rdi_8x96,
  644. .formats_pix = &vfe_formats_pix_8x96
  645. }
  646. }
  647. };
  648. static const struct camss_subdev_resources csiphy_res_2290[] = {
  649. /* CSIPHY0 */
  650. {
  651. .regulators = {
  652. { .supply = "vdd-csiphy-1p2", .init_load_uA = 26700 },
  653. { .supply = "vdd-csiphy-1p8", .init_load_uA = 2600 }
  654. },
  655. .clock = { "top_ahb", "ahb", "csiphy0", "csiphy0_timer" },
  656. .clock_rate = { { 0 },
  657. { 0 },
  658. { 240000000, 341330000, 384000000 },
  659. { 100000000, 200000000, 268800000 } },
  660. .reg = { "csiphy0" },
  661. .interrupt = { "csiphy0" },
  662. .csiphy = {
  663. .id = 0,
  664. .hw_ops = &csiphy_ops_3ph_1_0,
  665. .formats = &csiphy_formats_sdm845
  666. }
  667. },
  668. /* CSIPHY1 */
  669. {
  670. .regulators = {
  671. { .supply = "vdd-csiphy-1p2", .init_load_uA = 26700 },
  672. { .supply = "vdd-csiphy-1p8", .init_load_uA = 2600 }
  673. },
  674. .clock = { "top_ahb", "ahb", "csiphy1", "csiphy1_timer" },
  675. .clock_rate = { { 0 },
  676. { 0 },
  677. { 240000000, 341330000, 384000000 },
  678. { 100000000, 200000000, 268800000 } },
  679. .reg = { "csiphy1" },
  680. .interrupt = { "csiphy1" },
  681. .csiphy = {
  682. .id = 1,
  683. .hw_ops = &csiphy_ops_3ph_1_0,
  684. .formats = &csiphy_formats_sdm845
  685. }
  686. }
  687. };
  688. static const struct camss_subdev_resources csid_res_2290[] = {
  689. /* CSID0 */
  690. {
  691. .regulators = {},
  692. .clock = { "top_ahb", "ahb", "csi0", "vfe0_cphy_rx", "vfe0" },
  693. .clock_rate = { { 0 },
  694. { 0 },
  695. { 192000000, 240000000, 384000000, 426400000 },
  696. { 0 },
  697. { 0 } },
  698. .reg = { "csid0" },
  699. .interrupt = { "csid0" },
  700. .csid = {
  701. .hw_ops = &csid_ops_340,
  702. .parent_dev_ops = &vfe_parent_dev_ops,
  703. .formats = &csid_formats_gen2
  704. }
  705. },
  706. /* CSID1 */
  707. {
  708. .regulators = {},
  709. .clock = { "top_ahb", "ahb", "csi1", "vfe1_cphy_rx", "vfe1" },
  710. .clock_rate = { { 0 },
  711. { 0 },
  712. { 192000000, 240000000, 384000000, 426400000 },
  713. { 0 },
  714. { 0 } },
  715. .reg = { "csid1" },
  716. .interrupt = { "csid1" },
  717. .csid = {
  718. .hw_ops = &csid_ops_340,
  719. .parent_dev_ops = &vfe_parent_dev_ops,
  720. .formats = &csid_formats_gen2
  721. }
  722. }
  723. };
  724. static const struct camss_subdev_resources vfe_res_2290[] = {
  725. /* VFE0 */
  726. {
  727. .regulators = {},
  728. .clock = { "top_ahb", "ahb", "axi", "vfe0", "camnoc_rt_axi", "camnoc_nrt_axi" },
  729. .clock_rate = { { 0 },
  730. { 0 },
  731. { 0 },
  732. { 19200000, 153600000, 192000000, 256000000, 384000000, 460800000 },
  733. { 0 },
  734. { 0 }, },
  735. .reg = { "vfe0" },
  736. .interrupt = { "vfe0" },
  737. .vfe = {
  738. .line_num = 4,
  739. .hw_ops = &vfe_ops_340,
  740. .formats_rdi = &vfe_formats_rdi_845,
  741. .formats_pix = &vfe_formats_pix_845
  742. }
  743. },
  744. /* VFE1 */
  745. {
  746. .regulators = {},
  747. .clock = { "top_ahb", "ahb", "axi", "vfe1", "camnoc_rt_axi", "camnoc_nrt_axi" },
  748. .clock_rate = { { 0 },
  749. { 0 },
  750. { 0 },
  751. { 19200000, 153600000, 192000000, 256000000, 384000000, 460800000 },
  752. { 0 },
  753. { 0 }, },
  754. .reg = { "vfe1" },
  755. .interrupt = { "vfe1" },
  756. .vfe = {
  757. .line_num = 4,
  758. .hw_ops = &vfe_ops_340,
  759. .formats_rdi = &vfe_formats_rdi_845,
  760. .formats_pix = &vfe_formats_pix_845
  761. }
  762. },
  763. };
  764. static const struct resources_icc icc_res_2290[] = {
  765. {
  766. .name = "ahb",
  767. .icc_bw_tbl.avg = 150000,
  768. .icc_bw_tbl.peak = 300000,
  769. },
  770. {
  771. .name = "hf_mnoc",
  772. .icc_bw_tbl.avg = 2097152,
  773. .icc_bw_tbl.peak = 3000000,
  774. },
  775. {
  776. .name = "sf_mnoc",
  777. .icc_bw_tbl.avg = 2097152,
  778. .icc_bw_tbl.peak = 3000000,
  779. },
  780. };
  781. static const struct camss_subdev_resources csiphy_res_660[] = {
  782. /* CSIPHY0 */
  783. {
  784. .regulators = {},
  785. .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy0_timer",
  786. "csi0_phy", "csiphy_ahb2crif" },
  787. .clock_rate = { { 0 },
  788. { 0 },
  789. { 0 },
  790. { 100000000, 200000000, 269333333 },
  791. { 0 } },
  792. .reg = { "csiphy0", "csiphy0_clk_mux" },
  793. .interrupt = { "csiphy0" },
  794. .csiphy = {
  795. .id = 0,
  796. .hw_ops = &csiphy_ops_3ph_1_0,
  797. .formats = &csiphy_formats_8x96
  798. }
  799. },
  800. /* CSIPHY1 */
  801. {
  802. .regulators = {},
  803. .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy1_timer",
  804. "csi1_phy", "csiphy_ahb2crif" },
  805. .clock_rate = { { 0 },
  806. { 0 },
  807. { 0 },
  808. { 100000000, 200000000, 269333333 },
  809. { 0 } },
  810. .reg = { "csiphy1", "csiphy1_clk_mux" },
  811. .interrupt = { "csiphy1" },
  812. .csiphy = {
  813. .id = 1,
  814. .hw_ops = &csiphy_ops_3ph_1_0,
  815. .formats = &csiphy_formats_8x96
  816. }
  817. },
  818. /* CSIPHY2 */
  819. {
  820. .regulators = {},
  821. .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy2_timer",
  822. "csi2_phy", "csiphy_ahb2crif" },
  823. .clock_rate = { { 0 },
  824. { 0 },
  825. { 0 },
  826. { 100000000, 200000000, 269333333 },
  827. { 0 } },
  828. .reg = { "csiphy2", "csiphy2_clk_mux" },
  829. .interrupt = { "csiphy2" },
  830. .csiphy = {
  831. .id = 2,
  832. .hw_ops = &csiphy_ops_3ph_1_0,
  833. .formats = &csiphy_formats_8x96
  834. }
  835. }
  836. };
  837. static const struct camss_subdev_resources csid_res_660[] = {
  838. /* CSID0 */
  839. {
  840. .regulators = {
  841. { .supply = "vdda", .init_load_uA = 0 },
  842. { .supply = "vdd_sec", .init_load_uA = 0 }
  843. },
  844. .clock = { "top_ahb", "ispif_ahb", "csi0_ahb", "ahb",
  845. "csi0", "csi0_phy", "csi0_pix", "csi0_rdi",
  846. "cphy_csid0" },
  847. .clock_rate = { { 0 },
  848. { 0 },
  849. { 0 },
  850. { 0 },
  851. { 100000000, 200000000, 310000000,
  852. 404000000, 465000000 },
  853. { 0 },
  854. { 0 },
  855. { 0 },
  856. { 0 } },
  857. .reg = { "csid0" },
  858. .interrupt = { "csid0" },
  859. .csid = {
  860. .hw_ops = &csid_ops_4_7,
  861. .parent_dev_ops = &vfe_parent_dev_ops,
  862. .formats = &csid_formats_4_7
  863. }
  864. },
  865. /* CSID1 */
  866. {
  867. .regulators = {
  868. { .supply = "vdda", .init_load_uA = 0 },
  869. { .supply = "vdd_sec", .init_load_uA = 0 }
  870. },
  871. .clock = { "top_ahb", "ispif_ahb", "csi1_ahb", "ahb",
  872. "csi1", "csi1_phy", "csi1_pix", "csi1_rdi",
  873. "cphy_csid1" },
  874. .clock_rate = { { 0 },
  875. { 0 },
  876. { 0 },
  877. { 0 },
  878. { 100000000, 200000000, 310000000,
  879. 404000000, 465000000 },
  880. { 0 },
  881. { 0 },
  882. { 0 },
  883. { 0 } },
  884. .reg = { "csid1" },
  885. .interrupt = { "csid1" },
  886. .csid = {
  887. .hw_ops = &csid_ops_4_7,
  888. .parent_dev_ops = &vfe_parent_dev_ops,
  889. .formats = &csid_formats_4_7
  890. }
  891. },
  892. /* CSID2 */
  893. {
  894. .regulators = {
  895. { .supply = "vdda", .init_load_uA = 0 },
  896. { .supply = "vdd_sec", .init_load_uA = 0 }
  897. },
  898. .clock = { "top_ahb", "ispif_ahb", "csi2_ahb", "ahb",
  899. "csi2", "csi2_phy", "csi2_pix", "csi2_rdi",
  900. "cphy_csid2" },
  901. .clock_rate = { { 0 },
  902. { 0 },
  903. { 0 },
  904. { 0 },
  905. { 100000000, 200000000, 310000000,
  906. 404000000, 465000000 },
  907. { 0 },
  908. { 0 },
  909. { 0 },
  910. { 0 } },
  911. .reg = { "csid2" },
  912. .interrupt = { "csid2" },
  913. .csid = {
  914. .hw_ops = &csid_ops_4_7,
  915. .parent_dev_ops = &vfe_parent_dev_ops,
  916. .formats = &csid_formats_4_7
  917. }
  918. },
  919. /* CSID3 */
  920. {
  921. .regulators = {
  922. { .supply = "vdda", .init_load_uA = 0 },
  923. { .supply = "vdd_sec", .init_load_uA = 0 }
  924. },
  925. .clock = { "top_ahb", "ispif_ahb", "csi3_ahb", "ahb",
  926. "csi3", "csi3_phy", "csi3_pix", "csi3_rdi",
  927. "cphy_csid3" },
  928. .clock_rate = { { 0 },
  929. { 0 },
  930. { 0 },
  931. { 0 },
  932. { 100000000, 200000000, 310000000,
  933. 404000000, 465000000 },
  934. { 0 },
  935. { 0 },
  936. { 0 },
  937. { 0 } },
  938. .reg = { "csid3" },
  939. .interrupt = { "csid3" },
  940. .csid = {
  941. .hw_ops = &csid_ops_4_7,
  942. .parent_dev_ops = &vfe_parent_dev_ops,
  943. .formats = &csid_formats_4_7
  944. }
  945. }
  946. };
  947. static const struct camss_subdev_resources ispif_res_660 = {
  948. /* ISPIF */
  949. .clock = { "top_ahb", "ahb", "ispif_ahb",
  950. "csi0", "csi0_pix", "csi0_rdi",
  951. "csi1", "csi1_pix", "csi1_rdi",
  952. "csi2", "csi2_pix", "csi2_rdi",
  953. "csi3", "csi3_pix", "csi3_rdi" },
  954. .clock_for_reset = { "vfe0", "csi_vfe0", "vfe1", "csi_vfe1" },
  955. .reg = { "ispif", "csi_clk_mux" },
  956. .interrupt = { "ispif" },
  957. };
  958. static const struct camss_subdev_resources vfe_res_660[] = {
  959. /* VFE0 */
  960. {
  961. .regulators = {},
  962. .clock = { "throttle_axi", "top_ahb", "ahb", "vfe0",
  963. "csi_vfe0", "vfe_ahb", "vfe0_ahb", "vfe_axi",
  964. "vfe0_stream"},
  965. .clock_rate = { { 0 },
  966. { 0 },
  967. { 0 },
  968. { 120000000, 200000000, 256000000,
  969. 300000000, 404000000, 480000000,
  970. 540000000, 576000000 },
  971. { 0 },
  972. { 0 },
  973. { 0 },
  974. { 0 },
  975. { 0 } },
  976. .reg = { "vfe0" },
  977. .interrupt = { "vfe0" },
  978. .vfe = {
  979. .line_num = 3,
  980. .has_pd = true,
  981. .hw_ops = &vfe_ops_4_8,
  982. .formats_rdi = &vfe_formats_rdi_8x96,
  983. .formats_pix = &vfe_formats_pix_8x96
  984. }
  985. },
  986. /* VFE1 */
  987. {
  988. .regulators = {},
  989. .clock = { "throttle_axi", "top_ahb", "ahb", "vfe1",
  990. "csi_vfe1", "vfe_ahb", "vfe1_ahb", "vfe_axi",
  991. "vfe1_stream"},
  992. .clock_rate = { { 0 },
  993. { 0 },
  994. { 0 },
  995. { 120000000, 200000000, 256000000,
  996. 300000000, 404000000, 480000000,
  997. 540000000, 576000000 },
  998. { 0 },
  999. { 0 },
  1000. { 0 },
  1001. { 0 },
  1002. { 0 } },
  1003. .reg = { "vfe1" },
  1004. .interrupt = { "vfe1" },
  1005. .vfe = {
  1006. .line_num = 3,
  1007. .has_pd = true,
  1008. .hw_ops = &vfe_ops_4_8,
  1009. .formats_rdi = &vfe_formats_rdi_8x96,
  1010. .formats_pix = &vfe_formats_pix_8x96
  1011. }
  1012. }
  1013. };
  1014. static const struct camss_subdev_resources csiphy_res_670[] = {
  1015. /* CSIPHY0 */
  1016. {
  1017. .regulators = {
  1018. { .supply = "vdda-phy", .init_load_uA = 42800 },
  1019. { .supply = "vdda-pll", .init_load_uA = 13900 }
  1020. },
  1021. .clock = { "soc_ahb", "cpas_ahb",
  1022. "csiphy0", "csiphy0_timer" },
  1023. .clock_rate = { { 0 },
  1024. { 0 },
  1025. { 0 },
  1026. { 19200000, 240000000, 269333333 } },
  1027. .reg = { "csiphy0" },
  1028. .interrupt = { "csiphy0" },
  1029. .csiphy = {
  1030. .id = 0,
  1031. .hw_ops = &csiphy_ops_3ph_1_0,
  1032. .formats = &csiphy_formats_sdm845
  1033. }
  1034. },
  1035. /* CSIPHY1 */
  1036. {
  1037. .regulators = {
  1038. { .supply = "vdda-phy", .init_load_uA = 42800 },
  1039. { .supply = "vdda-pll", .init_load_uA = 13900 }
  1040. },
  1041. .clock = { "soc_ahb", "cpas_ahb",
  1042. "csiphy1", "csiphy1_timer" },
  1043. .clock_rate = { { 0 },
  1044. { 0 },
  1045. { 0 },
  1046. { 19200000, 240000000, 269333333 } },
  1047. .reg = { "csiphy1" },
  1048. .interrupt = { "csiphy1" },
  1049. .csiphy = {
  1050. .id = 1,
  1051. .hw_ops = &csiphy_ops_3ph_1_0,
  1052. .formats = &csiphy_formats_sdm845
  1053. }
  1054. },
  1055. /* CSIPHY2 */
  1056. {
  1057. .regulators = {
  1058. { .supply = "vdda-phy", .init_load_uA = 42800 },
  1059. { .supply = "vdda-pll", .init_load_uA = 13900 }
  1060. },
  1061. .clock = { "soc_ahb", "cpas_ahb",
  1062. "csiphy2", "csiphy2_timer" },
  1063. .clock_rate = { { 0 },
  1064. { 0 },
  1065. { 0 },
  1066. { 19200000, 240000000, 269333333 } },
  1067. .reg = { "csiphy2" },
  1068. .interrupt = { "csiphy2" },
  1069. .csiphy = {
  1070. .id = 2,
  1071. .hw_ops = &csiphy_ops_3ph_1_0,
  1072. .formats = &csiphy_formats_sdm845
  1073. }
  1074. }
  1075. };
  1076. static const struct camss_subdev_resources csid_res_670[] = {
  1077. /* CSID0 */
  1078. {
  1079. .regulators = {},
  1080. .clock = { "cpas_ahb", "soc_ahb", "vfe0",
  1081. "vfe0_cphy_rx", "csi0" },
  1082. .clock_rate = { { 0 },
  1083. { 0 },
  1084. { 100000000, 320000000, 404000000, 480000000, 600000000 },
  1085. { 384000000 },
  1086. { 19200000, 75000000, 384000000, 538666667 } },
  1087. .reg = { "csid0" },
  1088. .interrupt = { "csid0" },
  1089. .csid = {
  1090. .hw_ops = &csid_ops_gen2,
  1091. .parent_dev_ops = &vfe_parent_dev_ops,
  1092. .formats = &csid_formats_gen2
  1093. }
  1094. },
  1095. /* CSID1 */
  1096. {
  1097. .regulators = {},
  1098. .clock = { "cpas_ahb", "soc_ahb", "vfe1",
  1099. "vfe1_cphy_rx", "csi1" },
  1100. .clock_rate = { { 0 },
  1101. { 0 },
  1102. { 100000000, 320000000, 404000000, 480000000, 600000000 },
  1103. { 384000000 },
  1104. { 19200000, 75000000, 384000000, 538666667 } },
  1105. .reg = { "csid1" },
  1106. .interrupt = { "csid1" },
  1107. .csid = {
  1108. .hw_ops = &csid_ops_gen2,
  1109. .parent_dev_ops = &vfe_parent_dev_ops,
  1110. .formats = &csid_formats_gen2
  1111. }
  1112. },
  1113. /* CSID2 */
  1114. {
  1115. .regulators = {},
  1116. .clock = { "cpas_ahb", "soc_ahb", "vfe_lite",
  1117. "vfe_lite_cphy_rx", "csi2" },
  1118. .clock_rate = { { 0 },
  1119. { 0 },
  1120. { 100000000, 320000000, 404000000, 480000000, 600000000 },
  1121. { 384000000 },
  1122. { 19200000, 75000000, 384000000, 538666667 } },
  1123. .reg = { "csid2" },
  1124. .interrupt = { "csid2" },
  1125. .csid = {
  1126. .is_lite = true,
  1127. .hw_ops = &csid_ops_gen2,
  1128. .parent_dev_ops = &vfe_parent_dev_ops,
  1129. .formats = &csid_formats_gen2
  1130. }
  1131. }
  1132. };
  1133. static const struct camss_subdev_resources vfe_res_670[] = {
  1134. /* VFE0 */
  1135. {
  1136. .regulators = {},
  1137. .clock = { "camnoc_axi", "cpas_ahb", "soc_ahb",
  1138. "vfe0", "vfe0_axi" },
  1139. .clock_rate = { { 0 },
  1140. { 0 },
  1141. { 0 },
  1142. { 100000000, 320000000, 404000000, 480000000, 600000000 },
  1143. { 0 } },
  1144. .reg = { "vfe0" },
  1145. .interrupt = { "vfe0" },
  1146. .vfe = {
  1147. .line_num = 4,
  1148. .has_pd = true,
  1149. .pd_name = "ife0",
  1150. .hw_ops = &vfe_ops_170,
  1151. .formats_rdi = &vfe_formats_rdi_845,
  1152. .formats_pix = &vfe_formats_pix_845
  1153. }
  1154. },
  1155. /* VFE1 */
  1156. {
  1157. .regulators = {},
  1158. .clock = { "camnoc_axi", "cpas_ahb", "soc_ahb",
  1159. "vfe1", "vfe1_axi" },
  1160. .clock_rate = { { 0 },
  1161. { 0 },
  1162. { 0 },
  1163. { 100000000, 320000000, 404000000, 480000000, 600000000 },
  1164. { 0 } },
  1165. .reg = { "vfe1" },
  1166. .interrupt = { "vfe1" },
  1167. .vfe = {
  1168. .line_num = 4,
  1169. .has_pd = true,
  1170. .pd_name = "ife1",
  1171. .hw_ops = &vfe_ops_170,
  1172. .formats_rdi = &vfe_formats_rdi_845,
  1173. .formats_pix = &vfe_formats_pix_845
  1174. }
  1175. },
  1176. /* VFE-lite */
  1177. {
  1178. .regulators = {},
  1179. .clock = { "camnoc_axi", "cpas_ahb", "soc_ahb",
  1180. "vfe_lite" },
  1181. .clock_rate = { { 0 },
  1182. { 0 },
  1183. { 0 },
  1184. { 100000000, 320000000, 404000000, 480000000, 600000000 } },
  1185. .reg = { "vfe_lite" },
  1186. .interrupt = { "vfe_lite" },
  1187. .vfe = {
  1188. .is_lite = true,
  1189. .line_num = 4,
  1190. .hw_ops = &vfe_ops_170,
  1191. .formats_rdi = &vfe_formats_rdi_845,
  1192. .formats_pix = &vfe_formats_pix_845
  1193. }
  1194. }
  1195. };
  1196. static const struct camss_subdev_resources csiphy_res_845[] = {
  1197. /* CSIPHY0 */
  1198. {
  1199. .regulators = {},
  1200. .clock = { "camnoc_axi", "soc_ahb", "slow_ahb_src",
  1201. "cpas_ahb", "cphy_rx_src", "csiphy0",
  1202. "csiphy0_timer_src", "csiphy0_timer" },
  1203. .clock_rate = { { 0 },
  1204. { 0 },
  1205. { 0 },
  1206. { 0 },
  1207. { 0 },
  1208. { 0 },
  1209. { 0 },
  1210. { 19200000, 240000000, 269333333 } },
  1211. .reg = { "csiphy0" },
  1212. .interrupt = { "csiphy0" },
  1213. .csiphy = {
  1214. .id = 0,
  1215. .hw_ops = &csiphy_ops_3ph_1_0,
  1216. .formats = &csiphy_formats_sdm845
  1217. }
  1218. },
  1219. /* CSIPHY1 */
  1220. {
  1221. .regulators = {},
  1222. .clock = { "camnoc_axi", "soc_ahb", "slow_ahb_src",
  1223. "cpas_ahb", "cphy_rx_src", "csiphy1",
  1224. "csiphy1_timer_src", "csiphy1_timer" },
  1225. .clock_rate = { { 0 },
  1226. { 0 },
  1227. { 0 },
  1228. { 0 },
  1229. { 0 },
  1230. { 0 },
  1231. { 0 },
  1232. { 19200000, 240000000, 269333333 } },
  1233. .reg = { "csiphy1" },
  1234. .interrupt = { "csiphy1" },
  1235. .csiphy = {
  1236. .id = 1,
  1237. .hw_ops = &csiphy_ops_3ph_1_0,
  1238. .formats = &csiphy_formats_sdm845
  1239. }
  1240. },
  1241. /* CSIPHY2 */
  1242. {
  1243. .regulators = {},
  1244. .clock = { "camnoc_axi", "soc_ahb", "slow_ahb_src",
  1245. "cpas_ahb", "cphy_rx_src", "csiphy2",
  1246. "csiphy2_timer_src", "csiphy2_timer" },
  1247. .clock_rate = { { 0 },
  1248. { 0 },
  1249. { 0 },
  1250. { 0 },
  1251. { 0 },
  1252. { 0 },
  1253. { 0 },
  1254. { 19200000, 240000000, 269333333 } },
  1255. .reg = { "csiphy2" },
  1256. .interrupt = { "csiphy2" },
  1257. .csiphy = {
  1258. .id = 2,
  1259. .hw_ops = &csiphy_ops_3ph_1_0,
  1260. .formats = &csiphy_formats_sdm845
  1261. }
  1262. },
  1263. /* CSIPHY3 */
  1264. {
  1265. .regulators = {},
  1266. .clock = { "camnoc_axi", "soc_ahb", "slow_ahb_src",
  1267. "cpas_ahb", "cphy_rx_src", "csiphy3",
  1268. "csiphy3_timer_src", "csiphy3_timer" },
  1269. .clock_rate = { { 0 },
  1270. { 0 },
  1271. { 0 },
  1272. { 0 },
  1273. { 0 },
  1274. { 0 },
  1275. { 0 },
  1276. { 19200000, 240000000, 269333333 } },
  1277. .reg = { "csiphy3" },
  1278. .interrupt = { "csiphy3" },
  1279. .csiphy = {
  1280. .id = 3,
  1281. .hw_ops = &csiphy_ops_3ph_1_0,
  1282. .formats = &csiphy_formats_sdm845
  1283. }
  1284. }
  1285. };
  1286. static const struct camss_subdev_resources csid_res_845[] = {
  1287. /* CSID0 */
  1288. {
  1289. .regulators = {
  1290. { .supply = "vdda-phy", .init_load_uA = 0 },
  1291. { .supply = "vdda-pll", .init_load_uA = 0 }
  1292. },
  1293. .clock = { "cpas_ahb", "cphy_rx_src", "slow_ahb_src",
  1294. "soc_ahb", "vfe0", "vfe0_src",
  1295. "vfe0_cphy_rx", "csi0",
  1296. "csi0_src" },
  1297. .clock_rate = { { 0 },
  1298. { 384000000 },
  1299. { 80000000 },
  1300. { 0 },
  1301. { 19200000, 100000000, 320000000, 404000000, 480000000, 600000000 },
  1302. { 320000000 },
  1303. { 0 },
  1304. { 19200000, 75000000, 384000000, 538666667 },
  1305. { 384000000 } },
  1306. .reg = { "csid0" },
  1307. .interrupt = { "csid0" },
  1308. .csid = {
  1309. .hw_ops = &csid_ops_gen2,
  1310. .parent_dev_ops = &vfe_parent_dev_ops,
  1311. .formats = &csid_formats_gen2
  1312. }
  1313. },
  1314. /* CSID1 */
  1315. {
  1316. .regulators = {
  1317. { .supply = "vdda-phy", .init_load_uA = 0 },
  1318. { .supply = "vdda-pll", .init_load_uA = 0 }
  1319. },
  1320. .clock = { "cpas_ahb", "cphy_rx_src", "slow_ahb_src",
  1321. "soc_ahb", "vfe1", "vfe1_src",
  1322. "vfe1_cphy_rx", "csi1",
  1323. "csi1_src" },
  1324. .clock_rate = { { 0 },
  1325. { 384000000 },
  1326. { 80000000 },
  1327. { 0 },
  1328. { 19200000, 100000000, 320000000, 404000000, 480000000, 600000000 },
  1329. { 320000000 },
  1330. { 0 },
  1331. { 19200000, 75000000, 384000000, 538666667 },
  1332. { 384000000 } },
  1333. .reg = { "csid1" },
  1334. .interrupt = { "csid1" },
  1335. .csid = {
  1336. .hw_ops = &csid_ops_gen2,
  1337. .parent_dev_ops = &vfe_parent_dev_ops,
  1338. .formats = &csid_formats_gen2
  1339. }
  1340. },
  1341. /* CSID2 */
  1342. {
  1343. .regulators = {
  1344. { .supply = "vdda-phy", .init_load_uA = 0 },
  1345. { .supply = "vdda-pll", .init_load_uA = 0 }
  1346. },
  1347. .clock = { "cpas_ahb", "cphy_rx_src", "slow_ahb_src",
  1348. "soc_ahb", "vfe_lite", "vfe_lite_src",
  1349. "vfe_lite_cphy_rx", "csi2",
  1350. "csi2_src" },
  1351. .clock_rate = { { 0 },
  1352. { 384000000 },
  1353. { 80000000 },
  1354. { 0 },
  1355. { 19200000, 100000000, 320000000, 404000000, 480000000, 600000000 },
  1356. { 320000000 },
  1357. { 0 },
  1358. { 19200000, 75000000, 384000000, 538666667 },
  1359. { 384000000 } },
  1360. .reg = { "csid2" },
  1361. .interrupt = { "csid2" },
  1362. .csid = {
  1363. .is_lite = true,
  1364. .hw_ops = &csid_ops_gen2,
  1365. .parent_dev_ops = &vfe_parent_dev_ops,
  1366. .formats = &csid_formats_gen2
  1367. }
  1368. }
  1369. };
  1370. static const struct camss_subdev_resources vfe_res_845[] = {
  1371. /* VFE0 */
  1372. {
  1373. .regulators = {},
  1374. .clock = { "camnoc_axi", "cpas_ahb", "slow_ahb_src",
  1375. "soc_ahb", "vfe0", "vfe0_axi",
  1376. "vfe0_src", "csi0",
  1377. "csi0_src"},
  1378. .clock_rate = { { 0 },
  1379. { 0 },
  1380. { 80000000 },
  1381. { 0 },
  1382. { 19200000, 100000000, 320000000, 404000000, 480000000, 600000000 },
  1383. { 0 },
  1384. { 320000000 },
  1385. { 19200000, 75000000, 384000000, 538666667 },
  1386. { 384000000 } },
  1387. .reg = { "vfe0" },
  1388. .interrupt = { "vfe0" },
  1389. .vfe = {
  1390. .line_num = 4,
  1391. .pd_name = "ife0",
  1392. .has_pd = true,
  1393. .hw_ops = &vfe_ops_170,
  1394. .formats_rdi = &vfe_formats_rdi_845,
  1395. .formats_pix = &vfe_formats_pix_845
  1396. }
  1397. },
  1398. /* VFE1 */
  1399. {
  1400. .regulators = {},
  1401. .clock = { "camnoc_axi", "cpas_ahb", "slow_ahb_src",
  1402. "soc_ahb", "vfe1", "vfe1_axi",
  1403. "vfe1_src", "csi1",
  1404. "csi1_src"},
  1405. .clock_rate = { { 0 },
  1406. { 0 },
  1407. { 80000000 },
  1408. { 0 },
  1409. { 19200000, 100000000, 320000000, 404000000, 480000000, 600000000 },
  1410. { 0 },
  1411. { 320000000 },
  1412. { 19200000, 75000000, 384000000, 538666667 },
  1413. { 384000000 } },
  1414. .reg = { "vfe1" },
  1415. .interrupt = { "vfe1" },
  1416. .vfe = {
  1417. .line_num = 4,
  1418. .pd_name = "ife1",
  1419. .has_pd = true,
  1420. .hw_ops = &vfe_ops_170,
  1421. .formats_rdi = &vfe_formats_rdi_845,
  1422. .formats_pix = &vfe_formats_pix_845
  1423. }
  1424. },
  1425. /* VFE-lite */
  1426. {
  1427. .regulators = {},
  1428. .clock = { "camnoc_axi", "cpas_ahb", "slow_ahb_src",
  1429. "soc_ahb", "vfe_lite",
  1430. "vfe_lite_src", "csi2",
  1431. "csi2_src"},
  1432. .clock_rate = { { 0 },
  1433. { 0 },
  1434. { 80000000 },
  1435. { 0 },
  1436. { 19200000, 100000000, 320000000, 404000000, 480000000, 600000000 },
  1437. { 320000000 },
  1438. { 19200000, 75000000, 384000000, 538666667 },
  1439. { 384000000 } },
  1440. .reg = { "vfe_lite" },
  1441. .interrupt = { "vfe_lite" },
  1442. .vfe = {
  1443. .is_lite = true,
  1444. .line_num = 4,
  1445. .hw_ops = &vfe_ops_170,
  1446. .formats_rdi = &vfe_formats_rdi_845,
  1447. .formats_pix = &vfe_formats_pix_845
  1448. }
  1449. }
  1450. };
  1451. static const struct camss_subdev_resources csiphy_res_sm6150[] = {
  1452. /* CSIPHY0 */
  1453. {
  1454. .regulators = {
  1455. { .supply = "vdd-csiphy-1p2", .init_load_uA = 35000 },
  1456. { .supply = "vdd-csiphy-1p8", .init_load_uA = 5000 }
  1457. },
  1458. .clock = { "csiphy0", "csiphy0_timer" },
  1459. .clock_rate = { { 269333333, 384000000 },
  1460. { 269333333 } },
  1461. .reg = { "csiphy0" },
  1462. .interrupt = { "csiphy0" },
  1463. .csiphy = {
  1464. .id = 0,
  1465. .hw_ops = &csiphy_ops_3ph_1_0,
  1466. .formats = &csiphy_formats_sdm845
  1467. }
  1468. },
  1469. /* CSIPHY1 */
  1470. {
  1471. .regulators = {
  1472. { .supply = "vdd-csiphy-1p2", .init_load_uA = 35000 },
  1473. { .supply = "vdd-csiphy-1p8", .init_load_uA = 5000 }
  1474. },
  1475. .clock = { "csiphy1", "csiphy1_timer" },
  1476. .clock_rate = { { 269333333, 384000000 },
  1477. { 269333333 } },
  1478. .reg = { "csiphy1" },
  1479. .interrupt = { "csiphy1" },
  1480. .csiphy = {
  1481. .id = 1,
  1482. .hw_ops = &csiphy_ops_3ph_1_0,
  1483. .formats = &csiphy_formats_sdm845
  1484. }
  1485. },
  1486. /* CSIPHY2 */
  1487. {
  1488. .regulators = {
  1489. { .supply = "vdd-csiphy-1p2", .init_load_uA = 35000 },
  1490. { .supply = "vdd-csiphy-1p8", .init_load_uA = 5000 }
  1491. },
  1492. .clock = { "csiphy2", "csiphy2_timer" },
  1493. .clock_rate = { { 269333333, 384000000 },
  1494. { 269333333 } },
  1495. .reg = { "csiphy2" },
  1496. .interrupt = { "csiphy2" },
  1497. .csiphy = {
  1498. .id = 2,
  1499. .hw_ops = &csiphy_ops_3ph_1_0,
  1500. .formats = &csiphy_formats_sdm845
  1501. }
  1502. },
  1503. };
  1504. static const struct camss_subdev_resources csid_res_sm6150[] = {
  1505. /* CSID0 */
  1506. {
  1507. .regulators = {},
  1508. .clock = { "vfe0_cphy_rx", "vfe0_csid" },
  1509. .clock_rate = { { 269333333, 384000000 },
  1510. { 320000000, 540000000 } },
  1511. .reg = { "csid0" },
  1512. .interrupt = { "csid0" },
  1513. .csid = {
  1514. .is_lite = false,
  1515. .hw_ops = &csid_ops_gen2,
  1516. .parent_dev_ops = &vfe_parent_dev_ops,
  1517. .formats = &csid_formats_gen2
  1518. }
  1519. },
  1520. /* CSID1 */
  1521. {
  1522. .regulators = {},
  1523. .clock = { "vfe1_cphy_rx", "vfe1_csid" },
  1524. .clock_rate = { { 269333333, 384000000 },
  1525. { 320000000, 540000000 } },
  1526. .reg = { "csid1" },
  1527. .interrupt = { "csid1" },
  1528. .csid = {
  1529. .is_lite = false,
  1530. .hw_ops = &csid_ops_gen2,
  1531. .parent_dev_ops = &vfe_parent_dev_ops,
  1532. .formats = &csid_formats_gen2
  1533. }
  1534. },
  1535. /* CSID2 */
  1536. {
  1537. .regulators = {},
  1538. .clock = { "vfe_lite_cphy_rx", "vfe_lite_csid" },
  1539. .clock_rate = { { 269333333, 384000000 },
  1540. { 320000000, 540000000 } },
  1541. .reg = { "csid_lite" },
  1542. .interrupt = { "csid_lite" },
  1543. .csid = {
  1544. .is_lite = true,
  1545. .hw_ops = &csid_ops_gen2,
  1546. .parent_dev_ops = &vfe_parent_dev_ops,
  1547. .formats = &csid_formats_gen2
  1548. }
  1549. },
  1550. };
  1551. static const struct camss_subdev_resources vfe_res_sm6150[] = {
  1552. /* VFE0 */
  1553. {
  1554. .regulators = {},
  1555. .clock = { "gcc_axi_hf", "camnoc_axi", "cpas_ahb", "soc_ahb",
  1556. "vfe0", "vfe0_axi"},
  1557. .clock_rate = { { 0 },
  1558. { 0 },
  1559. { 80000000 },
  1560. { 37500000, 40000000 },
  1561. { 360000000, 432000000, 540000000, 600000000 },
  1562. { 265000000, 426000000 } },
  1563. .reg = { "vfe0" },
  1564. .interrupt = { "vfe0" },
  1565. .vfe = {
  1566. .line_num = 3,
  1567. .is_lite = false,
  1568. .has_pd = true,
  1569. .pd_name = "ife0",
  1570. .hw_ops = &vfe_ops_170,
  1571. .formats_rdi = &vfe_formats_rdi_845,
  1572. .formats_pix = &vfe_formats_pix_845
  1573. }
  1574. },
  1575. /* VFE1 */
  1576. {
  1577. .regulators = {},
  1578. .clock = { "gcc_axi_hf", "camnoc_axi", "cpas_ahb", "soc_ahb",
  1579. "vfe1", "vfe1_axi"},
  1580. .clock_rate = { { 0 },
  1581. { 0 },
  1582. { 80000000 },
  1583. { 37500000, 40000000 },
  1584. { 360000000, 432000000, 540000000, 600000000 },
  1585. { 265000000, 426000000 } },
  1586. .reg = { "vfe1" },
  1587. .interrupt = { "vfe1" },
  1588. .vfe = {
  1589. .line_num = 3,
  1590. .is_lite = false,
  1591. .has_pd = true,
  1592. .pd_name = "ife1",
  1593. .hw_ops = &vfe_ops_170,
  1594. .formats_rdi = &vfe_formats_rdi_845,
  1595. .formats_pix = &vfe_formats_pix_845
  1596. }
  1597. },
  1598. /* VFE2 */
  1599. {
  1600. .regulators = {},
  1601. .clock = { "gcc_axi_hf", "camnoc_axi", "cpas_ahb", "soc_ahb",
  1602. "vfe_lite" },
  1603. .clock_rate = { { 0 },
  1604. { 0 },
  1605. { 80000000 },
  1606. { 37500000, 40000000 },
  1607. { 360000000, 432000000, 540000000, 600000000 } },
  1608. .reg = { "vfe_lite" },
  1609. .interrupt = { "vfe_lite" },
  1610. .vfe = {
  1611. .line_num = 4,
  1612. .is_lite = true,
  1613. .hw_ops = &vfe_ops_170,
  1614. .formats_rdi = &vfe_formats_rdi_845,
  1615. .formats_pix = &vfe_formats_pix_845
  1616. }
  1617. },
  1618. };
  1619. static const struct resources_icc icc_res_sm6150[] = {
  1620. {
  1621. .name = "ahb",
  1622. .icc_bw_tbl.avg = 38400,
  1623. .icc_bw_tbl.peak = 76800,
  1624. },
  1625. {
  1626. .name = "hf_0",
  1627. .icc_bw_tbl.avg = 2097152,
  1628. .icc_bw_tbl.peak = 2097152,
  1629. },
  1630. };
  1631. static const struct camss_subdev_resources csiphy_res_8250[] = {
  1632. /* CSIPHY0 */
  1633. {
  1634. .regulators = {
  1635. { .supply = "vdda-phy", .init_load_uA = 17500 },
  1636. { .supply = "vdda-pll", .init_load_uA = 10000 }
  1637. },
  1638. .clock = { "csiphy0", "csiphy0_timer" },
  1639. .clock_rate = { { 400000000 },
  1640. { 300000000 } },
  1641. .reg = { "csiphy0" },
  1642. .interrupt = { "csiphy0" },
  1643. .csiphy = {
  1644. .id = 0,
  1645. .hw_ops = &csiphy_ops_3ph_1_0,
  1646. .formats = &csiphy_formats_sdm845
  1647. }
  1648. },
  1649. /* CSIPHY1 */
  1650. {
  1651. .regulators = {
  1652. { .supply = "vdda-phy", .init_load_uA = 17500 },
  1653. { .supply = "vdda-pll", .init_load_uA = 10000 }
  1654. },
  1655. .clock = { "csiphy1", "csiphy1_timer" },
  1656. .clock_rate = { { 400000000 },
  1657. { 300000000 } },
  1658. .reg = { "csiphy1" },
  1659. .interrupt = { "csiphy1" },
  1660. .csiphy = {
  1661. .id = 1,
  1662. .hw_ops = &csiphy_ops_3ph_1_0,
  1663. .formats = &csiphy_formats_sdm845
  1664. }
  1665. },
  1666. /* CSIPHY2 */
  1667. {
  1668. .regulators = {
  1669. { .supply = "vdda-phy", .init_load_uA = 17500 },
  1670. { .supply = "vdda-pll", .init_load_uA = 10000 }
  1671. },
  1672. .clock = { "csiphy2", "csiphy2_timer" },
  1673. .clock_rate = { { 400000000 },
  1674. { 300000000 } },
  1675. .reg = { "csiphy2" },
  1676. .interrupt = { "csiphy2" },
  1677. .csiphy = {
  1678. .id = 2,
  1679. .hw_ops = &csiphy_ops_3ph_1_0,
  1680. .formats = &csiphy_formats_sdm845
  1681. }
  1682. },
  1683. /* CSIPHY3 */
  1684. {
  1685. .regulators = {
  1686. { .supply = "vdda-phy", .init_load_uA = 17500 },
  1687. { .supply = "vdda-pll", .init_load_uA = 10000 }
  1688. },
  1689. .clock = { "csiphy3", "csiphy3_timer" },
  1690. .clock_rate = { { 400000000 },
  1691. { 300000000 } },
  1692. .reg = { "csiphy3" },
  1693. .interrupt = { "csiphy3" },
  1694. .csiphy = {
  1695. .id = 3,
  1696. .hw_ops = &csiphy_ops_3ph_1_0,
  1697. .formats = &csiphy_formats_sdm845
  1698. }
  1699. },
  1700. /* CSIPHY4 */
  1701. {
  1702. .regulators = {
  1703. { .supply = "vdda-phy", .init_load_uA = 17500 },
  1704. { .supply = "vdda-pll", .init_load_uA = 10000 }
  1705. },
  1706. .clock = { "csiphy4", "csiphy4_timer" },
  1707. .clock_rate = { { 400000000 },
  1708. { 300000000 } },
  1709. .reg = { "csiphy4" },
  1710. .interrupt = { "csiphy4" },
  1711. .csiphy = {
  1712. .id = 4,
  1713. .hw_ops = &csiphy_ops_3ph_1_0,
  1714. .formats = &csiphy_formats_sdm845
  1715. }
  1716. },
  1717. /* CSIPHY5 */
  1718. {
  1719. .regulators = {
  1720. { .supply = "vdda-phy", .init_load_uA = 17500 },
  1721. { .supply = "vdda-pll", .init_load_uA = 10000 }
  1722. },
  1723. .clock = { "csiphy5", "csiphy5_timer" },
  1724. .clock_rate = { { 400000000 },
  1725. { 300000000 } },
  1726. .reg = { "csiphy5" },
  1727. .interrupt = { "csiphy5" },
  1728. .csiphy = {
  1729. .id = 5,
  1730. .hw_ops = &csiphy_ops_3ph_1_0,
  1731. .formats = &csiphy_formats_sdm845
  1732. }
  1733. }
  1734. };
  1735. static const struct camss_subdev_resources csid_res_8250[] = {
  1736. /* CSID0 */
  1737. {
  1738. .regulators = {},
  1739. .clock = { "vfe0_csid", "vfe0_cphy_rx", "vfe0", "vfe0_areg", "vfe0_ahb" },
  1740. .clock_rate = { { 400000000 },
  1741. { 400000000 },
  1742. { 350000000, 475000000, 576000000, 720000000 },
  1743. { 100000000, 200000000, 300000000, 400000000 },
  1744. { 0 } },
  1745. .reg = { "csid0" },
  1746. .interrupt = { "csid0" },
  1747. .csid = {
  1748. .hw_ops = &csid_ops_gen2,
  1749. .parent_dev_ops = &vfe_parent_dev_ops,
  1750. .formats = &csid_formats_gen2
  1751. }
  1752. },
  1753. /* CSID1 */
  1754. {
  1755. .regulators = {},
  1756. .clock = { "vfe1_csid", "vfe1_cphy_rx", "vfe1", "vfe1_areg", "vfe1_ahb" },
  1757. .clock_rate = { { 400000000 },
  1758. { 400000000 },
  1759. { 350000000, 475000000, 576000000, 720000000 },
  1760. { 100000000, 200000000, 300000000, 400000000 },
  1761. { 0 } },
  1762. .reg = { "csid1" },
  1763. .interrupt = { "csid1" },
  1764. .csid = {
  1765. .hw_ops = &csid_ops_gen2,
  1766. .parent_dev_ops = &vfe_parent_dev_ops,
  1767. .formats = &csid_formats_gen2
  1768. }
  1769. },
  1770. /* CSID2 */
  1771. {
  1772. .regulators = {},
  1773. .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx", "vfe_lite", "vfe_lite_ahb" },
  1774. .clock_rate = { { 400000000 },
  1775. { 400000000 },
  1776. { 400000000, 480000000 },
  1777. { 0 } },
  1778. .reg = { "csid2" },
  1779. .interrupt = { "csid2" },
  1780. .csid = {
  1781. .is_lite = true,
  1782. .hw_ops = &csid_ops_gen2,
  1783. .parent_dev_ops = &vfe_parent_dev_ops,
  1784. .formats = &csid_formats_gen2
  1785. }
  1786. },
  1787. /* CSID3 */
  1788. {
  1789. .regulators = {},
  1790. .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx", "vfe_lite", "vfe_lite_ahb" },
  1791. .clock_rate = { { 400000000 },
  1792. { 400000000 },
  1793. { 400000000, 480000000 },
  1794. { 0 } },
  1795. .reg = { "csid3" },
  1796. .interrupt = { "csid3" },
  1797. .csid = {
  1798. .is_lite = true,
  1799. .hw_ops = &csid_ops_gen2,
  1800. .parent_dev_ops = &vfe_parent_dev_ops,
  1801. .formats = &csid_formats_gen2
  1802. }
  1803. }
  1804. };
  1805. static const struct camss_subdev_resources vfe_res_8250[] = {
  1806. /* VFE0 */
  1807. {
  1808. .regulators = {},
  1809. .clock = { "camnoc_axi_src", "slow_ahb_src", "cpas_ahb",
  1810. "camnoc_axi", "vfe0_ahb", "vfe0_areg", "vfe0",
  1811. "vfe0_axi", "cam_hf_axi" },
  1812. .clock_rate = { { 19200000, 300000000, 400000000, 480000000 },
  1813. { 19200000, 80000000 },
  1814. { 19200000 },
  1815. { 0 },
  1816. { 0 },
  1817. { 100000000, 200000000, 300000000, 400000000 },
  1818. { 350000000, 475000000, 576000000, 720000000 },
  1819. { 0 },
  1820. { 0 } },
  1821. .reg = { "vfe0" },
  1822. .interrupt = { "vfe0" },
  1823. .vfe = {
  1824. .line_num = 3,
  1825. .has_pd = true,
  1826. .pd_name = "ife0",
  1827. .hw_ops = &vfe_ops_480,
  1828. .formats_rdi = &vfe_formats_rdi_845,
  1829. .formats_pix = &vfe_formats_pix_845
  1830. }
  1831. },
  1832. /* VFE1 */
  1833. {
  1834. .regulators = {},
  1835. .clock = { "camnoc_axi_src", "slow_ahb_src", "cpas_ahb",
  1836. "camnoc_axi", "vfe1_ahb", "vfe1_areg", "vfe1",
  1837. "vfe1_axi", "cam_hf_axi" },
  1838. .clock_rate = { { 19200000, 300000000, 400000000, 480000000 },
  1839. { 19200000, 80000000 },
  1840. { 19200000 },
  1841. { 0 },
  1842. { 0 },
  1843. { 100000000, 200000000, 300000000, 400000000 },
  1844. { 350000000, 475000000, 576000000, 720000000 },
  1845. { 0 },
  1846. { 0 } },
  1847. .reg = { "vfe1" },
  1848. .interrupt = { "vfe1" },
  1849. .vfe = {
  1850. .line_num = 3,
  1851. .has_pd = true,
  1852. .pd_name = "ife1",
  1853. .hw_ops = &vfe_ops_480,
  1854. .formats_rdi = &vfe_formats_rdi_845,
  1855. .formats_pix = &vfe_formats_pix_845
  1856. }
  1857. },
  1858. /* VFE2 (lite) */
  1859. {
  1860. .regulators = {},
  1861. .clock = { "camnoc_axi_src", "slow_ahb_src", "cpas_ahb",
  1862. "camnoc_axi", "vfe_lite_ahb", "vfe_lite_axi",
  1863. "vfe_lite", "cam_hf_axi" },
  1864. .clock_rate = { { 19200000, 300000000, 400000000, 480000000 },
  1865. { 19200000, 80000000 },
  1866. { 19200000 },
  1867. { 0 },
  1868. { 0 },
  1869. { 0 },
  1870. { 400000000, 480000000 },
  1871. { 0 } },
  1872. .reg = { "vfe_lite0" },
  1873. .interrupt = { "vfe_lite0" },
  1874. .vfe = {
  1875. .is_lite = true,
  1876. .line_num = 4,
  1877. .hw_ops = &vfe_ops_480,
  1878. .formats_rdi = &vfe_formats_rdi_845,
  1879. .formats_pix = &vfe_formats_pix_845
  1880. }
  1881. },
  1882. /* VFE3 (lite) */
  1883. {
  1884. .regulators = {},
  1885. .clock = { "camnoc_axi_src", "slow_ahb_src", "cpas_ahb",
  1886. "camnoc_axi", "vfe_lite_ahb", "vfe_lite_axi",
  1887. "vfe_lite", "cam_hf_axi" },
  1888. .clock_rate = { { 19200000, 300000000, 400000000, 480000000 },
  1889. { 19200000, 80000000 },
  1890. { 19200000 },
  1891. { 0 },
  1892. { 0 },
  1893. { 0 },
  1894. { 400000000, 480000000 },
  1895. { 0 } },
  1896. .reg = { "vfe_lite1" },
  1897. .interrupt = { "vfe_lite1" },
  1898. .vfe = {
  1899. .is_lite = true,
  1900. .line_num = 4,
  1901. .hw_ops = &vfe_ops_480,
  1902. .formats_rdi = &vfe_formats_rdi_845,
  1903. .formats_pix = &vfe_formats_pix_845
  1904. }
  1905. },
  1906. };
  1907. static const struct resources_icc icc_res_sm8250[] = {
  1908. {
  1909. .name = "cam_ahb",
  1910. .icc_bw_tbl.avg = 38400,
  1911. .icc_bw_tbl.peak = 76800,
  1912. },
  1913. {
  1914. .name = "cam_hf_0_mnoc",
  1915. .icc_bw_tbl.avg = 2097152,
  1916. .icc_bw_tbl.peak = 2097152,
  1917. },
  1918. {
  1919. .name = "cam_sf_0_mnoc",
  1920. .icc_bw_tbl.avg = 0,
  1921. .icc_bw_tbl.peak = 2097152,
  1922. },
  1923. {
  1924. .name = "cam_sf_icp_mnoc",
  1925. .icc_bw_tbl.avg = 2097152,
  1926. .icc_bw_tbl.peak = 2097152,
  1927. },
  1928. };
  1929. static const struct camss_subdev_resources csiphy_res_7280[] = {
  1930. /* CSIPHY0 */
  1931. {
  1932. .regulators = {
  1933. { .supply = "vdda-phy", .init_load_uA = 16100 },
  1934. { .supply = "vdda-pll", .init_load_uA = 9000 }
  1935. },
  1936. .clock = { "csiphy0", "csiphy0_timer" },
  1937. .clock_rate = { { 300000000, 400000000 },
  1938. { 300000000 } },
  1939. .reg = { "csiphy0" },
  1940. .interrupt = { "csiphy0" },
  1941. .csiphy = {
  1942. .id = 0,
  1943. .hw_ops = &csiphy_ops_3ph_1_0,
  1944. .formats = &csiphy_formats_sdm845,
  1945. }
  1946. },
  1947. /* CSIPHY1 */
  1948. {
  1949. .regulators = {
  1950. { .supply = "vdda-phy", .init_load_uA = 16100 },
  1951. { .supply = "vdda-pll", .init_load_uA = 9000 }
  1952. },
  1953. .clock = { "csiphy1", "csiphy1_timer" },
  1954. .clock_rate = { { 300000000, 400000000 },
  1955. { 300000000 } },
  1956. .reg = { "csiphy1" },
  1957. .interrupt = { "csiphy1" },
  1958. .csiphy = {
  1959. .id = 1,
  1960. .hw_ops = &csiphy_ops_3ph_1_0,
  1961. .formats = &csiphy_formats_sdm845,
  1962. }
  1963. },
  1964. /* CSIPHY2 */
  1965. {
  1966. .regulators = {
  1967. { .supply = "vdda-phy", .init_load_uA = 16100 },
  1968. { .supply = "vdda-pll", .init_load_uA = 9000 }
  1969. },
  1970. .clock = { "csiphy2", "csiphy2_timer" },
  1971. .clock_rate = { { 300000000, 400000000 },
  1972. { 300000000 } },
  1973. .reg = { "csiphy2" },
  1974. .interrupt = { "csiphy2" },
  1975. .csiphy = {
  1976. .id = 2,
  1977. .hw_ops = &csiphy_ops_3ph_1_0,
  1978. .formats = &csiphy_formats_sdm845,
  1979. }
  1980. },
  1981. /* CSIPHY3 */
  1982. {
  1983. .regulators = {
  1984. { .supply = "vdda-phy", .init_load_uA = 16100 },
  1985. { .supply = "vdda-pll", .init_load_uA = 9000 }
  1986. },
  1987. .clock = { "csiphy3", "csiphy3_timer" },
  1988. .clock_rate = { { 300000000, 400000000 },
  1989. { 300000000 } },
  1990. .reg = { "csiphy3" },
  1991. .interrupt = { "csiphy3" },
  1992. .csiphy = {
  1993. .id = 3,
  1994. .hw_ops = &csiphy_ops_3ph_1_0,
  1995. .formats = &csiphy_formats_sdm845,
  1996. }
  1997. },
  1998. /* CSIPHY4 */
  1999. {
  2000. .regulators = {
  2001. { .supply = "vdda-phy", .init_load_uA = 16100 },
  2002. { .supply = "vdda-pll", .init_load_uA = 9000 }
  2003. },
  2004. .clock = { "csiphy4", "csiphy4_timer" },
  2005. .clock_rate = { { 300000000, 400000000 },
  2006. { 300000000 } },
  2007. .reg = { "csiphy4" },
  2008. .interrupt = { "csiphy4" },
  2009. .csiphy = {
  2010. .id = 4,
  2011. .hw_ops = &csiphy_ops_3ph_1_0,
  2012. .formats = &csiphy_formats_sdm845,
  2013. }
  2014. },
  2015. };
  2016. static const struct camss_subdev_resources csid_res_7280[] = {
  2017. /* CSID0 */
  2018. {
  2019. .regulators = {},
  2020. .clock = { "vfe0_csid", "vfe0_cphy_rx", "vfe0" },
  2021. .clock_rate = { { 300000000, 400000000 },
  2022. { 0 },
  2023. { 380000000, 510000000, 637000000, 760000000 }
  2024. },
  2025. .reg = { "csid0" },
  2026. .interrupt = { "csid0" },
  2027. .csid = {
  2028. .is_lite = false,
  2029. .hw_ops = &csid_ops_gen2,
  2030. .parent_dev_ops = &vfe_parent_dev_ops,
  2031. .formats = &csid_formats_gen2
  2032. }
  2033. },
  2034. /* CSID1 */
  2035. {
  2036. .regulators = {},
  2037. .clock = { "vfe1_csid", "vfe1_cphy_rx", "vfe1" },
  2038. .clock_rate = { { 300000000, 400000000 },
  2039. { 0 },
  2040. { 380000000, 510000000, 637000000, 760000000 }
  2041. },
  2042. .reg = { "csid1" },
  2043. .interrupt = { "csid1" },
  2044. .csid = {
  2045. .is_lite = false,
  2046. .hw_ops = &csid_ops_gen2,
  2047. .parent_dev_ops = &vfe_parent_dev_ops,
  2048. .formats = &csid_formats_gen2
  2049. }
  2050. },
  2051. /* CSID2 */
  2052. {
  2053. .regulators = {},
  2054. .clock = { "vfe2_csid", "vfe2_cphy_rx", "vfe2" },
  2055. .clock_rate = { { 300000000, 400000000 },
  2056. { 0 },
  2057. { 380000000, 510000000, 637000000, 760000000 }
  2058. },
  2059. .reg = { "csid2" },
  2060. .interrupt = { "csid2" },
  2061. .csid = {
  2062. .is_lite = false,
  2063. .hw_ops = &csid_ops_gen2,
  2064. .parent_dev_ops = &vfe_parent_dev_ops,
  2065. .formats = &csid_formats_gen2
  2066. }
  2067. },
  2068. /* CSID3 */
  2069. {
  2070. .regulators = {},
  2071. .clock = { "vfe_lite0_csid", "vfe_lite0_cphy_rx", "vfe_lite0" },
  2072. .clock_rate = { { 300000000, 400000000 },
  2073. { 0 },
  2074. { 320000000, 400000000, 480000000, 600000000 }
  2075. },
  2076. .reg = { "csid_lite0" },
  2077. .interrupt = { "csid_lite0" },
  2078. .csid = {
  2079. .is_lite = true,
  2080. .hw_ops = &csid_ops_gen2,
  2081. .parent_dev_ops = &vfe_parent_dev_ops,
  2082. .formats = &csid_formats_gen2
  2083. }
  2084. },
  2085. /* CSID4 */
  2086. {
  2087. .regulators = {},
  2088. .clock = { "vfe_lite1_csid", "vfe_lite1_cphy_rx", "vfe_lite1" },
  2089. .clock_rate = { { 300000000, 400000000 },
  2090. { 0 },
  2091. { 320000000, 400000000, 480000000, 600000000 }
  2092. },
  2093. .reg = { "csid_lite1" },
  2094. .interrupt = { "csid_lite1" },
  2095. .csid = {
  2096. .is_lite = true,
  2097. .hw_ops = &csid_ops_gen2,
  2098. .parent_dev_ops = &vfe_parent_dev_ops,
  2099. .formats = &csid_formats_gen2
  2100. }
  2101. },
  2102. };
  2103. static const struct camss_subdev_resources vfe_res_7280[] = {
  2104. /* VFE0 */
  2105. {
  2106. .regulators = {},
  2107. .clock = { "camnoc_axi", "cpas_ahb", "icp_ahb", "vfe0",
  2108. "vfe0_axi", "gcc_axi_hf", "gcc_axi_sf" },
  2109. .clock_rate = { { 150000000, 240000000, 320000000, 400000000, 480000000 },
  2110. { 80000000 },
  2111. { 0 },
  2112. { 380000000, 510000000, 637000000, 760000000 },
  2113. { 0 },
  2114. { 0 },
  2115. { 0 } },
  2116. .reg = { "vfe0" },
  2117. .interrupt = { "vfe0" },
  2118. .vfe = {
  2119. .line_num = 3,
  2120. .is_lite = false,
  2121. .has_pd = true,
  2122. .pd_name = "ife0",
  2123. .hw_ops = &vfe_ops_170,
  2124. .formats_rdi = &vfe_formats_rdi_845,
  2125. .formats_pix = &vfe_formats_pix_845
  2126. }
  2127. },
  2128. /* VFE1 */
  2129. {
  2130. .regulators = {},
  2131. .clock = { "camnoc_axi", "cpas_ahb", "icp_ahb", "vfe1",
  2132. "vfe1_axi", "gcc_axi_hf", "gcc_axi_sf" },
  2133. .clock_rate = { { 150000000, 240000000, 320000000, 400000000, 480000000 },
  2134. { 80000000 },
  2135. { 0 },
  2136. { 380000000, 510000000, 637000000, 760000000 },
  2137. { 0 },
  2138. { 0 },
  2139. { 0 } },
  2140. .reg = { "vfe1" },
  2141. .interrupt = { "vfe1" },
  2142. .vfe = {
  2143. .line_num = 3,
  2144. .is_lite = false,
  2145. .has_pd = true,
  2146. .pd_name = "ife1",
  2147. .hw_ops = &vfe_ops_170,
  2148. .formats_rdi = &vfe_formats_rdi_845,
  2149. .formats_pix = &vfe_formats_pix_845
  2150. }
  2151. },
  2152. /* VFE2 */
  2153. {
  2154. .regulators = {},
  2155. .clock = { "camnoc_axi", "cpas_ahb", "icp_ahb", "vfe2",
  2156. "vfe2_axi", "gcc_axi_hf", "gcc_axi_sf" },
  2157. .clock_rate = { { 150000000, 240000000, 320000000, 400000000, 480000000 },
  2158. { 80000000 },
  2159. { 0 },
  2160. { 380000000, 510000000, 637000000, 760000000 },
  2161. { 0 },
  2162. { 0 },
  2163. { 0 } },
  2164. .reg = { "vfe2" },
  2165. .interrupt = { "vfe2" },
  2166. .vfe = {
  2167. .line_num = 3,
  2168. .is_lite = false,
  2169. .hw_ops = &vfe_ops_170,
  2170. .has_pd = true,
  2171. .pd_name = "ife2",
  2172. .formats_rdi = &vfe_formats_rdi_845,
  2173. .formats_pix = &vfe_formats_pix_845
  2174. }
  2175. },
  2176. /* VFE3 (lite) */
  2177. {
  2178. .clock = { "camnoc_axi", "cpas_ahb", "icp_ahb",
  2179. "vfe_lite0", "gcc_axi_hf", "gcc_axi_sf" },
  2180. .clock_rate = { { 150000000, 240000000, 320000000, 400000000, 480000000 },
  2181. { 80000000 },
  2182. { 0 },
  2183. { 320000000, 400000000, 480000000, 600000000 },
  2184. { 0 },
  2185. { 0 } },
  2186. .regulators = {},
  2187. .reg = { "vfe_lite0" },
  2188. .interrupt = { "vfe_lite0" },
  2189. .vfe = {
  2190. .line_num = 4,
  2191. .is_lite = true,
  2192. .hw_ops = &vfe_ops_170,
  2193. .formats_rdi = &vfe_formats_rdi_845,
  2194. .formats_pix = &vfe_formats_pix_845
  2195. }
  2196. },
  2197. /* VFE4 (lite) */
  2198. {
  2199. .clock = { "camnoc_axi", "cpas_ahb", "icp_ahb",
  2200. "vfe_lite1", "gcc_axi_hf", "gcc_axi_sf" },
  2201. .clock_rate = { { 150000000, 240000000, 320000000, 400000000, 480000000 },
  2202. { 80000000 },
  2203. { 0 },
  2204. { 320000000, 400000000, 480000000, 600000000 },
  2205. { 0 },
  2206. { 0 } },
  2207. .regulators = {},
  2208. .reg = { "vfe_lite1" },
  2209. .interrupt = { "vfe_lite1" },
  2210. .vfe = {
  2211. .line_num = 4,
  2212. .is_lite = true,
  2213. .hw_ops = &vfe_ops_170,
  2214. .formats_rdi = &vfe_formats_rdi_845,
  2215. .formats_pix = &vfe_formats_pix_845
  2216. }
  2217. },
  2218. };
  2219. static const struct resources_icc icc_res_sc7280[] = {
  2220. {
  2221. .name = "ahb",
  2222. .icc_bw_tbl.avg = 38400,
  2223. .icc_bw_tbl.peak = 76800,
  2224. },
  2225. {
  2226. .name = "hf_0",
  2227. .icc_bw_tbl.avg = 2097152,
  2228. .icc_bw_tbl.peak = 2097152,
  2229. },
  2230. };
  2231. static const struct camss_subdev_resources csiphy_res_sc8280xp[] = {
  2232. /* CSIPHY0 */
  2233. {
  2234. .regulators = {},
  2235. .clock = { "csiphy0", "csiphy0_timer" },
  2236. .clock_rate = { { 400000000 },
  2237. { 300000000 } },
  2238. .reg = { "csiphy0" },
  2239. .interrupt = { "csiphy0" },
  2240. .csiphy = {
  2241. .id = 0,
  2242. .hw_ops = &csiphy_ops_3ph_1_0,
  2243. .formats = &csiphy_formats_sdm845
  2244. }
  2245. },
  2246. /* CSIPHY1 */
  2247. {
  2248. .regulators = {},
  2249. .clock = { "csiphy1", "csiphy1_timer" },
  2250. .clock_rate = { { 400000000 },
  2251. { 300000000 } },
  2252. .reg = { "csiphy1" },
  2253. .interrupt = { "csiphy1" },
  2254. .csiphy = {
  2255. .id = 1,
  2256. .hw_ops = &csiphy_ops_3ph_1_0,
  2257. .formats = &csiphy_formats_sdm845
  2258. }
  2259. },
  2260. /* CSIPHY2 */
  2261. {
  2262. .regulators = {},
  2263. .clock = { "csiphy2", "csiphy2_timer" },
  2264. .clock_rate = { { 400000000 },
  2265. { 300000000 } },
  2266. .reg = { "csiphy2" },
  2267. .interrupt = { "csiphy2" },
  2268. .csiphy = {
  2269. .id = 2,
  2270. .hw_ops = &csiphy_ops_3ph_1_0,
  2271. .formats = &csiphy_formats_sdm845
  2272. }
  2273. },
  2274. /* CSIPHY3 */
  2275. {
  2276. .regulators = {},
  2277. .clock = { "csiphy3", "csiphy3_timer" },
  2278. .clock_rate = { { 400000000 },
  2279. { 300000000 } },
  2280. .reg = { "csiphy3" },
  2281. .interrupt = { "csiphy3" },
  2282. .csiphy = {
  2283. .id = 3,
  2284. .hw_ops = &csiphy_ops_3ph_1_0,
  2285. .formats = &csiphy_formats_sdm845
  2286. }
  2287. },
  2288. };
  2289. static const struct camss_subdev_resources csid_res_sc8280xp[] = {
  2290. /* CSID0 */
  2291. {
  2292. .regulators = {
  2293. { .supply = "vdda-phy", .init_load_uA = 0 },
  2294. { .supply = "vdda-pll", .init_load_uA = 0 }
  2295. },
  2296. .clock = { "vfe0_csid", "vfe0_cphy_rx", "vfe0", "vfe0_axi" },
  2297. .clock_rate = { { 400000000, 480000000, 600000000 },
  2298. { 0 },
  2299. { 0 },
  2300. { 0 } },
  2301. .reg = { "csid0" },
  2302. .interrupt = { "csid0" },
  2303. .csid = {
  2304. .hw_ops = &csid_ops_gen2,
  2305. .parent_dev_ops = &vfe_parent_dev_ops,
  2306. .formats = &csid_formats_gen2
  2307. }
  2308. },
  2309. /* CSID1 */
  2310. {
  2311. .regulators = {
  2312. { .supply = "vdda-phy", .init_load_uA = 0 },
  2313. { .supply = "vdda-pll", .init_load_uA = 0 }
  2314. },
  2315. .clock = { "vfe1_csid", "vfe1_cphy_rx", "vfe1", "vfe1_axi" },
  2316. .clock_rate = { { 400000000, 480000000, 600000000 },
  2317. { 0 },
  2318. { 0 },
  2319. { 0 } },
  2320. .reg = { "csid1" },
  2321. .interrupt = { "csid1" },
  2322. .csid = {
  2323. .hw_ops = &csid_ops_gen2,
  2324. .parent_dev_ops = &vfe_parent_dev_ops,
  2325. .formats = &csid_formats_gen2
  2326. }
  2327. },
  2328. /* CSID2 */
  2329. {
  2330. .regulators = {
  2331. { .supply = "vdda-phy", .init_load_uA = 0 },
  2332. { .supply = "vdda-pll", .init_load_uA = 0 }
  2333. },
  2334. .clock = { "vfe2_csid", "vfe2_cphy_rx", "vfe2", "vfe2_axi" },
  2335. .clock_rate = { { 400000000, 480000000, 600000000 },
  2336. { 0 },
  2337. { 0 },
  2338. { 0 } },
  2339. .reg = { "csid2" },
  2340. .interrupt = { "csid2" },
  2341. .csid = {
  2342. .hw_ops = &csid_ops_gen2,
  2343. .parent_dev_ops = &vfe_parent_dev_ops,
  2344. .formats = &csid_formats_gen2
  2345. }
  2346. },
  2347. /* CSID3 */
  2348. {
  2349. .regulators = {
  2350. { .supply = "vdda-phy", .init_load_uA = 0 },
  2351. { .supply = "vdda-pll", .init_load_uA = 0 }
  2352. },
  2353. .clock = { "vfe3_csid", "vfe3_cphy_rx", "vfe3", "vfe3_axi" },
  2354. .clock_rate = { { 400000000, 480000000, 600000000 },
  2355. { 0 },
  2356. { 0 },
  2357. { 0 } },
  2358. .reg = { "csid3" },
  2359. .interrupt = { "csid3" },
  2360. .csid = {
  2361. .hw_ops = &csid_ops_gen2,
  2362. .parent_dev_ops = &vfe_parent_dev_ops,
  2363. .formats = &csid_formats_gen2
  2364. }
  2365. },
  2366. /* CSID_LITE0 */
  2367. {
  2368. .regulators = {
  2369. { .supply = "vdda-phy", .init_load_uA = 0 },
  2370. { .supply = "vdda-pll", .init_load_uA = 0 }
  2371. },
  2372. .clock = { "vfe_lite0_csid", "vfe_lite0_cphy_rx", "vfe_lite0" },
  2373. .clock_rate = { { 400000000, 480000000, 600000000 },
  2374. { 0 },
  2375. { 0 }, },
  2376. .reg = { "csid0_lite" },
  2377. .interrupt = { "csid0_lite" },
  2378. .csid = {
  2379. .is_lite = true,
  2380. .hw_ops = &csid_ops_gen2,
  2381. .parent_dev_ops = &vfe_parent_dev_ops,
  2382. .formats = &csid_formats_gen2
  2383. }
  2384. },
  2385. /* CSID_LITE1 */
  2386. {
  2387. .regulators = {
  2388. { .supply = "vdda-phy", .init_load_uA = 0 },
  2389. { .supply = "vdda-pll", .init_load_uA = 0 }
  2390. },
  2391. .clock = { "vfe_lite1_csid", "vfe_lite1_cphy_rx", "vfe_lite1" },
  2392. .clock_rate = { { 400000000, 480000000, 600000000 },
  2393. { 0 },
  2394. { 0 }, },
  2395. .reg = { "csid1_lite" },
  2396. .interrupt = { "csid1_lite" },
  2397. .csid = {
  2398. .is_lite = true,
  2399. .hw_ops = &csid_ops_gen2,
  2400. .parent_dev_ops = &vfe_parent_dev_ops,
  2401. .formats = &csid_formats_gen2
  2402. }
  2403. },
  2404. /* CSID_LITE2 */
  2405. {
  2406. .regulators = {
  2407. { .supply = "vdda-phy", .init_load_uA = 0 },
  2408. { .supply = "vdda-pll", .init_load_uA = 0 }
  2409. },
  2410. .clock = { "vfe_lite2_csid", "vfe_lite2_cphy_rx", "vfe_lite2" },
  2411. .clock_rate = { { 400000000, 480000000, 600000000 },
  2412. { 0 },
  2413. { 0 }, },
  2414. .reg = { "csid2_lite" },
  2415. .interrupt = { "csid2_lite" },
  2416. .csid = {
  2417. .is_lite = true,
  2418. .hw_ops = &csid_ops_gen2,
  2419. .parent_dev_ops = &vfe_parent_dev_ops,
  2420. .formats = &csid_formats_gen2
  2421. }
  2422. },
  2423. /* CSID_LITE3 */
  2424. {
  2425. .regulators = {
  2426. { .supply = "vdda-phy", .init_load_uA = 0 },
  2427. { .supply = "vdda-pll", .init_load_uA = 0 }
  2428. },
  2429. .clock = { "vfe_lite3_csid", "vfe_lite3_cphy_rx", "vfe_lite3" },
  2430. .clock_rate = { { 400000000, 480000000, 600000000 },
  2431. { 0 },
  2432. { 0 }, },
  2433. .reg = { "csid3_lite" },
  2434. .interrupt = { "csid3_lite" },
  2435. .csid = {
  2436. .is_lite = true,
  2437. .hw_ops = &csid_ops_gen2,
  2438. .parent_dev_ops = &vfe_parent_dev_ops,
  2439. .formats = &csid_formats_gen2
  2440. }
  2441. }
  2442. };
  2443. static const struct camss_subdev_resources vfe_res_sc8280xp[] = {
  2444. /* VFE0 */
  2445. {
  2446. .regulators = {},
  2447. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe0", "vfe0_axi" },
  2448. .clock_rate = { { 0 },
  2449. { 0 },
  2450. { 19200000, 80000000},
  2451. { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 },
  2452. { 400000000, 558000000, 637000000, 760000000 },
  2453. { 0 }, },
  2454. .reg = { "vfe0" },
  2455. .interrupt = { "vfe0" },
  2456. .vfe = {
  2457. .line_num = 4,
  2458. .pd_name = "ife0",
  2459. .hw_ops = &vfe_ops_170,
  2460. .formats_rdi = &vfe_formats_rdi_845,
  2461. .formats_pix = &vfe_formats_pix_845
  2462. }
  2463. },
  2464. /* VFE1 */
  2465. {
  2466. .regulators = {},
  2467. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe1", "vfe1_axi" },
  2468. .clock_rate = { { 0 },
  2469. { 0 },
  2470. { 19200000, 80000000},
  2471. { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 },
  2472. { 400000000, 558000000, 637000000, 760000000 },
  2473. { 0 }, },
  2474. .reg = { "vfe1" },
  2475. .interrupt = { "vfe1" },
  2476. .vfe = {
  2477. .line_num = 4,
  2478. .pd_name = "ife1",
  2479. .hw_ops = &vfe_ops_170,
  2480. .formats_rdi = &vfe_formats_rdi_845,
  2481. .formats_pix = &vfe_formats_pix_845
  2482. }
  2483. },
  2484. /* VFE2 */
  2485. {
  2486. .regulators = {},
  2487. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe2", "vfe2_axi" },
  2488. .clock_rate = { { 0 },
  2489. { 0 },
  2490. { 19200000, 80000000},
  2491. { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 },
  2492. { 400000000, 558000000, 637000000, 760000000 },
  2493. { 0 }, },
  2494. .reg = { "vfe2" },
  2495. .interrupt = { "vfe2" },
  2496. .vfe = {
  2497. .line_num = 4,
  2498. .pd_name = "ife2",
  2499. .hw_ops = &vfe_ops_170,
  2500. .formats_rdi = &vfe_formats_rdi_845,
  2501. .formats_pix = &vfe_formats_pix_845
  2502. }
  2503. },
  2504. /* VFE3 */
  2505. {
  2506. .regulators = {},
  2507. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe3", "vfe3_axi" },
  2508. .clock_rate = { { 0 },
  2509. { 0 },
  2510. { 19200000, 80000000},
  2511. { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 },
  2512. { 400000000, 558000000, 637000000, 760000000 },
  2513. { 0 }, },
  2514. .reg = { "vfe3" },
  2515. .interrupt = { "vfe3" },
  2516. .vfe = {
  2517. .line_num = 4,
  2518. .pd_name = "ife3",
  2519. .hw_ops = &vfe_ops_170,
  2520. .formats_rdi = &vfe_formats_rdi_845,
  2521. .formats_pix = &vfe_formats_pix_845
  2522. }
  2523. },
  2524. /* VFE_LITE_0 */
  2525. {
  2526. .regulators = {},
  2527. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe_lite0" },
  2528. .clock_rate = { { 0 },
  2529. { 0 },
  2530. { 19200000, 80000000},
  2531. { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 },
  2532. { 320000000, 400000000, 480000000, 600000000 }, },
  2533. .reg = { "vfe_lite0" },
  2534. .interrupt = { "vfe_lite0" },
  2535. .vfe = {
  2536. .is_lite = true,
  2537. .line_num = 4,
  2538. .hw_ops = &vfe_ops_170,
  2539. .formats_rdi = &vfe_formats_rdi_845,
  2540. .formats_pix = &vfe_formats_pix_845
  2541. }
  2542. },
  2543. /* VFE_LITE_1 */
  2544. {
  2545. .regulators = {},
  2546. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe_lite1" },
  2547. .clock_rate = { { 0 },
  2548. { 0 },
  2549. { 19200000, 80000000},
  2550. { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 },
  2551. { 320000000, 400000000, 480000000, 600000000 }, },
  2552. .reg = { "vfe_lite1" },
  2553. .interrupt = { "vfe_lite1" },
  2554. .vfe = {
  2555. .is_lite = true,
  2556. .line_num = 4,
  2557. .hw_ops = &vfe_ops_170,
  2558. .formats_rdi = &vfe_formats_rdi_845,
  2559. .formats_pix = &vfe_formats_pix_845
  2560. }
  2561. },
  2562. /* VFE_LITE_2 */
  2563. {
  2564. .regulators = {},
  2565. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe_lite2" },
  2566. .clock_rate = { { 0 },
  2567. { 0 },
  2568. { 19200000, 80000000},
  2569. { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 },
  2570. { 320000000, 400000000, 480000000, 600000000, }, },
  2571. .reg = { "vfe_lite2" },
  2572. .interrupt = { "vfe_lite2" },
  2573. .vfe = {
  2574. .is_lite = true,
  2575. .line_num = 4,
  2576. .hw_ops = &vfe_ops_170,
  2577. .formats_rdi = &vfe_formats_rdi_845,
  2578. .formats_pix = &vfe_formats_pix_845
  2579. }
  2580. },
  2581. /* VFE_LITE_3 */
  2582. {
  2583. .regulators = {},
  2584. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe_lite3" },
  2585. .clock_rate = { { 0 },
  2586. { 0 },
  2587. { 19200000, 80000000},
  2588. { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 },
  2589. { 320000000, 400000000, 480000000, 600000000 }, },
  2590. .reg = { "vfe_lite3" },
  2591. .interrupt = { "vfe_lite3" },
  2592. .vfe = {
  2593. .is_lite = true,
  2594. .line_num = 4,
  2595. .hw_ops = &vfe_ops_170,
  2596. .formats_rdi = &vfe_formats_rdi_845,
  2597. .formats_pix = &vfe_formats_pix_845
  2598. }
  2599. },
  2600. };
  2601. static const struct resources_icc icc_res_sc8280xp[] = {
  2602. {
  2603. .name = "cam_ahb",
  2604. .icc_bw_tbl.avg = 150000,
  2605. .icc_bw_tbl.peak = 300000,
  2606. },
  2607. {
  2608. .name = "cam_hf_mnoc",
  2609. .icc_bw_tbl.avg = 2097152,
  2610. .icc_bw_tbl.peak = 2097152,
  2611. },
  2612. {
  2613. .name = "cam_sf_mnoc",
  2614. .icc_bw_tbl.avg = 2097152,
  2615. .icc_bw_tbl.peak = 2097152,
  2616. },
  2617. {
  2618. .name = "cam_sf_icp_mnoc",
  2619. .icc_bw_tbl.avg = 2097152,
  2620. .icc_bw_tbl.peak = 2097152,
  2621. },
  2622. };
  2623. static const struct camss_subdev_resources csiphy_res_8550[] = {
  2624. /* CSIPHY0 */
  2625. {
  2626. .regulators = {
  2627. { .supply = "vdda-phy", .init_load_uA = 32200 },
  2628. { .supply = "vdda-pll", .init_load_uA = 18000 }
  2629. },
  2630. .clock = { "csiphy0", "csiphy0_timer" },
  2631. .clock_rate = { { 400000000, 480000000 },
  2632. { 400000000 } },
  2633. .reg = { "csiphy0" },
  2634. .interrupt = { "csiphy0" },
  2635. .csiphy = {
  2636. .id = 0,
  2637. .hw_ops = &csiphy_ops_3ph_1_0,
  2638. .formats = &csiphy_formats_sdm845
  2639. }
  2640. },
  2641. /* CSIPHY1 */
  2642. {
  2643. .regulators = {
  2644. { .supply = "vdda-phy", .init_load_uA = 32200 },
  2645. { .supply = "vdda-pll", .init_load_uA = 18000 }
  2646. },
  2647. .clock = { "csiphy1", "csiphy1_timer" },
  2648. .clock_rate = { { 400000000, 480000000 },
  2649. { 400000000 } },
  2650. .reg = { "csiphy1" },
  2651. .interrupt = { "csiphy1" },
  2652. .csiphy = {
  2653. .id = 1,
  2654. .hw_ops = &csiphy_ops_3ph_1_0,
  2655. .formats = &csiphy_formats_sdm845
  2656. }
  2657. },
  2658. /* CSIPHY2 */
  2659. {
  2660. .regulators = {
  2661. { .supply = "vdda-phy", .init_load_uA = 32200 },
  2662. { .supply = "vdda-pll", .init_load_uA = 18000 }
  2663. },
  2664. .clock = { "csiphy2", "csiphy2_timer" },
  2665. .clock_rate = { { 400000000, 480000000 },
  2666. { 400000000 } },
  2667. .reg = { "csiphy2" },
  2668. .interrupt = { "csiphy2" },
  2669. .csiphy = {
  2670. .id = 2,
  2671. .hw_ops = &csiphy_ops_3ph_1_0,
  2672. .formats = &csiphy_formats_sdm845
  2673. }
  2674. },
  2675. /* CSIPHY3 */
  2676. {
  2677. .regulators = {
  2678. { .supply = "vdda-phy", .init_load_uA = 32200 },
  2679. { .supply = "vdda-pll", .init_load_uA = 18000 }
  2680. },
  2681. .clock = { "csiphy3", "csiphy3_timer" },
  2682. .clock_rate = { { 400000000, 480000000 },
  2683. { 400000000 } },
  2684. .reg = { "csiphy3" },
  2685. .interrupt = { "csiphy3" },
  2686. .csiphy = {
  2687. .id = 3,
  2688. .hw_ops = &csiphy_ops_3ph_1_0,
  2689. .formats = &csiphy_formats_sdm845
  2690. }
  2691. },
  2692. /* CSIPHY4 */
  2693. {
  2694. .regulators = {
  2695. { .supply = "vdda-phy", .init_load_uA = 37900 },
  2696. { .supply = "vdda-pll", .init_load_uA = 18600 }
  2697. },
  2698. .clock = { "csiphy4", "csiphy4_timer" },
  2699. .clock_rate = { { 400000000, 480000000 },
  2700. { 400000000 } },
  2701. .reg = { "csiphy4" },
  2702. .interrupt = { "csiphy4" },
  2703. .csiphy = {
  2704. .id = 4,
  2705. .hw_ops = &csiphy_ops_3ph_1_0,
  2706. .formats = &csiphy_formats_sdm845
  2707. }
  2708. },
  2709. /* CSIPHY5 */
  2710. {
  2711. .regulators = {
  2712. { .supply = "vdda-phy", .init_load_uA = 32200 },
  2713. { .supply = "vdda-pll", .init_load_uA = 18000 }
  2714. },
  2715. .clock = { "csiphy5", "csiphy5_timer" },
  2716. .clock_rate = { { 400000000, 480000000 },
  2717. { 400000000 } },
  2718. .reg = { "csiphy5" },
  2719. .interrupt = { "csiphy5" },
  2720. .csiphy = {
  2721. .id = 5,
  2722. .hw_ops = &csiphy_ops_3ph_1_0,
  2723. .formats = &csiphy_formats_sdm845
  2724. }
  2725. },
  2726. /* CSIPHY6 */
  2727. {
  2728. .regulators = {
  2729. { .supply = "vdda-phy", .init_load_uA = 37900 },
  2730. { .supply = "vdda-pll", .init_load_uA = 18600 }
  2731. },
  2732. .clock = { "csiphy6", "csiphy6_timer" },
  2733. .clock_rate = { { 400000000, 480000000 },
  2734. { 400000000 } },
  2735. .reg = { "csiphy6" },
  2736. .interrupt = { "csiphy6" },
  2737. .csiphy = {
  2738. .id = 6,
  2739. .hw_ops = &csiphy_ops_3ph_1_0,
  2740. .formats = &csiphy_formats_sdm845
  2741. }
  2742. },
  2743. /* CSIPHY7 */
  2744. {
  2745. .regulators = {
  2746. { .supply = "vdda-phy", .init_load_uA = 32200 },
  2747. { .supply = "vdda-pll", .init_load_uA = 18000 }
  2748. },
  2749. .clock = { "csiphy7", "csiphy7_timer" },
  2750. .clock_rate = { { 400000000, 480000000 },
  2751. { 400000000 } },
  2752. .reg = { "csiphy7" },
  2753. .interrupt = { "csiphy7" },
  2754. .csiphy = {
  2755. .id = 7,
  2756. .hw_ops = &csiphy_ops_3ph_1_0,
  2757. .formats = &csiphy_formats_sdm845
  2758. }
  2759. }
  2760. };
  2761. static const struct resources_wrapper csid_wrapper_res_sm8550 = {
  2762. .reg = "csid_wrapper",
  2763. };
  2764. static const struct camss_subdev_resources csid_res_8550[] = {
  2765. /* CSID0 */
  2766. {
  2767. .regulators = {},
  2768. .clock = { "csid", "csiphy_rx" },
  2769. .clock_rate = { { 400000000, 480000000 },
  2770. { 400000000, 480000000 } },
  2771. .reg = { "csid0" },
  2772. .interrupt = { "csid0" },
  2773. .csid = {
  2774. .is_lite = false,
  2775. .parent_dev_ops = &vfe_parent_dev_ops,
  2776. .hw_ops = &csid_ops_gen3,
  2777. .formats = &csid_formats_gen2
  2778. }
  2779. },
  2780. /* CSID1 */
  2781. {
  2782. .regulators = {},
  2783. .clock = { "csid", "csiphy_rx" },
  2784. .clock_rate = { { 400000000, 480000000 },
  2785. { 400000000, 480000000 } },
  2786. .reg = { "csid1" },
  2787. .interrupt = { "csid1" },
  2788. .csid = {
  2789. .is_lite = false,
  2790. .parent_dev_ops = &vfe_parent_dev_ops,
  2791. .hw_ops = &csid_ops_gen3,
  2792. .formats = &csid_formats_gen2
  2793. }
  2794. },
  2795. /* CSID2 */
  2796. {
  2797. .regulators = {},
  2798. .clock = { "csid", "csiphy_rx" },
  2799. .clock_rate = { { 400000000, 480000000 },
  2800. { 400000000, 480000000 } },
  2801. .reg = { "csid2" },
  2802. .interrupt = { "csid2" },
  2803. .csid = {
  2804. .is_lite = false,
  2805. .parent_dev_ops = &vfe_parent_dev_ops,
  2806. .hw_ops = &csid_ops_gen3,
  2807. .formats = &csid_formats_gen2
  2808. }
  2809. },
  2810. /* CSID3 */
  2811. {
  2812. .regulators = {},
  2813. .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx" },
  2814. .clock_rate = { { 400000000, 480000000 },
  2815. { 400000000, 480000000 } },
  2816. .reg = { "csid_lite0" },
  2817. .interrupt = { "csid_lite0" },
  2818. .csid = {
  2819. .is_lite = true,
  2820. .parent_dev_ops = &vfe_parent_dev_ops,
  2821. .hw_ops = &csid_ops_gen3,
  2822. .formats = &csid_formats_gen2
  2823. }
  2824. },
  2825. /* CSID4 */
  2826. {
  2827. .regulators = {},
  2828. .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx" },
  2829. .clock_rate = { { 400000000, 480000000 },
  2830. { 400000000, 480000000 } },
  2831. .reg = { "csid_lite1" },
  2832. .interrupt = { "csid_lite1" },
  2833. .csid = {
  2834. .is_lite = true,
  2835. .parent_dev_ops = &vfe_parent_dev_ops,
  2836. .hw_ops = &csid_ops_gen3,
  2837. .formats = &csid_formats_gen2
  2838. }
  2839. }
  2840. };
  2841. static const struct camss_subdev_resources vfe_res_8550[] = {
  2842. /* VFE0 */
  2843. {
  2844. .regulators = {},
  2845. .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb_clk", "vfe0_fast_ahb",
  2846. "vfe0", "cpas_vfe0", "camnoc_axi" },
  2847. .clock_rate = { { 0 },
  2848. { 80000000 },
  2849. { 300000000, 400000000 },
  2850. { 300000000, 400000000 },
  2851. { 466000000, 594000000, 675000000, 785000000 },
  2852. { 300000000, 400000000 },
  2853. { 300000000, 400000000 } },
  2854. .reg = { "vfe0" },
  2855. .interrupt = { "vfe0" },
  2856. .vfe = {
  2857. .line_num = 3,
  2858. .is_lite = false,
  2859. .has_pd = true,
  2860. .pd_name = "ife0",
  2861. .hw_ops = &vfe_ops_gen3,
  2862. .formats_rdi = &vfe_formats_rdi_845,
  2863. .formats_pix = &vfe_formats_pix_845
  2864. }
  2865. },
  2866. /* VFE1 */
  2867. {
  2868. .regulators = {},
  2869. .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb_clk", "vfe1_fast_ahb",
  2870. "vfe1", "cpas_vfe1", "camnoc_axi" },
  2871. .clock_rate = { { 0 },
  2872. { 80000000 },
  2873. { 300000000, 400000000 },
  2874. { 300000000, 400000000 },
  2875. { 466000000, 594000000, 675000000, 785000000 },
  2876. { 300000000, 400000000 },
  2877. { 300000000, 400000000 } },
  2878. .reg = { "vfe1" },
  2879. .interrupt = { "vfe1" },
  2880. .vfe = {
  2881. .line_num = 3,
  2882. .is_lite = false,
  2883. .has_pd = true,
  2884. .pd_name = "ife1",
  2885. .hw_ops = &vfe_ops_gen3,
  2886. .formats_rdi = &vfe_formats_rdi_845,
  2887. .formats_pix = &vfe_formats_pix_845
  2888. }
  2889. },
  2890. /* VFE2 */
  2891. {
  2892. .regulators = {},
  2893. .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb_clk", "vfe2_fast_ahb",
  2894. "vfe2", "cpas_vfe2", "camnoc_axi" },
  2895. .clock_rate = { { 0 },
  2896. { 80000000 },
  2897. { 300000000, 400000000 },
  2898. { 300000000, 400000000 },
  2899. { 466000000, 594000000, 675000000, 785000000 },
  2900. { 300000000, 400000000 },
  2901. { 300000000, 400000000 } },
  2902. .reg = { "vfe2" },
  2903. .interrupt = { "vfe2" },
  2904. .vfe = {
  2905. .line_num = 3,
  2906. .is_lite = false,
  2907. .has_pd = true,
  2908. .pd_name = "ife2",
  2909. .hw_ops = &vfe_ops_gen3,
  2910. .formats_rdi = &vfe_formats_rdi_845,
  2911. .formats_pix = &vfe_formats_pix_845
  2912. }
  2913. },
  2914. /* VFE3 lite */
  2915. {
  2916. .regulators = {},
  2917. .clock = { "gcc_axi_hf", "cpas_ahb", "vfe_lite_ahb",
  2918. "vfe_lite", "cpas_ife_lite", "camnoc_axi" },
  2919. .clock_rate = { { 0 },
  2920. { 80000000 },
  2921. { 300000000, 400000000 },
  2922. { 400000000, 480000000 },
  2923. { 300000000, 400000000 },
  2924. { 300000000, 400000000 } },
  2925. .reg = { "vfe_lite0" },
  2926. .interrupt = { "vfe_lite0" },
  2927. .vfe = {
  2928. .line_num = 4,
  2929. .is_lite = true,
  2930. .hw_ops = &vfe_ops_gen3,
  2931. .formats_rdi = &vfe_formats_rdi_845,
  2932. .formats_pix = &vfe_formats_pix_845
  2933. }
  2934. },
  2935. /* VFE4 lite */
  2936. {
  2937. .regulators = {},
  2938. .clock = { "gcc_axi_hf", "cpas_ahb", "vfe_lite_ahb",
  2939. "vfe_lite", "cpas_ife_lite", "camnoc_axi" },
  2940. .clock_rate = { { 0 },
  2941. { 80000000 },
  2942. { 300000000, 400000000 },
  2943. { 400000000, 480000000 },
  2944. { 300000000, 400000000 },
  2945. { 300000000, 400000000 } },
  2946. .reg = { "vfe_lite1" },
  2947. .interrupt = { "vfe_lite1" },
  2948. .vfe = {
  2949. .line_num = 4,
  2950. .is_lite = true,
  2951. .hw_ops = &vfe_ops_gen3,
  2952. .formats_rdi = &vfe_formats_rdi_845,
  2953. .formats_pix = &vfe_formats_pix_845
  2954. }
  2955. },
  2956. };
  2957. static const struct resources_icc icc_res_sm8550[] = {
  2958. {
  2959. .name = "ahb",
  2960. .icc_bw_tbl.avg = 2097152,
  2961. .icc_bw_tbl.peak = 2097152,
  2962. },
  2963. {
  2964. .name = "hf_0_mnoc",
  2965. .icc_bw_tbl.avg = 2097152,
  2966. .icc_bw_tbl.peak = 2097152,
  2967. },
  2968. };
  2969. static const struct camss_subdev_resources csiphy_res_sm8650[] = {
  2970. /* CSIPHY0 */
  2971. {
  2972. .regulators = {
  2973. { .supply = "vdd-csiphy01-0p9", .init_load_uA = 88000 },
  2974. { .supply = "vdd-csiphy01-1p2", .init_load_uA = 17800 },
  2975. },
  2976. .clock = { "csiphy0", "csiphy0_timer" },
  2977. .clock_rate = { { 400000000 },
  2978. { 400000000 } },
  2979. .reg = { "csiphy0" },
  2980. .interrupt = { "csiphy0" },
  2981. .csiphy = {
  2982. .id = 0,
  2983. .hw_ops = &csiphy_ops_3ph_1_0,
  2984. .formats = &csiphy_formats_sdm845,
  2985. },
  2986. },
  2987. /* CSIPHY1 */
  2988. {
  2989. .regulators = {
  2990. { .supply = "vdd-csiphy01-0p9", .init_load_uA = 88000 },
  2991. { .supply = "vdd-csiphy01-1p2", .init_load_uA = 17800 },
  2992. },
  2993. .clock = { "csiphy1", "csiphy1_timer" },
  2994. .clock_rate = { { 400000000 },
  2995. { 400000000 } },
  2996. .reg = { "csiphy1" },
  2997. .interrupt = { "csiphy1" },
  2998. .csiphy = {
  2999. .id = 1,
  3000. .hw_ops = &csiphy_ops_3ph_1_0,
  3001. .formats = &csiphy_formats_sdm845,
  3002. },
  3003. },
  3004. /* CSIPHY2 */
  3005. {
  3006. .regulators = {
  3007. { .supply = "vdd-csiphy24-0p9", .init_load_uA = 147000 },
  3008. { .supply = "vdd-csiphy24-1p2", .init_load_uA = 24400 },
  3009. },
  3010. .clock = { "csiphy2", "csiphy2_timer" },
  3011. .clock_rate = { { 400000000 },
  3012. { 400000000 } },
  3013. .reg = { "csiphy2" },
  3014. .interrupt = { "csiphy2" },
  3015. .csiphy = {
  3016. .id = 2,
  3017. .hw_ops = &csiphy_ops_3ph_1_0,
  3018. .formats = &csiphy_formats_sdm845,
  3019. },
  3020. },
  3021. /* CSIPHY3 */
  3022. {
  3023. .regulators = {
  3024. { .supply = "vdd-csiphy35-0p9", .init_load_uA = 88000 },
  3025. { .supply = "vdd-csiphy35-1p2", .init_load_uA = 17800 },
  3026. },
  3027. .clock = { "csiphy3", "csiphy3_timer" },
  3028. .clock_rate = { { 400000000 },
  3029. { 400000000 } },
  3030. .reg = { "csiphy3" },
  3031. .interrupt = { "csiphy3" },
  3032. .csiphy = {
  3033. .id = 3,
  3034. .hw_ops = &csiphy_ops_3ph_1_0,
  3035. .formats = &csiphy_formats_sdm845,
  3036. },
  3037. },
  3038. /* CSIPHY4 */
  3039. {
  3040. .regulators = {
  3041. { .supply = "vdd-csiphy24-0p9", .init_load_uA = 147000 },
  3042. { .supply = "vdd-csiphy24-1p2", .init_load_uA = 24400 },
  3043. },
  3044. .clock = { "csiphy4", "csiphy4_timer" },
  3045. .clock_rate = { { 400000000 },
  3046. { 400000000 } },
  3047. .reg = { "csiphy4" },
  3048. .interrupt = { "csiphy4" },
  3049. .csiphy = {
  3050. .id = 4,
  3051. .hw_ops = &csiphy_ops_3ph_1_0,
  3052. .formats = &csiphy_formats_sdm845,
  3053. },
  3054. },
  3055. /* CSIPHY5 */
  3056. {
  3057. .regulators = {
  3058. { .supply = "vdd-csiphy35-0p9", .init_load_uA = 88000 },
  3059. { .supply = "vdd-csiphy35-1p2", .init_load_uA = 17800 },
  3060. },
  3061. .clock = { "csiphy5", "csiphy5_timer" },
  3062. .clock_rate = { { 400000000 },
  3063. { 400000000 } },
  3064. .reg = { "csiphy5" },
  3065. .interrupt = { "csiphy5" },
  3066. .csiphy = {
  3067. .id = 5,
  3068. .hw_ops = &csiphy_ops_3ph_1_0,
  3069. .formats = &csiphy_formats_sdm845,
  3070. },
  3071. },
  3072. };
  3073. static const struct camss_subdev_resources csid_res_sm8650[] = {
  3074. /* CSID0 */
  3075. {
  3076. .regulators = { },
  3077. .clock = { "csid", "csiphy_rx" },
  3078. .clock_rate = { { 400000000 },
  3079. { 400000000, 480000000 } },
  3080. .reg = { "csid0" },
  3081. .interrupt = { "csid0" },
  3082. .csid = {
  3083. .parent_dev_ops = &vfe_parent_dev_ops,
  3084. .hw_ops = &csid_ops_gen3,
  3085. .formats = &csid_formats_gen2,
  3086. },
  3087. },
  3088. /* CSID1 */
  3089. {
  3090. .regulators = { },
  3091. .clock = { "csid", "csiphy_rx" },
  3092. .clock_rate = { { 400000000 },
  3093. { 400000000, 480000000 } },
  3094. .reg = { "csid1" },
  3095. .interrupt = { "csid1" },
  3096. .csid = {
  3097. .parent_dev_ops = &vfe_parent_dev_ops,
  3098. .hw_ops = &csid_ops_gen3,
  3099. .formats = &csid_formats_gen2,
  3100. },
  3101. },
  3102. /* CSID2 */
  3103. {
  3104. .regulators = { },
  3105. .clock = { "csid", "csiphy_rx" },
  3106. .clock_rate = { { 400000000 },
  3107. { 400000000, 480000000 } },
  3108. .reg = { "csid2" },
  3109. .interrupt = { "csid2" },
  3110. .csid = {
  3111. .parent_dev_ops = &vfe_parent_dev_ops,
  3112. .hw_ops = &csid_ops_gen3,
  3113. .formats = &csid_formats_gen2,
  3114. },
  3115. },
  3116. /* CSID3 lite */
  3117. {
  3118. .regulators = { },
  3119. .clock = { "vfe_lite_ahb", "vfe_lite_csid", "vfe_lite_cphy_rx" },
  3120. .clock_rate = { { 0 },
  3121. { 400000000, 480000000 },
  3122. { 0 } },
  3123. .reg = { "csid_lite0" },
  3124. .interrupt = { "csid_lite0" },
  3125. .csid = {
  3126. .is_lite = true,
  3127. .parent_dev_ops = &vfe_parent_dev_ops,
  3128. .hw_ops = &csid_ops_gen3,
  3129. .formats = &csid_formats_gen2,
  3130. },
  3131. },
  3132. /* CSID4 lite */
  3133. {
  3134. .regulators = { },
  3135. .clock = { "vfe_lite_ahb", "vfe_lite_csid", "vfe_lite_cphy_rx" },
  3136. .clock_rate = { { 0 },
  3137. { 400000000, 480000000 },
  3138. { 0 } },
  3139. .reg = { "csid_lite1" },
  3140. .interrupt = { "csid_lite1" },
  3141. .csid = {
  3142. .is_lite = true,
  3143. .parent_dev_ops = &vfe_parent_dev_ops,
  3144. .hw_ops = &csid_ops_gen3,
  3145. .formats = &csid_formats_gen2,
  3146. },
  3147. },
  3148. };
  3149. static const struct camss_subdev_resources vfe_res_sm8650[] = {
  3150. /* VFE0 */
  3151. {
  3152. .regulators = { },
  3153. .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb",
  3154. "camnoc_axi", "vfe0_fast_ahb", "vfe0", "cpas_vfe0",
  3155. "qdss_debug_xo",
  3156. },
  3157. .clock_rate = { { 0 },
  3158. { 80000000 },
  3159. { 300000000, 400000000 },
  3160. { 300000000, 400000000 },
  3161. { 0 },
  3162. { 466000000, 594000000, 675000000, 785000000 },
  3163. { 0 },
  3164. { 0 },
  3165. },
  3166. .reg = { "vfe0" },
  3167. .interrupt = { "vfe0" },
  3168. .vfe = {
  3169. .line_num = 3,
  3170. .has_pd = true,
  3171. .pd_name = "ife0",
  3172. .hw_ops = &vfe_ops_gen3,
  3173. .formats_rdi = &vfe_formats_rdi_845,
  3174. .formats_pix = &vfe_formats_pix_845
  3175. },
  3176. },
  3177. /* VFE1 */
  3178. {
  3179. .regulators = { },
  3180. .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb",
  3181. "camnoc_axi", "vfe1_fast_ahb", "vfe1", "cpas_vfe1",
  3182. "qdss_debug_xo",
  3183. },
  3184. .clock_rate = { { 0 },
  3185. { 80000000 },
  3186. { 300000000, 400000000 },
  3187. { 300000000, 400000000 },
  3188. { 0 },
  3189. { 466000000, 594000000, 675000000, 785000000 },
  3190. { 0 },
  3191. { 0 },
  3192. },
  3193. .reg = { "vfe1" },
  3194. .interrupt = { "vfe1" },
  3195. .vfe = {
  3196. .line_num = 3,
  3197. .has_pd = true,
  3198. .pd_name = "ife1",
  3199. .hw_ops = &vfe_ops_gen3,
  3200. .formats_rdi = &vfe_formats_rdi_845,
  3201. .formats_pix = &vfe_formats_pix_845
  3202. },
  3203. },
  3204. /* VFE2 */
  3205. {
  3206. .regulators = { },
  3207. .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb",
  3208. "camnoc_axi", "vfe2_fast_ahb", "vfe2", "cpas_vfe2",
  3209. "qdss_debug_xo",
  3210. },
  3211. .clock_rate = { { 0 },
  3212. { 80000000 },
  3213. { 300000000, 400000000 },
  3214. { 300000000, 400000000 },
  3215. { 0 },
  3216. { 466000000, 594000000, 675000000, 785000000 },
  3217. { 0 },
  3218. { 0 },
  3219. },
  3220. .reg = { "vfe2" },
  3221. .interrupt = { "vfe2" },
  3222. .vfe = {
  3223. .line_num = 3,
  3224. .has_pd = true,
  3225. .pd_name = "ife2",
  3226. .hw_ops = &vfe_ops_gen3,
  3227. .formats_rdi = &vfe_formats_rdi_845,
  3228. .formats_pix = &vfe_formats_pix_845
  3229. },
  3230. },
  3231. /* VFE3 lite */
  3232. {
  3233. .regulators = { },
  3234. .clock = { "gcc_axi_hf", "cpas_ahb", "camnoc_axi",
  3235. "vfe_lite_ahb", "vfe_lite", "cpas_vfe_lite",
  3236. "qdss_debug_xo",
  3237. },
  3238. .clock_rate = { { 0 },
  3239. { 80000000 },
  3240. { 300000000, 400000000 },
  3241. { 0 },
  3242. { 400000000, 480000000 },
  3243. { 0 },
  3244. { 0 },
  3245. },
  3246. .reg = { "vfe_lite0" },
  3247. .interrupt = { "vfe_lite0" },
  3248. .vfe = {
  3249. .line_num = 4,
  3250. .is_lite = true,
  3251. .hw_ops = &vfe_ops_gen3,
  3252. .formats_rdi = &vfe_formats_rdi_845,
  3253. .formats_pix = &vfe_formats_pix_845
  3254. },
  3255. },
  3256. /* VFE4 lite */
  3257. {
  3258. .regulators = { },
  3259. .clock = { "gcc_axi_hf", "cpas_ahb", "camnoc_axi",
  3260. "vfe_lite_ahb", "vfe_lite", "cpas_vfe_lite",
  3261. "qdss_debug_xo",
  3262. },
  3263. .clock_rate = { { 0 },
  3264. { 80000000 },
  3265. { 300000000, 400000000 },
  3266. { 0 },
  3267. { 400000000, 480000000 },
  3268. { 0 },
  3269. { 0 },
  3270. },
  3271. .reg = { "vfe_lite1" },
  3272. .interrupt = { "vfe_lite1" },
  3273. .vfe = {
  3274. .line_num = 4,
  3275. .is_lite = true,
  3276. .hw_ops = &vfe_ops_gen3,
  3277. .formats_rdi = &vfe_formats_rdi_845,
  3278. .formats_pix = &vfe_formats_pix_845
  3279. },
  3280. },
  3281. };
  3282. static const struct resources_icc icc_res_sm8650[] = {
  3283. {
  3284. .name = "ahb",
  3285. .icc_bw_tbl.avg = 38400,
  3286. .icc_bw_tbl.peak = 76800,
  3287. },
  3288. {
  3289. .name = "hf_mnoc",
  3290. .icc_bw_tbl.avg = 2097152,
  3291. .icc_bw_tbl.peak = 2097152,
  3292. },
  3293. };
  3294. static const struct camss_subdev_resources csiphy_res_8300[] = {
  3295. /* CSIPHY0 */
  3296. {
  3297. .regulators = {
  3298. { .supply = "vdda-phy", .init_load_uA = 15900 },
  3299. { .supply = "vdda-pll", .init_load_uA = 8900 }
  3300. },
  3301. .clock = { "csiphy_rx", "csiphy0", "csiphy0_timer" },
  3302. .clock_rate = {
  3303. { 400000000 },
  3304. { 0 },
  3305. { 400000000 },
  3306. },
  3307. .reg = { "csiphy0" },
  3308. .interrupt = { "csiphy0" },
  3309. .csiphy = {
  3310. .id = 0,
  3311. .hw_ops = &csiphy_ops_3ph_1_0,
  3312. .formats = &csiphy_formats_sdm845,
  3313. }
  3314. },
  3315. /* CSIPHY1 */
  3316. {
  3317. .regulators = {
  3318. { .supply = "vdda-phy", .init_load_uA = 15900 },
  3319. { .supply = "vdda-pll", .init_load_uA = 8900 }
  3320. },
  3321. .clock = { "csiphy_rx", "csiphy1", "csiphy1_timer" },
  3322. .clock_rate = {
  3323. { 400000000 },
  3324. { 0 },
  3325. { 400000000 },
  3326. },
  3327. .reg = { "csiphy1" },
  3328. .interrupt = { "csiphy1" },
  3329. .csiphy = {
  3330. .id = 1,
  3331. .hw_ops = &csiphy_ops_3ph_1_0,
  3332. .formats = &csiphy_formats_sdm845,
  3333. }
  3334. },
  3335. /* CSIPHY2 */
  3336. {
  3337. .regulators = {
  3338. { .supply = "vdda-phy", .init_load_uA = 15900 },
  3339. { .supply = "vdda-pll", .init_load_uA = 8900 }
  3340. },
  3341. .clock = { "csiphy_rx", "csiphy2", "csiphy2_timer" },
  3342. .clock_rate = {
  3343. { 400000000 },
  3344. { 0 },
  3345. { 400000000 },
  3346. },
  3347. .reg = { "csiphy2" },
  3348. .interrupt = { "csiphy2" },
  3349. .csiphy = {
  3350. .id = 2,
  3351. .hw_ops = &csiphy_ops_3ph_1_0,
  3352. .formats = &csiphy_formats_sdm845,
  3353. }
  3354. },
  3355. };
  3356. static const struct camss_subdev_resources csiphy_res_8775p[] = {
  3357. /* CSIPHY0 */
  3358. {
  3359. .regulators = {
  3360. { .supply = "vdda-phy", .init_load_uA = 15900 },
  3361. { .supply = "vdda-pll", .init_load_uA = 8900 }
  3362. },
  3363. .clock = { "csiphy_rx", "csiphy0", "csiphy0_timer"},
  3364. .clock_rate = {
  3365. { 400000000 },
  3366. { 0 },
  3367. { 400000000 },
  3368. },
  3369. .reg = { "csiphy0" },
  3370. .interrupt = { "csiphy0" },
  3371. .csiphy = {
  3372. .id = 0,
  3373. .hw_ops = &csiphy_ops_3ph_1_0,
  3374. .formats = &csiphy_formats_sdm845
  3375. }
  3376. },
  3377. /* CSIPHY1 */
  3378. {
  3379. .regulators = {
  3380. { .supply = "vdda-phy", .init_load_uA = 15900 },
  3381. { .supply = "vdda-pll", .init_load_uA = 8900 }
  3382. },
  3383. .clock = { "csiphy_rx", "csiphy1", "csiphy1_timer"},
  3384. .clock_rate = {
  3385. { 400000000 },
  3386. { 0 },
  3387. { 400000000 },
  3388. },
  3389. .reg = { "csiphy1" },
  3390. .interrupt = { "csiphy1" },
  3391. .csiphy = {
  3392. .id = 1,
  3393. .hw_ops = &csiphy_ops_3ph_1_0,
  3394. .formats = &csiphy_formats_sdm845
  3395. }
  3396. },
  3397. /* CSIPHY2 */
  3398. {
  3399. .regulators = {
  3400. { .supply = "vdda-phy", .init_load_uA = 15900 },
  3401. { .supply = "vdda-pll", .init_load_uA = 8900 }
  3402. },
  3403. .clock = { "csiphy_rx", "csiphy2", "csiphy2_timer"},
  3404. .clock_rate = {
  3405. { 400000000 },
  3406. { 0 },
  3407. { 400000000 },
  3408. },
  3409. .reg = { "csiphy2" },
  3410. .interrupt = { "csiphy2" },
  3411. .csiphy = {
  3412. .id = 2,
  3413. .hw_ops = &csiphy_ops_3ph_1_0,
  3414. .formats = &csiphy_formats_sdm845
  3415. }
  3416. },
  3417. /* CSIPHY3 */
  3418. {
  3419. .regulators = {
  3420. { .supply = "vdda-phy", .init_load_uA = 15900 },
  3421. { .supply = "vdda-pll", .init_load_uA = 8900 }
  3422. },
  3423. .clock = { "csiphy_rx", "csiphy3", "csiphy3_timer"},
  3424. .clock_rate = {
  3425. { 400000000 },
  3426. { 0 },
  3427. { 400000000 },
  3428. },
  3429. .reg = { "csiphy3" },
  3430. .interrupt = { "csiphy3" },
  3431. .csiphy = {
  3432. .id = 3,
  3433. .hw_ops = &csiphy_ops_3ph_1_0,
  3434. .formats = &csiphy_formats_sdm845
  3435. }
  3436. },
  3437. };
  3438. static const struct camss_subdev_resources csid_res_8775p[] = {
  3439. /* CSID0 */
  3440. {
  3441. .regulators = {},
  3442. .clock = { "csid", "csiphy_rx"},
  3443. .clock_rate = {
  3444. { 400000000, 400000000},
  3445. { 400000000, 400000000}
  3446. },
  3447. .reg = { "csid0" },
  3448. .interrupt = { "csid0" },
  3449. .csid = {
  3450. .is_lite = false,
  3451. .hw_ops = &csid_ops_gen3,
  3452. .parent_dev_ops = &vfe_parent_dev_ops,
  3453. .formats = &csid_formats_gen2
  3454. }
  3455. },
  3456. /* CSID1 */
  3457. {
  3458. .regulators = {},
  3459. .clock = { "csid", "csiphy_rx"},
  3460. .clock_rate = {
  3461. { 400000000, 400000000},
  3462. { 400000000, 400000000}
  3463. },
  3464. .reg = { "csid1" },
  3465. .interrupt = { "csid1" },
  3466. .csid = {
  3467. .is_lite = false,
  3468. .hw_ops = &csid_ops_gen3,
  3469. .parent_dev_ops = &vfe_parent_dev_ops,
  3470. .formats = &csid_formats_gen2
  3471. }
  3472. },
  3473. /* CSID2 (lite) */
  3474. {
  3475. .regulators = {},
  3476. .clock = { "cpas_vfe_lite", "vfe_lite_ahb",
  3477. "vfe_lite_csid", "vfe_lite_cphy_rx",
  3478. "vfe_lite"},
  3479. .clock_rate = {
  3480. { 0, 0, 400000000, 400000000, 0},
  3481. { 0, 0, 400000000, 480000000, 0}
  3482. },
  3483. .reg = { "csid_lite0" },
  3484. .interrupt = { "csid_lite0" },
  3485. .csid = {
  3486. .is_lite = true,
  3487. .hw_ops = &csid_ops_gen3,
  3488. .parent_dev_ops = &vfe_parent_dev_ops,
  3489. .formats = &csid_formats_gen2
  3490. }
  3491. },
  3492. /* CSID3 (lite) */
  3493. {
  3494. .regulators = {},
  3495. .clock = { "cpas_vfe_lite", "vfe_lite_ahb",
  3496. "vfe_lite_csid", "vfe_lite_cphy_rx",
  3497. "vfe_lite"},
  3498. .clock_rate = {
  3499. { 0, 0, 400000000, 400000000, 0},
  3500. { 0, 0, 400000000, 480000000, 0}
  3501. },
  3502. .reg = { "csid_lite1" },
  3503. .interrupt = { "csid_lite1" },
  3504. .csid = {
  3505. .is_lite = true,
  3506. .hw_ops = &csid_ops_gen3,
  3507. .parent_dev_ops = &vfe_parent_dev_ops,
  3508. .formats = &csid_formats_gen2
  3509. }
  3510. },
  3511. /* CSID4 (lite) */
  3512. {
  3513. .regulators = {},
  3514. .clock = { "cpas_vfe_lite", "vfe_lite_ahb",
  3515. "vfe_lite_csid", "vfe_lite_cphy_rx",
  3516. "vfe_lite"},
  3517. .clock_rate = {
  3518. { 0, 0, 400000000, 400000000, 0},
  3519. { 0, 0, 400000000, 480000000, 0}
  3520. },
  3521. .reg = { "csid_lite2" },
  3522. .interrupt = { "csid_lite2" },
  3523. .csid = {
  3524. .is_lite = true,
  3525. .hw_ops = &csid_ops_gen3,
  3526. .parent_dev_ops = &vfe_parent_dev_ops,
  3527. .formats = &csid_formats_gen2
  3528. }
  3529. },
  3530. /* CSID5 (lite) */
  3531. {
  3532. .regulators = {},
  3533. .clock = { "cpas_vfe_lite", "vfe_lite_ahb",
  3534. "vfe_lite_csid", "vfe_lite_cphy_rx",
  3535. "vfe_lite"},
  3536. .clock_rate = {
  3537. { 0, 0, 400000000, 400000000, 0},
  3538. { 0, 0, 400000000, 480000000, 0}
  3539. },
  3540. .reg = { "csid_lite3" },
  3541. .interrupt = { "csid_lite3" },
  3542. .csid = {
  3543. .is_lite = true,
  3544. .hw_ops = &csid_ops_gen3,
  3545. .parent_dev_ops = &vfe_parent_dev_ops,
  3546. .formats = &csid_formats_gen2
  3547. }
  3548. },
  3549. /* CSID6 (lite) */
  3550. {
  3551. .regulators = {},
  3552. .clock = { "cpas_vfe_lite", "vfe_lite_ahb",
  3553. "vfe_lite_csid", "vfe_lite_cphy_rx",
  3554. "vfe_lite"},
  3555. .clock_rate = {
  3556. { 0, 0, 400000000, 400000000, 0},
  3557. { 0, 0, 400000000, 480000000, 0}
  3558. },
  3559. .reg = { "csid_lite4" },
  3560. .interrupt = { "csid_lite4" },
  3561. .csid = {
  3562. .is_lite = true,
  3563. .hw_ops = &csid_ops_gen3,
  3564. .parent_dev_ops = &vfe_parent_dev_ops,
  3565. .formats = &csid_formats_gen2
  3566. }
  3567. },
  3568. };
  3569. static const struct camss_subdev_resources vfe_res_8775p[] = {
  3570. /* VFE0 */
  3571. {
  3572. .regulators = {},
  3573. .clock = { "cpas_vfe0", "vfe0", "vfe0_fast_ahb",
  3574. "cpas_ahb", "gcc_axi_hf",
  3575. "cpas_fast_ahb_clk",
  3576. "camnoc_axi"},
  3577. .clock_rate = {
  3578. { 0 },
  3579. { 480000000 },
  3580. { 300000000, 400000000 },
  3581. { 300000000, 400000000 },
  3582. { 0 },
  3583. { 300000000, 400000000 },
  3584. { 400000000 },
  3585. },
  3586. .reg = { "vfe0" },
  3587. .interrupt = { "vfe0" },
  3588. .vfe = {
  3589. .line_num = 3,
  3590. .is_lite = false,
  3591. .has_pd = false,
  3592. .pd_name = NULL,
  3593. .hw_ops = &vfe_ops_gen3,
  3594. .formats_rdi = &vfe_formats_rdi_845,
  3595. .formats_pix = &vfe_formats_pix_845
  3596. }
  3597. },
  3598. /* VFE1 */
  3599. {
  3600. .regulators = {},
  3601. .clock = { "cpas_vfe1", "vfe1", "vfe1_fast_ahb",
  3602. "cpas_ahb", "gcc_axi_hf",
  3603. "cpas_fast_ahb_clk",
  3604. "camnoc_axi"},
  3605. .clock_rate = {
  3606. { 0 },
  3607. { 480000000 },
  3608. { 300000000, 400000000 },
  3609. { 300000000, 400000000 },
  3610. { 0 },
  3611. { 300000000, 400000000 },
  3612. { 400000000 },
  3613. },
  3614. .reg = { "vfe1" },
  3615. .interrupt = { "vfe1" },
  3616. .vfe = {
  3617. .line_num = 3,
  3618. .is_lite = false,
  3619. .has_pd = false,
  3620. .pd_name = NULL,
  3621. .hw_ops = &vfe_ops_gen3,
  3622. .formats_rdi = &vfe_formats_rdi_845,
  3623. .formats_pix = &vfe_formats_pix_845
  3624. }
  3625. },
  3626. /* VFE2 (lite) */
  3627. {
  3628. .regulators = {},
  3629. .clock = { "cpas_vfe_lite", "vfe_lite_ahb",
  3630. "vfe_lite_csid", "vfe_lite_cphy_rx",
  3631. "vfe_lite"},
  3632. .clock_rate = {
  3633. { 0, 0, 0, 0 },
  3634. { 300000000, 400000000, 400000000, 400000000 },
  3635. { 400000000, 400000000, 400000000, 400000000 },
  3636. { 400000000, 400000000, 400000000, 400000000 },
  3637. { 480000000, 600000000, 600000000, 600000000 },
  3638. },
  3639. .reg = { "vfe_lite0" },
  3640. .interrupt = { "vfe_lite0" },
  3641. .vfe = {
  3642. .line_num = 4,
  3643. .is_lite = true,
  3644. .hw_ops = &vfe_ops_gen3,
  3645. .formats_rdi = &vfe_formats_rdi_845,
  3646. .formats_pix = &vfe_formats_pix_845
  3647. }
  3648. },
  3649. /* VFE3 (lite) */
  3650. {
  3651. .regulators = {},
  3652. .clock = { "cpas_vfe_lite", "vfe_lite_ahb",
  3653. "vfe_lite_csid", "vfe_lite_cphy_rx",
  3654. "vfe_lite"},
  3655. .clock_rate = {
  3656. { 0, 0, 0, 0 },
  3657. { 300000000, 400000000, 400000000, 400000000 },
  3658. { 400000000, 400000000, 400000000, 400000000 },
  3659. { 400000000, 400000000, 400000000, 400000000 },
  3660. { 480000000, 600000000, 600000000, 600000000 },
  3661. },
  3662. .reg = { "vfe_lite1" },
  3663. .interrupt = { "vfe_lite1" },
  3664. .vfe = {
  3665. .line_num = 4,
  3666. .is_lite = true,
  3667. .hw_ops = &vfe_ops_gen3,
  3668. .formats_rdi = &vfe_formats_rdi_845,
  3669. .formats_pix = &vfe_formats_pix_845
  3670. }
  3671. },
  3672. /* VFE4 (lite) */
  3673. {
  3674. .regulators = {},
  3675. .clock = { "cpas_vfe_lite", "vfe_lite_ahb",
  3676. "vfe_lite_csid", "vfe_lite_cphy_rx",
  3677. "vfe_lite"},
  3678. .clock_rate = {
  3679. { 0, 0, 0, 0 },
  3680. { 300000000, 400000000, 400000000, 400000000 },
  3681. { 400000000, 400000000, 400000000, 400000000 },
  3682. { 400000000, 400000000, 400000000, 400000000 },
  3683. { 480000000, 600000000, 600000000, 600000000 },
  3684. },
  3685. .reg = { "vfe_lite2" },
  3686. .interrupt = { "vfe_lite2" },
  3687. .vfe = {
  3688. .line_num = 4,
  3689. .is_lite = true,
  3690. .hw_ops = &vfe_ops_gen3,
  3691. .formats_rdi = &vfe_formats_rdi_845,
  3692. .formats_pix = &vfe_formats_pix_845
  3693. }
  3694. },
  3695. /* VFE5 (lite) */
  3696. {
  3697. .regulators = {},
  3698. .clock = { "cpas_vfe_lite", "vfe_lite_ahb",
  3699. "vfe_lite_csid", "vfe_lite_cphy_rx",
  3700. "vfe_lite"},
  3701. .clock_rate = {
  3702. { 0, 0, 0, 0 },
  3703. { 300000000, 400000000, 400000000, 400000000 },
  3704. { 400000000, 400000000, 400000000, 400000000 },
  3705. { 400000000, 400000000, 400000000, 400000000 },
  3706. { 480000000, 600000000, 600000000, 600000000 },
  3707. },
  3708. .reg = { "vfe_lite3" },
  3709. .interrupt = { "vfe_lite3" },
  3710. .vfe = {
  3711. .line_num = 4,
  3712. .is_lite = true,
  3713. .hw_ops = &vfe_ops_gen3,
  3714. .formats_rdi = &vfe_formats_rdi_845,
  3715. .formats_pix = &vfe_formats_pix_845
  3716. }
  3717. },
  3718. /* VFE6 (lite) */
  3719. {
  3720. .regulators = {},
  3721. .clock = { "cpas_vfe_lite", "vfe_lite_ahb",
  3722. "vfe_lite_csid", "vfe_lite_cphy_rx",
  3723. "vfe_lite"},
  3724. .clock_rate = {
  3725. { 0, 0, 0, 0 },
  3726. { 300000000, 400000000, 400000000, 400000000 },
  3727. { 400000000, 400000000, 400000000, 400000000 },
  3728. { 400000000, 400000000, 400000000, 400000000 },
  3729. { 480000000, 600000000, 600000000, 600000000 },
  3730. },
  3731. .reg = { "vfe_lite4" },
  3732. .interrupt = { "vfe_lite4" },
  3733. .vfe = {
  3734. .line_num = 4,
  3735. .is_lite = true,
  3736. .hw_ops = &vfe_ops_gen3,
  3737. .formats_rdi = &vfe_formats_rdi_845,
  3738. .formats_pix = &vfe_formats_pix_845
  3739. }
  3740. },
  3741. };
  3742. static const struct resources_icc icc_res_qcs8300[] = {
  3743. {
  3744. .name = "ahb",
  3745. .icc_bw_tbl.avg = 38400,
  3746. .icc_bw_tbl.peak = 76800,
  3747. },
  3748. {
  3749. .name = "hf_0",
  3750. .icc_bw_tbl.avg = 2097152,
  3751. .icc_bw_tbl.peak = 2097152,
  3752. },
  3753. };
  3754. static const struct resources_icc icc_res_sa8775p[] = {
  3755. {
  3756. .name = "ahb",
  3757. .icc_bw_tbl.avg = 38400,
  3758. .icc_bw_tbl.peak = 76800,
  3759. },
  3760. {
  3761. .name = "hf_0",
  3762. .icc_bw_tbl.avg = 2097152,
  3763. .icc_bw_tbl.peak = 2097152,
  3764. },
  3765. };
  3766. static const struct camss_subdev_resources csiphy_res_x1e80100[] = {
  3767. /* CSIPHY0 */
  3768. {
  3769. .regulators = {
  3770. { .supply = "vdd-csiphy-0p8", .init_load_uA = 105000 },
  3771. { .supply = "vdd-csiphy-1p2", .init_load_uA = 58900 }
  3772. },
  3773. .clock = { "csiphy0", "csiphy0_timer" },
  3774. .clock_rate = { { 300000000, 400000000, 480000000 },
  3775. { 266666667, 400000000 } },
  3776. .reg = { "csiphy0" },
  3777. .interrupt = { "csiphy0" },
  3778. .csiphy = {
  3779. .id = 0,
  3780. .hw_ops = &csiphy_ops_3ph_1_0,
  3781. .formats = &csiphy_formats_sdm845
  3782. },
  3783. },
  3784. /* CSIPHY1 */
  3785. {
  3786. .regulators = {
  3787. { .supply = "vdd-csiphy-0p8", .init_load_uA = 105000 },
  3788. { .supply = "vdd-csiphy-1p2", .init_load_uA = 58900 }
  3789. },
  3790. .clock = { "csiphy1", "csiphy1_timer" },
  3791. .clock_rate = { { 300000000, 400000000, 480000000 },
  3792. { 266666667, 400000000 } },
  3793. .reg = { "csiphy1" },
  3794. .interrupt = { "csiphy1" },
  3795. .csiphy = {
  3796. .id = 1,
  3797. .hw_ops = &csiphy_ops_3ph_1_0,
  3798. .formats = &csiphy_formats_sdm845
  3799. },
  3800. },
  3801. /* CSIPHY2 */
  3802. {
  3803. .regulators = {
  3804. { .supply = "vdd-csiphy-0p8", .init_load_uA = 105000 },
  3805. { .supply = "vdd-csiphy-1p2", .init_load_uA = 58900 }
  3806. },
  3807. .clock = { "csiphy2", "csiphy2_timer" },
  3808. .clock_rate = { { 300000000, 400000000, 480000000 },
  3809. { 266666667, 400000000 } },
  3810. .reg = { "csiphy2" },
  3811. .interrupt = { "csiphy2" },
  3812. .csiphy = {
  3813. .id = 2,
  3814. .hw_ops = &csiphy_ops_3ph_1_0,
  3815. .formats = &csiphy_formats_sdm845
  3816. },
  3817. },
  3818. /* CSIPHY4 */
  3819. {
  3820. .regulators = {
  3821. { .supply = "vdd-csiphy-0p8", .init_load_uA = 105000 },
  3822. { .supply = "vdd-csiphy-1p2", .init_load_uA = 58900 }
  3823. },
  3824. .clock = { "csiphy4", "csiphy4_timer" },
  3825. .clock_rate = { { 300000000, 400000000, 480000000 },
  3826. { 266666667, 400000000 } },
  3827. .reg = { "csiphy4" },
  3828. .interrupt = { "csiphy4" },
  3829. .csiphy = {
  3830. .id = 4,
  3831. .hw_ops = &csiphy_ops_3ph_1_0,
  3832. .formats = &csiphy_formats_sdm845
  3833. },
  3834. },
  3835. };
  3836. static const struct camss_subdev_resources csid_res_x1e80100[] = {
  3837. /* CSID0 */
  3838. {
  3839. .regulators = {},
  3840. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb",
  3841. "cpas_fast_ahb", "csid", "csid_csiphy_rx" },
  3842. .clock_rate = { { 0 },
  3843. { 0 },
  3844. { 64000000, 80000000 },
  3845. { 80000000, 100000000, 200000000,
  3846. 300000000, 400000000 },
  3847. { 300000000, 400000000, 480000000 },
  3848. { 300000000, 400000000, 480000000 }, },
  3849. .reg = { "csid0" },
  3850. .interrupt = { "csid0" },
  3851. .csid = {
  3852. .hw_ops = &csid_ops_680,
  3853. .parent_dev_ops = &vfe_parent_dev_ops,
  3854. .formats = &csid_formats_gen2
  3855. },
  3856. },
  3857. /* CSID1 */
  3858. {
  3859. .regulators = {},
  3860. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb",
  3861. "cpas_fast_ahb", "csid", "csid_csiphy_rx" },
  3862. .clock_rate = { { 0 },
  3863. { 0 },
  3864. { 64000000, 80000000 },
  3865. { 80000000, 100000000, 200000000,
  3866. 300000000, 400000000 },
  3867. { 300000000, 400000000, 480000000 },
  3868. { 300000000, 400000000, 480000000 }, },
  3869. .reg = { "csid1" },
  3870. .interrupt = { "csid1" },
  3871. .csid = {
  3872. .hw_ops = &csid_ops_680,
  3873. .parent_dev_ops = &vfe_parent_dev_ops,
  3874. .formats = &csid_formats_gen2
  3875. },
  3876. },
  3877. /* CSID2 */
  3878. {
  3879. .regulators = {},
  3880. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb",
  3881. "cpas_fast_ahb", "csid", "csid_csiphy_rx" },
  3882. .clock_rate = { { 0 },
  3883. { 0 },
  3884. { 64000000, 80000000 },
  3885. { 80000000, 100000000, 200000000,
  3886. 300000000, 400000000 },
  3887. { 300000000, 400000000, 480000000 },
  3888. { 300000000, 400000000, 480000000 }, },
  3889. .reg = { "csid2" },
  3890. .interrupt = { "csid2" },
  3891. .csid = {
  3892. .hw_ops = &csid_ops_680,
  3893. .parent_dev_ops = &vfe_parent_dev_ops,
  3894. .formats = &csid_formats_gen2
  3895. },
  3896. },
  3897. /* CSID_LITE0 */
  3898. {
  3899. .regulators = {},
  3900. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb",
  3901. "cpas_fast_ahb", "csid", "csid_csiphy_rx" },
  3902. .clock_rate = { { 0 },
  3903. { 0 },
  3904. { 64000000, 80000000 },
  3905. { 80000000, 100000000, 200000000,
  3906. 300000000, 400000000 },
  3907. { 300000000, 400000000, 480000000 },
  3908. { 300000000, 400000000, 480000000 }, },
  3909. .reg = { "csid_lite0" },
  3910. .interrupt = { "csid_lite0" },
  3911. .csid = {
  3912. .is_lite = true,
  3913. .hw_ops = &csid_ops_680,
  3914. .parent_dev_ops = &vfe_parent_dev_ops,
  3915. .formats = &csid_formats_gen2
  3916. }
  3917. },
  3918. /* CSID_LITE1 */
  3919. {
  3920. .regulators = {},
  3921. .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb",
  3922. "cpas_fast_ahb", "csid", "csid_csiphy_rx" },
  3923. .clock_rate = { { 0 },
  3924. { 0 },
  3925. { 64000000, 80000000 },
  3926. { 80000000, 100000000, 200000000,
  3927. 300000000, 400000000 },
  3928. { 300000000, 400000000, 480000000 },
  3929. { 300000000, 400000000, 480000000 }, },
  3930. .reg = { "csid_lite1" },
  3931. .interrupt = { "csid_lite1" },
  3932. .csid = {
  3933. .is_lite = true,
  3934. .hw_ops = &csid_ops_680,
  3935. .parent_dev_ops = &vfe_parent_dev_ops,
  3936. .formats = &csid_formats_gen2
  3937. }
  3938. },
  3939. };
  3940. static const struct camss_subdev_resources vfe_res_x1e80100[] = {
  3941. /* IFE0 */
  3942. {
  3943. .regulators = {},
  3944. .clock = {"camnoc_rt_axi", "camnoc_nrt_axi", "cpas_ahb",
  3945. "cpas_fast_ahb", "cpas_vfe0", "vfe0_fast_ahb",
  3946. "vfe0" },
  3947. .clock_rate = { { 0 },
  3948. { 0 },
  3949. { 0 },
  3950. { 0 },
  3951. { 0 },
  3952. { 0 },
  3953. { 345600000, 432000000, 594000000, 675000000,
  3954. 727000000 }, },
  3955. .reg = { "vfe0" },
  3956. .interrupt = { "vfe0" },
  3957. .vfe = {
  3958. .line_num = 4,
  3959. .pd_name = "ife0",
  3960. .hw_ops = &vfe_ops_680,
  3961. .formats_rdi = &vfe_formats_rdi_845,
  3962. .formats_pix = &vfe_formats_pix_845
  3963. },
  3964. },
  3965. /* IFE1 */
  3966. {
  3967. .regulators = {},
  3968. .clock = { "camnoc_rt_axi", "camnoc_nrt_axi", "cpas_ahb",
  3969. "cpas_fast_ahb", "cpas_vfe1", "vfe1_fast_ahb",
  3970. "vfe1" },
  3971. .clock_rate = { { 0 },
  3972. { 0 },
  3973. { 0 },
  3974. { 0 },
  3975. { 0 },
  3976. { 0 },
  3977. { 345600000, 432000000, 594000000, 675000000,
  3978. 727000000 }, },
  3979. .reg = { "vfe1" },
  3980. .interrupt = { "vfe1" },
  3981. .vfe = {
  3982. .line_num = 4,
  3983. .pd_name = "ife1",
  3984. .hw_ops = &vfe_ops_680,
  3985. .formats_rdi = &vfe_formats_rdi_845,
  3986. .formats_pix = &vfe_formats_pix_845
  3987. },
  3988. },
  3989. /* IFE_LITE_0 */
  3990. {
  3991. .regulators = {},
  3992. .clock = { "camnoc_rt_axi", "camnoc_nrt_axi", "cpas_ahb",
  3993. "vfe_lite_ahb", "cpas_vfe_lite", "vfe_lite",
  3994. "vfe_lite_csid" },
  3995. .clock_rate = { { 0 },
  3996. { 0 },
  3997. { 0 },
  3998. { 0 },
  3999. { 0 },
  4000. { 266666667, 400000000, 480000000 },
  4001. { 266666667, 400000000, 480000000 }, },
  4002. .reg = { "vfe_lite0" },
  4003. .interrupt = { "vfe_lite0" },
  4004. .vfe = {
  4005. .is_lite = true,
  4006. .line_num = 4,
  4007. .hw_ops = &vfe_ops_680,
  4008. .formats_rdi = &vfe_formats_rdi_845,
  4009. .formats_pix = &vfe_formats_pix_845
  4010. },
  4011. },
  4012. /* IFE_LITE_1 */
  4013. {
  4014. .regulators = {},
  4015. .clock = { "camnoc_rt_axi", "camnoc_nrt_axi", "cpas_ahb",
  4016. "vfe_lite_ahb", "cpas_vfe_lite", "vfe_lite",
  4017. "vfe_lite_csid" },
  4018. .clock_rate = { { 0 },
  4019. { 0 },
  4020. { 0 },
  4021. { 0 },
  4022. { 0 },
  4023. { 266666667, 400000000, 480000000 },
  4024. { 266666667, 400000000, 480000000 }, },
  4025. .reg = { "vfe_lite1" },
  4026. .interrupt = { "vfe_lite1" },
  4027. .vfe = {
  4028. .is_lite = true,
  4029. .line_num = 4,
  4030. .hw_ops = &vfe_ops_680,
  4031. .formats_rdi = &vfe_formats_rdi_845,
  4032. .formats_pix = &vfe_formats_pix_845
  4033. },
  4034. },
  4035. };
  4036. static const struct resources_icc icc_res_x1e80100[] = {
  4037. {
  4038. .name = "ahb",
  4039. .icc_bw_tbl.avg = 150000,
  4040. .icc_bw_tbl.peak = 300000,
  4041. },
  4042. {
  4043. .name = "hf_mnoc",
  4044. .icc_bw_tbl.avg = 2097152,
  4045. .icc_bw_tbl.peak = 2097152,
  4046. },
  4047. {
  4048. .name = "sf_mnoc",
  4049. .icc_bw_tbl.avg = 2097152,
  4050. .icc_bw_tbl.peak = 2097152,
  4051. },
  4052. {
  4053. .name = "sf_icp_mnoc",
  4054. .icc_bw_tbl.avg = 2097152,
  4055. .icc_bw_tbl.peak = 2097152,
  4056. },
  4057. };
  4058. static const struct resources_wrapper csid_wrapper_res_x1e80100 = {
  4059. .reg = "csid_wrapper",
  4060. };
  4061. /*
  4062. * camss_add_clock_margin - Add margin to clock frequency rate
  4063. * @rate: Clock frequency rate
  4064. *
  4065. * When making calculations with physical clock frequency values
  4066. * some safety margin must be added. Add it.
  4067. */
  4068. inline void camss_add_clock_margin(u64 *rate)
  4069. {
  4070. *rate *= CAMSS_CLOCK_MARGIN_NUMERATOR;
  4071. *rate = div_u64(*rate, CAMSS_CLOCK_MARGIN_DENOMINATOR);
  4072. }
  4073. /*
  4074. * camss_enable_clocks - Enable multiple clocks
  4075. * @nclocks: Number of clocks in clock array
  4076. * @clock: Clock array
  4077. * @dev: Device
  4078. *
  4079. * Return 0 on success or a negative error code otherwise
  4080. */
  4081. int camss_enable_clocks(int nclocks, struct camss_clock *clock,
  4082. struct device *dev)
  4083. {
  4084. int ret;
  4085. int i;
  4086. for (i = 0; i < nclocks; i++) {
  4087. ret = clk_prepare_enable(clock[i].clk);
  4088. if (ret) {
  4089. dev_err(dev, "clock enable failed: %d\n", ret);
  4090. goto error;
  4091. }
  4092. }
  4093. return 0;
  4094. error:
  4095. for (i--; i >= 0; i--)
  4096. clk_disable_unprepare(clock[i].clk);
  4097. return ret;
  4098. }
  4099. /*
  4100. * camss_disable_clocks - Disable multiple clocks
  4101. * @nclocks: Number of clocks in clock array
  4102. * @clock: Clock array
  4103. */
  4104. void camss_disable_clocks(int nclocks, struct camss_clock *clock)
  4105. {
  4106. int i;
  4107. for (i = nclocks - 1; i >= 0; i--)
  4108. clk_disable_unprepare(clock[i].clk);
  4109. }
  4110. /*
  4111. * camss_find_sensor_pad - Find the media pad via which the sensor is linked
  4112. * @entity: Media entity to start searching from
  4113. *
  4114. * Return a pointer to sensor media pad or NULL if not found
  4115. */
  4116. struct media_pad *camss_find_sensor_pad(struct media_entity *entity)
  4117. {
  4118. struct media_pad *pad;
  4119. while (1) {
  4120. pad = &entity->pads[0];
  4121. if (!(pad->flags & MEDIA_PAD_FL_SINK))
  4122. return NULL;
  4123. pad = media_pad_remote_pad_first(pad);
  4124. if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
  4125. return NULL;
  4126. entity = pad->entity;
  4127. if (entity->function == MEDIA_ENT_F_CAM_SENSOR)
  4128. return pad;
  4129. }
  4130. }
  4131. /**
  4132. * camss_get_link_freq - Get link frequency from sensor
  4133. * @entity: Media entity in the current pipeline
  4134. * @bpp: Number of bits per pixel for the current format
  4135. * @lanes: Number of lanes in the link to the sensor
  4136. *
  4137. * Return link frequency on success or a negative error code otherwise
  4138. */
  4139. s64 camss_get_link_freq(struct media_entity *entity, unsigned int bpp,
  4140. unsigned int lanes)
  4141. {
  4142. struct media_pad *sensor_pad;
  4143. sensor_pad = camss_find_sensor_pad(entity);
  4144. if (!sensor_pad)
  4145. return -ENODEV;
  4146. return v4l2_get_link_freq(sensor_pad, bpp, 2 * lanes);
  4147. }
  4148. /*
  4149. * camss_get_pixel_clock - Get pixel clock rate from sensor
  4150. * @entity: Media entity in the current pipeline
  4151. * @pixel_clock: Received pixel clock value
  4152. *
  4153. * Return 0 on success or a negative error code otherwise
  4154. */
  4155. int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock)
  4156. {
  4157. struct media_pad *sensor_pad;
  4158. struct v4l2_subdev *subdev;
  4159. struct v4l2_ctrl *ctrl;
  4160. sensor_pad = camss_find_sensor_pad(entity);
  4161. if (!sensor_pad)
  4162. return -ENODEV;
  4163. subdev = media_entity_to_v4l2_subdev(sensor_pad->entity);
  4164. ctrl = v4l2_ctrl_find(subdev->ctrl_handler, V4L2_CID_PIXEL_RATE);
  4165. if (!ctrl)
  4166. return -EINVAL;
  4167. *pixel_clock = v4l2_ctrl_g_ctrl_int64(ctrl);
  4168. return 0;
  4169. }
  4170. int camss_pm_domain_on(struct camss *camss, int id)
  4171. {
  4172. int ret = 0;
  4173. if (id < camss->res->vfe_num) {
  4174. struct vfe_device *vfe = &camss->vfe[id];
  4175. ret = vfe->res->hw_ops->pm_domain_on(vfe);
  4176. }
  4177. return ret;
  4178. }
  4179. void camss_pm_domain_off(struct camss *camss, int id)
  4180. {
  4181. if (id < camss->res->vfe_num) {
  4182. struct vfe_device *vfe = &camss->vfe[id];
  4183. vfe->res->hw_ops->pm_domain_off(vfe);
  4184. }
  4185. }
  4186. static int vfe_parent_dev_ops_get(struct camss *camss, int id)
  4187. {
  4188. int ret = -EINVAL;
  4189. if (id < camss->res->vfe_num) {
  4190. struct vfe_device *vfe = &camss->vfe[id];
  4191. ret = vfe_get(vfe);
  4192. }
  4193. return ret;
  4194. }
  4195. static int vfe_parent_dev_ops_put(struct camss *camss, int id)
  4196. {
  4197. if (id < camss->res->vfe_num) {
  4198. struct vfe_device *vfe = &camss->vfe[id];
  4199. vfe_put(vfe);
  4200. }
  4201. return 0;
  4202. }
  4203. static void __iomem
  4204. *vfe_parent_dev_ops_get_base_address(struct camss *camss, int id)
  4205. {
  4206. if (id < camss->res->vfe_num) {
  4207. struct vfe_device *vfe = &camss->vfe[id];
  4208. return vfe->base;
  4209. }
  4210. return NULL;
  4211. }
  4212. static const struct parent_dev_ops vfe_parent_dev_ops = {
  4213. .get = vfe_parent_dev_ops_get,
  4214. .put = vfe_parent_dev_ops_put,
  4215. .get_base_address = vfe_parent_dev_ops_get_base_address
  4216. };
  4217. /*
  4218. * camss_parse_endpoint_node - Parse port endpoint node
  4219. * @dev: CAMSS device
  4220. * @ep: Device endpoint to be parsed
  4221. * @csd: Parsed data from port endpoint node
  4222. *
  4223. * Return 0 on success or a negative error code on failure
  4224. */
  4225. static int camss_parse_endpoint_node(struct device *dev,
  4226. struct fwnode_handle *ep,
  4227. struct camss_async_subdev *csd)
  4228. {
  4229. struct csiphy_lanes_cfg *lncfg = &csd->interface.csi2.lane_cfg;
  4230. struct v4l2_mbus_config_mipi_csi2 *mipi_csi2;
  4231. struct v4l2_fwnode_endpoint vep = { { 0 } };
  4232. unsigned int i;
  4233. int ret;
  4234. ret = v4l2_fwnode_endpoint_parse(ep, &vep);
  4235. if (ret)
  4236. return ret;
  4237. /*
  4238. * Most SoCs support both D-PHY and C-PHY standards, but currently only
  4239. * D-PHY is supported in the driver.
  4240. */
  4241. if (vep.bus_type != V4L2_MBUS_CSI2_DPHY) {
  4242. dev_err(dev, "Unsupported bus type %d\n", vep.bus_type);
  4243. return -EINVAL;
  4244. }
  4245. csd->interface.csiphy_id = vep.base.port;
  4246. mipi_csi2 = &vep.bus.mipi_csi2;
  4247. lncfg->clk.pos = mipi_csi2->clock_lane;
  4248. lncfg->clk.pol = mipi_csi2->lane_polarities[0];
  4249. lncfg->num_data = mipi_csi2->num_data_lanes;
  4250. lncfg->data = devm_kcalloc(dev,
  4251. lncfg->num_data, sizeof(*lncfg->data),
  4252. GFP_KERNEL);
  4253. if (!lncfg->data)
  4254. return -ENOMEM;
  4255. for (i = 0; i < lncfg->num_data; i++) {
  4256. lncfg->data[i].pos = mipi_csi2->data_lanes[i];
  4257. lncfg->data[i].pol = mipi_csi2->lane_polarities[i + 1];
  4258. }
  4259. return 0;
  4260. }
  4261. /*
  4262. * camss_parse_ports - Parse ports node
  4263. * @dev: CAMSS device
  4264. *
  4265. * Return 0 on success or a negative error code on failure
  4266. */
  4267. static int camss_parse_ports(struct camss *camss)
  4268. {
  4269. struct device *dev = camss->dev;
  4270. struct fwnode_handle *fwnode = dev_fwnode(dev), *ep;
  4271. int ret;
  4272. fwnode_graph_for_each_endpoint(fwnode, ep) {
  4273. struct camss_async_subdev *csd;
  4274. csd = v4l2_async_nf_add_fwnode_remote(&camss->notifier, ep,
  4275. typeof(*csd));
  4276. if (IS_ERR(csd)) {
  4277. ret = PTR_ERR(csd);
  4278. goto err_cleanup;
  4279. }
  4280. ret = camss_parse_endpoint_node(dev, ep, csd);
  4281. if (ret < 0)
  4282. goto err_cleanup;
  4283. }
  4284. return 0;
  4285. err_cleanup:
  4286. fwnode_handle_put(ep);
  4287. return ret;
  4288. }
  4289. /*
  4290. * camss_init_subdevices - Initialize subdev structures and resources
  4291. * @camss: CAMSS device
  4292. *
  4293. * Return 0 on success or a negative error code on failure
  4294. */
  4295. static int camss_init_subdevices(struct camss *camss)
  4296. {
  4297. struct platform_device *pdev = to_platform_device(camss->dev);
  4298. const struct camss_resources *res = camss->res;
  4299. unsigned int i;
  4300. int ret;
  4301. for (i = 0; i < camss->res->csiphy_num; i++) {
  4302. ret = msm_csiphy_subdev_init(camss, &camss->csiphy[i],
  4303. &res->csiphy_res[i],
  4304. res->csiphy_res[i].csiphy.id);
  4305. if (ret < 0) {
  4306. dev_err(camss->dev,
  4307. "Failed to init csiphy%d sub-device: %d\n",
  4308. i, ret);
  4309. return ret;
  4310. }
  4311. }
  4312. /* note: SM8250 requires VFE to be initialized before CSID */
  4313. for (i = 0; i < camss->res->vfe_num; i++) {
  4314. ret = msm_vfe_subdev_init(camss, &camss->vfe[i],
  4315. &res->vfe_res[i], i);
  4316. if (ret < 0) {
  4317. dev_err(camss->dev,
  4318. "Fail to init vfe%d sub-device: %d\n", i, ret);
  4319. return ret;
  4320. }
  4321. }
  4322. /* Get optional CSID wrapper regs shared between CSID devices */
  4323. if (res->csid_wrapper_res) {
  4324. char *reg = res->csid_wrapper_res->reg;
  4325. void __iomem *base;
  4326. base = devm_platform_ioremap_resource_byname(pdev, reg);
  4327. if (IS_ERR(base))
  4328. return PTR_ERR(base);
  4329. camss->csid_wrapper_base = base;
  4330. }
  4331. for (i = 0; i < camss->res->csid_num; i++) {
  4332. ret = msm_csid_subdev_init(camss, &camss->csid[i],
  4333. &res->csid_res[i], i);
  4334. if (ret < 0) {
  4335. dev_err(camss->dev,
  4336. "Failed to init csid%d sub-device: %d\n",
  4337. i, ret);
  4338. return ret;
  4339. }
  4340. }
  4341. ret = msm_ispif_subdev_init(camss, res->ispif_res);
  4342. if (ret < 0) {
  4343. dev_err(camss->dev, "Failed to init ispif sub-device: %d\n",
  4344. ret);
  4345. return ret;
  4346. }
  4347. return 0;
  4348. }
  4349. /*
  4350. * camss_link_err - print error in case link creation fails
  4351. * @src_name: name for source of the link
  4352. * @sink_name: name for sink of the link
  4353. */
  4354. inline void camss_link_err(struct camss *camss,
  4355. const char *src_name,
  4356. const char *sink_name,
  4357. int ret)
  4358. {
  4359. dev_err(camss->dev,
  4360. "Failed to link %s->%s entities: %d\n",
  4361. src_name,
  4362. sink_name,
  4363. ret);
  4364. }
  4365. /*
  4366. * camss_link_entities - Register subdev nodes and create links
  4367. * @camss: CAMSS device
  4368. *
  4369. * Return 0 on success or a negative error code on failure
  4370. */
  4371. static int camss_link_entities(struct camss *camss)
  4372. {
  4373. int i, j, k;
  4374. int ret;
  4375. for (i = 0; i < camss->res->csiphy_num; i++) {
  4376. for (j = 0; j < camss->res->csid_num; j++) {
  4377. ret = media_create_pad_link(&camss->csiphy[i].subdev.entity,
  4378. MSM_CSIPHY_PAD_SRC,
  4379. &camss->csid[j].subdev.entity,
  4380. MSM_CSID_PAD_SINK,
  4381. 0);
  4382. if (ret < 0) {
  4383. camss_link_err(camss,
  4384. camss->csiphy[i].subdev.entity.name,
  4385. camss->csid[j].subdev.entity.name,
  4386. ret);
  4387. return ret;
  4388. }
  4389. }
  4390. }
  4391. if (camss->ispif) {
  4392. for (i = 0; i < camss->res->csid_num; i++) {
  4393. for (j = 0; j < camss->ispif->line_num; j++) {
  4394. ret = media_create_pad_link(&camss->csid[i].subdev.entity,
  4395. MSM_CSID_PAD_SRC,
  4396. &camss->ispif->line[j].subdev.entity,
  4397. MSM_ISPIF_PAD_SINK,
  4398. 0);
  4399. if (ret < 0) {
  4400. camss_link_err(camss,
  4401. camss->csid[i].subdev.entity.name,
  4402. camss->ispif->line[j].subdev.entity.name,
  4403. ret);
  4404. return ret;
  4405. }
  4406. }
  4407. }
  4408. for (i = 0; i < camss->ispif->line_num; i++)
  4409. for (k = 0; k < camss->res->vfe_num; k++)
  4410. for (j = 0; j < camss->vfe[k].res->line_num; j++) {
  4411. struct v4l2_subdev *ispif = &camss->ispif->line[i].subdev;
  4412. struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev;
  4413. ret = media_create_pad_link(&ispif->entity,
  4414. MSM_ISPIF_PAD_SRC,
  4415. &vfe->entity,
  4416. MSM_VFE_PAD_SINK,
  4417. 0);
  4418. if (ret < 0) {
  4419. camss_link_err(camss, ispif->entity.name,
  4420. vfe->entity.name,
  4421. ret);
  4422. return ret;
  4423. }
  4424. }
  4425. } else {
  4426. for (i = 0; i < camss->res->csid_num; i++)
  4427. for (k = 0; k < camss->res->vfe_num; k++)
  4428. for (j = 0; j < camss->vfe[k].res->line_num; j++) {
  4429. struct v4l2_subdev *csid = &camss->csid[i].subdev;
  4430. struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev;
  4431. ret = media_create_pad_link(&csid->entity,
  4432. MSM_CSID_PAD_FIRST_SRC + j,
  4433. &vfe->entity,
  4434. MSM_VFE_PAD_SINK,
  4435. 0);
  4436. if (ret < 0) {
  4437. camss_link_err(camss, csid->entity.name,
  4438. vfe->entity.name,
  4439. ret);
  4440. return ret;
  4441. }
  4442. }
  4443. }
  4444. return 0;
  4445. }
  4446. void camss_reg_update(struct camss *camss, int hw_id, int port_id, bool is_clear)
  4447. {
  4448. struct csid_device *csid;
  4449. if (hw_id < camss->res->csid_num) {
  4450. csid = &camss->csid[hw_id];
  4451. csid->res->hw_ops->reg_update(csid, port_id, is_clear);
  4452. }
  4453. }
  4454. void camss_buf_done(struct camss *camss, int hw_id, int port_id)
  4455. {
  4456. struct vfe_device *vfe;
  4457. if (hw_id < camss->res->vfe_num) {
  4458. vfe = &camss->vfe[hw_id];
  4459. vfe->res->hw_ops->vfe_buf_done(vfe, port_id);
  4460. }
  4461. }
  4462. /*
  4463. * camss_register_entities - Register subdev nodes and create links
  4464. * @camss: CAMSS device
  4465. *
  4466. * Return 0 on success or a negative error code on failure
  4467. */
  4468. static int camss_register_entities(struct camss *camss)
  4469. {
  4470. int i;
  4471. int ret;
  4472. for (i = 0; i < camss->res->csiphy_num; i++) {
  4473. ret = msm_csiphy_register_entity(&camss->csiphy[i],
  4474. &camss->v4l2_dev);
  4475. if (ret < 0) {
  4476. dev_err(camss->dev,
  4477. "Failed to register csiphy%d entity: %d\n",
  4478. i, ret);
  4479. goto err_reg_csiphy;
  4480. }
  4481. }
  4482. for (i = 0; i < camss->res->csid_num; i++) {
  4483. ret = msm_csid_register_entity(&camss->csid[i],
  4484. &camss->v4l2_dev);
  4485. if (ret < 0) {
  4486. dev_err(camss->dev,
  4487. "Failed to register csid%d entity: %d\n",
  4488. i, ret);
  4489. goto err_reg_csid;
  4490. }
  4491. }
  4492. ret = msm_ispif_register_entities(camss->ispif,
  4493. &camss->v4l2_dev);
  4494. if (ret < 0) {
  4495. dev_err(camss->dev, "Failed to register ispif entities: %d\n", ret);
  4496. goto err_reg_ispif;
  4497. }
  4498. for (i = 0; i < camss->res->vfe_num; i++) {
  4499. ret = msm_vfe_register_entities(&camss->vfe[i],
  4500. &camss->v4l2_dev);
  4501. if (ret < 0) {
  4502. dev_err(camss->dev,
  4503. "Failed to register vfe%d entities: %d\n",
  4504. i, ret);
  4505. goto err_reg_vfe;
  4506. }
  4507. }
  4508. return 0;
  4509. err_reg_vfe:
  4510. for (i--; i >= 0; i--)
  4511. msm_vfe_unregister_entities(&camss->vfe[i]);
  4512. err_reg_ispif:
  4513. msm_ispif_unregister_entities(camss->ispif);
  4514. i = camss->res->csid_num;
  4515. err_reg_csid:
  4516. for (i--; i >= 0; i--)
  4517. msm_csid_unregister_entity(&camss->csid[i]);
  4518. i = camss->res->csiphy_num;
  4519. err_reg_csiphy:
  4520. for (i--; i >= 0; i--)
  4521. msm_csiphy_unregister_entity(&camss->csiphy[i]);
  4522. return ret;
  4523. }
  4524. /*
  4525. * camss_unregister_entities - Unregister subdev nodes
  4526. * @camss: CAMSS device
  4527. *
  4528. * Return 0 on success or a negative error code on failure
  4529. */
  4530. static void camss_unregister_entities(struct camss *camss)
  4531. {
  4532. unsigned int i;
  4533. for (i = 0; i < camss->res->csiphy_num; i++)
  4534. msm_csiphy_unregister_entity(&camss->csiphy[i]);
  4535. for (i = 0; i < camss->res->csid_num; i++)
  4536. msm_csid_unregister_entity(&camss->csid[i]);
  4537. msm_ispif_unregister_entities(camss->ispif);
  4538. for (i = 0; i < camss->res->vfe_num; i++)
  4539. msm_vfe_unregister_entities(&camss->vfe[i]);
  4540. }
  4541. static int camss_subdev_notifier_bound(struct v4l2_async_notifier *async,
  4542. struct v4l2_subdev *subdev,
  4543. struct v4l2_async_connection *asd)
  4544. {
  4545. struct camss *camss = container_of(async, struct camss, notifier);
  4546. struct camss_async_subdev *csd =
  4547. container_of(asd, struct camss_async_subdev, asd);
  4548. u8 id = csd->interface.csiphy_id;
  4549. struct csiphy_device *csiphy = &camss->csiphy[id];
  4550. csiphy->cfg.csi2 = &csd->interface.csi2;
  4551. subdev->host_priv = csiphy;
  4552. return 0;
  4553. }
  4554. static int camss_subdev_notifier_complete(struct v4l2_async_notifier *async)
  4555. {
  4556. struct camss *camss = container_of(async, struct camss, notifier);
  4557. struct v4l2_device *v4l2_dev = &camss->v4l2_dev;
  4558. struct v4l2_subdev *sd;
  4559. list_for_each_entry(sd, &v4l2_dev->subdevs, list) {
  4560. struct csiphy_device *csiphy = sd->host_priv;
  4561. struct media_entity *input, *sensor;
  4562. unsigned int i;
  4563. int ret;
  4564. if (!csiphy)
  4565. continue;
  4566. input = &csiphy->subdev.entity;
  4567. sensor = &sd->entity;
  4568. for (i = 0; i < sensor->num_pads; i++) {
  4569. if (sensor->pads[i].flags & MEDIA_PAD_FL_SOURCE)
  4570. break;
  4571. }
  4572. if (i == sensor->num_pads) {
  4573. dev_err(camss->dev,
  4574. "No source pad in external entity\n");
  4575. return -EINVAL;
  4576. }
  4577. ret = media_create_pad_link(sensor, i, input,
  4578. MSM_CSIPHY_PAD_SINK,
  4579. MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED);
  4580. if (ret < 0) {
  4581. camss_link_err(camss, sensor->name, input->name, ret);
  4582. return ret;
  4583. }
  4584. }
  4585. return v4l2_device_register_subdev_nodes(&camss->v4l2_dev);
  4586. }
  4587. static const struct v4l2_async_notifier_operations camss_subdev_notifier_ops = {
  4588. .bound = camss_subdev_notifier_bound,
  4589. .complete = camss_subdev_notifier_complete,
  4590. };
  4591. static const struct media_device_ops camss_media_ops = {
  4592. .link_notify = v4l2_pipeline_link_notify,
  4593. };
  4594. static int camss_configure_pd(struct camss *camss)
  4595. {
  4596. const struct camss_resources *res = camss->res;
  4597. struct device *dev = camss->dev;
  4598. int vfepd_num;
  4599. int i;
  4600. int ret;
  4601. camss->genpd_num = of_count_phandle_with_args(dev->of_node,
  4602. "power-domains",
  4603. "#power-domain-cells");
  4604. if (camss->genpd_num < 0) {
  4605. dev_err(dev, "Power domains are not defined for camss\n");
  4606. return camss->genpd_num;
  4607. }
  4608. /*
  4609. * If a platform device has just one power domain, then it is attached
  4610. * at platform_probe() level, thus there shall be no need and even no
  4611. * option to attach it again, this is the case for CAMSS on MSM8916.
  4612. */
  4613. if (camss->genpd_num == 1)
  4614. return 0;
  4615. /* count the # of VFEs which have flagged power-domain */
  4616. for (vfepd_num = i = 0; i < camss->res->vfe_num; i++) {
  4617. if (res->vfe_res[i].vfe.has_pd)
  4618. vfepd_num++;
  4619. }
  4620. /*
  4621. * If the number of power-domains is greater than the number of VFEs
  4622. * then the additional power-domain is for the entire CAMSS block.
  4623. */
  4624. if (!(camss->genpd_num > vfepd_num))
  4625. return 0;
  4626. /*
  4627. * If a power-domain name is defined try to use it.
  4628. * It is possible we are running a new kernel with an old dtb so
  4629. * fallback to indexes even if a pd_name is defined but not found.
  4630. */
  4631. if (camss->res->pd_name) {
  4632. camss->genpd = dev_pm_domain_attach_by_name(camss->dev,
  4633. camss->res->pd_name);
  4634. if (IS_ERR(camss->genpd))
  4635. return PTR_ERR(camss->genpd);
  4636. }
  4637. if (!camss->genpd) {
  4638. /*
  4639. * Legacy magic index. TITAN_TOP GDSC must be the last
  4640. * item in the power-domain list.
  4641. */
  4642. camss->genpd = dev_pm_domain_attach_by_id(camss->dev,
  4643. camss->genpd_num - 1);
  4644. if (IS_ERR(camss->genpd))
  4645. return PTR_ERR(camss->genpd);
  4646. }
  4647. if (!camss->genpd)
  4648. return -ENODEV;
  4649. camss->genpd_link = device_link_add(camss->dev, camss->genpd,
  4650. DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME |
  4651. DL_FLAG_RPM_ACTIVE);
  4652. if (!camss->genpd_link) {
  4653. ret = -EINVAL;
  4654. goto fail_pm;
  4655. }
  4656. return 0;
  4657. fail_pm:
  4658. dev_pm_domain_detach(camss->genpd, true);
  4659. return ret;
  4660. }
  4661. static int camss_icc_get(struct camss *camss)
  4662. {
  4663. const struct resources_icc *icc_res;
  4664. int i;
  4665. icc_res = camss->res->icc_res;
  4666. for (i = 0; i < camss->res->icc_path_num; i++) {
  4667. camss->icc_path[i] = devm_of_icc_get(camss->dev,
  4668. icc_res[i].name);
  4669. if (IS_ERR(camss->icc_path[i]))
  4670. return PTR_ERR(camss->icc_path[i]);
  4671. }
  4672. return 0;
  4673. }
  4674. static void camss_genpd_subdevice_cleanup(struct camss *camss)
  4675. {
  4676. int i;
  4677. for (i = 0; i < camss->res->vfe_num; i++)
  4678. msm_vfe_genpd_cleanup(&camss->vfe[i]);
  4679. }
  4680. static void camss_genpd_cleanup(struct camss *camss)
  4681. {
  4682. if (camss->genpd_num == 1)
  4683. return;
  4684. camss_genpd_subdevice_cleanup(camss);
  4685. if (camss->genpd_link)
  4686. device_link_del(camss->genpd_link);
  4687. dev_pm_domain_detach(camss->genpd, true);
  4688. }
  4689. /*
  4690. * camss_probe - Probe CAMSS platform device
  4691. * @pdev: Pointer to CAMSS platform device
  4692. *
  4693. * Return 0 on success or a negative error code on failure
  4694. */
  4695. static int camss_probe(struct platform_device *pdev)
  4696. {
  4697. struct device *dev = &pdev->dev;
  4698. struct camss *camss;
  4699. int ret;
  4700. camss = devm_kzalloc(dev, sizeof(*camss), GFP_KERNEL);
  4701. if (!camss)
  4702. return -ENOMEM;
  4703. camss->res = of_device_get_match_data(dev);
  4704. atomic_set(&camss->ref_count, 0);
  4705. camss->dev = dev;
  4706. platform_set_drvdata(pdev, camss);
  4707. camss->csiphy = devm_kcalloc(dev, camss->res->csiphy_num,
  4708. sizeof(*camss->csiphy), GFP_KERNEL);
  4709. if (!camss->csiphy)
  4710. return -ENOMEM;
  4711. camss->csid = devm_kcalloc(dev, camss->res->csid_num, sizeof(*camss->csid),
  4712. GFP_KERNEL);
  4713. if (!camss->csid)
  4714. return -ENOMEM;
  4715. if (camss->res->version == CAMSS_8x16 ||
  4716. camss->res->version == CAMSS_8x39 ||
  4717. camss->res->version == CAMSS_8x53 ||
  4718. camss->res->version == CAMSS_8x96) {
  4719. camss->ispif = devm_kcalloc(dev, 1, sizeof(*camss->ispif), GFP_KERNEL);
  4720. if (!camss->ispif)
  4721. return -ENOMEM;
  4722. }
  4723. camss->vfe = devm_kcalloc(dev, camss->res->vfe_num,
  4724. sizeof(*camss->vfe), GFP_KERNEL);
  4725. if (!camss->vfe)
  4726. return -ENOMEM;
  4727. ret = camss_icc_get(camss);
  4728. if (ret < 0)
  4729. return ret;
  4730. ret = camss_configure_pd(camss);
  4731. if (ret < 0) {
  4732. dev_err(dev, "Failed to configure power domains: %d\n", ret);
  4733. return ret;
  4734. }
  4735. ret = camss_init_subdevices(camss);
  4736. if (ret < 0)
  4737. goto err_genpd_cleanup;
  4738. ret = dma_set_mask_and_coherent(dev, 0xffffffff);
  4739. if (ret)
  4740. goto err_genpd_cleanup;
  4741. camss->media_dev.dev = camss->dev;
  4742. strscpy(camss->media_dev.model, "Qualcomm Camera Subsystem",
  4743. sizeof(camss->media_dev.model));
  4744. camss->media_dev.ops = &camss_media_ops;
  4745. media_device_init(&camss->media_dev);
  4746. camss->v4l2_dev.mdev = &camss->media_dev;
  4747. ret = v4l2_device_register(camss->dev, &camss->v4l2_dev);
  4748. if (ret < 0) {
  4749. dev_err(dev, "Failed to register V4L2 device: %d\n", ret);
  4750. goto err_media_device_cleanup;
  4751. }
  4752. v4l2_async_nf_init(&camss->notifier, &camss->v4l2_dev);
  4753. pm_runtime_enable(dev);
  4754. ret = camss_parse_ports(camss);
  4755. if (ret < 0)
  4756. goto err_v4l2_device_unregister;
  4757. ret = camss_register_entities(camss);
  4758. if (ret < 0)
  4759. goto err_v4l2_device_unregister;
  4760. ret = camss_link_entities(camss);
  4761. if (ret < 0)
  4762. goto err_register_subdevs;
  4763. ret = media_device_register(&camss->media_dev);
  4764. if (ret < 0) {
  4765. dev_err(dev, "Failed to register media device: %d\n", ret);
  4766. goto err_register_subdevs;
  4767. }
  4768. camss->notifier.ops = &camss_subdev_notifier_ops;
  4769. ret = v4l2_async_nf_register(&camss->notifier);
  4770. if (ret) {
  4771. dev_err(dev,
  4772. "Failed to register async subdev nodes: %d\n", ret);
  4773. goto err_media_device_unregister;
  4774. }
  4775. return 0;
  4776. err_media_device_unregister:
  4777. media_device_unregister(&camss->media_dev);
  4778. err_register_subdevs:
  4779. camss_unregister_entities(camss);
  4780. err_v4l2_device_unregister:
  4781. v4l2_device_unregister(&camss->v4l2_dev);
  4782. v4l2_async_nf_cleanup(&camss->notifier);
  4783. pm_runtime_disable(dev);
  4784. err_media_device_cleanup:
  4785. media_device_cleanup(&camss->media_dev);
  4786. err_genpd_cleanup:
  4787. camss_genpd_cleanup(camss);
  4788. return ret;
  4789. }
  4790. void camss_delete(struct camss *camss)
  4791. {
  4792. v4l2_device_unregister(&camss->v4l2_dev);
  4793. media_device_unregister(&camss->media_dev);
  4794. media_device_cleanup(&camss->media_dev);
  4795. pm_runtime_disable(camss->dev);
  4796. }
  4797. /*
  4798. * camss_remove - Remove CAMSS platform device
  4799. * @pdev: Pointer to CAMSS platform device
  4800. *
  4801. * Always returns 0.
  4802. */
  4803. static void camss_remove(struct platform_device *pdev)
  4804. {
  4805. struct camss *camss = platform_get_drvdata(pdev);
  4806. v4l2_async_nf_unregister(&camss->notifier);
  4807. v4l2_async_nf_cleanup(&camss->notifier);
  4808. camss_unregister_entities(camss);
  4809. if (atomic_read(&camss->ref_count) == 0)
  4810. camss_delete(camss);
  4811. camss_genpd_cleanup(camss);
  4812. }
  4813. static const struct camss_resources msm8916_resources = {
  4814. .version = CAMSS_8x16,
  4815. .csiphy_res = csiphy_res_8x16,
  4816. .csid_res = csid_res_8x16,
  4817. .ispif_res = &ispif_res_8x16,
  4818. .vfe_res = vfe_res_8x16,
  4819. .csiphy_num = ARRAY_SIZE(csiphy_res_8x16),
  4820. .csid_num = ARRAY_SIZE(csid_res_8x16),
  4821. .vfe_num = ARRAY_SIZE(vfe_res_8x16),
  4822. };
  4823. static const struct camss_resources msm8939_resources = {
  4824. .version = CAMSS_8x39,
  4825. .csiphy_res = csiphy_res_8x39,
  4826. .csid_res = csid_res_8x39,
  4827. .ispif_res = &ispif_res_8x39,
  4828. .vfe_res = vfe_res_8x39,
  4829. .csiphy_num = ARRAY_SIZE(csiphy_res_8x39),
  4830. .csid_num = ARRAY_SIZE(csid_res_8x39),
  4831. .vfe_num = ARRAY_SIZE(vfe_res_8x39),
  4832. };
  4833. static const struct camss_resources msm8953_resources = {
  4834. .version = CAMSS_8x53,
  4835. .icc_res = icc_res_8x53,
  4836. .icc_path_num = ARRAY_SIZE(icc_res_8x53),
  4837. .csiphy_res = csiphy_res_8x96,
  4838. .csid_res = csid_res_8x53,
  4839. .ispif_res = &ispif_res_8x53,
  4840. .vfe_res = vfe_res_8x53,
  4841. .csiphy_num = ARRAY_SIZE(csiphy_res_8x96),
  4842. .csid_num = ARRAY_SIZE(csid_res_8x53),
  4843. .vfe_num = ARRAY_SIZE(vfe_res_8x53),
  4844. };
  4845. static const struct camss_resources msm8996_resources = {
  4846. .version = CAMSS_8x96,
  4847. .csiphy_res = csiphy_res_8x96,
  4848. .csid_res = csid_res_8x96,
  4849. .ispif_res = &ispif_res_8x96,
  4850. .vfe_res = vfe_res_8x96,
  4851. .csiphy_num = ARRAY_SIZE(csiphy_res_8x96),
  4852. .csid_num = ARRAY_SIZE(csid_res_8x96),
  4853. .vfe_num = ARRAY_SIZE(vfe_res_8x96),
  4854. };
  4855. static const struct camss_resources qcm2290_resources = {
  4856. .version = CAMSS_2290,
  4857. .csiphy_res = csiphy_res_2290,
  4858. .csid_res = csid_res_2290,
  4859. .vfe_res = vfe_res_2290,
  4860. .icc_res = icc_res_2290,
  4861. .icc_path_num = ARRAY_SIZE(icc_res_2290),
  4862. .csiphy_num = ARRAY_SIZE(csiphy_res_2290),
  4863. .csid_num = ARRAY_SIZE(csid_res_2290),
  4864. .vfe_num = ARRAY_SIZE(vfe_res_2290),
  4865. };
  4866. static const struct camss_resources qcs8300_resources = {
  4867. .version = CAMSS_8300,
  4868. .pd_name = "top",
  4869. .csiphy_res = csiphy_res_8300,
  4870. .csid_res = csid_res_8775p,
  4871. .csid_wrapper_res = &csid_wrapper_res_sm8550,
  4872. .vfe_res = vfe_res_8775p,
  4873. .icc_res = icc_res_qcs8300,
  4874. .csiphy_num = ARRAY_SIZE(csiphy_res_8300),
  4875. .csid_num = ARRAY_SIZE(csid_res_8775p),
  4876. .vfe_num = ARRAY_SIZE(vfe_res_8775p),
  4877. .icc_path_num = ARRAY_SIZE(icc_res_qcs8300),
  4878. };
  4879. static const struct camss_resources sa8775p_resources = {
  4880. .version = CAMSS_8775P,
  4881. .pd_name = "top",
  4882. .csiphy_res = csiphy_res_8775p,
  4883. .csid_res = csid_res_8775p,
  4884. .csid_wrapper_res = &csid_wrapper_res_sm8550,
  4885. .vfe_res = vfe_res_8775p,
  4886. .icc_res = icc_res_sa8775p,
  4887. .csiphy_num = ARRAY_SIZE(csiphy_res_8775p),
  4888. .csid_num = ARRAY_SIZE(csid_res_8775p),
  4889. .vfe_num = ARRAY_SIZE(vfe_res_8775p),
  4890. .icc_path_num = ARRAY_SIZE(icc_res_sa8775p),
  4891. };
  4892. static const struct camss_resources sdm660_resources = {
  4893. .version = CAMSS_660,
  4894. .csiphy_res = csiphy_res_660,
  4895. .csid_res = csid_res_660,
  4896. .ispif_res = &ispif_res_660,
  4897. .vfe_res = vfe_res_660,
  4898. .csiphy_num = ARRAY_SIZE(csiphy_res_660),
  4899. .csid_num = ARRAY_SIZE(csid_res_660),
  4900. .vfe_num = ARRAY_SIZE(vfe_res_660),
  4901. };
  4902. static const struct camss_resources sdm670_resources = {
  4903. .version = CAMSS_845,
  4904. .csiphy_res = csiphy_res_670,
  4905. .csid_res = csid_res_670,
  4906. .vfe_res = vfe_res_670,
  4907. .csiphy_num = ARRAY_SIZE(csiphy_res_670),
  4908. .csid_num = ARRAY_SIZE(csid_res_670),
  4909. .vfe_num = ARRAY_SIZE(vfe_res_670),
  4910. };
  4911. static const struct camss_resources sdm845_resources = {
  4912. .version = CAMSS_845,
  4913. .pd_name = "top",
  4914. .csiphy_res = csiphy_res_845,
  4915. .csid_res = csid_res_845,
  4916. .vfe_res = vfe_res_845,
  4917. .csiphy_num = ARRAY_SIZE(csiphy_res_845),
  4918. .csid_num = ARRAY_SIZE(csid_res_845),
  4919. .vfe_num = ARRAY_SIZE(vfe_res_845),
  4920. };
  4921. static const struct camss_resources sm6150_resources = {
  4922. .version = CAMSS_6150,
  4923. .pd_name = "top",
  4924. .csiphy_res = csiphy_res_sm6150,
  4925. .csid_res = csid_res_sm6150,
  4926. .vfe_res = vfe_res_sm6150,
  4927. .icc_res = icc_res_sm6150,
  4928. .icc_path_num = ARRAY_SIZE(icc_res_sm6150),
  4929. .csiphy_num = ARRAY_SIZE(csiphy_res_sm6150),
  4930. .csid_num = ARRAY_SIZE(csid_res_sm6150),
  4931. .vfe_num = ARRAY_SIZE(vfe_res_sm6150),
  4932. };
  4933. static const struct camss_resources sm8250_resources = {
  4934. .version = CAMSS_8250,
  4935. .pd_name = "top",
  4936. .csiphy_res = csiphy_res_8250,
  4937. .csid_res = csid_res_8250,
  4938. .vfe_res = vfe_res_8250,
  4939. .icc_res = icc_res_sm8250,
  4940. .icc_path_num = ARRAY_SIZE(icc_res_sm8250),
  4941. .csiphy_num = ARRAY_SIZE(csiphy_res_8250),
  4942. .csid_num = ARRAY_SIZE(csid_res_8250),
  4943. .vfe_num = ARRAY_SIZE(vfe_res_8250),
  4944. };
  4945. static const struct camss_resources sc8280xp_resources = {
  4946. .version = CAMSS_8280XP,
  4947. .pd_name = "top",
  4948. .csiphy_res = csiphy_res_sc8280xp,
  4949. .csid_res = csid_res_sc8280xp,
  4950. .ispif_res = NULL,
  4951. .vfe_res = vfe_res_sc8280xp,
  4952. .icc_res = icc_res_sc8280xp,
  4953. .icc_path_num = ARRAY_SIZE(icc_res_sc8280xp),
  4954. .csiphy_num = ARRAY_SIZE(csiphy_res_sc8280xp),
  4955. .csid_num = ARRAY_SIZE(csid_res_sc8280xp),
  4956. .vfe_num = ARRAY_SIZE(vfe_res_sc8280xp),
  4957. };
  4958. static const struct camss_resources sc7280_resources = {
  4959. .version = CAMSS_7280,
  4960. .pd_name = "top",
  4961. .csiphy_res = csiphy_res_7280,
  4962. .csid_res = csid_res_7280,
  4963. .vfe_res = vfe_res_7280,
  4964. .icc_res = icc_res_sc7280,
  4965. .icc_path_num = ARRAY_SIZE(icc_res_sc7280),
  4966. .csiphy_num = ARRAY_SIZE(csiphy_res_7280),
  4967. .csid_num = ARRAY_SIZE(csid_res_7280),
  4968. .vfe_num = ARRAY_SIZE(vfe_res_7280),
  4969. };
  4970. static const struct camss_resources sm8550_resources = {
  4971. .version = CAMSS_8550,
  4972. .pd_name = "top",
  4973. .csiphy_res = csiphy_res_8550,
  4974. .csid_res = csid_res_8550,
  4975. .vfe_res = vfe_res_8550,
  4976. .csid_wrapper_res = &csid_wrapper_res_sm8550,
  4977. .icc_res = icc_res_sm8550,
  4978. .icc_path_num = ARRAY_SIZE(icc_res_sm8550),
  4979. .csiphy_num = ARRAY_SIZE(csiphy_res_8550),
  4980. .csid_num = ARRAY_SIZE(csid_res_8550),
  4981. .vfe_num = ARRAY_SIZE(vfe_res_8550),
  4982. };
  4983. static const struct camss_resources sm8650_resources = {
  4984. .version = CAMSS_8650,
  4985. .pd_name = "top",
  4986. .csiphy_res = csiphy_res_sm8650,
  4987. .csid_res = csid_res_sm8650,
  4988. .csid_wrapper_res = &csid_wrapper_res_sm8550,
  4989. .vfe_res = vfe_res_sm8650,
  4990. .icc_res = icc_res_sm8650,
  4991. .icc_path_num = ARRAY_SIZE(icc_res_sm8650),
  4992. .csiphy_num = ARRAY_SIZE(csiphy_res_sm8650),
  4993. .csid_num = ARRAY_SIZE(csid_res_sm8650),
  4994. .vfe_num = ARRAY_SIZE(vfe_res_sm8650),
  4995. };
  4996. static const struct camss_resources x1e80100_resources = {
  4997. .version = CAMSS_X1E80100,
  4998. .pd_name = "top",
  4999. .csiphy_res = csiphy_res_x1e80100,
  5000. .csid_res = csid_res_x1e80100,
  5001. .vfe_res = vfe_res_x1e80100,
  5002. .csid_wrapper_res = &csid_wrapper_res_x1e80100,
  5003. .icc_res = icc_res_x1e80100,
  5004. .icc_path_num = ARRAY_SIZE(icc_res_x1e80100),
  5005. .csiphy_num = ARRAY_SIZE(csiphy_res_x1e80100),
  5006. .csid_num = ARRAY_SIZE(csid_res_x1e80100),
  5007. .vfe_num = ARRAY_SIZE(vfe_res_x1e80100),
  5008. };
  5009. static const struct of_device_id camss_dt_match[] = {
  5010. { .compatible = "qcom,msm8916-camss", .data = &msm8916_resources },
  5011. { .compatible = "qcom,msm8939-camss", .data = &msm8939_resources },
  5012. { .compatible = "qcom,msm8953-camss", .data = &msm8953_resources },
  5013. { .compatible = "qcom,msm8996-camss", .data = &msm8996_resources },
  5014. { .compatible = "qcom,qcm2290-camss", .data = &qcm2290_resources },
  5015. { .compatible = "qcom,qcs8300-camss", .data = &qcs8300_resources },
  5016. { .compatible = "qcom,sa8775p-camss", .data = &sa8775p_resources },
  5017. { .compatible = "qcom,sc7280-camss", .data = &sc7280_resources },
  5018. { .compatible = "qcom,sc8280xp-camss", .data = &sc8280xp_resources },
  5019. { .compatible = "qcom,sdm660-camss", .data = &sdm660_resources },
  5020. { .compatible = "qcom,sdm670-camss", .data = &sdm670_resources },
  5021. { .compatible = "qcom,sdm845-camss", .data = &sdm845_resources },
  5022. { .compatible = "qcom,sm6150-camss", .data = &sm6150_resources },
  5023. { .compatible = "qcom,sm8250-camss", .data = &sm8250_resources },
  5024. { .compatible = "qcom,sm8550-camss", .data = &sm8550_resources },
  5025. { .compatible = "qcom,sm8650-camss", .data = &sm8650_resources },
  5026. { .compatible = "qcom,x1e80100-camss", .data = &x1e80100_resources },
  5027. { }
  5028. };
  5029. MODULE_DEVICE_TABLE(of, camss_dt_match);
  5030. static int __maybe_unused camss_runtime_suspend(struct device *dev)
  5031. {
  5032. struct camss *camss = dev_get_drvdata(dev);
  5033. int i;
  5034. int ret;
  5035. for (i = 0; i < camss->res->icc_path_num; i++) {
  5036. ret = icc_set_bw(camss->icc_path[i], 0, 0);
  5037. if (ret)
  5038. return ret;
  5039. }
  5040. return 0;
  5041. }
  5042. static int __maybe_unused camss_runtime_resume(struct device *dev)
  5043. {
  5044. struct camss *camss = dev_get_drvdata(dev);
  5045. const struct resources_icc *icc_res = camss->res->icc_res;
  5046. int i;
  5047. int ret;
  5048. for (i = 0; i < camss->res->icc_path_num; i++) {
  5049. ret = icc_set_bw(camss->icc_path[i],
  5050. icc_res[i].icc_bw_tbl.avg,
  5051. icc_res[i].icc_bw_tbl.peak);
  5052. if (ret)
  5053. return ret;
  5054. }
  5055. return 0;
  5056. }
  5057. static const struct dev_pm_ops camss_pm_ops = {
  5058. SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
  5059. pm_runtime_force_resume)
  5060. SET_RUNTIME_PM_OPS(camss_runtime_suspend, camss_runtime_resume, NULL)
  5061. };
  5062. static struct platform_driver qcom_camss_driver = {
  5063. .probe = camss_probe,
  5064. .remove = camss_remove,
  5065. .driver = {
  5066. .name = "qcom-camss",
  5067. .of_match_table = camss_dt_match,
  5068. .pm = &camss_pm_ops,
  5069. },
  5070. };
  5071. module_platform_driver(qcom_camss_driver);
  5072. MODULE_DESCRIPTION("Qualcomm Camera Subsystem driver");
  5073. MODULE_AUTHOR("Todor Tomov <todor.tomov@linaro.org>");
  5074. MODULE_LICENSE("GPL v2");