• Home
  • Raw
  • Download

Lines Matching refs:opp_table

42 struct opp_table *_managed_opp(struct device *dev, int index)  in _managed_opp()
44 struct opp_table *opp_table, *managed_table = NULL; in _managed_opp() local
51 list_for_each_entry(opp_table, &opp_tables, node) { in _managed_opp()
52 if (opp_table->np == np) { in _managed_opp()
60 if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) { in _managed_opp()
61 _get_opp_table_kref(opp_table); in _managed_opp()
62 managed_table = opp_table; in _managed_opp()
75 static struct dev_pm_opp *_find_opp_of_np(struct opp_table *opp_table, in _find_opp_of_np() argument
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()
85 mutex_unlock(&opp_table->lock); in _find_opp_of_np()
90 mutex_unlock(&opp_table->lock); in _find_opp_of_np()
102 static struct opp_table *_find_table_of_opp_np(struct device_node *opp_np) in _find_table_of_opp_np()
104 struct opp_table *opp_table; in _find_table_of_opp_np() local
115 list_for_each_entry(opp_table, &opp_tables, node) { in _find_table_of_opp_np()
116 if (opp_table_np == opp_table->np) { in _find_table_of_opp_np()
117 _get_opp_table_kref(opp_table); in _find_table_of_opp_np()
119 return opp_table; in _find_table_of_opp_np()
129 static void _opp_table_free_required_tables(struct opp_table *opp_table) in _opp_table_free_required_tables() argument
131 struct opp_table **required_opp_tables = opp_table->required_opp_tables; in _opp_table_free_required_tables()
137 for (i = 0; i < opp_table->required_opp_count; i++) { in _opp_table_free_required_tables()
146 opp_table->required_opp_count = 0; in _opp_table_free_required_tables()
147 opp_table->required_opp_tables = NULL; in _opp_table_free_required_tables()
148 list_del(&opp_table->lazy); in _opp_table_free_required_tables()
155 static void _opp_table_alloc_required_tables(struct opp_table *opp_table, in _opp_table_alloc_required_tables() argument
159 struct opp_table **required_opp_tables; in _opp_table_alloc_required_tables()
181 opp_table->required_opp_tables = required_opp_tables; in _opp_table_alloc_required_tables()
182 opp_table->required_opp_count = count; in _opp_table_alloc_required_tables()
198 list_add(&opp_table->lazy, &lazy_opp_tables); in _opp_table_alloc_required_tables()
203 _opp_table_free_required_tables(opp_table); in _opp_table_alloc_required_tables()
208 void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, in _of_init_opp_table() argument
223 opp_table->clock_latency_ns_max = val; in _of_init_opp_table()
225 &opp_table->voltage_tolerance_v1); in _of_init_opp_table()
228 opp_table->is_genpd = true; in _of_init_opp_table()
238 opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED; in _of_init_opp_table()
240 opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE; in _of_init_opp_table()
242 opp_table->np = opp_np; in _of_init_opp_table()
244 _opp_table_alloc_required_tables(opp_table, dev, opp_np); in _of_init_opp_table()
248 void _of_clear_opp_table(struct opp_table *opp_table) in _of_clear_opp_table() argument
250 _opp_table_free_required_tables(opp_table); in _of_clear_opp_table()
257 void _of_opp_free_required_opps(struct opp_table *opp_table, in _of_opp_free_required_opps() argument
266 for (i = 0; i < opp_table->required_opp_count; i++) { in _of_opp_free_required_opps()
279 static int _of_opp_alloc_required_opps(struct opp_table *opp_table, in _of_opp_alloc_required_opps() argument
283 struct opp_table *required_table; in _of_opp_alloc_required_opps()
285 int i, ret, count = opp_table->required_opp_count; in _of_opp_alloc_required_opps()
297 required_table = opp_table->required_opp_tables[i]; in _of_opp_alloc_required_opps()
323 _of_opp_free_required_opps(opp_table, opp); in _of_opp_alloc_required_opps()
329 static int lazy_link_required_opps(struct opp_table *opp_table, in lazy_link_required_opps() argument
330 struct opp_table *new_table, int index) in lazy_link_required_opps()
335 list_for_each_entry(opp, &opp_table->opp_list, node) { in lazy_link_required_opps()
354 static void lazy_link_required_opp_table(struct opp_table *new_table) in lazy_link_required_opp_table()
356 struct opp_table *opp_table, *temp, **required_opp_tables; in lazy_link_required_opp_table() local
363 list_for_each_entry_safe(opp_table, temp, &lazy_opp_tables, lazy) { in lazy_link_required_opp_table()
367 opp_np = of_get_next_available_child(opp_table->np, NULL); in lazy_link_required_opp_table()
369 for (i = 0; i < opp_table->required_opp_count; i++) { in lazy_link_required_opp_table()
370 required_opp_tables = opp_table->required_opp_tables; in lazy_link_required_opp_table()
396 ret = lazy_link_required_opps(opp_table, new_table, i); in lazy_link_required_opp_table()
408 list_del_init(&opp_table->lazy); in lazy_link_required_opp_table()
410 list_for_each_entry(opp, &opp_table->opp_list, node) in lazy_link_required_opp_table()
411 _required_opps_available(opp, opp_table->required_opp_count); in lazy_link_required_opp_table()
418 static int _bandwidth_supported(struct device *dev, struct opp_table *opp_table) in _bandwidth_supported() argument
423 if (!opp_table) { in _bandwidth_supported()
431 opp_np = of_node_get(opp_table->np); in _bandwidth_supported()
456 struct opp_table *opp_table) in dev_pm_opp_of_find_icc_paths() argument
462 ret = _bandwidth_supported(dev, opp_table); in dev_pm_opp_of_find_icc_paths()
503 if (opp_table) { in dev_pm_opp_of_find_icc_paths()
504 opp_table->paths = paths; in dev_pm_opp_of_find_icc_paths()
505 opp_table->path_count = num_paths; in dev_pm_opp_of_find_icc_paths()
519 static bool _opp_is_supported(struct device *dev, struct opp_table *opp_table, in _opp_is_supported() argument
522 unsigned int levels = opp_table->supported_hw_count; in _opp_is_supported()
526 if (!opp_table->supported_hw) { in _opp_is_supported()
562 if (!(val & opp_table->supported_hw[j])) { in _opp_is_supported()
576 struct opp_table *opp_table) in opp_parse_supplies() argument
579 int supplies = opp_table->regulator_count, vcount, icount, ret, i, j; in opp_parse_supplies()
584 if (opp_table->prop_name) { in opp_parse_supplies()
586 opp_table->prop_name); in opp_parse_supplies()
599 opp_table->regulator_count = 0; in opp_parse_supplies()
614 supplies = opp_table->regulator_count = 1; in opp_parse_supplies()
647 if (opp_table->prop_name) { in opp_parse_supplies()
649 opp_table->prop_name); in opp_parse_supplies()
727 static int _read_bw(struct dev_pm_opp *new_opp, struct opp_table *table, in _read_bw()
768 static int _read_opp_key(struct dev_pm_opp *new_opp, struct opp_table *table, in _read_opp_key()
835 static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, in _opp_add_static_v2() argument
843 new_opp = _opp_allocate(opp_table); in _opp_add_static_v2()
847 ret = _read_opp_key(new_opp, opp_table, np, &rate_not_available); in _opp_add_static_v2()
854 if (!_opp_is_supported(dev, opp_table, np)) { in _opp_add_static_v2()
866 ret = _of_opp_alloc_required_opps(opp_table, new_opp); in _opp_add_static_v2()
873 ret = opp_parse_supplies(new_opp, dev, opp_table); in _opp_add_static_v2()
877 if (opp_table->is_genpd) in _opp_add_static_v2()
880 ret = _opp_add(dev, new_opp, opp_table, rate_not_available); in _opp_add_static_v2()
890 if (opp_table->suspend_opp) { in _opp_add_static_v2()
892 if (new_opp->rate > opp_table->suspend_opp->rate) { in _opp_add_static_v2()
893 opp_table->suspend_opp->suspend = false; in _opp_add_static_v2()
895 opp_table->suspend_opp = new_opp; in _opp_add_static_v2()
899 opp_table->suspend_opp = new_opp; in _opp_add_static_v2()
903 if (new_opp->clock_latency_ns > opp_table->clock_latency_ns_max) in _opp_add_static_v2()
904 opp_table->clock_latency_ns_max = new_opp->clock_latency_ns; in _opp_add_static_v2()
916 blocking_notifier_call_chain(&opp_table->head, OPP_EVENT_ADD, new_opp); in _opp_add_static_v2()
920 _of_opp_free_required_opps(opp_table, new_opp); in _opp_add_static_v2()
928 static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table) in _of_add_opp_table_v2() argument
935 mutex_lock(&opp_table->lock); in _of_add_opp_table_v2()
936 if (opp_table->parsed_static_opps) { in _of_add_opp_table_v2()
937 opp_table->parsed_static_opps++; in _of_add_opp_table_v2()
938 mutex_unlock(&opp_table->lock); in _of_add_opp_table_v2()
942 opp_table->parsed_static_opps = 1; in _of_add_opp_table_v2()
943 mutex_unlock(&opp_table->lock); in _of_add_opp_table_v2()
946 for_each_available_child_of_node(opp_table->np, np) { in _of_add_opp_table_v2()
947 opp = _opp_add_static_v2(opp_table, dev, np); in _of_add_opp_table_v2()
966 list_for_each_entry(opp, &opp_table->opp_list, node) { in _of_add_opp_table_v2()
969 opp_table->genpd_performance_state = true; in _of_add_opp_table_v2()
974 lazy_link_required_opp_table(opp_table); in _of_add_opp_table_v2()
979 _opp_remove_all_static(opp_table); in _of_add_opp_table_v2()
985 static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table) in _of_add_opp_table_v1() argument
991 mutex_lock(&opp_table->lock); in _of_add_opp_table_v1()
992 if (opp_table->parsed_static_opps) { in _of_add_opp_table_v1()
993 opp_table->parsed_static_opps++; in _of_add_opp_table_v1()
994 mutex_unlock(&opp_table->lock); in _of_add_opp_table_v1()
998 opp_table->parsed_static_opps = 1; in _of_add_opp_table_v1()
999 mutex_unlock(&opp_table->lock); in _of_add_opp_table_v1()
1027 ret = _opp_add_v1(opp_table, dev, freq, volt, false); in _of_add_opp_table_v1()
1039 _opp_remove_all_static(opp_table); in _of_add_opp_table_v1()
1046 struct opp_table *opp_table; in _of_add_table_indexed() local
1060 opp_table = _add_opp_table_indexed(dev, index, getclk); in _of_add_table_indexed()
1061 if (IS_ERR(opp_table)) in _of_add_table_indexed()
1062 return PTR_ERR(opp_table); in _of_add_table_indexed()
1068 if (opp_table->np) in _of_add_table_indexed()
1069 ret = _of_add_opp_table_v2(dev, opp_table); in _of_add_table_indexed()
1071 ret = _of_add_opp_table_v1(dev, opp_table); in _of_add_table_indexed()
1074 dev_pm_opp_put_opp_table(opp_table); in _of_add_table_indexed()
1318 struct opp_table *opp_table; in of_get_required_opp_performance_state() local
1325 opp_table = _find_table_of_opp_np(required_np); in of_get_required_opp_performance_state()
1326 if (IS_ERR(opp_table)) { in of_get_required_opp_performance_state()
1328 __func__, np, PTR_ERR(opp_table)); in of_get_required_opp_performance_state()
1332 opp = _find_opp_of_np(opp_table, required_np); in of_get_required_opp_performance_state()
1338 dev_pm_opp_put_opp_table(opp_table); in of_get_required_opp_performance_state()