Lines Matching refs:path

155 	struct icc_path *path;
158 path = kzalloc(struct_size(path, reqs, num_nodes), GFP_KERNEL);
159 if (!path)
162 path->num_nodes = num_nodes;
166 hlist_add_head(&path->reqs[i].req_node, &node->req_list);
167 path->reqs[i].node = node;
168 path->reqs[i].dev = dev;
169 path->reqs[i].enabled = true;
170 /* reference to previous node was saved during path traversal */
174 return path;
180 struct icc_path *path = ERR_PTR(-EPROBE_DEFER);
207 path = ERR_PTR(-ENOENT);
238 path = path_init(dev, dst, depth);
240 return path;
244 * We want the path to honor all bandwidth requests, so the average and peak
283 static int apply_constraints(struct icc_path *path)
290 for (i = 0; i < path->num_nodes; i++) {
291 next = path->reqs[i].node;
407 struct icc_path **ptr, *path;
413 path = of_icc_get(dev, name);
414 if (!IS_ERR(path)) {
415 *ptr = path;
421 return path;
426 * of_icc_get_by_index() - get a path handle from a DT node based on index
428 * @idx: interconnect path index
430 * This function will search for a path between two endpoints and return an
442 struct icc_path *path;
455 * return a NULL path to skip setting constraints.
497 path = path_find(dev, src_data->node, dst_data->node);
499 if (IS_ERR(path)) {
500 dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path));
505 icc_set_tag(path, src_data->tag);
507 path->name = kasprintf(GFP_KERNEL, "%s-%s",
509 if (!path->name) {
510 kfree(path);
511 path = ERR_PTR(-ENOMEM);
517 return path;
522 * of_icc_get() - get a path handle from a DT node based on name
524 * @name: interconnect path name
526 * This function will search for a path between two endpoints and return an
548 * return a NULL path to skip setting constraints.
569 * icc_set_tag() - set an optional tag on a path
570 * @path: the path we want to tag
574 * with a path, so that a different aggregation could be done based on this tag.
576 void icc_set_tag(struct icc_path *path, u32 tag)
580 if (!path)
585 for (i = 0; i < path->num_nodes; i++)
586 path->reqs[i].tag = tag;
593 * icc_get_name() - Get name of the icc path
594 * @path: reference to the path returned by icc_get()
597 * path.
601 const char *icc_get_name(struct icc_path *path)
603 if (!path)
606 return path->name;
611 * icc_set_bw() - set bandwidth constraints on an interconnect path
612 * @path: reference to the path returned by icc_get()
617 * in terms of bandwidth for a previously requested path between two endpoints.
619 * path is locked by a mutex to ensure that the set() is completed.
620 * The @path can be NULL when the "interconnects" DT properties is missing,
625 int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw)
632 if (!path)
635 if (WARN_ON(IS_ERR(path) || !path->num_nodes))
640 old_avg = path->reqs[0].avg_bw;
641 old_peak = path->reqs[0].peak_bw;
643 for (i = 0; i < path->num_nodes; i++) {
644 node = path->reqs[i].node;
646 /* update the consumer request for this path */
647 path->reqs[i].avg_bw = avg_bw;
648 path->reqs[i].peak_bw = peak_bw;
653 trace_icc_set_bw(path, node, i, avg_bw, peak_bw);
656 ret = apply_constraints(path);
661 for (i = 0; i < path->num_nodes; i++) {
662 node = path->reqs[i].node;
663 path->reqs[i].avg_bw = old_avg;
664 path->reqs[i].peak_bw = old_peak;
667 apply_constraints(path);
672 trace_icc_set_bw_end(path, ret);
678 static int __icc_enable(struct icc_path *path, bool enable)
682 if (!path)
685 if (WARN_ON(IS_ERR(path) || !path->num_nodes))
690 for (i = 0; i < path->num_nodes; i++)
691 path->reqs[i].enabled = enable;
695 return icc_set_bw(path, path->reqs[0].avg_bw,
696 path->reqs[0].peak_bw);
699 int icc_enable(struct icc_path *path)
701 return __icc_enable(path, true);
705 int icc_disable(struct icc_path *path)
707 return __icc_enable(path, false);
712 * icc_get() - return a handle for path between two endpoints
713 * @dev: the device requesting the path
717 * This function will search for a path between two endpoints and return an
730 struct icc_path *path = ERR_PTR(-EPROBE_DEFER);
742 path = path_find(dev, src, dst);
743 if (IS_ERR(path)) {
744 dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path));
748 path->name = kasprintf(GFP_KERNEL, "%s-%s", src->name, dst->name);
749 if (!path->name) {
750 kfree(path);
751 path = ERR_PTR(-ENOMEM);
755 return path;
761 * @path: interconnect path
763 * Use this function to release the constraints on a path when the path is
766 void icc_put(struct icc_path *path)
772 if (!path || WARN_ON(IS_ERR(path)))
775 ret = icc_set_bw(path, 0, 0);
780 for (i = 0; i < path->num_nodes; i++) {
781 node = path->reqs[i].node;
782 hlist_del(&path->reqs[i].req_node);
788 kfree_const(path->name);
789 kfree(path);