Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: soc-dapm: convert to snd_soc_dapm_xxx()

This patch converts below functions.

dapm->dev -> snd_soc_dapm_to_dev()
dapm->card -> snd_soc_dapm_to_card()
dapm->component -> snd_soc_dapm_to_component()

dapm_kcontrol_get_value() -> snd_soc_dapm_kcontrol_get_value()

snd_soc_component_enable_pin() -> snd_soc_dapm_enable_pin()
snd_soc_component_enable_pin_unlocked() -> snd_soc_dapm_enable_pin_unlocked()
snd_soc_component_disable_pin() -> snd_soc_dapm_disable_pin()
snd_soc_component_disable_pin_unlocked() -> snd_soc_dapm_disable_pin_unlocked()
snd_soc_component_nc_pin() -> snd_soc_dapm_nc_pin()
snd_soc_component_nc_pin_unlocked() -> snd_soc_dapm_nc_pin_unlocked()
snd_soc_component_get_pin_status() -> snd_soc_dapm_get_pin_status()
snd_soc_component_force_enable_pin() -> snd_soc_dapm_force_enable_pin()
snd_soc_component_force_enable_pin_unlocked() -> snd_soc_dapm_force_enable_pin_unlocked()
snd_soc_component_force_bias_level() -> snd_soc_dapm_force_bias_level()
snd_soc_component_get_bias_level() -> snd_soc_dapm_get_bias_level()
snd_soc_component_init_bias_level() -> snd_soc_dapm_init_bias_level()
snd_soc_component_get_dapm() -> snd_soc_component_to_dapm()

snd_soc_dapm_kcontrol_component() -> snd_soc_dapm_kcontrol_to_component()
snd_soc_dapm_kcontrol_widget() -> snd_soc_dapm_kcontrol_to_widget()
snd_soc_dapm_kcontrol_dapm() -> snd_soc_dapm_kcontrol_to_dapm()
snd_soc_dapm_np_pin() -> snd_soc_dapm_disable_pin()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/87fraltngi.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
b10489e9 e758b08d

+116 -80
+116 -80
sound/soc/soc-dapm.c
··· 193 193 194 194 static void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason) 195 195 { 196 + struct device *dev = snd_soc_dapm_to_dev(w->dapm); 197 + 196 198 dapm_assert_locked(w->dapm); 197 199 198 200 if (!dapm_dirty_widget(w)) { 199 - dev_vdbg(w->dapm->dev, "Marking %s dirty due to %s\n", 201 + dev_vdbg(dev, "Marking %s dirty due to %s\n", 200 202 w->name, reason); 201 203 list_add_tail(&w->dirty, &w->dapm->card->dapm_dirty); 202 204 } ··· 534 532 struct snd_soc_dapm_widget *source, struct snd_soc_dapm_widget *sink, 535 533 const char *control) 536 534 { 535 + struct device *dev = snd_soc_dapm_to_dev(dapm); 537 536 bool dynamic_source = false; 538 537 bool dynamic_sink = false; 539 538 ··· 561 558 } 562 559 563 560 if (dynamic_source && dynamic_sink) { 564 - dev_err(dapm->dev, 561 + dev_err(dev, 565 562 "Direct connection between demux and mixer/mux not supported for path %s -> [%s] -> %s\n", 566 563 source->name, control, sink->name); 567 564 return -EINVAL; 568 565 } else if (!dynamic_source && !dynamic_sink) { 569 - dev_err(dapm->dev, 566 + dev_err(dev, 570 567 "Control not supported for path %s -> [%s] -> %s\n", 571 568 source->name, control, sink->name); 572 569 return -EINVAL; ··· 582 579 int (*connected)(struct snd_soc_dapm_widget *source, 583 580 struct snd_soc_dapm_widget *sink)) 584 581 { 582 + struct device *dev = snd_soc_dapm_to_dev(dapm); 585 583 enum snd_soc_dapm_direction dir; 586 584 struct snd_soc_dapm_path *path; 587 585 int ret; 588 586 589 587 if (wsink->is_supply && !wsource->is_supply) { 590 - dev_err(dapm->dev, 588 + dev_err(dev, 591 589 "Connecting non-supply widget to supply widget is not supported (%s -> %s)\n", 592 590 wsource->name, wsink->name); 593 591 return -EINVAL; 594 592 } 595 593 596 594 if (connected && !wsource->is_supply) { 597 - dev_err(dapm->dev, 595 + dev_err(dev, 598 596 "connected() callback only supported for supply widgets (%s -> %s)\n", 599 597 wsource->name, wsink->name); 600 598 return -EINVAL; 601 599 } 602 600 603 601 if (wsource->is_supply && control) { 604 - dev_err(dapm->dev, 602 + dev_err(dev, 605 603 "Conditional paths are not supported for supply widgets (%s -> [%s] -> %s)\n", 606 604 wsource->name, control, wsink->name); 607 605 return -EINVAL; ··· 680 676 static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, 681 677 struct snd_kcontrol *kcontrol, const char *ctrl_name) 682 678 { 679 + struct device *dev = snd_soc_dapm_to_dev(widget->dapm); 683 680 struct dapm_kcontrol_data *data; 684 681 struct soc_mixer_control *mc; 685 682 struct soc_enum *e; ··· 703 698 struct snd_soc_dapm_widget template; 704 699 705 700 if (snd_soc_volsw_is_stereo(mc)) 706 - dev_warn(widget->dapm->dev, 701 + dev_warn(dev, 707 702 "ASoC: Unsupported stereo autodisable control '%s'\n", 708 703 ctrl_name); 709 704 ··· 1138 1133 int kci) 1139 1134 { 1140 1135 struct snd_soc_dapm_context *dapm = w->dapm; 1136 + struct device *dev = snd_soc_dapm_to_dev(dapm); 1141 1137 struct snd_card *card = dapm->card->snd_card; 1142 1138 const char *prefix; 1143 1139 size_t prefix_len; ··· 1227 1221 1228 1222 ret = snd_ctl_add(card, kcontrol); 1229 1223 if (ret < 0) { 1230 - dev_err(dapm->dev, 1224 + dev_err(dev, 1231 1225 "ASoC: failed to add widget %s dapm kcontrol %s: %d\n", 1232 1226 w->name, name, ret); 1233 1227 goto exit_free; ··· 1283 1277 static int dapm_new_mux(struct snd_soc_dapm_widget *w) 1284 1278 { 1285 1279 struct snd_soc_dapm_context *dapm = w->dapm; 1280 + struct device *dev = snd_soc_dapm_to_dev(dapm); 1286 1281 enum snd_soc_dapm_direction dir; 1287 1282 struct snd_soc_dapm_path *path; 1288 1283 const char *type; ··· 1303 1296 } 1304 1297 1305 1298 if (w->num_kcontrols != 1) { 1306 - dev_err(dapm->dev, 1299 + dev_err(dev, 1307 1300 "ASoC: %s %s has incorrect number of controls\n", type, 1308 1301 w->name); 1309 1302 return -EINVAL; 1310 1303 } 1311 1304 1312 1305 if (list_empty(&w->edges[dir])) { 1313 - dev_err(dapm->dev, "ASoC: %s %s has no paths\n", type, w->name); 1306 + dev_err(dev, "ASoC: %s %s has no paths\n", type, w->name); 1314 1307 return -EINVAL; 1315 1308 } 1316 1309 ··· 1353 1346 /* add kcontrol */ 1354 1347 for (i = 0; i < w->num_kcontrols; i++) { 1355 1348 struct snd_soc_dapm_context *dapm = w->dapm; 1349 + struct device *dev = snd_soc_dapm_to_dev(dapm); 1356 1350 struct snd_card *card = dapm->card->snd_card; 1357 1351 struct snd_kcontrol *kcontrol = snd_soc_cnew(&w->kcontrol_news[i], 1358 1352 w, w->name, NULL); 1359 1353 int ret = snd_ctl_add(card, kcontrol); 1360 1354 1361 1355 if (ret < 0) { 1362 - dev_err(dapm->dev, 1356 + dev_err(dev, 1363 1357 "ASoC: failed to add widget %s dapm kcontrol %s: %d\n", 1364 1358 w->name, w->kcontrol_news[i].name, ret); 1365 1359 return ret; ··· 1378 1370 */ 1379 1371 static int snd_soc_dapm_suspend_check(struct snd_soc_dapm_widget *widget) 1380 1372 { 1373 + struct device *dev = snd_soc_dapm_to_dev(widget->dapm); 1381 1374 int level = snd_power_get_state(widget->dapm->card->snd_card); 1382 1375 1383 1376 switch (level) { 1384 1377 case SNDRV_CTL_POWER_D3hot: 1385 1378 case SNDRV_CTL_POWER_D3cold: 1386 1379 if (widget->ignore_suspend) 1387 - dev_dbg(widget->dapm->dev, "ASoC: %s ignoring suspend\n", 1380 + dev_dbg(dev, "ASoC: %s ignoring suspend\n", 1388 1381 widget->name); 1389 1382 return widget->ignore_suspend; 1390 1383 default: ··· 1616 1607 int snd_soc_dapm_regulator_event(struct snd_soc_dapm_widget *w, 1617 1608 struct snd_kcontrol *kcontrol, int event) 1618 1609 { 1610 + struct device *dev = snd_soc_dapm_to_dev(w->dapm); 1619 1611 int ret; 1620 1612 1621 1613 soc_dapm_async_complete(w->dapm); ··· 1625 1615 if (w->on_val & SND_SOC_DAPM_REGULATOR_BYPASS) { 1626 1616 ret = regulator_allow_bypass(w->regulator, false); 1627 1617 if (ret != 0) 1628 - dev_warn(w->dapm->dev, 1618 + dev_warn(dev, 1629 1619 "ASoC: Failed to unbypass %s: %d\n", 1630 1620 w->name, ret); 1631 1621 } ··· 1635 1625 if (w->on_val & SND_SOC_DAPM_REGULATOR_BYPASS) { 1636 1626 ret = regulator_allow_bypass(w->regulator, true); 1637 1627 if (ret != 0) 1638 - dev_warn(w->dapm->dev, 1628 + dev_warn(dev, 1639 1629 "ASoC: Failed to bypass %s: %d\n", 1640 1630 w->name, ret); 1641 1631 } ··· 1798 1788 static void dapm_seq_check_event(struct snd_soc_card *card, 1799 1789 struct snd_soc_dapm_widget *w, int event) 1800 1790 { 1791 + struct device *dev = card->dev; 1801 1792 const char *ev_name; 1802 1793 int power; 1803 1794 ··· 1838 1827 if (w->event && (w->event_flags & event)) { 1839 1828 int ret; 1840 1829 1841 - pop_dbg(w->dapm->dev, card->pop_time, "pop test : %s %s\n", 1830 + pop_dbg(dev, card->pop_time, "pop test : %s %s\n", 1842 1831 w->name, ev_name); 1843 1832 soc_dapm_async_complete(w->dapm); 1844 1833 trace_snd_soc_dapm_widget_event_start(w, event); 1845 1834 ret = w->event(w, NULL, event); 1846 1835 trace_snd_soc_dapm_widget_event_done(w, event); 1847 1836 if (ret < 0) 1848 - dev_err(w->dapm->dev, "ASoC: %s: %s event failed: %d\n", 1837 + dev_err(dev, "ASoC: %s: %s event failed: %d\n", 1849 1838 ev_name, w->name, ret); 1850 1839 } 1851 1840 } ··· 1854 1843 static void dapm_seq_run_coalesced(struct snd_soc_card *card, 1855 1844 struct list_head *pending) 1856 1845 { 1846 + struct device *dev = card->dev; 1857 1847 struct snd_soc_dapm_context *dapm; 1858 1848 struct snd_soc_dapm_widget *w; 1859 1849 int reg; ··· 1875 1863 else 1876 1864 value |= w->off_val << w->shift; 1877 1865 1878 - pop_dbg(dapm->dev, card->pop_time, 1866 + pop_dbg(dev, card->pop_time, 1879 1867 "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n", 1880 1868 w->name, reg, value, mask); 1881 1869 ··· 1889 1877 * same register. 1890 1878 */ 1891 1879 1892 - pop_dbg(dapm->dev, card->pop_time, 1880 + pop_dbg(dev, card->pop_time, 1893 1881 "pop test : Applying 0x%x/0x%x to %x in %dms\n", 1894 1882 value, mask, reg, card->pop_time); 1895 1883 pop_wait(card->pop_time); ··· 1913 1901 static void dapm_seq_run(struct snd_soc_card *card, 1914 1902 struct list_head *list, int event, bool power_up) 1915 1903 { 1904 + struct device *dev = card->dev; 1916 1905 struct snd_soc_dapm_widget *w, *n; 1917 1906 struct snd_soc_dapm_context *d; 1918 1907 LIST_HEAD(pending); ··· 1992 1979 } 1993 1980 1994 1981 if (ret < 0) 1995 - dev_err(w->dapm->dev, 1982 + dev_err(dev, 1996 1983 "ASoC: Failed to apply widget power: %d\n", ret); 1997 1984 } 1998 1985 ··· 2013 2000 2014 2001 static void dapm_widget_update(struct snd_soc_card *card, struct snd_soc_dapm_update *update) 2015 2002 { 2003 + struct device *dev = card->dev; 2016 2004 struct snd_soc_dapm_widget_list *wlist; 2017 2005 struct snd_soc_dapm_widget *w = NULL; 2018 2006 unsigned int wi; ··· 2028 2014 if (w->event && (w->event_flags & SND_SOC_DAPM_PRE_REG)) { 2029 2015 ret = w->event(w, update->kcontrol, SND_SOC_DAPM_PRE_REG); 2030 2016 if (ret != 0) 2031 - dev_err(w->dapm->dev, "ASoC: %s DAPM pre-event failed: %d\n", 2017 + dev_err(dev, "ASoC: %s DAPM pre-event failed: %d\n", 2032 2018 w->name, ret); 2033 2019 } 2034 2020 } ··· 2039 2025 ret = soc_dapm_update_bits(w->dapm, update->reg, update->mask, 2040 2026 update->val); 2041 2027 if (ret < 0) 2042 - dev_err(w->dapm->dev, "ASoC: %s DAPM update failed: %d\n", 2028 + dev_err(dev, "ASoC: %s DAPM update failed: %d\n", 2043 2029 w->name, ret); 2044 2030 2045 2031 if (update->has_second_set) { 2046 2032 ret = soc_dapm_update_bits(w->dapm, update->reg2, 2047 2033 update->mask2, update->val2); 2048 2034 if (ret < 0) 2049 - dev_err(w->dapm->dev, 2035 + dev_err(dev, 2050 2036 "ASoC: %s DAPM update failed: %d\n", 2051 2037 w->name, ret); 2052 2038 } ··· 2055 2041 if (w->event && (w->event_flags & SND_SOC_DAPM_POST_REG)) { 2056 2042 ret = w->event(w, update->kcontrol, SND_SOC_DAPM_POST_REG); 2057 2043 if (ret != 0) 2058 - dev_err(w->dapm->dev, "ASoC: %s DAPM post-event failed: %d\n", 2044 + dev_err(dev, "ASoC: %s DAPM post-event failed: %d\n", 2059 2045 w->name, ret); 2060 2046 } 2061 2047 } ··· 2067 2053 static void dapm_pre_sequence_async(void *data, async_cookie_t cookie) 2068 2054 { 2069 2055 struct snd_soc_dapm_context *dapm = data; 2056 + struct device *dev = snd_soc_dapm_to_dev(dapm); 2070 2057 int ret; 2071 2058 2072 2059 /* If we're off and we're not supposed to go into STANDBY */ 2073 2060 if (dapm->bias_level == SND_SOC_BIAS_OFF && 2074 2061 dapm->target_bias_level != SND_SOC_BIAS_OFF) { 2075 - if (dapm->dev && cookie) 2076 - pm_runtime_get_sync(dapm->dev); 2062 + if (dev && cookie) 2063 + pm_runtime_get_sync(dev); 2077 2064 2078 2065 ret = snd_soc_dapm_set_bias_level(dapm, SND_SOC_BIAS_STANDBY); 2079 2066 if (ret != 0) 2080 - dev_err(dapm->dev, 2067 + dev_err(dev, 2081 2068 "ASoC: Failed to turn on bias: %d\n", ret); 2082 2069 } 2083 2070 ··· 2089 2074 dapm->bias_level == SND_SOC_BIAS_ON)) { 2090 2075 ret = snd_soc_dapm_set_bias_level(dapm, SND_SOC_BIAS_PREPARE); 2091 2076 if (ret != 0) 2092 - dev_err(dapm->dev, 2077 + dev_err(dev, 2093 2078 "ASoC: Failed to prepare bias: %d\n", ret); 2094 2079 } 2095 2080 } ··· 2100 2085 static void dapm_post_sequence_async(void *data, async_cookie_t cookie) 2101 2086 { 2102 2087 struct snd_soc_dapm_context *dapm = data; 2088 + struct device *dev = snd_soc_dapm_to_dev(dapm); 2103 2089 int ret; 2104 2090 2105 2091 /* If we just powered the last thing off drop to standby bias */ ··· 2109 2093 dapm->target_bias_level == SND_SOC_BIAS_OFF)) { 2110 2094 ret = snd_soc_dapm_set_bias_level(dapm, SND_SOC_BIAS_STANDBY); 2111 2095 if (ret != 0) 2112 - dev_err(dapm->dev, "ASoC: Failed to apply standby bias: %d\n", 2113 - ret); 2096 + dev_err(dev, "ASoC: Failed to apply standby bias: %d\n", ret); 2114 2097 } 2115 2098 2116 2099 /* If we're in standby and can support bias off then do that */ ··· 2117 2102 dapm->target_bias_level == SND_SOC_BIAS_OFF) { 2118 2103 ret = snd_soc_dapm_set_bias_level(dapm, SND_SOC_BIAS_OFF); 2119 2104 if (ret != 0) 2120 - dev_err(dapm->dev, "ASoC: Failed to turn off bias: %d\n", 2121 - ret); 2105 + dev_err(dev, "ASoC: Failed to turn off bias: %d\n", ret); 2122 2106 2123 - if (dapm->dev && cookie) 2124 - pm_runtime_put(dapm->dev); 2107 + if (dev && cookie) 2108 + pm_runtime_put(dev); 2125 2109 } 2126 2110 2127 2111 /* If we just powered up then move to active bias */ ··· 2128 2114 dapm->target_bias_level == SND_SOC_BIAS_ON) { 2129 2115 ret = snd_soc_dapm_set_bias_level(dapm, SND_SOC_BIAS_ON); 2130 2116 if (ret != 0) 2131 - dev_err(dapm->dev, "ASoC: Failed to apply active bias: %d\n", 2132 - ret); 2117 + dev_err(dev, "ASoC: Failed to apply active bias: %d\n", ret); 2133 2118 } 2134 2119 } 2135 2120 ··· 2226 2213 static int dapm_power_widgets(struct snd_soc_card *card, int event, 2227 2214 struct snd_soc_dapm_update *update) 2228 2215 { 2216 + struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); 2229 2217 struct snd_soc_dapm_widget *w; 2230 2218 struct snd_soc_dapm_context *d; 2231 2219 LIST_HEAD(up_list); ··· 2313 2299 trace_snd_soc_dapm_walk_done(card); 2314 2300 2315 2301 /* Run card bias changes at first */ 2316 - dapm_pre_sequence_async(&card->dapm, 0); 2302 + dapm_pre_sequence_async(dapm, 0); 2317 2303 /* Run other bias changes in parallel */ 2318 2304 for_each_card_dapms(card, d) { 2319 - if (d != &card->dapm && d->bias_level != d->target_bias_level) 2305 + if (d != dapm && d->bias_level != d->target_bias_level) 2320 2306 async_schedule_domain(dapm_pre_sequence_async, d, 2321 2307 &async_domain); 2322 2308 } ··· 2340 2326 2341 2327 /* Run all the bias changes in parallel */ 2342 2328 for_each_card_dapms(card, d) { 2343 - if (d != &card->dapm && d->bias_level != d->target_bias_level) 2329 + if (d != dapm && d->bias_level != d->target_bias_level) 2344 2330 async_schedule_domain(dapm_post_sequence_async, d, 2345 2331 &async_domain); 2346 2332 } 2347 2333 async_synchronize_full_domain(&async_domain); 2348 2334 /* Run card bias changes at last */ 2349 - dapm_post_sequence_async(&card->dapm, 0); 2335 + dapm_post_sequence_async(dapm, 0); 2350 2336 2351 2337 /* do we need to notify any clients that DAPM event is complete */ 2352 2338 for_each_card_dapms(card, d) { ··· 2717 2703 static ssize_t dapm_widget_show_component(struct snd_soc_component *component, 2718 2704 char *buf, int count) 2719 2705 { 2720 - struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); 2706 + struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); 2721 2707 struct snd_soc_dapm_widget *w; 2722 2708 char *state = "not set"; 2723 2709 ··· 2907 2893 const char *pin, int status) 2908 2894 { 2909 2895 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); 2896 + struct device *dev = snd_soc_dapm_to_dev(dapm); 2910 2897 int ret = 0; 2911 2898 2912 2899 dapm_assert_locked(dapm); 2913 2900 2914 2901 if (!w) { 2915 - dev_err(dapm->dev, "ASoC: DAPM unknown pin %s\n", pin); 2902 + dev_err(dev, "ASoC: DAPM unknown pin %s\n", pin); 2916 2903 return -EINVAL; 2917 2904 } 2918 2905 ··· 2991 2976 struct snd_soc_dapm_widget *w, 2992 2977 int channels) 2993 2978 { 2979 + struct device *dev = snd_soc_dapm_to_dev(w->dapm); 2980 + 2994 2981 switch (w->id) { 2995 2982 case snd_soc_dapm_aif_out: 2996 2983 case snd_soc_dapm_aif_in: ··· 3001 2984 return 0; 3002 2985 } 3003 2986 3004 - dev_dbg(w->dapm->dev, "%s DAI route %s -> %s\n", 2987 + dev_dbg(dev, "%s DAI route %s -> %s\n", 3005 2988 w->channel < channels ? "Connecting" : "Disconnecting", 3006 2989 p->source->name, p->sink->name); 3007 2990 ··· 3076 3059 { 3077 3060 struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w; 3078 3061 struct snd_soc_dapm_widget *wtsource = NULL, *wtsink = NULL; 3062 + struct device *dev = snd_soc_dapm_to_dev(dapm); 3079 3063 const char *sink; 3080 3064 const char *source; 3081 3065 char prefixed_sink[80]; ··· 3119 3101 } 3120 3102 sink_ref++; 3121 3103 if (sink_ref > 1) 3122 - dev_warn(dapm->dev, 3104 + dev_warn(dev, 3123 3105 "ASoC: sink widget %s overwritten\n", 3124 3106 w->name); 3125 3107 continue; ··· 3133 3115 } 3134 3116 source_ref++; 3135 3117 if (source_ref > 1) 3136 - dev_warn(dapm->dev, 3118 + dev_warn(dev, 3137 3119 "ASoC: source widget %s overwritten\n", 3138 3120 w->name); 3139 3121 } ··· 3159 3141 route->connected); 3160 3142 err: 3161 3143 if (ret) 3162 - dev_err(dapm->dev, "ASoC: Failed to add route %s%s -%s%s%s> %s%s\n", 3144 + dev_err(dev, "ASoC: Failed to add route %s%s -%s%s%s> %s%s\n", 3163 3145 source, !wsource ? "(*)" : "", 3164 3146 !route->control ? "" : "> [", 3165 3147 !route->control ? "" : route->control, ··· 3171 3153 static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm, 3172 3154 const struct snd_soc_dapm_route *route) 3173 3155 { 3156 + struct device *dev = snd_soc_dapm_to_dev(dapm); 3174 3157 struct snd_soc_dapm_path *path, *p; 3175 3158 const char *sink; 3176 3159 const char *source; ··· 3180 3161 const char *prefix; 3181 3162 3182 3163 if (route->control) { 3183 - dev_err(dapm->dev, 3164 + dev_err(dev, 3184 3165 "ASoC: Removal of routes with controls not supported\n"); 3185 3166 return -EINVAL; 3186 3167 } ··· 3223 3204 dapm_update_widget_flags(wsource); 3224 3205 dapm_update_widget_flags(wsink); 3225 3206 } else { 3226 - dev_warn(dapm->dev, "ASoC: Route %s->%s does not exist\n", 3207 + dev_warn(dev, "ASoC: Route %s->%s does not exist\n", 3227 3208 source, sink); 3228 3209 } 3229 3210 ··· 3370 3351 int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, 3371 3352 struct snd_ctl_elem_value *ucontrol) 3372 3353 { 3373 - struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); 3354 + struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); 3374 3355 struct soc_mixer_control *mc = 3375 3356 (struct soc_mixer_control *)kcontrol->private_value; 3376 3357 int reg = mc->reg; ··· 3392 3373 if (snd_soc_volsw_is_stereo(mc)) 3393 3374 rval = (reg_val >> mc->rshift) & mask; 3394 3375 } else { 3395 - reg_val = dapm_kcontrol_get_value(kcontrol); 3376 + reg_val = snd_soc_dapm_kcontrol_get_value(kcontrol); 3396 3377 val = reg_val & mask; 3397 3378 3398 3379 if (snd_soc_volsw_is_stereo(mc)) ··· 3428 3409 int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, 3429 3410 struct snd_ctl_elem_value *ucontrol) 3430 3411 { 3431 - struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); 3412 + struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); 3413 + struct device *dev = snd_soc_dapm_to_dev(dapm); 3432 3414 struct snd_soc_card *card = dapm->card; 3433 3415 struct soc_mixer_control *mc = 3434 3416 (struct soc_mixer_control *)kcontrol->private_value; ··· 3462 3442 3463 3443 /* This assumes field width < (bits in unsigned int / 2) */ 3464 3444 if (width > sizeof(unsigned int) * 8 / 2) 3465 - dev_warn(dapm->dev, 3445 + dev_warn(dev, 3466 3446 "ASoC: control %s field width limit exceeded\n", 3467 3447 kcontrol->id.name); 3468 3448 change = dapm_kcontrol_set_value(kcontrol, val | (rval << width)); ··· 3517 3497 int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, 3518 3498 struct snd_ctl_elem_value *ucontrol) 3519 3499 { 3520 - struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); 3500 + struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); 3521 3501 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 3522 3502 unsigned int reg_val, val; 3523 3503 ··· 3525 3505 if (e->reg != SND_SOC_NOPM && dapm_kcontrol_is_powered(kcontrol)) { 3526 3506 reg_val = soc_dapm_read(dapm, e->reg); 3527 3507 } else { 3528 - reg_val = dapm_kcontrol_get_value(kcontrol); 3508 + reg_val = snd_soc_dapm_kcontrol_get_value(kcontrol); 3529 3509 } 3530 3510 snd_soc_dapm_mutex_unlock(dapm); 3531 3511 ··· 3553 3533 int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, 3554 3534 struct snd_ctl_elem_value *ucontrol) 3555 3535 { 3556 - struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); 3536 + struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); 3557 3537 struct snd_soc_card *card = dapm->card; 3558 3538 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 3559 3539 unsigned int *item = ucontrol->value.enumerated.item; ··· 3646 3626 struct snd_ctl_elem_value *ucontrol) 3647 3627 { 3648 3628 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); 3629 + struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); 3649 3630 const char *pin = (const char *)kcontrol->private_value; 3650 3631 3651 - return __snd_soc_dapm_get_pin_switch(&card->dapm, pin, ucontrol); 3632 + return __snd_soc_dapm_get_pin_switch(dapm, pin, ucontrol); 3652 3633 } 3653 3634 EXPORT_SYMBOL_GPL(snd_soc_dapm_get_pin_switch); 3654 3635 ··· 3666 3645 struct snd_ctl_elem_value *ucontrol) 3667 3646 { 3668 3647 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); 3648 + struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); 3669 3649 const char *pin = (const char *)kcontrol->private_value; 3670 3650 3671 - return __snd_soc_dapm_get_pin_switch(&component->dapm, pin, ucontrol); 3651 + return __snd_soc_dapm_get_pin_switch(dapm, pin, ucontrol); 3672 3652 } 3673 3653 EXPORT_SYMBOL_GPL(snd_soc_dapm_get_component_pin_switch); 3674 3654 ··· 3701 3679 struct snd_ctl_elem_value *ucontrol) 3702 3680 { 3703 3681 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); 3682 + struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); 3704 3683 const char *pin = (const char *)kcontrol->private_value; 3705 3684 3706 - return __snd_soc_dapm_put_pin_switch(&card->dapm, pin, ucontrol); 3685 + return __snd_soc_dapm_put_pin_switch(dapm, pin, ucontrol); 3707 3686 } 3708 3687 EXPORT_SYMBOL_GPL(snd_soc_dapm_put_pin_switch); 3709 3688 ··· 3721 3698 struct snd_ctl_elem_value *ucontrol) 3722 3699 { 3723 3700 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); 3701 + struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); 3724 3702 const char *pin = (const char *)kcontrol->private_value; 3725 3703 3726 - return __snd_soc_dapm_put_pin_switch(&component->dapm, pin, ucontrol); 3704 + return __snd_soc_dapm_put_pin_switch(dapm, pin, ucontrol); 3727 3705 } 3728 3706 EXPORT_SYMBOL_GPL(snd_soc_dapm_put_component_pin_switch); 3729 3707 ··· 3732 3708 snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, 3733 3709 const struct snd_soc_dapm_widget *widget) 3734 3710 { 3711 + struct device *dev = snd_soc_dapm_to_dev(dapm); 3735 3712 enum snd_soc_dapm_direction dir; 3736 3713 struct snd_soc_dapm_widget *w; 3737 3714 int ret = -ENOMEM; ··· 3743 3718 3744 3719 switch (w->id) { 3745 3720 case snd_soc_dapm_regulator_supply: 3746 - w->regulator = devm_regulator_get(dapm->dev, widget->name); 3721 + w->regulator = devm_regulator_get(dev, widget->name); 3747 3722 if (IS_ERR(w->regulator)) { 3748 3723 ret = PTR_ERR(w->regulator); 3749 3724 goto request_failed; ··· 3752 3727 if (w->on_val & SND_SOC_DAPM_REGULATOR_BYPASS) { 3753 3728 ret = regulator_allow_bypass(w->regulator, true); 3754 3729 if (ret != 0) 3755 - dev_warn(dapm->dev, 3730 + dev_warn(dev, 3756 3731 "ASoC: Failed to bypass %s: %d\n", 3757 3732 w->name, ret); 3758 3733 } 3759 3734 break; 3760 3735 case snd_soc_dapm_pinctrl: 3761 - w->pinctrl = devm_pinctrl_get(dapm->dev); 3736 + w->pinctrl = devm_pinctrl_get(dev); 3762 3737 if (IS_ERR(w->pinctrl)) { 3763 3738 ret = PTR_ERR(w->pinctrl); 3764 3739 goto request_failed; ··· 3768 3743 snd_soc_dapm_pinctrl_event(w, NULL, SND_SOC_DAPM_POST_PMD); 3769 3744 break; 3770 3745 case snd_soc_dapm_clock_supply: 3771 - w->clk = devm_clk_get(dapm->dev, widget->name); 3746 + w->clk = devm_clk_get(dev, widget->name); 3772 3747 if (IS_ERR(w->clk)) { 3773 3748 ret = PTR_ERR(w->clk); 3774 3749 goto request_failed; ··· 3862 3837 return w; 3863 3838 3864 3839 request_failed: 3865 - dev_err_probe(dapm->dev, ret, "ASoC: Failed to request %s\n", 3840 + dev_err_probe(dev, ret, "ASoC: Failed to request %s\n", 3866 3841 w->name); 3867 3842 kfree_const(w->name); 3868 3843 kfree_const(w->sname); ··· 3929 3904 snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, 3930 3905 struct snd_pcm_substream *substream) 3931 3906 { 3907 + struct device *dev = snd_soc_dapm_to_dev(w->dapm); 3932 3908 struct snd_soc_dapm_path *path; 3933 3909 struct snd_soc_dai *source, *sink; 3934 3910 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); ··· 3989 3963 */ 3990 3964 config = rtd->dai_link->c2c_params + rtd->c2c_params_select; 3991 3965 if (!config) { 3992 - dev_err(w->dapm->dev, "ASoC: link config missing\n"); 3966 + dev_err(dev, "ASoC: link config missing\n"); 3993 3967 return -EINVAL; 3994 3968 } 3995 3969 3996 3970 /* Be a little careful as we don't want to overflow the mask array */ 3997 3971 if (!config->formats) { 3998 - dev_warn(w->dapm->dev, "ASoC: Invalid format was specified\n"); 3972 + dev_warn(dev, "ASoC: Invalid format was specified\n"); 3999 3973 4000 3974 return -EINVAL; 4001 3975 } ··· 4205 4179 4206 4180 for (count = 0 ; count < num_c2c_params; count++) { 4207 4181 if (!config->stream_name) { 4208 - dev_warn(card->dapm.dev, 4182 + dev_warn(card->dev, 4209 4183 "ASoC: anonymous config %d for dai link %s\n", 4210 4184 count, link_name); 4211 4185 w_param_text[count] = ··· 4257 4231 struct snd_pcm_substream *substream, 4258 4232 char *id) 4259 4233 { 4234 + struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); 4260 4235 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 4261 4236 struct snd_soc_dapm_widget template; 4262 4237 struct snd_soc_dapm_widget *w; ··· 4305 4278 4306 4279 dev_dbg(card->dev, "ASoC: adding %s widget\n", link_name); 4307 4280 4308 - w = snd_soc_dapm_new_control_unlocked(&card->dapm, &template); 4281 + w = snd_soc_dapm_new_control_unlocked(dapm, &template); 4309 4282 if (IS_ERR(w)) { 4310 4283 ret = PTR_ERR(w); 4311 4284 goto outfree_kcontrol_news; ··· 4337 4310 int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, 4338 4311 struct snd_soc_dai *dai) 4339 4312 { 4313 + struct device *dev = snd_soc_dapm_to_dev(dapm); 4340 4314 struct snd_soc_dapm_widget template; 4341 4315 struct snd_soc_dapm_widget *w; 4342 4316 4343 - WARN_ON(dapm->dev != dai->dev); 4317 + WARN_ON(dev != dai->dev); 4344 4318 4345 4319 memset(&template, 0, sizeof(template)); 4346 4320 template.reg = SND_SOC_NOPM; ··· 4445 4417 struct snd_soc_dai *sink_dai, 4446 4418 struct snd_soc_dapm_widget *sink) 4447 4419 { 4448 - dev_dbg(dapm->dev, "connected DAI link %s:%s -> %s:%s\n", 4420 + struct device *dev = snd_soc_dapm_to_dev(dapm); 4421 + 4422 + dev_dbg(dev, "connected DAI link %s:%s -> %s:%s\n", 4449 4423 src_dai->component->name, src->name, 4450 4424 sink_dai->component->name, sink->name); 4451 4425 ··· 4464 4434 struct snd_soc_dai *codec_dai, 4465 4435 struct snd_soc_dai *cpu_dai) 4466 4436 { 4437 + struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); 4467 4438 struct snd_soc_dai_link *dai_link = rtd->dai_link; 4468 4439 struct snd_soc_dapm_widget *codec, *cpu; 4469 4440 struct snd_soc_dai *src_dai[] = { cpu_dai, codec_dai }; ··· 4499 4468 rtd->c2c_widget[stream] = dai; 4500 4469 } 4501 4470 4502 - dapm_connect_dai_routes(&card->dapm, src_dai[stream], *src[stream], 4471 + dapm_connect_dai_routes(dapm, src_dai[stream], *src[stream], 4503 4472 rtd->c2c_widget[stream], 4504 4473 sink_dai[stream], *sink[stream]); 4505 4474 } ··· 4692 4661 int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, 4693 4662 const char *pin) 4694 4663 { 4664 + struct device *dev; 4695 4665 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); 4696 4666 4697 4667 if (!w) { 4698 - dev_err(dapm->dev, "ASoC: unknown pin %s\n", pin); 4668 + dev = snd_soc_dapm_to_dev(dapm); 4669 + 4670 + dev_err(dev, "ASoC: unknown pin %s\n", pin); 4699 4671 return -EINVAL; 4700 4672 } 4701 4673 4702 - dev_dbg(w->dapm->dev, "ASoC: force enable pin %s\n", pin); 4674 + dev = snd_soc_dapm_to_dev(w->dapm); 4675 + 4676 + dev_dbg(dev, "ASoC: force enable pin %s\n", pin); 4703 4677 if (!w->connected) { 4704 4678 /* 4705 4679 * w->force does not affect the number of input or output paths, ··· 4827 4791 int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, 4828 4792 const char *pin) 4829 4793 { 4794 + struct device *dev = snd_soc_dapm_to_dev(dapm); 4830 4795 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, false); 4831 4796 4832 4797 if (!w) { 4833 - dev_err(dapm->dev, "ASoC: unknown pin %s\n", pin); 4798 + dev_err(dev, "ASoC: unknown pin %s\n", pin); 4834 4799 return -EINVAL; 4835 4800 } 4836 4801 ··· 4914 4877 */ 4915 4878 void snd_soc_dapm_shutdown(struct snd_soc_card *card) 4916 4879 { 4880 + struct snd_soc_dapm_context *card_dapm = snd_soc_card_to_dapm(card); 4917 4881 struct snd_soc_dapm_context *dapm; 4918 4882 4919 4883 for_each_card_dapms(card, dapm) { 4920 - if (dapm != &card->dapm) { 4884 + if (dapm != card_dapm) { 4921 4885 soc_dapm_shutdown_dapm(dapm); 4922 4886 if (dapm->bias_level == SND_SOC_BIAS_STANDBY) 4923 - snd_soc_dapm_set_bias_level(dapm, 4924 - SND_SOC_BIAS_OFF); 4887 + snd_soc_dapm_set_bias_level(dapm, SND_SOC_BIAS_OFF); 4925 4888 } 4926 4889 } 4927 4890 4928 - soc_dapm_shutdown_dapm(&card->dapm); 4929 - if (card->dapm.bias_level == SND_SOC_BIAS_STANDBY) 4930 - snd_soc_dapm_set_bias_level(&card->dapm, 4931 - SND_SOC_BIAS_OFF); 4891 + soc_dapm_shutdown_dapm(card_dapm); 4892 + if (card_dapm->bias_level == SND_SOC_BIAS_STANDBY) 4893 + snd_soc_dapm_set_bias_level(card_dapm, SND_SOC_BIAS_OFF); 4932 4894 } 4933 4895 4934 4896 /* Module information */