mtk_scp.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2019 MediaTek Inc.
  4. */
  5. #ifndef _MTK_SCP_H
  6. #define _MTK_SCP_H
  7. #include <linux/platform_device.h>
  8. typedef void (*scp_ipi_handler_t) (void *data,
  9. unsigned int len,
  10. void *priv);
  11. struct mtk_scp;
  12. /**
  13. * enum ipi_id - the id of inter-processor interrupt
  14. *
  15. * @SCP_IPI_INIT: The interrupt from scp is to notfiy kernel
  16. * SCP initialization completed.
  17. * IPI_SCP_INIT is sent from SCP when firmware is
  18. * loaded. AP doesn't need to send IPI_SCP_INIT
  19. * command to SCP.
  20. * For other IPI below, AP should send the request
  21. * to SCP to trigger the interrupt.
  22. * @SCP_IPI_MAX: The maximum IPI number
  23. */
  24. enum scp_ipi_id {
  25. SCP_IPI_INIT = 0,
  26. SCP_IPI_VDEC_H264,
  27. SCP_IPI_VDEC_VP8,
  28. SCP_IPI_VDEC_VP9,
  29. SCP_IPI_VENC_H264,
  30. SCP_IPI_VENC_VP8,
  31. SCP_IPI_MDP_INIT,
  32. SCP_IPI_MDP_DEINIT,
  33. SCP_IPI_MDP_FRAME,
  34. SCP_IPI_DIP,
  35. SCP_IPI_ISP_CMD,
  36. SCP_IPI_ISP_FRAME,
  37. SCP_IPI_FD_CMD,
  38. SCP_IPI_CROS_HOST_CMD,
  39. SCP_IPI_VDEC_LAT,
  40. SCP_IPI_VDEC_CORE,
  41. SCP_IPI_NS_SERVICE = 0xFF,
  42. SCP_IPI_MAX = 0x100,
  43. };
  44. struct mtk_scp *scp_get(struct platform_device *pdev);
  45. void scp_put(struct mtk_scp *scp);
  46. struct device *scp_get_device(struct mtk_scp *scp);
  47. struct rproc *scp_get_rproc(struct mtk_scp *scp);
  48. int scp_ipi_register(struct mtk_scp *scp, u32 id, scp_ipi_handler_t handler,
  49. void *priv);
  50. void scp_ipi_unregister(struct mtk_scp *scp, u32 id);
  51. int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len,
  52. unsigned int wait);
  53. unsigned int scp_get_vdec_hw_capa(struct mtk_scp *scp);
  54. unsigned int scp_get_venc_hw_capa(struct mtk_scp *scp);
  55. void *scp_mapping_dm_addr(struct mtk_scp *scp, u32 mem_addr);
  56. #endif /* _MTK_SCP_H */