Lines Matching refs:parent
63 struct clk_core *parent;
249 * context. If the parent isn't enabled already, we can't do
252 if ((core->flags & CLK_OPS_PARENT_ENABLE) && core->parent)
253 if (!clk_core_is_enabled(core->parent)) {
294 return hw->core->parent ? hw->core->parent->hw : NULL;
361 * clk_core_get - Find the clk_core parent of a clk
362 * @core: clk to find parent of
363 * @p_index: parent index to search for
365 * This is the preferred method for clk providers to find the parent of a
366 * clk when that parent is external to the clk controller. The parent_names
370 * namespace instead of looking for a globally unique parent string.
378 * parent: clock-controller@f00abcd {
385 * clocks = <&parent>;
430 struct clk_core *parent;
433 parent = entry->hw->core;
435 parent = clk_core_get(core, index);
436 if (PTR_ERR(parent) == -ENOENT && entry->name)
437 parent = clk_core_lookup(entry->name);
443 * when the parent is registered.
445 if (!parent)
446 parent = ERR_PTR(-EPROBE_DEFER);
449 if (!IS_ERR(parent))
450 entry->core = parent;
468 struct clk_core *parent;
470 parent = clk_core_get_parent_by_index(hw->core, index);
472 return !parent ? NULL : parent->hw;
486 if (!core->num_parents || core->parent)
490 * Clk must have a parent because num_parents > 0 but the parent isn't
492 * properly recalc the rate based on the parent's rate.
560 static bool clk_core_has_parent(struct clk_core *core, const struct clk_core *parent)
565 /* Optimize for the case where the parent is already the parent. */
566 if (core->parent == parent)
574 if (tmp == parent)
584 struct clk_core *parent,
588 if (WARN_ON(!clk_core_has_parent(core, parent)))
591 clk_core_init_rate_req(parent, req, parent_rate);
605 struct clk_core *parent = core->parent;
612 if (!parent) {
617 clk_core_forward_rate_req(core, req, parent, &parent_req,
622 ret = clk_core_round_rate_nolock(parent, &parent_req);
629 } else if (parent) {
630 best = clk_core_get_rate_nolock(parent);
645 struct clk_core *core = hw->core, *parent, *best_parent = NULL;
649 /* if NO_REPARENT flag set, pass through to current parent */
653 /* find the parent that can provide the fastest rate <= rate */
658 parent = clk_core_get_parent_by_index(core, i);
659 if (!parent)
665 clk_core_forward_rate_req(core, req, parent, &parent_req, req->rate);
669 ret = clk_core_round_rate_nolock(parent, &parent_req);
677 parent_rate = clk_core_get_rate_nolock(parent);
682 best_parent = parent;
768 * @req: rate request, also used to return preferred parent and frequencies
770 * Helper for finding best parent to provide a given frequency. This can be used
795 * Helper for finding best parent rate to provide a given frequency.
825 clk_core_rate_unprotect(core->parent);
855 * further up the parent chain of clocks. As a result, clocks up parent chain
894 clk_core_rate_protect(core->parent);
921 * further up the parent chain of clocks. As a result, clocks up parent chain
974 clk_core_unprepare(core->parent);
1019 ret = clk_core_prepare(core->parent);
1048 clk_core_unprepare(core->parent);
1110 clk_core_disable(core->parent);
1157 ret = clk_core_enable(core->parent);
1170 clk_core_disable(core->parent);
1391 clk_core_prepare_enable(core->parent);
1423 clk_core_disable_unprepare(core->parent);
1517 struct clk_core *parent;
1532 parent = core->parent;
1533 if (parent) {
1534 req->best_parent_hw = parent->hw;
1535 req->best_parent_rate = parent->rate;
1563 * clk_hw_forward_rate_request - Forwards a clk_rate_request to a clock's parent
1566 * @parent: the clk we want to forward @old_req to
1568 * @parent_rate: The rate which is to be requested to @parent
1570 * Initializes a clk_rate_request structure to submit to a clock parent
1575 const struct clk_hw *parent,
1579 if (WARN_ON(!hw || !old_req || !parent || !req))
1583 parent->core, req,
1611 clk_core_forward_rate_req(core, req, core->parent, &parent_req, req->rate);
1615 ret = clk_core_round_rate_nolock(core->parent, &parent_req);
1662 * else returns the parent rate.
1690 * then the parent rate is returned.
1769 * parent.
1778 if (core->parent)
1779 parent_accuracy = core->parent->accuracy;
1843 * it is assumed that the clock will take on the rate of its parent.
1859 if (core->parent)
1860 parent_rate = core->parent->rate;
1910 struct clk_core *parent)
1914 if (!parent)
1919 if (core->parents[i].core == parent)
1928 if (core->parents[i].hw == parent->hw)
1936 if (parent == clk_core_get(core, i))
1941 !strcmp(parent->name, core->parents[i].name))
1948 core->parents[i].core = parent;
1953 * clk_hw_get_parent_index - return the index of the parent clock
1956 * Fetches and returns the index of parent clock. Returns -EINVAL if the given
1957 * clock does not have a current parent.
1961 struct clk_hw *parent = clk_hw_get_parent(hw);
1963 if (WARN_ON(parent == NULL))
1966 return clk_fetch_parent_index(hw->core, parent->core);
2006 core->parent = new_parent;
2010 struct clk_core *parent)
2013 struct clk_core *old_parent = core->parent;
2027 * parent and also protect against a race with clk_enable() by
2028 * forcing the clock and the new parent on. This ensures that all
2035 /* enable old_parent & parent if CLK_OPS_PARENT_ENABLE is set */
2038 clk_core_prepare_enable(parent);
2043 clk_core_prepare_enable(parent);
2049 clk_reparent(core, parent);
2056 struct clk_core *parent,
2070 clk_core_disable_unprepare(parent);
2075 static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
2082 old_parent = __clk_set_parent_before(core, parent);
2084 trace_clk_set_parent(core, parent);
2087 if (parent && core->ops->set_parent)
2090 trace_clk_set_parent_complete(core, parent);
2097 __clk_set_parent_after(core, old_parent, parent);
2102 __clk_set_parent_after(core, parent, old_parent);
2110 * @parent_rate: the "future" rate of clk's parent
2119 * take on the rate of its parent.
2160 /* include clk in new parent's PRE_RATE_CHANGE notifications */
2162 if (new_parent && new_parent != core->parent)
2179 struct clk_core *old_parent, *parent;
2191 /* save parent rate, if it exists */
2192 parent = old_parent = core->parent;
2193 if (parent)
2194 best_parent_rate = parent->rate;
2198 /* find the closest rate and parent clk/rate */
2214 parent = req.best_parent_hw ? req.best_parent_hw->core : NULL;
2218 } else if (!parent || !(core->flags & CLK_SET_RATE_PARENT)) {
2219 /* pass-through clock without adjustable parent */
2223 /* pass-through clock with adjustable parent */
2224 top = clk_calc_new_rates(parent, rate);
2225 new_rate = parent->new_rate;
2229 /* some clocks must be gated to change parent */
2230 if (parent != old_parent &&
2237 /* try finding the new parent index */
2238 if (parent && core->num_parents > 1) {
2239 p_index = clk_fetch_parent_index(core, parent);
2241 pr_debug("%s: clk %s can not be parent of clk %s\n",
2242 __func__, parent->name, core->name);
2247 if ((core->flags & CLK_SET_RATE_PARENT) && parent &&
2248 best_parent_rate != parent->rate)
2249 top = clk_calc_new_rates(parent, best_parent_rate);
2252 clk_calc_subtree(core, new_rate, parent, p_index);
2308 struct clk_core *parent = NULL;
2313 parent = core->new_parent;
2315 } else if (core->parent) {
2316 parent = core->parent;
2317 best_parent_rate = core->parent->rate;
2328 if (core->new_parent && core->new_parent != core->parent) {
2346 clk_core_prepare_enable(parent);
2363 clk_core_disable_unprepare(parent);
2476 * propagate up to clk's parent; whether or not this happens depends on the
2478 * after calling .round_rate then upstream parent propagation is ignored. If
2479 * *parent_rate comes back with a new rate for clk's parent then we propagate
2480 * up to clk's parent and set its rate. Upward propagation will continue
2693 * clk_get_parent - return the parent of a clk
2694 * @clk: the clk whose parent gets returned
2696 * Simply returns clk->parent. Returns NULL if clk is NULL.
2700 struct clk *parent;
2707 parent = !clk->core->parent ? NULL : clk->core->parent->hw->clk;
2710 return parent;
2741 * clk_has_parent - check if a clock is a possible parent for another
2743 * @parent: parent clock source
2746 * the parent of another without actually changing the parent.
2748 * Returns true if @parent is a possible parent for @clk, false otherwise.
2750 bool clk_has_parent(const struct clk *clk, const struct clk *parent)
2753 if (!clk || !parent)
2756 return clk_core_has_parent(clk->core, parent->core);
2761 struct clk_core *parent)
2772 if (core->parent == parent)
2775 /* verify ops for multi-parent clks */
2779 /* check that we are allowed to re-parent if the clock is in use */
2786 /* try finding the new parent index */
2787 if (parent) {
2788 p_index = clk_fetch_parent_index(core, parent);
2790 pr_debug("%s: clk %s can not be parent of clk %s\n",
2791 __func__, parent->name, core->name);
2794 p_rate = parent->rate;
2808 /* do the re-parent */
2809 ret = __clk_set_parent(core, parent, p_index);
2825 int clk_hw_set_parent(struct clk_hw *hw, struct clk_hw *parent)
2827 return clk_core_set_parent_nolock(hw->core, parent->core);
2832 * clk_set_parent - switch the parent of a mux clk
2834 * @parent: the new input to clk
2836 * Re-parent clk to use parent as its new input source. If clk is in
2842 * After successfully changing clk's parent clk_set_parent will update the
2848 int clk_set_parent(struct clk *clk, struct clk *parent)
2861 parent ? parent->core : NULL);
2914 * clock accuracy. A parent clock phase attribute does not have an
3021 if (core->parent &&
3023 ret = clk_core_update_duty_cycle_nolock(core->parent);
3024 memcpy(&core->duty, &core->parent->duty, sizeof(core->duty));
3064 if (core->parent &&
3066 ret = clk_core_set_duty_cycle_nolock(core->parent, duty);
3067 memcpy(&core->duty, &core->parent->duty, sizeof(core->duty));
3421 struct clk_core *parent;
3425 * Go through the following options to fetch a parent's name.
3427 * 1. Fetch the registered parent clock and use its name
3430 * 4. Fetch parent clock's clock-output-name if DT index was set
3432 * This may still fail in some cases, such as when the parent is
3436 parent = clk_core_get_parent_by_index(core, i);
3437 if (parent) {
3438 seq_puts(s, parent->name);
3473 if (core->parent)
3474 seq_printf(s, "%s\n", core->parent->name);
3486 struct clk_core *parent;
3494 parent = clk_core_get_parent_by_index(core, idx);
3495 if (!parent)
3499 err = clk_core_set_parent_nolock(core, parent);
3654 pr_warn("** such as parent or rate setting, enabling, disabling, etc. **\n");
3699 * parent.
3702 struct clk_core *parent = __clk_init_parent(orphan);
3708 * are enabled during init but might not have a parent yet.
3710 if (parent) {
3712 __clk_set_parent_before(orphan, parent);
3713 __clk_set_parent_after(orphan, parent, NULL);
3738 * parent and rate and sets them both.
3743 struct clk_core *parent;
3753 * that clks aren't parented until their parent is fully registered.
3817 * such as rate, parent, etc ...
3828 parent = core->parent = __clk_init_parent(core);
3831 * Populate core->parent if parent has already been clk_core_init'd. If
3832 * parent has not yet been clk_core_init'd then place clk in the orphan
3837 * clocks and re-parent any that are children of the clock currently
3840 if (parent) {
3841 hlist_add_head(&core->child_node, &parent->children);
3842 core->orphan = parent->orphan;
3854 * fallback is to use the parent's accuracy. If a clock doesn't have a
3855 * parent (or is orphaned) then accuracy is set to zero (perfect
3860 clk_core_get_accuracy_no_lock(parent));
3861 else if (parent)
3862 core->accuracy = parent->accuracy;
3868 * Since a phase is by definition relative to its parent, just
3887 * parent's rate. If a clock doesn't have a parent (or is orphaned)
3892 clk_core_get_rate_nolock(parent));
3893 else if (parent)
3894 rate = parent->rate;
4083 struct clk_parent_map *parents, *parent;
4098 for (i = 0, parent = parents; i < num_parents; i++, parent++) {
4099 parent->index = -1;
4105 ret = clk_cpy_name(&parent->name, parent_names[i],
4108 parent->hw = parent_data[i].hw;
4109 parent->index = parent_data[i].index;
4110 ret = clk_cpy_name(&parent->fw_name,
4113 ret = clk_cpy_name(&parent->name,
4117 parent->hw = parent_hws[i];
4237 * dev_or_parent_of_node() - Get device node of @dev or @dev's parent
4241 * @dev->parent if dev doesn't have a device node, or NULL if neither
4242 * @dev or @dev->parent have a device node.
4253 np = dev_of_node(dev->parent);
4379 /* Remove this clk from all parent caches */
4927 * We allow a child device to use its parent device as the clock provider node
4936 parent_np = dev->parent ? dev->parent->of_node : NULL;
4953 * then the parent device's node is scanned for this information. If parent node
5071 * No matching clock found on this node. If the parent node
5075 np = np->parent;
5293 * This function looks for a parent clock. If there is one, then it
5294 * checks that the provider for this parent clock was initialized, in
5295 * this case the parent clock will be ready.
5304 /* this parent is ready we can check the next one */
5311 /* at least one parent is not ready, we exit now */
5318 * no more parent. As we didn't exit yet, then the
5319 * previous parent are ready. If there is no clock
5320 * parent, no need to wait for them, then we can
5384 struct clock_provider *parent;
5389 parent = kzalloc(sizeof(*parent), GFP_KERNEL);
5390 if (!parent) {
5401 parent->clk_init_cb = match->data;
5402 parent->np = of_node_get(np);
5403 list_add_tail(&parent->node, &clk_provider_list);
5430 * in case the clock parent was not mandatory