cam_icp_utils.h 966 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _CAM_ICP_UTILS_H_
  6. #define _CAM_ICP_UTILS_H_
  7. #include <linux/firmware.h>
  8. #include <linux/elf.h>
  9. #include <linux/iopoll.h>
  10. #include "cam_debug_util.h"
  11. /**
  12. * struct cam_icp_proc_params - ICP [a5/lx7] specific params
  13. * @skip_seg : If set skip segments listed in vaddr field
  14. * @vaddr : vaddr of segments to be skipped
  15. */
  16. struct cam_icp_proc_params {
  17. bool skip_seg;
  18. uint32_t vaddr[2];
  19. };
  20. /**
  21. * @brief : Validate FW elf image
  22. */
  23. int32_t cam_icp_validate_fw(const uint8_t *elf, uint32_t machine_id);
  24. /**
  25. * @brief : Get FW elf size
  26. */
  27. int32_t cam_icp_get_fw_size(const uint8_t *elf, uint32_t *fw_size,
  28. struct cam_icp_proc_params *params);
  29. /**
  30. * @brief : Program FW memory
  31. */
  32. int32_t cam_icp_program_fw(const uint8_t *elf,
  33. uintptr_t fw_kva_addr, struct cam_icp_proc_params *params);
  34. #endif /* _CAM_ICP_UTILS_H_ */