bL_switcher.h 2.3 KB

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