Re: [PATCH V3 1/2] ASoC: fsl_asrc: replace the process_option table with function

From: S.j. Wang
Date: Wed Apr 17 2019 - 22:37:10 EST


Hi

>
> Hi Shengjiu,
>
> This looks better. Just a couple of more small comments inline.
>
> On Wed, Apr 17, 2019 at 09:06:18AM +0000, S.j. Wang wrote:
>
> > +static int fsl_asrc_sel_proc(int inrate, int outrate, int *pre_proc,
> > + int *post_proc)
>
> Just a nit: it looks better by grouping them two-two.
>
> static int fsl_asrc_sel_proc(int inrate, int outrate,
> int *pre_proc, int *post_proc)
>
> > + /* Condition for selection of post-processing */
> > + post_proc_cond2 = (inrate * 15 > outrate * 16 && outrate < 56000) ||
> > + (inrate > 56000 && outrate < 56000);
>
> Could align the indentation:
> post_proc_cond2 = (inrate * 15 > outrate * 16 && outrate < 56000) ||
> (inrate > 56000 && outrate < 56000);
>
> Here:
> > + /* Does not support cases: Tsout > 8.125 * Tsin */
> > + if (inrate * 8 > 65 * outrate)
> > + return -EINVAL;
> And here:
> > + ret = fsl_asrc_sel_proc(inrate, outrate, &pre_proc, &post_proc);
> > + if (ret) {
> > + pair_err("No supported pre-processing options\n");
> > + return ret;
> > + }
>
> Instead of a general message, I was thinking of a more specific one by
> telling users that the ratio between the two rates isn't supported --
> something similar to what I suggested previously:
>
> pair_err("Does not support %d (input) > 8.125 * %d (output)\n",
> outrate, inrate);
>
In fsl_asrc_sel_proc, we can't call the pair_err for there is no
struct fsl_asrc_pair *pair in the argument. Do you think we need to
add this argument?

> Thanks
> Nicolin