mddi_client_dummy.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* drivers/video/msm_fb/mddi_client_dummy.c
  2. *
  3. * Support for "dummy" mddi client devices which require no
  4. * special initialization code.
  5. *
  6. * Copyright (C) 2007 Google Incorporated
  7. *
  8. * This software is licensed under the terms of the GNU General Public
  9. * License version 2, as published by the Free Software Foundation, and
  10. * may be copied, distributed, and modified under those terms.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. */
  17. #include <linux/slab.h>
  18. #include <linux/module.h>
  19. #include <linux/kernel.h>
  20. #include <linux/platform_device.h>
  21. #include <mach/msm_fb.h>
  22. struct panel_info {
  23. struct platform_device pdev;
  24. struct msm_panel_data panel_data;
  25. };
  26. static int mddi_dummy_suspend(struct msm_panel_data *panel_data)
  27. {
  28. return 0;
  29. }
  30. static int mddi_dummy_resume(struct msm_panel_data *panel_data)
  31. {
  32. return 0;
  33. }
  34. static int mddi_dummy_blank(struct msm_panel_data *panel_data)
  35. {
  36. return 0;
  37. }
  38. static int mddi_dummy_unblank(struct msm_panel_data *panel_data)
  39. {
  40. return 0;
  41. }
  42. static int mddi_dummy_probe(struct platform_device *pdev)
  43. {
  44. struct msm_mddi_client_data *client_data = pdev->dev.platform_data;
  45. struct panel_info *panel =
  46. kzalloc(sizeof(struct panel_info), GFP_KERNEL);
  47. int ret;
  48. if (!panel)
  49. return -ENOMEM;
  50. platform_set_drvdata(pdev, panel);
  51. panel->panel_data.suspend = mddi_dummy_suspend;
  52. panel->panel_data.resume = mddi_dummy_resume;
  53. panel->panel_data.blank = mddi_dummy_blank;
  54. panel->panel_data.unblank = mddi_dummy_unblank;
  55. panel->panel_data.caps = MSMFB_CAP_PARTIAL_UPDATES;
  56. panel->pdev.name = "msm_panel";
  57. panel->pdev.id = pdev->id;
  58. platform_device_add_resources(&panel->pdev,
  59. client_data->fb_resource, 1);
  60. panel->panel_data.fb_data = client_data->private_client_data;
  61. panel->pdev.dev.platform_data = &panel->panel_data;
  62. ret = platform_device_register(&panel->pdev);
  63. if (ret) {
  64. kfree(panel);
  65. return ret;
  66. }
  67. return 0;
  68. }
  69. static int mddi_dummy_remove(struct platform_device *pdev)
  70. {
  71. struct panel_info *panel = platform_get_drvdata(pdev);
  72. kfree(panel);
  73. return 0;
  74. }
  75. static struct platform_driver mddi_client_dummy = {
  76. .probe = mddi_dummy_probe,
  77. .remove = mddi_dummy_remove,
  78. .driver = { .name = "mddi_c_dummy" },
  79. };
  80. static int __init mddi_client_dummy_init(void)
  81. {
  82. platform_driver_register(&mddi_client_dummy);
  83. return 0;
  84. }
  85. module_init(mddi_client_dummy_init);