Lines Matching +full:opp +full:- +full:table
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()
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()
100 required_np = of_parse_phandle(np, "required-opps", index); in of_parse_required_opp()
102 pr_err("%s: Unable to parse required-opps: %pOF, index: %d\n", in of_parse_required_opp()
109 /* The caller must call dev_pm_opp_put_opp_table() after the table is used */
125 if (opp_table_np == opp_table->np) { in _find_table_of_opp_np()
132 return ERR_PTR(-ENODEV); in _find_table_of_opp_np()
138 struct opp_table **required_opp_tables = opp_table->required_opp_tables; in _opp_table_free_required_tables()
144 for (i = 0; i < opp_table->required_opp_count; i++) { in _opp_table_free_required_tables()
153 opp_table->required_opp_count = 0; in _opp_table_free_required_tables()
154 opp_table->required_opp_tables = NULL; in _opp_table_free_required_tables()
158 * Populate all devices and opp tables which are part of "required-opps" list.
159 * Checking only the first OPP node should be enough.
169 /* Traversing the first OPP node is all we need */ in _opp_table_alloc_required_tables()
172 dev_err(dev, "Empty OPP table\n"); in _opp_table_alloc_required_tables()
176 count = of_count_phandle_with_args(np, "required-opps", NULL); in _opp_table_alloc_required_tables()
185 opp_table->required_opp_tables = required_opp_tables; in _opp_table_alloc_required_tables()
186 opp_table->required_opp_count = count; in _opp_table_alloc_required_tables()
200 * We only support genpd's OPPs in the "required-opps" for now, in _opp_table_alloc_required_tables()
202 * required OPP doesn't belong to a genpd. in _opp_table_alloc_required_tables()
204 if (!required_opp_tables[i]->is_genpd) { in _opp_table_alloc_required_tables()
205 dev_err(dev, "required-opp doesn't belong to genpd: %pOF\n", in _opp_table_alloc_required_tables()
229 np = of_node_get(dev->of_node); in _of_init_opp_table()
233 if (!of_property_read_u32(np, "clock-latency", &val)) in _of_init_opp_table()
234 opp_table->clock_latency_ns_max = val; in _of_init_opp_table()
235 of_property_read_u32(np, "voltage-tolerance", in _of_init_opp_table()
236 &opp_table->voltage_tolerance_v1); in _of_init_opp_table()
238 if (of_find_property(np, "#power-domain-cells", NULL)) in _of_init_opp_table()
239 opp_table->is_genpd = true; in _of_init_opp_table()
241 /* Get OPP table node */ in _of_init_opp_table()
248 if (of_property_read_bool(opp_np, "opp-shared")) in _of_init_opp_table()
249 opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED; in _of_init_opp_table()
251 opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE; in _of_init_opp_table()
253 opp_table->np = opp_np; in _of_init_opp_table()
269 struct dev_pm_opp *opp) in _of_opp_free_required_opps() argument
271 struct dev_pm_opp **required_opps = opp->required_opps; in _of_opp_free_required_opps()
277 for (i = 0; i < opp_table->required_opp_count; i++) { in _of_opp_free_required_opps()
286 opp->required_opps = NULL; in _of_opp_free_required_opps()
289 /* Populate all required OPPs which are part of "required-opps" list */
291 struct dev_pm_opp *opp) in _of_opp_alloc_required_opps() argument
296 int i, ret, count = opp_table->required_opp_count; in _of_opp_alloc_required_opps()
303 return -ENOMEM; in _of_opp_alloc_required_opps()
305 opp->required_opps = required_opps; in _of_opp_alloc_required_opps()
308 required_table = opp_table->required_opp_tables[i]; in _of_opp_alloc_required_opps()
310 np = of_parse_required_opp(opp->np, i); in _of_opp_alloc_required_opps()
312 ret = -ENODEV; in _of_opp_alloc_required_opps()
320 pr_err("%s: Unable to find required OPP node: %pOF (%d)\n", in _of_opp_alloc_required_opps()
321 __func__, opp->np, i); in _of_opp_alloc_required_opps()
322 ret = -ENODEV; in _of_opp_alloc_required_opps()
330 _of_opp_free_required_opps(opp_table, opp); in _of_opp_alloc_required_opps()
341 np = of_node_get(dev->of_node); in _bandwidth_supported()
343 return -ENODEV; in _bandwidth_supported()
348 opp_np = of_node_get(opp_table->np); in _bandwidth_supported()
351 /* Lets not fail in case we are parsing opp-v1 bindings */ in _bandwidth_supported()
355 /* Checking only first OPP is sufficient */ in _bandwidth_supported()
358 dev_err(dev, "OPP table empty\n"); in _bandwidth_supported()
359 return -EINVAL; in _bandwidth_supported()
363 prop = of_find_property(np, "opp-peak-kBps", NULL); in _bandwidth_supported()
366 if (!prop || !prop->length) in _bandwidth_supported()
385 np = of_node_get(dev->of_node); in dev_pm_opp_of_find_icc_paths()
390 "#interconnect-cells"); in dev_pm_opp_of_find_icc_paths()
395 /* two phandles when #interconnect-cells = <1> */ in dev_pm_opp_of_find_icc_paths()
398 return -EINVAL; in dev_pm_opp_of_find_icc_paths()
404 return -ENOMEM; in dev_pm_opp_of_find_icc_paths()
410 if (ret != -EPROBE_DEFER) { in dev_pm_opp_of_find_icc_paths()
419 opp_table->paths = paths; in dev_pm_opp_of_find_icc_paths()
420 opp_table->path_count = num_paths; in dev_pm_opp_of_find_icc_paths()
425 while (i--) in dev_pm_opp_of_find_icc_paths()
437 unsigned int levels = opp_table->supported_hw_count; in _opp_is_supported()
441 if (!opp_table->supported_hw) { in _opp_is_supported()
444 * platform but there is an opp-supported-hw value set for in _opp_is_supported()
445 * an OPP then the OPP should not be enabled as there is in _opp_is_supported()
448 if (of_find_property(np, "opp-supported-hw", NULL)) in _opp_is_supported()
454 count = of_property_count_u32_elems(np, "opp-supported-hw"); in _opp_is_supported()
456 dev_err(dev, "%s: Invalid opp-supported-hw property (%d)\n", in _opp_is_supported()
468 ret = of_property_read_u32_index(np, "opp-supported-hw", in _opp_is_supported()
471 dev_warn(dev, "%s: failed to read opp-supported-hw property at index %d: %d\n", in _opp_is_supported()
477 if (!(val & opp_table->supported_hw[j])) { in _opp_is_supported()
490 static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, in opp_parse_supplies() argument
494 int supplies = opp_table->regulator_count, vcount, icount, ret, i, j; in opp_parse_supplies()
498 /* Search for "opp-microvolt-<name>" */ in opp_parse_supplies()
499 if (opp_table->prop_name) { in opp_parse_supplies()
500 snprintf(name, sizeof(name), "opp-microvolt-%s", in opp_parse_supplies()
501 opp_table->prop_name); in opp_parse_supplies()
502 prop = of_find_property(opp->np, name, NULL); in opp_parse_supplies()
506 /* Search for "opp-microvolt" */ in opp_parse_supplies()
507 sprintf(name, "opp-microvolt"); in opp_parse_supplies()
508 prop = of_find_property(opp->np, name, NULL); in opp_parse_supplies()
512 if (unlikely(supplies == -1)) { in opp_parse_supplies()
514 opp_table->regulator_count = 0; in opp_parse_supplies()
521 dev_err(dev, "%s: opp-microvolt missing although OPP managing regulators\n", in opp_parse_supplies()
523 return -EINVAL; in opp_parse_supplies()
527 if (unlikely(supplies == -1)) { in opp_parse_supplies()
529 supplies = opp_table->regulator_count = 1; in opp_parse_supplies()
531 dev_err(dev, "%s: opp-microvolt wasn't expected\n", __func__); in opp_parse_supplies()
532 return -EINVAL; in opp_parse_supplies()
535 vcount = of_property_count_u32_elems(opp->np, name); in opp_parse_supplies()
546 return -EINVAL; in opp_parse_supplies()
551 return -ENOMEM; in opp_parse_supplies()
553 ret = of_property_read_u32_array(opp->np, name, microvolt, vcount); in opp_parse_supplies()
556 ret = -EINVAL; in opp_parse_supplies()
560 /* Search for "opp-microamp-<name>" */ in opp_parse_supplies()
562 if (opp_table->prop_name) { in opp_parse_supplies()
563 snprintf(name, sizeof(name), "opp-microamp-%s", in opp_parse_supplies()
564 opp_table->prop_name); in opp_parse_supplies()
565 prop = of_find_property(opp->np, name, NULL); in opp_parse_supplies()
569 /* Search for "opp-microamp" */ in opp_parse_supplies()
570 sprintf(name, "opp-microamp"); in opp_parse_supplies()
571 prop = of_find_property(opp->np, name, NULL); in opp_parse_supplies()
575 icount = of_property_count_u32_elems(opp->np, name); in opp_parse_supplies()
586 ret = -EINVAL; in opp_parse_supplies()
592 ret = -EINVAL; in opp_parse_supplies()
596 ret = of_property_read_u32_array(opp->np, name, microamp, in opp_parse_supplies()
601 ret = -EINVAL; in opp_parse_supplies()
607 opp->supplies[i].u_volt = microvolt[j++]; in opp_parse_supplies()
610 opp->supplies[i].u_volt_min = opp->supplies[i].u_volt; in opp_parse_supplies()
611 opp->supplies[i].u_volt_max = opp->supplies[i].u_volt; in opp_parse_supplies()
613 opp->supplies[i].u_volt_min = microvolt[j++]; in opp_parse_supplies()
614 opp->supplies[i].u_volt_max = microvolt[j++]; in opp_parse_supplies()
618 opp->supplies[i].u_amp = microamp[i]; in opp_parse_supplies()
630 * dev_pm_opp_of_remove_table() - Free OPP table entries created from static DT
632 * @dev: device pointer used to lookup OPP table.
642 static int _read_bw(struct dev_pm_opp *new_opp, struct opp_table *table, in _read_bw() argument
645 const char *name = peak ? "opp-peak-kBps" : "opp-avg-kBps"; in _read_bw()
652 return -ENODEV; in _read_bw()
654 count = prop->length / sizeof(u32); in _read_bw()
655 if (table->path_count != count) { in _read_bw()
657 __func__, name, count, table->path_count); in _read_bw()
658 return -EINVAL; in _read_bw()
663 return -ENOMEM; in _read_bw()
673 new_opp->bandwidth[i].peak = kBps_to_icc(bw[i]); in _read_bw()
675 new_opp->bandwidth[i].avg = kBps_to_icc(bw[i]); in _read_bw()
683 static int _read_opp_key(struct dev_pm_opp *new_opp, struct opp_table *table, in _read_opp_key() argument
690 ret = of_property_read_u64(np, "opp-hz", &rate); in _read_opp_key()
697 new_opp->rate = (unsigned long)rate; in _read_opp_key()
704 * opp-peak-kBps = <path1_value path2_value>; in _read_opp_key()
705 * opp-avg-kBps = <path1_value path2_value>; in _read_opp_key()
707 ret = _read_bw(new_opp, table, np, true); in _read_opp_key()
710 ret = _read_bw(new_opp, table, np, false); in _read_opp_key()
714 if (ret && ret != -ENODEV) in _read_opp_key()
717 if (!of_property_read_u32(np, "opp-level", &new_opp->level)) in _read_opp_key()
727 * _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings)
728 * @opp_table: OPP table
732 * This function adds an opp definition to the opp table and returns status. The
733 * opp can be controlled using dev_pm_opp_enable/disable functions and may be
737 * Valid OPP pointer:
740 * Duplicate OPPs (both freq and volt are same) and opp->available
741 * OR if the OPP is not supported by hardware.
742 * ERR_PTR(-EEXIST):
744 * Duplicate OPPs (both freq and volt are same) and !opp->available
745 * ERR_PTR(-ENOMEM):
747 * ERR_PTR(-EINVAL):
748 * Failed parsing the OPP node
761 return ERR_PTR(-ENOMEM); in _opp_add_static_v2()
764 if (ret < 0 && !opp_table->is_genpd) { in _opp_add_static_v2()
765 dev_err(dev, "%s: opp key field not found\n", __func__); in _opp_add_static_v2()
769 /* Check if the OPP supports hardware's hierarchy of versions or not */ in _opp_add_static_v2()
771 dev_dbg(dev, "OPP not supported by hardware: %llu\n", rate); in _opp_add_static_v2()
775 new_opp->turbo = of_property_read_bool(np, "turbo-mode"); in _opp_add_static_v2()
777 new_opp->np = np; in _opp_add_static_v2()
778 new_opp->dynamic = false; in _opp_add_static_v2()
779 new_opp->available = true; in _opp_add_static_v2()
785 if (!of_property_read_u32(np, "clock-latency-ns", &val)) in _opp_add_static_v2()
786 new_opp->clock_latency_ns = val; in _opp_add_static_v2()
792 if (opp_table->is_genpd) in _opp_add_static_v2()
793 new_opp->pstate = pm_genpd_opp_to_performance_state(dev, new_opp); in _opp_add_static_v2()
798 if (ret == -EBUSY) in _opp_add_static_v2()
803 /* OPP to select on device suspend */ in _opp_add_static_v2()
804 if (of_property_read_bool(np, "opp-suspend")) { in _opp_add_static_v2()
805 if (opp_table->suspend_opp) { in _opp_add_static_v2()
806 /* Pick the OPP with higher rate as suspend OPP */ in _opp_add_static_v2()
807 if (new_opp->rate > opp_table->suspend_opp->rate) { in _opp_add_static_v2()
808 opp_table->suspend_opp->suspend = false; in _opp_add_static_v2()
809 new_opp->suspend = true; in _opp_add_static_v2()
810 opp_table->suspend_opp = new_opp; in _opp_add_static_v2()
813 new_opp->suspend = true; in _opp_add_static_v2()
814 opp_table->suspend_opp = new_opp; in _opp_add_static_v2()
818 if (new_opp->clock_latency_ns > opp_table->clock_latency_ns_max) in _opp_add_static_v2()
819 opp_table->clock_latency_ns_max = new_opp->clock_latency_ns; in _opp_add_static_v2()
822 __func__, new_opp->turbo, new_opp->rate, in _opp_add_static_v2()
823 new_opp->supplies[0].u_volt, new_opp->supplies[0].u_volt_min, in _opp_add_static_v2()
824 new_opp->supplies[0].u_volt_max, new_opp->clock_latency_ns); in _opp_add_static_v2()
830 blocking_notifier_call_chain(&opp_table->head, OPP_EVENT_ADD, new_opp); in _opp_add_static_v2()
841 /* Initializes OPP tables based on new bindings */
846 struct dev_pm_opp *opp; in _of_add_opp_table_v2() local
848 /* OPP table is already initialized for the device */ in _of_add_opp_table_v2()
849 mutex_lock(&opp_table->lock); in _of_add_opp_table_v2()
850 if (opp_table->parsed_static_opps) { in _of_add_opp_table_v2()
851 opp_table->parsed_static_opps++; in _of_add_opp_table_v2()
852 mutex_unlock(&opp_table->lock); in _of_add_opp_table_v2()
856 opp_table->parsed_static_opps = 1; in _of_add_opp_table_v2()
857 mutex_unlock(&opp_table->lock); in _of_add_opp_table_v2()
859 /* We have opp-table node now, iterate over it and add OPPs */ in _of_add_opp_table_v2()
860 for_each_available_child_of_node(opp_table->np, np) { in _of_add_opp_table_v2()
861 opp = _opp_add_static_v2(opp_table, dev, np); in _of_add_opp_table_v2()
862 if (IS_ERR(opp)) { in _of_add_opp_table_v2()
863 ret = PTR_ERR(opp); in _of_add_opp_table_v2()
864 dev_err(dev, "%s: Failed to add OPP, %d\n", __func__, in _of_add_opp_table_v2()
868 } else if (opp) { in _of_add_opp_table_v2()
873 /* There should be one of more OPP defined */ in _of_add_opp_table_v2()
875 ret = -ENOENT; in _of_add_opp_table_v2()
879 list_for_each_entry(opp, &opp_table->opp_list, node) { in _of_add_opp_table_v2()
880 /* Any non-zero performance state would enable the feature */ in _of_add_opp_table_v2()
881 if (opp->pstate) { in _of_add_opp_table_v2()
882 opp_table->genpd_performance_state = true; in _of_add_opp_table_v2()
895 /* Initializes OPP tables based on old-deprecated bindings */
902 mutex_lock(&opp_table->lock); in _of_add_opp_table_v1()
903 if (opp_table->parsed_static_opps) { in _of_add_opp_table_v1()
904 opp_table->parsed_static_opps++; in _of_add_opp_table_v1()
905 mutex_unlock(&opp_table->lock); in _of_add_opp_table_v1()
909 opp_table->parsed_static_opps = 1; in _of_add_opp_table_v1()
910 mutex_unlock(&opp_table->lock); in _of_add_opp_table_v1()
912 prop = of_find_property(dev->of_node, "operating-points", NULL); in _of_add_opp_table_v1()
914 ret = -ENODEV; in _of_add_opp_table_v1()
917 if (!prop->value) { in _of_add_opp_table_v1()
918 ret = -ENODATA; in _of_add_opp_table_v1()
923 * Each OPP is a set of tuples consisting of frequency and in _of_add_opp_table_v1()
924 * voltage like <freq-kHz vol-uV>. in _of_add_opp_table_v1()
926 nr = prop->length / sizeof(u32); in _of_add_opp_table_v1()
928 dev_err(dev, "%s: Invalid OPP table\n", __func__); in _of_add_opp_table_v1()
929 ret = -EINVAL; in _of_add_opp_table_v1()
933 val = prop->value; in _of_add_opp_table_v1()
940 dev_err(dev, "%s: Failed to add OPP %ld (%d)\n", in _of_add_opp_table_v1()
944 nr -= 2; in _of_add_opp_table_v1()
956 * dev_pm_opp_of_add_table() - Initialize opp table from device tree
957 * @dev: device pointer used to lookup OPP table.
959 * Register the initial OPP table with the OPP library for given device.
963 * Duplicate OPPs (both freq and volt are same) and opp->available
964 * -EEXIST Freq are same and volt are different OR
965 * Duplicate OPPs (both freq and volt are same) and !opp->available
966 * -ENOMEM Memory allocation failure
967 * -ENODEV when 'operating-points' property is not found or is invalid data
969 * -ENODATA when empty 'operating-points' property is found
970 * -EINVAL when invalid entries are found in opp-v2 table
985 if (opp_table->np) in dev_pm_opp_of_add_table()
998 * dev_pm_opp_of_add_table_indexed() - Initialize indexed opp table from device tree
999 * @dev: device pointer used to lookup OPP table.
1002 * Register the initial OPP table with the OPP library for given device only
1003 * using the "operating-points-v2" property.
1007 * Duplicate OPPs (both freq and volt are same) and opp->available
1008 * -EEXIST Freq are same and volt are different OR
1009 * Duplicate OPPs (both freq and volt are same) and !opp->available
1010 * -ENOMEM Memory allocation failure
1011 * -ENODEV when 'operating-points' property is not found or is invalid data
1013 * -ENODATA when empty 'operating-points' property is found
1014 * -EINVAL when invalid entries are found in opp-v2 table
1023 * If only one phandle is present, then the same OPP table in dev_pm_opp_of_add_table_indexed()
1026 count = of_count_phandle_with_args(dev->of_node, in dev_pm_opp_of_add_table_indexed()
1027 "operating-points-v2", NULL); in dev_pm_opp_of_add_table_indexed()
1047 * dev_pm_opp_of_cpumask_remove_table() - Removes OPP table for @cpumask
1048 * @cpumask: cpumask for which OPP table needs to be removed
1050 * This removes the OPP tables for CPUs present in the @cpumask.
1055 _dev_pm_opp_cpumask_remove_table(cpumask, -1); in dev_pm_opp_of_cpumask_remove_table()
1060 * dev_pm_opp_of_cpumask_add_table() - Adds OPP table for @cpumask
1061 * @cpumask: cpumask for which OPP table needs to be added.
1063 * This adds the OPP tables for CPUs present in the @cpumask.
1071 return -ENODEV; in dev_pm_opp_of_cpumask_add_table()
1078 ret = -ENODEV; in dev_pm_opp_of_cpumask_add_table()
1085 * OPP may get registered dynamically, don't print error in dev_pm_opp_of_cpumask_add_table()
1088 pr_debug("%s: couldn't find opp table for cpu:%d, %d\n", in dev_pm_opp_of_cpumask_add_table()
1106 * Works only for OPP v2 bindings.
1108 * Returns -ENOENT if operating-points-v2 bindings aren't supported.
1111 * dev_pm_opp_of_get_sharing_cpus() - Get cpumask of CPUs sharing OPPs with
1112 * @cpu_dev using operating-points-v2
1120 * Returns -ENOENT if operating-points-v2 isn't present for @cpu_dev.
1128 /* Get OPP descriptor node */ in dev_pm_opp_of_get_sharing_cpus()
1131 dev_dbg(cpu_dev, "%s: Couldn't find opp node.\n", __func__); in dev_pm_opp_of_get_sharing_cpus()
1132 return -ENOENT; in dev_pm_opp_of_get_sharing_cpus()
1135 cpumask_set_cpu(cpu_dev->id, cpumask); in dev_pm_opp_of_get_sharing_cpus()
1138 if (!of_property_read_bool(np, "opp-shared")) in dev_pm_opp_of_get_sharing_cpus()
1142 if (cpu == cpu_dev->id) in dev_pm_opp_of_get_sharing_cpus()
1149 ret = -ENOENT; in dev_pm_opp_of_get_sharing_cpus()
1153 /* Get OPP descriptor node */ in dev_pm_opp_of_get_sharing_cpus()
1157 pr_err("%pOF: Couldn't find opp node\n", cpu_np); in dev_pm_opp_of_get_sharing_cpus()
1158 ret = -ENOENT; in dev_pm_opp_of_get_sharing_cpus()
1162 /* CPUs are sharing opp node */ in dev_pm_opp_of_get_sharing_cpus()
1176 …* of_get_required_opp_performance_state() - Search for required OPP and return its performance sta…
1177 * @np: Node that contains the "required-opps" property.
1180 * Returns the performance state of the OPP pointed out by the "required-opps"
1188 struct dev_pm_opp *opp; in of_get_required_opp_performance_state() local
1191 int pstate = -EINVAL; in of_get_required_opp_performance_state()
1195 return -EINVAL; in of_get_required_opp_performance_state()
1199 pr_err("%s: Failed to find required OPP table %pOF: %ld\n", in of_get_required_opp_performance_state()
1204 opp = _find_opp_of_np(opp_table, required_np); in of_get_required_opp_performance_state()
1205 if (opp) { in of_get_required_opp_performance_state()
1206 pstate = opp->pstate; in of_get_required_opp_performance_state()
1207 dev_pm_opp_put(opp); in of_get_required_opp_performance_state()
1220 * dev_pm_opp_get_of_node() - Gets the DT node corresponding to an opp
1221 * @opp: opp for which DT node has to be returned for
1223 * Return: DT node corresponding to the opp, else 0 on success.
1227 struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp) in dev_pm_opp_get_of_node() argument
1229 if (IS_ERR_OR_NULL(opp)) { in dev_pm_opp_get_of_node()
1234 return of_node_get(opp->np); in dev_pm_opp_get_of_node()
1241 * of an existing OPP, or at the frequency of the first OPP above @kHz otherwise
1245 * respectively the voltage and frequency of the OPP.
1247 * Returns -EINVAL if the power calculation failed because of missing
1253 struct dev_pm_opp *opp; in _get_power() local
1260 np = of_node_get(dev->of_node); in _get_power()
1262 return -EINVAL; in _get_power()
1264 ret = of_property_read_u32(np, "dynamic-power-coefficient", &cap); in _get_power()
1267 return -EINVAL; in _get_power()
1270 opp = dev_pm_opp_find_freq_ceil(dev, &Hz); in _get_power()
1271 if (IS_ERR(opp)) in _get_power()
1272 return -EINVAL; in _get_power()
1274 mV = dev_pm_opp_get_voltage(opp) / 1000; in _get_power()
1275 dev_pm_opp_put(opp); in _get_power()
1277 return -EINVAL; in _get_power()
1289 * dev_pm_opp_of_register_em() - Attempt to register an Energy Model
1294 * This checks whether the "dynamic-power-coefficient" devicetree property has
1307 ret = -EINVAL; in dev_pm_opp_of_register_em()
1313 ret = -EINVAL; in dev_pm_opp_of_register_em()
1317 np = of_node_get(dev->of_node); in dev_pm_opp_of_register_em()
1319 ret = -EINVAL; in dev_pm_opp_of_register_em()
1324 * Register an EM only if the 'dynamic-power-coefficient' property is in dev_pm_opp_of_register_em()
1330 ret = of_property_read_u32(np, "dynamic-power-coefficient", &cap); in dev_pm_opp_of_register_em()
1333 dev_dbg(dev, "Couldn't find proper 'dynamic-power-coefficient' in DT\n"); in dev_pm_opp_of_register_em()
1334 ret = -EINVAL; in dev_pm_opp_of_register_em()