ASoC: 88pm860x: Question about pm860x_set_dai_sysclk implementation
Hi Haojian,
In sound/soc/codecs/88pm860x-codec.c (pm860x_set_dai_sysclk):
When dir != PM860X_CLK_DIR_OUT, current code set pm860x->dir = PM860X_CLK_DIR_IN; and then return -EINVAL. This looks confusion.
Since there is no comment for that, I'm wondering if the return -EINVAL is intentional or not.
Regards,
Axel
Quoted 11 lines · Axel Lin
Hi Haojian,
Insound/soc/codecs/88pm860x-codec.c(pm860x_set_dai_sysclk):
When dir !=PM860X_CLK_DIR_OUT, current code setpm860x->dir=PM860X_CLK_DIR_IN; and then return-EINVAL. This looks confusion.
Since there is no comment for that, I'm wondering if the return-EINVALis intentional or not.Regards,
Axel
Hi Axel,
Since we didn't support slave mode in our solution, I just return -EINVAL for PM860X_CLK_DIR_IN. I'm sorry to add the confused code. Could you help to format a patch to add the comments?
Regards
Haojian
2015-06-29 10:02 GMT+08:00 Haojian Zhuang <[email protected]>:
Quoted 13 lines · Axel Lin
Quoted 11 lines
Hi Haojian,
Insound/soc/codecs/88pm860x-codec.c(pm860x_set_dai_sysclk):
When dir !=PM860X_CLK_DIR_OUT, current code setpm860x->dir=PM860X_CLK_DIR_IN; and then return-EINVAL. This looks confusion.
Since there is no comment for that, I'm wondering if the return-EINVALis intentional or not.Regards,
Axel
Quoted 5 lines
Hi Axel,
Since we didn't support slave mode in our solution, I just return
-EINVALforPM860X_CLK_DIR_IN. I'm sorry to add the confused code. Could you help to format a patch to add the comments?
The main confusion part is current code actually *changes* pm860x->dir setting when return -EINVAL in pm860x_set_dai_sysclk.
(And the pm860x->dir is used in pm860x_pcm_set_dai_fmt.)
so I'm wondering if it make sense to just return -EINVAL without setting pm860x->dir = PM860X_CLK_DIR_IN; in pm860x_set_dai_sysclk.
Quoted 20 lines · Axel Lin
2015-06-29 10:02 GMT+08:00 Haojian Zhuang <[email protected]>:
Quoted 13 lines · Axel Lin
Quoted 11 lines
Hi Haojian,
Insound/soc/codecs/88pm860x-codec.c(pm860x_set_dai_sysclk):
When dir !=PM860X_CLK_DIR_OUT, current code setpm860x->dir=PM860X_CLK_DIR_IN; and then return-EINVAL. This looks confusion.
Since there is no comment for that, I'm wondering if the return-EINVALis intentional or not.Regards,
AxelQuoted 5 lines
Hi Axel,
Since we didn't support slave mode in our solution, I just return
-EINVALforPM860X_CLK_DIR_IN. I'm sorry to add the confused code. Could you help to format a patch to add the comments?
Quoted 5 lines
The main confusion part is current code actually *changes*
pm860x->dirsetting when return-EINVALinpm860x_set_dai_sysclk.
(And thepm860x->diris used inpm860x_pcm_set_dai_fmt.)
so I'm wondering if it make sense to just return-EINVALwithout settingpm860x->dir=PM860X_CLK_DIR_IN; inpm860x_set_dai_sysclk.
It's fine to return -EINVAL directly without setting pm680x->dir.
Regards
Haojian