diff mbox series

[12/13] ASoC: cs35l34: drop useless rate contraint

Message ID 20240905-alsa-12-24-128-v1-12-8371948d3921@baylibre.com
State Accepted
Commit 7bc09f7eb5e1f09b91b8edcf492e50bfda54080e
Headers show
Series ALSA: update sample rate definitions | expand

Commit Message

Jerome Brunet Sept. 5, 2024, 2:13 p.m. UTC
The cs35l34 adds a useless rate constraint on startup.
It does not set SNDRV_PCM_RATE_KNOT and the rates set are already a subset
of the ones provided in the constraint list, so it is a no-op.

>From the rest of the code, it is likely HW supports more than the 32, 44.1
and 48kHz listed in CS35L34_RATES but there is no way to know for sure
without proper documentation.

Keep the driver as it is for now and just drop the useless constraint.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 sound/soc/codecs/cs35l34.c | 21 ---------------------
 1 file changed, 21 deletions(-)

Comments

Charles Keepax Sept. 9, 2024, 4:14 p.m. UTC | #1
On Thu, Sep 05, 2024 at 04:13:03PM +0200, Jerome Brunet wrote:
> The cs35l34 adds a useless rate constraint on startup.
> It does not set SNDRV_PCM_RATE_KNOT and the rates set are already a subset
> of the ones provided in the constraint list, so it is a no-op.
> 
> >From the rest of the code, it is likely HW supports more than the 32, 44.1
> and 48kHz listed in CS35L34_RATES but there is no way to know for sure
> without proper documentation.
> 
> Keep the driver as it is for now and just drop the useless constraint.
> 
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
> ---

Yeah according to the datasheet it should support all the rates
listed in the cs35l34_src_rates list. But given the weird way
that CS35L34_RATES is implemented I think you are right best to
leave it as it is for now, incase there was a reason. Perhaps if
I find some time I might see if I have one in a draw somewhere in
the future.

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles
>  sound/soc/codecs/cs35l34.c | 21 ---------------------
>  1 file changed, 21 deletions(-)
> 
> diff --git a/sound/soc/codecs/cs35l34.c b/sound/soc/codecs/cs35l34.c
> index e63a518e3b8e..287b27476a10 100644
> --- a/sound/soc/codecs/cs35l34.c
> +++ b/sound/soc/codecs/cs35l34.c
> @@ -562,26 +562,6 @@ static int cs35l34_pcm_hw_params(struct snd_pcm_substream *substream,
>  	return ret;
>  }
>  
> -static const unsigned int cs35l34_src_rates[] = {
> -	8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000
> -};
> -
> -
> -static const struct snd_pcm_hw_constraint_list cs35l34_constraints = {
> -	.count  = ARRAY_SIZE(cs35l34_src_rates),
> -	.list   = cs35l34_src_rates,
> -};
> -
> -static int cs35l34_pcm_startup(struct snd_pcm_substream *substream,
> -			       struct snd_soc_dai *dai)
> -{
> -
> -	snd_pcm_hw_constraint_list(substream->runtime, 0,
> -				SNDRV_PCM_HW_PARAM_RATE, &cs35l34_constraints);
> -	return 0;
> -}
> -
> -
>  static int cs35l34_set_tristate(struct snd_soc_dai *dai, int tristate)
>  {
>  
> @@ -639,7 +619,6 @@ static int cs35l34_dai_set_sysclk(struct snd_soc_dai *dai,
>  }
>  
>  static const struct snd_soc_dai_ops cs35l34_ops = {
> -	.startup = cs35l34_pcm_startup,
>  	.set_tristate = cs35l34_set_tristate,
>  	.set_fmt = cs35l34_set_dai_fmt,
>  	.hw_params = cs35l34_pcm_hw_params,
> 
> -- 
> 2.45.2
>
diff mbox series

Patch

diff --git a/sound/soc/codecs/cs35l34.c b/sound/soc/codecs/cs35l34.c
index e63a518e3b8e..287b27476a10 100644
--- a/sound/soc/codecs/cs35l34.c
+++ b/sound/soc/codecs/cs35l34.c
@@ -562,26 +562,6 @@  static int cs35l34_pcm_hw_params(struct snd_pcm_substream *substream,
 	return ret;
 }
 
-static const unsigned int cs35l34_src_rates[] = {
-	8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000
-};
-
-
-static const struct snd_pcm_hw_constraint_list cs35l34_constraints = {
-	.count  = ARRAY_SIZE(cs35l34_src_rates),
-	.list   = cs35l34_src_rates,
-};
-
-static int cs35l34_pcm_startup(struct snd_pcm_substream *substream,
-			       struct snd_soc_dai *dai)
-{
-
-	snd_pcm_hw_constraint_list(substream->runtime, 0,
-				SNDRV_PCM_HW_PARAM_RATE, &cs35l34_constraints);
-	return 0;
-}
-
-
 static int cs35l34_set_tristate(struct snd_soc_dai *dai, int tristate)
 {
 
@@ -639,7 +619,6 @@  static int cs35l34_dai_set_sysclk(struct snd_soc_dai *dai,
 }
 
 static const struct snd_soc_dai_ops cs35l34_ops = {
-	.startup = cs35l34_pcm_startup,
 	.set_tristate = cs35l34_set_tristate,
 	.set_fmt = cs35l34_set_dai_fmt,
 	.hw_params = cs35l34_pcm_hw_params,