From: Arnaud Pouliquen <arnaud.pouliquen@st.com>
To: alsa-devel@alsa-project.org
Cc: Takashi Iwai <tiwai@suse.de>,
lgirdwood@gmail.com, Takashi Sakamoto <o-takashi@sakamocchi.jp>,
Vinod Koul <vinod.koul@intel.com>,
broonie@kernel.org,
Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Subject: [RFC v2 2/3] ASoC: sti: bind pcm controls to pcm device.
Date: Tue, 22 Nov 2016 11:53:15 +0100 [thread overview]
Message-ID: <1479811996-2238-3-git-send-email-arnaud.pouliquen@st.com> (raw)
In-Reply-To: <1479811996-2238-1-git-send-email-arnaud.pouliquen@st.com>
Move PCM control list in DAI driver struct, to
bind PCM control to PCM device created during DAI linking.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
---
sound/soc/sti/sti_uniperif.c | 33 ++++-----------------------------
1 file changed, 4 insertions(+), 29 deletions(-)
diff --git a/sound/soc/sti/sti_uniperif.c b/sound/soc/sti/sti_uniperif.c
index 98eb205..cf42982 100644
--- a/sound/soc/sti/sti_uniperif.c
+++ b/sound/soc/sti/sti_uniperif.c
@@ -248,34 +248,6 @@ int sti_uniperiph_get_tdm_word_pos(struct uniperif *uni,
}
/*
- * sti_uniperiph_dai_create_ctrl
- * This function is used to create Ctrl associated to DAI but also pcm device.
- * Request is done by front end to associate ctrl with pcm device id
- */
-static int sti_uniperiph_dai_create_ctrl(struct snd_soc_dai *dai)
-{
- struct sti_uniperiph_data *priv = snd_soc_dai_get_drvdata(dai);
- struct uniperif *uni = priv->dai_data.uni;
- struct snd_kcontrol_new *ctrl;
- int i;
-
- if (!uni->num_ctrls)
- return 0;
-
- for (i = 0; i < uni->num_ctrls; i++) {
- /*
- * Several Control can have same name. Controls are indexed on
- * Uniperipheral instance ID
- */
- ctrl = &uni->snd_ctrls[i];
- ctrl->index = uni->id;
- ctrl->device = uni->id;
- }
-
- return snd_soc_add_dai_controls(dai, uni->snd_ctrls, uni->num_ctrls);
-}
-
-/*
* DAI
*/
int sti_uniperiph_dai_hw_params(struct snd_pcm_substream *substream,
@@ -365,7 +337,7 @@ static int sti_uniperiph_dai_probe(struct snd_soc_dai *dai)
dai_data->dma_data.addr = dai_data->uni->fifo_phys_address;
dai_data->dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
- return sti_uniperiph_dai_create_ctrl(dai);
+ return 0;
}
static const struct snd_soc_dai_driver sti_uniperiph_dai_template = {
@@ -487,6 +459,9 @@ static int sti_uniperiph_probe(struct platform_device *pdev)
ret = sti_uniperiph_cpu_dai_of(node, priv);
+ priv->dai->pcm_controls = priv->dai_data.uni->snd_ctrls;
+ priv->dai->num_pcm_controls = priv->dai_data.uni->num_ctrls;
+
dev_set_drvdata(&pdev->dev, priv);
ret = devm_snd_soc_register_component(&pdev->dev,
--
1.9.1
next prev parent reply other threads:[~2016-11-22 10:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-22 10:53 [RFC v2 0/3] ALSA controls management using index/device/sub-devices fields Arnaud Pouliquen
2016-11-22 10:53 ` [RFC v2 1/3] ASoC: core: allow DAI PCM controls bound to PCM device Arnaud Pouliquen
2016-11-24 4:55 ` Vinod Koul
2016-11-24 5:14 ` Takashi Sakamoto
2016-11-24 9:52 ` Arnaud Pouliquen
2016-11-22 10:53 ` Arnaud Pouliquen [this message]
2016-11-22 10:53 ` [RFC v2 3/3] ASoC: hdmi-codec: Example of PCM control bound to PCM device for multi HDMI DAIs Arnaud Pouliquen
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=1479811996-2238-3-git-send-email-arnaud.pouliquen@st.com \
--to=arnaud.pouliquen@st.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.wolfsonmicro.com \
--cc=lgirdwood@gmail.com \
--cc=o-takashi@sakamocchi.jp \
--cc=tiwai@suse.de \
--cc=vinod.koul@intel.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).