bL_switcher.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * arch/arm/include/asm/bL_switcher.h
  4. *
  5. * Created by: Nicolas Pitre, April 2012
  6. * Copyright: (C) 2012-2013 Linaro Limited
  7. */
  8. #ifndef ASM_BL_SWITCHER_H
  9. #define ASM_BL_SWITCHER_H
  10. #include <linux/compiler.h>
  11. #include <linux/types.h>
  12. typedef void (*bL_switch_completion_handler)(void *cookie);
  13. int bL_switch_request_cb(unsigned int cpu, unsigned int new_cluster_id,
  14. bL_switch_completion_handler completer,
  15. void *completer_cookie);
  16. static inline int bL_switch_request(unsigned int cpu, unsigned int new_cluster_id)
  17. {
  18. return bL_switch_request_cb(cpu, new_cluster_id, NULL, NULL);
  19. }
  20. /*
  21. * Register here to be notified about runtime enabling/disabling of
  22. * the switcher.
  23. *
  24. * The notifier chain is called with the switcher activation lock held:
  25. * the switcher will not be enabled or disabled during callbacks.
  26. * Callbacks must not call bL_switcher_{get,put}_enabled().
  27. */
  28. #define BL_NOTIFY_PRE_ENABLE 0
  29. #define BL_NOTIFY_POST_ENABLE 1
  30. #define BL_NOTIFY_PRE_DISABLE 2
  31. #define BL_NOTIFY_POST_DISABLE 3
  32. #ifdef CONFIG_BL_SWITCHER
  33. int bL_switcher_register_notifier(struct notifier_block *nb);
  34. int bL_switcher_unregister_notifier(struct notifier_block *nb);
  35. /*
  36. * Use these functions to temporarily prevent enabling/disabling of
  37. * the switcher.
  38. * bL_switcher_get_enabled() returns true if the switcher is currently
  39. * enabled. Each call to bL_switcher_get_enabled() must be followed
  40. * by a call to bL_switcher_put_enabled(). These functions are not
  41. * recursive.
  42. */
  43. bool bL_switcher_get_enabled(void);
  44. void bL_switcher_put_enabled(void);
  45. int bL_switcher_trace_trigger(void);
  46. int bL_switcher_get_logical_index(u32 mpidr);
  47. #else
  48. static inline int bL_switcher_register_notifier(struct notifier_block *nb)
  49. {
  50. return 0;
  51. }
  52. static inline int bL_switcher_unregister_notifier(struct notifier_block *nb)
  53. {
  54. return 0;
  55. }
  56. static inline bool bL_switcher_get_enabled(void) { return false; }
  57. static inline void bL_switcher_put_enabled(void) { }
  58. static inline int bL_switcher_trace_trigger(void) { return 0; }
  59. static inline int bL_switcher_get_logical_index(u32 mpidr) { return -EUNATCH; }
  60. #endif /* CONFIG_BL_SWITCHER */
  61. #endif