sde_vm_event.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __SDE_VM_EVENT_H__
  6. #define __SDE_VM_EVENT_H__
  7. #include <linux/list.h>
  8. #include <linux/types.h>
  9. #include <linux/slab.h>
  10. #include <linux/platform_device.h>
  11. #include <drm/drm_device.h>
  12. /**
  13. * struct - msm_io_irq_entry - define irq item
  14. * @label: gh_irq_label for the irq
  15. * @irq_num: linux mapped irq num
  16. * @list: list head pointer
  17. */
  18. struct msm_io_irq_entry {
  19. u32 label;
  20. u32 irq_num;
  21. struct list_head list;
  22. };
  23. /**
  24. * struct - msm_io_mem_entry - define io memory item
  25. * @base: reg base
  26. * @size: size of the reg range
  27. * @list: list head pointer
  28. */
  29. struct msm_io_mem_entry {
  30. phys_addr_t base;
  31. phys_addr_t size;
  32. struct list_head list;
  33. };
  34. /**
  35. * struct - msm_io_res - represents the hw resources for vm sharing
  36. * @irq: list of IRQ's of all the dislay sub-devices
  37. * @mem: list of IO memory ranges of all the display sub-devices
  38. */
  39. struct msm_io_res {
  40. struct list_head irq;
  41. struct list_head mem;
  42. };
  43. /**
  44. * struct msm_vm_ops - hooks for communication with vm clients
  45. * @vm_pre_hw_release: invoked before releasing the HW
  46. * @vm_post_hw_acquire: invoked before pushing the first commit
  47. * @vm_check: invoked to check the readiness of the vm_clients
  48. * before releasing the HW
  49. * @vm_get_io_resources: invoked to collect HW resources
  50. */
  51. struct msm_vm_ops {
  52. int (*vm_pre_hw_release)(void *priv_data);
  53. int (*vm_post_hw_acquire)(void *priv_data);
  54. int (*vm_check)(void *priv_data);
  55. int (*vm_get_io_resources)(struct msm_io_res *io_res, void *priv_data);
  56. };
  57. /**
  58. * msm_vm_client_entry - defines the vm client info
  59. * @ops: client vm_ops
  60. * @dev: clients device id. Used in unregister
  61. * @data: client custom data
  62. * @list: linked list entry
  63. */
  64. struct msm_vm_client_entry {
  65. struct msm_vm_ops ops;
  66. struct device *dev;
  67. void *data;
  68. struct list_head list;
  69. };
  70. /**
  71. * msm_register_vm_event - api for display dependent drivers(clients) to
  72. * register for vm events
  73. * @dev: msm device
  74. * @client_dev: client device
  75. * @ops: vm event hooks
  76. * @priv_data: client custom data
  77. */
  78. int msm_register_vm_event(struct device *dev, struct device *client_dev,
  79. struct msm_vm_ops *ops, void *priv_data);
  80. /**
  81. * msm_unregister_vm_event - api for display dependent drivers(clients) to
  82. * unregister from vm events
  83. * @dev: msm device
  84. * @client_dev: client device
  85. */
  86. void msm_unregister_vm_event(struct device *dev, struct device *client_dev);
  87. #endif //__SDE_VM_EVENT_H__