From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>
Cc: "Andreas Irestål" <Andreas.Irestal@axis.com>,
alsa-devel@alsa-project.org,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Stephen Warren" <swarren@nvidia.com>,
"Hebbar Gururaja" <gururaja.hebbar@ti.com>
Subject: [PATCH 4/5] ASoC: dapm: Add a update parameter to snd_soc_dapm_{mux, mixer}_update_power
Date: Wed, 24 Jul 2013 15:27:38 +0200 [thread overview]
Message-ID: <1374672459-5202-4-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1374672459-5202-1-git-send-email-lars@metafoo.de>
In order to avoid race conditions the assignment of dapm->update should happen
while card->dapm_mutex is being held. To allow CODEC drivers to run a register
update when using snd_soc_dapm_mux_update_power() or
snd_soc_dapm_mixer_update_power() add a update parameter to these two functions.
The update parameter will be assigned to dapm->update while card->dapm_mutex is
locked.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
include/sound/soc-dapm.h | 7 +++++--
sound/soc/soc-dapm.c | 10 ++++++++--
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 3717ad0..e77c6f5 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -333,6 +333,7 @@ struct snd_soc_dapm_route;
struct snd_soc_dapm_context;
struct regulator;
struct snd_soc_dapm_widget_list;
+struct snd_soc_dapm_update;
int dapm_reg_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event);
@@ -392,9 +393,11 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card);
/* external DAPM widget events */
int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm,
- struct snd_kcontrol *kcontrol, int connect);
+ struct snd_kcontrol *kcontrol, int connect,
+ struct snd_soc_dapm_update *update);
int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm,
- struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e);
+ struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e,
+ struct snd_soc_dapm_update *update);
/* dapm sys fs - used by the core */
int snd_soc_dapm_sys_add(struct device *dev);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index d511217..366daef 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1952,13 +1952,16 @@ static int soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm,
}
int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm,
- struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e)
+ struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e,
+ struct snd_soc_dapm_update *update)
{
struct snd_soc_card *card = dapm->card;
int ret;
mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ dapm->update = update;
ret = soc_dapm_mux_update_power(dapm, kcontrol, mux, e);
+ dapm->update = NULL;
mutex_unlock(&card->dapm_mutex);
if (ret > 0)
soc_dpcm_runtime_update(card);
@@ -1992,13 +1995,16 @@ static int soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm,
}
int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm,
- struct snd_kcontrol *kcontrol, int connect)
+ struct snd_kcontrol *kcontrol, int connect,
+ struct snd_soc_dapm_update *update)
{
struct snd_soc_card *card = dapm->card;
int ret;
mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ dapm->update = update;
ret = soc_dapm_mixer_update_power(dapm, kcontrol, connect);
+ dapm->update = NULL;
mutex_unlock(&card->dapm_mutex);
if (ret > 0)
soc_dpcm_runtime_update(card);
--
1.8.0
next prev parent reply other threads:[~2013-07-24 13:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-24 13:27 [PATCH 1/5] ASoC: dapm: Fix return value of snd_soc_dapm_put_{volsw, enum_virt}() Lars-Peter Clausen
2013-07-24 13:27 ` [PATCH 2/5] ASoC: dapm: Pass snd_soc_card directly to soc_dpcm_runtime_update() Lars-Peter Clausen
2013-07-24 13:27 ` [PATCH 3/5] ASoC: dapm: Run widget updates for shared controls at the same time Lars-Peter Clausen
2013-07-24 13:27 ` Lars-Peter Clausen [this message]
2013-07-24 13:27 ` [PATCH 5/5] ASoC: tlv320aic3x: Use snd_soc_dapm_mixer_update_power Lars-Peter Clausen
2013-07-24 13:56 ` [PATCH 1/5] ASoC: dapm: Fix return value of snd_soc_dapm_put_{volsw, enum_virt}() Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1374672459-5202-4-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=Andreas.Irestal@axis.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=gururaja.hebbar@ti.com \
--cc=lgirdwood@gmail.com \
--cc=swarren@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).