Lines Matching +full:opp +full:- +full:shared
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Generic OPP OF helpers
5 * Copyright (C) 2009-2010 Texas Instruments Incorporated.
22 #include "opp.h"
25 * Returns opp descriptor node for a device node, caller must
31 /* "operating-points-v2" can be an array for power domain providers */ in _opp_of_get_opp_desc_node()
32 return of_parse_phandle(np, "operating-points-v2", index); in _opp_of_get_opp_desc_node()
35 /* Returns opp descriptor node for a device, caller must do of_node_put() */
38 return _opp_of_get_opp_desc_node(dev->of_node, 0); in dev_pm_opp_of_get_opp_desc_node()
47 np = _opp_of_get_opp_desc_node(dev->of_node, index); in _managed_opp()
52 if (opp_table->np == np) { in _managed_opp()
54 * Multiple devices can point to the same OPP table and in _managed_opp()
55 * so will have same node-pointer, np. in _managed_opp()
57 * But the OPPs will be considered as shared only if the in _managed_opp()
58 * OPP table contains a "opp-shared" property. in _managed_opp()
60 if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) { in _managed_opp()
74 /* The caller must call dev_pm_opp_put() after the OPP is used */
78 struct dev_pm_opp *opp; in _find_opp_of_np() local
80 mutex_lock(&opp_table->lock); in _find_opp_of_np()
82 list_for_each_entry(opp, &opp_table->opp_list, node) { in _find_opp_of_np()
83 if (opp->np == opp_np) { in _find_opp_of_np()
84 dev_pm_opp_get(opp); in _find_opp_of_np()
85 mutex_unlock(&opp_table->lock); in _find_opp_of_np()
86 return opp; in _find_opp_of_np()
90 mutex_unlock(&opp_table->lock); in _find_opp_of_np()
98 return of_parse_phandle(np, "required-opps", index); in of_parse_required_opp()
117 if (opp_table_np == opp_table->np) { in _find_table_of_opp_np()
124 return ERR_PTR(-ENODEV); in _find_table_of_opp_np()
130 struct opp_table **required_opp_tables = opp_table->required_opp_tables; in _opp_table_free_required_tables()
136 for (i = 0; i < opp_table->required_opp_count; i++) { in _opp_table_free_required_tables()
145 opp_table->required_opp_count = 0; in _opp_table_free_required_tables()
146 opp_table->required_opp_tables = NULL; in _opp_table_free_required_tables()
150 * Populate all devices and opp tables which are part of "required-opps" list.
151 * Checking only the first OPP node should be enough.
161 /* Traversing the first OPP node is all we need */ in _opp_table_alloc_required_tables()
164 dev_err(dev, "Empty OPP table\n"); in _opp_table_alloc_required_tables()
168 count = of_count_phandle_with_args(np, "required-opps", NULL); in _opp_table_alloc_required_tables()
177 opp_table->required_opp_tables = required_opp_tables; in _opp_table_alloc_required_tables()
178 opp_table->required_opp_count = count; in _opp_table_alloc_required_tables()
192 * We only support genpd's OPPs in the "required-opps" for now, in _opp_table_alloc_required_tables()
194 * required OPP doesn't belong to a genpd. in _opp_table_alloc_required_tables()
196 if (!required_opp_tables[i]->is_genpd) { in _opp_table_alloc_required_tables()
197 dev_err(dev, "required-opp doesn't belong to genpd: %pOF\n", in _opp_table_alloc_required_tables()
221 np = of_node_get(dev->of_node); in _of_init_opp_table()
225 if (!of_property_read_u32(np, "clock-latency", &val)) in _of_init_opp_table()
226 opp_table->clock_latency_ns_max = val; in _of_init_opp_table()
227 of_property_read_u32(np, "voltage-tolerance", in _of_init_opp_table()
228 &opp_table->voltage_tolerance_v1); in _of_init_opp_table()
230 if (of_find_property(np, "#power-domain-cells", NULL)) in _of_init_opp_table()
231 opp_table->is_genpd = true; in _of_init_opp_table()
233 /* Get OPP table node */ in _of_init_opp_table()
240 if (of_property_read_bool(opp_np, "opp-shared")) in _of_init_opp_table()
241 opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED; in _of_init_opp_table()
243 opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE; in _of_init_opp_table()
245 opp_table->np = opp_np; in _of_init_opp_table()
261 struct dev_pm_opp *opp) in _of_opp_free_required_opps() argument
263 struct dev_pm_opp **required_opps = opp->required_opps; in _of_opp_free_required_opps()
269 for (i = 0; i < opp_table->required_opp_count; i++) { in _of_opp_free_required_opps()
278 opp->required_opps = NULL; in _of_opp_free_required_opps()
281 /* Populate all required OPPs which are part of "required-opps" list */
283 struct dev_pm_opp *opp) in _of_opp_alloc_required_opps() argument
288 int i, ret, count = opp_table->required_opp_count; in _of_opp_alloc_required_opps()
295 return -ENOMEM; in _of_opp_alloc_required_opps()
297 opp->required_opps = required_opps; in _of_opp_alloc_required_opps()
300 required_table = opp_table->required_opp_tables[i]; in _of_opp_alloc_required_opps()
302 np = of_parse_required_opp(opp->np, i); in _of_opp_alloc_required_opps()
304 ret = -ENODEV; in _of_opp_alloc_required_opps()
312 pr_err("%s: Unable to find required OPP node: %pOF (%d)\n", in _of_opp_alloc_required_opps()
313 __func__, opp->np, i); in _of_opp_alloc_required_opps()
314 ret = -ENODEV; in _of_opp_alloc_required_opps()
322 _of_opp_free_required_opps(opp_table, opp); in _of_opp_alloc_required_opps()
333 np = of_node_get(dev->of_node); in _bandwidth_supported()
335 return -ENODEV; in _bandwidth_supported()
340 opp_np = of_node_get(opp_table->np); in _bandwidth_supported()
343 /* Lets not fail in case we are parsing opp-v1 bindings */ in _bandwidth_supported()
347 /* Checking only first OPP is sufficient */ in _bandwidth_supported()
350 dev_err(dev, "OPP table empty\n"); in _bandwidth_supported()
351 return -EINVAL; in _bandwidth_supported()
355 prop = of_find_property(np, "opp-peak-kBps", NULL); in _bandwidth_supported()
358 if (!prop || !prop->length) in _bandwidth_supported()
377 np = of_node_get(dev->of_node); in dev_pm_opp_of_find_icc_paths()
382 "#interconnect-cells"); in dev_pm_opp_of_find_icc_paths()
387 /* two phandles when #interconnect-cells = <1> */ in dev_pm_opp_of_find_icc_paths()
390 return -EINVAL; in dev_pm_opp_of_find_icc_paths()
396 return -ENOMEM; in dev_pm_opp_of_find_icc_paths()
402 if (ret != -EPROBE_DEFER) { in dev_pm_opp_of_find_icc_paths()
411 opp_table->paths = paths; in dev_pm_opp_of_find_icc_paths()
412 opp_table->path_count = num_paths; in dev_pm_opp_of_find_icc_paths()
417 while (i--) in dev_pm_opp_of_find_icc_paths()
429 unsigned int levels = opp_table->supported_hw_count; in _opp_is_supported()
433 if (!opp_table->supported_hw) { in _opp_is_supported()
436 * platform but there is an opp-supported-hw value set for in _opp_is_supported()
437 * an OPP then the OPP should not be enabled as there is in _opp_is_supported()
440 if (of_find_property(np, "opp-supported-hw", NULL)) in _opp_is_supported()
446 count = of_property_count_u32_elems(np, "opp-supported-hw"); in _opp_is_supported()
448 dev_err(dev, "%s: Invalid opp-supported-hw property (%d)\n", in _opp_is_supported()
460 ret = of_property_read_u32_index(np, "opp-supported-hw", in _opp_is_supported()
463 dev_warn(dev, "%s: failed to read opp-supported-hw property at index %d: %d\n", in _opp_is_supported()
469 if (!(val & opp_table->supported_hw[j])) { in _opp_is_supported()
482 static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, in opp_parse_supplies() argument
486 int supplies = opp_table->regulator_count, vcount, icount, ret, i, j; in opp_parse_supplies()
490 /* Search for "opp-microvolt-<name>" */ in opp_parse_supplies()
491 if (opp_table->prop_name) { in opp_parse_supplies()
492 snprintf(name, sizeof(name), "opp-microvolt-%s", in opp_parse_supplies()
493 opp_table->prop_name); in opp_parse_supplies()
494 prop = of_find_property(opp->np, name, NULL); in opp_parse_supplies()
498 /* Search for "opp-microvolt" */ in opp_parse_supplies()
499 sprintf(name, "opp-microvolt"); in opp_parse_supplies()
500 prop = of_find_property(opp->np, name, NULL); in opp_parse_supplies()
504 if (unlikely(supplies == -1)) { in opp_parse_supplies()
506 opp_table->regulator_count = 0; in opp_parse_supplies()
513 dev_err(dev, "%s: opp-microvolt missing although OPP managing regulators\n", in opp_parse_supplies()
515 return -EINVAL; in opp_parse_supplies()
519 if (unlikely(supplies == -1)) { in opp_parse_supplies()
521 supplies = opp_table->regulator_count = 1; in opp_parse_supplies()
523 dev_err(dev, "%s: opp-microvolt wasn't expected\n", __func__); in opp_parse_supplies()
524 return -EINVAL; in opp_parse_supplies()
527 vcount = of_property_count_u32_elems(opp->np, name); in opp_parse_supplies()
538 return -EINVAL; in opp_parse_supplies()
543 return -ENOMEM; in opp_parse_supplies()
545 ret = of_property_read_u32_array(opp->np, name, microvolt, vcount); in opp_parse_supplies()
548 ret = -EINVAL; in opp_parse_supplies()
552 /* Search for "opp-microamp-<name>" */ in opp_parse_supplies()
554 if (opp_table->prop_name) { in opp_parse_supplies()
555 snprintf(name, sizeof(name), "opp-microamp-%s", in opp_parse_supplies()
556 opp_table->prop_name); in opp_parse_supplies()
557 prop = of_find_property(opp->np, name, NULL); in opp_parse_supplies()
561 /* Search for "opp-microamp" */ in opp_parse_supplies()
562 sprintf(name, "opp-microamp"); in opp_parse_supplies()
563 prop = of_find_property(opp->np, name, NULL); in opp_parse_supplies()
567 icount = of_property_count_u32_elems(opp->np, name); in opp_parse_supplies()
578 ret = -EINVAL; in opp_parse_supplies()
584 ret = -EINVAL; in opp_parse_supplies()
588 ret = of_property_read_u32_array(opp->np, name, microamp, in opp_parse_supplies()
593 ret = -EINVAL; in opp_parse_supplies()
599 opp->supplies[i].u_volt = microvolt[j++]; in opp_parse_supplies()
602 opp->supplies[i].u_volt_min = opp->supplies[i].u_volt; in opp_parse_supplies()
603 opp->supplies[i].u_volt_max = opp->supplies[i].u_volt; in opp_parse_supplies()
605 opp->supplies[i].u_volt_min = microvolt[j++]; in opp_parse_supplies()
606 opp->supplies[i].u_volt_max = microvolt[j++]; in opp_parse_supplies()
610 opp->supplies[i].u_amp = microamp[i]; in opp_parse_supplies()
622 * dev_pm_opp_of_remove_table() - Free OPP table entries created from static DT
624 * @dev: device pointer used to lookup OPP table.
637 const char *name = peak ? "opp-peak-kBps" : "opp-avg-kBps"; in _read_bw()
644 return -ENODEV; in _read_bw()
646 count = prop->length / sizeof(u32); in _read_bw()
647 if (table->path_count != count) { in _read_bw()
649 __func__, name, count, table->path_count); in _read_bw()
650 return -EINVAL; in _read_bw()
655 return -ENOMEM; in _read_bw()
665 new_opp->bandwidth[i].peak = kBps_to_icc(bw[i]); in _read_bw()
667 new_opp->bandwidth[i].avg = kBps_to_icc(bw[i]); in _read_bw()
682 ret = of_property_read_u64(np, "opp-hz", &rate); in _read_opp_key()
689 new_opp->rate = (unsigned long)rate; in _read_opp_key()
696 * opp-peak-kBps = <path1_value path2_value>; in _read_opp_key()
697 * opp-avg-kBps = <path1_value path2_value>; in _read_opp_key()
706 if (ret && ret != -ENODEV) in _read_opp_key()
709 if (!of_property_read_u32(np, "opp-level", &new_opp->level)) in _read_opp_key()
719 * _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings)
720 * @opp_table: OPP table
724 * This function adds an opp definition to the opp table and returns status. The
725 * opp can be controlled using dev_pm_opp_enable/disable functions and may be
729 * Valid OPP pointer:
732 * Duplicate OPPs (both freq and volt are same) and opp->available
733 * OR if the OPP is not supported by hardware.
734 * ERR_PTR(-EEXIST):
736 * Duplicate OPPs (both freq and volt are same) and !opp->available
737 * ERR_PTR(-ENOMEM):
739 * ERR_PTR(-EINVAL):
740 * Failed parsing the OPP node
752 return ERR_PTR(-ENOMEM); in _opp_add_static_v2()
755 if (ret < 0 && !opp_table->is_genpd) { in _opp_add_static_v2()
756 dev_err(dev, "%s: opp key field not found\n", __func__); in _opp_add_static_v2()
760 /* Check if the OPP supports hardware's hierarchy of versions or not */ in _opp_add_static_v2()
762 dev_dbg(dev, "OPP not supported by hardware: %lu\n", in _opp_add_static_v2()
763 new_opp->rate); in _opp_add_static_v2()
767 new_opp->turbo = of_property_read_bool(np, "turbo-mode"); in _opp_add_static_v2()
769 new_opp->np = np; in _opp_add_static_v2()
770 new_opp->dynamic = false; in _opp_add_static_v2()
771 new_opp->available = true; in _opp_add_static_v2()
777 if (!of_property_read_u32(np, "clock-latency-ns", &val)) in _opp_add_static_v2()
778 new_opp->clock_latency_ns = val; in _opp_add_static_v2()
784 if (opp_table->is_genpd) in _opp_add_static_v2()
785 new_opp->pstate = pm_genpd_opp_to_performance_state(dev, new_opp); in _opp_add_static_v2()
790 if (ret == -EBUSY) in _opp_add_static_v2()
795 /* OPP to select on device suspend */ in _opp_add_static_v2()
796 if (of_property_read_bool(np, "opp-suspend")) { in _opp_add_static_v2()
797 if (opp_table->suspend_opp) { in _opp_add_static_v2()
798 /* Pick the OPP with higher rate as suspend OPP */ in _opp_add_static_v2()
799 if (new_opp->rate > opp_table->suspend_opp->rate) { in _opp_add_static_v2()
800 opp_table->suspend_opp->suspend = false; in _opp_add_static_v2()
801 new_opp->suspend = true; in _opp_add_static_v2()
802 opp_table->suspend_opp = new_opp; in _opp_add_static_v2()
805 new_opp->suspend = true; in _opp_add_static_v2()
806 opp_table->suspend_opp = new_opp; in _opp_add_static_v2()
810 if (new_opp->clock_latency_ns > opp_table->clock_latency_ns_max) in _opp_add_static_v2()
811 opp_table->clock_latency_ns_max = new_opp->clock_latency_ns; in _opp_add_static_v2()
814 __func__, new_opp->turbo, new_opp->rate, in _opp_add_static_v2()
815 new_opp->supplies[0].u_volt, new_opp->supplies[0].u_volt_min, in _opp_add_static_v2()
816 new_opp->supplies[0].u_volt_max, new_opp->clock_latency_ns); in _opp_add_static_v2()
822 blocking_notifier_call_chain(&opp_table->head, OPP_EVENT_ADD, new_opp); in _opp_add_static_v2()
833 /* Initializes OPP tables based on new bindings */
838 struct dev_pm_opp *opp; in _of_add_opp_table_v2() local
840 /* OPP table is already initialized for the device */ in _of_add_opp_table_v2()
841 mutex_lock(&opp_table->lock); in _of_add_opp_table_v2()
842 if (opp_table->parsed_static_opps) { in _of_add_opp_table_v2()
843 opp_table->parsed_static_opps++; in _of_add_opp_table_v2()
844 mutex_unlock(&opp_table->lock); in _of_add_opp_table_v2()
848 opp_table->parsed_static_opps = 1; in _of_add_opp_table_v2()
849 mutex_unlock(&opp_table->lock); in _of_add_opp_table_v2()
851 /* We have opp-table node now, iterate over it and add OPPs */ in _of_add_opp_table_v2()
852 for_each_available_child_of_node(opp_table->np, np) { in _of_add_opp_table_v2()
853 opp = _opp_add_static_v2(opp_table, dev, np); in _of_add_opp_table_v2()
854 if (IS_ERR(opp)) { in _of_add_opp_table_v2()
855 ret = PTR_ERR(opp); in _of_add_opp_table_v2()
856 dev_err(dev, "%s: Failed to add OPP, %d\n", __func__, in _of_add_opp_table_v2()
860 } else if (opp) { in _of_add_opp_table_v2()
868 ret = -ENOENT; in _of_add_opp_table_v2()
872 list_for_each_entry(opp, &opp_table->opp_list, node) { in _of_add_opp_table_v2()
873 /* Any non-zero performance state would enable the feature */ in _of_add_opp_table_v2()
874 if (opp->pstate) { in _of_add_opp_table_v2()
875 opp_table->genpd_performance_state = true; in _of_add_opp_table_v2()
888 /* Initializes OPP tables based on old-deprecated bindings */
895 mutex_lock(&opp_table->lock); in _of_add_opp_table_v1()
896 if (opp_table->parsed_static_opps) { in _of_add_opp_table_v1()
897 opp_table->parsed_static_opps++; in _of_add_opp_table_v1()
898 mutex_unlock(&opp_table->lock); in _of_add_opp_table_v1()
902 opp_table->parsed_static_opps = 1; in _of_add_opp_table_v1()
903 mutex_unlock(&opp_table->lock); in _of_add_opp_table_v1()
905 prop = of_find_property(dev->of_node, "operating-points", NULL); in _of_add_opp_table_v1()
907 ret = -ENODEV; in _of_add_opp_table_v1()
910 if (!prop->value) { in _of_add_opp_table_v1()
911 ret = -ENODATA; in _of_add_opp_table_v1()
916 * Each OPP is a set of tuples consisting of frequency and in _of_add_opp_table_v1()
917 * voltage like <freq-kHz vol-uV>. in _of_add_opp_table_v1()
919 nr = prop->length / sizeof(u32); in _of_add_opp_table_v1()
921 dev_err(dev, "%s: Invalid OPP table\n", __func__); in _of_add_opp_table_v1()
922 ret = -EINVAL; in _of_add_opp_table_v1()
926 val = prop->value; in _of_add_opp_table_v1()
933 dev_err(dev, "%s: Failed to add OPP %ld (%d)\n", in _of_add_opp_table_v1()
937 nr -= 2; in _of_add_opp_table_v1()
949 * dev_pm_opp_of_add_table() - Initialize opp table from device tree
950 * @dev: device pointer used to lookup OPP table.
952 * Register the initial OPP table with the OPP library for given device.
956 * Duplicate OPPs (both freq and volt are same) and opp->available
957 * -EEXIST Freq are same and volt are different OR
958 * Duplicate OPPs (both freq and volt are same) and !opp->available
959 * -ENOMEM Memory allocation failure
960 * -ENODEV when 'operating-points' property is not found or is invalid data
962 * -ENODATA when empty 'operating-points' property is found
963 * -EINVAL when invalid entries are found in opp-v2 table
978 if (opp_table->np) in dev_pm_opp_of_add_table()
991 * dev_pm_opp_of_add_table_indexed() - Initialize indexed opp table from device tree
992 * @dev: device pointer used to lookup OPP table.
995 * Register the initial OPP table with the OPP library for given device only
996 * using the "operating-points-v2" property.
1000 * Duplicate OPPs (both freq and volt are same) and opp->available
1001 * -EEXIST Freq are same and volt are different OR
1002 * Duplicate OPPs (both freq and volt are same) and !opp->available
1003 * -ENOMEM Memory allocation failure
1004 * -ENODEV when 'operating-points' property is not found or is invalid data
1006 * -ENODATA when empty 'operating-points' property is found
1007 * -EINVAL when invalid entries are found in opp-v2 table
1016 * If only one phandle is present, then the same OPP table in dev_pm_opp_of_add_table_indexed()
1019 count = of_count_phandle_with_args(dev->of_node, in dev_pm_opp_of_add_table_indexed()
1020 "operating-points-v2", NULL); in dev_pm_opp_of_add_table_indexed()
1040 * dev_pm_opp_of_cpumask_remove_table() - Removes OPP table for @cpumask
1041 * @cpumask: cpumask for which OPP table needs to be removed
1043 * This removes the OPP tables for CPUs present in the @cpumask.
1048 _dev_pm_opp_cpumask_remove_table(cpumask, -1); in dev_pm_opp_of_cpumask_remove_table()
1053 * dev_pm_opp_of_cpumask_add_table() - Adds OPP table for @cpumask
1054 * @cpumask: cpumask for which OPP table needs to be added.
1056 * This adds the OPP tables for CPUs present in the @cpumask.
1064 return -ENODEV; in dev_pm_opp_of_cpumask_add_table()
1071 ret = -ENODEV; in dev_pm_opp_of_cpumask_add_table()
1078 * OPP may get registered dynamically, don't print error in dev_pm_opp_of_cpumask_add_table()
1081 pr_debug("%s: couldn't find opp table for cpu:%d, %d\n", in dev_pm_opp_of_cpumask_add_table()
1099 * Works only for OPP v2 bindings.
1101 * Returns -ENOENT if operating-points-v2 bindings aren't supported.
1104 * dev_pm_opp_of_get_sharing_cpus() - Get cpumask of CPUs sharing OPPs with
1105 * @cpu_dev using operating-points-v2
1113 * Returns -ENOENT if operating-points-v2 isn't present for @cpu_dev.
1121 /* Get OPP descriptor node */ in dev_pm_opp_of_get_sharing_cpus()
1124 dev_dbg(cpu_dev, "%s: Couldn't find opp node.\n", __func__); in dev_pm_opp_of_get_sharing_cpus()
1125 return -ENOENT; in dev_pm_opp_of_get_sharing_cpus()
1128 cpumask_set_cpu(cpu_dev->id, cpumask); in dev_pm_opp_of_get_sharing_cpus()
1130 /* OPPs are shared ? */ in dev_pm_opp_of_get_sharing_cpus()
1131 if (!of_property_read_bool(np, "opp-shared")) in dev_pm_opp_of_get_sharing_cpus()
1135 if (cpu == cpu_dev->id) in dev_pm_opp_of_get_sharing_cpus()
1142 ret = -ENOENT; in dev_pm_opp_of_get_sharing_cpus()
1146 /* Get OPP descriptor node */ in dev_pm_opp_of_get_sharing_cpus()
1150 pr_err("%pOF: Couldn't find opp node\n", cpu_np); in dev_pm_opp_of_get_sharing_cpus()
1151 ret = -ENOENT; in dev_pm_opp_of_get_sharing_cpus()
1155 /* CPUs are sharing opp node */ in dev_pm_opp_of_get_sharing_cpus()
1169 …* of_get_required_opp_performance_state() - Search for required OPP and return its performance sta…
1170 * @np: Node that contains the "required-opps" property.
1173 * Returns the performance state of the OPP pointed out by the "required-opps"
1181 struct dev_pm_opp *opp; in of_get_required_opp_performance_state() local
1184 int pstate = -EINVAL; in of_get_required_opp_performance_state()
1188 return -ENODEV; in of_get_required_opp_performance_state()
1192 pr_err("%s: Failed to find required OPP table %pOF: %ld\n", in of_get_required_opp_performance_state()
1197 opp = _find_opp_of_np(opp_table, required_np); in of_get_required_opp_performance_state()
1198 if (opp) { in of_get_required_opp_performance_state()
1199 pstate = opp->pstate; in of_get_required_opp_performance_state()
1200 dev_pm_opp_put(opp); in of_get_required_opp_performance_state()
1213 * dev_pm_opp_get_of_node() - Gets the DT node corresponding to an opp
1214 * @opp: opp for which DT node has to be returned for
1216 * Return: DT node corresponding to the opp, else 0 on success.
1220 struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp) in dev_pm_opp_get_of_node() argument
1222 if (IS_ERR_OR_NULL(opp)) { in dev_pm_opp_get_of_node()
1227 return of_node_get(opp->np); in dev_pm_opp_get_of_node()
1234 * of an existing OPP, or at the frequency of the first OPP above @kHz otherwise
1238 * respectively the voltage and frequency of the OPP.
1240 * Returns -EINVAL if the power calculation failed because of missing
1246 struct dev_pm_opp *opp; in _get_power() local
1253 np = of_node_get(dev->of_node); in _get_power()
1255 return -EINVAL; in _get_power()
1257 ret = of_property_read_u32(np, "dynamic-power-coefficient", &cap); in _get_power()
1260 return -EINVAL; in _get_power()
1263 opp = dev_pm_opp_find_freq_ceil(dev, &Hz); in _get_power()
1264 if (IS_ERR(opp)) in _get_power()
1265 return -EINVAL; in _get_power()
1267 mV = dev_pm_opp_get_voltage(opp) / 1000; in _get_power()
1268 dev_pm_opp_put(opp); in _get_power()
1270 return -EINVAL; in _get_power()
1282 * dev_pm_opp_of_register_em() - Attempt to register an Energy Model
1287 * This checks whether the "dynamic-power-coefficient" devicetree property has
1300 ret = -EINVAL; in dev_pm_opp_of_register_em()
1306 ret = -EINVAL; in dev_pm_opp_of_register_em()
1310 np = of_node_get(dev->of_node); in dev_pm_opp_of_register_em()
1312 ret = -EINVAL; in dev_pm_opp_of_register_em()
1317 * Register an EM only if the 'dynamic-power-coefficient' property is in dev_pm_opp_of_register_em()
1323 ret = of_property_read_u32(np, "dynamic-power-coefficient", &cap); in dev_pm_opp_of_register_em()
1326 dev_dbg(dev, "Couldn't find proper 'dynamic-power-coefficient' in DT\n"); in dev_pm_opp_of_register_em()
1327 ret = -EINVAL; in dev_pm_opp_of_register_em()