clk-mt6779-venc.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2019 MediaTek Inc.
  4. * Author: Wendell Lin <[email protected]>
  5. */
  6. #include <linux/module.h>
  7. #include <linux/clk-provider.h>
  8. #include <linux/platform_device.h>
  9. #include "clk-mtk.h"
  10. #include "clk-gate.h"
  11. #include <dt-bindings/clock/mt6779-clk.h>
  12. static const struct mtk_gate_regs venc_cg_regs = {
  13. .set_ofs = 0x0004,
  14. .clr_ofs = 0x0008,
  15. .sta_ofs = 0x0000,
  16. };
  17. #define GATE_VENC_I(_id, _name, _parent, _shift) \
  18. GATE_MTK(_id, _name, _parent, &venc_cg_regs, _shift, \
  19. &mtk_clk_gate_ops_setclr_inv)
  20. static const struct mtk_gate venc_clks[] = {
  21. GATE_VENC_I(CLK_VENC_GCON_LARB, "venc_larb", "venc_sel", 0),
  22. GATE_VENC_I(CLK_VENC_GCON_VENC, "venc_venc", "venc_sel", 4),
  23. GATE_VENC_I(CLK_VENC_GCON_JPGENC, "venc_jpgenc", "venc_sel", 8),
  24. GATE_VENC_I(CLK_VENC_GCON_GALS, "venc_gals", "venc_sel", 28),
  25. };
  26. static const struct mtk_clk_desc venc_desc = {
  27. .clks = venc_clks,
  28. .num_clks = ARRAY_SIZE(venc_clks),
  29. };
  30. static const struct of_device_id of_match_clk_mt6779_venc[] = {
  31. {
  32. .compatible = "mediatek,mt6779-vencsys",
  33. .data = &venc_desc,
  34. }, {
  35. /* sentinel */
  36. }
  37. };
  38. static struct platform_driver clk_mt6779_venc_drv = {
  39. .probe = mtk_clk_simple_probe,
  40. .remove = mtk_clk_simple_remove,
  41. .driver = {
  42. .name = "clk-mt6779-venc",
  43. .of_match_table = of_match_clk_mt6779_venc,
  44. },
  45. };
  46. module_platform_driver(clk_mt6779_venc_drv);
  47. MODULE_LICENSE("GPL");