clk-mt8183-cam.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // Copyright (c) 2018 MediaTek Inc.
  4. // Author: Weiyi Lu <[email protected]>
  5. #include <linux/clk-provider.h>
  6. #include <linux/platform_device.h>
  7. #include "clk-mtk.h"
  8. #include "clk-gate.h"
  9. #include <dt-bindings/clock/mt8183-clk.h>
  10. static const struct mtk_gate_regs cam_cg_regs = {
  11. .set_ofs = 0x4,
  12. .clr_ofs = 0x8,
  13. .sta_ofs = 0x0,
  14. };
  15. #define GATE_CAM(_id, _name, _parent, _shift) \
  16. GATE_MTK(_id, _name, _parent, &cam_cg_regs, _shift, \
  17. &mtk_clk_gate_ops_setclr)
  18. static const struct mtk_gate cam_clks[] = {
  19. GATE_CAM(CLK_CAM_LARB6, "cam_larb6", "cam_sel", 0),
  20. GATE_CAM(CLK_CAM_DFP_VAD, "cam_dfp_vad", "cam_sel", 1),
  21. GATE_CAM(CLK_CAM_LARB3, "cam_larb3", "cam_sel", 2),
  22. GATE_CAM(CLK_CAM_CAM, "cam_cam", "cam_sel", 6),
  23. GATE_CAM(CLK_CAM_CAMTG, "cam_camtg", "cam_sel", 7),
  24. GATE_CAM(CLK_CAM_SENINF, "cam_seninf", "cam_sel", 8),
  25. GATE_CAM(CLK_CAM_CAMSV0, "cam_camsv0", "cam_sel", 9),
  26. GATE_CAM(CLK_CAM_CAMSV1, "cam_camsv1", "cam_sel", 10),
  27. GATE_CAM(CLK_CAM_CAMSV2, "cam_camsv2", "cam_sel", 11),
  28. GATE_CAM(CLK_CAM_CCU, "cam_ccu", "cam_sel", 12),
  29. };
  30. static const struct mtk_clk_desc cam_desc = {
  31. .clks = cam_clks,
  32. .num_clks = ARRAY_SIZE(cam_clks),
  33. };
  34. static const struct of_device_id of_match_clk_mt8183_cam[] = {
  35. {
  36. .compatible = "mediatek,mt8183-camsys",
  37. .data = &cam_desc,
  38. }, {
  39. /* sentinel */
  40. }
  41. };
  42. static struct platform_driver clk_mt8183_cam_drv = {
  43. .probe = mtk_clk_simple_probe,
  44. .remove = mtk_clk_simple_remove,
  45. .driver = {
  46. .name = "clk-mt8183-cam",
  47. .of_match_table = of_match_clk_mt8183_cam,
  48. },
  49. };
  50. builtin_platform_driver(clk_mt8183_cam_drv);