dsi_cfg.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. * Copyright (c) 2015, The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #include "dsi_cfg.h"
  14. static const char * const dsi_v2_bus_clk_names[] = {
  15. "core_mmss", "iface", "bus",
  16. };
  17. static const struct msm_dsi_config apq8064_dsi_cfg = {
  18. .io_offset = 0,
  19. .reg_cfg = {
  20. .num = 3,
  21. .regs = {
  22. {"vdda", 100000, 100}, /* 1.2 V */
  23. {"avdd", 10000, 100}, /* 3.0 V */
  24. {"vddio", 100000, 100}, /* 1.8 V */
  25. },
  26. },
  27. .bus_clk_names = dsi_v2_bus_clk_names,
  28. .num_bus_clks = ARRAY_SIZE(dsi_v2_bus_clk_names),
  29. .io_start = { 0x4700000, 0x5800000 },
  30. .num_dsi = 2,
  31. };
  32. static const char * const dsi_6g_bus_clk_names[] = {
  33. "mdp_core", "iface", "bus", "core_mmss",
  34. };
  35. static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = {
  36. .io_offset = DSI_6G_REG_SHIFT,
  37. .reg_cfg = {
  38. .num = 4,
  39. .regs = {
  40. {"gdsc", -1, -1},
  41. {"vdd", 150000, 100}, /* 3.0 V */
  42. {"vdda", 100000, 100}, /* 1.2 V */
  43. {"vddio", 100000, 100}, /* 1.8 V */
  44. },
  45. },
  46. .bus_clk_names = dsi_6g_bus_clk_names,
  47. .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
  48. .io_start = { 0xfd922800, 0xfd922b00 },
  49. .num_dsi = 2,
  50. };
  51. static const char * const dsi_8916_bus_clk_names[] = {
  52. "mdp_core", "iface", "bus",
  53. };
  54. static const struct msm_dsi_config msm8916_dsi_cfg = {
  55. .io_offset = DSI_6G_REG_SHIFT,
  56. .reg_cfg = {
  57. .num = 3,
  58. .regs = {
  59. {"gdsc", -1, -1},
  60. {"vdda", 100000, 100}, /* 1.2 V */
  61. {"vddio", 100000, 100}, /* 1.8 V */
  62. },
  63. },
  64. .bus_clk_names = dsi_8916_bus_clk_names,
  65. .num_bus_clks = ARRAY_SIZE(dsi_8916_bus_clk_names),
  66. .io_start = { 0x1a98000 },
  67. .num_dsi = 1,
  68. };
  69. static const struct msm_dsi_config msm8994_dsi_cfg = {
  70. .io_offset = DSI_6G_REG_SHIFT,
  71. .reg_cfg = {
  72. .num = 7,
  73. .regs = {
  74. {"gdsc", -1, -1},
  75. {"vdda", 100000, 100}, /* 1.25 V */
  76. {"vddio", 100000, 100}, /* 1.8 V */
  77. {"vcca", 10000, 100}, /* 1.0 V */
  78. {"vdd", 100000, 100}, /* 1.8 V */
  79. {"lab_reg", -1, -1},
  80. {"ibb_reg", -1, -1},
  81. },
  82. },
  83. .bus_clk_names = dsi_6g_bus_clk_names,
  84. .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
  85. .io_start = { 0xfd998000, 0xfd9a0000 },
  86. .num_dsi = 2,
  87. };
  88. /*
  89. * TODO: core_mmss_clk fails to enable for some reason, but things work fine
  90. * without it too. Figure out why it doesn't enable and uncomment below
  91. */
  92. static const char * const dsi_8996_bus_clk_names[] = {
  93. "mdp_core", "iface", "bus", /* "core_mmss", */
  94. };
  95. static const struct msm_dsi_config msm8996_dsi_cfg = {
  96. .io_offset = DSI_6G_REG_SHIFT,
  97. .reg_cfg = {
  98. .num = 2,
  99. .regs = {
  100. {"vdda", 18160, 1 }, /* 1.25 V */
  101. {"vcca", 17000, 32 }, /* 0.925 V */
  102. {"vddio", 100000, 100 },/* 1.8 V */
  103. },
  104. },
  105. .bus_clk_names = dsi_8996_bus_clk_names,
  106. .num_bus_clks = ARRAY_SIZE(dsi_8996_bus_clk_names),
  107. .io_start = { 0x994000, 0x996000 },
  108. .num_dsi = 2,
  109. };
  110. static const char * const dsi_sdm845_bus_clk_names[] = {
  111. "iface", "bus",
  112. };
  113. static const struct msm_dsi_config sdm845_dsi_cfg = {
  114. .io_offset = DSI_6G_REG_SHIFT,
  115. .reg_cfg = {
  116. .num = 1,
  117. .regs = {
  118. {"vdda", 21800, 4 }, /* 1.2 V */
  119. },
  120. },
  121. .bus_clk_names = dsi_sdm845_bus_clk_names,
  122. .num_bus_clks = ARRAY_SIZE(dsi_sdm845_bus_clk_names),
  123. .io_start = { 0xae94000, 0xae96000 },
  124. .num_dsi = 2,
  125. };
  126. static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = {
  127. {MSM_DSI_VER_MAJOR_V2, MSM_DSI_V2_VER_MINOR_8064, &apq8064_dsi_cfg},
  128. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_0,
  129. &msm8974_apq8084_dsi_cfg},
  130. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1,
  131. &msm8974_apq8084_dsi_cfg},
  132. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1_1,
  133. &msm8974_apq8084_dsi_cfg},
  134. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_2,
  135. &msm8974_apq8084_dsi_cfg},
  136. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3, &msm8994_dsi_cfg},
  137. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3_1, &msm8916_dsi_cfg},
  138. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_1, &msm8996_dsi_cfg},
  139. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_1, &sdm845_dsi_cfg},
  140. };
  141. const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor)
  142. {
  143. const struct msm_dsi_cfg_handler *cfg_hnd = NULL;
  144. int i;
  145. for (i = ARRAY_SIZE(dsi_cfg_handlers) - 1; i >= 0; i--) {
  146. if ((dsi_cfg_handlers[i].major == major) &&
  147. (dsi_cfg_handlers[i].minor == minor)) {
  148. cfg_hnd = &dsi_cfg_handlers[i];
  149. break;
  150. }
  151. }
  152. return cfg_hnd;
  153. }