Lines Matching full:bcm
16 #include "bcm-voter.h"
24 * @dev: reference to the device that communicates with the BCM
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) in bcm_aggregate_mask() argument
68 bcm->vote_x[bucket] = 0; in bcm_aggregate_mask()
69 bcm->vote_y[bucket] = 0; in bcm_aggregate_mask()
71 for (i = 0; i < bcm->num_nodes; i++) { in bcm_aggregate_mask()
72 node = bcm->nodes[i]; in bcm_aggregate_mask()
74 /* If any vote in this bucket exists, keep the BCM enabled */ in bcm_aggregate_mask()
76 bcm->vote_x[bucket] = 0; in bcm_aggregate_mask()
77 bcm->vote_y[bucket] = bcm->enable_mask; in bcm_aggregate_mask()
83 if (bcm->keepalive) { in bcm_aggregate_mask()
84 bcm->vote_x[QCOM_ICC_BUCKET_AMC] = bcm->enable_mask; in bcm_aggregate_mask()
85 bcm->vote_x[QCOM_ICC_BUCKET_WAKE] = bcm->enable_mask; in bcm_aggregate_mask()
86 bcm->vote_y[QCOM_ICC_BUCKET_AMC] = bcm->enable_mask; in bcm_aggregate_mask()
87 bcm->vote_y[QCOM_ICC_BUCKET_WAKE] = bcm->enable_mask; in bcm_aggregate_mask()
91 static void bcm_aggregate(struct qcom_icc_bcm *bcm) in bcm_aggregate() argument
100 for (i = 0; i < bcm->num_nodes; i++) { in bcm_aggregate()
101 node = bcm->nodes[i]; in bcm_aggregate()
102 temp = bcm_div(node->sum_avg[bucket] * bcm->aux_data.width, in bcm_aggregate()
106 temp = bcm_div(node->max_peak[bucket] * bcm->aux_data.width, in bcm_aggregate()
111 temp = agg_avg[bucket] * bcm->vote_scale; in bcm_aggregate()
112 bcm->vote_x[bucket] = bcm_div(temp, bcm->aux_data.unit); in bcm_aggregate()
114 temp = agg_peak[bucket] * bcm->vote_scale; in bcm_aggregate()
115 bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit); in bcm_aggregate()
118 if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 && in bcm_aggregate()
119 bcm->vote_y[QCOM_ICC_BUCKET_AMC] == 0) { in bcm_aggregate()
120 bcm->vote_x[QCOM_ICC_BUCKET_AMC] = 1; in bcm_aggregate()
121 bcm->vote_x[QCOM_ICC_BUCKET_WAKE] = 1; in bcm_aggregate()
122 bcm->vote_y[QCOM_ICC_BUCKET_AMC] = 1; in bcm_aggregate()
123 bcm->vote_y[QCOM_ICC_BUCKET_WAKE] = 1; in bcm_aggregate()
161 struct qcom_icc_bcm *bcm; in tcs_list_gen() local
167 list_for_each_entry(bcm, bcm_list, list) { in tcs_list_gen()
170 if ((list_is_last(&bcm->list, bcm_list)) || in tcs_list_gen()
171 bcm->aux_data.vcd != list_next_entry(bcm, list)->aux_data.vcd) { in tcs_list_gen()
178 tcs_cmd_gen(&tcs_list[idx], bcm->vote_x[bucket], in tcs_list_gen()
179 bcm->vote_y[bucket], bcm->addr, commit, wait); in tcs_list_gen()
185 * to ensure that every BCM is committed since we only set the in tcs_list_gen()
186 * commit bit on the last BCM request of every VCD. in tcs_list_gen()
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); in of_bcm_voter_get()
227 node = of_parse_phandle(np, "qcom,bcm-voters", idx); in of_bcm_voter_get()
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) in qcom_icc_bcm_voter_add() argument
254 if (list_empty(&bcm->list)) in qcom_icc_bcm_voter_add()
255 list_add_tail(&bcm->list, &voter->commit_list); in qcom_icc_bcm_voter_add()
257 if (list_empty(&bcm->ws_list)) in qcom_icc_bcm_voter_add()
258 list_add_tail(&bcm->ws_list, &voter->ws_list); in qcom_icc_bcm_voter_add()
268 * This function generates a set of AMC commands and flushes to the BCM device
271 * through multiple commit requests and bcm nodes are removed only when the
278 struct qcom_icc_bcm *bcm; in qcom_icc_bcm_voter_commit() local
288 list_for_each_entry(bcm, &voter->commit_list, list) { in qcom_icc_bcm_voter_commit()
289 if (bcm->enable_mask) in qcom_icc_bcm_voter_commit()
290 bcm_aggregate_mask(bcm); in qcom_icc_bcm_voter_commit()
292 bcm_aggregate(bcm); in qcom_icc_bcm_voter_commit()
322 list_for_each_entry_safe(bcm, bcm_tmp, &voter->commit_list, list) in qcom_icc_bcm_voter_commit()
323 list_del_init(&bcm->list); in qcom_icc_bcm_voter_commit()
325 list_for_each_entry_safe(bcm, bcm_tmp, &voter->ws_list, ws_list) { in qcom_icc_bcm_voter_commit()
331 if (bcm->vote_x[QCOM_ICC_BUCKET_WAKE] != in qcom_icc_bcm_voter_commit()
332 bcm->vote_x[QCOM_ICC_BUCKET_SLEEP] || in qcom_icc_bcm_voter_commit()
333 bcm->vote_y[QCOM_ICC_BUCKET_WAKE] != in qcom_icc_bcm_voter_commit()
334 bcm->vote_y[QCOM_ICC_BUCKET_SLEEP]) in qcom_icc_bcm_voter_commit()
335 list_add_tail(&bcm->list, &voter->commit_list); in qcom_icc_bcm_voter_commit()
337 list_del_init(&bcm->ws_list); in qcom_icc_bcm_voter_commit()
362 list_for_each_entry_safe(bcm, bcm_tmp, &voter->commit_list, list) in qcom_icc_bcm_voter_commit()
363 list_del_init(&bcm->list); in qcom_icc_bcm_voter_commit()
397 { .compatible = "qcom,bcm-voter" },
412 MODULE_DESCRIPTION("Qualcomm BCM Voter interconnect driver");