linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: wm8524: remove rate constraint for FE-BE case
@ 2022-04-12  9:13 Shengjiu Wang
  2022-04-12 12:39 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Shengjiu Wang @ 2022-04-12  9:13 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, patches, alsa-devel
  Cc: linux-kernel, shengjiu.wang

The constraint is propagate to Front End Bitstream
for Front End and Back End share same snd_soc_pcm_runtime.

The constraint is not needed for Back End Bitstream
when there is be_hw_params_fixup() defined.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Tested-by: Fabio Estevam <festevam@denx.de>
---
 sound/soc/codecs/wm8524.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm8524.c b/sound/soc/codecs/wm8524.c
index 81f858f6bd67..442a59857875 100644
--- a/sound/soc/codecs/wm8524.c
+++ b/sound/soc/codecs/wm8524.c
@@ -61,6 +61,7 @@ static int wm8524_startup(struct snd_pcm_substream *substream,
 {
 	struct snd_soc_component *component = dai->component;
 	struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 
 	/* The set of sample rates that can be supported depends on the
 	 * MCLK supplied to the CODEC - enforce this.
@@ -71,9 +72,10 @@ static int wm8524_startup(struct snd_pcm_substream *substream,
 		return -EINVAL;
 	}
 
-	snd_pcm_hw_constraint_list(substream->runtime, 0,
-				   SNDRV_PCM_HW_PARAM_RATE,
-				   &wm8524->rate_constraint);
+	if (!rtd->dai_link->be_hw_params_fixup)
+		snd_pcm_hw_constraint_list(substream->runtime, 0,
+					   SNDRV_PCM_HW_PARAM_RATE,
+					   &wm8524->rate_constraint);
 
 	gpiod_set_value_cansleep(wm8524->mute, 1);
 
-- 
2.17.1


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

* Re: [PATCH] ASoC: wm8524: remove rate constraint for FE-BE case
  2022-04-12  9:13 [PATCH] ASoC: wm8524: remove rate constraint for FE-BE case Shengjiu Wang
@ 2022-04-12 12:39 ` Mark Brown
       [not found]   ` <CAA+D8AP=ydd6f9su=JR1q9NVWTg2tHoTF1OGHQGmFN+gZhAcHQ@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2022-04-12 12:39 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: lgirdwood, perex, tiwai, patches, alsa-devel, linux-kernel,
	shengjiu.wang

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

On Tue, Apr 12, 2022 at 05:13:46PM +0800, Shengjiu Wang wrote:
> The constraint is propagate to Front End Bitstream
> for Front End and Back End share same snd_soc_pcm_runtime.

> The constraint is not needed for Back End Bitstream
> when there is be_hw_params_fixup() defined.

> -	snd_pcm_hw_constraint_list(substream->runtime, 0,
> -				   SNDRV_PCM_HW_PARAM_RATE,
> -				   &wm8524->rate_constraint);
> +	if (!rtd->dai_link->be_hw_params_fixup)
> +		snd_pcm_hw_constraint_list(substream->runtime, 0,
> +					   SNDRV_PCM_HW_PARAM_RATE,
> +					   &wm8524->rate_constraint);

This applies in general to constraints set by the CODEC, it's not
something that should be fixed at the driver level.  Peering into the
runtime to see if DPCM is doing anything isn't a great solution here,
nor is having to open code it into the driver.  I already had it in the
back of my head to generalise the set constraints based on sysclk
pattern into the core, that might be productive here.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ASoC: wm8524: remove rate constraint for FE-BE case
       [not found]   ` <CAA+D8AP=ydd6f9su=JR1q9NVWTg2tHoTF1OGHQGmFN+gZhAcHQ@mail.gmail.com>
@ 2022-04-12 13:22     ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2022-04-12 13:22 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: Shengjiu Wang, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	patches, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

On Tue, Apr 12, 2022 at 09:18:16PM +0800, Shengjiu Wang wrote:
> On Tue, Apr 12, 2022 at 8:39 PM Mark Brown <broonie@kernel.org> wrote:

> > nor is having to open code it into the driver.  I already had it in the
> > back of my head to generalise the set constraints based on sysclk
> > pattern into the core, that might be productive here.

> I also hesitate to add this in the codec driver. I agree that it is better
> to be put in the core.

> When will you have a patch for this?

Dunno, no fixed plans - it partly depends on how gummed up other stuff
I'm doing is waiting for review.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2022-04-12 13:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12  9:13 [PATCH] ASoC: wm8524: remove rate constraint for FE-BE case Shengjiu Wang
2022-04-12 12:39 ` Mark Brown
     [not found]   ` <CAA+D8AP=ydd6f9su=JR1q9NVWTg2tHoTF1OGHQGmFN+gZhAcHQ@mail.gmail.com>
2022-04-12 13:22     ` 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).