mt_spm_constraint.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) 2022, 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 BIT(0)
  10. #define MT_RM_CONSTRAINT_ALLOW_DRAM_S0 BIT(1)
  11. #define MT_RM_CONSTRAINT_ALLOW_DRAM_S1 BIT(2)
  12. #define MT_RM_CONSTRAINT_ALLOW_VCORE_LP BIT(3)
  13. #define MT_RM_CONSTRAINT_ALLOW_INFRA_PDN BIT(4)
  14. #define MT_RM_CONSTRAINT_ALLOW_BUS26M_OFF BIT(5)
  15. #define MT_RM_CONSTRAINT_ALLOW_AP_SUSPEND BIT(6)
  16. #define MT_RM_CONSTRAINT_ALLOW_BBLPM BIT(7)
  17. #define MT_RM_CONSTRAINT_ALLOW_XO_UFS BIT(8)
  18. #define MT_RM_CONSTRAINT_ALLOW_GPS_STATE BIT(9)
  19. #define MT_RM_CONSTRAINT_ALLOW_LVTS_STATE BIT(10)
  20. #define MT_SPM_RC_INVALID (0x0)
  21. #define MT_SPM_RC_VALID_SW BIT(0)
  22. #define MT_SPM_RC_VALID_FW BIT(1)
  23. #define MT_SPM_RC_VALID_RESIDNECY BIT(2)
  24. #define MT_SPM_RC_VALID_COND_CHECK BIT(3)
  25. #define MT_SPM_RC_VALID_COND_LATCH BIT(4)
  26. #define MT_SPM_RC_VALID_UFS_H8 BIT(5)
  27. #define MT_SPM_RC_VALID_FLIGHTMODE BIT(6)
  28. #define MT_SPM_RC_VALID_XSOC_BBLPM BIT(7)
  29. #define MT_SPM_RC_VALID_TRACE_EVENT BIT(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 = 0U,
  48. MT_RM_CONSTRAINT_ID_SYSPLL = 1U,
  49. MT_RM_CONSTRAINT_ID_DRAM = 2U,
  50. MT_RM_CONSTRAINT_ID_CPU_BUCK_LDO = 3U,
  51. MT_RM_CONSTRAINT_ID_ALL = 4U,
  52. };
  53. #endif /* MT_SPM_CONSTRAINT_H */