clk-mt6779-vdec.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 vdec0_cg_regs = {
  13. .set_ofs = 0x0000,
  14. .clr_ofs = 0x0004,
  15. .sta_ofs = 0x0000,
  16. };
  17. static const struct mtk_gate_regs vdec1_cg_regs = {
  18. .set_ofs = 0x0008,
  19. .clr_ofs = 0x000c,
  20. .sta_ofs = 0x0008,
  21. };
  22. #define GATE_VDEC0_I(_id, _name, _parent, _shift) \
  23. GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift, \
  24. &mtk_clk_gate_ops_setclr_inv)
  25. #define GATE_VDEC1_I(_id, _name, _parent, _shift) \
  26. GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift, \
  27. &mtk_clk_gate_ops_setclr_inv)
  28. static const struct mtk_gate vdec_clks[] = {
  29. /* VDEC0 */
  30. GATE_VDEC0_I(CLK_VDEC_VDEC, "vdec_cken", "vdec_sel", 0),
  31. /* VDEC1 */
  32. GATE_VDEC1_I(CLK_VDEC_LARB1, "vdec_larb1_cken", "vdec_sel", 0),
  33. };
  34. static const struct mtk_clk_desc vdec_desc = {
  35. .clks = vdec_clks,
  36. .num_clks = ARRAY_SIZE(vdec_clks),
  37. };
  38. static const struct of_device_id of_match_clk_mt6779_vdec[] = {
  39. {
  40. .compatible = "mediatek,mt6779-vdecsys",
  41. .data = &vdec_desc,
  42. }, {
  43. /* sentinel */
  44. }
  45. };
  46. static struct platform_driver clk_mt6779_vdec_drv = {
  47. .probe = mtk_clk_simple_probe,
  48. .remove = mtk_clk_simple_remove,
  49. .driver = {
  50. .name = "clk-mt6779-vdec",
  51. .of_match_table = of_match_clk_mt6779_vdec,
  52. },
  53. };
  54. module_platform_driver(clk_mt6779_vdec_drv);
  55. MODULE_LICENSE("GPL");