lcdc_panel.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* Copyright (c) 2008-2009, 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. static int lcdc_panel_on(struct platform_device *pdev)
  15. {
  16. return 0;
  17. }
  18. static int lcdc_panel_off(struct platform_device *pdev)
  19. {
  20. return 0;
  21. }
  22. static int __devinit lcdc_panel_probe(struct platform_device *pdev)
  23. {
  24. msm_fb_add_device(pdev);
  25. return 0;
  26. }
  27. static struct platform_driver this_driver = {
  28. .probe = lcdc_panel_probe,
  29. .driver = {
  30. .name = "lcdc_panel",
  31. },
  32. };
  33. static struct msm_fb_panel_data lcdc_panel_data = {
  34. .on = lcdc_panel_on,
  35. .off = lcdc_panel_off,
  36. };
  37. static int lcdc_dev_id;
  38. int lcdc_device_register(struct msm_panel_info *pinfo)
  39. {
  40. struct platform_device *pdev = NULL;
  41. int ret;
  42. pdev = platform_device_alloc("lcdc_panel", ++lcdc_dev_id);
  43. if (!pdev)
  44. return -ENOMEM;
  45. lcdc_panel_data.panel_info = *pinfo;
  46. ret = platform_device_add_data(pdev, &lcdc_panel_data,
  47. sizeof(lcdc_panel_data));
  48. if (ret) {
  49. printk(KERN_ERR
  50. "%s: platform_device_add_data failed!\n", __func__);
  51. goto err_device_put;
  52. }
  53. ret = platform_device_add(pdev);
  54. if (ret) {
  55. printk(KERN_ERR
  56. "%s: platform_device_register failed!\n", __func__);
  57. goto err_device_put;
  58. }
  59. return 0;
  60. err_device_put:
  61. platform_device_put(pdev);
  62. return ret;
  63. }
  64. static int __init lcdc_panel_init(void)
  65. {
  66. return platform_driver_register(&this_driver);
  67. }
  68. module_init(lcdc_panel_init);