[PATCH 3/3] ASoC: rsnd: add null CLOCKIN support
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Wed May 26 00:48:25 CEST 2021
Hi Geert
> I'm not such a big fan of creating dummy clocks.
> And what if a future SoC lacks two CLOCKIN pins? Then you'll try to
> register a second dummy clock with the same name, which will fail,
> presumably?
I think current code will reuse same null_clk for these.
> This should only be done when the clock does not exist, not in case
> of other errors (e.g. -EPROBE_DEFER, which isn't handled yet)?
>
> As devm_clk_get_optional() already checks for existence, you could use:
>
> struct clk *clk = devm_clk_get_optional(dev, clk_name[i]);
> if (!clk)
> clk = rsnd_adg_null_clk_get(priv);
Ah, indeed.
Thanks. I will fix it.
> But in light of the above (avoiding dummy clocks), it might be more
> robust to make sure all code can handle adg->clk[i] = NULL?
The reason why I don't use adg->clk[i] = NULL is it is using this macro
#define for_each_rsnd_clk(pos, adg, i) \
for (i = 0; \
(i < CLKMAX) && \
((pos) = adg->clk[i]); \
i++)
The loop will stop at (A) if it was
adg->clk[0] = audio_clk_a;
adg->clk[1] = audio_clk_b;
(A) adg->clk[2] = NULL
adg->clk[3] = audio_clk_i;
Thank you for your help !!
Best regards
---
Kuninori Morimoto
More information about the Alsa-devel
mailing list