[alsa-devel] [PATCH 2/2] ASoC: adau17x1: Do not reload dsp-fw if samplerate has not changed

Lars-Peter Clausen lars at metafoo.de
Thu Apr 5 17:33:34 CEST 2018


On 04/03/2018 10:05 AM, Robert Rosengren wrote:
> From: Danny Smith <dannys at axis.com>
> 
> Reloading fw causes an audiable popping sound, we can avoid this
> by not reloading if the samplerate is the same as before.
> 

Seems like a sensible idea thanks.

> Signed-off-by: Danny Smith <dannys at axis.com>
> ---
>  sound/soc/codecs/adau17x1.c | 39 ++++++++++++++++++++++++---------------
>  1 file changed, 24 insertions(+), 15 deletions(-)
> 
> diff --git a/sound/soc/codecs/adau17x1.c b/sound/soc/codecs/adau17x1.c
> index 5636b9522462..3c28b7191ecd 100644
> --- a/sound/soc/codecs/adau17x1.c
> +++ b/sound/soc/codecs/adau17x1.c
> @@ -840,25 +840,34 @@ int adau17x1_setup_firmware(struct adau *adau, unsigned int rate)
>  	int ret;
>  	int dspsr, dsp_run;
>  
> -	ret = regmap_read(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, &dspsr);
> -	if (ret)
> -		return ret;
> +	/* Check if sample rate is the same as before. If it is there is no
> +	 * point in performing the below steps as the call to
> +	 * sigmadsp_setup(...) will return directly when it finds the sample
> +	 * rate to be the same as before. By checking this we can prevent an
> +	 * audiable popping noise which occours when toggling DSP_RUN.
> +	 */
> +	if (adau->sigmadsp->current_samplerate != rate) {

I think in order to avoid all that re-indention you could just

	if (adau->sigmadsp->current_samplerate == rate)
		return 0;

[...]


More information about the Alsa-devel mailing list