Lines Matching full:voter

16 #include "bcm-voter.h"
23 * struct bcm_voter - Bus Clock Manager voter
26 * @lock: mutex to protect commit and wake/sleep lists in the voter
156 static void tcs_list_gen(struct bcm_voter *voter, int bucket, in tcs_list_gen() argument
160 struct list_head *bcm_list = &voter->commit_list; in tcs_list_gen()
176 wait = commit && (voter->tcs_wait & BIT(bucket)); 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.
211 struct bcm_voter *voter = ERR_PTR(-EPROBE_DEFER); in of_bcm_voter_get() local
222 idx = of_property_match_string(np, "qcom,bcm-voter-names", name); in of_bcm_voter_get()
232 voter = temp; in of_bcm_voter_get()
239 return voter; in of_bcm_voter_get()
245 * @voter: voter that the bcms are being added to
248 void qcom_icc_bcm_voter_add(struct bcm_voter *voter, struct qcom_icc_bcm *bcm) in qcom_icc_bcm_voter_add() argument
250 if (!voter) in qcom_icc_bcm_voter_add()
253 mutex_lock(&voter->lock); in qcom_icc_bcm_voter_add()
255 list_add_tail(&bcm->list, &voter->commit_list); in qcom_icc_bcm_voter_add()
258 list_add_tail(&bcm->ws_list, &voter->ws_list); in qcom_icc_bcm_voter_add()
260 mutex_unlock(&voter->lock); in qcom_icc_bcm_voter_add()
266 * @voter: voter that needs flushing
269 * associated with the voter. It conditionally generate WAKE and SLEEP commands
276 int qcom_icc_bcm_voter_commit(struct bcm_voter *voter) in qcom_icc_bcm_voter_commit() argument
284 if (!voter) in qcom_icc_bcm_voter_commit()
287 mutex_lock(&voter->lock); in qcom_icc_bcm_voter_commit()
288 list_for_each_entry(bcm, &voter->commit_list, list) { in qcom_icc_bcm_voter_commit()
303 list_sort(NULL, &voter->commit_list, cmp_vcd); in qcom_icc_bcm_voter_commit()
309 tcs_list_gen(voter, QCOM_ICC_BUCKET_AMC, cmds, commit_idx); in qcom_icc_bcm_voter_commit()
313 rpmh_invalidate(voter->dev); in qcom_icc_bcm_voter_commit()
315 ret = rpmh_write_batch(voter->dev, RPMH_ACTIVE_ONLY_STATE, 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()
325 list_for_each_entry_safe(bcm, bcm_tmp, &voter->ws_list, ws_list) { in qcom_icc_bcm_voter_commit()
335 list_add_tail(&bcm->list, &voter->commit_list); in qcom_icc_bcm_voter_commit()
340 if (list_empty(&voter->commit_list)) in qcom_icc_bcm_voter_commit()
343 list_sort(NULL, &voter->commit_list, cmp_vcd); in qcom_icc_bcm_voter_commit()
345 tcs_list_gen(voter, QCOM_ICC_BUCKET_WAKE, cmds, commit_idx); in qcom_icc_bcm_voter_commit()
347 ret = rpmh_write_batch(voter->dev, RPMH_WAKE_ONLY_STATE, cmds, commit_idx); in qcom_icc_bcm_voter_commit()
353 tcs_list_gen(voter, QCOM_ICC_BUCKET_SLEEP, cmds, commit_idx); in qcom_icc_bcm_voter_commit()
355 ret = rpmh_write_batch(voter->dev, RPMH_SLEEP_STATE, cmds, commit_idx); 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()
365 mutex_unlock(&voter->lock); in qcom_icc_bcm_voter_commit()
373 struct bcm_voter *voter; in qcom_icc_bcm_voter_probe() local
375 voter = devm_kzalloc(&pdev->dev, sizeof(*voter), GFP_KERNEL); in qcom_icc_bcm_voter_probe()
376 if (!voter) in qcom_icc_bcm_voter_probe()
379 voter->dev = &pdev->dev; in qcom_icc_bcm_voter_probe()
380 voter->np = np; in qcom_icc_bcm_voter_probe()
382 if (of_property_read_u32(np, "qcom,tcs-wait", &voter->tcs_wait)) in qcom_icc_bcm_voter_probe()
383 voter->tcs_wait = QCOM_ICC_TAG_ACTIVE_ONLY; in qcom_icc_bcm_voter_probe()
385 mutex_init(&voter->lock); in qcom_icc_bcm_voter_probe()
386 INIT_LIST_HEAD(&voter->commit_list); in qcom_icc_bcm_voter_probe()
387 INIT_LIST_HEAD(&voter->ws_list); in qcom_icc_bcm_voter_probe()
390 list_add_tail(&voter->voter_node, &bcm_voters); in qcom_icc_bcm_voter_probe()
397 { .compatible = "qcom,bcm-voter" },
412 MODULE_DESCRIPTION("Qualcomm BCM Voter interconnect driver");