clk-mt2701-img.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2014 MediaTek Inc.
  4. * Author: Shunli Wang <[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/mt2701-clk.h>
  11. static const struct mtk_gate_regs img_cg_regs = {
  12. .set_ofs = 0x0004,
  13. .clr_ofs = 0x0008,
  14. .sta_ofs = 0x0000,
  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_SMI_COMM, "img_smi_comm", "mm_sel", 0),
  20. GATE_IMG(CLK_IMG_RESZ, "img_resz", "mm_sel", 1),
  21. GATE_IMG(CLK_IMG_JPGDEC_SMI, "img_jpgdec_smi", "mm_sel", 5),
  22. GATE_IMG(CLK_IMG_JPGDEC, "img_jpgdec", "mm_sel", 6),
  23. GATE_IMG(CLK_IMG_VENC_LT, "img_venc_lt", "mm_sel", 8),
  24. GATE_IMG(CLK_IMG_VENC, "img_venc", "mm_sel", 9),
  25. };
  26. static const struct mtk_clk_desc img_desc = {
  27. .clks = img_clks,
  28. .num_clks = ARRAY_SIZE(img_clks),
  29. };
  30. static const struct of_device_id of_match_clk_mt2701_img[] = {
  31. {
  32. .compatible = "mediatek,mt2701-imgsys",
  33. .data = &img_desc,
  34. }, {
  35. /* sentinel */
  36. }
  37. };
  38. static struct platform_driver clk_mt2701_img_drv = {
  39. .probe = mtk_clk_simple_probe,
  40. .remove = mtk_clk_simple_remove,
  41. .driver = {
  42. .name = "clk-mt2701-img",
  43. .of_match_table = of_match_clk_mt2701_img,
  44. },
  45. };
  46. builtin_platform_driver(clk_mt2701_img_drv);