diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-07-29 11:13:56 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-07-29 13:40:59 -0400 |
commit | 95dd5cd6e16d86786f7dc9da404ae477403d8f83 (patch) | |
tree | 807db53d68165fe9bb825e53d9b0ab282d572431 /sound/soc/soc-dapm.c | |
parent | 564c65049eddb1a95b48958080db97eda88c98dd (diff) |
ASoC: dapm: Pass card instead of dapm context to dapm_power_widgets()
DAPM operations are always performed on the card as a whole. Yet (primarily for
historic reasons) dapm_power_widgets() takes a DAPM context as its parameter.
The DAPM context is mainly used to look up a pointer to the card. The same is
true for a couple of functions that are being called from dapm_power_widgets().
This patch changes the signature of dapm_power_widgets() and a couple of related
functions to take a snd_soc_card instead of a snd_soc_dapm_context.
Some of the functions also use the DAPM's device to print error and debug
messages. This can be a bit confusing though since this means the messages for
all widgets, also those from other contexts, will be printed with that device.
The patch updates those cases to use the device of the widget's DAPM context.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r-- | sound/soc/soc-dapm.c | 100 |
1 files changed, 49 insertions, 51 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 7449e27bf133..5db8df2f8866 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1213,10 +1213,9 @@ static void dapm_seq_insert(struct snd_soc_dapm_widget *new_widget, | |||
1213 | list_add_tail(&new_widget->power_list, list); | 1213 | list_add_tail(&new_widget->power_list, list); |
1214 | } | 1214 | } |
1215 | 1215 | ||
1216 | static void dapm_seq_check_event(struct snd_soc_dapm_context *dapm, | 1216 | static void dapm_seq_check_event(struct snd_soc_card *card, |
1217 | struct snd_soc_dapm_widget *w, int event) | 1217 | struct snd_soc_dapm_widget *w, int event) |
1218 | { | 1218 | { |
1219 | struct snd_soc_card *card = dapm->card; | ||
1220 | const char *ev_name; | 1219 | const char *ev_name; |
1221 | int power, ret; | 1220 | int power, ret; |
1222 | 1221 | ||
@@ -1254,22 +1253,21 @@ static void dapm_seq_check_event(struct snd_soc_dapm_context *dapm, | |||
1254 | return; | 1253 | return; |
1255 | 1254 | ||
1256 | if (w->event && (w->event_flags & event)) { | 1255 | if (w->event && (w->event_flags & event)) { |
1257 | pop_dbg(dapm->dev, card->pop_time, "pop test : %s %s\n", | 1256 | pop_dbg(w->dapm->dev, card->pop_time, "pop test : %s %s\n", |
1258 | w->name, ev_name); | 1257 | w->name, ev_name); |
1259 | trace_snd_soc_dapm_widget_event_start(w, event); | 1258 | trace_snd_soc_dapm_widget_event_start(w, event); |
1260 | ret = w->event(w, NULL, event); | 1259 | ret = w->event(w, NULL, event); |
1261 | trace_snd_soc_dapm_widget_event_done(w, event); | 1260 | trace_snd_soc_dapm_widget_event_done(w, event); |
1262 | if (ret < 0) | 1261 | if (ret < 0) |
1263 | dev_err(dapm->dev, "ASoC: %s: %s event failed: %d\n", | 1262 | dev_err(w->dapm->dev, "ASoC: %s: %s event failed: %d\n", |
1264 | ev_name, w->name, ret); | 1263 | ev_name, w->name, ret); |
1265 | } | 1264 | } |
1266 | } | 1265 | } |
1267 | 1266 | ||
1268 | /* Apply the coalesced changes from a DAPM sequence */ | 1267 | /* Apply the coalesced changes from a DAPM sequence */ |
1269 | static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | 1268 | static void dapm_seq_run_coalesced(struct snd_soc_card *card, |
1270 | struct list_head *pending) | 1269 | struct list_head *pending) |
1271 | { | 1270 | { |
1272 | struct snd_soc_card *card = dapm->card; | ||
1273 | struct snd_soc_dapm_widget *w; | 1271 | struct snd_soc_dapm_widget *w; |
1274 | int reg, power; | 1272 | int reg, power; |
1275 | unsigned int value = 0; | 1273 | unsigned int value = 0; |
@@ -1292,13 +1290,13 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
1292 | if (power) | 1290 | if (power) |
1293 | value |= cur_mask; | 1291 | value |= cur_mask; |
1294 | 1292 | ||
1295 | pop_dbg(dapm->dev, card->pop_time, | 1293 | pop_dbg(w->dapm->dev, card->pop_time, |
1296 | "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n", | 1294 | "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n", |
1297 | w->name, reg, value, mask); | 1295 | w->name, reg, value, mask); |
1298 | 1296 | ||
1299 | /* Check for events */ | 1297 | /* Check for events */ |
1300 | dapm_seq_check_event(dapm, w, SND_SOC_DAPM_PRE_PMU); | 1298 | dapm_seq_check_event(card, w, SND_SOC_DAPM_PRE_PMU); |
1301 | dapm_seq_check_event(dapm, w, SND_SOC_DAPM_PRE_PMD); | 1299 | dapm_seq_check_event(card, w, SND_SOC_DAPM_PRE_PMD); |
1302 | } | 1300 | } |
1303 | 1301 | ||
1304 | if (reg >= 0) { | 1302 | if (reg >= 0) { |
@@ -1308,7 +1306,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
1308 | w = list_first_entry(pending, struct snd_soc_dapm_widget, | 1306 | w = list_first_entry(pending, struct snd_soc_dapm_widget, |
1309 | power_list); | 1307 | power_list); |
1310 | 1308 | ||
1311 | pop_dbg(dapm->dev, card->pop_time, | 1309 | pop_dbg(w->dapm->dev, card->pop_time, |
1312 | "pop test : Applying 0x%x/0x%x to %x in %dms\n", | 1310 | "pop test : Applying 0x%x/0x%x to %x in %dms\n", |
1313 | value, mask, reg, card->pop_time); | 1311 | value, mask, reg, card->pop_time); |
1314 | pop_wait(card->pop_time); | 1312 | pop_wait(card->pop_time); |
@@ -1316,8 +1314,8 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
1316 | } | 1314 | } |
1317 | 1315 | ||
1318 | list_for_each_entry(w, pending, power_list) { | 1316 | list_for_each_entry(w, pending, power_list) { |
1319 | dapm_seq_check_event(dapm, w, SND_SOC_DAPM_POST_PMU); | 1317 | dapm_seq_check_event(card, w, SND_SOC_DAPM_POST_PMU); |
1320 | dapm_seq_check_event(dapm, w, SND_SOC_DAPM_POST_PMD); | 1318 | dapm_seq_check_event(card, w, SND_SOC_DAPM_POST_PMD); |
1321 | } | 1319 | } |
1322 | } | 1320 | } |
1323 | 1321 | ||
@@ -1329,8 +1327,8 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
1329 | * Currently anything that requires more than a single write is not | 1327 | * Currently anything that requires more than a single write is not |
1330 | * handled. | 1328 | * handled. |
1331 | */ | 1329 | */ |
1332 | static void dapm_seq_run(struct snd_soc_dapm_context *dapm, | 1330 | static void dapm_seq_run(struct snd_soc_card *card, |
1333 | struct list_head *list, int event, bool power_up) | 1331 | struct list_head *list, int event, bool power_up) |
1334 | { | 1332 | { |
1335 | struct snd_soc_dapm_widget *w, *n; | 1333 | struct snd_soc_dapm_widget *w, *n; |
1336 | LIST_HEAD(pending); | 1334 | LIST_HEAD(pending); |
@@ -1353,7 +1351,7 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm, | |||
1353 | if (sort[w->id] != cur_sort || w->reg != cur_reg || | 1351 | if (sort[w->id] != cur_sort || w->reg != cur_reg || |
1354 | w->dapm != cur_dapm || w->subseq != cur_subseq) { | 1352 | w->dapm != cur_dapm || w->subseq != cur_subseq) { |
1355 | if (!list_empty(&pending)) | 1353 | if (!list_empty(&pending)) |
1356 | dapm_seq_run_coalesced(cur_dapm, &pending); | 1354 | dapm_seq_run_coalesced(card, &pending); |
1357 | 1355 | ||
1358 | if (cur_dapm && cur_dapm->seq_notifier) { | 1356 | if (cur_dapm && cur_dapm->seq_notifier) { |
1359 | for (i = 0; i < ARRAY_SIZE(dapm_up_seq); i++) | 1357 | for (i = 0; i < ARRAY_SIZE(dapm_up_seq); i++) |
@@ -1413,7 +1411,7 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm, | |||
1413 | } | 1411 | } |
1414 | 1412 | ||
1415 | if (!list_empty(&pending)) | 1413 | if (!list_empty(&pending)) |
1416 | dapm_seq_run_coalesced(cur_dapm, &pending); | 1414 | dapm_seq_run_coalesced(card, &pending); |
1417 | 1415 | ||
1418 | if (cur_dapm && cur_dapm->seq_notifier) { | 1416 | if (cur_dapm && cur_dapm->seq_notifier) { |
1419 | for (i = 0; i < ARRAY_SIZE(dapm_up_seq); i++) | 1417 | for (i = 0; i < ARRAY_SIZE(dapm_up_seq); i++) |
@@ -1423,9 +1421,9 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm, | |||
1423 | } | 1421 | } |
1424 | } | 1422 | } |
1425 | 1423 | ||
1426 | static void dapm_widget_update(struct snd_soc_dapm_context *dapm) | 1424 | static void dapm_widget_update(struct snd_soc_card *card) |
1427 | { | 1425 | { |
1428 | struct snd_soc_dapm_update *update = dapm->card->update; | 1426 | struct snd_soc_dapm_update *update = card->update; |
1429 | struct snd_soc_dapm_widget_list *wlist; | 1427 | struct snd_soc_dapm_widget_list *wlist; |
1430 | struct snd_soc_dapm_widget *w = NULL; | 1428 | struct snd_soc_dapm_widget *w = NULL; |
1431 | unsigned int wi; | 1429 | unsigned int wi; |
@@ -1442,7 +1440,7 @@ static void dapm_widget_update(struct snd_soc_dapm_context *dapm) | |||
1442 | if (w->event && (w->event_flags & SND_SOC_DAPM_PRE_REG)) { | 1440 | if (w->event && (w->event_flags & SND_SOC_DAPM_PRE_REG)) { |
1443 | ret = w->event(w, update->kcontrol, SND_SOC_DAPM_PRE_REG); | 1441 | ret = w->event(w, update->kcontrol, SND_SOC_DAPM_PRE_REG); |
1444 | if (ret != 0) | 1442 | if (ret != 0) |
1445 | dev_err(dapm->dev, "ASoC: %s DAPM pre-event failed: %d\n", | 1443 | dev_err(w->dapm->dev, "ASoC: %s DAPM pre-event failed: %d\n", |
1446 | w->name, ret); | 1444 | w->name, ret); |
1447 | } | 1445 | } |
1448 | } | 1446 | } |
@@ -1453,7 +1451,7 @@ static void dapm_widget_update(struct snd_soc_dapm_context *dapm) | |||
1453 | ret = soc_widget_update_bits_locked(w, update->reg, update->mask, | 1451 | ret = soc_widget_update_bits_locked(w, update->reg, update->mask, |
1454 | update->val); | 1452 | update->val); |
1455 | if (ret < 0) | 1453 | if (ret < 0) |
1456 | dev_err(dapm->dev, "ASoC: %s DAPM update failed: %d\n", | 1454 | dev_err(w->dapm->dev, "ASoC: %s DAPM update failed: %d\n", |
1457 | w->name, ret); | 1455 | w->name, ret); |
1458 | 1456 | ||
1459 | for (wi = 0; wi < wlist->num_widgets; wi++) { | 1457 | for (wi = 0; wi < wlist->num_widgets; wi++) { |
@@ -1462,7 +1460,7 @@ static void dapm_widget_update(struct snd_soc_dapm_context *dapm) | |||
1462 | if (w->event && (w->event_flags & SND_SOC_DAPM_POST_REG)) { | 1460 | if (w->event && (w->event_flags & SND_SOC_DAPM_POST_REG)) { |
1463 | ret = w->event(w, update->kcontrol, SND_SOC_DAPM_POST_REG); | 1461 | ret = w->event(w, update->kcontrol, SND_SOC_DAPM_POST_REG); |
1464 | if (ret != 0) | 1462 | if (ret != 0) |
1465 | dev_err(dapm->dev, "ASoC: %s DAPM post-event failed: %d\n", | 1463 | dev_err(w->dapm->dev, "ASoC: %s DAPM post-event failed: %d\n", |
1466 | w->name, ret); | 1464 | w->name, ret); |
1467 | } | 1465 | } |
1468 | } | 1466 | } |
@@ -1627,9 +1625,8 @@ static void dapm_power_one_widget(struct snd_soc_dapm_widget *w, | |||
1627 | * o Input pin to Output pin (bypass, sidetone) | 1625 | * o Input pin to Output pin (bypass, sidetone) |
1628 | * o DAC to ADC (loopback). | 1626 | * o DAC to ADC (loopback). |
1629 | */ | 1627 | */ |
1630 | static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event) | 1628 | static int dapm_power_widgets(struct snd_soc_card *card, int event) |
1631 | { | 1629 | { |
1632 | struct snd_soc_card *card = dapm->card; | ||
1633 | struct snd_soc_dapm_widget *w; | 1630 | struct snd_soc_dapm_widget *w; |
1634 | struct snd_soc_dapm_context *d; | 1631 | struct snd_soc_dapm_context *d; |
1635 | LIST_HEAD(up_list); | 1632 | LIST_HEAD(up_list); |
@@ -1711,29 +1708,29 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event) | |||
1711 | trace_snd_soc_dapm_walk_done(card); | 1708 | trace_snd_soc_dapm_walk_done(card); |
1712 | 1709 | ||
1713 | /* Run all the bias changes in parallel */ | 1710 | /* Run all the bias changes in parallel */ |
1714 | list_for_each_entry(d, &dapm->card->dapm_list, list) | 1711 | list_for_each_entry(d, &card->dapm_list, list) |
1715 | async_schedule_domain(dapm_pre_sequence_async, d, | 1712 | async_schedule_domain(dapm_pre_sequence_async, d, |
1716 | &async_domain); | 1713 | &async_domain); |
1717 | async_synchronize_full_domain(&async_domain); | 1714 | async_synchronize_full_domain(&async_domain); |
1718 | 1715 | ||
1719 | list_for_each_entry(w, &down_list, power_list) { | 1716 | list_for_each_entry(w, &down_list, power_list) { |
1720 | dapm_seq_check_event(dapm, w, SND_SOC_DAPM_WILL_PMD); | 1717 | dapm_seq_check_event(card, w, SND_SOC_DAPM_WILL_PMD); |
1721 | } | 1718 | } |
1722 | 1719 | ||
1723 | list_for_each_entry(w, &up_list, power_list) { | 1720 | list_for_each_entry(w, &up_list, power_list) { |
1724 | dapm_seq_check_event(dapm, w, SND_SOC_DAPM_WILL_PMU); | 1721 | dapm_seq_check_event(card, w, SND_SOC_DAPM_WILL_PMU); |
1725 | } | 1722 | } |
1726 | 1723 | ||
1727 | /* Power down widgets first; try to avoid amplifying pops. */ | 1724 | /* Power down widgets first; try to avoid amplifying pops. */ |
1728 | dapm_seq_run(dapm, &down_list, event, false); | 1725 | dapm_seq_run(card, &down_list, event, false); |
1729 | 1726 | ||
1730 | dapm_widget_update(dapm); | 1727 | dapm_widget_update(card); |
1731 | 1728 | ||
1732 | /* Now power up. */ | 1729 | /* Now power up. */ |
1733 | dapm_seq_run(dapm, &up_list, event, true); | 1730 | dapm_seq_run(card, &up_list, event, true); |
1734 | 1731 | ||
1735 | /* Run all the bias changes in parallel */ | 1732 | /* Run all the bias changes in parallel */ |
1736 | list_for_each_entry(d, &dapm->card->dapm_list, list) | 1733 | list_for_each_entry(d, &card->dapm_list, list) |
1737 | async_schedule_domain(dapm_post_sequence_async, d, | 1734 | async_schedule_domain(dapm_post_sequence_async, d, |
1738 | &async_domain); | 1735 | &async_domain); |
1739 | async_synchronize_full_domain(&async_domain); | 1736 | async_synchronize_full_domain(&async_domain); |
@@ -1744,7 +1741,7 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event) | |||
1744 | d->stream_event(d, event); | 1741 | d->stream_event(d, event); |
1745 | } | 1742 | } |
1746 | 1743 | ||
1747 | pop_dbg(dapm->dev, card->pop_time, | 1744 | pop_dbg(card->dev, card->pop_time, |
1748 | "DAPM sequencing finished, waiting %dms\n", card->pop_time); | 1745 | "DAPM sequencing finished, waiting %dms\n", card->pop_time); |
1749 | pop_wait(card->pop_time); | 1746 | pop_wait(card->pop_time); |
1750 | 1747 | ||
@@ -1917,14 +1914,14 @@ static inline void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm) | |||
1917 | #endif | 1914 | #endif |
1918 | 1915 | ||
1919 | /* test and update the power status of a mux widget */ | 1916 | /* test and update the power status of a mux widget */ |
1920 | static int soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm, | 1917 | static int soc_dapm_mux_update_power(struct snd_soc_card *card, |
1921 | struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e) | 1918 | struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e) |
1922 | { | 1919 | { |
1923 | struct snd_soc_dapm_path *path; | 1920 | struct snd_soc_dapm_path *path; |
1924 | int found = 0; | 1921 | int found = 0; |
1925 | 1922 | ||
1926 | /* find dapm widget path assoc with kcontrol */ | 1923 | /* find dapm widget path assoc with kcontrol */ |
1927 | list_for_each_entry(path, &dapm->card->paths, list) { | 1924 | list_for_each_entry(path, &card->paths, list) { |
1928 | if (path->kcontrol != kcontrol) | 1925 | if (path->kcontrol != kcontrol) |
1929 | continue; | 1926 | continue; |
1930 | 1927 | ||
@@ -1946,7 +1943,7 @@ static int soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm, | |||
1946 | } | 1943 | } |
1947 | 1944 | ||
1948 | if (found) | 1945 | if (found) |
1949 | dapm_power_widgets(dapm, SND_SOC_DAPM_STREAM_NOP); | 1946 | dapm_power_widgets(card, SND_SOC_DAPM_STREAM_NOP); |
1950 | 1947 | ||
1951 | return found; | 1948 | return found; |
1952 | } | 1949 | } |
@@ -1960,7 +1957,7 @@ int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm, | |||
1960 | 1957 | ||
1961 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | 1958 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); |
1962 | card->update = update; | 1959 | card->update = update; |
1963 | ret = soc_dapm_mux_update_power(dapm, kcontrol, mux, e); | 1960 | ret = soc_dapm_mux_update_power(card, kcontrol, mux, e); |
1964 | card->update = NULL; | 1961 | card->update = NULL; |
1965 | mutex_unlock(&card->dapm_mutex); | 1962 | mutex_unlock(&card->dapm_mutex); |
1966 | if (ret > 0) | 1963 | if (ret > 0) |
@@ -1970,14 +1967,14 @@ int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm, | |||
1970 | EXPORT_SYMBOL_GPL(snd_soc_dapm_mux_update_power); | 1967 | EXPORT_SYMBOL_GPL(snd_soc_dapm_mux_update_power); |
1971 | 1968 | ||
1972 | /* test and update the power status of a mixer or switch widget */ | 1969 | /* test and update the power status of a mixer or switch widget */ |
1973 | static int soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm, | 1970 | static int soc_dapm_mixer_update_power(struct snd_soc_card *card, |
1974 | struct snd_kcontrol *kcontrol, int connect) | 1971 | struct snd_kcontrol *kcontrol, int connect) |
1975 | { | 1972 | { |
1976 | struct snd_soc_dapm_path *path; | 1973 | struct snd_soc_dapm_path *path; |
1977 | int found = 0; | 1974 | int found = 0; |
1978 | 1975 | ||
1979 | /* find dapm widget path assoc with kcontrol */ | 1976 | /* find dapm widget path assoc with kcontrol */ |
1980 | list_for_each_entry(path, &dapm->card->paths, list) { | 1977 | list_for_each_entry(path, &card->paths, list) { |
1981 | if (path->kcontrol != kcontrol) | 1978 | if (path->kcontrol != kcontrol) |
1982 | continue; | 1979 | continue; |
1983 | 1980 | ||
@@ -1989,7 +1986,7 @@ static int soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm, | |||
1989 | } | 1986 | } |
1990 | 1987 | ||
1991 | if (found) | 1988 | if (found) |
1992 | dapm_power_widgets(dapm, SND_SOC_DAPM_STREAM_NOP); | 1989 | dapm_power_widgets(card, SND_SOC_DAPM_STREAM_NOP); |
1993 | 1990 | ||
1994 | return found; | 1991 | return found; |
1995 | } | 1992 | } |
@@ -2003,7 +2000,7 @@ int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm, | |||
2003 | 2000 | ||
2004 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | 2001 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); |
2005 | card->update = update; | 2002 | card->update = update; |
2006 | ret = soc_dapm_mixer_update_power(dapm, kcontrol, connect); | 2003 | ret = soc_dapm_mixer_update_power(card, kcontrol, connect); |
2007 | card->update = NULL; | 2004 | card->update = NULL; |
2008 | mutex_unlock(&card->dapm_mutex); | 2005 | mutex_unlock(&card->dapm_mutex); |
2009 | if (ret > 0) | 2006 | if (ret > 0) |
@@ -2180,7 +2177,7 @@ int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm) | |||
2180 | return 0; | 2177 | return 0; |
2181 | 2178 | ||
2182 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | 2179 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); |
2183 | ret = dapm_power_widgets(dapm, SND_SOC_DAPM_STREAM_NOP); | 2180 | ret = dapm_power_widgets(dapm->card, SND_SOC_DAPM_STREAM_NOP); |
2184 | mutex_unlock(&dapm->card->dapm_mutex); | 2181 | mutex_unlock(&dapm->card->dapm_mutex); |
2185 | return ret; | 2182 | return ret; |
2186 | } | 2183 | } |
@@ -2545,12 +2542,13 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_weak_routes); | |||
2545 | */ | 2542 | */ |
2546 | int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) | 2543 | int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) |
2547 | { | 2544 | { |
2545 | struct snd_soc_card *card = dapm->card; | ||
2548 | struct snd_soc_dapm_widget *w; | 2546 | struct snd_soc_dapm_widget *w; |
2549 | unsigned int val; | 2547 | unsigned int val; |
2550 | 2548 | ||
2551 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); | 2549 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); |
2552 | 2550 | ||
2553 | list_for_each_entry(w, &dapm->card->widgets, list) | 2551 | list_for_each_entry(w, &card->widgets, list) |
2554 | { | 2552 | { |
2555 | if (w->new) | 2553 | if (w->new) |
2556 | continue; | 2554 | continue; |
@@ -2560,7 +2558,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) | |||
2560 | sizeof(struct snd_kcontrol *), | 2558 | sizeof(struct snd_kcontrol *), |
2561 | GFP_KERNEL); | 2559 | GFP_KERNEL); |
2562 | if (!w->kcontrols) { | 2560 | if (!w->kcontrols) { |
2563 | mutex_unlock(&dapm->card->dapm_mutex); | 2561 | mutex_unlock(&card->dapm_mutex); |
2564 | return -ENOMEM; | 2562 | return -ENOMEM; |
2565 | } | 2563 | } |
2566 | } | 2564 | } |
@@ -2601,8 +2599,8 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) | |||
2601 | dapm_debugfs_add_widget(w); | 2599 | dapm_debugfs_add_widget(w); |
2602 | } | 2600 | } |
2603 | 2601 | ||
2604 | dapm_power_widgets(dapm, SND_SOC_DAPM_STREAM_NOP); | 2602 | dapm_power_widgets(card, SND_SOC_DAPM_STREAM_NOP); |
2605 | mutex_unlock(&dapm->card->dapm_mutex); | 2603 | mutex_unlock(&card->dapm_mutex); |
2606 | return 0; | 2604 | return 0; |
2607 | } | 2605 | } |
2608 | EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets); | 2606 | EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets); |
@@ -2695,7 +2693,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | |||
2695 | 2693 | ||
2696 | card->update = &update; | 2694 | card->update = &update; |
2697 | 2695 | ||
2698 | soc_dapm_mixer_update_power(widget->dapm, kcontrol, connect); | 2696 | soc_dapm_mixer_update_power(card, kcontrol, connect); |
2699 | 2697 | ||
2700 | card->update = NULL; | 2698 | card->update = NULL; |
2701 | } | 2699 | } |
@@ -2777,7 +2775,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, | |||
2777 | update.val = val; | 2775 | update.val = val; |
2778 | card->update = &update; | 2776 | card->update = &update; |
2779 | 2777 | ||
2780 | soc_dapm_mux_update_power(widget->dapm, kcontrol, mux, e); | 2778 | soc_dapm_mux_update_power(card, kcontrol, mux, e); |
2781 | 2779 | ||
2782 | card->update = NULL; | 2780 | card->update = NULL; |
2783 | } | 2781 | } |
@@ -2832,7 +2830,7 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, | |||
2832 | change = widget->value != ucontrol->value.enumerated.item[0]; | 2830 | change = widget->value != ucontrol->value.enumerated.item[0]; |
2833 | if (change) { | 2831 | if (change) { |
2834 | widget->value = ucontrol->value.enumerated.item[0]; | 2832 | widget->value = ucontrol->value.enumerated.item[0]; |
2835 | soc_dapm_mux_update_power(widget->dapm, kcontrol, widget->value, e); | 2833 | soc_dapm_mux_update_power(card, kcontrol, widget->value, e); |
2836 | } | 2834 | } |
2837 | 2835 | ||
2838 | mutex_unlock(&card->dapm_mutex); | 2836 | mutex_unlock(&card->dapm_mutex); |
@@ -2930,7 +2928,7 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | |||
2930 | update.val = val; | 2928 | update.val = val; |
2931 | card->update = &update; | 2929 | card->update = &update; |
2932 | 2930 | ||
2933 | soc_dapm_mux_update_power(widget->dapm, kcontrol, mux, e); | 2931 | soc_dapm_mux_update_power(card, kcontrol, mux, e); |
2934 | 2932 | ||
2935 | card->update = NULL; | 2933 | card->update = NULL; |
2936 | } | 2934 | } |
@@ -3478,7 +3476,7 @@ static void soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, | |||
3478 | } | 3476 | } |
3479 | } | 3477 | } |
3480 | 3478 | ||
3481 | dapm_power_widgets(&rtd->card->dapm, event); | 3479 | dapm_power_widgets(rtd->card, event); |
3482 | } | 3480 | } |
3483 | 3481 | ||
3484 | /** | 3482 | /** |
@@ -3747,7 +3745,7 @@ static void soc_dapm_shutdown_codec(struct snd_soc_dapm_context *dapm) | |||
3747 | if (dapm->bias_level == SND_SOC_BIAS_ON) | 3745 | if (dapm->bias_level == SND_SOC_BIAS_ON) |
3748 | snd_soc_dapm_set_bias_level(dapm, | 3746 | snd_soc_dapm_set_bias_level(dapm, |
3749 | SND_SOC_BIAS_PREPARE); | 3747 | SND_SOC_BIAS_PREPARE); |
3750 | dapm_seq_run(dapm, &down_list, 0, false); | 3748 | dapm_seq_run(card, &down_list, 0, false); |
3751 | if (dapm->bias_level == SND_SOC_BIAS_PREPARE) | 3749 | if (dapm->bias_level == SND_SOC_BIAS_PREPARE) |
3752 | snd_soc_dapm_set_bias_level(dapm, | 3750 | snd_soc_dapm_set_bias_level(dapm, |
3753 | SND_SOC_BIAS_STANDBY); | 3751 | SND_SOC_BIAS_STANDBY); |