From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@ti.com>
Cc: alsa-devel@alsa-project.org, Misael Lopez Cruz <misael.lopez@ti.com>
Subject: [PATCH v3 2/3] ASoC: soc-dapm: API to attach DAPM_SUPPLY to be used for dai
Date: Fri, 26 Aug 2011 16:33:22 +0300 [thread overview]
Message-ID: <1314365603-8947-3-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1314365603-8947-1-git-send-email-peter.ujfalusi@ti.com>
There are cpu dais, which require special ordering during stream
stop (OMAP4's McPDM interface for example) in a system level.
OMAP4 McPDM required to be stopped after the attached codec's
(twl6040) DAC/ADC has been stopped.
This requironment can be solved with a use of DAPM_SUPPLY
widget attached to the codec's ADC/DAC from machine driver.
Provide generic enough API from core which can be used from
other drivers, if needed.
The snd_soc_dapm_attach_dai_supply function can be used to attach
the DAPM_SUPPLY widget to the specified dapm_context.
The resulting widget's private_data will be initialized with
the dai's drvdata.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
include/sound/soc-dapm.h | 5 +++++
sound/soc/soc-dapm.c | 27 +++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index c10d4cc..e540bb2 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -381,6 +381,11 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
const char *pin);
+int snd_soc_dapm_attach_dai_supply(struct snd_soc_dapm_context *dapm,
+ struct snd_soc_dai *dai, char *wname,
+ int (*wevent)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int),
+ unsigned short wflags);
+
/* dapm widget types */
enum snd_soc_dapm_type {
snd_soc_dapm_input = 0, /* input pin */
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 7e15914..8839202 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2776,6 +2776,33 @@ void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm)
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_free);
+/**
+ * snd_soc_dapm_attach_dai_supply - attach supply widget on behalf of a dai
+ * @dapm: DAPM context
+ * @dai: DAI, which requesting the widget
+ * @wname: name of the DAPM_SUPPLY widget
+ * @wevent: event handler callback
+ * @wflags: DAPM event flags
+ *
+ * Creates DAPM_SUPPLY widget on behalf of a dai. The new widget's private_data
+ * will inherit the dai's driver data pointer, which is going to be available
+ * in the event handler.
+ */
+int snd_soc_dapm_attach_dai_supply(struct snd_soc_dapm_context *dapm,
+ struct snd_soc_dai *dai, char *wname,
+ int (*wevent)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int),
+ unsigned short wflags)
+{
+ void *pdata = snd_soc_dai_get_drvdata(dai);
+ struct snd_soc_dapm_widget dai_widget =
+ SND_SOC_DAPM_SUPPLY(wname, SND_SOC_NOPM, 0, 0, wevent, wflags);
+
+ snd_soc_dapm_widget_set_pdata(&dai_widget, pdata);
+
+ return snd_soc_dapm_new_control(dapm, &dai_widget);
+}
+EXPORT_SYMBOL_GPL(snd_soc_dapm_attach_dai_supply);
+
static void soc_dapm_shutdown_codec(struct snd_soc_dapm_context *dapm)
{
struct snd_soc_dapm_widget *w;
--
1.7.6.1
next prev parent reply other threads:[~2011-08-26 13:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-26 13:33 [PATCH v3 0/3] ASoC: omap-mcpdm: New McPDM driver Peter Ujfalusi
2011-08-26 13:33 ` [PATCH v3 1/3] ASoC: DAPM: Add private data pointer for DAPM widget Peter Ujfalusi
2011-08-26 13:33 ` Peter Ujfalusi [this message]
2011-08-26 19:05 ` [PATCH v3 2/3] ASoC: soc-dapm: API to attach DAPM_SUPPLY to be used for dai Mark Brown
2011-08-29 8:22 ` Péter Ujfalusi
2011-08-29 9:16 ` Mark Brown
2011-08-29 11:41 ` Péter Ujfalusi
2011-09-03 6:31 ` Mark Brown
2011-09-06 10:21 ` Péter Ujfalusi
2011-09-06 15:09 ` Mark Brown
2011-08-26 13:33 ` [PATCH v3 3/3] ASoC: omap-mcpdm: Replace legacy driver Peter Ujfalusi
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=1314365603-8947-3-git-send-email-peter.ujfalusi@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lrg@ti.com \
--cc=misael.lopez@ti.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).