mddi_prism.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* Copyright (c) 2008-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. static int prism_lcd_on(struct platform_device *pdev);
  17. static int prism_lcd_off(struct platform_device *pdev);
  18. static int prism_lcd_on(struct platform_device *pdev)
  19. {
  20. /* Set the MDP pixel data attributes for Primary Display */
  21. mddi_host_write_pix_attr_reg(0x00C3);
  22. return 0;
  23. }
  24. static int prism_lcd_off(struct platform_device *pdev)
  25. {
  26. return 0;
  27. }
  28. static int __devinit prism_probe(struct platform_device *pdev)
  29. {
  30. msm_fb_add_device(pdev);
  31. return 0;
  32. }
  33. static struct platform_driver this_driver = {
  34. .probe = prism_probe,
  35. .driver = {
  36. .name = "mddi_prism_wvga",
  37. },
  38. };
  39. static struct msm_fb_panel_data prism_panel_data = {
  40. .on = prism_lcd_on,
  41. .off = prism_lcd_off,
  42. };
  43. static struct platform_device this_device = {
  44. .name = "mddi_prism_wvga",
  45. .id = 0,
  46. .dev = {
  47. .platform_data = &prism_panel_data,
  48. }
  49. };
  50. static int __init prism_init(void)
  51. {
  52. int ret;
  53. struct msm_panel_info *pinfo;
  54. #ifdef CONFIG_FB_MSM_MDDI_AUTO_DETECT
  55. u32 id;
  56. ret = msm_fb_detect_client("mddi_prism_wvga");
  57. if (ret == -ENODEV)
  58. return 0;
  59. if (ret) {
  60. id = mddi_get_client_id();
  61. if (((id >> 16) != 0x4474) || ((id & 0xffff) == 0x8960))
  62. return 0;
  63. }
  64. #endif
  65. ret = platform_driver_register(&this_driver);
  66. if (!ret) {
  67. pinfo = &prism_panel_data.panel_info;
  68. pinfo->xres = 800;
  69. pinfo->yres = 480;
  70. MSM_FB_SINGLE_MODE_PANEL(pinfo);
  71. pinfo->type = MDDI_PANEL;
  72. pinfo->pdest = DISPLAY_1;
  73. pinfo->mddi.vdopkt = MDDI_DEFAULT_PRIM_PIX_ATTR;
  74. pinfo->wait_cycle = 0;
  75. pinfo->mddi.is_type1 = TRUE;
  76. pinfo->bpp = 18;
  77. pinfo->fb_num = 2;
  78. pinfo->clk_rate = 153600000;
  79. pinfo->clk_min = 140000000;
  80. pinfo->clk_max = 160000000;
  81. pinfo->lcd.vsync_enable = TRUE;
  82. pinfo->lcd.refx100 = 6050;
  83. pinfo->lcd.v_back_porch = 23;
  84. pinfo->lcd.v_front_porch = 20;
  85. pinfo->lcd.v_pulse_width = 105;
  86. pinfo->lcd.hw_vsync_mode = TRUE;
  87. pinfo->lcd.vsync_notifier_period = 0;
  88. ret = platform_device_register(&this_device);
  89. if (ret)
  90. platform_driver_unregister(&this_driver);
  91. }
  92. return ret;
  93. }
  94. module_init(prism_init);