clk-mt8167-img.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2020 MediaTek Inc.
  4. * Copyright (c) 2020 BayLibre, SAS
  5. * Author: James Liao <jamesjj.liao@mediatek.com>
  6. * Fabien Parent <fparent@baylibre.com>
  7. */
  8. #include <linux/clk-provider.h>
  9. #include <linux/mod_devicetable.h>
  10. #include <linux/platform_device.h>
  11. #include "clk-mtk.h"
  12. #include "clk-gate.h"
  13. #include <dt-bindings/clock/mt8167-clk.h>
  14. static const struct mtk_gate_regs img_cg_regs = {
  15. .set_ofs = 0x4,
  16. .clr_ofs = 0x8,
  17. .sta_ofs = 0x0,
  18. };
  19. #define GATE_IMG(_id, _name, _parent, _shift) \
  20. GATE_MTK(_id, _name, _parent, &img_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
  21. static const struct mtk_gate img_clks[] = {
  22. GATE_IMG(CLK_IMG_LARB1_SMI, "img_larb1_smi", "smi_mm", 0),
  23. GATE_IMG(CLK_IMG_CAM_SMI, "img_cam_smi", "smi_mm", 5),
  24. GATE_IMG(CLK_IMG_CAM_CAM, "img_cam_cam", "smi_mm", 6),
  25. GATE_IMG(CLK_IMG_SEN_TG, "img_sen_tg", "cam_mm", 7),
  26. GATE_IMG(CLK_IMG_SEN_CAM, "img_sen_cam", "smi_mm", 8),
  27. GATE_IMG(CLK_IMG_VENC, "img_venc", "smi_mm", 9),
  28. };
  29. static const struct mtk_clk_desc img_desc = {
  30. .clks = img_clks,
  31. .num_clks = ARRAY_SIZE(img_clks),
  32. };
  33. static const struct of_device_id of_match_clk_mt8167_imgsys[] = {
  34. { .compatible = "mediatek,mt8167-imgsys", .data = &img_desc },
  35. { /* sentinel */ }
  36. };
  37. MODULE_DEVICE_TABLE(of, of_match_clk_mt8167_imgsys);
  38. static struct platform_driver clk_mt8167_imgsys_drv = {
  39. .probe = mtk_clk_simple_probe,
  40. .remove = mtk_clk_simple_remove,
  41. .driver = {
  42. .name = "clk-mt8167-imgsys",
  43. .of_match_table = of_match_clk_mt8167_imgsys,
  44. },
  45. };
  46. module_platform_driver(clk_mt8167_imgsys_drv);
  47. MODULE_DESCRIPTION("MediaTek MT8167 imgsys clocks driver");
  48. MODULE_LICENSE("GPL");