Re: [PATCH V4 2/3] ASoC: fsl_asrc: replace the process_option table with function

From: S.j. Wang <hidden>
Date: 2019-04-20 07:21:28
Also in: alsa-devel, lkml

Hi

On Fri, Apr 19, 2019 at 10:23:53AM +0000, S.j. Wang wrote:
quoted
@@ -289,6 +318,12 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair
*pair)
quoted
              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.
Ok.
quoted
+     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.
Ok.
quoted
@@ -380,8 +415,8 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair
*pair)
quoted
      /* 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);
quoted
      regmap_update_bits(asrc_priv->regmap, REG_ASRCFG,
                         ASRCFG_PREMODi_MASK(index) |
ASRCFG_POSTMODi_MASK(index),
quoted
-                        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));
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help