On 04/03/2018 10:05 AM, Robert Rosengren wrote: > From: Danny Smith <dannys@xxxxxxxx> > > 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@xxxxxxxx> > --- > 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; [...] _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel