Skip to contentSkip to conversation

ASoC: 88pm860x: Question about pm860x_set_dai_sysclk implementation

DISCUSSION Axel Lin 2 participants 4 messages Jun 28, 2015 – Jun 29, 2015

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

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

#1 lore raw
Quoted 11 lines · Axel Lin

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

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

author
#2 lore raw

2015-06-29 10:02 GMT+08:00 Haojian Zhuang <[email protected]>:

Quoted 13 lines · Axel Lin
Quoted 11 lines

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 5 lines

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?

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.

#3 lore raw
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,
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 5 lines

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?

Quoted 5 lines

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.

It's fine to return -EINVAL directly without setting pm680x->dir.

Regards
Haojian