clk-mt8183-vdec.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // Copyright (c) 2018 MediaTek Inc.
  4. // Author: Weiyi Lu <[email protected]>
  5. #include <linux/clk-provider.h>
  6. #include <linux/platform_device.h>
  7. #include "clk-mtk.h"
  8. #include "clk-gate.h"
  9. #include <dt-bindings/clock/mt8183-clk.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_I(_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_I(_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_I(CLK_VDEC_VDEC, "vdec_vdec", "mm_sel", 0),
  29. /* VDEC1 */
  30. GATE_VDEC1_I(CLK_VDEC_LARB1, "vdec_larb1", "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_mt8183_vdec[] = {
  37. {
  38. .compatible = "mediatek,mt8183-vdecsys",
  39. .data = &vdec_desc,
  40. }, {
  41. /* sentinel */
  42. }
  43. };
  44. static struct platform_driver clk_mt8183_vdec_drv = {
  45. .probe = mtk_clk_simple_probe,
  46. .remove = mtk_clk_simple_remove,
  47. .driver = {
  48. .name = "clk-mt8183-vdec",
  49. .of_match_table = of_match_clk_mt8183_vdec,
  50. },
  51. };
  52. builtin_platform_driver(clk_mt8183_vdec_drv);