hw_fence_drv_ipc.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #ifndef __HW_FENCE_DRV_IPC_H
  6. #define __HW_FENCE_DRV_IPC_H
  7. #define HW_FENCE_IPC_CLIENT_ID_APPS 8
  8. #define HW_FENCE_IPC_CLIENT_ID_GPU 9
  9. #define HW_FENCE_IPC_CLIENT_ID_DPU 25
  10. #define HW_FENCE_IPC_COMPUTE_L1_PROTOCOL_ID_LAHAINA 2
  11. #define HW_FENCE_IPC_COMPUTE_L1_PROTOCOL_ID_WAIPIO 1
  12. #define HW_FENCE_IPC_COMPUTE_L1_PROTOCOL_ID_KAILUA 2
  13. #define HW_FENCE_IPCC_HW_REV_100 0x00010000 /* Lahaina */
  14. #define HW_FENCE_IPCC_HW_REV_110 0x00010100 /* Waipio */
  15. #define HW_FENCE_IPCC_HW_REV_170 0x00010700 /* Kailua */
  16. #define IPC_PROTOCOLp_CLIENTc_VERSION(base, p, c) (base + (0x40000*p) + (0x1000*c))
  17. #define IPC_PROTOCOLp_CLIENTc_CONFIG(base, p, c) (base + 0x8 + (0x40000*p) + (0x1000*c))
  18. #define IPC_PROTOCOLp_CLIENTc_RECV_SIGNAL_ENABLE(base, p, c) \
  19. (base + 0x14 + (0x40000*p) + (0x1000*c))
  20. #define IPC_PROTOCOLp_CLIENTc_SEND(base, p, c) ((base + 0xc) + (0x40000*p) + (0x1000*c))
  21. /**
  22. * hw_fence_ipcc_trigger_signal() - Trigger ipc signal for the requested client/signal pair.
  23. * @drv_data: driver data.
  24. * @tx_client_id: ipc client id that sends the ipc signal.
  25. * @rx_client_id: ipc client id that receives the ipc signal.
  26. * @signal_id: signal id to send.
  27. *
  28. * This API triggers the ipc 'signal_id' from the 'tx_client_id' to the 'rx_client_id'
  29. */
  30. void hw_fence_ipcc_trigger_signal(struct hw_fence_driver_data *drv_data,
  31. u32 tx_client_id, u32 rx_client_id, u32 signal_id);
  32. /**
  33. * hw_fence_ipcc_enable_signaling() - Enable ipcc signaling for hw-fence driver.
  34. * @drv_data: driver data.
  35. *
  36. * Return: 0 on success or negative errno (-EINVAL)
  37. */
  38. int hw_fence_ipcc_enable_signaling(struct hw_fence_driver_data *drv_data);
  39. #ifdef HW_DPU_IPCC
  40. /**
  41. * hw_fence_ipcc_enable_dpu_signaling() - Enable ipcc signaling for dpu client.
  42. * @drv_data: driver data.
  43. *
  44. * Return: 0 on success or negative errno (-EINVAL)
  45. */
  46. int hw_fence_ipcc_enable_dpu_signaling(struct hw_fence_driver_data *drv_data);
  47. #endif /* HW_DPU_IPCC */
  48. /**
  49. * hw_fence_ipcc_get_client_id() - Returns the ipc client id that corresponds to the hw fence
  50. * driver client.
  51. * @drv_data: driver data.
  52. * @client_id: hw fence driver client id.
  53. *
  54. * The ipc client id returned by this API is used by the hw fence driver when signaling the fence.
  55. *
  56. * Return: client_id on success or negative errno (-EINVAL)
  57. */
  58. int hw_fence_ipcc_get_client_id(struct hw_fence_driver_data *drv_data, u32 client_id);
  59. /**
  60. * hw_fence_ipcc_get_signal_id() - Returns the ipc signal id that corresponds to the hw fence
  61. * driver client.
  62. * @drv_data: driver data.
  63. * @client_id: hw fence driver client id.
  64. *
  65. * The ipc signal id returned by this API is used by the hw fence driver when signaling the fence.
  66. *
  67. * Return: client_id on success or negative errno (-EINVAL)
  68. */
  69. int hw_fence_ipcc_get_signal_id(struct hw_fence_driver_data *drv_data, u32 client_id);
  70. /**
  71. * hw_fence_ipcc_needs_rxq_update() - Returns bool to indicate if client uses rx-queue.
  72. * @drv_data: driver data.
  73. * @client_id: hw fence driver client id.
  74. *
  75. * Return: true if client needs to update rxq, false otherwise
  76. */
  77. bool hw_fence_ipcc_needs_rxq_update(struct hw_fence_driver_data *drv_data, int client_id);
  78. #endif /* __HW_FENCE_DRV_IPC_H */