Lines Matching refs:opp

22 #include "opp.h"
31 * Returns opp descriptor node for a device node, caller must
40 /* Returns opp descriptor node for a device, caller must do of_node_put() */
65 * OPP table contains a "opp-shared" property.
84 struct dev_pm_opp *opp;
88 list_for_each_entry(opp, &opp_table->opp_list, node)
90 if (opp->np == opp_np) {
91 dev_pm_opp_get(opp);
93 return opp;
160 * Populate all devices and opp tables which are part of "required-opps" list.
209 dev_err(dev, "required-opp doesn't belong to genpd: %pOF\n", required_np);
253 if (of_property_read_bool(opp_np, "opp-shared")) {
274 void _of_opp_free_required_opps(struct opp_table *opp_table, struct dev_pm_opp *opp)
276 struct dev_pm_opp **required_opps = opp->required_opps;
293 opp->required_opps = NULL;
297 static int _of_opp_alloc_required_opps(struct opp_table *opp_table, struct dev_pm_opp *opp)
313 opp->required_opps = required_opps;
318 np = of_parse_required_opp(opp->np, i);
328 pr_err("%s: Unable to find required OPP node: %pOF (%d)\n", __func__, opp->np, i);
337 _of_opp_free_required_opps(opp_table, opp);
357 /* Lets not fail in case we are parsing opp-v1 bindings */
368 prop = of_find_property(np, "opp-peak-kBps", NULL);
449 * platform but there is an opp-supported-hw value set for
453 if (of_find_property(np, "opp-supported-hw", NULL)) {
460 count = of_property_count_u32_elems(np, "opp-supported-hw");
462 dev_err(dev, "%s: Invalid opp-supported-hw property (%d)\n", __func__, count);
473 ret = of_property_read_u32_index(np, "opp-supported-hw", i * levels + j, &val);
475 dev_warn(dev, "%s: failed to read opp-supported-hw property at index %d: %d\n", __func__,
495 static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, struct opp_table *opp_table)
502 /* Search for "opp-microvolt-<name>" */
504 snprintf(name, sizeof(name), "opp-microvolt-%s", opp_table->prop_name);
505 prop = of_find_property(opp->np, name, NULL);
509 /* Search for "opp-microvolt" */
510 sprintf(name, "opp-microvolt");
511 prop = of_find_property(opp->np, name, NULL);
524 dev_err(dev, "%s: opp-microvolt missing although OPP managing regulators\n", __func__);
533 dev_err(dev, "%s: opp-microvolt wasn't expected\n", __func__);
537 vcount = of_property_count_u32_elems(opp->np, name);
555 ret = of_property_read_u32_array(opp->np, name, microvolt, vcount);
562 /* Search for "opp-microamp-<name>" */
565 snprintf(name, sizeof(name), "opp-microamp-%s", opp_table->prop_name);
566 prop = of_find_property(opp->np, name, NULL);
570 /* Search for "opp-microamp" */
571 sprintf(name, "opp-microamp");
572 prop = of_find_property(opp->np, name, NULL);
576 icount = of_property_count_u32_elems(opp->np, name);
596 ret = of_property_read_u32_array(opp->np, name, microamp, icount);
605 opp->supplies[i].u_volt = microvolt[j++];
608 opp->supplies[i].u_volt_min = opp->supplies[i].u_volt;
609 opp->supplies[i].u_volt_max = opp->supplies[i].u_volt;
611 opp->supplies[i].u_volt_min = microvolt[j++];
612 opp->supplies[i].u_volt_max = microvolt[j++];
616 opp->supplies[i].u_amp = microamp[i];
643 const char *name = peak ? "opp-peak-kBps" : "opp-avg-kBps";
690 ret = of_property_read_u64(np, "opp-hz", &rate);
704 * opp-peak-kBps = <path1_value path2_value>;
705 * opp-avg-kBps = <path1_value path2_value>;
718 if (!of_property_read_u32(np, "opp-level", &new_opp->level)) {
735 * This function adds an opp definition to the opp table and returns status. The
736 * opp can be controlled using dev_pm_opp_enable/disable functions and may be
743 * Duplicate OPPs (both freq and volt are same) and opp->available
747 * Duplicate OPPs (both freq and volt are same) and !opp->available
767 dev_err(dev, "%s: opp key field not found\n", __func__);
811 if (of_property_read_bool(np, "opp-suspend")) {
853 struct dev_pm_opp *opp;
866 /* We have opp-table node now, iterate over it and add OPPs */
869 opp = _opp_add_static_v2(opp_table, dev, np);
870 if (IS_ERR(opp)) {
871 ret = PTR_ERR(opp);
875 } else if (opp) {
887 list_for_each_entry(opp, &opp_table->opp_list, node)
890 if (opp->pstate) {
964 * dev_pm_opp_of_add_table() - Initialize opp table from device tree
971 * Duplicate OPPs (both freq and volt are same) and opp->available
973 * Duplicate OPPs (both freq and volt are same) and !opp->available
978 * -EINVAL when invalid entries are found in opp-v2 table
1009 * dev_pm_opp_of_add_table_indexed() - Initialize indexed opp table from device tree
1018 * Duplicate OPPs (both freq and volt are same) and opp->available
1020 * Duplicate OPPs (both freq and volt are same) and !opp->available
1025 * -EINVAL when invalid entries are found in opp-v2 table
1102 pr_debug("%s: couldn't find opp table for cpu:%d, %d\n", __func__, cpu, ret);
1143 dev_dbg(cpu_dev, "%s: Couldn't find opp node.\n", __func__);
1150 if (!of_property_read_bool(np, "opp-shared")) {
1171 pr_err("%pOF: Couldn't find opp node\n", cpu_np);
1176 /* CPUs are sharing opp node */
1203 struct dev_pm_opp *opp;
1219 opp = _find_opp_of_np(opp_table, required_np);
1220 if (opp) {
1221 pstate = opp->pstate;
1222 dev_pm_opp_put(opp);
1235 * dev_pm_opp_get_of_node() - Gets the DT node corresponding to an opp
1236 * @opp: opp for which DT node has to be returned for
1238 * Return: DT node corresponding to the opp, else 0 on success.
1242 struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp)
1244 if (IS_ERR_OR_NULL(opp)) {
1249 return of_node_get(opp->np);
1267 struct dev_pm_opp *opp;
1286 opp = dev_pm_opp_find_freq_ceil(dev, &Hz);
1287 if (IS_ERR(opp)) {
1291 mV = dev_pm_opp_get_voltage(opp) / 1000;
1292 dev_pm_opp_put(opp);