clk-mt6779-img.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2019 MediaTek Inc.
  4. * Author: Wendell Lin <[email protected]>
  5. */
  6. #include <linux/module.h>
  7. #include <linux/clk-provider.h>
  8. #include <linux/platform_device.h>
  9. #include <dt-bindings/clock/mt6779-clk.h>
  10. #include "clk-mtk.h"
  11. #include "clk-gate.h"
  12. static const struct mtk_gate_regs img_cg_regs = {
  13. .set_ofs = 0x0004,
  14. .clr_ofs = 0x0008,
  15. .sta_ofs = 0x0000,
  16. };
  17. #define GATE_IMG(_id, _name, _parent, _shift) \
  18. GATE_MTK(_id, _name, _parent, &img_cg_regs, _shift, \
  19. &mtk_clk_gate_ops_setclr)
  20. static const struct mtk_gate img_clks[] = {
  21. GATE_IMG(CLK_IMG_LARB5, "imgsys_larb5", "img_sel", 0),
  22. GATE_IMG(CLK_IMG_LARB6, "imgsys_larb6", "img_sel", 1),
  23. GATE_IMG(CLK_IMG_DIP, "imgsys_dip", "img_sel", 2),
  24. GATE_IMG(CLK_IMG_MFB, "imgsys_mfb", "img_sel", 6),
  25. GATE_IMG(CLK_IMG_WPE_A, "imgsys_wpe_a", "img_sel", 7),
  26. };
  27. static const struct mtk_clk_desc img_desc = {
  28. .clks = img_clks,
  29. .num_clks = ARRAY_SIZE(img_clks),
  30. };
  31. static const struct of_device_id of_match_clk_mt6779_img[] = {
  32. {
  33. .compatible = "mediatek,mt6779-imgsys",
  34. .data = &img_desc,
  35. }, {
  36. /* sentinel */
  37. }
  38. };
  39. static struct platform_driver clk_mt6779_img_drv = {
  40. .probe = mtk_clk_simple_probe,
  41. .remove = mtk_clk_simple_remove,
  42. .driver = {
  43. .name = "clk-mt6779-img",
  44. .of_match_table = of_match_clk_mt6779_img,
  45. },
  46. };
  47. module_platform_driver(clk_mt6779_img_drv);
  48. MODULE_LICENSE("GPL");