mddi_orise.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /* Copyright (c) 2010, 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. */
  13. #include "msm_fb.h"
  14. #include "mddihost.h"
  15. #include "mddihosti.h"
  16. #define MDDI_ORISE_1_2 1
  17. #define write_client_reg(__X, __Y, __Z) {\
  18. mddi_queue_register_write(__X, __Y, TRUE, 0);\
  19. }
  20. static int mddi_orise_lcd_on(struct platform_device *pdev);
  21. static int mddi_orise_lcd_off(struct platform_device *pdev);
  22. static int __init mddi_orise_probe(struct platform_device *pdev);
  23. static int __init mddi_orise_init(void);
  24. /* function used to turn on the display */
  25. static void mddi_orise_prim_lcd_init(void)
  26. {
  27. write_client_reg(0x00110000, 0, TRUE);
  28. mddi_wait(150);
  29. write_client_reg(0x00290000, 0, TRUE);
  30. }
  31. static struct platform_driver this_driver = {
  32. .driver = {
  33. .name = "mddi_orise",
  34. },
  35. };
  36. static struct msm_fb_panel_data mddi_orise_panel_data = {
  37. .on = mddi_orise_lcd_on,
  38. .off = mddi_orise_lcd_off,
  39. };
  40. static struct platform_device this_device = {
  41. .name = "mddi_orise",
  42. .id = MDDI_ORISE_1_2,
  43. .dev = {
  44. .platform_data = &mddi_orise_panel_data,
  45. }
  46. };
  47. static int mddi_orise_lcd_on(struct platform_device *pdev)
  48. {
  49. struct msm_fb_data_type *mfd;
  50. mfd = platform_get_drvdata(pdev);
  51. if (!mfd)
  52. return -ENODEV;
  53. if (mfd->key != MFD_KEY)
  54. return -EINVAL;
  55. mddi_orise_prim_lcd_init();
  56. return 0;
  57. }
  58. static int mddi_orise_lcd_off(struct platform_device *pdev)
  59. {
  60. return 0;
  61. }
  62. static int __init mddi_orise_probe(struct platform_device *pdev)
  63. {
  64. msm_fb_add_device(pdev);
  65. return 0;
  66. }
  67. static int __init mddi_orise_init(void)
  68. {
  69. int ret;
  70. struct msm_panel_info *pinfo;
  71. #ifdef CONFIG_FB_MSM_MDDI_AUTO_DETECT
  72. u32 id;
  73. ret = msm_fb_detect_client("mddi_orise");
  74. if (ret == -ENODEV)
  75. return 0;
  76. if (ret) {
  77. id = mddi_get_client_id();
  78. if (((id >> 16) != 0xbe8d) || ((id & 0xffff) != 0x8031))
  79. return 0;
  80. }
  81. #endif
  82. ret = platform_driver_probe(&this_driver, mddi_orise_probe);
  83. if (!ret) {
  84. pinfo = &mddi_orise_panel_data.panel_info;
  85. pinfo->xres = 480;
  86. pinfo->yres = 800;
  87. MSM_FB_SINGLE_MODE_PANEL(pinfo);
  88. pinfo->type = MDDI_PANEL;
  89. pinfo->pdest = DISPLAY_1;
  90. pinfo->mddi.is_type1 = TRUE;
  91. pinfo->mddi.vdopkt = MDDI_DEFAULT_PRIM_PIX_ATTR;
  92. pinfo->wait_cycle = 0;
  93. pinfo->bpp = 18;
  94. pinfo->fb_num = 2;
  95. pinfo->clk_rate = 192000000;
  96. pinfo->clk_min = 192000000;
  97. pinfo->clk_max = 192000000;
  98. pinfo->lcd.rev = 2;
  99. pinfo->lcd.vsync_enable = FALSE;
  100. pinfo->lcd.refx100 = 6050;
  101. pinfo->lcd.v_back_porch = 2;
  102. pinfo->lcd.v_front_porch = 2;
  103. pinfo->lcd.v_pulse_width = 105;
  104. pinfo->lcd.hw_vsync_mode = TRUE;
  105. pinfo->lcd.vsync_notifier_period = 0;
  106. ret = platform_device_register(&this_device);
  107. if (ret)
  108. platform_driver_unregister(&this_driver);
  109. }
  110. return ret;
  111. }
  112. module_init(mddi_orise_init);