mmprofile.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. #include <linux/miscdevice.h>
  2. #include <linux/fs.h>
  3. #include <linux/file.h>
  4. #include <linux/cdev.h>
  5. #include <asm/io.h>
  6. #include <generated/autoconf.h>
  7. #include <linux/module.h>
  8. #include <linux/init.h>
  9. #include <linux/device.h>
  10. #include <linux/platform_device.h>
  11. #include <asm/uaccess.h>
  12. /* #include <asm/mach-types.h> */
  13. #define MMPROFILE_INTERNAL
  14. #include <linux/mmprofile_internal.h>
  15. /* #pragma GCC optimize ("O0") */
  16. #define MMP_DEVNAME "mmp"
  17. void MMProfileStart(int start)
  18. {
  19. }
  20. void MMProfileEnable(int enable)
  21. {
  22. }
  23. /* Exposed APIs begin */
  24. MMP_Event MMProfileRegisterEvent(MMP_Event parent, const char *name)
  25. {
  26. return 0;
  27. }
  28. EXPORT_SYMBOL(MMProfileRegisterEvent);
  29. MMP_Event MMProfileFindEvent(MMP_Event parent, const char *name)
  30. {
  31. return 0;
  32. }
  33. EXPORT_SYMBOL(MMProfileFindEvent);
  34. void MMProfileEnableEvent(MMP_Event event, long enable)
  35. {
  36. }
  37. EXPORT_SYMBOL(MMProfileEnableEvent);
  38. void MMProfileEnableEventRecursive(MMP_Event event, long enable)
  39. {
  40. }
  41. EXPORT_SYMBOL(MMProfileEnableEventRecursive);
  42. long MMProfileQueryEnable(MMP_Event event)
  43. {
  44. return 0;
  45. }
  46. EXPORT_SYMBOL(MMProfileQueryEnable);
  47. void MMProfileLogEx(MMP_Event event, MMP_LogType type, unsigned long data1, unsigned long data2)
  48. {
  49. }
  50. EXPORT_SYMBOL(MMProfileLogEx);
  51. void MMProfileLog(MMP_Event event, MMP_LogType type)
  52. {
  53. }
  54. EXPORT_SYMBOL(MMProfileLog);
  55. long MMProfileLogMeta(MMP_Event event, MMP_LogType type, MMP_MetaData_t *pMetaData)
  56. {
  57. return 0;
  58. }
  59. EXPORT_SYMBOL(MMProfileLogMeta);
  60. long MMProfileLogMetaStructure(MMP_Event event, MMP_LogType type,
  61. MMP_MetaDataStructure_t *pMetaData)
  62. {
  63. return 0;
  64. }
  65. EXPORT_SYMBOL(MMProfileLogMetaStructure);
  66. long MMProfileLogMetaStringEx(MMP_Event event, MMP_LogType type, unsigned long data1,
  67. unsigned long data2, const char *str)
  68. {
  69. return 0;
  70. }
  71. EXPORT_SYMBOL(MMProfileLogMetaStringEx);
  72. long MMProfileLogMetaString(MMP_Event event, MMP_LogType type, const char *str)
  73. {
  74. return 0;
  75. }
  76. EXPORT_SYMBOL(MMProfileLogMetaString);
  77. long MMProfileLogMetaBitmap(MMP_Event event, MMP_LogType type, MMP_MetaDataBitmap_t *pMetaData)
  78. {
  79. return 0;
  80. }
  81. EXPORT_SYMBOL(MMProfileLogMetaBitmap);
  82. /* Exposed APIs end */
  83. /* Driver specific begin */
  84. /*
  85. static dev_t mmprofile_devno;
  86. static struct cdev *mmprofile_cdev;
  87. static struct class *mmprofile_class = NULL;
  88. */
  89. static int mmprofile_release(struct inode *inode, struct file *file)
  90. {
  91. return 0;
  92. }
  93. static int mmprofile_open(struct inode *inode, struct file *file)
  94. {
  95. return 0;
  96. }
  97. static ssize_t mmprofile_read(struct file *file, char __user *data, size_t len, loff_t *ppos)
  98. {
  99. return 0;
  100. }
  101. static ssize_t mmprofile_write(struct file *file, const char __user *data, size_t len,
  102. loff_t *ppos)
  103. {
  104. return 0;
  105. }
  106. static long mmprofile_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  107. {
  108. return 0;
  109. }
  110. static int mmprofile_mmap(struct file *file, struct vm_area_struct *vma)
  111. {
  112. return -EINVAL;
  113. }
  114. const struct file_operations mmprofile_fops = {
  115. .owner = THIS_MODULE,
  116. .unlocked_ioctl = mmprofile_ioctl,
  117. .open = mmprofile_open,
  118. .release = mmprofile_release,
  119. .read = mmprofile_read,
  120. .write = mmprofile_write,
  121. .mmap = mmprofile_mmap,
  122. };
  123. /* fix build warning: unused */
  124. #if 0
  125. static int mmprofile_probe(struct platform_device *pdev)
  126. {
  127. #if 0
  128. struct class_device *class_dev = 0;
  129. int ret = alloc_chrdev_region(&mmprofile_devno, 0, 1, MMP_DEVNAME);
  130. mmprofile_cdev = cdev_alloc();
  131. mmprofile_cdev->owner = THIS_MODULE;
  132. mmprofile_cdev->ops = &mmprofile_fops;
  133. ret = cdev_add(mmprofile_cdev, mmprofile_devno, 1);
  134. mmprofile_class = class_create(THIS_MODULE, MMP_DEVNAME);
  135. class_dev =
  136. (struct class_device *)device_create(mmprofile_class, NULL, mmprofile_devno, NULL,
  137. MMP_DEVNAME);
  138. #endif
  139. return 0;
  140. }
  141. #endif
  142. /* fix build warning: unused */
  143. #if 0
  144. static int mmprofile_remove(struct platform_device *pdev)
  145. {
  146. return 0;
  147. }
  148. #endif
  149. #if 0
  150. static struct platform_driver mmprofile_driver = {
  151. .probe = mmprofile_probe,
  152. .remove = mmprofile_remove,
  153. .driver = {.name = MMP_DEVNAME}
  154. };
  155. static struct platform_device mmprofile_device = {
  156. .name = MMP_DEVNAME,
  157. .id = 0,
  158. };
  159. #endif
  160. static int __init mmprofile_init(void)
  161. {
  162. #if 0
  163. if (platform_device_register(&mmprofile_device))
  164. return -ENODEV;
  165. if (platform_driver_register(&mmprofile_driver)) {
  166. platform_device_unregister(&mmprofile_device);
  167. return -ENODEV;
  168. }
  169. #endif
  170. return 0;
  171. }
  172. static void __exit mmprofile_exit(void)
  173. {
  174. #if 0
  175. device_destroy(mmprofile_class, mmprofile_devno);
  176. class_destroy(mmprofile_class);
  177. cdev_del(mmprofile_cdev);
  178. unregister_chrdev_region(mmprofile_devno, 1);
  179. platform_driver_unregister(&mmprofile_driver);
  180. platform_device_unregister(&mmprofile_device);
  181. #endif
  182. }
  183. /* Driver specific end */
  184. module_init(mmprofile_init);
  185. module_exit(mmprofile_exit);
  186. MODULE_AUTHOR("Tianshu Qiu <tianshu.qiu@mediatek.com>");
  187. MODULE_DESCRIPTION("MMProfile Driver");
  188. MODULE_LICENSE("GPL");