skl-ssp-clk.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * skl-ssp-clk.h - Skylake ssp clock information and ipc structure
  3. *
  4. * Copyright (C) 2017 Intel Corp
  5. * Author: Jaikrishna Nemallapudi <jaikrishnax.nemallapudi@intel.com>
  6. * Author: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
  7. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; version 2 of the License.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  19. *
  20. */
  21. #ifndef SOUND_SOC_SKL_SSP_CLK_H
  22. #define SOUND_SOC_SKL_SSP_CLK_H
  23. #define SKL_MAX_SSP 6
  24. /* xtal/cardinal/pll, parent of ssp clocks and mclk */
  25. #define SKL_MAX_CLK_SRC 3
  26. #define SKL_MAX_SSP_CLK_TYPES 3 /* mclk, sclk, sclkfs */
  27. #define SKL_MAX_CLK_CNT (SKL_MAX_SSP * SKL_MAX_SSP_CLK_TYPES)
  28. /* Max number of configurations supported for each clock */
  29. #define SKL_MAX_CLK_RATES 10
  30. #define SKL_SCLK_OFS SKL_MAX_SSP
  31. #define SKL_SCLKFS_OFS (SKL_SCLK_OFS + SKL_MAX_SSP)
  32. enum skl_clk_type {
  33. SKL_MCLK,
  34. SKL_SCLK,
  35. SKL_SCLK_FS,
  36. };
  37. enum skl_clk_src_type {
  38. SKL_XTAL,
  39. SKL_CARDINAL,
  40. SKL_PLL,
  41. };
  42. struct skl_clk_parent_src {
  43. u8 clk_id;
  44. const char *name;
  45. unsigned long rate;
  46. const char *parent_name;
  47. };
  48. struct skl_tlv_hdr {
  49. u32 type;
  50. u32 size;
  51. };
  52. struct skl_dmactrl_mclk_cfg {
  53. struct skl_tlv_hdr hdr;
  54. /* DMA Clk TLV params */
  55. u32 clk_warm_up:16;
  56. u32 mclk:1;
  57. u32 warm_up_over:1;
  58. u32 rsvd0:14;
  59. u32 clk_stop_delay:16;
  60. u32 keep_running:1;
  61. u32 clk_stop_over:1;
  62. u32 rsvd1:14;
  63. };
  64. struct skl_dmactrl_sclkfs_cfg {
  65. struct skl_tlv_hdr hdr;
  66. /* DMA SClk&FS TLV params */
  67. u32 sampling_frequency;
  68. u32 bit_depth;
  69. u32 channel_map;
  70. u32 channel_config;
  71. u32 interleaving_style;
  72. u32 number_of_channels : 8;
  73. u32 valid_bit_depth : 8;
  74. u32 sample_type : 8;
  75. u32 reserved : 8;
  76. };
  77. union skl_clk_ctrl_ipc {
  78. struct skl_dmactrl_mclk_cfg mclk;
  79. struct skl_dmactrl_sclkfs_cfg sclk_fs;
  80. };
  81. struct skl_clk_rate_cfg_table {
  82. unsigned long rate;
  83. union skl_clk_ctrl_ipc dma_ctl_ipc;
  84. void *config;
  85. };
  86. /*
  87. * rate for mclk will be in rates[0]. For sclk and sclkfs, rates[] store
  88. * all possible clocks ssp can generate for that platform.
  89. */
  90. struct skl_ssp_clk {
  91. const char *name;
  92. const char *parent_name;
  93. struct skl_clk_rate_cfg_table rate_cfg[SKL_MAX_CLK_RATES];
  94. };
  95. struct skl_clk_pdata {
  96. struct skl_clk_parent_src *parent_clks;
  97. int num_clks;
  98. struct skl_ssp_clk *ssp_clks;
  99. void *pvt_data;
  100. };
  101. #endif /* SOUND_SOC_SKL_SSP_CLK_H */