clk-mt8365-vdec.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2022 MediaTek Inc.
  4. */
  5. #include <dt-bindings/clock/mediatek,mt8365-clk.h>
  6. #include <linux/clk-provider.h>
  7. #include <linux/platform_device.h>
  8. #include "clk-gate.h"
  9. #include "clk-mtk.h"
  10. static const struct mtk_gate_regs vdec0_cg_regs = {
  11. .set_ofs = 0x0,
  12. .clr_ofs = 0x4,
  13. .sta_ofs = 0x0,
  14. };
  15. static const struct mtk_gate_regs vdec1_cg_regs = {
  16. .set_ofs = 0x8,
  17. .clr_ofs = 0xc,
  18. .sta_ofs = 0x8,
  19. };
  20. #define GATE_VDEC0(_id, _name, _parent, _shift) \
  21. GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift, \
  22. &mtk_clk_gate_ops_setclr_inv)
  23. #define GATE_VDEC1(_id, _name, _parent, _shift) \
  24. GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift, \
  25. &mtk_clk_gate_ops_setclr_inv)
  26. static const struct mtk_gate vdec_clks[] = {
  27. /* VDEC0 */
  28. GATE_VDEC0(CLK_VDEC_VDEC, "vdec_fvdec_ck", "mm_sel", 0),
  29. /* VDEC1 */
  30. GATE_VDEC1(CLK_VDEC_LARB1, "vdec_flarb1_ck", "mm_sel", 0),
  31. };
  32. static const struct mtk_clk_desc vdec_desc = {
  33. .clks = vdec_clks,
  34. .num_clks = ARRAY_SIZE(vdec_clks),
  35. };
  36. static const struct of_device_id of_match_clk_mt8365_vdec[] = {
  37. {
  38. .compatible = "mediatek,mt8365-vdecsys",
  39. .data = &vdec_desc,
  40. }, {
  41. /* sentinel */
  42. }
  43. };
  44. static struct platform_driver clk_mt8365_vdec_drv = {
  45. .probe = mtk_clk_simple_probe,
  46. .remove = mtk_clk_simple_remove,
  47. .driver = {
  48. .name = "clk-mt8365-vdec",
  49. .of_match_table = of_match_clk_mt8365_vdec,
  50. },
  51. };
  52. builtin_platform_driver(clk_mt8365_vdec_drv);
  53. MODULE_LICENSE("GPL");