msm_cvp.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _MSM_CVP_H_
  7. #define _MSM_CVP_H_
  8. #include "msm_cvp_internal.h"
  9. #include "msm_cvp_common.h"
  10. #include "msm_cvp_clocks.h"
  11. #include "msm_cvp_debug.h"
  12. #include "msm_cvp_dsp.h"
  13. #include "eva_shared_def.h"
  14. static inline bool is_buf_param_valid(u32 buf_num, u32 offset)
  15. {
  16. int max_buf_num;
  17. max_buf_num = sizeof(struct eva_kmd_hfi_packet) /
  18. sizeof(struct cvp_buf_type);
  19. if (buf_num > max_buf_num)
  20. return false;
  21. if ((offset > U32_MAX/sizeof(u32)) ||
  22. (offset*sizeof(u32) > U32_MAX - buf_num * sizeof(struct cvp_buf_type)))
  23. return false;
  24. if ((offset * sizeof(u32) + buf_num * sizeof(struct cvp_buf_type)) >
  25. sizeof(struct eva_kmd_hfi_packet))
  26. return false;
  27. return true;
  28. }
  29. int msm_cvp_handle_syscall(struct msm_cvp_inst *inst, struct eva_kmd_arg *arg);
  30. int msm_cvp_session_init(struct msm_cvp_inst *inst);
  31. int msm_cvp_session_deinit(struct msm_cvp_inst *inst);
  32. int msm_cvp_session_queue_stop(struct msm_cvp_inst *inst);
  33. int msm_cvp_session_create(struct msm_cvp_inst *inst);
  34. int msm_cvp_session_delete(struct msm_cvp_inst *inst);
  35. int msm_cvp_session_start(struct msm_cvp_inst *inst, struct eva_kmd_arg *arg);
  36. int msm_cvp_session_stop(struct msm_cvp_inst *inst, struct eva_kmd_arg *arg);
  37. int msm_cvp_get_session_info(struct msm_cvp_inst *inst, u32 *session);
  38. int msm_cvp_update_power(struct msm_cvp_inst *inst);
  39. int cvp_clean_session_queues(struct msm_cvp_inst *inst);
  40. #endif