mddi_client_dummy.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/module.h>
  18. #include <linux/kernel.h>
  19. #include <linux/platform_device.h>
  20. #include <mach/msm_fb.h>
  21. struct panel_info {
  22. struct platform_device pdev;
  23. struct msm_panel_data panel_data;
  24. };
  25. static int mddi_dummy_suspend(struct msm_panel_data *panel_data)
  26. {
  27. return 0;
  28. }
  29. static int mddi_dummy_resume(struct msm_panel_data *panel_data)
  30. {
  31. return 0;
  32. }
  33. static int mddi_dummy_blank(struct msm_panel_data *panel_data)
  34. {
  35. return 0;
  36. }
  37. static int mddi_dummy_unblank(struct msm_panel_data *panel_data)
  38. {
  39. return 0;
  40. }
  41. static int mddi_dummy_probe(struct platform_device *pdev)
  42. {
  43. struct msm_mddi_client_data *client_data = pdev->dev.platform_data;
  44. struct panel_info *panel =
  45. kzalloc(sizeof(struct panel_info), GFP_KERNEL);
  46. int ret;
  47. if (!panel)
  48. return -ENOMEM;
  49. platform_set_drvdata(pdev, panel);
  50. panel->panel_data.suspend = mddi_dummy_suspend;
  51. panel->panel_data.resume = mddi_dummy_resume;
  52. panel->panel_data.blank = mddi_dummy_blank;
  53. panel->panel_data.unblank = mddi_dummy_unblank;
  54. panel->panel_data.caps = MSMFB_CAP_PARTIAL_UPDATES;
  55. panel->pdev.name = "msm_panel";
  56. panel->pdev.id = pdev->id;
  57. platform_device_add_resources(&panel->pdev,
  58. client_data->fb_resource, 1);
  59. panel->panel_data.fb_data = client_data->private_client_data;
  60. panel->pdev.dev.platform_data = &panel->panel_data;
  61. ret = platform_device_register(&panel->pdev);
  62. if (ret) {
  63. kfree(panel);
  64. return ret;
  65. }
  66. return 0;
  67. }
  68. static int mddi_dummy_remove(struct platform_device *pdev)
  69. {
  70. struct panel_info *panel = platform_get_drvdata(pdev);
  71. kfree(panel);
  72. return 0;
  73. }
  74. static struct platform_driver mddi_client_dummy = {
  75. .probe = mddi_dummy_probe,
  76. .remove = mddi_dummy_remove,
  77. .driver = { .name = "mddi_c_dummy" },
  78. };
  79. static int __init mddi_client_dummy_init(void)
  80. {
  81. platform_driver_register(&mddi_client_dummy);
  82. return 0;
  83. }
  84. module_init(mddi_client_dummy_init);