clk-mt6795-vdecsys.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2022 Collabora Ltd.
  4. * Author: AngeloGioacchino Del Regno <[email protected]>
  5. */
  6. #include <dt-bindings/clock/mediatek,mt6795-clk.h>
  7. #include <linux/module.h>
  8. #include <linux/platform_device.h>
  9. #include "clk-gate.h"
  10. #include "clk-mtk.h"
  11. #define GATE_VDEC(_id, _name, _parent, _regs) \
  12. GATE_MTK(_id, _name, _parent, _regs, 0, \
  13. &mtk_clk_gate_ops_setclr_inv)
  14. static const struct mtk_gate_regs vdec0_cg_regs = {
  15. .set_ofs = 0x0000,
  16. .clr_ofs = 0x0004,
  17. .sta_ofs = 0x0000,
  18. };
  19. static const struct mtk_gate_regs vdec1_cg_regs = {
  20. .set_ofs = 0x0008,
  21. .clr_ofs = 0x000c,
  22. .sta_ofs = 0x0008,
  23. };
  24. static const struct mtk_gate vdec_clks[] = {
  25. GATE_VDEC(CLK_VDEC_CKEN, "vdec_cken", "vdec_sel", &vdec0_cg_regs),
  26. GATE_VDEC(CLK_VDEC_LARB_CKEN, "vdec_larb_cken", "mm_sel", &vdec1_cg_regs),
  27. };
  28. static const struct mtk_clk_desc vdec_desc = {
  29. .clks = vdec_clks,
  30. .num_clks = ARRAY_SIZE(vdec_clks),
  31. };
  32. static const struct of_device_id of_match_clk_mt6795_vdecsys[] = {
  33. { .compatible = "mediatek,mt6795-vdecsys", .data = &vdec_desc },
  34. { /* sentinel */ }
  35. };
  36. static struct platform_driver clk_mt6795_vdecsys_drv = {
  37. .probe = mtk_clk_simple_probe,
  38. .remove = mtk_clk_simple_remove,
  39. .driver = {
  40. .name = "clk-mt6795-vdecsys",
  41. .of_match_table = of_match_clk_mt6795_vdecsys,
  42. },
  43. };
  44. module_platform_driver(clk_mt6795_vdecsys_drv);
  45. MODULE_DESCRIPTION("MediaTek MT6795 vdecsys clocks driver");
  46. MODULE_LICENSE("GPL");