cam_compat.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _CAM_COMPAT_H_
  7. #define _CAM_COMPAT_H_
  8. #include <linux/version.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/component.h>
  11. #include <linux/iommu.h>
  12. #include <linux/qcom_scm.h>
  13. #include <linux/list_sort.h>
  14. #include <linux/dma-iommu.h>
  15. #include <soc/qcom/of_common.h>
  16. #include <linux/spi/spi.h>
  17. #include "cam_csiphy_dev.h"
  18. #include "cam_cpastop_hw.h"
  19. #include "cam_smmu_api.h"
  20. #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
  21. #include <linux/ion.h>
  22. #include <linux/msm_ion.h>
  23. #define VFL_TYPE_VIDEO VFL_TYPE_GRABBER
  24. #endif
  25. #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) && \
  26. LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
  27. #include <soc/qcom/of_common.h>
  28. #include <linux/qcom-dma-mapping.h>
  29. #endif
  30. #if KERNEL_VERSION(5, 18, 0) <= LINUX_VERSION_CODE
  31. MODULE_IMPORT_NS(DMA_BUF);
  32. #endif
  33. struct cam_fw_alloc_info {
  34. struct device *fw_dev;
  35. void *fw_kva;
  36. uint64_t fw_hdl;
  37. };
  38. int cam_reserve_icp_fw(struct cam_fw_alloc_info *icp_fw, size_t fw_length);
  39. void cam_unreserve_icp_fw(struct cam_fw_alloc_info *icp_fw, size_t fw_length);
  40. void cam_cpastop_scm_write(struct cam_cpas_hw_errata_wa *errata_wa);
  41. int cam_ife_notify_safe_lut_scm(bool safe_trigger);
  42. int camera_component_match_add_drivers(struct device *master_dev,
  43. struct component_match **match_list);
  44. int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev,
  45. bool protect, int32_t offset);
  46. void cam_free_clear(const void *);
  47. void cam_check_iommu_faults(struct iommu_domain *domain,
  48. struct cam_smmu_pf_info *pf_info);
  49. static inline int cam_get_ddr_type(void) { return of_fdt_get_ddrtype(); }
  50. int cam_compat_util_get_dmabuf_va(struct dma_buf *dmabuf, uintptr_t *vaddr);
  51. void cam_compat_util_put_dmabuf_va(struct dma_buf *dmabuf, void *vaddr);
  52. void cam_smmu_util_iommu_custom(struct device *dev,
  53. dma_addr_t discard_start, size_t discard_length);
  54. const struct device *cam_cpas_get_rsc_dev_for_drv(uint32_t index);
  55. int cam_cpas_start_drv_for_dev(const struct device *dev);
  56. int cam_cpas_stop_drv_for_dev(const struct device *dev);
  57. int cam_cpas_drv_channel_switch_for_dev(const struct device *dev);
  58. #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
  59. int cam_req_mgr_ordered_list_cmp(void *priv,
  60. const struct list_head *head_1, const struct list_head *head_2);
  61. void cam_i3c_driver_remove(struct i3c_device *client);
  62. #else
  63. int cam_req_mgr_ordered_list_cmp(void *priv,
  64. struct list_head *head_1, struct list_head *head_2);
  65. int cam_i3c_driver_remove(struct i3c_device *client);
  66. #endif
  67. long cam_dma_buf_set_name(struct dma_buf *dmabuf, const char *name);
  68. #if KERNEL_VERSION(5, 18, 0) <= LINUX_VERSION_CODE
  69. void cam_eeprom_spi_driver_remove(struct spi_device *sdev);
  70. #else
  71. int cam_eeprom_spi_driver_remove(struct spi_device *sdev);
  72. #endif
  73. int cam_compat_util_get_irq(struct cam_hw_soc_info *soc_info);
  74. #endif /* _CAM_COMPAT_H_ */