clk: qcom: clk-rcg: introduce support for multiple conf for same freq
authorChristian Marangi <ansuelsmth@gmail.com>
Wed, 20 Dec 2023 22:17:22 +0000 (23:17 +0100)
committerBjorn Andersson <andersson@kernel.org>
Sat, 27 Apr 2024 18:01:14 +0000 (13:01 -0500)
commitd06b1043644a1831ab141bbee2669002bba15b0f
tree0b8ce3fce94c0896bb9715a6f36555b61d200bf2
parent3db0f3b9ff5adb6a5e8564a32fadb2af1216810d
clk: qcom: clk-rcg: introduce support for multiple conf for same freq

Some RCG frequency can be reached by multiple configuration.

We currently declare multiple configuration for the same frequency but
that is not supported and always the first configuration will be taken.

These multiple configuration are needed as based on the current parent
configuration, it may be needed to use a different configuration to
reach the same frequency.

To handle this introduce 3 new macro, C, FM and FMS:

- C is used to declare a freq_conf where src, pre_div, m and n are
  provided.

- FM is used to declare a freq_multi_tbl with the frequency and an
  array of confs to insert all the config for the provided frequency.

- FMS is used to declare a freq_multi_tbl with the frequency and an
  array of a single conf with the provided src, pre_div, m and n.

Struct clk_rcg2 is changed to add a union type to reference a simple
freq_tbl or a complex freq_multi_tbl.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20231220221724.3822-2-ansuelsmth@gmail.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/clk/qcom/clk-rcg.h