clk-mt6765-cam.c 1.5 KB

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