[alsa-devel] [PATCH 0/3] ASoC: dapm: add PGA kcontrol, dai_link enhancement &
This adds few small patches in DAPM which we require for Intel DSPs Firsts adds support for having kcontrol on PGAs. This is required for modules which are modelled as PGA but cna be user configurable. Next is new callback on snd_soc_dai_link_events(). Lastly a macro to return widget associated with a kcontrol
Jeeja KP (2): ASoC: dapm: Add kcontrol support for PGAs ASoC: dapm: Add startup & shutdown for dai_links
Mythri P K (1): ASoC: dapm: Add snd_soc_dapm_kcontrol_widget()
include/sound/soc-dapm.h | 3 +++ sound/soc/soc-dapm.c | 64 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 60 insertions(+), 7 deletions(-)
From: Jeeja KP jeeja.kp@intel.com
For DSPs we can define processing blocks as DAPM PGA widgets. Some of these proceesing blocks can be configured by usermode like EQ etc. So we need to add support of kcontrol for PGA widgets.
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Mythri P K mythri.p.k@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/soc-dapm.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index ff8bda471b25..746800380eb7 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -779,8 +779,8 @@ static int dapm_is_shared_kcontrol(struct snd_soc_dapm_context *dapm, * Determine if a kcontrol is shared. If it is, look it up. If it isn't, * create it. Either way, add the widget into the control's widget list */ -static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, - int kci) +static int dapm_create_or_share_mixmuxpga_kcontrol( + struct snd_soc_dapm_widget *w, int kci) { struct snd_soc_dapm_context *dapm = w->dapm; struct snd_card *card = dapm->card->snd_card; @@ -822,6 +822,10 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, wname_in_long_name = true; kcname_in_long_name = false; break; + case snd_soc_dapm_pga: + wname_in_long_name = true; + kcname_in_long_name = true; + break; default: return -EINVAL; } @@ -899,7 +903,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w) continue;
if (!w->kcontrols[i]) { - ret = dapm_create_or_share_mixmux_kcontrol(w, i); + ret = dapm_create_or_share_mixmuxpga_kcontrol(w, i); if (ret < 0) return ret; } @@ -952,7 +956,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w) return -EINVAL; }
- ret = dapm_create_or_share_mixmux_kcontrol(w, 0); + ret = dapm_create_or_share_mixmuxpga_kcontrol(w, 0); if (ret < 0) return ret;
@@ -967,9 +971,13 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w) /* create new dapm volume control */ static int dapm_new_pga(struct snd_soc_dapm_widget *w) { - if (w->num_kcontrols) - dev_err(w->dapm->dev, - "ASoC: PGA controls not supported: '%s'\n", w->name); + int i, ret; + + for (i = 0; i < w->num_kcontrols; i++) { + ret = dapm_create_or_share_mixmuxpga_kcontrol(w, i); + if (ret < 0) + return ret; + }
return 0; }
On 10/20/2015 05:38 PM, Vinod Koul wrote:
From: Jeeja KP jeeja.kp@intel.com
For DSPs we can define processing blocks as DAPM PGA widgets. Some of these proceesing blocks can be configured by usermode like EQ etc. So we need to add support of kcontrol for PGA widgets.
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Mythri P K mythri.p.k@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com
This looks ok ...
sound/soc/soc-dapm.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index ff8bda471b25..746800380eb7 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -779,8 +779,8 @@ static int dapm_is_shared_kcontrol(struct snd_soc_dapm_context *dapm,
- Determine if a kcontrol is shared. If it is, look it up. If it isn't,
- create it. Either way, add the widget into the control's widget list
*/ -static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
- int kci)
+static int dapm_create_or_share_mixmuxpga_kcontrol(
... but maybe just call it dapm_create_or_share_kcontrol()
struct snd_soc_dapm_widget *w, int kci)
{ struct snd_soc_dapm_context *dapm = w->dapm; struct snd_card *card = dapm->card->snd_card; @@ -822,6 +822,10 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, wname_in_long_name = true; kcname_in_long_name = false; break;
case snd_soc_dapm_pga:
This should have the same behavior as mixers and switches, just add the case there instead having a different path.
wname_in_long_name = true;
kcname_in_long_name = true;
break; default: return -EINVAL;
On Tue, Oct 20, 2015 at 05:58:46PM +0200, Lars-Peter Clausen wrote:
-static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
- int kci)
+static int dapm_create_or_share_mixmuxpga_kcontrol(
... but maybe just call it dapm_create_or_share_kcontrol()
I don't mind that
struct snd_soc_dapm_widget *w, int kci)
{ struct snd_soc_dapm_context *dapm = w->dapm; struct snd_card *card = dapm->card->snd_card; @@ -822,6 +822,10 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, wname_in_long_name = true; kcname_in_long_name = false; break;
case snd_soc_dapm_pga:
This should have the same behavior as mixers and switches, just add the case there instead having a different path.
Oh yes thanks for pointing out that makese better sense, will update in v2.
From: Jeeja KP jeeja.kp@intel.com
For DAI link events, DSPs would like to get notified for startup and shutdown event as well apart for existing hw_params. This helps managing DSP resource allocation and freeup on these events So add support for startup and shutdown for snd_soc_dai_link_event()
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/soc-dapm.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 746800380eb7..ef8064df2678 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3481,11 +3481,29 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_PRE_PMU: substream.stream = SNDRV_PCM_STREAM_CAPTURE; + if (source->driver->ops && source->driver->ops->startup) { + ret = source->driver->ops->startup(&substream, source); + if (ret < 0) { + dev_err(source->dev, + "ASoC: startup() failed: %d\n", ret); + goto out; + } + source->active++; + } ret = soc_dai_hw_params(&substream, params, source); if (ret < 0) goto out;
substream.stream = SNDRV_PCM_STREAM_PLAYBACK; + if (sink->driver->ops && sink->driver->ops->startup) { + ret = sink->driver->ops->startup(&substream, sink); + if (ret < 0) { + dev_err(sink->dev, + "ASoC: startup() failed: %d\n", ret); + goto out; + } + sink->active++; + } ret = soc_dai_hw_params(&substream, params, sink); if (ret < 0) goto out; @@ -3505,6 +3523,18 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, if (ret != 0 && ret != -ENOTSUPP) dev_warn(sink->dev, "ASoC: Failed to mute: %d\n", ret); ret = 0; + + source->active--; + if (source->driver->ops && source->driver->ops->shutdown) { + substream.stream = SNDRV_PCM_STREAM_CAPTURE; + source->driver->ops->shutdown(&substream, source); + } + + sink->active--; + if (sink->driver->ops && sink->driver->ops->shutdown) { + substream.stream = SNDRV_PCM_STREAM_PLAYBACK; + sink->driver->ops->shutdown(&substream, sink); + } break;
default:
The patch
ASoC: dapm: Add startup & shutdown for dai_links
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 9b8ef9f6b3fcccc2b6ce4bb59d8ab55b36a8b8f0 Mon Sep 17 00:00:00 2001
From: Jeeja KP jeeja.kp@intel.com Date: Tue, 20 Oct 2015 22:30:07 +0530 Subject: [PATCH] ASoC: dapm: Add startup & shutdown for dai_links
For DAI link events, DSPs would like to get notified for startup and shutdown event as well apart for existing hw_params. This helps managing DSP resource allocation and freeup on these events So add support for startup and shutdown for snd_soc_dai_link_event()
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-dapm.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 9762ac4..a28d6a1 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3478,11 +3478,29 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_PRE_PMU: substream.stream = SNDRV_PCM_STREAM_CAPTURE; + if (source->driver->ops && source->driver->ops->startup) { + ret = source->driver->ops->startup(&substream, source); + if (ret < 0) { + dev_err(source->dev, + "ASoC: startup() failed: %d\n", ret); + goto out; + } + source->active++; + } ret = soc_dai_hw_params(&substream, params, source); if (ret < 0) goto out;
substream.stream = SNDRV_PCM_STREAM_PLAYBACK; + if (sink->driver->ops && sink->driver->ops->startup) { + ret = sink->driver->ops->startup(&substream, sink); + if (ret < 0) { + dev_err(sink->dev, + "ASoC: startup() failed: %d\n", ret); + goto out; + } + sink->active++; + } ret = soc_dai_hw_params(&substream, params, sink); if (ret < 0) goto out; @@ -3502,6 +3520,18 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, if (ret != 0 && ret != -ENOTSUPP) dev_warn(sink->dev, "ASoC: Failed to mute: %d\n", ret); ret = 0; + + source->active--; + if (source->driver->ops && source->driver->ops->shutdown) { + substream.stream = SNDRV_PCM_STREAM_CAPTURE; + source->driver->ops->shutdown(&substream, source); + } + + sink->active--; + if (sink->driver->ops && sink->driver->ops->shutdown) { + substream.stream = SNDRV_PCM_STREAM_PLAYBACK; + sink->driver->ops->shutdown(&substream, sink); + } break;
default:
From: Mythri P K mythri.p.k@intel.com
Given a kcontrol, we may want to access the parent widget and it's associated data. So export function to return it.
Signed-off-by: Mythri P K mythri.p.k@intel.com Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- include/sound/soc-dapm.h | 3 +++ sound/soc/soc-dapm.c | 12 ++++++++++++ 2 files changed, 15 insertions(+)
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 5abba037d245..7855cfe46b69 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -451,6 +451,9 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( struct snd_kcontrol *kcontrol);
+struct snd_soc_dapm_widget *snd_soc_dapm_kcontrol_widget( + struct snd_kcontrol *kcontrol); + int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index ef8064df2678..d54ee252ba74 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -509,6 +509,18 @@ static bool dapm_kcontrol_set_value(const struct snd_kcontrol *kcontrol, }
/** + * snd_soc_dapm_kcontrol_widget() - Returns the widget associated to a + * kcontrol + * @kcontrol: The kcontrol + */ +struct snd_soc_dapm_widget *snd_soc_dapm_kcontrol_widget( + struct snd_kcontrol *kcontrol) +{ + return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]; +} +EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_widget); + +/** * snd_soc_dapm_kcontrol_dapm() - Returns the dapm context associated to a * kcontrol * @kcontrol: The kcontrol
The patch
ASoC: dapm: Add snd_soc_dapm_kcontrol_widget()
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 93e39a11520c000c9086215460bf27b35b09c724 Mon Sep 17 00:00:00 2001
From: Mythri P K mythri.p.k@intel.com Date: Tue, 20 Oct 2015 22:30:08 +0530 Subject: [PATCH] ASoC: dapm: Add snd_soc_dapm_kcontrol_widget()
Given a kcontrol, we may want to access the parent widget and it's associated data. So export function to return it.
Signed-off-by: Mythri P K mythri.p.k@intel.com Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Mark Brown broonie@kernel.org --- include/sound/soc-dapm.h | 3 +++ sound/soc/soc-dapm.c | 12 ++++++++++++ 2 files changed, 15 insertions(+)
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 5abba03..7855cfe 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -451,6 +451,9 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( struct snd_kcontrol *kcontrol);
+struct snd_soc_dapm_widget *snd_soc_dapm_kcontrol_widget( + struct snd_kcontrol *kcontrol); + int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index a28d6a1..38281c2 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -509,6 +509,18 @@ static bool dapm_kcontrol_set_value(const struct snd_kcontrol *kcontrol, }
/** + * snd_soc_dapm_kcontrol_widget() - Returns the widget associated to a + * kcontrol + * @kcontrol: The kcontrol + */ +struct snd_soc_dapm_widget *snd_soc_dapm_kcontrol_widget( + struct snd_kcontrol *kcontrol) +{ + return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]; +} +EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_widget); + +/** * snd_soc_dapm_kcontrol_dapm() - Returns the dapm context associated to a * kcontrol * @kcontrol: The kcontrol
participants (3)
-
Lars-Peter Clausen
-
Mark Brown
-
Vinod Koul