mt_spm_constraint.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) 2020, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MT_SPM_CONSTRAINT_H
  7. #define MT_SPM_CONSTRAINT_H
  8. #include <mt_lp_rm.h>
  9. #define MT_RM_CONSTRAINT_ALLOW_CPU_BUCK_OFF (1U << 0)
  10. #define MT_RM_CONSTRAINT_ALLOW_DRAM_S0 (1U << 1)
  11. #define MT_RM_CONSTRAINT_ALLOW_DRAM_S1 (1U << 2)
  12. #define MT_RM_CONSTRAINT_ALLOW_VCORE_LP (1U << 3)
  13. #define MT_RM_CONSTRAINT_ALLOW_INFRA_PDN (1U << 4)
  14. #define MT_RM_CONSTRAINT_ALLOW_BUS26M_OFF (1U << 5)
  15. #define MT_RM_CONSTRAINT_ALLOW_AP_SUSPEND (1U << 6)
  16. #define MT_RM_CONSTRAINT_ALLOW_BBLPM (1U << 7)
  17. #define MT_RM_CONSTRAINT_ALLOW_XO_UFS (1U << 8)
  18. #define MT_RM_CONSTRAINT_ALLOW_GPS_STATE (1U << 9)
  19. #define MT_RM_CONSTRAINT_ALLOW_LVTS_STATE (1U << 10)
  20. #define MT_SPM_RC_INVALID 0x0
  21. #define MT_SPM_RC_VALID_SW (1U << 0)
  22. #define MT_SPM_RC_VALID_FW (1U << 1)
  23. #define MT_SPM_RC_VALID_RESIDNECY (1U << 2)
  24. #define MT_SPM_RC_VALID_COND_CHECK (1U << 3)
  25. #define MT_SPM_RC_VALID_COND_LATCH (1U << 4)
  26. #define MT_SPM_RC_VALID_UFS_H8 (1U << 5)
  27. #define MT_SPM_RC_VALID_FLIGHTMODE (1U << 6)
  28. #define MT_SPM_RC_VALID_XSOC_BBLPM (1U << 7)
  29. #define MT_SPM_RC_VALID_TRACE_EVENT (1U << 8)
  30. #define MT_SPM_RC_VALID (MT_SPM_RC_VALID_SW)
  31. #define IS_MT_RM_RC_READY(status) \
  32. ((status & MT_SPM_RC_VALID) == MT_SPM_RC_VALID)
  33. #define MT_SPM_RC_BBLPM_MODE \
  34. (MT_SPM_RC_VALID_UFS_H8 | \
  35. MT_SPM_RC_VALID_FLIGHTMODE | \
  36. MT_SPM_RC_VALID_XSOC_BBLPM)
  37. #define IS_MT_SPM_RC_BBLPM_MODE(st) \
  38. ((st & (MT_SPM_RC_BBLPM_MODE)) == MT_SPM_RC_BBLPM_MODE)
  39. struct constraint_status {
  40. uint16_t id;
  41. uint16_t valid;
  42. uint32_t cond_block;
  43. uint32_t enter_cnt;
  44. struct mt_spm_cond_tables *cond_res;
  45. };
  46. enum MT_SPM_RM_RC_TYPE {
  47. MT_RM_CONSTRAINT_ID_BUS26M,
  48. MT_RM_CONSTRAINT_ID_SYSPLL,
  49. MT_RM_CONSTRAINT_ID_DRAM,
  50. MT_RM_CONSTRAINT_ID_CPU_BUCK_LDO,
  51. MT_RM_CONSTRAINT_ID_ALL,
  52. };
  53. #endif /* MT_SPM_CONSTRAINT_H */