clk-mt6765-audio.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2018 MediaTek Inc.
  4. * Author: Owen Chen <[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/mt6765-clk.h>
  11. static const struct mtk_gate_regs audio0_cg_regs = {
  12. .set_ofs = 0x0,
  13. .clr_ofs = 0x0,
  14. .sta_ofs = 0x0,
  15. };
  16. static const struct mtk_gate_regs audio1_cg_regs = {
  17. .set_ofs = 0x4,
  18. .clr_ofs = 0x4,
  19. .sta_ofs = 0x4,
  20. };
  21. #define GATE_AUDIO0(_id, _name, _parent, _shift) \
  22. GATE_MTK(_id, _name, _parent, &audio0_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
  23. #define GATE_AUDIO1(_id, _name, _parent, _shift) \
  24. GATE_MTK(_id, _name, _parent, &audio1_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
  25. static const struct mtk_gate audio_clks[] = {
  26. /* AUDIO0 */
  27. GATE_AUDIO0(CLK_AUDIO_AFE, "aud_afe", "audio_ck", 2),
  28. GATE_AUDIO0(CLK_AUDIO_22M, "aud_22m", "aud_engen1_ck", 8),
  29. GATE_AUDIO0(CLK_AUDIO_APLL_TUNER, "aud_apll_tuner",
  30. "aud_engen1_ck", 19),
  31. GATE_AUDIO0(CLK_AUDIO_ADC, "aud_adc", "audio_ck", 24),
  32. GATE_AUDIO0(CLK_AUDIO_DAC, "aud_dac", "audio_ck", 25),
  33. GATE_AUDIO0(CLK_AUDIO_DAC_PREDIS, "aud_dac_predis",
  34. "audio_ck", 26),
  35. GATE_AUDIO0(CLK_AUDIO_TML, "aud_tml", "audio_ck", 27),
  36. /* AUDIO1 */
  37. GATE_AUDIO1(CLK_AUDIO_I2S1_BCLK, "aud_i2s1_bclk",
  38. "audio_ck", 4),
  39. GATE_AUDIO1(CLK_AUDIO_I2S2_BCLK, "aud_i2s2_bclk",
  40. "audio_ck", 5),
  41. GATE_AUDIO1(CLK_AUDIO_I2S3_BCLK, "aud_i2s3_bclk",
  42. "audio_ck", 6),
  43. GATE_AUDIO1(CLK_AUDIO_I2S4_BCLK, "aud_i2s4_bclk",
  44. "audio_ck", 7),
  45. };
  46. static const struct mtk_clk_desc audio_desc = {
  47. .clks = audio_clks,
  48. .num_clks = ARRAY_SIZE(audio_clks),
  49. };
  50. static const struct of_device_id of_match_clk_mt6765_audio[] = {
  51. {
  52. .compatible = "mediatek,mt6765-audsys",
  53. .data = &audio_desc,
  54. }, {
  55. /* sentinel */
  56. }
  57. };
  58. static struct platform_driver clk_mt6765_audio_drv = {
  59. .probe = mtk_clk_simple_probe,
  60. .remove = mtk_clk_simple_remove,
  61. .driver = {
  62. .name = "clk-mt6765-audio",
  63. .of_match_table = of_match_clk_mt6765_audio,
  64. },
  65. };
  66. builtin_platform_driver(clk_mt6765_audio_drv);