ipa_rm_i.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Copyright (c) 2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _IPA_RM_I_H_
  13. #define _IPA_RM_I_H_
  14. #include <linux/workqueue.h>
  15. #include <mach/ipa.h>
  16. #define IPA_RM_RESOURCE_CONS_MAX \
  17. (IPA_RM_RESOURCE_MAX - IPA_RM_RESOURCE_PROD_MAX)
  18. #define IPA_RM_RESORCE_IS_PROD(x) \
  19. (x >= IPA_RM_RESOURCE_PROD && x < IPA_RM_RESOURCE_PROD_MAX)
  20. #define IPA_RM_RESORCE_IS_CONS(x) \
  21. (x >= IPA_RM_RESOURCE_PROD_MAX && x < IPA_RM_RESOURCE_MAX)
  22. #define IPA_RM_INDEX_INVALID (-1)
  23. int ipa_rm_prod_index(enum ipa_rm_resource_name resource_name);
  24. int ipa_rm_cons_index(enum ipa_rm_resource_name resource_name);
  25. /**
  26. * enum ipa_rm_wq_cmd - workqueue commands
  27. */
  28. enum ipa_rm_wq_cmd {
  29. IPA_RM_WQ_NOTIFY_PROD,
  30. IPA_RM_WQ_NOTIFY_CONS,
  31. IPA_RM_WQ_RESOURCE_CB
  32. };
  33. /**
  34. * struct ipa_rm_wq_work_type - IPA RM worqueue specific
  35. * work type
  36. * @work: work struct
  37. * @wq_cmd: command that should be processed in workqueue context
  38. * @resource_name: name of the resource on which this work
  39. * should be done
  40. * @dep_graph: data structure to search for resource if exists
  41. * @event: event to notify
  42. * @notify_registered_only: notify only clients registered by
  43. * ipa_rm_register()
  44. */
  45. struct ipa_rm_wq_work_type {
  46. struct work_struct work;
  47. enum ipa_rm_wq_cmd wq_cmd;
  48. enum ipa_rm_resource_name resource_name;
  49. enum ipa_rm_event event;
  50. bool notify_registered_only;
  51. };
  52. int ipa_rm_wq_send_cmd(enum ipa_rm_wq_cmd wq_cmd,
  53. enum ipa_rm_resource_name resource_name,
  54. enum ipa_rm_event event,
  55. bool notify_registered_only);
  56. int ipa_rm_initialize(void);
  57. int ipa_rm_stat(char *buf, int size);
  58. void ipa_rm_exit(void);
  59. #endif /* _IPA_RM_I_H_ */