clk-mt8195-venc.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. //
  3. // Copyright (c) 2021 MediaTek Inc.
  4. // Author: Chun-Jie Chen <[email protected]>
  5. #include "clk-gate.h"
  6. #include "clk-mtk.h"
  7. #include <dt-bindings/clock/mt8195-clk.h>
  8. #include <linux/clk-provider.h>
  9. #include <linux/platform_device.h>
  10. static const struct mtk_gate_regs venc_cg_regs = {
  11. .set_ofs = 0x4,
  12. .clr_ofs = 0x8,
  13. .sta_ofs = 0x0,
  14. };
  15. #define GATE_VENC(_id, _name, _parent, _shift) \
  16. GATE_MTK(_id, _name, _parent, &venc_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
  17. static const struct mtk_gate venc_clks[] = {
  18. GATE_VENC(CLK_VENC_LARB, "venc_larb", "top_venc", 0),
  19. GATE_VENC(CLK_VENC_VENC, "venc_venc", "top_venc", 4),
  20. GATE_VENC(CLK_VENC_JPGENC, "venc_jpgenc", "top_venc", 8),
  21. GATE_VENC(CLK_VENC_JPGDEC, "venc_jpgdec", "top_venc", 12),
  22. GATE_VENC(CLK_VENC_JPGDEC_C1, "venc_jpgdec_c1", "top_venc", 16),
  23. GATE_VENC(CLK_VENC_GALS, "venc_gals", "top_venc", 28),
  24. };
  25. static const struct mtk_gate venc_core1_clks[] = {
  26. GATE_VENC(CLK_VENC_CORE1_LARB, "venc_core1_larb", "top_venc", 0),
  27. GATE_VENC(CLK_VENC_CORE1_VENC, "venc_core1_venc", "top_venc", 4),
  28. GATE_VENC(CLK_VENC_CORE1_JPGENC, "venc_core1_jpgenc", "top_venc", 8),
  29. GATE_VENC(CLK_VENC_CORE1_JPGDEC, "venc_core1_jpgdec", "top_venc", 12),
  30. GATE_VENC(CLK_VENC_CORE1_JPGDEC_C1, "venc_core1_jpgdec_c1", "top_venc", 16),
  31. GATE_VENC(CLK_VENC_CORE1_GALS, "venc_core1_gals", "top_venc", 28),
  32. };
  33. static const struct mtk_clk_desc venc_desc = {
  34. .clks = venc_clks,
  35. .num_clks = ARRAY_SIZE(venc_clks),
  36. };
  37. static const struct mtk_clk_desc venc_core1_desc = {
  38. .clks = venc_core1_clks,
  39. .num_clks = ARRAY_SIZE(venc_core1_clks),
  40. };
  41. static const struct of_device_id of_match_clk_mt8195_venc[] = {
  42. {
  43. .compatible = "mediatek,mt8195-vencsys",
  44. .data = &venc_desc,
  45. }, {
  46. .compatible = "mediatek,mt8195-vencsys_core1",
  47. .data = &venc_core1_desc,
  48. }, {
  49. /* sentinel */
  50. }
  51. };
  52. static struct platform_driver clk_mt8195_venc_drv = {
  53. .probe = mtk_clk_simple_probe,
  54. .remove = mtk_clk_simple_remove,
  55. .driver = {
  56. .name = "clk-mt8195-venc",
  57. .of_match_table = of_match_clk_mt8195_venc,
  58. },
  59. };
  60. builtin_platform_driver(clk_mt8195_venc_drv);