dsi_cfg.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. };
  30. static const char * const dsi_6g_bus_clk_names[] = {
  31. "mdp_core_clk", "iface_clk", "bus_clk", "core_mmss_clk",
  32. };
  33. static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = {
  34. .io_offset = DSI_6G_REG_SHIFT,
  35. .reg_cfg = {
  36. .num = 4,
  37. .regs = {
  38. {"gdsc", -1, -1},
  39. {"vdd", 150000, 100}, /* 3.0 V */
  40. {"vdda", 100000, 100}, /* 1.2 V */
  41. {"vddio", 100000, 100}, /* 1.8 V */
  42. },
  43. },
  44. .bus_clk_names = dsi_6g_bus_clk_names,
  45. .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
  46. };
  47. static const char * const dsi_8916_bus_clk_names[] = {
  48. "mdp_core_clk", "iface_clk", "bus_clk",
  49. };
  50. static const struct msm_dsi_config msm8916_dsi_cfg = {
  51. .io_offset = DSI_6G_REG_SHIFT,
  52. .reg_cfg = {
  53. .num = 3,
  54. .regs = {
  55. {"gdsc", -1, -1},
  56. {"vdda", 100000, 100}, /* 1.2 V */
  57. {"vddio", 100000, 100}, /* 1.8 V */
  58. },
  59. },
  60. .bus_clk_names = dsi_8916_bus_clk_names,
  61. .num_bus_clks = ARRAY_SIZE(dsi_8916_bus_clk_names),
  62. };
  63. static const struct msm_dsi_config msm8994_dsi_cfg = {
  64. .io_offset = DSI_6G_REG_SHIFT,
  65. .reg_cfg = {
  66. .num = 7,
  67. .regs = {
  68. {"gdsc", -1, -1},
  69. {"vdda", 100000, 100}, /* 1.25 V */
  70. {"vddio", 100000, 100}, /* 1.8 V */
  71. {"vcca", 10000, 100}, /* 1.0 V */
  72. {"vdd", 100000, 100}, /* 1.8 V */
  73. {"lab_reg", -1, -1},
  74. {"ibb_reg", -1, -1},
  75. },
  76. },
  77. .bus_clk_names = dsi_6g_bus_clk_names,
  78. .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
  79. };
  80. static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = {
  81. {MSM_DSI_VER_MAJOR_V2, MSM_DSI_V2_VER_MINOR_8064, &apq8064_dsi_cfg},
  82. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_0,
  83. &msm8974_apq8084_dsi_cfg},
  84. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1,
  85. &msm8974_apq8084_dsi_cfg},
  86. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1_1,
  87. &msm8974_apq8084_dsi_cfg},
  88. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_2,
  89. &msm8974_apq8084_dsi_cfg},
  90. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3, &msm8994_dsi_cfg},
  91. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3_1, &msm8916_dsi_cfg},
  92. };
  93. const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor)
  94. {
  95. const struct msm_dsi_cfg_handler *cfg_hnd = NULL;
  96. int i;
  97. for (i = ARRAY_SIZE(dsi_cfg_handlers) - 1; i >= 0; i--) {
  98. if ((dsi_cfg_handlers[i].major == major) &&
  99. (dsi_cfg_handlers[i].minor == minor)) {
  100. cfg_hnd = &dsi_cfg_handlers[i];
  101. break;
  102. }
  103. }
  104. return cfg_hnd;
  105. }