skl-ssp-clk.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * skl-ssp-clk.h - Skylake ssp clock information and ipc structure
  4. *
  5. * Copyright (C) 2017 Intel Corp
  6. * Author: Jaikrishna Nemallapudi <[email protected]>
  7. * Author: Subhransu S. Prusty <[email protected]>
  8. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. *
  10. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11. */
  12. #ifndef SOUND_SOC_SKL_SSP_CLK_H
  13. #define SOUND_SOC_SKL_SSP_CLK_H
  14. #define SKL_MAX_SSP 6
  15. /* xtal/cardinal/pll, parent of ssp clocks and mclk */
  16. #define SKL_MAX_CLK_SRC 3
  17. #define SKL_MAX_SSP_CLK_TYPES 3 /* mclk, sclk, sclkfs */
  18. #define SKL_MAX_CLK_CNT (SKL_MAX_SSP * SKL_MAX_SSP_CLK_TYPES)
  19. /* Max number of configurations supported for each clock */
  20. #define SKL_MAX_CLK_RATES 10
  21. #define SKL_SCLK_OFS SKL_MAX_SSP
  22. #define SKL_SCLKFS_OFS (SKL_SCLK_OFS + SKL_MAX_SSP)
  23. enum skl_clk_type {
  24. SKL_MCLK,
  25. SKL_SCLK,
  26. SKL_SCLK_FS,
  27. };
  28. enum skl_clk_src_type {
  29. SKL_XTAL,
  30. SKL_CARDINAL,
  31. SKL_PLL,
  32. };
  33. struct skl_clk_parent_src {
  34. u8 clk_id;
  35. const char *name;
  36. unsigned long rate;
  37. const char *parent_name;
  38. };
  39. struct skl_tlv_hdr {
  40. u32 type;
  41. u32 size;
  42. };
  43. struct skl_dmactrl_mclk_cfg {
  44. struct skl_tlv_hdr hdr;
  45. /* DMA Clk TLV params */
  46. u32 clk_warm_up:16;
  47. u32 mclk:1;
  48. u32 warm_up_over:1;
  49. u32 rsvd0:14;
  50. u32 clk_stop_delay:16;
  51. u32 keep_running:1;
  52. u32 clk_stop_over:1;
  53. u32 rsvd1:14;
  54. };
  55. struct skl_dmactrl_sclkfs_cfg {
  56. struct skl_tlv_hdr hdr;
  57. /* DMA SClk&FS TLV params */
  58. u32 sampling_frequency;
  59. u32 bit_depth;
  60. u32 channel_map;
  61. u32 channel_config;
  62. u32 interleaving_style;
  63. u32 number_of_channels : 8;
  64. u32 valid_bit_depth : 8;
  65. u32 sample_type : 8;
  66. u32 reserved : 8;
  67. };
  68. union skl_clk_ctrl_ipc {
  69. struct skl_dmactrl_mclk_cfg mclk;
  70. struct skl_dmactrl_sclkfs_cfg sclk_fs;
  71. };
  72. struct skl_clk_rate_cfg_table {
  73. unsigned long rate;
  74. union skl_clk_ctrl_ipc dma_ctl_ipc;
  75. void *config;
  76. };
  77. /*
  78. * rate for mclk will be in rates[0]. For sclk and sclkfs, rates[] store
  79. * all possible clocks ssp can generate for that platform.
  80. */
  81. struct skl_ssp_clk {
  82. const char *name;
  83. const char *parent_name;
  84. struct skl_clk_rate_cfg_table rate_cfg[SKL_MAX_CLK_RATES];
  85. };
  86. struct skl_clk_pdata {
  87. struct skl_clk_parent_src *parent_clks;
  88. int num_clks;
  89. struct skl_ssp_clk *ssp_clks;
  90. void *pvt_data;
  91. };
  92. #endif /* SOUND_SOC_SKL_SSP_CLK_H */