Lines Matching refs:w

160 static bool dapm_dirty_widget(struct snd_soc_dapm_widget *w)  in dapm_dirty_widget()  argument
162 return !list_empty(&w->dirty); in dapm_dirty_widget()
165 static void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason) in dapm_mark_dirty() argument
167 dapm_assert_locked(w->dapm); in dapm_mark_dirty()
169 if (!dapm_dirty_widget(w)) { in dapm_mark_dirty()
170 dev_vdbg(w->dapm->dev, "Marking %s dirty due to %s\n", in dapm_mark_dirty()
171 w->name, reason); in dapm_mark_dirty()
172 list_add_tail(&w->dirty, &w->dapm->card->dapm_dirty); in dapm_mark_dirty()
184 struct snd_soc_dapm_widget *w, enum snd_soc_dapm_direction dir) in dapm_widget_invalidate_paths() argument
191 dapm_assert_locked(w->dapm); in dapm_widget_invalidate_paths()
193 if (w->endpoints[dir] == -1) in dapm_widget_invalidate_paths()
196 list_add_tail(&w->work_list, &list); in dapm_widget_invalidate_paths()
197 w->endpoints[dir] = -1; in dapm_widget_invalidate_paths()
199 list_for_each_entry(w, &list, work_list) { in dapm_widget_invalidate_paths()
200 snd_soc_dapm_widget_for_each_path(w, dir, p) { in dapm_widget_invalidate_paths()
224 static void dapm_widget_invalidate_input_paths(struct snd_soc_dapm_widget *w) in dapm_widget_invalidate_input_paths() argument
226 dapm_widget_invalidate_paths(w, SND_SOC_DAPM_DIR_IN); in dapm_widget_invalidate_input_paths()
241 static void dapm_widget_invalidate_output_paths(struct snd_soc_dapm_widget *w) in dapm_widget_invalidate_output_paths() argument
243 dapm_widget_invalidate_paths(w, SND_SOC_DAPM_DIR_OUT); in dapm_widget_invalidate_output_paths()
280 struct snd_soc_dapm_widget *w; in dapm_mark_endpoints_dirty() local
284 list_for_each_entry(w, &card->widgets, list) { in dapm_mark_endpoints_dirty()
285 if (w->is_ep) { in dapm_mark_endpoints_dirty()
286 dapm_mark_dirty(w, "Rechecking endpoints"); in dapm_mark_endpoints_dirty()
287 if (w->is_ep & SND_SOC_DAPM_EP_SINK) in dapm_mark_endpoints_dirty()
288 dapm_widget_invalidate_output_paths(w); in dapm_mark_endpoints_dirty()
289 if (w->is_ep & SND_SOC_DAPM_EP_SOURCE) in dapm_mark_endpoints_dirty()
290 dapm_widget_invalidate_input_paths(w); in dapm_mark_endpoints_dirty()
540 struct snd_soc_dapm_widget *w; in dapm_reset() local
546 list_for_each_entry(w, &card->widgets, list) { in dapm_reset()
547 w->new_power = w->power; in dapm_reset()
548 w->power_checked = false; in dapm_reset()
593 struct snd_soc_dapm_widget *w = wcache->widget; in dapm_wcache_lookup() local
598 if (w) { in dapm_wcache_lookup()
599 wlist = &w->dapm->card->widgets; in dapm_wcache_lookup()
601 list_for_each_entry_from(w, wlist, list) { in dapm_wcache_lookup()
602 if (!strcmp(name, w->name)) in dapm_wcache_lookup()
603 return w; in dapm_wcache_lookup()
614 struct snd_soc_dapm_widget *w) in dapm_wcache_update() argument
616 wcache->widget = w; in dapm_wcache_update()
690 struct snd_soc_dapm_widget *w) in dapm_connect_mux() argument
692 const struct snd_kcontrol_new *kcontrol = &w->kcontrol_news[0]; in dapm_connect_mux()
770 struct snd_soc_dapm_widget *w; in dapm_is_shared_kcontrol() local
775 list_for_each_entry(w, &dapm->card->widgets, list) { in dapm_is_shared_kcontrol()
776 if (w == kcontrolw || w->dapm != kcontrolw->dapm) in dapm_is_shared_kcontrol()
778 for (i = 0; i < w->num_kcontrols; i++) { in dapm_is_shared_kcontrol()
779 if (&w->kcontrol_news[i] == kcontrol_new) { in dapm_is_shared_kcontrol()
780 if (w->kcontrols) in dapm_is_shared_kcontrol()
781 *kcontrol = w->kcontrols[i]; in dapm_is_shared_kcontrol()
794 static int dapm_create_or_share_kcontrol(struct snd_soc_dapm_widget *w, in dapm_create_or_share_kcontrol() argument
797 struct snd_soc_dapm_context *dapm = w->dapm; in dapm_create_or_share_kcontrol()
814 shared = dapm_is_shared_kcontrol(dapm, w, &w->kcontrol_news[kci], in dapm_create_or_share_kcontrol()
822 switch (w->id) { in dapm_create_or_share_kcontrol()
851 w->name + prefix_len, in dapm_create_or_share_kcontrol()
852 w->kcontrol_news[kci].name); in dapm_create_or_share_kcontrol()
859 name = w->name + prefix_len; in dapm_create_or_share_kcontrol()
862 name = w->kcontrol_news[kci].name; in dapm_create_or_share_kcontrol()
865 kcontrol = snd_soc_cnew(&w->kcontrol_news[kci], NULL, name, in dapm_create_or_share_kcontrol()
874 ret = dapm_kcontrol_data_alloc(w, kcontrol); in dapm_create_or_share_kcontrol()
884 w->name, name, ret); in dapm_create_or_share_kcontrol()
889 ret = dapm_kcontrol_add_widget(kcontrol, w); in dapm_create_or_share_kcontrol()
891 w->kcontrols[kci] = kcontrol; in dapm_create_or_share_kcontrol()
900 static int dapm_new_mixer(struct snd_soc_dapm_widget *w) in dapm_new_mixer() argument
907 for (i = 0; i < w->num_kcontrols; i++) { in dapm_new_mixer()
909 snd_soc_dapm_widget_for_each_source_path(w, path) { in dapm_new_mixer()
911 if (path->name != (char *)w->kcontrol_news[i].name) in dapm_new_mixer()
914 if (!w->kcontrols[i]) { in dapm_new_mixer()
915 ret = dapm_create_or_share_kcontrol(w, i); in dapm_new_mixer()
920 dapm_kcontrol_add_path(w->kcontrols[i], path); in dapm_new_mixer()
922 data = snd_kcontrol_chip(w->kcontrols[i]); in dapm_new_mixer()
935 static int dapm_new_mux(struct snd_soc_dapm_widget *w) in dapm_new_mux() argument
937 struct snd_soc_dapm_context *dapm = w->dapm; in dapm_new_mux()
943 switch (w->id) { in dapm_new_mux()
956 if (w->num_kcontrols != 1) { in dapm_new_mux()
959 w->name); in dapm_new_mux()
963 if (list_empty(&w->edges[dir])) { in dapm_new_mux()
964 dev_err(dapm->dev, "ASoC: %s %s has no paths\n", type, w->name); in dapm_new_mux()
968 ret = dapm_create_or_share_kcontrol(w, 0); in dapm_new_mux()
972 snd_soc_dapm_widget_for_each_path(w, dir, path) { in dapm_new_mux()
974 dapm_kcontrol_add_path(w->kcontrols[0], path); in dapm_new_mux()
981 static int dapm_new_pga(struct snd_soc_dapm_widget *w) in dapm_new_pga() argument
985 for (i = 0; i < w->num_kcontrols; i++) { in dapm_new_pga()
986 ret = dapm_create_or_share_kcontrol(w, i); in dapm_new_pga()
995 static int dapm_new_dai_link(struct snd_soc_dapm_widget *w) in dapm_new_dai_link() argument
999 struct snd_soc_dapm_context *dapm = w->dapm; in dapm_new_dai_link()
1003 if (w->num_params <= 1) in dapm_new_dai_link()
1007 for (i = 0; i < w->num_kcontrols; i++) { in dapm_new_dai_link()
1008 kcontrol = snd_soc_cnew(&w->kcontrol_news[i], w, in dapm_new_dai_link()
1009 w->name, NULL); in dapm_new_dai_link()
1014 w->name, w->kcontrol_news[i].name, ret); in dapm_new_dai_link()
1017 kcontrol->private_data = w; in dapm_new_dai_link()
1018 w->kcontrols[i] = kcontrol; in dapm_new_dai_link()
1047 struct snd_soc_dapm_widget *w; in dapm_widget_list_create() local
1055 *list = kzalloc(sizeof(**list) + size * sizeof(*w), GFP_KERNEL); in dapm_widget_list_create()
1059 list_for_each_entry(w, widgets, work_list) in dapm_widget_list_create()
1060 (*list)->widgets[i++] = w; in dapm_widget_list_create()
1157 struct snd_soc_dapm_widget *w; in snd_soc_dapm_dai_get_connected_widgets() local
1168 list_for_each_entry(w, &card->widgets, list) { in snd_soc_dapm_dai_get_connected_widgets()
1169 w->endpoints[SND_SOC_DAPM_DIR_IN] = -1; in snd_soc_dapm_dai_get_connected_widgets()
1170 w->endpoints[SND_SOC_DAPM_DIR_OUT] = -1; in snd_soc_dapm_dai_get_connected_widgets()
1194 int dapm_regulator_event(struct snd_soc_dapm_widget *w, in dapm_regulator_event() argument
1199 soc_dapm_async_complete(w->dapm); in dapm_regulator_event()
1202 if (w->on_val & SND_SOC_DAPM_REGULATOR_BYPASS) { in dapm_regulator_event()
1203 ret = regulator_allow_bypass(w->regulator, false); in dapm_regulator_event()
1205 dev_warn(w->dapm->dev, in dapm_regulator_event()
1207 w->name, ret); in dapm_regulator_event()
1210 return regulator_enable(w->regulator); in dapm_regulator_event()
1212 if (w->on_val & SND_SOC_DAPM_REGULATOR_BYPASS) { in dapm_regulator_event()
1213 ret = regulator_allow_bypass(w->regulator, true); in dapm_regulator_event()
1215 dev_warn(w->dapm->dev, in dapm_regulator_event()
1217 w->name, ret); in dapm_regulator_event()
1220 return regulator_disable_deferred(w->regulator, w->shift); in dapm_regulator_event()
1228 int dapm_clock_event(struct snd_soc_dapm_widget *w, in dapm_clock_event() argument
1231 if (!w->clk) in dapm_clock_event()
1234 soc_dapm_async_complete(w->dapm); in dapm_clock_event()
1238 return clk_prepare_enable(w->clk); in dapm_clock_event()
1240 clk_disable_unprepare(w->clk); in dapm_clock_event()
1248 static int dapm_widget_power_check(struct snd_soc_dapm_widget *w) in dapm_widget_power_check() argument
1250 if (w->power_checked) in dapm_widget_power_check()
1251 return w->new_power; in dapm_widget_power_check()
1253 if (w->force) in dapm_widget_power_check()
1254 w->new_power = 1; in dapm_widget_power_check()
1256 w->new_power = w->power_check(w); in dapm_widget_power_check()
1258 w->power_checked = true; in dapm_widget_power_check()
1260 return w->new_power; in dapm_widget_power_check()
1265 static int dapm_generic_check_power(struct snd_soc_dapm_widget *w) in dapm_generic_check_power() argument
1269 DAPM_UPDATE_STAT(w, power_checks); in dapm_generic_check_power()
1271 in = is_connected_input_ep(w, NULL); in dapm_generic_check_power()
1272 out = is_connected_output_ep(w, NULL); in dapm_generic_check_power()
1277 static int dapm_supply_check_power(struct snd_soc_dapm_widget *w) in dapm_supply_check_power() argument
1281 DAPM_UPDATE_STAT(w, power_checks); in dapm_supply_check_power()
1284 snd_soc_dapm_widget_for_each_sink_path(w, path) { in dapm_supply_check_power()
1285 DAPM_UPDATE_STAT(w, neighbour_checks); in dapm_supply_check_power()
1301 static int dapm_always_on_check_power(struct snd_soc_dapm_widget *w) in dapm_always_on_check_power() argument
1338 struct snd_soc_dapm_widget *w; in dapm_seq_insert() local
1340 list_for_each_entry(w, list, power_list) in dapm_seq_insert()
1341 if (dapm_seq_compare(new_widget, w, power_up) < 0) { in dapm_seq_insert()
1342 list_add_tail(&new_widget->power_list, &w->power_list); in dapm_seq_insert()
1350 struct snd_soc_dapm_widget *w, int event) in dapm_seq_check_event() argument
1385 if (w->new_power != power) in dapm_seq_check_event()
1388 if (w->event && (w->event_flags & event)) { in dapm_seq_check_event()
1389 pop_dbg(w->dapm->dev, card->pop_time, "pop test : %s %s\n", in dapm_seq_check_event()
1390 w->name, ev_name); in dapm_seq_check_event()
1391 soc_dapm_async_complete(w->dapm); in dapm_seq_check_event()
1392 trace_snd_soc_dapm_widget_event_start(w, event); in dapm_seq_check_event()
1393 ret = w->event(w, NULL, event); in dapm_seq_check_event()
1394 trace_snd_soc_dapm_widget_event_done(w, event); in dapm_seq_check_event()
1396 dev_err(w->dapm->dev, "ASoC: %s: %s event failed: %d\n", in dapm_seq_check_event()
1397 ev_name, w->name, ret); in dapm_seq_check_event()
1406 struct snd_soc_dapm_widget *w; in dapm_seq_run_coalesced() local
1411 w = list_first_entry(pending, struct snd_soc_dapm_widget, power_list); in dapm_seq_run_coalesced()
1412 reg = w->reg; in dapm_seq_run_coalesced()
1413 dapm = w->dapm; in dapm_seq_run_coalesced()
1415 list_for_each_entry(w, pending, power_list) { in dapm_seq_run_coalesced()
1416 WARN_ON(reg != w->reg || dapm != w->dapm); in dapm_seq_run_coalesced()
1417 w->power = w->new_power; in dapm_seq_run_coalesced()
1419 mask |= w->mask << w->shift; in dapm_seq_run_coalesced()
1420 if (w->power) in dapm_seq_run_coalesced()
1421 value |= w->on_val << w->shift; in dapm_seq_run_coalesced()
1423 value |= w->off_val << w->shift; in dapm_seq_run_coalesced()
1427 w->name, reg, value, mask); in dapm_seq_run_coalesced()
1430 dapm_seq_check_event(card, w, SND_SOC_DAPM_PRE_PMU); in dapm_seq_run_coalesced()
1431 dapm_seq_check_event(card, w, SND_SOC_DAPM_PRE_PMD); in dapm_seq_run_coalesced()
1446 list_for_each_entry(w, pending, power_list) { in dapm_seq_run_coalesced()
1447 dapm_seq_check_event(card, w, SND_SOC_DAPM_POST_PMU); in dapm_seq_run_coalesced()
1448 dapm_seq_check_event(card, w, SND_SOC_DAPM_POST_PMD); in dapm_seq_run_coalesced()
1463 struct snd_soc_dapm_widget *w, *n; in dapm_seq_run() local
1478 list_for_each_entry_safe(w, n, list, power_list) { in dapm_seq_run()
1482 if (sort[w->id] != cur_sort || w->reg != cur_reg || in dapm_seq_run()
1483 w->dapm != cur_dapm || w->subseq != cur_subseq) { in dapm_seq_run()
1495 if (cur_dapm && w->dapm != cur_dapm) in dapm_seq_run()
1505 switch (w->id) { in dapm_seq_run()
1507 if (!w->event) in dapm_seq_run()
1508 list_for_each_entry_safe_continue(w, n, list, in dapm_seq_run()
1512 ret = w->event(w, in dapm_seq_run()
1515 ret = w->event(w, in dapm_seq_run()
1520 if (!w->event) in dapm_seq_run()
1521 list_for_each_entry_safe_continue(w, n, list, in dapm_seq_run()
1525 ret = w->event(w, in dapm_seq_run()
1528 ret = w->event(w, in dapm_seq_run()
1534 cur_sort = sort[w->id]; in dapm_seq_run()
1535 cur_subseq = w->subseq; in dapm_seq_run()
1536 cur_reg = w->reg; in dapm_seq_run()
1537 cur_dapm = w->dapm; in dapm_seq_run()
1538 list_move(&w->power_list, &pending); in dapm_seq_run()
1543 dev_err(w->dapm->dev, in dapm_seq_run()
1566 struct snd_soc_dapm_widget *w = NULL; in dapm_widget_update() local
1576 w = wlist->widgets[wi]; in dapm_widget_update()
1578 if (w->event && (w->event_flags & SND_SOC_DAPM_PRE_REG)) { in dapm_widget_update()
1579 ret = w->event(w, update->kcontrol, SND_SOC_DAPM_PRE_REG); in dapm_widget_update()
1581 dev_err(w->dapm->dev, "ASoC: %s DAPM pre-event failed: %d\n", in dapm_widget_update()
1582 w->name, ret); in dapm_widget_update()
1586 if (!w) in dapm_widget_update()
1589 ret = soc_dapm_update_bits(w->dapm, update->reg, update->mask, in dapm_widget_update()
1592 dev_err(w->dapm->dev, "ASoC: %s DAPM update failed: %d\n", in dapm_widget_update()
1593 w->name, ret); in dapm_widget_update()
1596 w = wlist->widgets[wi]; in dapm_widget_update()
1598 if (w->event && (w->event_flags & SND_SOC_DAPM_POST_REG)) { in dapm_widget_update()
1599 ret = w->event(w, update->kcontrol, SND_SOC_DAPM_POST_REG); in dapm_widget_update()
1601 dev_err(w->dapm->dev, "ASoC: %s DAPM post-event failed: %d\n", in dapm_widget_update()
1602 w->name, ret); in dapm_widget_update()
1694 static void dapm_widget_set_power(struct snd_soc_dapm_widget *w, bool power, in dapm_widget_set_power() argument
1700 if (w->power == power) in dapm_widget_set_power()
1703 trace_snd_soc_dapm_widget_power(w, power); in dapm_widget_set_power()
1708 snd_soc_dapm_widget_for_each_source_path(w, path) in dapm_widget_set_power()
1712 if (!w->is_supply) { in dapm_widget_set_power()
1713 snd_soc_dapm_widget_for_each_sink_path(w, path) in dapm_widget_set_power()
1719 dapm_seq_insert(w, up_list, true); in dapm_widget_set_power()
1721 dapm_seq_insert(w, down_list, false); in dapm_widget_set_power()
1724 static void dapm_power_one_widget(struct snd_soc_dapm_widget *w, in dapm_power_one_widget() argument
1730 switch (w->id) { in dapm_power_one_widget()
1732 dapm_seq_insert(w, down_list, false); in dapm_power_one_widget()
1735 dapm_seq_insert(w, up_list, true); in dapm_power_one_widget()
1739 power = dapm_widget_power_check(w); in dapm_power_one_widget()
1741 dapm_widget_set_power(w, power, up_list, down_list); in dapm_power_one_widget()
1773 struct snd_soc_dapm_widget *w; in dapm_power_widgets() local
1799 list_for_each_entry(w, &card->dapm_dirty, dirty) { in dapm_power_widgets()
1800 dapm_power_one_widget(w, &up_list, &down_list); in dapm_power_widgets()
1803 list_for_each_entry(w, &card->widgets, list) { in dapm_power_widgets()
1804 switch (w->id) { in dapm_power_widgets()
1810 list_del_init(&w->dirty); in dapm_power_widgets()
1814 if (w->new_power) { in dapm_power_widgets()
1815 d = w->dapm; in dapm_power_widgets()
1824 switch (w->id) { in dapm_power_widgets()
1866 list_for_each_entry(w, &down_list, power_list) { in dapm_power_widgets()
1867 dapm_seq_check_event(card, w, SND_SOC_DAPM_WILL_PMD); in dapm_power_widgets()
1870 list_for_each_entry(w, &up_list, power_list) { in dapm_power_widgets()
1871 dapm_seq_check_event(card, w, SND_SOC_DAPM_WILL_PMU); in dapm_power_widgets()
1912 struct snd_soc_dapm_widget *w = file->private_data; in dapm_widget_power_read_file() local
1913 struct snd_soc_card *card = w->dapm->card; in dapm_widget_power_read_file()
1927 if (w->is_supply) { in dapm_widget_power_read_file()
1931 in = is_connected_input_ep(w, NULL); in dapm_widget_power_read_file()
1932 out = is_connected_output_ep(w, NULL); in dapm_widget_power_read_file()
1936 w->name, w->power ? "On" : "Off", in dapm_widget_power_read_file()
1937 w->force ? " (forced)" : "", in, out); in dapm_widget_power_read_file()
1939 if (w->reg >= 0) in dapm_widget_power_read_file()
1942 w->reg, w->reg, w->mask << w->shift); in dapm_widget_power_read_file()
1946 if (w->sname) in dapm_widget_power_read_file()
1948 w->sname, in dapm_widget_power_read_file()
1949 w->active ? "active" : "inactive"); in dapm_widget_power_read_file()
1953 snd_soc_dapm_widget_for_each_path(w, dir, p) { in dapm_widget_power_read_file()
1954 if (p->connected && !p->connected(w, p->node[rdir])) in dapm_widget_power_read_file()
2041 static void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w) in dapm_debugfs_add_widget() argument
2043 struct snd_soc_dapm_context *dapm = w->dapm; in dapm_debugfs_add_widget()
2046 if (!dapm->debugfs_dapm || !w->name) in dapm_debugfs_add_widget()
2049 d = debugfs_create_file(w->name, 0444, in dapm_debugfs_add_widget()
2050 dapm->debugfs_dapm, w, in dapm_debugfs_add_widget()
2053 dev_warn(w->dapm->dev, in dapm_debugfs_add_widget()
2055 w->name); in dapm_debugfs_add_widget()
2069 static inline void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w) in dapm_debugfs_add_widget() argument
2187 struct snd_soc_dapm_widget *w; in dapm_widget_show_component() local
2198 list_for_each_entry(w, &cmpnt->card->widgets, list) { in dapm_widget_show_component()
2199 if (w->dapm != dapm) in dapm_widget_show_component()
2203 switch (w->id) { in dapm_widget_show_component()
2218 if (w->name) in dapm_widget_show_component()
2220 w->name, w->power ? "On":"Off"); in dapm_widget_show_component()
2282 void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w) in snd_soc_dapm_free_widget() argument
2287 list_del(&w->list); in snd_soc_dapm_free_widget()
2294 snd_soc_dapm_widget_for_each_path_safe(w, dir, p, next_p) in snd_soc_dapm_free_widget()
2298 kfree(w->kcontrols); in snd_soc_dapm_free_widget()
2299 kfree_const(w->name); in snd_soc_dapm_free_widget()
2300 kfree(w); in snd_soc_dapm_free_widget()
2312 struct snd_soc_dapm_widget *w, *next_w; in dapm_free_widgets() local
2314 list_for_each_entry_safe(w, next_w, &dapm->card->widgets, list) { in dapm_free_widgets()
2315 if (w->dapm != dapm) in dapm_free_widgets()
2317 snd_soc_dapm_free_widget(w); in dapm_free_widgets()
2326 struct snd_soc_dapm_widget *w; in dapm_find_widget() local
2329 list_for_each_entry(w, &dapm->card->widgets, list) { in dapm_find_widget()
2330 if (!strcmp(w->name, pin)) { in dapm_find_widget()
2331 if (w->dapm == dapm) in dapm_find_widget()
2332 return w; in dapm_find_widget()
2334 fallback = w; in dapm_find_widget()
2347 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); in snd_soc_dapm_set_pin() local
2351 if (!w) { in snd_soc_dapm_set_pin()
2356 if (w->connected != status) { in snd_soc_dapm_set_pin()
2357 dapm_mark_dirty(w, "pin configuration"); in snd_soc_dapm_set_pin()
2358 dapm_widget_invalidate_input_paths(w); in snd_soc_dapm_set_pin()
2359 dapm_widget_invalidate_output_paths(w); in snd_soc_dapm_set_pin()
2362 w->connected = status; in snd_soc_dapm_set_pin()
2364 w->force = 0; in snd_soc_dapm_set_pin()
2422 static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w) in dapm_update_widget_flags() argument
2428 switch (w->id) { in dapm_update_widget_flags()
2431 if (w->dapm->card->fully_routed) in dapm_update_widget_flags()
2434 snd_soc_dapm_widget_for_each_source_path(w, p) { in dapm_update_widget_flags()
2446 if (w->dapm->card->fully_routed) in dapm_update_widget_flags()
2449 snd_soc_dapm_widget_for_each_sink_path(w, p) { in dapm_update_widget_flags()
2462 if (!list_empty(&w->edges[dir])) in dapm_update_widget_flags()
2470 w->is_ep = ep; in dapm_update_widget_flags()
2622 struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w; in snd_soc_dapm_add_route() local
2654 list_for_each_entry(w, &dapm->card->widgets, list) { in snd_soc_dapm_add_route()
2655 if (!wsink && !(strcmp(w->name, sink))) { in snd_soc_dapm_add_route()
2656 wtsink = w; in snd_soc_dapm_add_route()
2657 if (w->dapm == dapm) { in snd_soc_dapm_add_route()
2658 wsink = w; in snd_soc_dapm_add_route()
2664 if (!wsource && !(strcmp(w->name, source))) { in snd_soc_dapm_add_route()
2665 wtsource = w; in snd_soc_dapm_add_route()
2666 if (w->dapm == dapm) { in snd_soc_dapm_add_route()
2667 wsource = w; in snd_soc_dapm_add_route()
2918 struct snd_soc_dapm_widget *w; in snd_soc_dapm_new_widgets() local
2923 list_for_each_entry(w, &card->widgets, list) in snd_soc_dapm_new_widgets()
2925 if (w->new) in snd_soc_dapm_new_widgets()
2928 if (w->num_kcontrols) { in snd_soc_dapm_new_widgets()
2929 w->kcontrols = kzalloc(w->num_kcontrols * in snd_soc_dapm_new_widgets()
2932 if (!w->kcontrols) { in snd_soc_dapm_new_widgets()
2938 switch(w->id) { in snd_soc_dapm_new_widgets()
2942 dapm_new_mixer(w); in snd_soc_dapm_new_widgets()
2946 dapm_new_mux(w); in snd_soc_dapm_new_widgets()
2950 dapm_new_pga(w); in snd_soc_dapm_new_widgets()
2953 dapm_new_dai_link(w); in snd_soc_dapm_new_widgets()
2960 if (w->reg >= 0) { in snd_soc_dapm_new_widgets()
2961 soc_dapm_read(w->dapm, w->reg, &val); in snd_soc_dapm_new_widgets()
2962 val = val >> w->shift; in snd_soc_dapm_new_widgets()
2963 val &= w->mask; in snd_soc_dapm_new_widgets()
2964 if (val == w->on_val) in snd_soc_dapm_new_widgets()
2965 w->power = 1; in snd_soc_dapm_new_widgets()
2968 w->new = 1; in snd_soc_dapm_new_widgets()
2970 dapm_mark_dirty(w, "new widget"); in snd_soc_dapm_new_widgets()
2971 dapm_debugfs_add_widget(w); in snd_soc_dapm_new_widgets()
3273 struct snd_soc_dapm_widget *w; in snd_soc_dapm_new_control() local
3276 w = snd_soc_dapm_new_control_unlocked(dapm, widget); in snd_soc_dapm_new_control()
3277 if (!w) in snd_soc_dapm_new_control()
3283 return w; in snd_soc_dapm_new_control()
3291 struct snd_soc_dapm_widget *w; in snd_soc_dapm_new_control_unlocked() local
3295 if ((w = dapm_cnew_widget(widget)) == NULL) in snd_soc_dapm_new_control_unlocked()
3298 switch (w->id) { in snd_soc_dapm_new_control_unlocked()
3300 w->regulator = devm_regulator_get(dapm->dev, w->name); in snd_soc_dapm_new_control_unlocked()
3301 if (IS_ERR(w->regulator)) { in snd_soc_dapm_new_control_unlocked()
3302 ret = PTR_ERR(w->regulator); in snd_soc_dapm_new_control_unlocked()
3304 w->name, ret); in snd_soc_dapm_new_control_unlocked()
3308 if (w->on_val & SND_SOC_DAPM_REGULATOR_BYPASS) { in snd_soc_dapm_new_control_unlocked()
3309 ret = regulator_allow_bypass(w->regulator, true); in snd_soc_dapm_new_control_unlocked()
3311 dev_warn(w->dapm->dev, in snd_soc_dapm_new_control_unlocked()
3313 w->name, ret); in snd_soc_dapm_new_control_unlocked()
3318 w->clk = devm_clk_get(dapm->dev, w->name); in snd_soc_dapm_new_control_unlocked()
3319 if (IS_ERR(w->clk)) { in snd_soc_dapm_new_control_unlocked()
3320 ret = PTR_ERR(w->clk); in snd_soc_dapm_new_control_unlocked()
3322 w->name, ret); in snd_soc_dapm_new_control_unlocked()
3335 w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); in snd_soc_dapm_new_control_unlocked()
3337 w->name = kstrdup_const(widget->name, GFP_KERNEL); in snd_soc_dapm_new_control_unlocked()
3338 if (w->name == NULL) { in snd_soc_dapm_new_control_unlocked()
3339 kfree(w); in snd_soc_dapm_new_control_unlocked()
3343 switch (w->id) { in snd_soc_dapm_new_control_unlocked()
3345 w->is_ep = SND_SOC_DAPM_EP_SOURCE; in snd_soc_dapm_new_control_unlocked()
3346 w->power_check = dapm_generic_check_power; in snd_soc_dapm_new_control_unlocked()
3350 w->is_ep = SND_SOC_DAPM_EP_SOURCE; in snd_soc_dapm_new_control_unlocked()
3351 w->power_check = dapm_generic_check_power; in snd_soc_dapm_new_control_unlocked()
3355 w->is_ep = SND_SOC_DAPM_EP_SINK; in snd_soc_dapm_new_control_unlocked()
3356 w->power_check = dapm_generic_check_power; in snd_soc_dapm_new_control_unlocked()
3360 w->is_ep = SND_SOC_DAPM_EP_SINK; in snd_soc_dapm_new_control_unlocked()
3361 w->power_check = dapm_generic_check_power; in snd_soc_dapm_new_control_unlocked()
3365 w->is_ep = SND_SOC_DAPM_EP_SOURCE; in snd_soc_dapm_new_control_unlocked()
3366 w->power_check = dapm_always_on_check_power; in snd_soc_dapm_new_control_unlocked()
3384 w->power_check = dapm_generic_check_power; in snd_soc_dapm_new_control_unlocked()
3390 w->is_supply = 1; in snd_soc_dapm_new_control_unlocked()
3391 w->power_check = dapm_supply_check_power; in snd_soc_dapm_new_control_unlocked()
3394 w->power_check = dapm_always_on_check_power; in snd_soc_dapm_new_control_unlocked()
3398 w->dapm = dapm; in snd_soc_dapm_new_control_unlocked()
3399 INIT_LIST_HEAD(&w->list); in snd_soc_dapm_new_control_unlocked()
3400 INIT_LIST_HEAD(&w->dirty); in snd_soc_dapm_new_control_unlocked()
3401 list_add_tail(&w->list, &dapm->card->widgets); in snd_soc_dapm_new_control_unlocked()
3404 INIT_LIST_HEAD(&w->edges[dir]); in snd_soc_dapm_new_control_unlocked()
3405 w->endpoints[dir] = -1; in snd_soc_dapm_new_control_unlocked()
3409 w->connected = 1; in snd_soc_dapm_new_control_unlocked()
3410 return w; in snd_soc_dapm_new_control_unlocked()
3427 struct snd_soc_dapm_widget *w; in snd_soc_dapm_new_controls() local
3433 w = snd_soc_dapm_new_control_unlocked(dapm, widget); in snd_soc_dapm_new_controls()
3434 if (!w) { in snd_soc_dapm_new_controls()
3448 static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, in snd_soc_dai_link_event() argument
3453 const struct snd_soc_pcm_stream *config = w->params + w->params_select; in snd_soc_dai_link_event()
3460 WARN_ON(list_empty(&w->edges[SND_SOC_DAPM_DIR_OUT]) || in snd_soc_dai_link_event()
3461 list_empty(&w->edges[SND_SOC_DAPM_DIR_IN]))) in snd_soc_dai_link_event()
3465 source_p = list_first_entry(&w->edges[SND_SOC_DAPM_DIR_OUT], in snd_soc_dai_link_event()
3468 sink_p = list_first_entry(&w->edges[SND_SOC_DAPM_DIR_IN], in snd_soc_dai_link_event()
3479 dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n", in snd_soc_dai_link_event()
3576 struct snd_soc_dapm_widget *w = snd_kcontrol_chip(kcontrol); in snd_soc_dapm_dai_link_get() local
3578 ucontrol->value.enumerated.item[0] = w->params_select; in snd_soc_dapm_dai_link_get()
3586 struct snd_soc_dapm_widget *w = snd_kcontrol_chip(kcontrol); in snd_soc_dapm_dai_link_put() local
3589 if (w->power) in snd_soc_dapm_dai_link_put()
3592 if (ucontrol->value.enumerated.item[0] == w->params_select) in snd_soc_dapm_dai_link_put()
3595 if (ucontrol->value.enumerated.item[0] >= w->num_params) in snd_soc_dapm_dai_link_put()
3598 w->params_select = ucontrol->value.enumerated.item[0]; in snd_soc_dapm_dai_link_put()
3610 struct snd_soc_dapm_widget *w; in snd_soc_dapm_new_pcm() local
3699 w = snd_soc_dapm_new_control_unlocked(&card->dapm, &template); in snd_soc_dapm_new_pcm()
3700 if (!w) { in snd_soc_dapm_new_pcm()
3707 w->params = params; in snd_soc_dapm_new_pcm()
3708 w->num_params = num_params; in snd_soc_dapm_new_pcm()
3710 ret = snd_soc_dapm_add_path(&card->dapm, source, w, NULL, NULL); in snd_soc_dapm_new_pcm()
3713 return snd_soc_dapm_add_path(&card->dapm, w, sink, NULL, NULL); in snd_soc_dapm_new_pcm()
3716 devm_kfree(card->dev, w); in snd_soc_dapm_new_pcm()
3735 struct snd_soc_dapm_widget *w; in snd_soc_dapm_new_dai_widgets() local
3750 w = snd_soc_dapm_new_control_unlocked(dapm, &template); in snd_soc_dapm_new_dai_widgets()
3751 if (!w) { in snd_soc_dapm_new_dai_widgets()
3757 w->priv = dai; in snd_soc_dapm_new_dai_widgets()
3758 dai->playback_widget = w; in snd_soc_dapm_new_dai_widgets()
3769 w = snd_soc_dapm_new_control_unlocked(dapm, &template); in snd_soc_dapm_new_dai_widgets()
3770 if (!w) { in snd_soc_dapm_new_dai_widgets()
3776 w->priv = dai; in snd_soc_dapm_new_dai_widgets()
3777 dai->capture_widget = w; in snd_soc_dapm_new_dai_widgets()
3785 struct snd_soc_dapm_widget *dai_w, *w; in snd_soc_dapm_link_dai_widgets() local
3802 list_for_each_entry(w, &card->widgets, list) { in snd_soc_dapm_link_dai_widgets()
3803 if (w->dapm != dai_w->dapm) in snd_soc_dapm_link_dai_widgets()
3806 switch (w->id) { in snd_soc_dapm_link_dai_widgets()
3814 if (!w->sname || !strstr(w->sname, dai_w->sname)) in snd_soc_dapm_link_dai_widgets()
3819 sink = w; in snd_soc_dapm_link_dai_widgets()
3821 src = w; in snd_soc_dapm_link_dai_widgets()
3825 snd_soc_dapm_add_path(w->dapm, src, sink, NULL, NULL); in snd_soc_dapm_link_dai_widgets()
3871 struct snd_soc_dapm_widget *w; in soc_dapm_dai_stream_event() local
3875 w = dai->playback_widget; in soc_dapm_dai_stream_event()
3877 w = dai->capture_widget; in soc_dapm_dai_stream_event()
3879 if (w) { in soc_dapm_dai_stream_event()
3880 dapm_mark_dirty(w, "stream event"); in soc_dapm_dai_stream_event()
3882 if (w->id == snd_soc_dapm_dai_in) { in soc_dapm_dai_stream_event()
3884 dapm_widget_invalidate_input_paths(w); in soc_dapm_dai_stream_event()
3887 dapm_widget_invalidate_output_paths(w); in soc_dapm_dai_stream_event()
3892 w->active = 1; in soc_dapm_dai_stream_event()
3893 w->is_ep = ep; in soc_dapm_dai_stream_event()
3896 w->active = 0; in soc_dapm_dai_stream_event()
3897 w->is_ep = 0; in soc_dapm_dai_stream_event()
4023 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); in snd_soc_dapm_force_enable_pin_unlocked() local
4025 if (!w) { in snd_soc_dapm_force_enable_pin_unlocked()
4030 dev_dbg(w->dapm->dev, "ASoC: force enable pin %s\n", pin); in snd_soc_dapm_force_enable_pin_unlocked()
4031 if (!w->connected) { in snd_soc_dapm_force_enable_pin_unlocked()
4036 dapm_widget_invalidate_input_paths(w); in snd_soc_dapm_force_enable_pin_unlocked()
4037 dapm_widget_invalidate_output_paths(w); in snd_soc_dapm_force_enable_pin_unlocked()
4038 w->connected = 1; in snd_soc_dapm_force_enable_pin_unlocked()
4040 w->force = 1; in snd_soc_dapm_force_enable_pin_unlocked()
4041 dapm_mark_dirty(w, "force enable"); in snd_soc_dapm_force_enable_pin_unlocked()
4181 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); in snd_soc_dapm_get_pin_status() local
4183 if (w) in snd_soc_dapm_get_pin_status()
4184 return w->connected; in snd_soc_dapm_get_pin_status()
4204 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, false); in snd_soc_dapm_ignore_suspend() local
4206 if (!w) { in snd_soc_dapm_ignore_suspend()
4211 w->ignore_suspend = 1; in snd_soc_dapm_ignore_suspend()
4234 struct snd_soc_dapm_widget *w; in soc_dapm_shutdown_dapm() local
4240 list_for_each_entry(w, &dapm->card->widgets, list) { in soc_dapm_shutdown_dapm()
4241 if (w->dapm != dapm) in soc_dapm_shutdown_dapm()
4243 if (w->power) { in soc_dapm_shutdown_dapm()
4244 dapm_seq_insert(w, &down_list, false); in soc_dapm_shutdown_dapm()
4245 w->power = 0; in soc_dapm_shutdown_dapm()