002-v6.2-03-clk-qcom-krait-cc-also-enable-secondary-mux-and-div-.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From 18ae57b1e8abee6c453381470f6e18991d2901a8 Mon Sep 17 00:00:00 2001
  2. From: Christian Marangi <[email protected]>
  3. Date: Wed, 9 Nov 2022 01:56:28 +0100
  4. Subject: [PATCH 3/6] clk: qcom: krait-cc: also enable secondary mux and div
  5. clk
  6. clk-krait ignore any rate change if clk is not flagged as enabled.
  7. Correctly enable the secondary mux and div clk to correctly change rate
  8. instead of silently ignoring the request.
  9. Signed-off-by: Christian Marangi <[email protected]>
  10. Signed-off-by: Bjorn Andersson <[email protected]>
  11. Link: https://lore.kernel.org/r/[email protected]
  12. ---
  13. drivers/clk/qcom/krait-cc.c | 21 ++++++++++++++++++++-
  14. 1 file changed, 20 insertions(+), 1 deletion(-)
  15. --- a/drivers/clk/qcom/krait-cc.c
  16. +++ b/drivers/clk/qcom/krait-cc.c
  17. @@ -80,6 +80,7 @@ krait_add_div(struct device *dev, int id
  18. };
  19. const char *p_names[1];
  20. struct clk *clk;
  21. + int cpu;
  22. div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL);
  23. if (!div)
  24. @@ -103,6 +104,17 @@ krait_add_div(struct device *dev, int id
  25. }
  26. clk = devm_clk_register(dev, &div->hw);
  27. + if (IS_ERR(clk))
  28. + goto err;
  29. +
  30. + /* clk-krait ignore any rate change if mux is not flagged as enabled */
  31. + if (id < 0)
  32. + for_each_online_cpu(cpu)
  33. + clk_prepare_enable(div->hw.clk);
  34. + else
  35. + clk_prepare_enable(div->hw.clk);
  36. +
  37. +err:
  38. kfree(p_names[0]);
  39. kfree(init.name);
  40. @@ -113,7 +125,7 @@ static int
  41. krait_add_sec_mux(struct device *dev, int id, const char *s,
  42. unsigned int offset, bool unique_aux)
  43. {
  44. - int ret;
  45. + int cpu, ret;
  46. struct krait_mux_clk *mux;
  47. static const char *sec_mux_list[] = {
  48. "qsb",
  49. @@ -165,6 +177,13 @@ krait_add_sec_mux(struct device *dev, in
  50. if (ret)
  51. goto unique_aux;
  52. + /* clk-krait ignore any rate change if mux is not flagged as enabled */
  53. + if (id < 0)
  54. + for_each_online_cpu(cpu)
  55. + clk_prepare_enable(mux->hw.clk);
  56. + else
  57. + clk_prepare_enable(mux->hw.clk);
  58. +
  59. unique_aux:
  60. if (unique_aux)
  61. kfree(sec_mux_list[0]);