From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Nikesh Oswal <nikesh@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, tiwai@suse.de,
patches@opensource.wolfsonmicro.com,
linux-kernel@vger.kernel.org, lgirdwood@gmail.com,
broonie@kernel.org
Subject: Re: [PATCH v8] ASoC: dapm: add code to configure dai link parameters
Date: Fri, 16 Jan 2015 14:46:35 +0000 [thread overview]
Message-ID: <20150116144635.GX14516@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1421330832-15449-1-git-send-email-nikesh@opensource.wolfsonmicro.com>
On Thu, Jan 15, 2015 at 02:07:11PM +0000, Nikesh Oswal wrote:
> dai-link params for codec-codec links were fixed. The fixed
> link between codec and another chip which may be another codec,
> baseband, bluetooth codec etc may require run time configuaration
> changes. This change provides an optional alsa control to select
> one of the params from a list of params.
>
> Signed-off-by: Nikesh Oswal <nikesh@opensource.wolfsonmicro.com>
> ---
> include/sound/soc-dapm.h | 3 +
> include/sound/soc.h | 1 +
> sound/soc/soc-core.c | 6 +-
> sound/soc/soc-dapm.c | 155 ++++++++++++++++++++++++++++++++++++++++++++--
> 4 files changed, 157 insertions(+), 8 deletions(-)
>
> diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
> index 5c0a798..a2098e4 100644
> @@ -3299,14 +3363,52 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
> struct snd_soc_dapm_widget *w;
> size_t len;
> char *link_name;
> - int ret;
> + int ret, count;
> + unsigned long private_value;
> + const char **w_param_text;
> + struct soc_enum w_param_enum[] = {
> + SOC_ENUM_SINGLE(0, 0, 0, NULL),
> + };
> + struct snd_kcontrol_new kcontrol_dai_link[] = {
> + SOC_ENUM_EXT(NULL, w_param_enum[0],
> + snd_soc_dapm_dai_link_get,
> + snd_soc_dapm_dai_link_put),
> + };
> + const struct snd_soc_pcm_stream *config = params;
> +
> + w_param_text = devm_kcalloc(card->dev, num_params,
> + sizeof(char *), GFP_KERNEL);
> + if (!w_param_text)
> + return -ENOMEM;
>
> len = strlen(source->name) + strlen(sink->name) + 2;
> link_name = devm_kzalloc(card->dev, len, GFP_KERNEL);
> - if (!link_name)
> - return -ENOMEM;
> + if (!link_name) {
> + ret = -ENOMEM;
> + goto outfree_w_param;
> + }
> snprintf(link_name, len, "%s-%s", source->name, sink->name);
>
> + for (count = 0 ; count < num_params; count++) {
> + if (!config->stream_name) {
> + dev_warn(card->dapm.dev,
> + "ASoC: anonymous config %d for dai link %s\n",
> + count, link_name);
The ALSA core doesn't like one of the string in the enum text
links being a NULL pointer so you will want to add some sort of
default text or something in this case.
> + } else {
> + w_param_text[count] = devm_kmemdup(card->dev,
> + config->stream_name,
> + strlen(config->stream_name) + 1,
> + GFP_KERNEL);
> + if (!w_param_text[count]) {
> + ret = -ENOMEM;
> + goto outfree_link_name;
> + }
> + }
> + config++;
> + }
> + w_param_enum[0].items = num_params;
> + w_param_enum[0].texts = w_param_text;
> +
> memset(&template, 0, sizeof(template));
> template.reg = SND_SOC_NOPM;
> template.id = snd_soc_dapm_dai_link;
Thanks,
Charles
WARNING: multiple messages have this Message-ID (diff)
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Nikesh Oswal <nikesh@opensource.wolfsonmicro.com>
Cc: broonie@kernel.org, lgirdwood@gmail.com, tiwai@suse.de,
alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
linux-kernel@vger.kernel.org, perex@perex.cz
Subject: Re: [PATCH v8] ASoC: dapm: add code to configure dai link parameters
Date: Fri, 16 Jan 2015 14:46:35 +0000 [thread overview]
Message-ID: <20150116144635.GX14516@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1421330832-15449-1-git-send-email-nikesh@opensource.wolfsonmicro.com>
On Thu, Jan 15, 2015 at 02:07:11PM +0000, Nikesh Oswal wrote:
> dai-link params for codec-codec links were fixed. The fixed
> link between codec and another chip which may be another codec,
> baseband, bluetooth codec etc may require run time configuaration
> changes. This change provides an optional alsa control to select
> one of the params from a list of params.
>
> Signed-off-by: Nikesh Oswal <nikesh@opensource.wolfsonmicro.com>
> ---
> include/sound/soc-dapm.h | 3 +
> include/sound/soc.h | 1 +
> sound/soc/soc-core.c | 6 +-
> sound/soc/soc-dapm.c | 155 ++++++++++++++++++++++++++++++++++++++++++++--
> 4 files changed, 157 insertions(+), 8 deletions(-)
>
> diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
> index 5c0a798..a2098e4 100644
> @@ -3299,14 +3363,52 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
> struct snd_soc_dapm_widget *w;
> size_t len;
> char *link_name;
> - int ret;
> + int ret, count;
> + unsigned long private_value;
> + const char **w_param_text;
> + struct soc_enum w_param_enum[] = {
> + SOC_ENUM_SINGLE(0, 0, 0, NULL),
> + };
> + struct snd_kcontrol_new kcontrol_dai_link[] = {
> + SOC_ENUM_EXT(NULL, w_param_enum[0],
> + snd_soc_dapm_dai_link_get,
> + snd_soc_dapm_dai_link_put),
> + };
> + const struct snd_soc_pcm_stream *config = params;
> +
> + w_param_text = devm_kcalloc(card->dev, num_params,
> + sizeof(char *), GFP_KERNEL);
> + if (!w_param_text)
> + return -ENOMEM;
>
> len = strlen(source->name) + strlen(sink->name) + 2;
> link_name = devm_kzalloc(card->dev, len, GFP_KERNEL);
> - if (!link_name)
> - return -ENOMEM;
> + if (!link_name) {
> + ret = -ENOMEM;
> + goto outfree_w_param;
> + }
> snprintf(link_name, len, "%s-%s", source->name, sink->name);
>
> + for (count = 0 ; count < num_params; count++) {
> + if (!config->stream_name) {
> + dev_warn(card->dapm.dev,
> + "ASoC: anonymous config %d for dai link %s\n",
> + count, link_name);
The ALSA core doesn't like one of the string in the enum text
links being a NULL pointer so you will want to add some sort of
default text or something in this case.
> + } else {
> + w_param_text[count] = devm_kmemdup(card->dev,
> + config->stream_name,
> + strlen(config->stream_name) + 1,
> + GFP_KERNEL);
> + if (!w_param_text[count]) {
> + ret = -ENOMEM;
> + goto outfree_link_name;
> + }
> + }
> + config++;
> + }
> + w_param_enum[0].items = num_params;
> + w_param_enum[0].texts = w_param_text;
> +
> memset(&template, 0, sizeof(template));
> template.reg = SND_SOC_NOPM;
> template.id = snd_soc_dapm_dai_link;
Thanks,
Charles
next prev parent reply other threads:[~2015-01-16 14:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-15 14:07 [PATCH v8] ASoC: dapm: add code to configure dai link parameters Nikesh Oswal
2015-01-15 14:07 ` Nikesh Oswal
2015-01-16 14:46 ` Charles Keepax [this message]
2015-01-16 14:46 ` Charles Keepax
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=20150116144635.GX14516@opensource.wolfsonmicro.com \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nikesh@opensource.wolfsonmicro.com \
--cc=patches@opensource.wolfsonmicro.com \
--cc=tiwai@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.