mipi_renesas_cmd_fwvga_pt.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #include "msm_fb.h"
  13. #include "mipi_dsi.h"
  14. #include "mipi_renesas.h"
  15. static struct msm_panel_info pinfo;
  16. static struct mipi_dsi_phy_ctrl dsi_cmd_mode_phy_db = {
  17. #ifdef CONFIG_FB_MSM_MDP303
  18. /* DSI Bit Clock at 500 MHz, 2 lane, RGB888 */
  19. /* regulator */
  20. {0x03, 0x01, 0x01, 0x00},
  21. /* timing */
  22. {0xb9, 0x8e, 0x1f, 0x00, 0x98, 0x9c, 0x22, 0x90,
  23. 0x18, 0x03, 0x04},
  24. /* phy ctrl */
  25. {0x7f, 0x00, 0x00, 0x00},
  26. /* strength */
  27. {0xbb, 0x02, 0x06, 0x00},
  28. /* pll control */
  29. {0x01, 0xec, 0x31, 0xd2, 0x00, 0x40, 0x37, 0x62,
  30. 0x01, 0x0f, 0x07,
  31. 0x05, 0x14, 0x03, 0x0, 0x0, 0x0, 0x20, 0x0, 0x02, 0x0},
  32. #else
  33. /* DSI_BIT_CLK at 400MHz, 1 lane, RGB888 */
  34. {0x03, 0x01, 0x01, 0x00}, /* regulator */
  35. /* timing */
  36. {0x22, 0x0c, 0x7, 0x00, 0x10, 0x20, 0x10,
  37. 0xd, 0x8, 0x2, 0x3},
  38. /* phy ctrl */
  39. {0x7f, 0x00, 0x00, 0x00},
  40. /* strength */
  41. {0xee, 0x00, 0x6, 0x00},
  42. /* pll control */
  43. {0x40, 0x2f, 0xb1, 0xda, 0x00, 0x50, 0x48, 0x63,
  44. #if defined(RENESAS_FWVGA_TWO_LANE)
  45. 0x33, 0x1f, 0x07,
  46. #else /* default set to 1 lane */
  47. 0x30, 0x07, 0x07,
  48. #endif
  49. 0x05, 0x14, 0x03, 0x0, 0x0, 0x54, 0x06, 0x10, 0x04, 0x0},
  50. #endif
  51. };
  52. static int __init mipi_cmd_renesas_fwvga_pt_init(void)
  53. {
  54. int ret;
  55. if (msm_fb_detect_client("mipi_cmd_renesas_fwvga"))
  56. return 0;
  57. pinfo.xres = 480;
  58. pinfo.yres = 864;
  59. pinfo.type = MIPI_CMD_PANEL;
  60. pinfo.pdest = DISPLAY_1;
  61. pinfo.wait_cycle = 0;
  62. pinfo.bpp = 24;
  63. #ifdef CONFIG_FB_MSM_MDP303
  64. pinfo.lcdc.h_back_porch = 100;
  65. pinfo.lcdc.h_front_porch = 100;
  66. pinfo.lcdc.h_pulse_width = 8;
  67. pinfo.lcdc.v_back_porch = 20;
  68. pinfo.lcdc.v_front_porch = 20;
  69. pinfo.lcdc.v_pulse_width = 1;
  70. #else
  71. pinfo.lcdc.h_front_porch = 50;
  72. #if defined(RENESAS_FWVGA_TWO_LANE)
  73. pinfo.lcdc.h_back_porch = 400;
  74. pinfo.lcdc.h_pulse_width = 5;
  75. pinfo.lcdc.v_back_porch = 75;
  76. pinfo.lcdc.v_front_porch = 5;
  77. pinfo.lcdc.v_pulse_width = 1;
  78. #else
  79. pinfo.lcdc.h_back_porch = 50;
  80. pinfo.lcdc.h_pulse_width = 20;
  81. pinfo.lcdc.v_back_porch = 10;
  82. pinfo.lcdc.v_front_porch = 10;
  83. pinfo.lcdc.v_pulse_width = 5;
  84. #endif
  85. #endif /* CONFIG_FB_MSM_MDP303 */
  86. pinfo.lcdc.border_clr = 0; /* blk */
  87. pinfo.lcdc.underflow_clr = 0xff; /* blue */
  88. pinfo.lcdc.hsync_skew = 0;
  89. pinfo.bl_max = 255;
  90. pinfo.bl_min = 1;
  91. pinfo.fb_num = 2;
  92. #ifdef CONFIG_FB_MSM_MDP303
  93. pinfo.clk_rate = 499000000;
  94. #else
  95. pinfo.clk_rate = 152000000;
  96. #endif
  97. pinfo.lcd.refx100 = 6000; /* adjust refx100 to prevent tearing */
  98. pinfo.mipi.mode = DSI_CMD_MODE;
  99. pinfo.mipi.dst_format = DSI_CMD_DST_FORMAT_RGB888;
  100. pinfo.mipi.vc = 0;
  101. pinfo.mipi.rgb_swap = DSI_RGB_SWAP_RGB;
  102. pinfo.mipi.data_lane0 = TRUE;
  103. #ifdef CONFIG_FB_MSM_MDP303
  104. pinfo.lcd.vsync_enable = TRUE;
  105. pinfo.lcd.hw_vsync_mode = TRUE;
  106. pinfo.mipi.data_lane1 = TRUE;
  107. pinfo.mipi.t_clk_post = 0x20;
  108. pinfo.mipi.t_clk_pre = 0x2F;
  109. pinfo.mipi.stream = 0; /* dma_p */
  110. pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_SW;
  111. pinfo.mipi.dma_trigger = DSI_CMD_TRIGGER_SW;
  112. pinfo.mipi.te_sel = 1; /* TE from vsync gpio */
  113. pinfo.mipi.interleave_max = 1;
  114. pinfo.mipi.insert_dcs_cmd = TRUE;
  115. pinfo.mipi.wr_mem_continue = 0x3c;
  116. pinfo.mipi.wr_mem_start = 0x2c;
  117. pinfo.mipi.dsi_phy_db = &dsi_cmd_mode_phy_db;
  118. pinfo.mipi.tx_eot_append = 0x01;
  119. pinfo.mipi.rx_eot_ignore = 0;
  120. pinfo.mipi.dlane_swap = 0x01;
  121. #else
  122. #if defined(RENESAS_FWVGA_TWO_LANE)
  123. pinfo.mipi.data_lane1 = TRUE;
  124. #else
  125. pinfo.mipi.data_lane1 = FALSE;
  126. #endif
  127. pinfo.mipi.t_clk_post = 0x18;
  128. pinfo.mipi.t_clk_pre = 0x14;
  129. pinfo.mipi.stream = 0; /* dma_p */
  130. pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_SW;
  131. pinfo.mipi.dma_trigger = DSI_CMD_TRIGGER_SW;
  132. pinfo.mipi.te_sel = 1; /* TE from vsycn gpio */
  133. pinfo.mipi.interleave_max = 1;
  134. pinfo.mipi.insert_dcs_cmd = TRUE;
  135. pinfo.mipi.wr_mem_continue = 0x3c;
  136. pinfo.mipi.wr_mem_start = 0x2c;
  137. pinfo.mipi.dsi_phy_db = &dsi_cmd_mode_phy_db;
  138. #endif /* CONFIG_FB_MSM_MDP303 */
  139. ret = mipi_renesas_device_register(&pinfo, MIPI_DSI_PRIM,
  140. MIPI_DSI_PANEL_FWVGA_PT);
  141. if (ret)
  142. pr_err("%s: failed to register device!\n", __func__);
  143. return ret;
  144. }
  145. module_init(mipi_cmd_renesas_fwvga_pt_init);