ASoC: dapm: Fix marking widgets dirty when a route is added
Subsystems (4)
PATCH 1/8 ASoC: dapm: Fix marking widgets dirty when a route is added
The current calls to dapm_mark_dirty() in snd_soc_dapm_add_path() are on a path that is only reached if the sink widget is either a mixer or a mux. Move the calls further up so they are called for all widget types.
--- sound/soc/soc-dapm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/soc-dapm.c +3 -3
@@ -2374,6 +2374,9 @@ static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm, wsource->ext =1 ; } +dapm_mark_dirty (wsource,"Route added" ); +dapm_mark_dirty (wsink,"Route added" ); +/* connect static paths */ if (control ==NULL ) {list_add (&path->list, &dapm->card->paths);
@@ -2436,9 +2439,6 @@ static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm,return 0 ; } -dapm_mark_dirty (wsource,"Route added" ); -dapm_mark_dirty (wsink,"Route added" ); -return 0 ; err:kfree (path);
Signature · 1 line
1.8.0
PATCH 2/8 ASoC: dmic: Convert table based DAPM setup
Let the core take care of instantiating the DAPM widgets and routes, this makes the code a bit shorter.
--- sound/soc/codecs/dmic.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
sound/soc/codecs/dmic.c +4 -13
@@ -50,20 +50,11 @@ static const struct snd_soc_dapm_route intercon[] = { {"DMIC AIF", NULL, "DMic"}, }; -static int dmic_probe (struct snd_soc_codec *codec) -{ -struct snd_soc_dapm_context *dapm = &codec->dapm; - -snd_soc_dapm_new_controls (dapm, dmic_dapm_widgets, -ARRAY_SIZE (dmic_dapm_widgets)); -snd_soc_dapm_add_routes (dapm, intercon,ARRAY_SIZE (intercon)); -snd_soc_dapm_new_widgets (dapm); - -return 0 ; -} -static struct snd_soc_codec_driver soc_dmic = { - .probe = dmic_probe, + .dapm_widgets = dmic_dapm_widgets, + .num_dapm_widgets =ARRAY_SIZE (dmic_dapm_widgets), + .dapm_routes = intercon, + .num_dapm_routes =ARRAY_SIZE (intercon), };static int dmic_dev_probe (struct platform_device *pdev)
Signature · 1 line
1.8.0
PATCH 3/8 ASoC: tlv320aic32x4: Convert table based control and DAPM setup
In reply to Lars-Peter ClausenLet the core take care of instantiating the controls and DAPM widgets and routes, this makes the code a bit shorter.
--- sound/soc/codecs/tlv320aic32x4.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)
sound/soc/codecs/tlv320aic32x4.c +7 -15
@@ -338,18 +338,6 @@ static inline int aic32x4_get_divs(int mclk, int rate)return -EINVAL ; } -static int aic32x4_add_widgets (struct snd_soc_codec *codec) -{ -snd_soc_dapm_new_controls (&codec->dapm, aic32x4_dapm_widgets, -ARRAY_SIZE (aic32x4_dapm_widgets)); - -snd_soc_dapm_add_routes (&codec->dapm, aic32x4_dapm_routes, -ARRAY_SIZE (aic32x4_dapm_routes)); - -snd_soc_dapm_new_widgets (&codec->dapm); -return 0 ; -} -static int aic32x4_set_dai_sysclk (struct snd_soc_dai *codec_dai,int clk_id,unsigned int freq,int dir) {
@@ -683,9 +671,6 @@ static int aic32x4_probe(struct snd_soc_codec *codec) }aic32x4_set_bias_level (codec,SND_SOC_BIAS_STANDBY ); -snd_soc_add_codec_controls (codec, aic32x4_snd_controls, -ARRAY_SIZE (aic32x4_snd_controls)); -aic32x4_add_widgets (codec);/* * Workaround: for an unknown reason, the ADC needs to be powered up
@@ -714,6 +699,13 @@ static struct snd_soc_codec_driver soc_codec_dev_aic32x4 = { .suspend = aic32x4_suspend, .resume = aic32x4_resume, .set_bias_level = aic32x4_set_bias_level, + + .controls = aic32x4_snd_controls, + .num_controls = ARRAY_SIZE(aic32x4_snd_controls), + .dapm_widgets = aic32x4_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(aic32x4_dapm_widgets), + .dapm_routes = aic32x4_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(aic32x4_dapm_routes), }; static int aic32x4_i2c_probe(struct i2c_client *i2c,
Signature · 1 line
1.8.0
PATCH 4/8 ASoC; wm8904: Remove unnecessary call to snd_soc_dapm_new_widgets()
In reply to Lars-Peter ClausenThe core will call snd_soc_dapm_new_widgets() once all components of the card have been initialized, so there is no need to do this manually in the driver. Calling it earlier also might result in a partially instantiated system being powered up which cause undesired side effects.
--- sound/soc/codecs/wm8904.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/wm8904.c +0 -1
@@ -1202,7 +1202,6 @@ static int wm8904_add_widgets(struct snd_soc_codec *codec)break ; } -snd_soc_dapm_new_widgets (dapm);return 0 ; }
Signature · 1 line
1.8.0
PATCH 5/8 ASoC: jack: Remove unnecessary call to snd_soc_dapm_new_widgets()
In reply to Lars-Peter Clausensnd_soc_jack_add_pins() does not create any new DAPM widgets, so there is no need to call snd_soc_dapm_new_widgets().
--- sound/soc/soc-jack.c | 2 -- 1 file changed, 2 deletions(-)
sound/soc/soc-jack.c +0 -2
@@ -183,8 +183,6 @@ int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,list_add (&(pins[i].list), &jack->pins); } -snd_soc_dapm_new_widgets (&jack->codec->card->dapm); -/* Update to reflect the last reported status; canned jack * implementations are likely to set their state before the * card has an opportunity to associate pins.
Signature · 1 line
1.8.0
PATCH 6/8 ASoC: Call snd_soc_dapm_new_widgets() only once during card initialization
In reply to Lars-Peter ClausenEach time snd_soc_dapm_new_widgets() is called it will instantiate all the widgets and routes that have been added so far and then power them. Doing this multiple times before the card is fully initialized and all widgets have been added can cause unnecessary and even invalid power state transitions which can result in extra register writes and and also might cause clicks and pops.
--- sound/soc/soc-core.c | 5 ----- 1 file changed, 5 deletions(-)
sound/soc/soc-core.c +0 -5
@@ -1243,9 +1243,6 @@ static int soc_post_component_init(struct snd_soc_card *card, } rtd->card = card; -/* Make sure all DAPM widgets are instantiated */ -snd_soc_dapm_new_widgets (&codec->dapm); -/* machine controls, routes and widgets are not prefixed */ temp = codec->name_prefix; codec->name_prefix =NULL ;
@@ -1741,8 +1738,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)snd_soc_dapm_add_routes (&card->dapm, card->dapm_routes, card->num_dapm_routes); -snd_soc_dapm_new_widgets (&card->dapm); -for (i =0 ; i < card->num_links; i++) { dai_link = &card->dai_link[i]; dai_fmt = dai_link->dai_fmt;
Signature · 1 line
1.8.0
PATCH 7/8 ASoC: Move call to snd_soc_dapm_new_widgets() after snd_soc_dapm_auto_nc_codec_pins()
In reply to Lars-Peter ClausenCall snd_soc_dapm_new_widgets() before the auto non-connected pins have been marked as not connected will power the system under the assumption that those pins are connected. Once the pins have been marked as disconnected the system there will be an additional power run. This can cause unnecessary power transitions. Calling snd_soc_dapm_new_widgets() only after the pins have been marked as non-connected avoids this.
--- sound/soc/soc-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-core.c +2 -2
@@ -1816,12 +1816,12 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) } } -snd_soc_dapm_new_widgets (&card->dapm); -if (card->fully_routed)list_for_each_entry (codec, &card->codec_dev_list, card_list)snd_soc_dapm_auto_nc_codec_pins (codec); +snd_soc_dapm_new_widgets (&card->dapm); + ret =snd_card_register (card->snd_card);if (ret <0 ) { dev_err(card->dev, "ASoC: failed to register soundcard %d\n",
Signature · 1 line
1.8.0
PATCH 8/8 ASoC: Pass card instead of dapm context to snd_soc_dapm_new_widgets()
In reply to Lars-Peter Clausensnd_soc_dapm_new_widgets() works on the ASoC card as a whole not on a specific DAPM context. The DAPM context that is passed as the parameter is only used to look up the pointer to the card. This patch updates the signature of snd_soc_dapm_new_widgets() to take the card directly.
--- include/sound/soc-dapm.h | 2 +- sound/soc/soc-core.c | 2 +- sound/soc/soc-dapm.c | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-)
include/sound/soc-dapm.h +1 -1
@@ -413,7 +413,7 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card, struct snd_soc_dapm_widget *sink);/* dapm path setup */ -int snd_soc_dapm_new_widgets (struct snd_soc_dapm_context *dapm); +int snd_soc_dapm_new_widgets (struct snd_soc_card *card);void snd_soc_dapm_free (struct snd_soc_dapm_context *dapm);int snd_soc_dapm_add_routes (struct snd_soc_dapm_context *dapm,const struct snd_soc_dapm_route *route,int num);
sound/soc/soc-core.c +1 -1
@@ -1820,7 +1820,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)list_for_each_entry (codec, &card->codec_dev_list, card_list)snd_soc_dapm_auto_nc_codec_pins (codec); -snd_soc_dapm_new_widgets (&card->dapm); +snd_soc_dapm_new_widgets (card); ret =snd_card_register (card->snd_card);if (ret <0 ) {
sound/soc/soc-dapm.c +1 -2
@@ -2712,9 +2712,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_weak_routes);* * Returns 0 for success. */ -int snd_soc_dapm_new_widgets (struct snd_soc_dapm_context *dapm) +int snd_soc_dapm_new_widgets (struct snd_soc_card *card) { -struct snd_soc_card *card = dapm->card;struct snd_soc_dapm_widget *w;unsigned int val;
Signature · 1 line
1.8.0
Re: [PATCH 2/8] ASoC: dmic: Convert table based DAPM setup
In reply to Lars-Peter ClausenQuoted 2 lines · Lars-Peter Clausen
Let the core take care of instantiating the DAPM widgets and routes, this makes the code a bit shorter.
Applied, thanks.
Quoted 3 lines · Lars-Peter Clausen
The current calls to
dapm_mark_dirty()insnd_soc_dapm_add_path()are on a path that is only reached if the sink widget is either a mixer or a mux. Move the calls further up so they are called for all widget types.
Applied, thanks.
Re: [PATCH 3/8] ASoC: tlv320aic32x4: Convert table based control and DAPM setup
In reply to Lars-Peter ClausenQuoted 2 lines · Lars-Peter Clausen
Let the core take care of instantiating the controls and DAPM widgets and routes, this makes the code a bit shorter.
Applied, thanks.
Please don't submit a bunch of unrelated patches as a series, submit them separately. It's a bit easier for review and will avoid later patches getting ignored if there's problems early on.
Re: [PATCH 4/8] ASoC; wm8904: Remove unnecessary call to snd_soc_dapm_new_widgets()
In reply to Lars-Peter ClausenQuoted 4 lines · Lars-Peter Clausen
The core will call
snd_soc_dapm_new_widgets()once all components of the card have been initialized, so there is no need to do this manually in the driver. Calling it earlier also might result in a partially instantiated system being powered up which cause undesired side effects.
Applied, thanks.
Re: [PATCH 5/8] ASoC: jack: Remove unnecessary call to snd_soc_dapm_new_widgets()
In reply to Lars-Peter ClausenQuoted 2 lines · Lars-Peter Clausen
snd_soc_jack_add_pins()does not create any new DAPM widgets, so there is no need to callsnd_soc_dapm_new_widgets().
Applied, thanks.
Re: [PATCH 6/8] ASoC: Call snd_soc_dapm_new_widgets() only once during card initialization
In reply to Lars-Peter ClausenQuoted 5 lines · Lars-Peter Clausen
Each time
snd_soc_dapm_new_widgets()is called it will instantiate all the widgets and routes that have been added so far and then power them. Doing this multiple times before the card is fully initialized and all widgets have been added can cause unnecessary and even invalid power state transitions which can result in extra register writes and and also might cause clicks and pops.
Applied, thanks.
Re: [PATCH 3/8] ASoC: tlv320aic32x4: Convert table based control and DAPM setup
In reply to Mark BrownQuoted 8 lines · Mark Brown
Quoted 2 lines · Lars-Peter Clausen
Let the core take care of instantiating the controls and DAPM widgets and routes, this makes the code a bit shorter.
Applied, thanks.
Please don't submit a bunch of unrelated patches as a series, submit them separately.
The last patch in the series depends on all the other patches in this series (maybe except for the mark dirty fix).
- Lars
Re: [PATCH 7/8] ASoC: Move call to snd_soc_dapm_new_widgets() after snd_soc_dapm_auto_nc_codec_pins()
In reply to Lars-Peter ClausenQuoted 6 lines · Lars-Peter Clausen
Call
snd_soc_dapm_new_widgets()before the auto non-connected pins have been marked as not connected will power the system under the assumption that those pins are connected. Once the pins have been marked as disconnected the system there will be an additional power run. This can cause unnecessary power transitions. Callingsnd_soc_dapm_new_widgets()only after the pins have been marked as non-connected avoids this.
Applied, thanks.
Re: [PATCH 8/8] ASoC: Pass card instead of dapm context to snd_soc_dapm_new_widgets()
In reply to Lars-Peter ClausenQuoted 4 lines · Lars-Peter Clausen
snd_soc_dapm_new_widgets()works on the ASoC card as a whole not on a specific DAPM context. The DAPM context that is passed as the parameter is only used to look up the pointer to the card. This patch updates the signature ofsnd_soc_dapm_new_widgets()to take the card directly.
Applied, thanks.
Mark Brown
maintainerRe: [PATCH 3/8] ASoC: tlv320aic32x4: Convert table based control and DAPM setup
In reply to Lars-Peter ClausenQuoted 7 lines · Lars-Peter Clausen
Quoted 2 lines · Mark Brown
Please don't submit a bunch of unrelated patches as a series, submit them separately.
The last patch in the series depends on all the other patches in this series (maybe except for the mark dirty fix).
Yes, it was mainly the mark_dirty change which shouldn't have any overlap.