diff options
author | Sivaram Nair <sivaramn@nvidia.com> | 2012-08-22 10:13:48 +0300 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 12:32:22 -0700 |
commit | f0121e7287b5f125d555591370348b6a56f4eab7 (patch) | |
tree | 12f595a62dd2e34d3880b4be17db1bedeaadb669 /include/linux/edp.h | |
parent | 1cf749545d7c3a047dd3c1f6bb610cda77a6a53f (diff) |
pm: EDP: Add governor framework
This patch introduces the governor framework into EDP. Governor will
handle all request related processing including issuing of notifications
and throttling.
A single governor can be used by multiple managers.
Change-Id: If0f97107d6a2df9dfa22e7e84c1f48ba27d27280
Signed-off-by: Sivaram Nair <sivaramn@nvidia.com>
Reviewed-on: http://git-master/r/125225
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Rebase-Id: Rfd6dca218da5cdeb0fe36f55d9e8facee57e10ac
Diffstat (limited to 'include/linux/edp.h')
-rw-r--r-- | include/linux/edp.h | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/include/linux/edp.h b/include/linux/edp.h index eeb09e49b497..9cc59f3f8c6a 100644 --- a/include/linux/edp.h +++ b/include/linux/edp.h @@ -33,6 +33,9 @@ struct edp_manager { struct list_head clients; bool registered; unsigned int remaining; + struct edp_governor *gov; + struct work_struct work; + unsigned int num_denied; }; /* @@ -42,7 +45,9 @@ struct edp_manager { * @e0_index: index of the E0 state in the above array * @max_borrowers: maximum number of clients allowed to borrow from this * @priority: client priority - should be between EDP_MIN_PRIO & EDP_MAX_PRIO + * @throttle: throttle callback function * @notify_loan_update: for receiving loan size change notifications + * (clients should return the amount of loan consumed) * @notify_loan_close: for receiving loan closure notification * Note that each EDP client is tied to a single EDP manager */ @@ -54,7 +59,9 @@ struct edp_client { unsigned int max_borrowers; int priority; - void (*notify_loan_update)(unsigned int new_size, + void (*throttle)(unsigned int new_state); + void (*notify_promotion)(unsigned int new_state); + unsigned int (*notify_loan_update)(unsigned int new_size, struct edp_client *lender); void (*notify_loan_close)(struct edp_client *lender); @@ -67,6 +74,25 @@ struct edp_client { unsigned int ithreshold; unsigned int num_borrowers; unsigned int num_loans; + + /* governor internal */ + unsigned int gwt; +}; + +struct edp_governor { + char name[EDP_NAME_LEN]; + struct module *owner; + + int (*start)(struct edp_manager *mgr); + void (*stop)(struct edp_manager *mgr); + void (*update_request)(struct edp_client *client, + const unsigned int *req); + void (*update_loans)(struct edp_client *client); + void (*promote)(struct edp_manager *mgr); + + /* internal */ + struct list_head link; + unsigned int refcnt; }; #ifdef CONFIG_EDP_FRAMEWORK @@ -109,6 +135,11 @@ extern int edp_unregister_loan(struct edp_client *lender, struct edp_client *borrower); extern int edp_update_loan_threshold(struct edp_client *lender, unsigned int threshold); + +extern int edp_register_governor(struct edp_governor *gov); +extern int edp_unregister_governor(struct edp_governor *gov); +extern struct edp_governor *edp_get_governor(const char *name); +extern int edp_set_governor(struct edp_manager *mgr, struct edp_governor *gov); #else static inline int edp_register_manager(struct edp_manager *mgr) { return -ENODEV; } @@ -135,6 +166,15 @@ static inline int edp_unregister_loan(struct edp_client *lender, static inline int edp_update_loan_threshold(struct edp_client *lender, unsigned int threshold) { return -ENODEV; } +static inline int edp_register_governor(struct edp_governor *gov) +{ return -ENODEV; } +static inline int edp_unregister_governor(struct edp_governor *gov) +{ return -ENODEV; } +static inline struct edp_governor *edp_get_governor(const char *name) +{ return NULL; } +static inline int edp_set_governor(struct edp_manager *mgr, + struct edp_governor *gov) +{ return -ENODEV; } #endif #endif |