clk-mt2701-vdec.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 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_CKGEN, "vdec_cken", "vdec_sel", 0),
  27. GATE_VDEC1(CLK_VDEC_LARB, "vdec_larb_cken", "mm_sel", 0),
  28. };
  29. static const struct mtk_clk_desc vdec_desc = {
  30. .clks = vdec_clks,
  31. .num_clks = ARRAY_SIZE(vdec_clks),
  32. };
  33. static const struct of_device_id of_match_clk_mt2701_vdec[] = {
  34. {
  35. .compatible = "mediatek,mt2701-vdecsys",
  36. .data = &vdec_desc,
  37. }, {
  38. /* sentinel */
  39. }
  40. };
  41. static struct platform_driver clk_mt2701_vdec_drv = {
  42. .probe = mtk_clk_simple_probe,
  43. .remove = mtk_clk_simple_remove,
  44. .driver = {
  45. .name = "clk-mt2701-vdec",
  46. .of_match_table = of_match_clk_mt2701_vdec,
  47. },
  48. };
  49. builtin_platform_driver(clk_mt2701_vdec_drv);