dsi_cfg.c 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2015, The Linux Foundation. All rights reserved.
  4. */
  5. #include "dsi_cfg.h"
  6. static const char * const dsi_v2_bus_clk_names[] = {
  7. "core_mmss", "iface", "bus",
  8. };
  9. static const struct regulator_bulk_data apq8064_dsi_regulators[] = {
  10. { .supply = "vdda", .init_load_uA = 100000 }, /* 1.2 V */
  11. { .supply = "avdd", .init_load_uA = 10000 }, /* 3.0 V */
  12. { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */
  13. };
  14. static const struct msm_dsi_config apq8064_dsi_cfg = {
  15. .io_offset = 0,
  16. .regulator_data = apq8064_dsi_regulators,
  17. .num_regulators = ARRAY_SIZE(apq8064_dsi_regulators),
  18. .bus_clk_names = dsi_v2_bus_clk_names,
  19. .num_bus_clks = ARRAY_SIZE(dsi_v2_bus_clk_names),
  20. .io_start = {
  21. { 0x4700000, 0x5800000 },
  22. },
  23. };
  24. static const char * const dsi_6g_bus_clk_names[] = {
  25. "mdp_core", "iface", "bus", "core_mmss",
  26. };
  27. static const struct regulator_bulk_data msm8974_apq8084_regulators[] = {
  28. { .supply = "vdd", .init_load_uA = 150000 }, /* 3.0 V */
  29. { .supply = "vdda", .init_load_uA = 100000 }, /* 1.2 V */
  30. { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */
  31. };
  32. static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = {
  33. .io_offset = DSI_6G_REG_SHIFT,
  34. .regulator_data = msm8974_apq8084_regulators,
  35. .num_regulators = ARRAY_SIZE(msm8974_apq8084_regulators),
  36. .bus_clk_names = dsi_6g_bus_clk_names,
  37. .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
  38. .io_start = {
  39. { 0xfd922800, 0xfd922b00 },
  40. },
  41. };
  42. static const char * const dsi_v1_3_1_clk_names[] = {
  43. "mdp_core", "iface", "bus",
  44. };
  45. static const struct regulator_bulk_data dsi_v1_3_1_regulators[] = {
  46. { .supply = "vdda", .init_load_uA = 100000 }, /* 1.2 V */
  47. { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */
  48. };
  49. static const struct msm_dsi_config msm8916_dsi_cfg = {
  50. .io_offset = DSI_6G_REG_SHIFT,
  51. .regulator_data = dsi_v1_3_1_regulators,
  52. .num_regulators = ARRAY_SIZE(dsi_v1_3_1_regulators),
  53. .bus_clk_names = dsi_v1_3_1_clk_names,
  54. .num_bus_clks = ARRAY_SIZE(dsi_v1_3_1_clk_names),
  55. .io_start = {
  56. { 0x1a98000 },
  57. },
  58. };
  59. static const struct msm_dsi_config msm8976_dsi_cfg = {
  60. .io_offset = DSI_6G_REG_SHIFT,
  61. .regulator_data = dsi_v1_3_1_regulators,
  62. .num_regulators = ARRAY_SIZE(dsi_v1_3_1_regulators),
  63. .bus_clk_names = dsi_v1_3_1_clk_names,
  64. .num_bus_clks = ARRAY_SIZE(dsi_v1_3_1_clk_names),
  65. .io_start = {
  66. { 0x1a94000, 0x1a96000 },
  67. },
  68. };
  69. static const struct regulator_bulk_data msm8994_dsi_regulators[] = {
  70. { .supply = "vdda", .init_load_uA = 100000 }, /* 1.25 V */
  71. { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */
  72. { .supply = "vcca", .init_load_uA = 10000 }, /* 1.0 V */
  73. { .supply = "vdd", .init_load_uA = 100000 }, /* 1.8 V */
  74. { .supply = "lab_reg", .init_load_uA = -1 },
  75. { .supply = "ibb_reg", .init_load_uA = -1 },
  76. };
  77. static const struct msm_dsi_config msm8994_dsi_cfg = {
  78. .io_offset = DSI_6G_REG_SHIFT,
  79. .regulator_data = msm8994_dsi_regulators,
  80. .num_regulators = ARRAY_SIZE(msm8994_dsi_regulators),
  81. .bus_clk_names = dsi_6g_bus_clk_names,
  82. .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
  83. .io_start = {
  84. { 0xfd998000, 0xfd9a0000 },
  85. },
  86. };
  87. static const struct regulator_bulk_data msm8996_dsi_regulators[] = {
  88. { .supply = "vdda", .init_load_uA = 18160 }, /* 1.25 V */
  89. { .supply = "vcca", .init_load_uA = 17000 }, /* 0.925 V */
  90. { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */
  91. };
  92. static const struct msm_dsi_config msm8996_dsi_cfg = {
  93. .io_offset = DSI_6G_REG_SHIFT,
  94. .regulator_data = msm8996_dsi_regulators,
  95. .num_regulators = ARRAY_SIZE(msm8996_dsi_regulators),
  96. .bus_clk_names = dsi_6g_bus_clk_names,
  97. .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
  98. .io_start = {
  99. { 0x994000, 0x996000 },
  100. },
  101. };
  102. static const char * const dsi_msm8998_bus_clk_names[] = {
  103. "iface", "bus", "core",
  104. };
  105. static const struct regulator_bulk_data msm8998_dsi_regulators[] = {
  106. { .supply = "vdd", .init_load_uA = 367000 }, /* 0.9 V */
  107. { .supply = "vdda", .init_load_uA = 62800 }, /* 1.2 V */
  108. };
  109. static const struct msm_dsi_config msm8998_dsi_cfg = {
  110. .io_offset = DSI_6G_REG_SHIFT,
  111. .regulator_data = msm8998_dsi_regulators,
  112. .num_regulators = ARRAY_SIZE(msm8998_dsi_regulators),
  113. .bus_clk_names = dsi_msm8998_bus_clk_names,
  114. .num_bus_clks = ARRAY_SIZE(dsi_msm8998_bus_clk_names),
  115. .io_start = {
  116. { 0xc994000, 0xc996000 },
  117. },
  118. };
  119. static const char * const dsi_sdm660_bus_clk_names[] = {
  120. "iface", "bus", "core", "core_mmss",
  121. };
  122. static const struct regulator_bulk_data sdm660_dsi_regulators[] = {
  123. { .supply = "vdda", .init_load_uA = 12560 }, /* 1.2 V */
  124. };
  125. static const struct msm_dsi_config sdm660_dsi_cfg = {
  126. .io_offset = DSI_6G_REG_SHIFT,
  127. .regulator_data = sdm660_dsi_regulators,
  128. .num_regulators = ARRAY_SIZE(sdm660_dsi_regulators),
  129. .bus_clk_names = dsi_sdm660_bus_clk_names,
  130. .num_bus_clks = ARRAY_SIZE(dsi_sdm660_bus_clk_names),
  131. .io_start = {
  132. { 0xc994000, 0xc996000 },
  133. },
  134. };
  135. static const char * const dsi_v2_4_clk_names[] = {
  136. "iface", "bus",
  137. };
  138. static const struct regulator_bulk_data dsi_v2_4_regulators[] = {
  139. { .supply = "vdda", .init_load_uA = 21800 }, /* 1.2 V */
  140. { .supply = "refgen" },
  141. };
  142. static const struct msm_dsi_config sdm845_dsi_cfg = {
  143. .io_offset = DSI_6G_REG_SHIFT,
  144. .regulator_data = dsi_v2_4_regulators,
  145. .num_regulators = ARRAY_SIZE(dsi_v2_4_regulators),
  146. .bus_clk_names = dsi_v2_4_clk_names,
  147. .num_bus_clks = ARRAY_SIZE(dsi_v2_4_clk_names),
  148. .io_start = {
  149. { 0xae94000, 0xae96000 }, /* SDM845 / SDM670 */
  150. { 0x5e94000 }, /* QCM2290 / SM6115 / SM6125 / SM6375 */
  151. },
  152. };
  153. static const struct regulator_bulk_data sm8550_dsi_regulators[] = {
  154. { .supply = "vdda", .init_load_uA = 16800 }, /* 1.2 V */
  155. };
  156. static const struct msm_dsi_config sm8550_dsi_cfg = {
  157. .io_offset = DSI_6G_REG_SHIFT,
  158. .regulator_data = sm8550_dsi_regulators,
  159. .num_regulators = ARRAY_SIZE(sm8550_dsi_regulators),
  160. .bus_clk_names = dsi_v2_4_clk_names,
  161. .num_bus_clks = ARRAY_SIZE(dsi_v2_4_clk_names),
  162. .io_start = {
  163. { 0xae94000, 0xae96000 },
  164. },
  165. };
  166. static const struct regulator_bulk_data sm8650_dsi_regulators[] = {
  167. { .supply = "vdda", .init_load_uA = 16600 }, /* 1.2 V */
  168. };
  169. static const struct msm_dsi_config sm8650_dsi_cfg = {
  170. .io_offset = DSI_6G_REG_SHIFT,
  171. .regulator_data = sm8650_dsi_regulators,
  172. .num_regulators = ARRAY_SIZE(sm8650_dsi_regulators),
  173. .bus_clk_names = dsi_v2_4_clk_names,
  174. .num_bus_clks = ARRAY_SIZE(dsi_v2_4_clk_names),
  175. .io_start = {
  176. { 0xae94000, 0xae96000 },
  177. },
  178. };
  179. static const struct regulator_bulk_data sc7280_dsi_regulators[] = {
  180. { .supply = "vdda", .init_load_uA = 8350 }, /* 1.2 V */
  181. { .supply = "refgen" },
  182. };
  183. static const struct msm_dsi_config sc7280_dsi_cfg = {
  184. .io_offset = DSI_6G_REG_SHIFT,
  185. .regulator_data = sc7280_dsi_regulators,
  186. .num_regulators = ARRAY_SIZE(sc7280_dsi_regulators),
  187. .bus_clk_names = dsi_v2_4_clk_names,
  188. .num_bus_clks = ARRAY_SIZE(dsi_v2_4_clk_names),
  189. .io_start = {
  190. { 0xae94000, 0xae96000 },
  191. },
  192. };
  193. static const struct msm_dsi_host_cfg_ops msm_dsi_v2_host_ops = {
  194. .link_clk_set_rate = dsi_link_clk_set_rate_v2,
  195. .link_clk_enable = dsi_link_clk_enable_v2,
  196. .link_clk_disable = dsi_link_clk_disable_v2,
  197. .clk_init_ver = dsi_clk_init_v2,
  198. .tx_buf_alloc = dsi_tx_buf_alloc_v2,
  199. .tx_buf_get = dsi_tx_buf_get_v2,
  200. .tx_buf_put = NULL,
  201. .dma_base_get = dsi_dma_base_get_v2,
  202. .calc_clk_rate = dsi_calc_clk_rate_v2,
  203. };
  204. static const struct msm_dsi_host_cfg_ops msm_dsi_6g_host_ops = {
  205. .link_clk_set_rate = dsi_link_clk_set_rate_6g,
  206. .link_clk_enable = dsi_link_clk_enable_6g,
  207. .link_clk_disable = dsi_link_clk_disable_6g,
  208. .clk_init_ver = NULL,
  209. .tx_buf_alloc = dsi_tx_buf_alloc_6g,
  210. .tx_buf_get = dsi_tx_buf_get_6g,
  211. .tx_buf_put = dsi_tx_buf_put_6g,
  212. .dma_base_get = dsi_dma_base_get_6g,
  213. .calc_clk_rate = dsi_calc_clk_rate_6g,
  214. };
  215. static const struct msm_dsi_host_cfg_ops msm_dsi_6g_v2_host_ops = {
  216. .link_clk_set_rate = dsi_link_clk_set_rate_6g,
  217. .link_clk_enable = dsi_link_clk_enable_6g,
  218. .link_clk_disable = dsi_link_clk_disable_6g,
  219. .clk_init_ver = dsi_clk_init_6g_v2,
  220. .tx_buf_alloc = dsi_tx_buf_alloc_6g,
  221. .tx_buf_get = dsi_tx_buf_get_6g,
  222. .tx_buf_put = dsi_tx_buf_put_6g,
  223. .dma_base_get = dsi_dma_base_get_6g,
  224. .calc_clk_rate = dsi_calc_clk_rate_6g,
  225. };
  226. static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = {
  227. {MSM_DSI_VER_MAJOR_V2, MSM_DSI_V2_VER_MINOR_8064,
  228. &apq8064_dsi_cfg, &msm_dsi_v2_host_ops},
  229. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_0,
  230. &msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
  231. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_0_2,
  232. &msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
  233. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1,
  234. &msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
  235. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1_1,
  236. &msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
  237. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_2,
  238. &msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
  239. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3,
  240. &msm8994_dsi_cfg, &msm_dsi_6g_host_ops},
  241. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3_1,
  242. &msm8916_dsi_cfg, &msm_dsi_6g_host_ops},
  243. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_1,
  244. &msm8996_dsi_cfg, &msm_dsi_6g_host_ops},
  245. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_2,
  246. &msm8976_dsi_cfg, &msm_dsi_6g_host_ops},
  247. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_1_0,
  248. &sdm660_dsi_cfg, &msm_dsi_6g_v2_host_ops},
  249. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_0,
  250. &msm8998_dsi_cfg, &msm_dsi_6g_v2_host_ops},
  251. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_1,
  252. &sdm845_dsi_cfg, &msm_dsi_6g_v2_host_ops},
  253. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_3_0,
  254. &sdm845_dsi_cfg, &msm_dsi_6g_v2_host_ops},
  255. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_4_0,
  256. &sdm845_dsi_cfg, &msm_dsi_6g_v2_host_ops},
  257. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_4_1,
  258. &sdm845_dsi_cfg, &msm_dsi_6g_v2_host_ops},
  259. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_5_0,
  260. &sc7280_dsi_cfg, &msm_dsi_6g_v2_host_ops},
  261. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_6_0,
  262. &sdm845_dsi_cfg, &msm_dsi_6g_v2_host_ops},
  263. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_7_0,
  264. &sm8550_dsi_cfg, &msm_dsi_6g_v2_host_ops},
  265. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_8_0,
  266. &sm8650_dsi_cfg, &msm_dsi_6g_v2_host_ops},
  267. };
  268. const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor)
  269. {
  270. const struct msm_dsi_cfg_handler *cfg_hnd = NULL;
  271. int i;
  272. for (i = ARRAY_SIZE(dsi_cfg_handlers) - 1; i >= 0; i--) {
  273. if ((dsi_cfg_handlers[i].major == major) &&
  274. (dsi_cfg_handlers[i].minor == minor)) {
  275. cfg_hnd = &dsi_cfg_handlers[i];
  276. break;
  277. }
  278. }
  279. return cfg_hnd;
  280. }