Re: [PATCH] ASoC: fsl-asoc-card: Remove fsl_asoc_card_set_bias_level function

From: Shengjiu Wang
Date: Mon Jul 27 2020 - 02:33:43 EST


On Mon, Jul 27, 2020 at 8:58 AM Nicolin Chen <nicoleotsuka@xxxxxxxxx> wrote:
>
> On Sun, Jul 26, 2020 at 07:20:17PM +0800, Shengjiu Wang wrote:
> > With this case:
> > aplay -Dhw:x 16khz.wav 24khz.wav
> > There is sound distortion for 24khz.wav. The reason is that setting
> > PLL of WM8962 with set_bias_level function, the bias level is not
> > changed when 24khz.wav is played, then the PLL won't be reset, the
> > clock is not correct, so distortion happens.
> >
> > The resolution of this issue is to remove fsl_asoc_card_set_bias_level.
> > Move PLL configuration to hw_params and hw_free.
>
> Hmm...using set_bias_level() instead of hw_params/hw_free() was
> strongly suggested by Mark when I got imx-wm8962 machine driver
> upstream. So we will need his input here, although I personally
> don't have a problem with it...
>
> > After removing fsl_asoc_card_set_bias_level, also test WM8960 case,
> > it can work.
> >
> > Fixes: 708b4351f08c ("ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support")
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@xxxxxxx>
> > ---
> > sound/soc/fsl/fsl-asoc-card.c | 149 +++++++++++++++-------------------
> > 1 file changed, 66 insertions(+), 83 deletions(-)
> >
> > diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
> > index 4848ba61d083..0517dbb3e908 100644
> > --- a/sound/soc/fsl/fsl-asoc-card.c
> > +++ b/sound/soc/fsl/fsl-asoc-card.c
> > @@ -73,6 +73,7 @@ struct cpu_priv {
> > * @codec_priv: CODEC private data
> > * @cpu_priv: CPU private data
> > * @card: ASoC card structure
> > + * @is_stream_in_use: flags for release resource in hw_free
>
> Would love to see something shorter... Could we reuse similar
> one below, borrowing from fsl_ssi driver?
>
> * @streams: Mask of current active streams: BIT(TX) and BIT(RX)
>
> > static int fsl_asoc_card_audmux_init(struct device_node *np,
> > struct fsl_asoc_card_priv *priv)
> > {
> > @@ -611,7 +600,6 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
> > /* Diversify the card configurations */
> > if (of_device_is_compatible(np, "fsl,imx-audio-cs42888")) {
> > codec_dai_name = "cs42888";
> > - priv->card.set_bias_level = NULL;
>
> Can check if set_bias_level is still being used with this change.

Do you mean to keep this line:
priv->card.set_bias_level = NULL; ?

best regards
wang shengjiu