alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] ASoC: dapm/pins: handle component prefix
@ 2021-02-08 23:40 Pierre-Louis Bossart
  2021-02-08 23:40 ` [RFC PATCH 1/2] ASoC: dapm: use component prefix when checking widget names Pierre-Louis Bossart
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pierre-Louis Bossart @ 2021-02-08 23:40 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Pierre-Louis Bossart

SoundWire machine drivers make a heavy use of component prefixes to
uniquify control names. This however results in errors when looking
for widgets or pins. This patchset suggests two solutions but feedback
or suggestions on how to take the prefix into account would be
welcome.

Bard Liao (1):
  ASoC: Intel: boards: max98373: get dapm from cpu_dai

Shuming Fan (1):
  ASoC: dapm: use component prefix when checking widget names

 sound/soc/intel/boards/sof_maxim_common.c |  5 +++--
 sound/soc/soc-dapm.c                      | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC PATCH 1/2] ASoC: dapm: use component prefix when checking widget names
  2021-02-08 23:40 [RFC PATCH 0/2] ASoC: dapm/pins: handle component prefix Pierre-Louis Bossart
@ 2021-02-08 23:40 ` Pierre-Louis Bossart
  2021-02-08 23:40 ` [RFC PATCH 2/2] ASoC: Intel: boards: max98373: get dapm from cpu_dai Pierre-Louis Bossart
  2021-02-10 20:11 ` [RFC PATCH 0/2] ASoC: dapm/pins: handle component prefix Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Pierre-Louis Bossart @ 2021-02-08 23:40 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, Shuming Fan, broonie, Pierre-Louis Bossart, Rander Wang

From: Shuming Fan <shumingf@realtek.com>

On a TigerLake SoundWire platform, we see these warnings:

[   27.360086] rt5682 sdw:0:25d:5682:0: ASoC: DAPM unknown pin MICBIAS
[   27.360092] rt5682 sdw:0:25d:5682:0: ASoC: DAPM unknown pin Vref2

This is root-caused to the addition of a component prefix in the
machine driver. The tests in soc-dapm should account for a prefix
instead of reporting an invalid issue.

Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Shuming Fan <shumingf@realtek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/soc-dapm.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 2b75d0139e47..b005f9eadd71 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2528,9 +2528,20 @@ static struct snd_soc_dapm_widget *dapm_find_widget(
 {
 	struct snd_soc_dapm_widget *w;
 	struct snd_soc_dapm_widget *fallback = NULL;
+	char prefixed_pin[80];
+	const char *pin_name;
+	const char *prefix = soc_dapm_prefix(dapm);
+
+	if (prefix) {
+		snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s",
+			 prefix, pin);
+		pin_name = prefixed_pin;
+	} else {
+		pin_name = pin;
+	}
 
 	for_each_card_widgets(dapm->card, w) {
-		if (!strcmp(w->name, pin)) {
+		if (!strcmp(w->name, pin_name)) {
 			if (w->dapm == dapm)
 				return w;
 			else
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFC PATCH 2/2] ASoC: Intel: boards: max98373: get dapm from cpu_dai
  2021-02-08 23:40 [RFC PATCH 0/2] ASoC: dapm/pins: handle component prefix Pierre-Louis Bossart
  2021-02-08 23:40 ` [RFC PATCH 1/2] ASoC: dapm: use component prefix when checking widget names Pierre-Louis Bossart
@ 2021-02-08 23:40 ` Pierre-Louis Bossart
  2021-02-10 20:11 ` [RFC PATCH 0/2] ASoC: dapm/pins: handle component prefix Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Pierre-Louis Bossart @ 2021-02-08 23:40 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Bard Liao, Pierre-Louis Bossart

From: Bard Liao <yung-chuan.liao@linux.intel.com>

There is a prefix on max98373 codec, and the prefix will be added to
the pin name However, there is no prefix on the "Right Spk" and "Left
Spk" widgets.

To avoid getting a redundant prefix, we should get dapm from cpu_dai
component.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/sof_maxim_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/boards/sof_maxim_common.c b/sound/soc/intel/boards/sof_maxim_common.c
index c2a9757181fe..437d20562753 100644
--- a/sound/soc/intel/boards/sof_maxim_common.c
+++ b/sound/soc/intel/boards/sof_maxim_common.c
@@ -63,6 +63,7 @@ int max98373_trigger(struct snd_pcm_substream *substream, int cmd)
 {
 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
 	struct snd_soc_dai *codec_dai;
+	struct snd_soc_dai *cpu_dai;
 	int j;
 	int ret = 0;
 
@@ -70,10 +71,10 @@ int max98373_trigger(struct snd_pcm_substream *substream, int cmd)
 	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
 		return 0;
 
+	cpu_dai = asoc_rtd_to_cpu(rtd, 0);
 	for_each_rtd_codec_dais(rtd, j, codec_dai) {
-		struct snd_soc_component *component = codec_dai->component;
 		struct snd_soc_dapm_context *dapm =
-				snd_soc_component_get_dapm(component);
+				snd_soc_component_get_dapm(cpu_dai->component);
 		char pin_name[MAX_98373_PIN_NAME];
 
 		snprintf(pin_name, ARRAY_SIZE(pin_name), "%s Spk",
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 0/2] ASoC: dapm/pins: handle component prefix
  2021-02-08 23:40 [RFC PATCH 0/2] ASoC: dapm/pins: handle component prefix Pierre-Louis Bossart
  2021-02-08 23:40 ` [RFC PATCH 1/2] ASoC: dapm: use component prefix when checking widget names Pierre-Louis Bossart
  2021-02-08 23:40 ` [RFC PATCH 2/2] ASoC: Intel: boards: max98373: get dapm from cpu_dai Pierre-Louis Bossart
@ 2021-02-10 20:11 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-02-10 20:11 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: tiwai

On Mon, 8 Feb 2021 17:40:41 -0600, Pierre-Louis Bossart wrote:
> SoundWire machine drivers make a heavy use of component prefixes to
> uniquify control names. This however results in errors when looking
> for widgets or pins. This patchset suggests two solutions but feedback
> or suggestions on how to take the prefix into account would be
> welcome.
> 
> Bard Liao (1):
>   ASoC: Intel: boards: max98373: get dapm from cpu_dai
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: dapm: use component prefix when checking widget names
      commit: ae4fc532244b3bb4d86c397418d980b0c6be1dfd
[2/2] ASoC: Intel: boards: max98373: get dapm from cpu_dai
      commit: 1183c350011a6f6b551c200b9206bf1808c22a4c

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-10 20:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 23:40 [RFC PATCH 0/2] ASoC: dapm/pins: handle component prefix Pierre-Louis Bossart
2021-02-08 23:40 ` [RFC PATCH 1/2] ASoC: dapm: use component prefix when checking widget names Pierre-Louis Bossart
2021-02-08 23:40 ` [RFC PATCH 2/2] ASoC: Intel: boards: max98373: get dapm from cpu_dai Pierre-Louis Bossart
2021-02-10 20:11 ` [RFC PATCH 0/2] ASoC: dapm/pins: handle component prefix Mark Brown

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).