clk-mt6765-img.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 img_cg_regs = {
  12. .set_ofs = 0x4,
  13. .clr_ofs = 0x8,
  14. .sta_ofs = 0x0,
  15. };
  16. #define GATE_IMG(_id, _name, _parent, _shift) \
  17. GATE_MTK(_id, _name, _parent, &img_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
  18. static const struct mtk_gate img_clks[] = {
  19. GATE_IMG(CLK_IMG_LARB2, "img_larb2", "mm_ck", 0),
  20. GATE_IMG(CLK_IMG_DIP, "img_dip", "mm_ck", 2),
  21. GATE_IMG(CLK_IMG_FDVT, "img_fdvt", "mm_ck", 3),
  22. GATE_IMG(CLK_IMG_DPE, "img_dpe", "mm_ck", 4),
  23. GATE_IMG(CLK_IMG_RSC, "img_rsc", "mm_ck", 5),
  24. };
  25. static const struct mtk_clk_desc img_desc = {
  26. .clks = img_clks,
  27. .num_clks = ARRAY_SIZE(img_clks),
  28. };
  29. static const struct of_device_id of_match_clk_mt6765_img[] = {
  30. {
  31. .compatible = "mediatek,mt6765-imgsys",
  32. .data = &img_desc,
  33. }, {
  34. /* sentinel */
  35. }
  36. };
  37. static struct platform_driver clk_mt6765_img_drv = {
  38. .probe = mtk_clk_simple_probe,
  39. .remove = mtk_clk_simple_remove,
  40. .driver = {
  41. .name = "clk-mt6765-img",
  42. .of_match_table = of_match_clk_mt6765_img,
  43. },
  44. };
  45. builtin_platform_driver(clk_mt6765_img_drv);