pm-cps.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) 2014 Imagination Technologies
  4. * Author: Paul Burton <[email protected]>
  5. */
  6. #ifndef __MIPS_ASM_PM_CPS_H__
  7. #define __MIPS_ASM_PM_CPS_H__
  8. /*
  9. * The CM & CPC can only handle coherence & power control on a per-core basis,
  10. * thus in an MT system the VP(E)s within each core are coupled and can only
  11. * enter or exit states requiring CM or CPC assistance in unison.
  12. */
  13. #if defined(CONFIG_CPU_MIPSR6)
  14. # define coupled_coherence cpu_has_vp
  15. #elif defined(CONFIG_MIPS_MT)
  16. # define coupled_coherence cpu_has_mipsmt
  17. #else
  18. # define coupled_coherence 0
  19. #endif
  20. /* Enumeration of possible PM states */
  21. enum cps_pm_state {
  22. CPS_PM_NC_WAIT, /* MIPS wait instruction, non-coherent */
  23. CPS_PM_CLOCK_GATED, /* Core clock gated */
  24. CPS_PM_POWER_GATED, /* Core power gated */
  25. CPS_PM_STATE_COUNT,
  26. };
  27. /**
  28. * cps_pm_support_state - determine whether the system supports a PM state
  29. * @state: the state to test for support
  30. *
  31. * Returns true if the system supports the given state, otherwise false.
  32. */
  33. extern bool cps_pm_support_state(enum cps_pm_state state);
  34. /**
  35. * cps_pm_enter_state - enter a PM state
  36. * @state: the state to enter
  37. *
  38. * Enter the given PM state. If coupled_coherence is non-zero then it is
  39. * expected that this function be called at approximately the same time on
  40. * each coupled CPU. Returns 0 on successful entry & exit, otherwise -errno.
  41. */
  42. extern int cps_pm_enter_state(enum cps_pm_state state);
  43. #endif /* __MIPS_ASM_PM_CPS_H__ */