[alsa-devel] [PATCH V4 2/3] ASoC: fsl_asrc: replace the process_option table with function
Nicolin Chen
nicoleotsuka at gmail.com
Fri Apr 19 20:22:42 CEST 2019
On Fri, Apr 19, 2019 at 10:23:53AM +0000, S.j. Wang wrote:
> @@ -289,6 +318,12 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair)
> return -EINVAL;
> }
>
> + ret = fsl_asrc_sel_proc(inrate, outrate, &pre_proc, &post_proc);
Since the function always return 0, I am thinking of treating
this function as a lookup function, and then moving this call
right before the register settings -- as we have already made
sure that both inrate and outrate are supported.
> + if (ret) {
> + pair_err("No supported pre-processing options\n");
> + return ret;
> + }
And probably no longer need this error-out. If there's a new
limitation related to this function, I believe we can add it
to the rate validation section as we are doing now -- better
to have rate validation code at one place.
> @@ -380,8 +415,8 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair)
> /* Apply configurations for pre- and post-processing */
Here:
- /* Apply configurations for pre- and post-processing */
+ /* Select and apply configurations for pre- and post-processing */
+ fsl_asrc_sel_proc(inrate, outrate, &pre_proc, &post_proc);
> regmap_update_bits(asrc_priv->regmap, REG_ASRCFG,
> ASRCFG_PREMODi_MASK(index) | ASRCFG_POSTMODi_MASK(index),
> - ASRCFG_PREMOD(index, process_option[in][out][0]) |
> - ASRCFG_POSTMOD(index, process_option[in][out][1]));
> + ASRCFG_PREMOD(index, pre_proc) |
> + ASRCFG_POSTMOD(index, post_proc));
More information about the Alsa-devel
mailing list