lastbus.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef __LASTPC_H__
  2. #define __LASTPC_H__
  3. #include <linux/platform_device.h>
  4. #include <linux/pm.h>
  5. #include <linux/compiler.h>
  6. struct lastbus_plt;
  7. struct lastbus_plt_operations {
  8. /* if platform needs special settings before */
  9. int (*start)(struct lastbus_plt *plt);
  10. /* dump anything we get */
  11. int (*dump)(struct lastbus_plt *plt, char *buf, int len);
  12. /* enable the lastbus functionality */
  13. int (*enable)(struct lastbus_plt *plt);
  14. /* if you want to add unit test by sysfs interface, implement this */
  15. int (*test)(struct lastbus_plt *plt, int test_case);
  16. /* if you want to show unit test by sysfs interface, implement this */
  17. int (*test_show)(char *buf);
  18. /* if you want to do anything more than lastbus.c:lastbus_probe() */
  19. int (*probe)(struct lastbus_plt *plt, struct platform_device *pdev);
  20. /* if you want to do anything more than lastbus.c:lastbus_remove() */
  21. int (*remove)(struct lastbus_plt *plt, struct platform_device *pdev);
  22. /* if you want to do anything more than lastbus.c:lastbus_suspend() */
  23. int (*suspend)(struct lastbus_plt *plt, struct platform_device *pdev, pm_message_t state);
  24. /* if you want to do anything more than lastbus.c:lastbus_resume() */
  25. int (*resume)(struct lastbus_plt *plt, struct platform_device *pdev);
  26. };
  27. struct lastbus_plt {
  28. unsigned int min_buf_len;
  29. struct lastbus_plt_operations *ops;
  30. struct lastbus *common;
  31. };
  32. struct lastbus {
  33. struct platform_driver plt_drv;
  34. void __iomem *mcu_base;
  35. void __iomem *peri_base;
  36. struct lastbus_plt *cur_plt;
  37. };
  38. /* for platform register their specific lastbus behaviors
  39. (chip or various versions of lastbus)
  40. */
  41. int lastbus_register(struct lastbus_plt *plt);
  42. #endif /* end of __LASTPC_H__ */