• Home
  • Raw
  • Download

Lines Matching refs:w

183 static bool dapm_dirty_widget(struct snd_soc_dapm_widget *w)  in dapm_dirty_widget()  argument
185 return !list_empty(&w->dirty); in dapm_dirty_widget()
188 static void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason) in dapm_mark_dirty() argument
190 dapm_assert_locked(w->dapm); in dapm_mark_dirty()
192 if (!dapm_dirty_widget(w)) { in dapm_mark_dirty()
193 dev_vdbg(w->dapm->dev, "Marking %s dirty due to %s\n", in dapm_mark_dirty()
194 w->name, reason); in dapm_mark_dirty()
195 list_add_tail(&w->dirty, &w->dapm->card->dapm_dirty); in dapm_mark_dirty()
207 struct snd_soc_dapm_widget *w, enum snd_soc_dapm_direction dir) in dapm_widget_invalidate_paths() argument
214 dapm_assert_locked(w->dapm); in dapm_widget_invalidate_paths()
216 if (w->endpoints[dir] == -1) in dapm_widget_invalidate_paths()
219 list_add_tail(&w->work_list, &list); in dapm_widget_invalidate_paths()
220 w->endpoints[dir] = -1; in dapm_widget_invalidate_paths()
222 list_for_each_entry(w, &list, work_list) { in dapm_widget_invalidate_paths()
223 snd_soc_dapm_widget_for_each_path(w, dir, p) { in dapm_widget_invalidate_paths()
247 static void dapm_widget_invalidate_input_paths(struct snd_soc_dapm_widget *w) in dapm_widget_invalidate_input_paths() argument
249 dapm_widget_invalidate_paths(w, SND_SOC_DAPM_DIR_IN); in dapm_widget_invalidate_input_paths()
264 static void dapm_widget_invalidate_output_paths(struct snd_soc_dapm_widget *w) in dapm_widget_invalidate_output_paths() argument
266 dapm_widget_invalidate_paths(w, SND_SOC_DAPM_DIR_OUT); in dapm_widget_invalidate_output_paths()
303 struct snd_soc_dapm_widget *w; in dapm_mark_endpoints_dirty() local
307 for_each_card_widgets(card, w) { in dapm_mark_endpoints_dirty()
308 if (w->is_ep) { in dapm_mark_endpoints_dirty()
309 dapm_mark_dirty(w, "Rechecking endpoints"); in dapm_mark_endpoints_dirty()
310 if (w->is_ep & SND_SOC_DAPM_EP_SINK) in dapm_mark_endpoints_dirty()
311 dapm_widget_invalidate_output_paths(w); in dapm_mark_endpoints_dirty()
312 if (w->is_ep & SND_SOC_DAPM_EP_SOURCE) in dapm_mark_endpoints_dirty()
313 dapm_widget_invalidate_input_paths(w); in dapm_mark_endpoints_dirty()
325 struct snd_soc_dapm_widget *w; in dapm_cnew_widget() local
327 w = kmemdup(_widget, sizeof(*_widget), GFP_KERNEL); in dapm_cnew_widget()
328 if (!w) in dapm_cnew_widget()
336 w->sname = kstrdup_const(_widget->sname, GFP_KERNEL); in dapm_cnew_widget()
337 if (!w->sname) { in dapm_cnew_widget()
338 kfree(w); in dapm_cnew_widget()
342 return w; in dapm_cnew_widget()
605 struct snd_soc_dapm_widget *w; in dapm_reset() local
611 for_each_card_widgets(card, w) { in dapm_reset()
612 w->new_power = w->power; in dapm_reset()
613 w->power_checked = false; in dapm_reset()
657 struct snd_soc_dapm_widget *w = wcache->widget; in dapm_wcache_lookup() local
659 if (w) { in dapm_wcache_lookup()
660 struct list_head *wlist = &w->dapm->card->widgets; in dapm_wcache_lookup()
664 list_for_each_entry_from(w, wlist, list) { in dapm_wcache_lookup()
665 if (!strcmp(name, w->name)) in dapm_wcache_lookup()
666 return w; in dapm_wcache_lookup()
677 struct snd_soc_dapm_widget *w) in dapm_wcache_update() argument
679 wcache->widget = w; in dapm_wcache_update()
751 struct snd_soc_dapm_widget *w) in dapm_connect_mux() argument
753 const struct snd_kcontrol_new *kcontrol = &w->kcontrol_news[0]; in dapm_connect_mux()
853 struct snd_soc_dapm_widget *w; in dapm_is_shared_kcontrol() local
858 for_each_card_widgets(dapm->card, w) { in dapm_is_shared_kcontrol()
859 if (w == kcontrolw || w->dapm != kcontrolw->dapm) in dapm_is_shared_kcontrol()
861 for (i = 0; i < w->num_kcontrols; i++) { in dapm_is_shared_kcontrol()
862 if (&w->kcontrol_news[i] == kcontrol_new) { in dapm_is_shared_kcontrol()
863 if (w->kcontrols) in dapm_is_shared_kcontrol()
864 *kcontrol = w->kcontrols[i]; in dapm_is_shared_kcontrol()
877 static int dapm_create_or_share_kcontrol(struct snd_soc_dapm_widget *w, in dapm_create_or_share_kcontrol() argument
880 struct snd_soc_dapm_context *dapm = w->dapm; in dapm_create_or_share_kcontrol()
897 shared = dapm_is_shared_kcontrol(dapm, w, &w->kcontrol_news[kci], in dapm_create_or_share_kcontrol()
905 switch (w->id) { in dapm_create_or_share_kcontrol()
936 w->name + prefix_len, in dapm_create_or_share_kcontrol()
937 w->kcontrol_news[kci].name); in dapm_create_or_share_kcontrol()
944 name = w->name + prefix_len; in dapm_create_or_share_kcontrol()
947 name = w->kcontrol_news[kci].name; in dapm_create_or_share_kcontrol()
950 kcontrol = snd_soc_cnew(&w->kcontrol_news[kci], NULL, name, in dapm_create_or_share_kcontrol()
959 ret = dapm_kcontrol_data_alloc(w, kcontrol, name); in dapm_create_or_share_kcontrol()
969 w->name, name, ret); in dapm_create_or_share_kcontrol()
974 ret = dapm_kcontrol_add_widget(kcontrol, w); in dapm_create_or_share_kcontrol()
976 w->kcontrols[kci] = kcontrol; in dapm_create_or_share_kcontrol()
985 static int dapm_new_mixer(struct snd_soc_dapm_widget *w) in dapm_new_mixer() argument
992 for (i = 0; i < w->num_kcontrols; i++) { in dapm_new_mixer()
994 snd_soc_dapm_widget_for_each_source_path(w, path) { in dapm_new_mixer()
996 if (path->name != (char *)w->kcontrol_news[i].name) in dapm_new_mixer()
999 if (!w->kcontrols[i]) { in dapm_new_mixer()
1000 ret = dapm_create_or_share_kcontrol(w, i); in dapm_new_mixer()
1005 dapm_kcontrol_add_path(w->kcontrols[i], path); in dapm_new_mixer()
1007 data = snd_kcontrol_chip(w->kcontrols[i]); in dapm_new_mixer()
1020 static int dapm_new_mux(struct snd_soc_dapm_widget *w) in dapm_new_mux() argument
1022 struct snd_soc_dapm_context *dapm = w->dapm; in dapm_new_mux()
1028 switch (w->id) { in dapm_new_mux()
1041 if (w->num_kcontrols != 1) { in dapm_new_mux()
1044 w->name); in dapm_new_mux()
1048 if (list_empty(&w->edges[dir])) { in dapm_new_mux()
1049 dev_err(dapm->dev, "ASoC: %s %s has no paths\n", type, w->name); in dapm_new_mux()
1053 ret = dapm_create_or_share_kcontrol(w, 0); in dapm_new_mux()
1057 snd_soc_dapm_widget_for_each_path(w, dir, path) { in dapm_new_mux()
1059 dapm_kcontrol_add_path(w->kcontrols[0], path); in dapm_new_mux()
1066 static int dapm_new_pga(struct snd_soc_dapm_widget *w) in dapm_new_pga() argument
1070 for (i = 0; i < w->num_kcontrols; i++) { in dapm_new_pga()
1071 int ret = dapm_create_or_share_kcontrol(w, i); in dapm_new_pga()
1080 static int dapm_new_dai_link(struct snd_soc_dapm_widget *w) in dapm_new_dai_link() argument
1083 struct snd_soc_pcm_runtime *rtd = w->priv; in dapm_new_dai_link()
1090 for (i = 0; i < w->num_kcontrols; i++) { in dapm_new_dai_link()
1091 struct snd_soc_dapm_context *dapm = w->dapm; in dapm_new_dai_link()
1093 struct snd_kcontrol *kcontrol = snd_soc_cnew(&w->kcontrol_news[i], in dapm_new_dai_link()
1094 w, w->name, NULL); in dapm_new_dai_link()
1100 w->name, w->kcontrol_news[i].name, ret); in dapm_new_dai_link()
1103 kcontrol->private_data = w; in dapm_new_dai_link()
1104 w->kcontrols[i] = kcontrol; in dapm_new_dai_link()
1138 struct snd_soc_dapm_widget *w; in dapm_widget_list_create() local
1150 list_for_each_entry(w, widgets, work_list) in dapm_widget_list_create()
1151 (*list)->widgets[i++] = w; in dapm_widget_list_create()
1308 struct snd_soc_dapm_widget *w; in snd_soc_dapm_dai_get_connected_widgets() local
1316 w = dai->playback_widget; in snd_soc_dapm_dai_get_connected_widgets()
1317 invalidate_paths_ep(w, SND_SOC_DAPM_DIR_OUT); in snd_soc_dapm_dai_get_connected_widgets()
1318 paths = is_connected_output_ep(w, &widgets, in snd_soc_dapm_dai_get_connected_widgets()
1321 w = dai->capture_widget; in snd_soc_dapm_dai_get_connected_widgets()
1322 invalidate_paths_ep(w, SND_SOC_DAPM_DIR_IN); in snd_soc_dapm_dai_get_connected_widgets()
1323 paths = is_connected_input_ep(w, &widgets, in snd_soc_dapm_dai_get_connected_widgets()
1348 int dapm_regulator_event(struct snd_soc_dapm_widget *w, in dapm_regulator_event() argument
1353 soc_dapm_async_complete(w->dapm); in dapm_regulator_event()
1356 if (w->on_val & SND_SOC_DAPM_REGULATOR_BYPASS) { in dapm_regulator_event()
1357 ret = regulator_allow_bypass(w->regulator, false); in dapm_regulator_event()
1359 dev_warn(w->dapm->dev, in dapm_regulator_event()
1361 w->name, ret); in dapm_regulator_event()
1364 return regulator_enable(w->regulator); in dapm_regulator_event()
1366 if (w->on_val & SND_SOC_DAPM_REGULATOR_BYPASS) { in dapm_regulator_event()
1367 ret = regulator_allow_bypass(w->regulator, true); in dapm_regulator_event()
1369 dev_warn(w->dapm->dev, in dapm_regulator_event()
1371 w->name, ret); in dapm_regulator_event()
1374 return regulator_disable_deferred(w->regulator, w->shift); in dapm_regulator_event()
1382 int dapm_pinctrl_event(struct snd_soc_dapm_widget *w, in dapm_pinctrl_event() argument
1385 struct snd_soc_dapm_pinctrl_priv *priv = w->priv; in dapm_pinctrl_event()
1386 struct pinctrl *p = w->pinctrl; in dapm_pinctrl_event()
1407 int dapm_clock_event(struct snd_soc_dapm_widget *w, in dapm_clock_event() argument
1410 if (!w->clk) in dapm_clock_event()
1413 soc_dapm_async_complete(w->dapm); in dapm_clock_event()
1416 return clk_prepare_enable(w->clk); in dapm_clock_event()
1418 clk_disable_unprepare(w->clk); in dapm_clock_event()
1426 static int dapm_widget_power_check(struct snd_soc_dapm_widget *w) in dapm_widget_power_check() argument
1428 if (w->power_checked) in dapm_widget_power_check()
1429 return w->new_power; in dapm_widget_power_check()
1431 if (w->force) in dapm_widget_power_check()
1432 w->new_power = 1; in dapm_widget_power_check()
1434 w->new_power = w->power_check(w); in dapm_widget_power_check()
1436 w->power_checked = true; in dapm_widget_power_check()
1438 return w->new_power; in dapm_widget_power_check()
1442 static int dapm_generic_check_power(struct snd_soc_dapm_widget *w) in dapm_generic_check_power() argument
1446 DAPM_UPDATE_STAT(w, power_checks); in dapm_generic_check_power()
1448 in = is_connected_input_ep(w, NULL, NULL); in dapm_generic_check_power()
1449 out = is_connected_output_ep(w, NULL, NULL); in dapm_generic_check_power()
1454 static int dapm_supply_check_power(struct snd_soc_dapm_widget *w) in dapm_supply_check_power() argument
1458 DAPM_UPDATE_STAT(w, power_checks); in dapm_supply_check_power()
1461 snd_soc_dapm_widget_for_each_sink_path(w, path) { in dapm_supply_check_power()
1462 DAPM_UPDATE_STAT(w, neighbour_checks); in dapm_supply_check_power()
1478 static int dapm_always_on_check_power(struct snd_soc_dapm_widget *w) in dapm_always_on_check_power() argument
1480 return w->connected; in dapm_always_on_check_power()
1521 struct snd_soc_dapm_widget *w; in dapm_seq_insert() local
1523 list_for_each_entry(w, list, power_list) in dapm_seq_insert()
1524 if (dapm_seq_compare(new_widget, w, power_up) < 0) { in dapm_seq_insert()
1525 list_add_tail(&new_widget->power_list, &w->power_list); in dapm_seq_insert()
1533 struct snd_soc_dapm_widget *w, int event) in dapm_seq_check_event() argument
1568 if (w->new_power != power) in dapm_seq_check_event()
1571 if (w->event && (w->event_flags & event)) { in dapm_seq_check_event()
1574 pop_dbg(w->dapm->dev, card->pop_time, "pop test : %s %s\n", in dapm_seq_check_event()
1575 w->name, ev_name); in dapm_seq_check_event()
1576 soc_dapm_async_complete(w->dapm); in dapm_seq_check_event()
1577 trace_snd_soc_dapm_widget_event_start(w, event); in dapm_seq_check_event()
1578 ret = w->event(w, NULL, event); in dapm_seq_check_event()
1579 trace_snd_soc_dapm_widget_event_done(w, event); in dapm_seq_check_event()
1581 dev_err(w->dapm->dev, "ASoC: %s: %s event failed: %d\n", in dapm_seq_check_event()
1582 ev_name, w->name, ret); in dapm_seq_check_event()
1591 struct snd_soc_dapm_widget *w; in dapm_seq_run_coalesced() local
1596 w = list_first_entry(pending, struct snd_soc_dapm_widget, power_list); in dapm_seq_run_coalesced()
1597 reg = w->reg; in dapm_seq_run_coalesced()
1598 dapm = w->dapm; in dapm_seq_run_coalesced()
1600 list_for_each_entry(w, pending, power_list) { in dapm_seq_run_coalesced()
1601 WARN_ON(reg != w->reg || dapm != w->dapm); in dapm_seq_run_coalesced()
1602 w->power = w->new_power; in dapm_seq_run_coalesced()
1604 mask |= w->mask << w->shift; in dapm_seq_run_coalesced()
1605 if (w->power) in dapm_seq_run_coalesced()
1606 value |= w->on_val << w->shift; in dapm_seq_run_coalesced()
1608 value |= w->off_val << w->shift; in dapm_seq_run_coalesced()
1612 w->name, reg, value, mask); in dapm_seq_run_coalesced()
1615 dapm_seq_check_event(card, w, SND_SOC_DAPM_PRE_PMU); in dapm_seq_run_coalesced()
1616 dapm_seq_check_event(card, w, SND_SOC_DAPM_PRE_PMD); in dapm_seq_run_coalesced()
1631 list_for_each_entry(w, pending, power_list) { in dapm_seq_run_coalesced()
1632 dapm_seq_check_event(card, w, SND_SOC_DAPM_POST_PMU); in dapm_seq_run_coalesced()
1633 dapm_seq_check_event(card, w, SND_SOC_DAPM_POST_PMD); in dapm_seq_run_coalesced()
1648 struct snd_soc_dapm_widget *w, *n; in dapm_seq_run() local
1663 list_for_each_entry_safe(w, n, list, power_list) { in dapm_seq_run()
1667 if (sort[w->id] != cur_sort || w->reg != cur_reg || in dapm_seq_run()
1668 w->dapm != cur_dapm || w->subseq != cur_subseq) { in dapm_seq_run()
1680 if (cur_dapm && w->dapm != cur_dapm) in dapm_seq_run()
1690 switch (w->id) { in dapm_seq_run()
1692 if (!w->event) in dapm_seq_run()
1696 ret = w->event(w, in dapm_seq_run()
1699 ret = w->event(w, in dapm_seq_run()
1704 if (!w->event) in dapm_seq_run()
1708 ret = w->event(w, in dapm_seq_run()
1711 ret = w->event(w, in dapm_seq_run()
1717 cur_sort = sort[w->id]; in dapm_seq_run()
1718 cur_subseq = w->subseq; in dapm_seq_run()
1719 cur_reg = w->reg; in dapm_seq_run()
1720 cur_dapm = w->dapm; in dapm_seq_run()
1721 list_move(&w->power_list, &pending); in dapm_seq_run()
1726 dev_err(w->dapm->dev, in dapm_seq_run()
1749 struct snd_soc_dapm_widget *w = NULL; in dapm_widget_update() local
1758 for_each_dapm_widgets(wlist, wi, w) { in dapm_widget_update()
1759 if (w->event && (w->event_flags & SND_SOC_DAPM_PRE_REG)) { in dapm_widget_update()
1760 ret = w->event(w, update->kcontrol, SND_SOC_DAPM_PRE_REG); in dapm_widget_update()
1762 dev_err(w->dapm->dev, "ASoC: %s DAPM pre-event failed: %d\n", in dapm_widget_update()
1763 w->name, ret); in dapm_widget_update()
1767 if (!w) in dapm_widget_update()
1770 ret = soc_dapm_update_bits(w->dapm, update->reg, update->mask, in dapm_widget_update()
1773 dev_err(w->dapm->dev, "ASoC: %s DAPM update failed: %d\n", in dapm_widget_update()
1774 w->name, ret); in dapm_widget_update()
1777 ret = soc_dapm_update_bits(w->dapm, update->reg2, in dapm_widget_update()
1780 dev_err(w->dapm->dev, in dapm_widget_update()
1782 w->name, ret); in dapm_widget_update()
1785 for_each_dapm_widgets(wlist, wi, w) { in dapm_widget_update()
1786 if (w->event && (w->event_flags & SND_SOC_DAPM_POST_REG)) { in dapm_widget_update()
1787 ret = w->event(w, update->kcontrol, SND_SOC_DAPM_POST_REG); in dapm_widget_update()
1789 dev_err(w->dapm->dev, "ASoC: %s DAPM post-event failed: %d\n", in dapm_widget_update()
1790 w->name, ret); in dapm_widget_update()
1882 static void dapm_widget_set_power(struct snd_soc_dapm_widget *w, bool power, in dapm_widget_set_power() argument
1888 if (w->power == power) in dapm_widget_set_power()
1891 trace_snd_soc_dapm_widget_power(w, power); in dapm_widget_set_power()
1896 snd_soc_dapm_widget_for_each_source_path(w, path) in dapm_widget_set_power()
1900 if (!w->is_supply) { in dapm_widget_set_power()
1901 snd_soc_dapm_widget_for_each_sink_path(w, path) in dapm_widget_set_power()
1907 dapm_seq_insert(w, up_list, true); in dapm_widget_set_power()
1909 dapm_seq_insert(w, down_list, false); in dapm_widget_set_power()
1912 static void dapm_power_one_widget(struct snd_soc_dapm_widget *w, in dapm_power_one_widget() argument
1918 switch (w->id) { in dapm_power_one_widget()
1920 dapm_seq_insert(w, down_list, false); in dapm_power_one_widget()
1923 dapm_seq_insert(w, up_list, true); in dapm_power_one_widget()
1927 power = dapm_widget_power_check(w); in dapm_power_one_widget()
1929 dapm_widget_set_power(w, power, up_list, down_list); in dapm_power_one_widget()
1961 struct snd_soc_dapm_widget *w; in dapm_power_widgets() local
1988 list_for_each_entry(w, &card->dapm_dirty, dirty) { in dapm_power_widgets()
1989 dapm_power_one_widget(w, &up_list, &down_list); in dapm_power_widgets()
1992 for_each_card_widgets(card, w) { in dapm_power_widgets()
1993 switch (w->id) { in dapm_power_widgets()
1999 list_del_init(&w->dirty); in dapm_power_widgets()
2003 if (w->new_power) { in dapm_power_widgets()
2004 d = w->dapm; in dapm_power_widgets()
2013 switch (w->id) { in dapm_power_widgets()
2056 list_for_each_entry(w, &down_list, power_list) { in dapm_power_widgets()
2057 dapm_seq_check_event(card, w, SND_SOC_DAPM_WILL_PMD); in dapm_power_widgets()
2060 list_for_each_entry(w, &up_list, power_list) { in dapm_power_widgets()
2061 dapm_seq_check_event(card, w, SND_SOC_DAPM_WILL_PMU); in dapm_power_widgets()
2106 struct snd_soc_dapm_widget *w = file->private_data; in dapm_widget_power_read_file() local
2107 struct snd_soc_card *card = w->dapm->card; in dapm_widget_power_read_file()
2121 if (w->is_supply) { in dapm_widget_power_read_file()
2125 in = is_connected_input_ep(w, NULL, NULL); in dapm_widget_power_read_file()
2126 out = is_connected_output_ep(w, NULL, NULL); in dapm_widget_power_read_file()
2130 w->name, w->power ? "On" : "Off", in dapm_widget_power_read_file()
2131 w->force ? " (forced)" : "", in, out); in dapm_widget_power_read_file()
2133 if (w->reg >= 0) in dapm_widget_power_read_file()
2136 w->reg, w->reg, w->mask << w->shift); in dapm_widget_power_read_file()
2140 if (w->sname) in dapm_widget_power_read_file()
2142 w->sname, in dapm_widget_power_read_file()
2143 w->active ? "active" : "inactive"); in dapm_widget_power_read_file()
2147 snd_soc_dapm_widget_for_each_path(w, dir, p) { in dapm_widget_power_read_file()
2223 static void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w) in dapm_debugfs_add_widget() argument
2225 struct snd_soc_dapm_context *dapm = w->dapm; in dapm_debugfs_add_widget()
2227 if (!dapm->debugfs_dapm || !w->name) in dapm_debugfs_add_widget()
2230 debugfs_create_file(w->name, 0444, dapm->debugfs_dapm, w, in dapm_debugfs_add_widget()
2246 static inline void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w) in dapm_debugfs_add_widget() argument
2390 struct snd_soc_dapm_widget *w; in dapm_widget_show_component() local
2401 for_each_card_widgets(cmpnt->card, w) { in dapm_widget_show_component()
2402 if (w->dapm != dapm) in dapm_widget_show_component()
2406 switch (w->id) { in dapm_widget_show_component()
2423 if (w->name) in dapm_widget_show_component()
2425 w->name, w->power ? "On":"Off"); in dapm_widget_show_component()
2488 void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w) in snd_soc_dapm_free_widget() argument
2493 list_del(&w->list); in snd_soc_dapm_free_widget()
2494 list_del(&w->dirty); in snd_soc_dapm_free_widget()
2501 snd_soc_dapm_widget_for_each_path_safe(w, dir, p, next_p) in snd_soc_dapm_free_widget()
2505 kfree(w->kcontrols); in snd_soc_dapm_free_widget()
2506 kfree_const(w->name); in snd_soc_dapm_free_widget()
2507 kfree_const(w->sname); in snd_soc_dapm_free_widget()
2508 kfree(w); in snd_soc_dapm_free_widget()
2520 struct snd_soc_dapm_widget *w, *next_w; in dapm_free_widgets() local
2522 for_each_card_widgets_safe(dapm->card, w, next_w) { in dapm_free_widgets()
2523 if (w->dapm != dapm) in dapm_free_widgets()
2525 snd_soc_dapm_free_widget(w); in dapm_free_widgets()
2534 struct snd_soc_dapm_widget *w; in dapm_find_widget() local
2548 for_each_card_widgets(dapm->card, w) { in dapm_find_widget()
2549 if (!strcmp(w->name, pin_name)) { in dapm_find_widget()
2550 if (w->dapm == dapm) in dapm_find_widget()
2551 return w; in dapm_find_widget()
2553 fallback = w; in dapm_find_widget()
2571 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); in __snd_soc_dapm_set_pin() local
2576 if (!w) { in __snd_soc_dapm_set_pin()
2581 if (w->connected != status) { in __snd_soc_dapm_set_pin()
2582 dapm_mark_dirty(w, "pin configuration"); in __snd_soc_dapm_set_pin()
2583 dapm_widget_invalidate_input_paths(w); in __snd_soc_dapm_set_pin()
2584 dapm_widget_invalidate_output_paths(w); in __snd_soc_dapm_set_pin()
2588 w->connected = status; in __snd_soc_dapm_set_pin()
2590 w->force = 0; in __snd_soc_dapm_set_pin()
2652 struct snd_soc_dapm_widget *w, in dapm_update_dai_chan() argument
2655 switch (w->id) { in dapm_update_dai_chan()
2663 dev_dbg(w->dapm->dev, "%s DAI route %s -> %s\n", in dapm_update_dai_chan()
2664 w->channel < channels ? "Connecting" : "Disconnecting", in dapm_update_dai_chan()
2667 if (w->channel < channels) in dapm_update_dai_chan()
2682 struct snd_soc_dapm_widget *w; in dapm_update_dai_unlocked() local
2685 w = snd_soc_dai_get_widget(dai, dir); in dapm_update_dai_unlocked()
2687 if (!w) in dapm_update_dai_unlocked()
2693 snd_soc_dapm_widget_for_each_sink_path(w, p) { in dapm_update_dai_unlocked()
2699 snd_soc_dapm_widget_for_each_source_path(w, p) { in dapm_update_dai_unlocked()
2732 static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w) in dapm_update_widget_flags() argument
2738 switch (w->id) { in dapm_update_widget_flags()
2741 if (w->dapm->card->fully_routed) in dapm_update_widget_flags()
2744 snd_soc_dapm_widget_for_each_source_path(w, p) { in dapm_update_widget_flags()
2756 if (w->dapm->card->fully_routed) in dapm_update_widget_flags()
2759 snd_soc_dapm_widget_for_each_sink_path(w, p) { in dapm_update_widget_flags()
2772 if (!list_empty(&w->edges[dir])) in dapm_update_widget_flags()
2780 w->is_ep = ep; in dapm_update_widget_flags()
2932 struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w; in snd_soc_dapm_add_route() local
2966 for_each_card_widgets(dapm->card, w) { in snd_soc_dapm_add_route()
2967 if (!wsink && !(strcmp(w->name, sink))) { in snd_soc_dapm_add_route()
2968 wtsink = w; in snd_soc_dapm_add_route()
2969 if (w->dapm == dapm) { in snd_soc_dapm_add_route()
2970 wsink = w; in snd_soc_dapm_add_route()
2978 w->name); in snd_soc_dapm_add_route()
2981 if (!wsource && !(strcmp(w->name, source))) { in snd_soc_dapm_add_route()
2982 wtsource = w; in snd_soc_dapm_add_route()
2983 if (w->dapm == dapm) { in snd_soc_dapm_add_route()
2984 wsource = w; in snd_soc_dapm_add_route()
2992 w->name); in snd_soc_dapm_add_route()
3239 struct snd_soc_dapm_widget *w; in snd_soc_dapm_new_widgets() local
3244 for_each_card_widgets(card, w) in snd_soc_dapm_new_widgets()
3246 if (w->new) in snd_soc_dapm_new_widgets()
3249 if (w->num_kcontrols) { in snd_soc_dapm_new_widgets()
3250 w->kcontrols = kcalloc(w->num_kcontrols, in snd_soc_dapm_new_widgets()
3253 if (!w->kcontrols) { in snd_soc_dapm_new_widgets()
3259 switch(w->id) { in snd_soc_dapm_new_widgets()
3263 dapm_new_mixer(w); in snd_soc_dapm_new_widgets()
3267 dapm_new_mux(w); in snd_soc_dapm_new_widgets()
3272 dapm_new_pga(w); in snd_soc_dapm_new_widgets()
3275 dapm_new_dai_link(w); in snd_soc_dapm_new_widgets()
3282 if (w->reg >= 0) { in snd_soc_dapm_new_widgets()
3283 val = soc_dapm_read(w->dapm, w->reg); in snd_soc_dapm_new_widgets()
3284 val = val >> w->shift; in snd_soc_dapm_new_widgets()
3285 val &= w->mask; in snd_soc_dapm_new_widgets()
3286 if (val == w->on_val) in snd_soc_dapm_new_widgets()
3287 w->power = 1; in snd_soc_dapm_new_widgets()
3290 w->new = 1; in snd_soc_dapm_new_widgets()
3292 dapm_mark_dirty(w, "new widget"); in snd_soc_dapm_new_widgets()
3293 dapm_debugfs_add_widget(w); in snd_soc_dapm_new_widgets()
3623 struct snd_soc_dapm_widget *w; in snd_soc_dapm_new_control_unlocked() local
3627 if ((w = dapm_cnew_widget(widget)) == NULL) in snd_soc_dapm_new_control_unlocked()
3630 switch (w->id) { in snd_soc_dapm_new_control_unlocked()
3632 w->regulator = devm_regulator_get(dapm->dev, w->name); in snd_soc_dapm_new_control_unlocked()
3633 if (IS_ERR(w->regulator)) { in snd_soc_dapm_new_control_unlocked()
3634 ret = PTR_ERR(w->regulator); in snd_soc_dapm_new_control_unlocked()
3638 if (w->on_val & SND_SOC_DAPM_REGULATOR_BYPASS) { in snd_soc_dapm_new_control_unlocked()
3639 ret = regulator_allow_bypass(w->regulator, true); in snd_soc_dapm_new_control_unlocked()
3643 w->name, ret); in snd_soc_dapm_new_control_unlocked()
3647 w->pinctrl = devm_pinctrl_get(dapm->dev); in snd_soc_dapm_new_control_unlocked()
3648 if (IS_ERR(w->pinctrl)) { in snd_soc_dapm_new_control_unlocked()
3649 ret = PTR_ERR(w->pinctrl); in snd_soc_dapm_new_control_unlocked()
3654 dapm_pinctrl_event(w, NULL, SND_SOC_DAPM_POST_PMD); in snd_soc_dapm_new_control_unlocked()
3657 w->clk = devm_clk_get(dapm->dev, w->name); in snd_soc_dapm_new_control_unlocked()
3658 if (IS_ERR(w->clk)) { in snd_soc_dapm_new_control_unlocked()
3659 ret = PTR_ERR(w->clk); in snd_soc_dapm_new_control_unlocked()
3669 w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); in snd_soc_dapm_new_control_unlocked()
3671 w->name = kstrdup_const(widget->name, GFP_KERNEL); in snd_soc_dapm_new_control_unlocked()
3672 if (w->name == NULL) { in snd_soc_dapm_new_control_unlocked()
3673 kfree_const(w->sname); in snd_soc_dapm_new_control_unlocked()
3674 kfree(w); in snd_soc_dapm_new_control_unlocked()
3678 switch (w->id) { in snd_soc_dapm_new_control_unlocked()
3680 w->is_ep = SND_SOC_DAPM_EP_SOURCE; in snd_soc_dapm_new_control_unlocked()
3681 w->power_check = dapm_generic_check_power; in snd_soc_dapm_new_control_unlocked()
3685 w->is_ep = SND_SOC_DAPM_EP_SOURCE; in snd_soc_dapm_new_control_unlocked()
3686 w->power_check = dapm_generic_check_power; in snd_soc_dapm_new_control_unlocked()
3690 w->is_ep = SND_SOC_DAPM_EP_SINK; in snd_soc_dapm_new_control_unlocked()
3691 w->power_check = dapm_generic_check_power; in snd_soc_dapm_new_control_unlocked()
3695 w->is_ep = SND_SOC_DAPM_EP_SINK; in snd_soc_dapm_new_control_unlocked()
3696 w->power_check = dapm_generic_check_power; in snd_soc_dapm_new_control_unlocked()
3700 w->is_ep = SND_SOC_DAPM_EP_SOURCE; in snd_soc_dapm_new_control_unlocked()
3701 w->power_check = dapm_always_on_check_power; in snd_soc_dapm_new_control_unlocked()
3704 w->is_ep = SND_SOC_DAPM_EP_SINK; in snd_soc_dapm_new_control_unlocked()
3705 w->power_check = dapm_always_on_check_power; in snd_soc_dapm_new_control_unlocked()
3731 w->power_check = dapm_generic_check_power; in snd_soc_dapm_new_control_unlocked()
3738 w->is_supply = 1; in snd_soc_dapm_new_control_unlocked()
3739 w->power_check = dapm_supply_check_power; in snd_soc_dapm_new_control_unlocked()
3742 w->power_check = dapm_always_on_check_power; in snd_soc_dapm_new_control_unlocked()
3746 w->dapm = dapm; in snd_soc_dapm_new_control_unlocked()
3747 INIT_LIST_HEAD(&w->list); in snd_soc_dapm_new_control_unlocked()
3748 INIT_LIST_HEAD(&w->dirty); in snd_soc_dapm_new_control_unlocked()
3750 list_add_tail(&w->list, &dapm->card->widgets); in snd_soc_dapm_new_control_unlocked()
3753 INIT_LIST_HEAD(&w->edges[dir]); in snd_soc_dapm_new_control_unlocked()
3754 w->endpoints[dir] = -1; in snd_soc_dapm_new_control_unlocked()
3758 w->connected = 1; in snd_soc_dapm_new_control_unlocked()
3759 return w; in snd_soc_dapm_new_control_unlocked()
3764 w->name, ret); in snd_soc_dapm_new_control_unlocked()
3766 kfree_const(w->sname); in snd_soc_dapm_new_control_unlocked()
3767 kfree(w); in snd_soc_dapm_new_control_unlocked()
3784 struct snd_soc_dapm_widget *w; in snd_soc_dapm_new_control() local
3787 w = snd_soc_dapm_new_control_unlocked(dapm, widget); in snd_soc_dapm_new_control()
3790 return w; in snd_soc_dapm_new_control()
3813 struct snd_soc_dapm_widget *w = snd_soc_dapm_new_control_unlocked(dapm, widget); in snd_soc_dapm_new_controls() local
3814 if (IS_ERR(w)) { in snd_soc_dapm_new_controls()
3815 ret = PTR_ERR(w); in snd_soc_dapm_new_controls()
3826 snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, in snd_soc_dai_link_event_pre_pmu() argument
3851 snd_soc_dapm_widget_for_each_source_path(w, path) { in snd_soc_dai_link_event_pre_pmu()
3862 snd_soc_dapm_widget_for_each_sink_path(w, path) { in snd_soc_dai_link_event_pre_pmu()
3881 dev_err(w->dapm->dev, "ASoC: link config missing\n"); in snd_soc_dai_link_event_pre_pmu()
3890 dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n", in snd_soc_dai_link_event_pre_pmu()
3908 snd_soc_dapm_widget_for_each_source_path(w, path) { in snd_soc_dai_link_event_pre_pmu()
3919 snd_soc_dapm_widget_for_each_sink_path(w, path) { in snd_soc_dai_link_event_pre_pmu()
3939 static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, in snd_soc_dai_link_event() argument
3944 struct snd_pcm_substream *substream = w->priv; in snd_soc_dai_link_event()
3947 if (WARN_ON(list_empty(&w->edges[SND_SOC_DAPM_DIR_OUT]) || in snd_soc_dai_link_event()
3948 list_empty(&w->edges[SND_SOC_DAPM_DIR_IN]))) in snd_soc_dai_link_event()
3953 ret = snd_soc_dai_link_event_pre_pmu(w, substream); in snd_soc_dai_link_event()
3960 snd_soc_dapm_widget_for_each_sink_path(w, path) { in snd_soc_dai_link_event()
3969 snd_soc_dapm_widget_for_each_sink_path(w, path) { in snd_soc_dai_link_event()
3977 snd_soc_dapm_widget_for_each_source_path(w, path) { in snd_soc_dai_link_event()
3983 snd_soc_dapm_widget_for_each_sink_path(w, path) { in snd_soc_dai_link_event()
3989 snd_soc_dapm_widget_for_each_source_path(w, path) { in snd_soc_dai_link_event()
3996 snd_soc_dapm_widget_for_each_sink_path(w, path) { in snd_soc_dai_link_event()
4021 struct snd_soc_dapm_widget *w = snd_kcontrol_chip(kcontrol); in snd_soc_dapm_dai_link_get() local
4022 struct snd_soc_pcm_runtime *rtd = w->priv; in snd_soc_dapm_dai_link_get()
4032 struct snd_soc_dapm_widget *w = snd_kcontrol_chip(kcontrol); in snd_soc_dapm_dai_link_put() local
4033 struct snd_soc_pcm_runtime *rtd = w->priv; in snd_soc_dapm_dai_link_put()
4036 if (w->power) in snd_soc_dapm_dai_link_put()
4143 struct snd_soc_dapm_widget *w; in snd_soc_dapm_new_dai() local
4189 w = snd_soc_dapm_new_control_unlocked(&card->dapm, &template); in snd_soc_dapm_new_dai()
4190 if (IS_ERR(w)) { in snd_soc_dapm_new_dai()
4191 ret = PTR_ERR(w); in snd_soc_dapm_new_dai()
4197 w->priv = substream; in snd_soc_dapm_new_dai()
4199 return w; in snd_soc_dapm_new_dai()
4214 struct snd_soc_dapm_widget *w; in snd_soc_dapm_new_dai_widgets() local
4229 w = snd_soc_dapm_new_control_unlocked(dapm, &template); in snd_soc_dapm_new_dai_widgets()
4230 if (IS_ERR(w)) in snd_soc_dapm_new_dai_widgets()
4231 return PTR_ERR(w); in snd_soc_dapm_new_dai_widgets()
4233 w->priv = dai; in snd_soc_dapm_new_dai_widgets()
4234 dai->playback_widget = w; in snd_soc_dapm_new_dai_widgets()
4245 w = snd_soc_dapm_new_control_unlocked(dapm, &template); in snd_soc_dapm_new_dai_widgets()
4246 if (IS_ERR(w)) in snd_soc_dapm_new_dai_widgets()
4247 return PTR_ERR(w); in snd_soc_dapm_new_dai_widgets()
4249 w->priv = dai; in snd_soc_dapm_new_dai_widgets()
4250 dai->capture_widget = w; in snd_soc_dapm_new_dai_widgets()
4258 struct snd_soc_dapm_widget *dai_w, *w; in snd_soc_dapm_link_dai_widgets() local
4282 for_each_card_widgets(card, w) { in snd_soc_dapm_link_dai_widgets()
4283 if (w->dapm != dai_w->dapm) in snd_soc_dapm_link_dai_widgets()
4286 switch (w->id) { in snd_soc_dapm_link_dai_widgets()
4294 if (!w->sname || !strstr(w->sname, dai_w->sname)) in snd_soc_dapm_link_dai_widgets()
4299 sink = w; in snd_soc_dapm_link_dai_widgets()
4301 src = w; in snd_soc_dapm_link_dai_widgets()
4305 snd_soc_dapm_add_path(w->dapm, src, sink, NULL, NULL); in snd_soc_dapm_link_dai_widgets()
4388 struct snd_soc_dapm_widget *w; in soc_dapm_dai_stream_event() local
4390 w = snd_soc_dai_get_widget(dai, stream); in soc_dapm_dai_stream_event()
4392 if (w) { in soc_dapm_dai_stream_event()
4395 dapm_mark_dirty(w, "stream event"); in soc_dapm_dai_stream_event()
4397 if (w->id == snd_soc_dapm_dai_in) { in soc_dapm_dai_stream_event()
4399 dapm_widget_invalidate_input_paths(w); in soc_dapm_dai_stream_event()
4402 dapm_widget_invalidate_output_paths(w); in soc_dapm_dai_stream_event()
4407 w->active = 1; in soc_dapm_dai_stream_event()
4408 w->is_ep = ep; in soc_dapm_dai_stream_event()
4411 w->active = 0; in soc_dapm_dai_stream_event()
4412 w->is_ep = 0; in soc_dapm_dai_stream_event()
4571 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); in snd_soc_dapm_force_enable_pin_unlocked() local
4573 if (!w) { in snd_soc_dapm_force_enable_pin_unlocked()
4578 dev_dbg(w->dapm->dev, "ASoC: force enable pin %s\n", pin); in snd_soc_dapm_force_enable_pin_unlocked()
4579 if (!w->connected) { in snd_soc_dapm_force_enable_pin_unlocked()
4584 dapm_widget_invalidate_input_paths(w); in snd_soc_dapm_force_enable_pin_unlocked()
4585 dapm_widget_invalidate_output_paths(w); in snd_soc_dapm_force_enable_pin_unlocked()
4586 w->connected = 1; in snd_soc_dapm_force_enable_pin_unlocked()
4588 w->force = 1; in snd_soc_dapm_force_enable_pin_unlocked()
4589 dapm_mark_dirty(w, "force enable"); in snd_soc_dapm_force_enable_pin_unlocked()
4729 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); in snd_soc_dapm_get_pin_status() local
4731 if (w) in snd_soc_dapm_get_pin_status()
4732 return w->connected; in snd_soc_dapm_get_pin_status()
4752 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, false); in snd_soc_dapm_ignore_suspend() local
4754 if (!w) { in snd_soc_dapm_ignore_suspend()
4759 w->ignore_suspend = 1; in snd_soc_dapm_ignore_suspend()
4804 struct snd_soc_dapm_widget *w; in soc_dapm_shutdown_dapm() local
4810 for_each_card_widgets(dapm->card, w) { in soc_dapm_shutdown_dapm()
4811 if (w->dapm != dapm) in soc_dapm_shutdown_dapm()
4813 if (w->power) { in soc_dapm_shutdown_dapm()
4814 dapm_seq_insert(w, &down_list, false); in soc_dapm_shutdown_dapm()
4815 w->new_power = 0; in soc_dapm_shutdown_dapm()