mtk_mira.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #define LOG_TAG "mtk_mira"
  2. #include "disp_drv_log.h"
  3. #include <linux/kernel.h>
  4. #include <linux/mm.h>
  5. #include <linux/proc_fs.h>
  6. #include <linux/module.h>
  7. #include "mtk_mira.h"
  8. #include "mtk_disp_mgr.h"
  9. #define DISP_DEVNAME "mtk_mira"
  10. static struct proc_dir_entry *proc_entry;
  11. static long disp_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  12. {
  13. return mtk_disp_mgr_ioctl(file, cmd, arg);
  14. }
  15. static int disp_open(struct inode *inode, struct file *file)
  16. {
  17. return 0;
  18. }
  19. static ssize_t disp_read(struct file *file, char __user *data, size_t len, loff_t *ppos)
  20. {
  21. return 0;
  22. }
  23. static int disp_release(struct inode *inode, struct file *file)
  24. {
  25. return 0;
  26. }
  27. static int disp_flush(struct file *file, fl_owner_t a_id)
  28. {
  29. return 0;
  30. }
  31. /* remap register to user space */
  32. static int disp_mmap(struct file *file, struct vm_area_struct *a_pstVMArea)
  33. {
  34. return 0;
  35. }
  36. #ifdef CONFIG_COMPAT
  37. static long disp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  38. {
  39. long ret = -ENOIOCTLCMD;
  40. switch (cmd) {
  41. /* add cases here for 32bit/64bit conversion */
  42. /* ... */
  43. default:
  44. return mtk_disp_mgr_ioctl(file, cmd, arg);
  45. }
  46. return ret;
  47. }
  48. #endif
  49. /* Kernel interface */
  50. static const struct file_operations disp_fops = {
  51. .owner = THIS_MODULE,
  52. .unlocked_ioctl = disp_unlocked_ioctl,
  53. #ifdef CONFIG_COMPAT
  54. .compat_ioctl = disp_compat_ioctl,
  55. #endif
  56. .open = disp_open,
  57. .release = disp_release,
  58. .flush = disp_flush,
  59. .read = disp_read,
  60. .mmap = disp_mmap
  61. };
  62. static int __init disp_init(void)
  63. {
  64. int ret = 0;
  65. DISPMSG("Register the disp driver\n");
  66. proc_entry = proc_create(DISP_DEVNAME, 0644, NULL, &disp_fops);
  67. if (proc_entry == NULL)
  68. ret = -ENOMEM;
  69. return ret;
  70. }
  71. static void __exit disp_exit(void)
  72. {
  73. remove_proc_entry(DISP_DEVNAME, proc_entry);
  74. DISPMSG("Done\n");
  75. }
  76. module_init(disp_init);
  77. module_exit(disp_exit);
  78. MODULE_AUTHOR("Tzu-Meng, Chung <Tzu-Meng.Chung@mediatek.com>");
  79. MODULE_DESCRIPTION("Display subsystem Driver");
  80. MODULE_LICENSE("GPL");