dispcc-sm8550.c 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2023, Linaro Ltd.
  5. */
  6. #include <linux/clk-provider.h>
  7. #include <linux/err.h>
  8. #include <linux/kernel.h>
  9. #include <linux/mod_devicetable.h>
  10. #include <linux/module.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/regmap.h>
  13. #include <linux/pm_runtime.h>
  14. #include <dt-bindings/clock/qcom,sm8550-dispcc.h>
  15. #include "common.h"
  16. #include "clk-alpha-pll.h"
  17. #include "clk-branch.h"
  18. #include "clk-pll.h"
  19. #include "clk-rcg.h"
  20. #include "clk-regmap.h"
  21. #include "clk-regmap-divider.h"
  22. #include "clk-regmap-mux.h"
  23. #include "reset.h"
  24. #include "gdsc.h"
  25. /* Need to match the order of clocks in DT binding */
  26. enum {
  27. DT_BI_TCXO,
  28. DT_BI_TCXO_AO,
  29. DT_AHB_CLK,
  30. DT_SLEEP_CLK,
  31. DT_DSI0_PHY_PLL_OUT_BYTECLK,
  32. DT_DSI0_PHY_PLL_OUT_DSICLK,
  33. DT_DSI1_PHY_PLL_OUT_BYTECLK,
  34. DT_DSI1_PHY_PLL_OUT_DSICLK,
  35. DT_DP0_PHY_PLL_LINK_CLK,
  36. DT_DP0_PHY_PLL_VCO_DIV_CLK,
  37. DT_DP1_PHY_PLL_LINK_CLK,
  38. DT_DP1_PHY_PLL_VCO_DIV_CLK,
  39. DT_DP2_PHY_PLL_LINK_CLK,
  40. DT_DP2_PHY_PLL_VCO_DIV_CLK,
  41. DT_DP3_PHY_PLL_LINK_CLK,
  42. DT_DP3_PHY_PLL_VCO_DIV_CLK,
  43. };
  44. #define DISP_CC_MISC_CMD 0xF000
  45. enum {
  46. P_BI_TCXO,
  47. P_DISP_CC_PLL0_OUT_MAIN,
  48. P_DISP_CC_PLL1_OUT_EVEN,
  49. P_DISP_CC_PLL1_OUT_MAIN,
  50. P_DP0_PHY_PLL_LINK_CLK,
  51. P_DP0_PHY_PLL_VCO_DIV_CLK,
  52. P_DP1_PHY_PLL_LINK_CLK,
  53. P_DP1_PHY_PLL_VCO_DIV_CLK,
  54. P_DP2_PHY_PLL_LINK_CLK,
  55. P_DP2_PHY_PLL_VCO_DIV_CLK,
  56. P_DP3_PHY_PLL_LINK_CLK,
  57. P_DP3_PHY_PLL_VCO_DIV_CLK,
  58. P_DSI0_PHY_PLL_OUT_BYTECLK,
  59. P_DSI0_PHY_PLL_OUT_DSICLK,
  60. P_DSI1_PHY_PLL_OUT_BYTECLK,
  61. P_DSI1_PHY_PLL_OUT_DSICLK,
  62. P_SLEEP_CLK,
  63. };
  64. static struct pll_vco lucid_ole_vco[] = {
  65. { 249600000, 2000000000, 0 },
  66. };
  67. static struct alpha_pll_config disp_cc_pll0_config = {
  68. .l = 0xd,
  69. .alpha = 0x6492,
  70. .config_ctl_val = 0x20485699,
  71. .config_ctl_hi_val = 0x00182261,
  72. .config_ctl_hi1_val = 0x82aa299c,
  73. .test_ctl_val = 0x00000000,
  74. .test_ctl_hi_val = 0x00000003,
  75. .test_ctl_hi1_val = 0x00009000,
  76. .test_ctl_hi2_val = 0x00000034,
  77. .user_ctl_val = 0x00000000,
  78. .user_ctl_hi_val = 0x00000005,
  79. };
  80. static struct clk_alpha_pll disp_cc_pll0 = {
  81. .offset = 0x0,
  82. .vco_table = lucid_ole_vco,
  83. .num_vco = ARRAY_SIZE(lucid_ole_vco),
  84. .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE],
  85. .clkr = {
  86. .hw.init = &(const struct clk_init_data) {
  87. .name = "disp_cc_pll0",
  88. .parent_data = &(const struct clk_parent_data) {
  89. .index = DT_BI_TCXO,
  90. },
  91. .num_parents = 1,
  92. .ops = &clk_alpha_pll_reset_lucid_ole_ops,
  93. },
  94. },
  95. };
  96. static struct alpha_pll_config disp_cc_pll1_config = {
  97. .l = 0x1f,
  98. .alpha = 0x4000,
  99. .config_ctl_val = 0x20485699,
  100. .config_ctl_hi_val = 0x00182261,
  101. .config_ctl_hi1_val = 0x82aa299c,
  102. .test_ctl_val = 0x00000000,
  103. .test_ctl_hi_val = 0x00000003,
  104. .test_ctl_hi1_val = 0x00009000,
  105. .test_ctl_hi2_val = 0x00000034,
  106. .user_ctl_val = 0x00000000,
  107. .user_ctl_hi_val = 0x00000005,
  108. };
  109. static struct clk_alpha_pll disp_cc_pll1 = {
  110. .offset = 0x1000,
  111. .vco_table = lucid_ole_vco,
  112. .num_vco = ARRAY_SIZE(lucid_ole_vco),
  113. .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE],
  114. .clkr = {
  115. .hw.init = &(const struct clk_init_data) {
  116. .name = "disp_cc_pll1",
  117. .parent_data = &(const struct clk_parent_data) {
  118. .index = DT_BI_TCXO,
  119. },
  120. .num_parents = 1,
  121. .ops = &clk_alpha_pll_reset_lucid_ole_ops,
  122. },
  123. },
  124. };
  125. static const struct parent_map disp_cc_parent_map_0[] = {
  126. { P_BI_TCXO, 0 },
  127. };
  128. static const struct clk_parent_data disp_cc_parent_data_0[] = {
  129. { .index = DT_BI_TCXO },
  130. };
  131. static const struct clk_parent_data disp_cc_parent_data_0_ao[] = {
  132. { .index = DT_BI_TCXO_AO },
  133. };
  134. static const struct parent_map disp_cc_parent_map_1[] = {
  135. { P_BI_TCXO, 0 },
  136. { P_DP3_PHY_PLL_VCO_DIV_CLK, 3 },
  137. { P_DP1_PHY_PLL_VCO_DIV_CLK, 4 },
  138. { P_DP2_PHY_PLL_VCO_DIV_CLK, 6 },
  139. };
  140. static const struct clk_parent_data disp_cc_parent_data_1[] = {
  141. { .index = DT_BI_TCXO },
  142. { .index = DT_DP3_PHY_PLL_VCO_DIV_CLK },
  143. { .index = DT_DP1_PHY_PLL_VCO_DIV_CLK },
  144. { .index = DT_DP2_PHY_PLL_VCO_DIV_CLK },
  145. };
  146. static const struct parent_map disp_cc_parent_map_2[] = {
  147. { P_BI_TCXO, 0 },
  148. { P_DSI0_PHY_PLL_OUT_DSICLK, 1 },
  149. { P_DSI0_PHY_PLL_OUT_BYTECLK, 2 },
  150. { P_DSI1_PHY_PLL_OUT_DSICLK, 3 },
  151. { P_DSI1_PHY_PLL_OUT_BYTECLK, 4 },
  152. };
  153. static const struct clk_parent_data disp_cc_parent_data_2[] = {
  154. { .index = DT_BI_TCXO },
  155. { .index = DT_DSI0_PHY_PLL_OUT_DSICLK },
  156. { .index = DT_DSI0_PHY_PLL_OUT_BYTECLK },
  157. { .index = DT_DSI1_PHY_PLL_OUT_DSICLK },
  158. { .index = DT_DSI1_PHY_PLL_OUT_BYTECLK },
  159. };
  160. static const struct parent_map disp_cc_parent_map_3[] = {
  161. { P_BI_TCXO, 0 },
  162. { P_DP1_PHY_PLL_LINK_CLK, 2 },
  163. { P_DP2_PHY_PLL_LINK_CLK, 3 },
  164. { P_DP3_PHY_PLL_LINK_CLK, 4 },
  165. };
  166. static const struct clk_parent_data disp_cc_parent_data_3[] = {
  167. { .index = DT_BI_TCXO },
  168. { .index = DT_DP1_PHY_PLL_LINK_CLK },
  169. { .index = DT_DP2_PHY_PLL_LINK_CLK },
  170. { .index = DT_DP3_PHY_PLL_LINK_CLK },
  171. };
  172. static const struct parent_map disp_cc_parent_map_4[] = {
  173. { P_BI_TCXO, 0 },
  174. { P_DP0_PHY_PLL_LINK_CLK, 1 },
  175. { P_DP0_PHY_PLL_VCO_DIV_CLK, 2 },
  176. { P_DP3_PHY_PLL_VCO_DIV_CLK, 3 },
  177. { P_DP1_PHY_PLL_VCO_DIV_CLK, 4 },
  178. { P_DP2_PHY_PLL_VCO_DIV_CLK, 6 },
  179. };
  180. static const struct clk_parent_data disp_cc_parent_data_4[] = {
  181. { .index = DT_BI_TCXO },
  182. { .index = DT_DP0_PHY_PLL_LINK_CLK },
  183. { .index = DT_DP0_PHY_PLL_VCO_DIV_CLK },
  184. { .index = DT_DP3_PHY_PLL_VCO_DIV_CLK },
  185. { .index = DT_DP1_PHY_PLL_VCO_DIV_CLK },
  186. { .index = DT_DP2_PHY_PLL_VCO_DIV_CLK },
  187. };
  188. static const struct parent_map disp_cc_parent_map_5[] = {
  189. { P_BI_TCXO, 0 },
  190. { P_DSI0_PHY_PLL_OUT_BYTECLK, 2 },
  191. { P_DSI1_PHY_PLL_OUT_BYTECLK, 4 },
  192. };
  193. static const struct clk_parent_data disp_cc_parent_data_5[] = {
  194. { .index = DT_BI_TCXO },
  195. { .index = DT_DSI0_PHY_PLL_OUT_BYTECLK },
  196. { .index = DT_DSI1_PHY_PLL_OUT_BYTECLK },
  197. };
  198. static const struct parent_map disp_cc_parent_map_6[] = {
  199. { P_BI_TCXO, 0 },
  200. { P_DISP_CC_PLL1_OUT_MAIN, 4 },
  201. { P_DISP_CC_PLL1_OUT_EVEN, 6 },
  202. };
  203. static const struct clk_parent_data disp_cc_parent_data_6[] = {
  204. { .index = DT_BI_TCXO },
  205. { .hw = &disp_cc_pll1.clkr.hw },
  206. { .hw = &disp_cc_pll1.clkr.hw },
  207. };
  208. static const struct parent_map disp_cc_parent_map_7[] = {
  209. { P_BI_TCXO, 0 },
  210. { P_DP0_PHY_PLL_LINK_CLK, 1 },
  211. { P_DP1_PHY_PLL_LINK_CLK, 2 },
  212. { P_DP2_PHY_PLL_LINK_CLK, 3 },
  213. { P_DP3_PHY_PLL_LINK_CLK, 4 },
  214. };
  215. static const struct clk_parent_data disp_cc_parent_data_7[] = {
  216. { .index = DT_BI_TCXO },
  217. { .index = DT_DP0_PHY_PLL_LINK_CLK },
  218. { .index = DT_DP1_PHY_PLL_LINK_CLK },
  219. { .index = DT_DP2_PHY_PLL_LINK_CLK },
  220. { .index = DT_DP3_PHY_PLL_LINK_CLK },
  221. };
  222. static const struct parent_map disp_cc_parent_map_8[] = {
  223. { P_BI_TCXO, 0 },
  224. { P_DISP_CC_PLL0_OUT_MAIN, 1 },
  225. { P_DISP_CC_PLL1_OUT_MAIN, 4 },
  226. { P_DISP_CC_PLL1_OUT_EVEN, 6 },
  227. };
  228. static const struct clk_parent_data disp_cc_parent_data_8[] = {
  229. { .index = DT_BI_TCXO },
  230. { .hw = &disp_cc_pll0.clkr.hw },
  231. { .hw = &disp_cc_pll1.clkr.hw },
  232. { .hw = &disp_cc_pll1.clkr.hw },
  233. };
  234. static const struct parent_map disp_cc_parent_map_9[] = {
  235. { P_SLEEP_CLK, 0 },
  236. };
  237. static const struct clk_parent_data disp_cc_parent_data_9[] = {
  238. { .index = DT_SLEEP_CLK },
  239. };
  240. static const struct freq_tbl ftbl_disp_cc_mdss_ahb_clk_src[] = {
  241. F(19200000, P_BI_TCXO, 1, 0, 0),
  242. F(37500000, P_DISP_CC_PLL1_OUT_MAIN, 16, 0, 0),
  243. F(75000000, P_DISP_CC_PLL1_OUT_MAIN, 8, 0, 0),
  244. { }
  245. };
  246. static struct clk_rcg2 disp_cc_mdss_ahb_clk_src = {
  247. .cmd_rcgr = 0x82e8,
  248. .mnd_width = 0,
  249. .hid_width = 5,
  250. .parent_map = disp_cc_parent_map_6,
  251. .freq_tbl = ftbl_disp_cc_mdss_ahb_clk_src,
  252. .clkr.hw.init = &(const struct clk_init_data) {
  253. .name = "disp_cc_mdss_ahb_clk_src",
  254. .parent_data = disp_cc_parent_data_6,
  255. .num_parents = ARRAY_SIZE(disp_cc_parent_data_6),
  256. .flags = CLK_SET_RATE_PARENT,
  257. .ops = &clk_rcg2_shared_ops,
  258. },
  259. };
  260. static const struct freq_tbl ftbl_disp_cc_mdss_byte0_clk_src[] = {
  261. F(19200000, P_BI_TCXO, 1, 0, 0),
  262. { }
  263. };
  264. static struct clk_rcg2 disp_cc_mdss_byte0_clk_src = {
  265. .cmd_rcgr = 0x8108,
  266. .mnd_width = 0,
  267. .hid_width = 5,
  268. .parent_map = disp_cc_parent_map_2,
  269. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  270. .clkr.hw.init = &(const struct clk_init_data) {
  271. .name = "disp_cc_mdss_byte0_clk_src",
  272. .parent_data = disp_cc_parent_data_2,
  273. .num_parents = ARRAY_SIZE(disp_cc_parent_data_2),
  274. .flags = CLK_SET_RATE_PARENT,
  275. .ops = &clk_byte2_ops,
  276. },
  277. };
  278. static struct clk_rcg2 disp_cc_mdss_byte1_clk_src = {
  279. .cmd_rcgr = 0x8124,
  280. .mnd_width = 0,
  281. .hid_width = 5,
  282. .parent_map = disp_cc_parent_map_2,
  283. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  284. .clkr.hw.init = &(const struct clk_init_data) {
  285. .name = "disp_cc_mdss_byte1_clk_src",
  286. .parent_data = disp_cc_parent_data_2,
  287. .num_parents = ARRAY_SIZE(disp_cc_parent_data_2),
  288. .flags = CLK_SET_RATE_PARENT,
  289. .ops = &clk_byte2_ops,
  290. },
  291. };
  292. static struct clk_rcg2 disp_cc_mdss_dptx0_aux_clk_src = {
  293. .cmd_rcgr = 0x81bc,
  294. .mnd_width = 0,
  295. .hid_width = 5,
  296. .parent_map = disp_cc_parent_map_0,
  297. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  298. .clkr.hw.init = &(const struct clk_init_data) {
  299. .name = "disp_cc_mdss_dptx0_aux_clk_src",
  300. .parent_data = disp_cc_parent_data_0,
  301. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0),
  302. .flags = CLK_SET_RATE_PARENT,
  303. .ops = &clk_rcg2_ops,
  304. },
  305. };
  306. static struct clk_rcg2 disp_cc_mdss_dptx0_link_clk_src = {
  307. .cmd_rcgr = 0x8170,
  308. .mnd_width = 0,
  309. .hid_width = 5,
  310. .parent_map = disp_cc_parent_map_7,
  311. .clkr.hw.init = &(const struct clk_init_data) {
  312. .name = "disp_cc_mdss_dptx0_link_clk_src",
  313. .parent_data = disp_cc_parent_data_7,
  314. .num_parents = ARRAY_SIZE(disp_cc_parent_data_7),
  315. .flags = CLK_SET_RATE_PARENT,
  316. .ops = &clk_byte2_ops,
  317. },
  318. };
  319. static struct clk_rcg2 disp_cc_mdss_dptx0_pixel0_clk_src = {
  320. .cmd_rcgr = 0x818c,
  321. .mnd_width = 16,
  322. .hid_width = 5,
  323. .parent_map = disp_cc_parent_map_4,
  324. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  325. .clkr.hw.init = &(const struct clk_init_data) {
  326. .name = "disp_cc_mdss_dptx0_pixel0_clk_src",
  327. .parent_data = disp_cc_parent_data_4,
  328. .num_parents = ARRAY_SIZE(disp_cc_parent_data_4),
  329. .flags = CLK_SET_RATE_PARENT,
  330. .ops = &clk_dp_ops,
  331. },
  332. };
  333. static struct clk_rcg2 disp_cc_mdss_dptx0_pixel1_clk_src = {
  334. .cmd_rcgr = 0x81a4,
  335. .mnd_width = 16,
  336. .hid_width = 5,
  337. .parent_map = disp_cc_parent_map_4,
  338. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  339. .clkr.hw.init = &(const struct clk_init_data) {
  340. .name = "disp_cc_mdss_dptx0_pixel1_clk_src",
  341. .parent_data = disp_cc_parent_data_4,
  342. .num_parents = ARRAY_SIZE(disp_cc_parent_data_4),
  343. .flags = CLK_SET_RATE_PARENT,
  344. .ops = &clk_dp_ops,
  345. },
  346. };
  347. static struct clk_rcg2 disp_cc_mdss_dptx1_aux_clk_src = {
  348. .cmd_rcgr = 0x8220,
  349. .mnd_width = 0,
  350. .hid_width = 5,
  351. .parent_map = disp_cc_parent_map_0,
  352. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  353. .clkr.hw.init = &(const struct clk_init_data) {
  354. .name = "disp_cc_mdss_dptx1_aux_clk_src",
  355. .parent_data = disp_cc_parent_data_0,
  356. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0),
  357. .flags = CLK_SET_RATE_PARENT,
  358. .ops = &clk_rcg2_ops,
  359. },
  360. };
  361. static struct clk_rcg2 disp_cc_mdss_dptx1_link_clk_src = {
  362. .cmd_rcgr = 0x8204,
  363. .mnd_width = 0,
  364. .hid_width = 5,
  365. .parent_map = disp_cc_parent_map_3,
  366. .clkr.hw.init = &(const struct clk_init_data) {
  367. .name = "disp_cc_mdss_dptx1_link_clk_src",
  368. .parent_data = disp_cc_parent_data_3,
  369. .num_parents = ARRAY_SIZE(disp_cc_parent_data_3),
  370. .flags = CLK_SET_RATE_PARENT,
  371. .ops = &clk_byte2_ops,
  372. },
  373. };
  374. static struct clk_rcg2 disp_cc_mdss_dptx1_pixel0_clk_src = {
  375. .cmd_rcgr = 0x81d4,
  376. .mnd_width = 16,
  377. .hid_width = 5,
  378. .parent_map = disp_cc_parent_map_1,
  379. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  380. .clkr.hw.init = &(const struct clk_init_data) {
  381. .name = "disp_cc_mdss_dptx1_pixel0_clk_src",
  382. .parent_data = disp_cc_parent_data_1,
  383. .num_parents = ARRAY_SIZE(disp_cc_parent_data_1),
  384. .flags = CLK_SET_RATE_PARENT,
  385. .ops = &clk_dp_ops,
  386. },
  387. };
  388. static struct clk_rcg2 disp_cc_mdss_dptx1_pixel1_clk_src = {
  389. .cmd_rcgr = 0x81ec,
  390. .mnd_width = 16,
  391. .hid_width = 5,
  392. .parent_map = disp_cc_parent_map_1,
  393. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  394. .clkr.hw.init = &(const struct clk_init_data) {
  395. .name = "disp_cc_mdss_dptx1_pixel1_clk_src",
  396. .parent_data = disp_cc_parent_data_1,
  397. .num_parents = ARRAY_SIZE(disp_cc_parent_data_1),
  398. .flags = CLK_SET_RATE_PARENT,
  399. .ops = &clk_dp_ops,
  400. },
  401. };
  402. static struct clk_rcg2 disp_cc_mdss_dptx2_aux_clk_src = {
  403. .cmd_rcgr = 0x8284,
  404. .mnd_width = 0,
  405. .hid_width = 5,
  406. .parent_map = disp_cc_parent_map_0,
  407. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  408. .clkr.hw.init = &(const struct clk_init_data) {
  409. .name = "disp_cc_mdss_dptx2_aux_clk_src",
  410. .parent_data = disp_cc_parent_data_0,
  411. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0),
  412. .flags = CLK_SET_RATE_PARENT,
  413. .ops = &clk_rcg2_ops,
  414. },
  415. };
  416. static struct clk_rcg2 disp_cc_mdss_dptx2_link_clk_src = {
  417. .cmd_rcgr = 0x8238,
  418. .mnd_width = 0,
  419. .hid_width = 5,
  420. .parent_map = disp_cc_parent_map_3,
  421. .clkr.hw.init = &(const struct clk_init_data) {
  422. .name = "disp_cc_mdss_dptx2_link_clk_src",
  423. .parent_data = disp_cc_parent_data_3,
  424. .num_parents = ARRAY_SIZE(disp_cc_parent_data_3),
  425. .flags = CLK_SET_RATE_PARENT,
  426. .ops = &clk_byte2_ops,
  427. },
  428. };
  429. static struct clk_rcg2 disp_cc_mdss_dptx2_pixel0_clk_src = {
  430. .cmd_rcgr = 0x8254,
  431. .mnd_width = 16,
  432. .hid_width = 5,
  433. .parent_map = disp_cc_parent_map_1,
  434. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  435. .clkr.hw.init = &(const struct clk_init_data) {
  436. .name = "disp_cc_mdss_dptx2_pixel0_clk_src",
  437. .parent_data = disp_cc_parent_data_1,
  438. .num_parents = ARRAY_SIZE(disp_cc_parent_data_1),
  439. .flags = CLK_SET_RATE_PARENT,
  440. .ops = &clk_dp_ops,
  441. },
  442. };
  443. static struct clk_rcg2 disp_cc_mdss_dptx2_pixel1_clk_src = {
  444. .cmd_rcgr = 0x826c,
  445. .mnd_width = 16,
  446. .hid_width = 5,
  447. .parent_map = disp_cc_parent_map_1,
  448. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  449. .clkr.hw.init = &(const struct clk_init_data) {
  450. .name = "disp_cc_mdss_dptx2_pixel1_clk_src",
  451. .parent_data = disp_cc_parent_data_1,
  452. .num_parents = ARRAY_SIZE(disp_cc_parent_data_1),
  453. .flags = CLK_SET_RATE_PARENT,
  454. .ops = &clk_dp_ops,
  455. },
  456. };
  457. static struct clk_rcg2 disp_cc_mdss_dptx3_aux_clk_src = {
  458. .cmd_rcgr = 0x82d0,
  459. .mnd_width = 0,
  460. .hid_width = 5,
  461. .parent_map = disp_cc_parent_map_0,
  462. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  463. .clkr.hw.init = &(const struct clk_init_data) {
  464. .name = "disp_cc_mdss_dptx3_aux_clk_src",
  465. .parent_data = disp_cc_parent_data_0,
  466. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0),
  467. .flags = CLK_SET_RATE_PARENT,
  468. .ops = &clk_rcg2_ops,
  469. },
  470. };
  471. static struct clk_rcg2 disp_cc_mdss_dptx3_link_clk_src = {
  472. .cmd_rcgr = 0x82b4,
  473. .mnd_width = 0,
  474. .hid_width = 5,
  475. .parent_map = disp_cc_parent_map_3,
  476. .clkr.hw.init = &(const struct clk_init_data) {
  477. .name = "disp_cc_mdss_dptx3_link_clk_src",
  478. .parent_data = disp_cc_parent_data_3,
  479. .num_parents = ARRAY_SIZE(disp_cc_parent_data_3),
  480. .flags = CLK_SET_RATE_PARENT,
  481. .ops = &clk_byte2_ops,
  482. },
  483. };
  484. static struct clk_rcg2 disp_cc_mdss_dptx3_pixel0_clk_src = {
  485. .cmd_rcgr = 0x829c,
  486. .mnd_width = 16,
  487. .hid_width = 5,
  488. .parent_map = disp_cc_parent_map_1,
  489. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  490. .clkr.hw.init = &(const struct clk_init_data) {
  491. .name = "disp_cc_mdss_dptx3_pixel0_clk_src",
  492. .parent_data = disp_cc_parent_data_1,
  493. .num_parents = ARRAY_SIZE(disp_cc_parent_data_1),
  494. .flags = CLK_SET_RATE_PARENT,
  495. .ops = &clk_dp_ops,
  496. },
  497. };
  498. static struct clk_rcg2 disp_cc_mdss_esc0_clk_src = {
  499. .cmd_rcgr = 0x8140,
  500. .mnd_width = 0,
  501. .hid_width = 5,
  502. .parent_map = disp_cc_parent_map_5,
  503. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  504. .clkr.hw.init = &(const struct clk_init_data) {
  505. .name = "disp_cc_mdss_esc0_clk_src",
  506. .parent_data = disp_cc_parent_data_5,
  507. .num_parents = ARRAY_SIZE(disp_cc_parent_data_5),
  508. .flags = CLK_SET_RATE_PARENT,
  509. .ops = &clk_rcg2_shared_ops,
  510. },
  511. };
  512. static struct clk_rcg2 disp_cc_mdss_esc1_clk_src = {
  513. .cmd_rcgr = 0x8158,
  514. .mnd_width = 0,
  515. .hid_width = 5,
  516. .parent_map = disp_cc_parent_map_5,
  517. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  518. .clkr.hw.init = &(const struct clk_init_data) {
  519. .name = "disp_cc_mdss_esc1_clk_src",
  520. .parent_data = disp_cc_parent_data_5,
  521. .num_parents = ARRAY_SIZE(disp_cc_parent_data_5),
  522. .flags = CLK_SET_RATE_PARENT,
  523. .ops = &clk_rcg2_shared_ops,
  524. },
  525. };
  526. static const struct freq_tbl ftbl_disp_cc_mdss_mdp_clk_src[] = {
  527. F(19200000, P_BI_TCXO, 1, 0, 0),
  528. F(85714286, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  529. F(100000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  530. F(150000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  531. F(172000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  532. F(200000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  533. F(325000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  534. F(375000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  535. F(514000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  536. { }
  537. };
  538. static const struct freq_tbl ftbl_disp_cc_mdss_mdp_clk_src_sar2130p[] = {
  539. F(200000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  540. F(325000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  541. F(514000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  542. { }
  543. };
  544. static const struct freq_tbl ftbl_disp_cc_mdss_mdp_clk_src_sm8650[] = {
  545. F(19200000, P_BI_TCXO, 1, 0, 0),
  546. F(85714286, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  547. F(100000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  548. F(150000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  549. F(200000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  550. F(325000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  551. F(402000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  552. F(514000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  553. { }
  554. };
  555. static struct clk_rcg2 disp_cc_mdss_mdp_clk_src = {
  556. .cmd_rcgr = 0x80d8,
  557. .mnd_width = 0,
  558. .hid_width = 5,
  559. .parent_map = disp_cc_parent_map_8,
  560. .freq_tbl = ftbl_disp_cc_mdss_mdp_clk_src,
  561. .clkr.hw.init = &(const struct clk_init_data) {
  562. .name = "disp_cc_mdss_mdp_clk_src",
  563. .parent_data = disp_cc_parent_data_8,
  564. .num_parents = ARRAY_SIZE(disp_cc_parent_data_8),
  565. .flags = CLK_SET_RATE_PARENT,
  566. .ops = &clk_rcg2_shared_ops,
  567. },
  568. };
  569. static struct clk_rcg2 disp_cc_mdss_pclk0_clk_src = {
  570. .cmd_rcgr = 0x80a8,
  571. .mnd_width = 8,
  572. .hid_width = 5,
  573. .parent_map = disp_cc_parent_map_2,
  574. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  575. .clkr.hw.init = &(const struct clk_init_data) {
  576. .name = "disp_cc_mdss_pclk0_clk_src",
  577. .parent_data = disp_cc_parent_data_2,
  578. .num_parents = ARRAY_SIZE(disp_cc_parent_data_2),
  579. .flags = CLK_SET_RATE_PARENT,
  580. .ops = &clk_pixel_ops,
  581. },
  582. };
  583. static struct clk_rcg2 disp_cc_mdss_pclk1_clk_src = {
  584. .cmd_rcgr = 0x80c0,
  585. .mnd_width = 8,
  586. .hid_width = 5,
  587. .parent_map = disp_cc_parent_map_2,
  588. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  589. .clkr.hw.init = &(const struct clk_init_data) {
  590. .name = "disp_cc_mdss_pclk1_clk_src",
  591. .parent_data = disp_cc_parent_data_2,
  592. .num_parents = ARRAY_SIZE(disp_cc_parent_data_2),
  593. .flags = CLK_SET_RATE_PARENT,
  594. .ops = &clk_pixel_ops,
  595. },
  596. };
  597. static struct clk_rcg2 disp_cc_mdss_vsync_clk_src = {
  598. .cmd_rcgr = 0x80f0,
  599. .mnd_width = 0,
  600. .hid_width = 5,
  601. .parent_map = disp_cc_parent_map_0,
  602. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  603. .clkr.hw.init = &(const struct clk_init_data) {
  604. .name = "disp_cc_mdss_vsync_clk_src",
  605. .parent_data = disp_cc_parent_data_0,
  606. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0),
  607. .flags = CLK_SET_RATE_PARENT,
  608. .ops = &clk_rcg2_ops,
  609. },
  610. };
  611. static const struct freq_tbl ftbl_disp_cc_sleep_clk_src[] = {
  612. F(32000, P_SLEEP_CLK, 1, 0, 0),
  613. { }
  614. };
  615. static struct clk_rcg2 disp_cc_sleep_clk_src = {
  616. .cmd_rcgr = 0xe05c,
  617. .mnd_width = 0,
  618. .hid_width = 5,
  619. .parent_map = disp_cc_parent_map_9,
  620. .freq_tbl = ftbl_disp_cc_sleep_clk_src,
  621. .clkr.hw.init = &(const struct clk_init_data) {
  622. .name = "disp_cc_sleep_clk_src",
  623. .parent_data = disp_cc_parent_data_9,
  624. .num_parents = ARRAY_SIZE(disp_cc_parent_data_9),
  625. .flags = CLK_SET_RATE_PARENT,
  626. .ops = &clk_rcg2_ops,
  627. },
  628. };
  629. static struct clk_rcg2 disp_cc_xo_clk_src = {
  630. .cmd_rcgr = 0xe03c,
  631. .mnd_width = 0,
  632. .hid_width = 5,
  633. .parent_map = disp_cc_parent_map_0,
  634. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  635. .clkr.hw.init = &(const struct clk_init_data) {
  636. .name = "disp_cc_xo_clk_src",
  637. .parent_data = disp_cc_parent_data_0_ao,
  638. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0_ao),
  639. .flags = CLK_SET_RATE_PARENT,
  640. .ops = &clk_rcg2_ops,
  641. },
  642. };
  643. static struct clk_regmap_div disp_cc_mdss_byte0_div_clk_src = {
  644. .reg = 0x8120,
  645. .shift = 0,
  646. .width = 4,
  647. .clkr.hw.init = &(const struct clk_init_data) {
  648. .name = "disp_cc_mdss_byte0_div_clk_src",
  649. .parent_hws = (const struct clk_hw*[]) {
  650. &disp_cc_mdss_byte0_clk_src.clkr.hw,
  651. },
  652. .num_parents = 1,
  653. .ops = &clk_regmap_div_ops,
  654. },
  655. };
  656. static struct clk_regmap_div disp_cc_mdss_byte1_div_clk_src = {
  657. .reg = 0x813c,
  658. .shift = 0,
  659. .width = 4,
  660. .clkr.hw.init = &(const struct clk_init_data) {
  661. .name = "disp_cc_mdss_byte1_div_clk_src",
  662. .parent_hws = (const struct clk_hw*[]) {
  663. &disp_cc_mdss_byte1_clk_src.clkr.hw,
  664. },
  665. .num_parents = 1,
  666. .ops = &clk_regmap_div_ops,
  667. },
  668. };
  669. static struct clk_regmap_div disp_cc_mdss_dptx0_link_div_clk_src = {
  670. .reg = 0x8188,
  671. .shift = 0,
  672. .width = 4,
  673. .clkr.hw.init = &(const struct clk_init_data) {
  674. .name = "disp_cc_mdss_dptx0_link_div_clk_src",
  675. .parent_hws = (const struct clk_hw*[]) {
  676. &disp_cc_mdss_dptx0_link_clk_src.clkr.hw,
  677. },
  678. .num_parents = 1,
  679. .flags = CLK_SET_RATE_PARENT,
  680. .ops = &clk_regmap_div_ro_ops,
  681. },
  682. };
  683. static struct clk_regmap_div disp_cc_mdss_dptx1_link_div_clk_src = {
  684. .reg = 0x821c,
  685. .shift = 0,
  686. .width = 4,
  687. .clkr.hw.init = &(const struct clk_init_data) {
  688. .name = "disp_cc_mdss_dptx1_link_div_clk_src",
  689. .parent_hws = (const struct clk_hw*[]) {
  690. &disp_cc_mdss_dptx1_link_clk_src.clkr.hw,
  691. },
  692. .num_parents = 1,
  693. .flags = CLK_SET_RATE_PARENT,
  694. .ops = &clk_regmap_div_ro_ops,
  695. },
  696. };
  697. static struct clk_regmap_div disp_cc_mdss_dptx2_link_div_clk_src = {
  698. .reg = 0x8250,
  699. .shift = 0,
  700. .width = 4,
  701. .clkr.hw.init = &(const struct clk_init_data) {
  702. .name = "disp_cc_mdss_dptx2_link_div_clk_src",
  703. .parent_hws = (const struct clk_hw*[]) {
  704. &disp_cc_mdss_dptx2_link_clk_src.clkr.hw,
  705. },
  706. .num_parents = 1,
  707. .flags = CLK_SET_RATE_PARENT,
  708. .ops = &clk_regmap_div_ro_ops,
  709. },
  710. };
  711. static struct clk_regmap_div disp_cc_mdss_dptx3_link_div_clk_src = {
  712. .reg = 0x82cc,
  713. .shift = 0,
  714. .width = 4,
  715. .clkr.hw.init = &(const struct clk_init_data) {
  716. .name = "disp_cc_mdss_dptx3_link_div_clk_src",
  717. .parent_hws = (const struct clk_hw*[]) {
  718. &disp_cc_mdss_dptx3_link_clk_src.clkr.hw,
  719. },
  720. .num_parents = 1,
  721. .flags = CLK_SET_RATE_PARENT,
  722. .ops = &clk_regmap_div_ro_ops,
  723. },
  724. };
  725. static struct clk_branch disp_cc_mdss_accu_clk = {
  726. .halt_reg = 0xe058,
  727. .halt_check = BRANCH_HALT_VOTED,
  728. .clkr = {
  729. .enable_reg = 0xe058,
  730. .enable_mask = BIT(0),
  731. .hw.init = &(const struct clk_init_data) {
  732. .name = "disp_cc_mdss_accu_clk",
  733. .parent_hws = (const struct clk_hw*[]) {
  734. &disp_cc_xo_clk_src.clkr.hw,
  735. },
  736. .num_parents = 1,
  737. .flags = CLK_SET_RATE_PARENT,
  738. .ops = &clk_branch2_ops,
  739. },
  740. },
  741. };
  742. static struct clk_branch disp_cc_mdss_ahb1_clk = {
  743. .halt_reg = 0xa020,
  744. .halt_check = BRANCH_HALT,
  745. .clkr = {
  746. .enable_reg = 0xa020,
  747. .enable_mask = BIT(0),
  748. .hw.init = &(const struct clk_init_data) {
  749. .name = "disp_cc_mdss_ahb1_clk",
  750. .parent_hws = (const struct clk_hw*[]) {
  751. &disp_cc_mdss_ahb_clk_src.clkr.hw,
  752. },
  753. .num_parents = 1,
  754. .flags = CLK_SET_RATE_PARENT,
  755. .ops = &clk_branch2_ops,
  756. },
  757. },
  758. };
  759. static struct clk_branch disp_cc_mdss_ahb_clk = {
  760. .halt_reg = 0x80a4,
  761. .halt_check = BRANCH_HALT,
  762. .clkr = {
  763. .enable_reg = 0x80a4,
  764. .enable_mask = BIT(0),
  765. .hw.init = &(const struct clk_init_data) {
  766. .name = "disp_cc_mdss_ahb_clk",
  767. .parent_hws = (const struct clk_hw*[]) {
  768. &disp_cc_mdss_ahb_clk_src.clkr.hw,
  769. },
  770. .num_parents = 1,
  771. .flags = CLK_SET_RATE_PARENT,
  772. .ops = &clk_branch2_ops,
  773. },
  774. },
  775. };
  776. static struct clk_branch disp_cc_mdss_byte0_clk = {
  777. .halt_reg = 0x8028,
  778. .halt_check = BRANCH_HALT,
  779. .clkr = {
  780. .enable_reg = 0x8028,
  781. .enable_mask = BIT(0),
  782. .hw.init = &(const struct clk_init_data) {
  783. .name = "disp_cc_mdss_byte0_clk",
  784. .parent_hws = (const struct clk_hw*[]) {
  785. &disp_cc_mdss_byte0_clk_src.clkr.hw,
  786. },
  787. .num_parents = 1,
  788. .flags = CLK_SET_RATE_PARENT,
  789. .ops = &clk_branch2_ops,
  790. },
  791. },
  792. };
  793. static struct clk_branch disp_cc_mdss_byte0_intf_clk = {
  794. .halt_reg = 0x802c,
  795. .halt_check = BRANCH_HALT,
  796. .clkr = {
  797. .enable_reg = 0x802c,
  798. .enable_mask = BIT(0),
  799. .hw.init = &(const struct clk_init_data) {
  800. .name = "disp_cc_mdss_byte0_intf_clk",
  801. .parent_hws = (const struct clk_hw*[]) {
  802. &disp_cc_mdss_byte0_div_clk_src.clkr.hw,
  803. },
  804. .num_parents = 1,
  805. .flags = CLK_SET_RATE_PARENT,
  806. .ops = &clk_branch2_ops,
  807. },
  808. },
  809. };
  810. static struct clk_branch disp_cc_mdss_byte1_clk = {
  811. .halt_reg = 0x8030,
  812. .halt_check = BRANCH_HALT,
  813. .clkr = {
  814. .enable_reg = 0x8030,
  815. .enable_mask = BIT(0),
  816. .hw.init = &(const struct clk_init_data) {
  817. .name = "disp_cc_mdss_byte1_clk",
  818. .parent_hws = (const struct clk_hw*[]) {
  819. &disp_cc_mdss_byte1_clk_src.clkr.hw,
  820. },
  821. .num_parents = 1,
  822. .flags = CLK_SET_RATE_PARENT,
  823. .ops = &clk_branch2_ops,
  824. },
  825. },
  826. };
  827. static struct clk_branch disp_cc_mdss_byte1_intf_clk = {
  828. .halt_reg = 0x8034,
  829. .halt_check = BRANCH_HALT,
  830. .clkr = {
  831. .enable_reg = 0x8034,
  832. .enable_mask = BIT(0),
  833. .hw.init = &(const struct clk_init_data) {
  834. .name = "disp_cc_mdss_byte1_intf_clk",
  835. .parent_hws = (const struct clk_hw*[]) {
  836. &disp_cc_mdss_byte1_div_clk_src.clkr.hw,
  837. },
  838. .num_parents = 1,
  839. .flags = CLK_SET_RATE_PARENT,
  840. .ops = &clk_branch2_ops,
  841. },
  842. },
  843. };
  844. static struct clk_branch disp_cc_mdss_dptx0_aux_clk = {
  845. .halt_reg = 0x8058,
  846. .halt_check = BRANCH_HALT,
  847. .clkr = {
  848. .enable_reg = 0x8058,
  849. .enable_mask = BIT(0),
  850. .hw.init = &(const struct clk_init_data) {
  851. .name = "disp_cc_mdss_dptx0_aux_clk",
  852. .parent_hws = (const struct clk_hw*[]) {
  853. &disp_cc_mdss_dptx0_aux_clk_src.clkr.hw,
  854. },
  855. .num_parents = 1,
  856. .flags = CLK_SET_RATE_PARENT,
  857. .ops = &clk_branch2_ops,
  858. },
  859. },
  860. };
  861. static struct clk_branch disp_cc_mdss_dptx0_crypto_clk = {
  862. .halt_reg = 0x804c,
  863. .halt_check = BRANCH_HALT,
  864. .clkr = {
  865. .enable_reg = 0x804c,
  866. .enable_mask = BIT(0),
  867. .hw.init = &(const struct clk_init_data) {
  868. .name = "disp_cc_mdss_dptx0_crypto_clk",
  869. .parent_hws = (const struct clk_hw*[]) {
  870. &disp_cc_mdss_dptx0_link_clk_src.clkr.hw,
  871. },
  872. .num_parents = 1,
  873. .flags = CLK_SET_RATE_PARENT,
  874. .ops = &clk_branch2_ops,
  875. },
  876. },
  877. };
  878. static struct clk_branch disp_cc_mdss_dptx0_link_clk = {
  879. .halt_reg = 0x8040,
  880. .halt_check = BRANCH_HALT,
  881. .clkr = {
  882. .enable_reg = 0x8040,
  883. .enable_mask = BIT(0),
  884. .hw.init = &(const struct clk_init_data) {
  885. .name = "disp_cc_mdss_dptx0_link_clk",
  886. .parent_hws = (const struct clk_hw*[]) {
  887. &disp_cc_mdss_dptx0_link_clk_src.clkr.hw,
  888. },
  889. .num_parents = 1,
  890. .flags = CLK_SET_RATE_PARENT,
  891. .ops = &clk_branch2_ops,
  892. },
  893. },
  894. };
  895. static struct clk_branch disp_cc_mdss_dptx0_link_intf_clk = {
  896. .halt_reg = 0x8048,
  897. .halt_check = BRANCH_HALT,
  898. .clkr = {
  899. .enable_reg = 0x8048,
  900. .enable_mask = BIT(0),
  901. .hw.init = &(const struct clk_init_data) {
  902. .name = "disp_cc_mdss_dptx0_link_intf_clk",
  903. .parent_hws = (const struct clk_hw*[]) {
  904. &disp_cc_mdss_dptx0_link_div_clk_src.clkr.hw,
  905. },
  906. .num_parents = 1,
  907. .flags = CLK_SET_RATE_PARENT,
  908. .ops = &clk_branch2_ops,
  909. },
  910. },
  911. };
  912. static struct clk_branch disp_cc_mdss_dptx0_pixel0_clk = {
  913. .halt_reg = 0x8050,
  914. .halt_check = BRANCH_HALT,
  915. .clkr = {
  916. .enable_reg = 0x8050,
  917. .enable_mask = BIT(0),
  918. .hw.init = &(const struct clk_init_data) {
  919. .name = "disp_cc_mdss_dptx0_pixel0_clk",
  920. .parent_hws = (const struct clk_hw*[]) {
  921. &disp_cc_mdss_dptx0_pixel0_clk_src.clkr.hw,
  922. },
  923. .num_parents = 1,
  924. .flags = CLK_SET_RATE_PARENT,
  925. .ops = &clk_branch2_ops,
  926. },
  927. },
  928. };
  929. static struct clk_branch disp_cc_mdss_dptx0_pixel1_clk = {
  930. .halt_reg = 0x8054,
  931. .halt_check = BRANCH_HALT,
  932. .clkr = {
  933. .enable_reg = 0x8054,
  934. .enable_mask = BIT(0),
  935. .hw.init = &(const struct clk_init_data) {
  936. .name = "disp_cc_mdss_dptx0_pixel1_clk",
  937. .parent_hws = (const struct clk_hw*[]) {
  938. &disp_cc_mdss_dptx0_pixel1_clk_src.clkr.hw,
  939. },
  940. .num_parents = 1,
  941. .flags = CLK_SET_RATE_PARENT,
  942. .ops = &clk_branch2_ops,
  943. },
  944. },
  945. };
  946. static struct clk_branch disp_cc_mdss_dptx0_usb_router_link_intf_clk = {
  947. .halt_reg = 0x8044,
  948. .halt_check = BRANCH_HALT,
  949. .clkr = {
  950. .enable_reg = 0x8044,
  951. .enable_mask = BIT(0),
  952. .hw.init = &(const struct clk_init_data) {
  953. .name = "disp_cc_mdss_dptx0_usb_router_link_intf_clk",
  954. .parent_hws = (const struct clk_hw*[]) {
  955. &disp_cc_mdss_dptx0_link_div_clk_src.clkr.hw,
  956. },
  957. .num_parents = 1,
  958. .flags = CLK_SET_RATE_PARENT,
  959. .ops = &clk_branch2_ops,
  960. },
  961. },
  962. };
  963. static struct clk_branch disp_cc_mdss_dptx1_aux_clk = {
  964. .halt_reg = 0x8074,
  965. .halt_check = BRANCH_HALT,
  966. .clkr = {
  967. .enable_reg = 0x8074,
  968. .enable_mask = BIT(0),
  969. .hw.init = &(const struct clk_init_data) {
  970. .name = "disp_cc_mdss_dptx1_aux_clk",
  971. .parent_hws = (const struct clk_hw*[]) {
  972. &disp_cc_mdss_dptx1_aux_clk_src.clkr.hw,
  973. },
  974. .num_parents = 1,
  975. .flags = CLK_SET_RATE_PARENT,
  976. .ops = &clk_branch2_ops,
  977. },
  978. },
  979. };
  980. static struct clk_branch disp_cc_mdss_dptx1_crypto_clk = {
  981. .halt_reg = 0x8070,
  982. .halt_check = BRANCH_HALT,
  983. .clkr = {
  984. .enable_reg = 0x8070,
  985. .enable_mask = BIT(0),
  986. .hw.init = &(const struct clk_init_data) {
  987. .name = "disp_cc_mdss_dptx1_crypto_clk",
  988. .parent_hws = (const struct clk_hw*[]) {
  989. &disp_cc_mdss_dptx1_link_clk_src.clkr.hw,
  990. },
  991. .num_parents = 1,
  992. .flags = CLK_SET_RATE_PARENT,
  993. .ops = &clk_branch2_ops,
  994. },
  995. },
  996. };
  997. static struct clk_branch disp_cc_mdss_dptx1_link_clk = {
  998. .halt_reg = 0x8064,
  999. .halt_check = BRANCH_HALT,
  1000. .clkr = {
  1001. .enable_reg = 0x8064,
  1002. .enable_mask = BIT(0),
  1003. .hw.init = &(const struct clk_init_data) {
  1004. .name = "disp_cc_mdss_dptx1_link_clk",
  1005. .parent_hws = (const struct clk_hw*[]) {
  1006. &disp_cc_mdss_dptx1_link_clk_src.clkr.hw,
  1007. },
  1008. .num_parents = 1,
  1009. .flags = CLK_SET_RATE_PARENT,
  1010. .ops = &clk_branch2_ops,
  1011. },
  1012. },
  1013. };
  1014. static struct clk_branch disp_cc_mdss_dptx1_link_intf_clk = {
  1015. .halt_reg = 0x806c,
  1016. .halt_check = BRANCH_HALT,
  1017. .clkr = {
  1018. .enable_reg = 0x806c,
  1019. .enable_mask = BIT(0),
  1020. .hw.init = &(const struct clk_init_data) {
  1021. .name = "disp_cc_mdss_dptx1_link_intf_clk",
  1022. .parent_hws = (const struct clk_hw*[]) {
  1023. &disp_cc_mdss_dptx1_link_div_clk_src.clkr.hw,
  1024. },
  1025. .num_parents = 1,
  1026. .flags = CLK_SET_RATE_PARENT,
  1027. .ops = &clk_branch2_ops,
  1028. },
  1029. },
  1030. };
  1031. static struct clk_branch disp_cc_mdss_dptx1_pixel0_clk = {
  1032. .halt_reg = 0x805c,
  1033. .halt_check = BRANCH_HALT,
  1034. .clkr = {
  1035. .enable_reg = 0x805c,
  1036. .enable_mask = BIT(0),
  1037. .hw.init = &(const struct clk_init_data) {
  1038. .name = "disp_cc_mdss_dptx1_pixel0_clk",
  1039. .parent_hws = (const struct clk_hw*[]) {
  1040. &disp_cc_mdss_dptx1_pixel0_clk_src.clkr.hw,
  1041. },
  1042. .num_parents = 1,
  1043. .flags = CLK_SET_RATE_PARENT,
  1044. .ops = &clk_branch2_ops,
  1045. },
  1046. },
  1047. };
  1048. static struct clk_branch disp_cc_mdss_dptx1_pixel1_clk = {
  1049. .halt_reg = 0x8060,
  1050. .halt_check = BRANCH_HALT,
  1051. .clkr = {
  1052. .enable_reg = 0x8060,
  1053. .enable_mask = BIT(0),
  1054. .hw.init = &(const struct clk_init_data) {
  1055. .name = "disp_cc_mdss_dptx1_pixel1_clk",
  1056. .parent_hws = (const struct clk_hw*[]) {
  1057. &disp_cc_mdss_dptx1_pixel1_clk_src.clkr.hw,
  1058. },
  1059. .num_parents = 1,
  1060. .flags = CLK_SET_RATE_PARENT,
  1061. .ops = &clk_branch2_ops,
  1062. },
  1063. },
  1064. };
  1065. static struct clk_branch disp_cc_mdss_dptx1_usb_router_link_intf_clk = {
  1066. .halt_reg = 0x8068,
  1067. .halt_check = BRANCH_HALT,
  1068. .clkr = {
  1069. .enable_reg = 0x8068,
  1070. .enable_mask = BIT(0),
  1071. .hw.init = &(const struct clk_init_data) {
  1072. .name = "disp_cc_mdss_dptx1_usb_router_link_intf_clk",
  1073. .parent_hws = (const struct clk_hw*[]) {
  1074. &disp_cc_mdss_dptx0_link_div_clk_src.clkr.hw,
  1075. },
  1076. .num_parents = 1,
  1077. .flags = CLK_SET_RATE_PARENT,
  1078. .ops = &clk_branch2_ops,
  1079. },
  1080. },
  1081. };
  1082. static struct clk_branch disp_cc_mdss_dptx2_aux_clk = {
  1083. .halt_reg = 0x808c,
  1084. .halt_check = BRANCH_HALT,
  1085. .clkr = {
  1086. .enable_reg = 0x808c,
  1087. .enable_mask = BIT(0),
  1088. .hw.init = &(const struct clk_init_data) {
  1089. .name = "disp_cc_mdss_dptx2_aux_clk",
  1090. .parent_hws = (const struct clk_hw*[]) {
  1091. &disp_cc_mdss_dptx2_aux_clk_src.clkr.hw,
  1092. },
  1093. .num_parents = 1,
  1094. .flags = CLK_SET_RATE_PARENT,
  1095. .ops = &clk_branch2_ops,
  1096. },
  1097. },
  1098. };
  1099. static struct clk_branch disp_cc_mdss_dptx2_crypto_clk = {
  1100. .halt_reg = 0x8088,
  1101. .halt_check = BRANCH_HALT,
  1102. .clkr = {
  1103. .enable_reg = 0x8088,
  1104. .enable_mask = BIT(0),
  1105. .hw.init = &(const struct clk_init_data) {
  1106. .name = "disp_cc_mdss_dptx2_crypto_clk",
  1107. .parent_hws = (const struct clk_hw*[]) {
  1108. &disp_cc_mdss_dptx2_link_clk_src.clkr.hw,
  1109. },
  1110. .num_parents = 1,
  1111. .flags = CLK_SET_RATE_PARENT,
  1112. .ops = &clk_branch2_ops,
  1113. },
  1114. },
  1115. };
  1116. static struct clk_branch disp_cc_mdss_dptx2_link_clk = {
  1117. .halt_reg = 0x8080,
  1118. .halt_check = BRANCH_HALT,
  1119. .clkr = {
  1120. .enable_reg = 0x8080,
  1121. .enable_mask = BIT(0),
  1122. .hw.init = &(const struct clk_init_data) {
  1123. .name = "disp_cc_mdss_dptx2_link_clk",
  1124. .parent_hws = (const struct clk_hw*[]) {
  1125. &disp_cc_mdss_dptx2_link_clk_src.clkr.hw,
  1126. },
  1127. .num_parents = 1,
  1128. .flags = CLK_SET_RATE_PARENT,
  1129. .ops = &clk_branch2_ops,
  1130. },
  1131. },
  1132. };
  1133. static struct clk_branch disp_cc_mdss_dptx2_link_intf_clk = {
  1134. .halt_reg = 0x8084,
  1135. .halt_check = BRANCH_HALT,
  1136. .clkr = {
  1137. .enable_reg = 0x8084,
  1138. .enable_mask = BIT(0),
  1139. .hw.init = &(const struct clk_init_data) {
  1140. .name = "disp_cc_mdss_dptx2_link_intf_clk",
  1141. .parent_hws = (const struct clk_hw*[]) {
  1142. &disp_cc_mdss_dptx2_link_div_clk_src.clkr.hw,
  1143. },
  1144. .num_parents = 1,
  1145. .flags = CLK_SET_RATE_PARENT,
  1146. .ops = &clk_branch2_ops,
  1147. },
  1148. },
  1149. };
  1150. static struct clk_branch disp_cc_mdss_dptx2_pixel0_clk = {
  1151. .halt_reg = 0x8078,
  1152. .halt_check = BRANCH_HALT,
  1153. .clkr = {
  1154. .enable_reg = 0x8078,
  1155. .enable_mask = BIT(0),
  1156. .hw.init = &(const struct clk_init_data) {
  1157. .name = "disp_cc_mdss_dptx2_pixel0_clk",
  1158. .parent_hws = (const struct clk_hw*[]) {
  1159. &disp_cc_mdss_dptx2_pixel0_clk_src.clkr.hw,
  1160. },
  1161. .num_parents = 1,
  1162. .flags = CLK_SET_RATE_PARENT,
  1163. .ops = &clk_branch2_ops,
  1164. },
  1165. },
  1166. };
  1167. static struct clk_branch disp_cc_mdss_dptx2_pixel1_clk = {
  1168. .halt_reg = 0x807c,
  1169. .halt_check = BRANCH_HALT,
  1170. .clkr = {
  1171. .enable_reg = 0x807c,
  1172. .enable_mask = BIT(0),
  1173. .hw.init = &(const struct clk_init_data) {
  1174. .name = "disp_cc_mdss_dptx2_pixel1_clk",
  1175. .parent_hws = (const struct clk_hw*[]) {
  1176. &disp_cc_mdss_dptx2_pixel1_clk_src.clkr.hw,
  1177. },
  1178. .num_parents = 1,
  1179. .flags = CLK_SET_RATE_PARENT,
  1180. .ops = &clk_branch2_ops,
  1181. },
  1182. },
  1183. };
  1184. static struct clk_branch disp_cc_mdss_dptx3_aux_clk = {
  1185. .halt_reg = 0x809c,
  1186. .halt_check = BRANCH_HALT,
  1187. .clkr = {
  1188. .enable_reg = 0x809c,
  1189. .enable_mask = BIT(0),
  1190. .hw.init = &(const struct clk_init_data) {
  1191. .name = "disp_cc_mdss_dptx3_aux_clk",
  1192. .parent_hws = (const struct clk_hw*[]) {
  1193. &disp_cc_mdss_dptx3_aux_clk_src.clkr.hw,
  1194. },
  1195. .num_parents = 1,
  1196. .flags = CLK_SET_RATE_PARENT,
  1197. .ops = &clk_branch2_ops,
  1198. },
  1199. },
  1200. };
  1201. static struct clk_branch disp_cc_mdss_dptx3_crypto_clk = {
  1202. .halt_reg = 0x80a0,
  1203. .halt_check = BRANCH_HALT,
  1204. .clkr = {
  1205. .enable_reg = 0x80a0,
  1206. .enable_mask = BIT(0),
  1207. .hw.init = &(const struct clk_init_data) {
  1208. .name = "disp_cc_mdss_dptx3_crypto_clk",
  1209. .parent_hws = (const struct clk_hw*[]) {
  1210. &disp_cc_mdss_dptx3_link_clk_src.clkr.hw,
  1211. },
  1212. .num_parents = 1,
  1213. .flags = CLK_SET_RATE_PARENT,
  1214. .ops = &clk_branch2_ops,
  1215. },
  1216. },
  1217. };
  1218. static struct clk_branch disp_cc_mdss_dptx3_link_clk = {
  1219. .halt_reg = 0x8094,
  1220. .halt_check = BRANCH_HALT,
  1221. .clkr = {
  1222. .enable_reg = 0x8094,
  1223. .enable_mask = BIT(0),
  1224. .hw.init = &(const struct clk_init_data) {
  1225. .name = "disp_cc_mdss_dptx3_link_clk",
  1226. .parent_hws = (const struct clk_hw*[]) {
  1227. &disp_cc_mdss_dptx3_link_clk_src.clkr.hw,
  1228. },
  1229. .num_parents = 1,
  1230. .flags = CLK_SET_RATE_PARENT,
  1231. .ops = &clk_branch2_ops,
  1232. },
  1233. },
  1234. };
  1235. static struct clk_branch disp_cc_mdss_dptx3_link_intf_clk = {
  1236. .halt_reg = 0x8098,
  1237. .halt_check = BRANCH_HALT,
  1238. .clkr = {
  1239. .enable_reg = 0x8098,
  1240. .enable_mask = BIT(0),
  1241. .hw.init = &(const struct clk_init_data) {
  1242. .name = "disp_cc_mdss_dptx3_link_intf_clk",
  1243. .parent_hws = (const struct clk_hw*[]) {
  1244. &disp_cc_mdss_dptx3_link_div_clk_src.clkr.hw,
  1245. },
  1246. .num_parents = 1,
  1247. .flags = CLK_SET_RATE_PARENT,
  1248. .ops = &clk_branch2_ops,
  1249. },
  1250. },
  1251. };
  1252. static struct clk_branch disp_cc_mdss_dptx3_pixel0_clk = {
  1253. .halt_reg = 0x8090,
  1254. .halt_check = BRANCH_HALT,
  1255. .clkr = {
  1256. .enable_reg = 0x8090,
  1257. .enable_mask = BIT(0),
  1258. .hw.init = &(const struct clk_init_data) {
  1259. .name = "disp_cc_mdss_dptx3_pixel0_clk",
  1260. .parent_hws = (const struct clk_hw*[]) {
  1261. &disp_cc_mdss_dptx3_pixel0_clk_src.clkr.hw,
  1262. },
  1263. .num_parents = 1,
  1264. .flags = CLK_SET_RATE_PARENT,
  1265. .ops = &clk_branch2_ops,
  1266. },
  1267. },
  1268. };
  1269. static struct clk_branch disp_cc_mdss_esc0_clk = {
  1270. .halt_reg = 0x8038,
  1271. .halt_check = BRANCH_HALT,
  1272. .clkr = {
  1273. .enable_reg = 0x8038,
  1274. .enable_mask = BIT(0),
  1275. .hw.init = &(const struct clk_init_data) {
  1276. .name = "disp_cc_mdss_esc0_clk",
  1277. .parent_hws = (const struct clk_hw*[]) {
  1278. &disp_cc_mdss_esc0_clk_src.clkr.hw,
  1279. },
  1280. .num_parents = 1,
  1281. .flags = CLK_SET_RATE_PARENT,
  1282. .ops = &clk_branch2_ops,
  1283. },
  1284. },
  1285. };
  1286. static struct clk_branch disp_cc_mdss_esc1_clk = {
  1287. .halt_reg = 0x803c,
  1288. .halt_check = BRANCH_HALT,
  1289. .clkr = {
  1290. .enable_reg = 0x803c,
  1291. .enable_mask = BIT(0),
  1292. .hw.init = &(const struct clk_init_data) {
  1293. .name = "disp_cc_mdss_esc1_clk",
  1294. .parent_hws = (const struct clk_hw*[]) {
  1295. &disp_cc_mdss_esc1_clk_src.clkr.hw,
  1296. },
  1297. .num_parents = 1,
  1298. .flags = CLK_SET_RATE_PARENT,
  1299. .ops = &clk_branch2_ops,
  1300. },
  1301. },
  1302. };
  1303. static struct clk_branch disp_cc_mdss_mdp1_clk = {
  1304. .halt_reg = 0xa004,
  1305. .halt_check = BRANCH_HALT,
  1306. .clkr = {
  1307. .enable_reg = 0xa004,
  1308. .enable_mask = BIT(0),
  1309. .hw.init = &(const struct clk_init_data) {
  1310. .name = "disp_cc_mdss_mdp1_clk",
  1311. .parent_hws = (const struct clk_hw*[]) {
  1312. &disp_cc_mdss_mdp_clk_src.clkr.hw,
  1313. },
  1314. .num_parents = 1,
  1315. .flags = CLK_SET_RATE_PARENT,
  1316. .ops = &clk_branch2_ops,
  1317. },
  1318. },
  1319. };
  1320. static struct clk_branch disp_cc_mdss_mdp_clk = {
  1321. .halt_reg = 0x800c,
  1322. .halt_check = BRANCH_HALT,
  1323. .clkr = {
  1324. .enable_reg = 0x800c,
  1325. .enable_mask = BIT(0),
  1326. .hw.init = &(const struct clk_init_data) {
  1327. .name = "disp_cc_mdss_mdp_clk",
  1328. .parent_hws = (const struct clk_hw*[]) {
  1329. &disp_cc_mdss_mdp_clk_src.clkr.hw,
  1330. },
  1331. .num_parents = 1,
  1332. .flags = CLK_SET_RATE_PARENT,
  1333. .ops = &clk_branch2_ops,
  1334. },
  1335. },
  1336. };
  1337. static struct clk_branch disp_cc_mdss_mdp_lut1_clk = {
  1338. .halt_reg = 0xa010,
  1339. .halt_check = BRANCH_HALT,
  1340. .clkr = {
  1341. .enable_reg = 0xa010,
  1342. .enable_mask = BIT(0),
  1343. .hw.init = &(const struct clk_init_data) {
  1344. .name = "disp_cc_mdss_mdp_lut1_clk",
  1345. .parent_hws = (const struct clk_hw*[]) {
  1346. &disp_cc_mdss_mdp_clk_src.clkr.hw,
  1347. },
  1348. .num_parents = 1,
  1349. .flags = CLK_SET_RATE_PARENT,
  1350. .ops = &clk_branch2_ops,
  1351. },
  1352. },
  1353. };
  1354. static struct clk_branch disp_cc_mdss_mdp_lut_clk = {
  1355. .halt_reg = 0x8018,
  1356. .halt_check = BRANCH_HALT_VOTED,
  1357. .clkr = {
  1358. .enable_reg = 0x8018,
  1359. .enable_mask = BIT(0),
  1360. .hw.init = &(const struct clk_init_data) {
  1361. .name = "disp_cc_mdss_mdp_lut_clk",
  1362. .parent_hws = (const struct clk_hw*[]) {
  1363. &disp_cc_mdss_mdp_clk_src.clkr.hw,
  1364. },
  1365. .num_parents = 1,
  1366. .flags = CLK_SET_RATE_PARENT,
  1367. .ops = &clk_branch2_ops,
  1368. },
  1369. },
  1370. };
  1371. static struct clk_branch disp_cc_mdss_non_gdsc_ahb_clk = {
  1372. .halt_reg = 0xc004,
  1373. .halt_check = BRANCH_HALT_VOTED,
  1374. .clkr = {
  1375. .enable_reg = 0xc004,
  1376. .enable_mask = BIT(0),
  1377. .hw.init = &(const struct clk_init_data) {
  1378. .name = "disp_cc_mdss_non_gdsc_ahb_clk",
  1379. .parent_hws = (const struct clk_hw*[]) {
  1380. &disp_cc_mdss_ahb_clk_src.clkr.hw,
  1381. },
  1382. .num_parents = 1,
  1383. .flags = CLK_SET_RATE_PARENT,
  1384. .ops = &clk_branch2_ops,
  1385. },
  1386. },
  1387. };
  1388. static struct clk_branch disp_cc_mdss_pclk0_clk = {
  1389. .halt_reg = 0x8004,
  1390. .halt_check = BRANCH_HALT,
  1391. .clkr = {
  1392. .enable_reg = 0x8004,
  1393. .enable_mask = BIT(0),
  1394. .hw.init = &(const struct clk_init_data) {
  1395. .name = "disp_cc_mdss_pclk0_clk",
  1396. .parent_hws = (const struct clk_hw*[]) {
  1397. &disp_cc_mdss_pclk0_clk_src.clkr.hw,
  1398. },
  1399. .num_parents = 1,
  1400. .flags = CLK_SET_RATE_PARENT,
  1401. .ops = &clk_branch2_ops,
  1402. },
  1403. },
  1404. };
  1405. static struct clk_branch disp_cc_mdss_pclk1_clk = {
  1406. .halt_reg = 0x8008,
  1407. .halt_check = BRANCH_HALT,
  1408. .clkr = {
  1409. .enable_reg = 0x8008,
  1410. .enable_mask = BIT(0),
  1411. .hw.init = &(const struct clk_init_data) {
  1412. .name = "disp_cc_mdss_pclk1_clk",
  1413. .parent_hws = (const struct clk_hw*[]) {
  1414. &disp_cc_mdss_pclk1_clk_src.clkr.hw,
  1415. },
  1416. .num_parents = 1,
  1417. .flags = CLK_SET_RATE_PARENT,
  1418. .ops = &clk_branch2_ops,
  1419. },
  1420. },
  1421. };
  1422. static struct clk_branch disp_cc_mdss_rscc_ahb_clk = {
  1423. .halt_reg = 0xc00c,
  1424. .halt_check = BRANCH_HALT,
  1425. .clkr = {
  1426. .enable_reg = 0xc00c,
  1427. .enable_mask = BIT(0),
  1428. .hw.init = &(const struct clk_init_data) {
  1429. .name = "disp_cc_mdss_rscc_ahb_clk",
  1430. .parent_hws = (const struct clk_hw*[]) {
  1431. &disp_cc_mdss_ahb_clk_src.clkr.hw,
  1432. },
  1433. .num_parents = 1,
  1434. .flags = CLK_SET_RATE_PARENT,
  1435. .ops = &clk_branch2_ops,
  1436. },
  1437. },
  1438. };
  1439. static struct clk_branch disp_cc_mdss_rscc_vsync_clk = {
  1440. .halt_reg = 0xc008,
  1441. .halt_check = BRANCH_HALT,
  1442. .clkr = {
  1443. .enable_reg = 0xc008,
  1444. .enable_mask = BIT(0),
  1445. .hw.init = &(const struct clk_init_data) {
  1446. .name = "disp_cc_mdss_rscc_vsync_clk",
  1447. .parent_hws = (const struct clk_hw*[]) {
  1448. &disp_cc_mdss_vsync_clk_src.clkr.hw,
  1449. },
  1450. .num_parents = 1,
  1451. .flags = CLK_SET_RATE_PARENT,
  1452. .ops = &clk_branch2_ops,
  1453. },
  1454. },
  1455. };
  1456. static struct clk_branch disp_cc_mdss_vsync1_clk = {
  1457. .halt_reg = 0xa01c,
  1458. .halt_check = BRANCH_HALT,
  1459. .clkr = {
  1460. .enable_reg = 0xa01c,
  1461. .enable_mask = BIT(0),
  1462. .hw.init = &(const struct clk_init_data) {
  1463. .name = "disp_cc_mdss_vsync1_clk",
  1464. .parent_hws = (const struct clk_hw*[]) {
  1465. &disp_cc_mdss_vsync_clk_src.clkr.hw,
  1466. },
  1467. .num_parents = 1,
  1468. .flags = CLK_SET_RATE_PARENT,
  1469. .ops = &clk_branch2_ops,
  1470. },
  1471. },
  1472. };
  1473. static struct clk_branch disp_cc_mdss_vsync_clk = {
  1474. .halt_reg = 0x8024,
  1475. .halt_check = BRANCH_HALT,
  1476. .clkr = {
  1477. .enable_reg = 0x8024,
  1478. .enable_mask = BIT(0),
  1479. .hw.init = &(const struct clk_init_data) {
  1480. .name = "disp_cc_mdss_vsync_clk",
  1481. .parent_hws = (const struct clk_hw*[]) {
  1482. &disp_cc_mdss_vsync_clk_src.clkr.hw,
  1483. },
  1484. .num_parents = 1,
  1485. .flags = CLK_SET_RATE_PARENT,
  1486. .ops = &clk_branch2_ops,
  1487. },
  1488. },
  1489. };
  1490. static struct clk_branch disp_cc_sleep_clk = {
  1491. .halt_reg = 0xe074,
  1492. .halt_check = BRANCH_HALT,
  1493. .clkr = {
  1494. .enable_reg = 0xe074,
  1495. .enable_mask = BIT(0),
  1496. .hw.init = &(const struct clk_init_data) {
  1497. .name = "disp_cc_sleep_clk",
  1498. .parent_hws = (const struct clk_hw*[]) {
  1499. &disp_cc_sleep_clk_src.clkr.hw,
  1500. },
  1501. .num_parents = 1,
  1502. .flags = CLK_SET_RATE_PARENT,
  1503. .ops = &clk_branch2_ops,
  1504. },
  1505. },
  1506. };
  1507. static struct gdsc mdss_gdsc = {
  1508. .gdscr = 0x9000,
  1509. .pd = {
  1510. .name = "mdss_gdsc",
  1511. },
  1512. .pwrsts = PWRSTS_OFF_ON,
  1513. .flags = POLL_CFG_GDSCR | HW_CTRL | RETAIN_FF_ENABLE,
  1514. };
  1515. static struct gdsc mdss_int2_gdsc = {
  1516. .gdscr = 0xb000,
  1517. .pd = {
  1518. .name = "mdss_int2_gdsc",
  1519. },
  1520. .pwrsts = PWRSTS_OFF_ON,
  1521. .flags = POLL_CFG_GDSCR | HW_CTRL | RETAIN_FF_ENABLE,
  1522. };
  1523. static struct clk_regmap *disp_cc_sm8550_clocks[] = {
  1524. [DISP_CC_MDSS_ACCU_CLK] = &disp_cc_mdss_accu_clk.clkr,
  1525. [DISP_CC_MDSS_AHB1_CLK] = &disp_cc_mdss_ahb1_clk.clkr,
  1526. [DISP_CC_MDSS_AHB_CLK] = &disp_cc_mdss_ahb_clk.clkr,
  1527. [DISP_CC_MDSS_AHB_CLK_SRC] = &disp_cc_mdss_ahb_clk_src.clkr,
  1528. [DISP_CC_MDSS_BYTE0_CLK] = &disp_cc_mdss_byte0_clk.clkr,
  1529. [DISP_CC_MDSS_BYTE0_CLK_SRC] = &disp_cc_mdss_byte0_clk_src.clkr,
  1530. [DISP_CC_MDSS_BYTE0_DIV_CLK_SRC] = &disp_cc_mdss_byte0_div_clk_src.clkr,
  1531. [DISP_CC_MDSS_BYTE0_INTF_CLK] = &disp_cc_mdss_byte0_intf_clk.clkr,
  1532. [DISP_CC_MDSS_BYTE1_CLK] = &disp_cc_mdss_byte1_clk.clkr,
  1533. [DISP_CC_MDSS_BYTE1_CLK_SRC] = &disp_cc_mdss_byte1_clk_src.clkr,
  1534. [DISP_CC_MDSS_BYTE1_DIV_CLK_SRC] = &disp_cc_mdss_byte1_div_clk_src.clkr,
  1535. [DISP_CC_MDSS_BYTE1_INTF_CLK] = &disp_cc_mdss_byte1_intf_clk.clkr,
  1536. [DISP_CC_MDSS_DPTX0_AUX_CLK] = &disp_cc_mdss_dptx0_aux_clk.clkr,
  1537. [DISP_CC_MDSS_DPTX0_AUX_CLK_SRC] = &disp_cc_mdss_dptx0_aux_clk_src.clkr,
  1538. [DISP_CC_MDSS_DPTX0_CRYPTO_CLK] = &disp_cc_mdss_dptx0_crypto_clk.clkr,
  1539. [DISP_CC_MDSS_DPTX0_LINK_CLK] = &disp_cc_mdss_dptx0_link_clk.clkr,
  1540. [DISP_CC_MDSS_DPTX0_LINK_CLK_SRC] = &disp_cc_mdss_dptx0_link_clk_src.clkr,
  1541. [DISP_CC_MDSS_DPTX0_LINK_DIV_CLK_SRC] = &disp_cc_mdss_dptx0_link_div_clk_src.clkr,
  1542. [DISP_CC_MDSS_DPTX0_LINK_INTF_CLK] = &disp_cc_mdss_dptx0_link_intf_clk.clkr,
  1543. [DISP_CC_MDSS_DPTX0_PIXEL0_CLK] = &disp_cc_mdss_dptx0_pixel0_clk.clkr,
  1544. [DISP_CC_MDSS_DPTX0_PIXEL0_CLK_SRC] = &disp_cc_mdss_dptx0_pixel0_clk_src.clkr,
  1545. [DISP_CC_MDSS_DPTX0_PIXEL1_CLK] = &disp_cc_mdss_dptx0_pixel1_clk.clkr,
  1546. [DISP_CC_MDSS_DPTX0_PIXEL1_CLK_SRC] = &disp_cc_mdss_dptx0_pixel1_clk_src.clkr,
  1547. [DISP_CC_MDSS_DPTX0_USB_ROUTER_LINK_INTF_CLK] =
  1548. &disp_cc_mdss_dptx0_usb_router_link_intf_clk.clkr,
  1549. [DISP_CC_MDSS_DPTX1_AUX_CLK] = &disp_cc_mdss_dptx1_aux_clk.clkr,
  1550. [DISP_CC_MDSS_DPTX1_AUX_CLK_SRC] = &disp_cc_mdss_dptx1_aux_clk_src.clkr,
  1551. [DISP_CC_MDSS_DPTX1_CRYPTO_CLK] = &disp_cc_mdss_dptx1_crypto_clk.clkr,
  1552. [DISP_CC_MDSS_DPTX1_LINK_CLK] = &disp_cc_mdss_dptx1_link_clk.clkr,
  1553. [DISP_CC_MDSS_DPTX1_LINK_CLK_SRC] = &disp_cc_mdss_dptx1_link_clk_src.clkr,
  1554. [DISP_CC_MDSS_DPTX1_LINK_DIV_CLK_SRC] = &disp_cc_mdss_dptx1_link_div_clk_src.clkr,
  1555. [DISP_CC_MDSS_DPTX1_LINK_INTF_CLK] = &disp_cc_mdss_dptx1_link_intf_clk.clkr,
  1556. [DISP_CC_MDSS_DPTX1_PIXEL0_CLK] = &disp_cc_mdss_dptx1_pixel0_clk.clkr,
  1557. [DISP_CC_MDSS_DPTX1_PIXEL0_CLK_SRC] = &disp_cc_mdss_dptx1_pixel0_clk_src.clkr,
  1558. [DISP_CC_MDSS_DPTX1_PIXEL1_CLK] = &disp_cc_mdss_dptx1_pixel1_clk.clkr,
  1559. [DISP_CC_MDSS_DPTX1_PIXEL1_CLK_SRC] = &disp_cc_mdss_dptx1_pixel1_clk_src.clkr,
  1560. [DISP_CC_MDSS_DPTX1_USB_ROUTER_LINK_INTF_CLK] =
  1561. &disp_cc_mdss_dptx1_usb_router_link_intf_clk.clkr,
  1562. [DISP_CC_MDSS_DPTX2_AUX_CLK] = &disp_cc_mdss_dptx2_aux_clk.clkr,
  1563. [DISP_CC_MDSS_DPTX2_AUX_CLK_SRC] = &disp_cc_mdss_dptx2_aux_clk_src.clkr,
  1564. [DISP_CC_MDSS_DPTX2_CRYPTO_CLK] = &disp_cc_mdss_dptx2_crypto_clk.clkr,
  1565. [DISP_CC_MDSS_DPTX2_LINK_CLK] = &disp_cc_mdss_dptx2_link_clk.clkr,
  1566. [DISP_CC_MDSS_DPTX2_LINK_CLK_SRC] = &disp_cc_mdss_dptx2_link_clk_src.clkr,
  1567. [DISP_CC_MDSS_DPTX2_LINK_DIV_CLK_SRC] = &disp_cc_mdss_dptx2_link_div_clk_src.clkr,
  1568. [DISP_CC_MDSS_DPTX2_LINK_INTF_CLK] = &disp_cc_mdss_dptx2_link_intf_clk.clkr,
  1569. [DISP_CC_MDSS_DPTX2_PIXEL0_CLK] = &disp_cc_mdss_dptx2_pixel0_clk.clkr,
  1570. [DISP_CC_MDSS_DPTX2_PIXEL0_CLK_SRC] = &disp_cc_mdss_dptx2_pixel0_clk_src.clkr,
  1571. [DISP_CC_MDSS_DPTX2_PIXEL1_CLK] = &disp_cc_mdss_dptx2_pixel1_clk.clkr,
  1572. [DISP_CC_MDSS_DPTX2_PIXEL1_CLK_SRC] = &disp_cc_mdss_dptx2_pixel1_clk_src.clkr,
  1573. [DISP_CC_MDSS_DPTX3_AUX_CLK] = &disp_cc_mdss_dptx3_aux_clk.clkr,
  1574. [DISP_CC_MDSS_DPTX3_AUX_CLK_SRC] = &disp_cc_mdss_dptx3_aux_clk_src.clkr,
  1575. [DISP_CC_MDSS_DPTX3_CRYPTO_CLK] = &disp_cc_mdss_dptx3_crypto_clk.clkr,
  1576. [DISP_CC_MDSS_DPTX3_LINK_CLK] = &disp_cc_mdss_dptx3_link_clk.clkr,
  1577. [DISP_CC_MDSS_DPTX3_LINK_CLK_SRC] = &disp_cc_mdss_dptx3_link_clk_src.clkr,
  1578. [DISP_CC_MDSS_DPTX3_LINK_DIV_CLK_SRC] = &disp_cc_mdss_dptx3_link_div_clk_src.clkr,
  1579. [DISP_CC_MDSS_DPTX3_LINK_INTF_CLK] = &disp_cc_mdss_dptx3_link_intf_clk.clkr,
  1580. [DISP_CC_MDSS_DPTX3_PIXEL0_CLK] = &disp_cc_mdss_dptx3_pixel0_clk.clkr,
  1581. [DISP_CC_MDSS_DPTX3_PIXEL0_CLK_SRC] = &disp_cc_mdss_dptx3_pixel0_clk_src.clkr,
  1582. [DISP_CC_MDSS_ESC0_CLK] = &disp_cc_mdss_esc0_clk.clkr,
  1583. [DISP_CC_MDSS_ESC0_CLK_SRC] = &disp_cc_mdss_esc0_clk_src.clkr,
  1584. [DISP_CC_MDSS_ESC1_CLK] = &disp_cc_mdss_esc1_clk.clkr,
  1585. [DISP_CC_MDSS_ESC1_CLK_SRC] = &disp_cc_mdss_esc1_clk_src.clkr,
  1586. [DISP_CC_MDSS_MDP1_CLK] = &disp_cc_mdss_mdp1_clk.clkr,
  1587. [DISP_CC_MDSS_MDP_CLK] = &disp_cc_mdss_mdp_clk.clkr,
  1588. [DISP_CC_MDSS_MDP_CLK_SRC] = &disp_cc_mdss_mdp_clk_src.clkr,
  1589. [DISP_CC_MDSS_MDP_LUT1_CLK] = &disp_cc_mdss_mdp_lut1_clk.clkr,
  1590. [DISP_CC_MDSS_MDP_LUT_CLK] = &disp_cc_mdss_mdp_lut_clk.clkr,
  1591. [DISP_CC_MDSS_NON_GDSC_AHB_CLK] = &disp_cc_mdss_non_gdsc_ahb_clk.clkr,
  1592. [DISP_CC_MDSS_PCLK0_CLK] = &disp_cc_mdss_pclk0_clk.clkr,
  1593. [DISP_CC_MDSS_PCLK0_CLK_SRC] = &disp_cc_mdss_pclk0_clk_src.clkr,
  1594. [DISP_CC_MDSS_PCLK1_CLK] = &disp_cc_mdss_pclk1_clk.clkr,
  1595. [DISP_CC_MDSS_PCLK1_CLK_SRC] = &disp_cc_mdss_pclk1_clk_src.clkr,
  1596. [DISP_CC_MDSS_RSCC_AHB_CLK] = &disp_cc_mdss_rscc_ahb_clk.clkr,
  1597. [DISP_CC_MDSS_RSCC_VSYNC_CLK] = &disp_cc_mdss_rscc_vsync_clk.clkr,
  1598. [DISP_CC_MDSS_VSYNC1_CLK] = &disp_cc_mdss_vsync1_clk.clkr,
  1599. [DISP_CC_MDSS_VSYNC_CLK] = &disp_cc_mdss_vsync_clk.clkr,
  1600. [DISP_CC_MDSS_VSYNC_CLK_SRC] = &disp_cc_mdss_vsync_clk_src.clkr,
  1601. [DISP_CC_PLL0] = &disp_cc_pll0.clkr,
  1602. [DISP_CC_PLL1] = &disp_cc_pll1.clkr,
  1603. [DISP_CC_SLEEP_CLK] = &disp_cc_sleep_clk.clkr,
  1604. [DISP_CC_SLEEP_CLK_SRC] = &disp_cc_sleep_clk_src.clkr,
  1605. [DISP_CC_XO_CLK_SRC] = &disp_cc_xo_clk_src.clkr,
  1606. };
  1607. static const struct qcom_reset_map disp_cc_sm8550_resets[] = {
  1608. [DISP_CC_MDSS_CORE_BCR] = { 0x8000 },
  1609. [DISP_CC_MDSS_CORE_INT2_BCR] = { 0xa000 },
  1610. [DISP_CC_MDSS_RSCC_BCR] = { 0xc000 },
  1611. };
  1612. static struct gdsc *disp_cc_sm8550_gdscs[] = {
  1613. [MDSS_GDSC] = &mdss_gdsc,
  1614. [MDSS_INT2_GDSC] = &mdss_int2_gdsc,
  1615. };
  1616. static const struct regmap_config disp_cc_sm8550_regmap_config = {
  1617. .reg_bits = 32,
  1618. .reg_stride = 4,
  1619. .val_bits = 32,
  1620. .max_register = 0x11008,
  1621. .fast_io = true,
  1622. };
  1623. static const struct qcom_cc_desc disp_cc_sm8550_desc = {
  1624. .config = &disp_cc_sm8550_regmap_config,
  1625. .clks = disp_cc_sm8550_clocks,
  1626. .num_clks = ARRAY_SIZE(disp_cc_sm8550_clocks),
  1627. .resets = disp_cc_sm8550_resets,
  1628. .num_resets = ARRAY_SIZE(disp_cc_sm8550_resets),
  1629. .gdscs = disp_cc_sm8550_gdscs,
  1630. .num_gdscs = ARRAY_SIZE(disp_cc_sm8550_gdscs),
  1631. };
  1632. static const struct of_device_id disp_cc_sm8550_match_table[] = {
  1633. { .compatible = "qcom,sar2130p-dispcc" },
  1634. { .compatible = "qcom,sm8550-dispcc" },
  1635. { .compatible = "qcom,sm8650-dispcc" },
  1636. { }
  1637. };
  1638. MODULE_DEVICE_TABLE(of, disp_cc_sm8550_match_table);
  1639. static int disp_cc_sm8550_probe(struct platform_device *pdev)
  1640. {
  1641. struct regmap *regmap;
  1642. int ret;
  1643. ret = devm_pm_runtime_enable(&pdev->dev);
  1644. if (ret)
  1645. return ret;
  1646. ret = pm_runtime_resume_and_get(&pdev->dev);
  1647. if (ret)
  1648. return ret;
  1649. regmap = qcom_cc_map(pdev, &disp_cc_sm8550_desc);
  1650. if (IS_ERR(regmap)) {
  1651. ret = PTR_ERR(regmap);
  1652. goto err_put_rpm;
  1653. }
  1654. if (of_device_is_compatible(pdev->dev.of_node, "qcom,sm8650-dispcc")) {
  1655. lucid_ole_vco[0].max_freq = 2100000000;
  1656. disp_cc_mdss_mdp_clk_src.freq_tbl = ftbl_disp_cc_mdss_mdp_clk_src_sm8650;
  1657. disp_cc_mdss_dptx1_usb_router_link_intf_clk.clkr.hw.init->parent_hws[0] =
  1658. &disp_cc_mdss_dptx1_link_div_clk_src.clkr.hw;
  1659. } else if (of_device_is_compatible(pdev->dev.of_node, "qcom,sar2130p-dispcc")) {
  1660. disp_cc_pll0_config.l = 0x1f;
  1661. disp_cc_pll0_config.alpha = 0x4000;
  1662. disp_cc_pll0_config.user_ctl_val = 0x1;
  1663. disp_cc_pll1_config.user_ctl_val = 0x1;
  1664. disp_cc_mdss_mdp_clk_src.freq_tbl = ftbl_disp_cc_mdss_mdp_clk_src_sar2130p;
  1665. }
  1666. clk_lucid_ole_pll_configure(&disp_cc_pll0, regmap, &disp_cc_pll0_config);
  1667. clk_lucid_ole_pll_configure(&disp_cc_pll1, regmap, &disp_cc_pll1_config);
  1668. /* Enable clock gating for MDP clocks */
  1669. regmap_update_bits(regmap, DISP_CC_MISC_CMD, 0x10, 0x10);
  1670. /* Keep some clocks always-on */
  1671. qcom_branch_set_clk_en(regmap, 0xe054); /* DISP_CC_XO_CLK */
  1672. ret = qcom_cc_really_probe(&pdev->dev, &disp_cc_sm8550_desc, regmap);
  1673. if (ret)
  1674. goto err_put_rpm;
  1675. pm_runtime_put(&pdev->dev);
  1676. return 0;
  1677. err_put_rpm:
  1678. pm_runtime_put_sync(&pdev->dev);
  1679. return ret;
  1680. }
  1681. static struct platform_driver disp_cc_sm8550_driver = {
  1682. .probe = disp_cc_sm8550_probe,
  1683. .driver = {
  1684. .name = "disp_cc-sm8550",
  1685. .of_match_table = disp_cc_sm8550_match_table,
  1686. },
  1687. };
  1688. module_platform_driver(disp_cc_sm8550_driver);
  1689. MODULE_DESCRIPTION("QTI DISPCC SM8550 / SM8650 Driver");
  1690. MODULE_LICENSE("GPL");