linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 00/31] clk: mediatek: Cleanups and Improvements - Part 1
@ 2022-02-08 12:40 Chen-Yu Tsai
  2022-02-08 12:40 ` [PATCH v3 01/31] clk: mediatek: Use %pe to print errors Chen-Yu Tsai
                   ` (31 more replies)
  0 siblings, 32 replies; 96+ messages in thread
From: Chen-Yu Tsai @ 2022-02-08 12:40 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette, Matthias Brugger
  Cc: Chen-Yu Tsai, Chun-Jie Chen, AngeloGioacchino Del Regno,
	Miles Chen, linux-clk, linux-arm-kernel, linux-mediatek,
	linux-kernel

Hi everyone,

This is version 3 of part 1 of planned work to cleanup, improve, and
modernize the MediaTek clk drivers. The full proposal can be found here:

https://lore.kernel.org/linux-clk/20220122091731.283592-1-wenst@chromium.org/


Changes since version 2:

- Collected review tags
- Moved platform_set_drvdata() in clk_mt8195_apusys_pll_probe() to the
  correct patch (patch 30)
- Corrected error path for clk_mt8195_apmixed_probe() in patch
  "clk: mediatek: mt8195: Implement error handling in probe functions"
  - Also dropped review tag for this patch

Changes since version 1:

- Added NULL pointer check against __clk_get_hw() return value in
  mtk_clk_unregister_pll()
- Added NULL pointer check against __clk_get_hw() return value in
  mtk_clk_unregister_composite()
- Copied MHZ macro into clk-pll.c and restored its usage
- Dropped extra semicolon in mtk_clk_register_plls()
  - Reported by kernel test robot <lkp@intel.com>


I also wanted to ask, what would be a good way to do the "struct clk" to
"struct clk_hw" API conversion?

A. Add new register/unregister APIs that use "struct clk_hw" instead of
   "struct clk". This would result in a lot of patches and a lot of
   churn though.

B. Replace "struct clk" with "struct clk_hw" (and "struct clk_onecell_data"
   with "struct clk_hw_onecell_data") and work around existing code with
   __clk_get_hw() or its opposite. This would result in a few huge
   pages, as to not break bisection, but would likely cause less churn.
   And it would cover all existing platforms in one go.


Thanks
ChenYu


Original cover letter sans full proposal as follows:

Part 1 involves cleaning up various parts of the MediaTek common clk
driver library:

- Code style cleanups in places touched by other changes
- Code for a given clk type that happened to be split between different
  files is consolidated
- Parts of the implementation, such as the internal data structures and
  registration/unregistration of a single clk, are internalized and no
  longer exported to other parts of the library
- Unregister APIs for all clk types in the library are added
- Remove function added for the simple driver case
- Error handling is added for all clk types
- MT8195 clk drivers cleaned up with error handling and removal support
  added

Adding error handling to the clk driver library results is a change in
its behavior, and might cause some breakage where the affected system
was originally somewhat working, but not completely. The failure would
result from a duplicated clk, either in name or ID. Old behavior was to
skip over these and ignore the error, whereas the new behavior is to
restore changes and error out.

To detect duplicate IDs, an additional warning will now be printed when
such occurrences happen. In a correct driver such things should not
happen though, so maybe we could consider wrapping that in some debug
Kconfig option. That's why I put it as the last patch in this series.

This series was tested on MT8195 with the series applied on the downstream
ChromeOS v5.10 kernel. Some other patches were applied to make this
series apply cleanly, but nothing The cpumux clk type changes were
not tested due to lack of related hardware. However the changes are
very similar to the other types, and I am confident there are no issues.


Chen-Yu Tsai (31):
  clk: mediatek: Use %pe to print errors
  clk: mediatek: gate: Consolidate gate type clk related code
  clk: mediatek: gate: Internalize clk implementation
  clk: mediatek: gate: Implement unregister API
  clk: mediatek: gate: Clean up included headers
  clk: mediatek: cpumux: Implement unregister API
  clk: mediatek: cpumux: Internalize struct mtk_clk_cpumux
  clk: mediatek: cpumux: Clean up included headers
  clk: mediatek: mux: Implement unregister API
  clk: mediatek: mux: Internalize struct mtk_clk_mux
  clk: mediatek: mux: Clean up included headers
  clk: mediatek: pll: Split definitions into separate header file
  clk: mediatek: pll: Implement unregister API
  clk: mediatek: pll: Clean up included headers
  clk: mediatek: Implement mtk_clk_unregister_fixed_clks() API
  clk: mediatek: Implement mtk_clk_unregister_factors() API
  clk: mediatek: Implement mtk_clk_unregister_divider_clks() API
  clk: mediatek: Implement mtk_clk_unregister_composites() API
  clk: mediatek: Add mtk_clk_simple_remove()
  clk: mediatek: mtk: Clean up included headers
  clk: mediatek: cpumux: Implement error handling in register API
  clk: mediatek: gate: Implement error handling in register API
  clk: mediatek: mux: Reverse check for existing clk to reduce nesting
    level
  clk: mediatek: mux: Implement error handling in register API
  clk: mediatek: pll: Implement error handling in register API
  clk: mediatek: mtk: Implement error handling in register APIs
  clk: mediatek: Unregister clks in mtk_clk_simple_probe() error path
  clk: mediatek: mt8195: Hook up mtk_clk_simple_remove()
  clk: mediatek: mt8195: Implement error handling in probe functions
  clk: mediatek: mt8195: Implement remove functions
  clk: mediatek: Warn if clk IDs are duplicated

 drivers/clk/mediatek/clk-apmixed.c            |   2 +-
 drivers/clk/mediatek/clk-cpumux.c             |  69 +++-
 drivers/clk/mediatek/clk-cpumux.h             |  13 +-
 drivers/clk/mediatek/clk-gate.c               | 148 +++++++--
 drivers/clk/mediatek/clk-gate.h               |  59 ++--
 drivers/clk/mediatek/clk-mt2701.c             |   5 +-
 drivers/clk/mediatek/clk-mt2712.c             |   3 +-
 drivers/clk/mediatek/clk-mt6765.c             |   3 +-
 drivers/clk/mediatek/clk-mt6779.c             |   3 +-
 drivers/clk/mediatek/clk-mt6797.c             |   3 +-
 drivers/clk/mediatek/clk-mt7622.c             |   5 +-
 drivers/clk/mediatek/clk-mt7629.c             |   5 +-
 drivers/clk/mediatek/clk-mt7986-apmixed.c     |   4 +-
 drivers/clk/mediatek/clk-mt8135.c             |   3 +-
 drivers/clk/mediatek/clk-mt8167.c             |   3 +-
 drivers/clk/mediatek/clk-mt8173.c             |   5 +-
 drivers/clk/mediatek/clk-mt8183.c             |   3 +-
 drivers/clk/mediatek/clk-mt8192.c             |   3 +-
 drivers/clk/mediatek/clk-mt8195-apmixedsys.c  |  30 +-
 drivers/clk/mediatek/clk-mt8195-apusys_pll.c  |  25 +-
 drivers/clk/mediatek/clk-mt8195-cam.c         |   1 +
 drivers/clk/mediatek/clk-mt8195-ccu.c         |   1 +
 drivers/clk/mediatek/clk-mt8195-img.c         |   1 +
 .../clk/mediatek/clk-mt8195-imp_iic_wrap.c    |   1 +
 drivers/clk/mediatek/clk-mt8195-infra_ao.c    |   1 +
 drivers/clk/mediatek/clk-mt8195-ipe.c         |   1 +
 drivers/clk/mediatek/clk-mt8195-mfg.c         |   1 +
 drivers/clk/mediatek/clk-mt8195-peri_ao.c     |   1 +
 drivers/clk/mediatek/clk-mt8195-scp_adsp.c    |   1 +
 drivers/clk/mediatek/clk-mt8195-topckgen.c    |  69 +++-
 drivers/clk/mediatek/clk-mt8195-vdec.c        |   1 +
 drivers/clk/mediatek/clk-mt8195-vdo0.c        |  20 +-
 drivers/clk/mediatek/clk-mt8195-vdo1.c        |  20 +-
 drivers/clk/mediatek/clk-mt8195-venc.c        |   1 +
 drivers/clk/mediatek/clk-mt8195-vpp0.c        |   1 +
 drivers/clk/mediatek/clk-mt8195-vpp1.c        |   1 +
 drivers/clk/mediatek/clk-mt8195-wpe.c         |   1 +
 drivers/clk/mediatek/clk-mt8516.c             |   3 +-
 drivers/clk/mediatek/clk-mtk.c                | 304 +++++++++++++-----
 drivers/clk/mediatek/clk-mtk.h                | 105 ++----
 drivers/clk/mediatek/clk-mux.c                |  89 ++++-
 drivers/clk/mediatek/clk-mux.h                |  17 +-
 drivers/clk/mediatek/clk-pll.c                | 100 +++++-
 drivers/clk/mediatek/clk-pll.h                |  57 ++++
 drivers/clk/mediatek/reset.c                  |   3 +-
 45 files changed, 903 insertions(+), 292 deletions(-)
 create mode 100644 drivers/clk/mediatek/clk-pll.h

-- 
2.35.0.263.gb82422642f-goog


^ permalink raw reply	[flat|nested] 96+ messages in thread

end of thread, other threads:[~2022-02-17 20:30 UTC | newest]

Thread overview: 96+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08 12:40 [PATCH v3 00/31] clk: mediatek: Cleanups and Improvements - Part 1 Chen-Yu Tsai
2022-02-08 12:40 ` [PATCH v3 01/31] clk: mediatek: Use %pe to print errors Chen-Yu Tsai
2022-02-15  6:06   ` Chun-Jie Chen
2022-02-17 20:20   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 02/31] clk: mediatek: gate: Consolidate gate type clk related code Chen-Yu Tsai
2022-02-15  6:20   ` Chun-Jie Chen
2022-02-17 20:20   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 03/31] clk: mediatek: gate: Internalize clk implementation Chen-Yu Tsai
2022-02-15  6:22   ` Chun-Jie Chen
2022-02-17 20:20   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 04/31] clk: mediatek: gate: Implement unregister API Chen-Yu Tsai
2022-02-15  6:23   ` Chun-Jie Chen
2022-02-17 20:21   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 05/31] clk: mediatek: gate: Clean up included headers Chen-Yu Tsai
2022-02-15  6:24   ` Chun-Jie Chen
2022-02-17 20:21   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 06/31] clk: mediatek: cpumux: Implement unregister API Chen-Yu Tsai
2022-02-15  6:25   ` Chun-Jie Chen
2022-02-17 20:21   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 07/31] clk: mediatek: cpumux: Internalize struct mtk_clk_cpumux Chen-Yu Tsai
2022-02-15  6:25   ` Chun-Jie Chen
2022-02-17 20:21   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 08/31] clk: mediatek: cpumux: Clean up included headers Chen-Yu Tsai
2022-02-15  6:26   ` Chun-Jie Chen
2022-02-17 20:21   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 09/31] clk: mediatek: mux: Implement unregister API Chen-Yu Tsai
2022-02-15  6:30   ` Chun-Jie Chen
2022-02-17 20:24   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 10/31] clk: mediatek: mux: Internalize struct mtk_clk_mux Chen-Yu Tsai
2022-02-15  6:30   ` Chun-Jie Chen
2022-02-17 20:24   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 11/31] clk: mediatek: mux: Clean up included headers Chen-Yu Tsai
2022-02-15  6:31   ` Chun-Jie Chen
2022-02-17 20:25   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 12/31] clk: mediatek: pll: Split definitions into separate header file Chen-Yu Tsai
2022-02-15  6:32   ` Chun-Jie Chen
2022-02-17 20:25   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 13/31] clk: mediatek: pll: Implement unregister API Chen-Yu Tsai
2022-02-15  6:33   ` Chun-Jie Chen
2022-02-17 20:25   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 14/31] clk: mediatek: pll: Clean up included headers Chen-Yu Tsai
2022-02-15  6:34   ` Chun-Jie Chen
2022-02-17 20:25   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 15/31] clk: mediatek: Implement mtk_clk_unregister_fixed_clks() API Chen-Yu Tsai
2022-02-15  6:35   ` Chun-Jie Chen
2022-02-17 20:25   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 16/31] clk: mediatek: Implement mtk_clk_unregister_factors() API Chen-Yu Tsai
2022-02-15  6:36   ` Chun-Jie Chen
2022-02-17 20:26   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 17/31] clk: mediatek: Implement mtk_clk_unregister_divider_clks() API Chen-Yu Tsai
2022-02-15  6:36   ` Chun-Jie Chen
2022-02-17 20:26   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 18/31] clk: mediatek: Implement mtk_clk_unregister_composites() API Chen-Yu Tsai
2022-02-15  6:37   ` Chun-Jie Chen
2022-02-17 20:26   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 19/31] clk: mediatek: Add mtk_clk_simple_remove() Chen-Yu Tsai
2022-02-15  6:37   ` Chun-Jie Chen
2022-02-17 20:26   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 20/31] clk: mediatek: mtk: Clean up included headers Chen-Yu Tsai
2022-02-15  6:57   ` Chun-Jie Chen
2022-02-17 20:26   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 21/31] clk: mediatek: cpumux: Implement error handling in register API Chen-Yu Tsai
2022-02-15  7:00   ` Chun-Jie Chen
2022-02-17 20:27   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 22/31] clk: mediatek: gate: " Chen-Yu Tsai
2022-02-15  7:01   ` Chun-Jie Chen
2022-02-17 20:27   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 23/31] clk: mediatek: mux: Reverse check for existing clk to reduce nesting level Chen-Yu Tsai
2022-02-15  7:04   ` Chun-Jie Chen
2022-02-17 20:27   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 24/31] clk: mediatek: mux: Implement error handling in register API Chen-Yu Tsai
2022-02-15  7:05   ` Chun-Jie Chen
2022-02-17 20:27   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 25/31] clk: mediatek: pll: " Chen-Yu Tsai
2022-02-15  7:05   ` Chun-Jie Chen
2022-02-17 20:28   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 26/31] clk: mediatek: mtk: Implement error handling in register APIs Chen-Yu Tsai
2022-02-15  7:10   ` Chun-Jie Chen
2022-02-17 20:28   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 27/31] clk: mediatek: Unregister clks in mtk_clk_simple_probe() error path Chen-Yu Tsai
2022-02-15  7:11   ` Chun-Jie Chen
2022-02-17 20:29   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 28/31] clk: mediatek: mt8195: Hook up mtk_clk_simple_remove() Chen-Yu Tsai
2022-02-08 13:23   ` AngeloGioacchino Del Regno
2022-02-15  7:12   ` Chun-Jie Chen
2022-02-17 20:29   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 29/31] clk: mediatek: mt8195: Implement error handling in probe functions Chen-Yu Tsai
2022-02-08 13:23   ` AngeloGioacchino Del Regno
2022-02-17 20:29   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 30/31] clk: mediatek: mt8195: Implement remove functions Chen-Yu Tsai
2022-02-08 13:23   ` AngeloGioacchino Del Regno
2022-02-17 20:29   ` Stephen Boyd
2022-02-08 12:40 ` [PATCH v3 31/31] clk: mediatek: Warn if clk IDs are duplicated Chen-Yu Tsai
2022-02-17 20:29   ` Stephen Boyd
2022-02-08 19:32 ` [PATCH v3 00/31] clk: mediatek: Cleanups and Improvements - Part 1 Boris Lysov
2022-02-09  3:13   ` Chen-Yu Tsai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).