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()
110 static struct opp_table *_find_table_of_opp_np(struct device_node *opp_np) in _find_table_of_opp_np()
112 struct opp_table *opp_table; in _find_table_of_opp_np() local
124 list_for_each_entry(opp_table, &opp_tables, node) { in _find_table_of_opp_np()
125 if (opp_table_np == opp_table->np) { in _find_table_of_opp_np()
126 _get_opp_table_kref(opp_table); in _find_table_of_opp_np()
127 return opp_table; in _find_table_of_opp_np()
136 static void _opp_table_free_required_tables(struct opp_table *opp_table) in _opp_table_free_required_tables() argument
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()
161 static void _opp_table_alloc_required_tables(struct opp_table *opp_table, in _opp_table_alloc_required_tables() argument
165 struct opp_table **required_opp_tables; 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()
214 _opp_table_free_required_tables(opp_table); in _opp_table_alloc_required_tables()
219 void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, in _of_init_opp_table() argument
234 opp_table->clock_latency_ns_max = val; in _of_init_opp_table()
236 &opp_table->voltage_tolerance_v1); in _of_init_opp_table()
239 opp_table->is_genpd = true; 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()
255 _opp_table_alloc_required_tables(opp_table, dev, opp_np); in _of_init_opp_table()
259 void _of_clear_opp_table(struct opp_table *opp_table) in _of_clear_opp_table() argument
261 _opp_table_free_required_tables(opp_table); in _of_clear_opp_table()
268 void _of_opp_free_required_opps(struct opp_table *opp_table, in _of_opp_free_required_opps() argument
277 for (i = 0; i < opp_table->required_opp_count; i++) { in _of_opp_free_required_opps()
290 static int _of_opp_alloc_required_opps(struct opp_table *opp_table, in _of_opp_alloc_required_opps() argument
294 struct opp_table *required_table; in _of_opp_alloc_required_opps()
296 int i, ret, count = opp_table->required_opp_count; in _of_opp_alloc_required_opps()
308 required_table = opp_table->required_opp_tables[i]; in _of_opp_alloc_required_opps()
330 _of_opp_free_required_opps(opp_table, opp); in _of_opp_alloc_required_opps()
335 static bool _opp_is_supported(struct device *dev, struct opp_table *opp_table, in _opp_is_supported() argument
338 unsigned int count = opp_table->supported_hw_count; in _opp_is_supported()
342 if (!opp_table->supported_hw) { in _opp_is_supported()
365 if (!(version & opp_table->supported_hw[count])) in _opp_is_supported()
373 struct opp_table *opp_table) in opp_parse_supplies() argument
376 int supplies = opp_table->regulator_count, vcount, icount, ret, i, j; in opp_parse_supplies()
381 if (opp_table->prop_name) { in opp_parse_supplies()
383 opp_table->prop_name); in opp_parse_supplies()
396 opp_table->regulator_count = 0; in opp_parse_supplies()
411 supplies = opp_table->regulator_count = 1; in opp_parse_supplies()
444 if (opp_table->prop_name) { in opp_parse_supplies()
446 opp_table->prop_name); in opp_parse_supplies()
548 static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, in _opp_add_static_v2() argument
557 new_opp = _opp_allocate(opp_table); in _opp_add_static_v2()
564 if (!opp_table->is_genpd) { in _opp_add_static_v2()
582 if (!_opp_is_supported(dev, opp_table, np)) { in _opp_add_static_v2()
593 ret = _of_opp_alloc_required_opps(opp_table, new_opp); in _opp_add_static_v2()
600 ret = opp_parse_supplies(new_opp, dev, opp_table); in _opp_add_static_v2()
604 if (opp_table->is_genpd) in _opp_add_static_v2()
607 ret = _opp_add(dev, new_opp, opp_table, rate_not_available); in _opp_add_static_v2()
617 if (opp_table->suspend_opp) { in _opp_add_static_v2()
619 if (new_opp->rate > opp_table->suspend_opp->rate) { in _opp_add_static_v2()
620 opp_table->suspend_opp->suspend = false; in _opp_add_static_v2()
622 opp_table->suspend_opp = new_opp; in _opp_add_static_v2()
626 opp_table->suspend_opp = new_opp; in _opp_add_static_v2()
630 if (new_opp->clock_latency_ns > opp_table->clock_latency_ns_max) in _opp_add_static_v2()
631 opp_table->clock_latency_ns_max = new_opp->clock_latency_ns; in _opp_add_static_v2()
642 blocking_notifier_call_chain(&opp_table->head, OPP_EVENT_ADD, new_opp); in _opp_add_static_v2()
646 _of_opp_free_required_opps(opp_table, new_opp); in _opp_add_static_v2()
654 static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table) in _of_add_opp_table_v2() argument
661 if (opp_table->parsed_static_opps) { in _of_add_opp_table_v2()
662 kref_get(&opp_table->list_kref); in _of_add_opp_table_v2()
671 kref_init(&opp_table->list_kref); in _of_add_opp_table_v2()
674 for_each_available_child_of_node(opp_table->np, np) { in _of_add_opp_table_v2()
675 opp = _opp_add_static_v2(opp_table, dev, np); in _of_add_opp_table_v2()
691 list_for_each_entry(opp, &opp_table->opp_list, node) in _of_add_opp_table_v2()
702 opp_table->genpd_performance_state = true; in _of_add_opp_table_v2()
704 opp_table->parsed_static_opps = true; in _of_add_opp_table_v2()
710 static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table) in _of_add_opp_table_v1() argument
737 ret = _opp_add_v1(opp_table, dev, freq, volt, false); in _of_add_opp_table_v1()
768 struct opp_table *opp_table; in dev_pm_opp_of_add_table() local
771 opp_table = dev_pm_opp_get_opp_table_indexed(dev, 0); in dev_pm_opp_of_add_table()
772 if (!opp_table) in dev_pm_opp_of_add_table()
779 if (opp_table->np) in dev_pm_opp_of_add_table()
780 ret = _of_add_opp_table_v2(dev, opp_table); in dev_pm_opp_of_add_table()
782 ret = _of_add_opp_table_v1(dev, opp_table); in dev_pm_opp_of_add_table()
785 dev_pm_opp_put_opp_table(opp_table); in dev_pm_opp_of_add_table()
812 struct opp_table *opp_table; in dev_pm_opp_of_add_table_indexed() local
826 opp_table = dev_pm_opp_get_opp_table_indexed(dev, index); in dev_pm_opp_of_add_table_indexed()
827 if (!opp_table) in dev_pm_opp_of_add_table_indexed()
830 ret = _of_add_opp_table_v2(dev, opp_table); in dev_pm_opp_of_add_table_indexed()
832 dev_pm_opp_put_opp_table(opp_table); in dev_pm_opp_of_add_table_indexed()
984 struct opp_table *opp_table; in of_get_required_opp_performance_state() local
991 opp_table = _find_table_of_opp_np(required_np); in of_get_required_opp_performance_state()
992 if (IS_ERR(opp_table)) { in of_get_required_opp_performance_state()
994 __func__, np, PTR_ERR(opp_table)); in of_get_required_opp_performance_state()
998 opp = _find_opp_of_np(opp_table, required_np); in of_get_required_opp_performance_state()
1004 dev_pm_opp_put_opp_table(opp_table); in of_get_required_opp_performance_state()