dsi_cfg.c 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. /* DSI v2 has not been supported by now */
  15. static const struct msm_dsi_config dsi_v2_cfg = {
  16. .io_offset = 0,
  17. };
  18. static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = {
  19. .io_offset = DSI_6G_REG_SHIFT,
  20. .reg_cfg = {
  21. .num = 4,
  22. .regs = {
  23. {"gdsc", -1, -1, -1, -1},
  24. {"vdd", 3000000, 3000000, 150000, 100},
  25. {"vdda", 1200000, 1200000, 100000, 100},
  26. {"vddio", 1800000, 1800000, 100000, 100},
  27. },
  28. },
  29. };
  30. static const struct msm_dsi_config msm8916_dsi_cfg = {
  31. .io_offset = DSI_6G_REG_SHIFT,
  32. .reg_cfg = {
  33. .num = 4,
  34. .regs = {
  35. {"gdsc", -1, -1, -1, -1},
  36. {"vdd", 2850000, 2850000, 100000, 100},
  37. {"vdda", 1200000, 1200000, 100000, 100},
  38. {"vddio", 1800000, 1800000, 100000, 100},
  39. },
  40. },
  41. };
  42. static const struct msm_dsi_config msm8994_dsi_cfg = {
  43. .io_offset = DSI_6G_REG_SHIFT,
  44. .reg_cfg = {
  45. .num = 7,
  46. .regs = {
  47. {"gdsc", -1, -1, -1, -1},
  48. {"vdda", 1250000, 1250000, 100000, 100},
  49. {"vddio", 1800000, 1800000, 100000, 100},
  50. {"vcca", 1000000, 1000000, 10000, 100},
  51. {"vdd", 1800000, 1800000, 100000, 100},
  52. {"lab_reg", -1, -1, -1, -1},
  53. {"ibb_reg", -1, -1, -1, -1},
  54. },
  55. }
  56. };
  57. static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = {
  58. {MSM_DSI_VER_MAJOR_V2, U32_MAX, &dsi_v2_cfg},
  59. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_0,
  60. &msm8974_apq8084_dsi_cfg},
  61. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1,
  62. &msm8974_apq8084_dsi_cfg},
  63. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1_1,
  64. &msm8974_apq8084_dsi_cfg},
  65. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_2,
  66. &msm8974_apq8084_dsi_cfg},
  67. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3, &msm8994_dsi_cfg},
  68. {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3_1, &msm8916_dsi_cfg},
  69. };
  70. const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor)
  71. {
  72. const struct msm_dsi_cfg_handler *cfg_hnd = NULL;
  73. int i;
  74. for (i = ARRAY_SIZE(dsi_cfg_handlers) - 1; i >= 0; i--) {
  75. if ((dsi_cfg_handlers[i].major == major) &&
  76. (dsi_cfg_handlers[i].minor == minor)) {
  77. cfg_hnd = &dsi_cfg_handlers[i];
  78. break;
  79. }
  80. }
  81. return cfg_hnd;
  82. }