summaryrefslogtreecommitdiffstats
path: root/thermal_client.h
diff options
context:
space:
mode:
authorManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>2019-09-19 21:28:53 +0530
committerManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>2019-10-16 17:22:46 +0530
commit38da0e727dc462ea66d460936681cf549844a725 (patch)
tree01be18086e8bbd122e68d298a3df71e1df0a80d9 /thermal_client.h
parentca0159c55dcdf1ee01f2c159ca040b07d5519278 (diff)
downloadandroid_vendor_qcom_opensource_thermal-engine-38da0e727dc462ea66d460936681cf549844a725.tar.gz
android_vendor_qcom_opensource_thermal-engine-38da0e727dc462ea66d460936681cf549844a725.tar.bz2
android_vendor_qcom_opensource_thermal-engine-38da0e727dc462ea66d460936681cf549844a725.zip
thermal-engine: Add support for bandwidth client API to receive two data
Add support for bandwidth request API to receive two input data (bw_score and usecase_id) from clients using the same API. Add new thermal bandwidth client helper API to combine two type of bandwidth input data into single 32 bit int value. Client can use this utility API for merging two inputs prior to every bandwidth request to thermal/limits module. Validate multi inputs from client from both thermal client library and thermal server side before using it. Remove tab characters from thermal client header file. Client needs to consider below points for using bandwidth client APIs - Whenever client wants to update bandwidth vote to limits, use this helper API, 'thermal_bandwidth_client_merge_input_info()' first to merge two input data into single int variable and the return value will be used as final bandwidth request value for API, 'thermal_bandwidth_client_request()' with client name. - 1st 16 bit will be used for bandwidth utilization score and 2nd 16 bits will be used for usecase_id. - Both input data should be a maximum of 15 bit positive integer. More than 15 bit data will be treat as invalid bandwidth data. - Default value for both bandwidth input data will be zero. So client should not use zero as a valid use case id or bandwidth score. - It is client responsibility to pass current value of both inputs anytime. If one of the input changes, client needs to send latest value for both the inputs. The limits code will always consider last requested value for both inputs. - On first client request call, thermal library code will create few resources for sending data and server death monitor. It will re-use the same resource on subsequent calls. It is clients responsibility to invoke 'thermal_bandwidth_client_cancel_request()' API to release all these resources once client is done with bandwidth request update or on exit. Change-Id: I7afe80812434cfef6fe568e59e8beda5bdc8fddc
Diffstat (limited to 'thermal_client.h')
-rw-r--r--thermal_client.h70
1 files changed, 40 insertions, 30 deletions
diff --git a/thermal_client.h b/thermal_client.h
index a8fbce3..e70d2ec 100644
--- a/thermal_client.h
+++ b/thermal_client.h
@@ -39,48 +39,48 @@ extern "C" {
/* Enum for supported fields */
enum supported_fields {
- UNKNOWN_FIELD = 0x0,
- DISABLE_FIELD = 0x1,
- SAMPLING_FIELD = 0x2,
- POLLING_DELAY_FIELD = SAMPLING_FIELD,
- THRESHOLDS_FIELD = 0x4,
- SET_POINT_FIELD = THRESHOLDS_FIELD,
- THRESHOLDS_CLR_FIELD = 0x8,
- SET_POINT_CLR_FIELD = THRESHOLDS_CLR_FIELD,
- ACTION_INFO_FIELD = 0x10,
- UPPER_LIMIT_FIELD = ACTION_INFO_FIELD,
- LOWER_LIMIT_FIELD = 0x20,
- PASSIVE_DELAY_FIELD = 0x40,
- SUPPORTED_FIELD_MAX = 0x80,
+ UNKNOWN_FIELD = 0x0,
+ DISABLE_FIELD = 0x1,
+ SAMPLING_FIELD = 0x2,
+ POLLING_DELAY_FIELD = SAMPLING_FIELD,
+ THRESHOLDS_FIELD = 0x4,
+ SET_POINT_FIELD = THRESHOLDS_FIELD,
+ THRESHOLDS_CLR_FIELD = 0x8,
+ SET_POINT_CLR_FIELD = THRESHOLDS_CLR_FIELD,
+ ACTION_INFO_FIELD = 0x10,
+ UPPER_LIMIT_FIELD = ACTION_INFO_FIELD,
+ LOWER_LIMIT_FIELD = 0x20,
+ PASSIVE_DELAY_FIELD = 0x40,
+ SUPPORTED_FIELD_MAX = 0x80,
};
enum field_data_type {
- FIELD_INT = 0,
- FIELD_STR,
- FIELD_INT_ARR,
- FIELD_ARR_STR,
- FIELD_ARR_INT_ARR,
- FIELD_MAX
+ FIELD_INT = 0,
+ FIELD_STR,
+ FIELD_INT_ARR,
+ FIELD_ARR_STR,
+ FIELD_ARR_INT_ARR,
+ FIELD_MAX
};
struct action_info_data {
- int info[MAX_ACTIONS];
- uint32_t num_actions;
+ int info[MAX_ACTIONS];
+ uint32_t num_actions;
};
struct field_data {
- char *field_name;
- enum field_data_type data_type;
- uint32_t num_data;
- void *data;
+ char *field_name;
+ enum field_data_type data_type;
+ uint32_t num_data;
+ void *data;
};
struct config_instance {
- char *cfg_desc;
- char *algo_type;
- unsigned int fields_mask; /* mask set by client to request to adjust supported fields */
- uint32_t num_fields;
- struct field_data *fields;
+ char *cfg_desc;
+ char *algo_type;
+ unsigned int fields_mask; /* mask set by client to request to adjust supported fields */
+ uint32_t num_fields;
+ struct field_data *fields;
};
int thermal_client_config_query(char *algo_type, struct config_instance **configs);
@@ -95,6 +95,16 @@ void thermal_client_unregister_callback(int client_cb_handle);
int thermal_bandwidth_client_request(char *client_name, int req_data);
void thermal_bandwidth_client_cancel_request(char *client_name);
+/* Inline API to combine two 15 bit bw inputs into single int variable and return the same */
+static inline int thermal_bandwidth_client_merge_input_info(int bw_score, int uc_id)
+{
+ if (bw_score < 0 || bw_score > 0x7fff ||
+ uc_id < 0 || uc_id > 0x7fff)
+ return -1;
+
+ return (((uc_id & 0x7fff) << 0x10) | (bw_score & 0x7fff));
+}
+
#ifdef __cplusplus
}
#endif