• Home
  • Raw
  • Download

Lines Matching +full:required +full:- +full:opps

4  * Copyright (C) 2009-2010 Texas Instruments Incorporated.
33 if (opp_table->np == np) { in _managed_opp()
36 * so will have same node-pointer, np. in _managed_opp()
38 * But the OPPs will be considered as shared only if the in _managed_opp()
39 * OPP table contains a "opp-shared" property. in _managed_opp()
41 if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) { in _managed_opp()
60 * Only required for backward compatibility with v1 bindings, but isn't in _of_init_opp_table()
63 np = of_node_get(dev->of_node); in _of_init_opp_table()
67 if (!of_property_read_u32(np, "clock-latency", &val)) in _of_init_opp_table()
68 opp_table->clock_latency_ns_max = val; in _of_init_opp_table()
69 of_property_read_u32(np, "voltage-tolerance", in _of_init_opp_table()
70 &opp_table->voltage_tolerance_v1); in _of_init_opp_table()
78 unsigned int count = opp_table->supported_hw_count; in _opp_is_supported()
82 if (!opp_table->supported_hw) { in _opp_is_supported()
85 * platform but there is an opp-supported-hw value set for in _opp_is_supported()
89 if (of_find_property(np, "opp-supported-hw", NULL)) in _opp_is_supported()
95 while (count--) { in _opp_is_supported()
96 ret = of_property_read_u32_index(np, "opp-supported-hw", count, in _opp_is_supported()
99 dev_warn(dev, "%s: failed to read opp-supported-hw property at index %d: %d\n", in _opp_is_supported()
105 if (!(version & opp_table->supported_hw[count])) in _opp_is_supported()
116 int supplies = opp_table->regulator_count, vcount, icount, ret, i, j; in opp_parse_supplies()
120 /* Search for "opp-microvolt-<name>" */ in opp_parse_supplies()
121 if (opp_table->prop_name) { in opp_parse_supplies()
122 snprintf(name, sizeof(name), "opp-microvolt-%s", in opp_parse_supplies()
123 opp_table->prop_name); in opp_parse_supplies()
124 prop = of_find_property(opp->np, name, NULL); in opp_parse_supplies()
128 /* Search for "opp-microvolt" */ in opp_parse_supplies()
129 sprintf(name, "opp-microvolt"); in opp_parse_supplies()
130 prop = of_find_property(opp->np, name, NULL); in opp_parse_supplies()
134 if (unlikely(supplies == -1)) { in opp_parse_supplies()
136 opp_table->regulator_count = 0; in opp_parse_supplies()
143 dev_err(dev, "%s: opp-microvolt missing although OPP managing regulators\n", in opp_parse_supplies()
145 return -EINVAL; in opp_parse_supplies()
149 if (unlikely(supplies == -1)) { in opp_parse_supplies()
151 supplies = opp_table->regulator_count = 1; in opp_parse_supplies()
153 dev_err(dev, "%s: opp-microvolt wasn't expected\n", __func__); in opp_parse_supplies()
154 return -EINVAL; in opp_parse_supplies()
157 vcount = of_property_count_u32_elems(opp->np, name); in opp_parse_supplies()
168 return -EINVAL; in opp_parse_supplies()
173 return -ENOMEM; in opp_parse_supplies()
175 ret = of_property_read_u32_array(opp->np, name, microvolt, vcount); in opp_parse_supplies()
178 ret = -EINVAL; in opp_parse_supplies()
182 /* Search for "opp-microamp-<name>" */ in opp_parse_supplies()
184 if (opp_table->prop_name) { in opp_parse_supplies()
185 snprintf(name, sizeof(name), "opp-microamp-%s", in opp_parse_supplies()
186 opp_table->prop_name); in opp_parse_supplies()
187 prop = of_find_property(opp->np, name, NULL); in opp_parse_supplies()
191 /* Search for "opp-microamp" */ in opp_parse_supplies()
192 sprintf(name, "opp-microamp"); in opp_parse_supplies()
193 prop = of_find_property(opp->np, name, NULL); in opp_parse_supplies()
197 icount = of_property_count_u32_elems(opp->np, name); in opp_parse_supplies()
208 ret = -EINVAL; in opp_parse_supplies()
214 ret = -EINVAL; in opp_parse_supplies()
218 ret = of_property_read_u32_array(opp->np, name, microamp, in opp_parse_supplies()
223 ret = -EINVAL; in opp_parse_supplies()
229 opp->supplies[i].u_volt = microvolt[j++]; in opp_parse_supplies()
232 opp->supplies[i].u_volt_min = opp->supplies[i].u_volt; in opp_parse_supplies()
233 opp->supplies[i].u_volt_max = opp->supplies[i].u_volt; in opp_parse_supplies()
235 opp->supplies[i].u_volt_min = microvolt[j++]; in opp_parse_supplies()
236 opp->supplies[i].u_volt_max = microvolt[j++]; in opp_parse_supplies()
240 opp->supplies[i].u_amp = microamp[i]; in opp_parse_supplies()
252 * dev_pm_opp_of_remove_table() - Free OPP table entries created from static DT
256 * Free OPPs created using static entries present in DT.
269 /* "operating-points-v2" can be an array for power domain providers */ in _opp_of_get_opp_desc_node()
270 return of_parse_phandle(np, "operating-points-v2", index); in _opp_of_get_opp_desc_node()
276 return _opp_of_get_opp_desc_node(dev->of_node, 0); in dev_pm_opp_of_get_opp_desc_node()
281 * _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings)
292 * Duplicate OPPs (both freq and volt are same) and opp->available
293 * -EEXIST Freq are same and volt are different OR
294 * Duplicate OPPs (both freq and volt are same) and !opp->available
295 * -ENOMEM Memory allocation failure
296 * -EINVAL Failed parsing the OPP node
309 return -ENOMEM; in _opp_add_static_v2()
311 ret = of_property_read_u64(np, "opp-hz", &rate); in _opp_add_static_v2()
313 /* "opp-hz" is optional for devices like power domains. */ in _opp_add_static_v2()
314 if (!of_find_property(dev->of_node, "#power-domain-cells", in _opp_add_static_v2()
316 dev_err(dev, "%s: opp-hz not found\n", __func__); in _opp_add_static_v2()
327 new_opp->rate = (unsigned long)rate; in _opp_add_static_v2()
336 new_opp->turbo = of_property_read_bool(np, "turbo-mode"); in _opp_add_static_v2()
338 new_opp->np = np; in _opp_add_static_v2()
339 new_opp->dynamic = false; in _opp_add_static_v2()
340 new_opp->available = true; in _opp_add_static_v2()
342 if (!of_property_read_u32(np, "clock-latency-ns", &val)) in _opp_add_static_v2()
343 new_opp->clock_latency_ns = val; in _opp_add_static_v2()
345 new_opp->pstate = of_genpd_opp_to_performance_state(dev, np); in _opp_add_static_v2()
353 /* Don't return error for duplicate OPPs */ in _opp_add_static_v2()
354 if (ret == -EBUSY) in _opp_add_static_v2()
360 if (of_property_read_bool(np, "opp-suspend")) { in _opp_add_static_v2()
361 if (opp_table->suspend_opp) { in _opp_add_static_v2()
362 dev_warn(dev, "%s: Multiple suspend OPPs found (%lu %lu)\n", in _opp_add_static_v2()
363 __func__, opp_table->suspend_opp->rate, in _opp_add_static_v2()
364 new_opp->rate); in _opp_add_static_v2()
366 new_opp->suspend = true; in _opp_add_static_v2()
367 opp_table->suspend_opp = new_opp; in _opp_add_static_v2()
371 if (new_opp->clock_latency_ns > opp_table->clock_latency_ns_max) in _opp_add_static_v2()
372 opp_table->clock_latency_ns_max = new_opp->clock_latency_ns; in _opp_add_static_v2()
375 __func__, new_opp->turbo, new_opp->rate, in _opp_add_static_v2()
376 new_opp->supplies[0].u_volt, new_opp->supplies[0].u_volt_min, in _opp_add_static_v2()
377 new_opp->supplies[0].u_volt_max, new_opp->clock_latency_ns); in _opp_add_static_v2()
383 blocking_notifier_call_chain(&opp_table->head, OPP_EVENT_ADD, new_opp); in _opp_add_static_v2()
402 /* OPPs are already managed */ in _of_add_opp_table_v2()
404 ret = -ENOMEM; in _of_add_opp_table_v2()
410 return -ENOMEM; in _of_add_opp_table_v2()
412 /* We have opp-table node now, iterate over it and add OPPs */ in _of_add_opp_table_v2()
428 ret = -ENOENT; in _of_add_opp_table_v2()
432 list_for_each_entry(opp, &opp_table->opp_list, node) in _of_add_opp_table_v2()
433 pstate_count += !!opp->pstate; in _of_add_opp_table_v2()
439 ret = -ENOENT; in _of_add_opp_table_v2()
445 opp_table->genpd_performance_state = true; in _of_add_opp_table_v2()
447 opp_table->np = opp_np; in _of_add_opp_table_v2()
448 if (of_property_read_bool(opp_np, "opp-shared")) in _of_add_opp_table_v2()
449 opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED; in _of_add_opp_table_v2()
451 opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE; in _of_add_opp_table_v2()
459 /* Initializes OPP tables based on old-deprecated bindings */
467 prop = of_find_property(dev->of_node, "operating-points", NULL); in _of_add_opp_table_v1()
469 return -ENODEV; in _of_add_opp_table_v1()
470 if (!prop->value) in _of_add_opp_table_v1()
471 return -ENODATA; in _of_add_opp_table_v1()
475 * voltage like <freq-kHz vol-uV>. in _of_add_opp_table_v1()
477 nr = prop->length / sizeof(u32); in _of_add_opp_table_v1()
480 return -EINVAL; in _of_add_opp_table_v1()
485 return -ENOMEM; in _of_add_opp_table_v1()
487 val = prop->value; in _of_add_opp_table_v1()
499 nr -= 2; in _of_add_opp_table_v1()
507 * dev_pm_opp_of_add_table() - Initialize opp table from device tree
514 * Duplicate OPPs (both freq and volt are same) and opp->available
515 * -EEXIST Freq are same and volt are different OR
516 * Duplicate OPPs (both freq and volt are same) and !opp->available
517 * -ENOMEM Memory allocation failure
518 * -ENODEV when 'operating-points' property is not found or is invalid data
520 * -ENODATA when empty 'operating-points' property is found
521 * -EINVAL when invalid entries are found in opp-v2 table
529 * OPPs have two version of bindings now. The older one is deprecated, in dev_pm_opp_of_add_table()
535 * Try old-deprecated bindings for backward compatibility with in dev_pm_opp_of_add_table()
549 * dev_pm_opp_of_add_table_indexed() - Initialize indexed opp table from device tree
554 * using the "operating-points-v2" property.
558 * Duplicate OPPs (both freq and volt are same) and opp->available
559 * -EEXIST Freq are same and volt are different OR
560 * Duplicate OPPs (both freq and volt are same) and !opp->available
561 * -ENOMEM Memory allocation failure
562 * -ENODEV when 'operating-points' property is not found or is invalid data
564 * -ENODATA when empty 'operating-points' property is found
565 * -EINVAL when invalid entries are found in opp-v2 table
573 opp_np = _opp_of_get_opp_desc_node(dev->of_node, index); in dev_pm_opp_of_add_table_indexed()
579 count = of_count_phandle_with_args(dev->of_node, in dev_pm_opp_of_add_table_indexed()
580 "operating-points-v2", NULL); in dev_pm_opp_of_add_table_indexed()
586 return -ENODEV; in dev_pm_opp_of_add_table_indexed()
599 * dev_pm_opp_of_cpumask_remove_table() - Removes OPP table for @cpumask
612 * dev_pm_opp_of_cpumask_add_table() - Adds OPP table for @cpumask
641 /* Free all other OPPs */ in dev_pm_opp_of_cpumask_add_table()
654 * Returns -ENOENT if operating-points-v2 bindings aren't supported.
657 * dev_pm_opp_of_get_sharing_cpus() - Get cpumask of CPUs sharing OPPs with
658 * @cpu_dev using operating-points-v2
664 * This updates the @cpumask with CPUs that are sharing OPPs with @cpu_dev.
666 * Returns -ENOENT if operating-points-v2 isn't present for @cpu_dev.
678 return -ENOENT; in dev_pm_opp_of_get_sharing_cpus()
681 cpumask_set_cpu(cpu_dev->id, cpumask); in dev_pm_opp_of_get_sharing_cpus()
683 /* OPPs are shared ? */ in dev_pm_opp_of_get_sharing_cpus()
684 if (!of_property_read_bool(np, "opp-shared")) in dev_pm_opp_of_get_sharing_cpus()
688 if (cpu == cpu_dev->id) in dev_pm_opp_of_get_sharing_cpus()
695 ret = -ENOENT; in dev_pm_opp_of_get_sharing_cpus()
704 ret = -ENOENT; in dev_pm_opp_of_get_sharing_cpus()
722 * of_dev_pm_opp_find_required_opp() - Search for required OPP.
724 * @np: Node that contains the "required-opps" property.
727 * node. Although the "required-opps" property supports having multiple
733 * The callers are required to call dev_pm_opp_put() for the returned OPP after
739 struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ENODEV); in of_dev_pm_opp_find_required_opp()
747 required_np = of_parse_phandle(np, "required-opps", 0); in of_dev_pm_opp_find_required_opp()
749 dev_err(dev, "Unable to parse required-opps\n"); in of_dev_pm_opp_find_required_opp()
753 mutex_lock(&opp_table->lock); in of_dev_pm_opp_find_required_opp()
755 list_for_each_entry(temp_opp, &opp_table->opp_list, node) { in of_dev_pm_opp_find_required_opp()
756 if (temp_opp->available && temp_opp->np == required_np) { in of_dev_pm_opp_find_required_opp()
765 mutex_unlock(&opp_table->lock); in of_dev_pm_opp_find_required_opp()
776 * dev_pm_opp_get_of_node() - Gets the DT node corresponding to an opp
790 return of_node_get(opp->np); in dev_pm_opp_get_of_node()