clk-mt6797-vdec.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2017 MediaTek Inc.
  4. * Author: Kevin-CW 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/mt6797-clk.h>
  11. static const struct mtk_gate_regs vdec0_cg_regs = {
  12. .set_ofs = 0x0000,
  13. .clr_ofs = 0x0004,
  14. .sta_ofs = 0x0000,
  15. };
  16. static const struct mtk_gate_regs vdec1_cg_regs = {
  17. .set_ofs = 0x0008,
  18. .clr_ofs = 0x000c,
  19. .sta_ofs = 0x0008,
  20. };
  21. #define GATE_VDEC0(_id, _name, _parent, _shift) \
  22. GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
  23. #define GATE_VDEC1(_id, _name, _parent, _shift) \
  24. GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
  25. static const struct mtk_gate vdec_clks[] = {
  26. GATE_VDEC0(CLK_VDEC_CKEN_ENG, "vdec_cken_eng", "vdec_sel", 8),
  27. GATE_VDEC0(CLK_VDEC_ACTIVE, "vdec_active", "vdec_sel", 4),
  28. GATE_VDEC0(CLK_VDEC_CKEN, "vdec_cken", "vdec_sel", 0),
  29. GATE_VDEC1(CLK_VDEC_LARB1_CKEN, "vdec_larb1_cken", "mm_sel", 0),
  30. };
  31. static const struct mtk_clk_desc vdec_desc = {
  32. .clks = vdec_clks,
  33. .num_clks = ARRAY_SIZE(vdec_clks),
  34. };
  35. static const struct of_device_id of_match_clk_mt6797_vdec[] = {
  36. {
  37. .compatible = "mediatek,mt6797-vdecsys",
  38. .data = &vdec_desc,
  39. }, {
  40. /* sentinel */
  41. }
  42. };
  43. static struct platform_driver clk_mt6797_vdec_drv = {
  44. .probe = mtk_clk_simple_probe,
  45. .remove = mtk_clk_simple_remove,
  46. .driver = {
  47. .name = "clk-mt6797-vdec",
  48. .of_match_table = of_match_clk_mt6797_vdec,
  49. },
  50. };
  51. builtin_platform_driver(clk_mt6797_vdec_drv);