Lines Matching refs:bcm
16 #include "bcm-voter.h"
25 * @np: reference to the device node to match bcm voters
29 * @voter_node: list of bcm voters
62 static void bcm_aggregate_mask(struct qcom_icc_bcm *bcm)
68 bcm->vote_x[bucket] = 0;
69 bcm->vote_y[bucket] = 0;
71 for (i = 0; i < bcm->num_nodes; i++) {
72 node = bcm->nodes[i];
76 bcm->vote_x[bucket] = 0;
77 bcm->vote_y[bucket] = bcm->enable_mask;
83 if (bcm->keepalive) {
84 bcm->vote_x[QCOM_ICC_BUCKET_AMC] = bcm->enable_mask;
85 bcm->vote_x[QCOM_ICC_BUCKET_WAKE] = bcm->enable_mask;
86 bcm->vote_y[QCOM_ICC_BUCKET_AMC] = bcm->enable_mask;
87 bcm->vote_y[QCOM_ICC_BUCKET_WAKE] = bcm->enable_mask;
91 static void bcm_aggregate(struct qcom_icc_bcm *bcm)
100 for (i = 0; i < bcm->num_nodes; i++) {
101 node = bcm->nodes[i];
102 temp = bcm_div(node->sum_avg[bucket] * bcm->aux_data.width,
106 temp = bcm_div(node->max_peak[bucket] * bcm->aux_data.width,
111 temp = agg_avg[bucket] * bcm->vote_scale;
112 bcm->vote_x[bucket] = bcm_div(temp, bcm->aux_data.unit);
114 temp = agg_peak[bucket] * bcm->vote_scale;
115 bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
118 if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
119 bcm->vote_y[QCOM_ICC_BUCKET_AMC] == 0) {
120 bcm->vote_x[QCOM_ICC_BUCKET_AMC] = 1;
121 bcm->vote_x[QCOM_ICC_BUCKET_WAKE] = 1;
122 bcm->vote_y[QCOM_ICC_BUCKET_AMC] = 1;
123 bcm->vote_y[QCOM_ICC_BUCKET_WAKE] = 1;
161 struct qcom_icc_bcm *bcm;
167 list_for_each_entry(bcm, bcm_list, list) {
170 if ((list_is_last(&bcm->list, bcm_list)) ||
171 bcm->aux_data.vcd != list_next_entry(bcm, list)->aux_data.vcd) {
178 tcs_cmd_gen(&tcs_list[idx], bcm->vote_x[bucket],
179 bcm->vote_y[bucket], bcm->addr, commit, wait);
199 * of_bcm_voter_get - gets a bcm voter handle from DT node
201 * @name: name for the bcm voter device
207 * when matching bcm voter is yet to be found.
222 idx = of_property_match_string(np, "qcom,bcm-voter-names", name);
227 node = of_parse_phandle(np, "qcom,bcm-voters", idx);
244 * qcom_icc_bcm_voter_add - queues up the bcm nodes that require updates
246 * @bcm: bcm to add to the commit and wake sleep list
248 void qcom_icc_bcm_voter_add(struct bcm_voter *voter, struct qcom_icc_bcm *bcm)
254 if (list_empty(&bcm->list))
255 list_add_tail(&bcm->list, &voter->commit_list);
257 if (list_empty(&bcm->ws_list))
258 list_add_tail(&bcm->ws_list, &voter->ws_list);
271 * through multiple commit requests and bcm nodes are removed only when the
278 struct qcom_icc_bcm *bcm;
288 list_for_each_entry(bcm, &voter->commit_list, list) {
289 if (bcm->enable_mask)
290 bcm_aggregate_mask(bcm);
292 bcm_aggregate(bcm);
322 list_for_each_entry_safe(bcm, bcm_tmp, &voter->commit_list, list)
323 list_del_init(&bcm->list);
325 list_for_each_entry_safe(bcm, bcm_tmp, &voter->ws_list, ws_list) {
331 if (bcm->vote_x[QCOM_ICC_BUCKET_WAKE] !=
332 bcm->vote_x[QCOM_ICC_BUCKET_SLEEP] ||
333 bcm->vote_y[QCOM_ICC_BUCKET_WAKE] !=
334 bcm->vote_y[QCOM_ICC_BUCKET_SLEEP])
335 list_add_tail(&bcm->list, &voter->commit_list);
337 list_del_init(&bcm->ws_list);
362 list_for_each_entry_safe(bcm, bcm_tmp, &voter->commit_list, list)
363 list_del_init(&bcm->list);
397 { .compatible = "qcom,bcm-voter" },