clk: cs2000-cp: add support for dynamic mode
authorDaniel Mack <daniel@zonque.org>
Tue, 25 Jan 2022 09:33:33 +0000 (10:33 +0100)
committerStephen Boyd <sboyd@kernel.org>
Tue, 25 Jan 2022 22:23:16 +0000 (14:23 -0800)
commitda1eb4e8b4df2942614478289c89a2031d0488b1
tree7ef79ccf4f9baeb668819ccdcde52b27ef0285dc
parenta6e11bb24ebd40a05a33ac1985d8643eb7217a40
clk: cs2000-cp: add support for dynamic mode

The CS2000 chip features two input clocks, REF_CLK and CLK_IN.

In static mode, the output clock (CLK_OUT) is directly derived from
REF_CLK, and CLK_IN is ignored. In dynamic mode, CLK_IN is used by the
digital PLL.

In dynamic mode, a low-frequency ratio configuration that uses a higher
multiplier factor.

Until now, only the static mode and high-frequency divider rations of
the hardware was supported by the driver. This patch adds support for
dynamic mode and both ratios:

 * Parse a new OF property 'cirrus,dynamic-mode' to determine the mode
 * In dynamic mode, present CLK_IN as parent clock, else use REF_CLK
 * The low-frequency ratio mode is automatically selected, depending
   on the mode of operation and the given input and output rates

Signed-off-by: Daniel Mack <daniel@zonque.org>
Link: https://lore.kernel.org/r/20220125093336.226787-7-daniel@zonque.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/clk-cs2000-cp.c