dsi_cfg.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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_clk", "iface_clk", "bus_clk",
  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_clk", "iface_clk", "bus_clk", "core_mmss_clk",
  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_clk", "iface_clk", "bus_clk",
  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. static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = {
  89. {MSM_DSI_VER_MAJOR_V2, MSM_DSI_V2_VER_MINOR_8064, &apq8064_dsi_cfg},
  90. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_0,
  91. &msm8974_apq8084_dsi_cfg},
  92. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1,
  93. &msm8974_apq8084_dsi_cfg},
  94. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1_1,
  95. &msm8974_apq8084_dsi_cfg},
  96. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_2,
  97. &msm8974_apq8084_dsi_cfg},
  98. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3, &msm8994_dsi_cfg},
  99. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3_1, &msm8916_dsi_cfg},
  100. };
  101. const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor)
  102. {
  103. const struct msm_dsi_cfg_handler *cfg_hnd = NULL;
  104. int i;
  105. for (i = ARRAY_SIZE(dsi_cfg_handlers) - 1; i >= 0; i--) {
  106. if ((dsi_cfg_handlers[i].major == major) &&
  107. (dsi_cfg_handlers[i].minor == minor)) {
  108. cfg_hnd = &dsi_cfg_handlers[i];
  109. break;
  110. }
  111. }
  112. return cfg_hnd;
  113. }