skl.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * skl.h - HD Audio skylake defintions.
  3. *
  4. * Copyright (C) 2015 Intel Corp
  5. * Author: Jeeja KP <jeeja.kp@intel.com>
  6. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; version 2 of the License.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. *
  19. */
  20. #ifndef __SOUND_SOC_SKL_H
  21. #define __SOUND_SOC_SKL_H
  22. #include <sound/hda_register.h>
  23. #include <sound/hdaudio_ext.h>
  24. #include "skl-nhlt.h"
  25. #define SKL_SUSPEND_DELAY 2000
  26. /* Vendor Specific Registers */
  27. #define AZX_REG_VS_EM1 0x1000
  28. #define AZX_REG_VS_INRC 0x1004
  29. #define AZX_REG_VS_OUTRC 0x1008
  30. #define AZX_REG_VS_FIFOTRK 0x100C
  31. #define AZX_REG_VS_FIFOTRK2 0x1010
  32. #define AZX_REG_VS_EM2 0x1030
  33. #define AZX_REG_VS_EM3L 0x1038
  34. #define AZX_REG_VS_EM3U 0x103C
  35. #define AZX_REG_VS_EM4L 0x1040
  36. #define AZX_REG_VS_EM4U 0x1044
  37. #define AZX_REG_VS_LTRC 0x1048
  38. #define AZX_REG_VS_D0I3C 0x104A
  39. #define AZX_REG_VS_PCE 0x104B
  40. #define AZX_REG_VS_L2MAGC 0x1050
  41. #define AZX_REG_VS_L2LAHPT 0x1054
  42. #define AZX_REG_VS_SDXDPIB_XBASE 0x1084
  43. #define AZX_REG_VS_SDXDPIB_XINTERVAL 0x20
  44. #define AZX_REG_VS_SDXEFIFOS_XBASE 0x1094
  45. #define AZX_REG_VS_SDXEFIFOS_XINTERVAL 0x20
  46. #define AZX_PCIREG_PGCTL 0x44
  47. #define AZX_PGCTL_LSRMD_MASK (1 << 4)
  48. #define AZX_PCIREG_CGCTL 0x48
  49. #define AZX_CGCTL_MISCBDCGE_MASK (1 << 6)
  50. /* D0I3C Register fields */
  51. #define AZX_REG_VS_D0I3C_CIP 0x1 /* Command in progress */
  52. #define AZX_REG_VS_D0I3C_I3 0x4 /* D0i3 enable */
  53. struct skl_dsp_resource {
  54. u32 max_mcps;
  55. u32 max_mem;
  56. u32 mcps;
  57. u32 mem;
  58. };
  59. struct skl {
  60. struct hdac_ext_bus ebus;
  61. struct pci_dev *pci;
  62. unsigned int init_failed:1; /* delayed init failed */
  63. struct platform_device *dmic_dev;
  64. struct platform_device *i2s_dev;
  65. struct snd_soc_platform *platform;
  66. struct nhlt_acpi_table *nhlt; /* nhlt ptr */
  67. struct skl_sst *skl_sst; /* sst skl ctx */
  68. struct skl_dsp_resource resource;
  69. struct list_head ppl_list;
  70. const char *fw_name;
  71. char tplg_name[64];
  72. unsigned short pci_id;
  73. const struct firmware *tplg;
  74. int supend_active;
  75. };
  76. #define skl_to_ebus(s) (&(s)->ebus)
  77. #define ebus_to_skl(sbus) \
  78. container_of(sbus, struct skl, sbus)
  79. /* to pass dai dma data */
  80. struct skl_dma_params {
  81. u32 format;
  82. u8 stream_tag;
  83. };
  84. /* to pass dmic data */
  85. struct skl_machine_pdata {
  86. u32 dmic_num;
  87. };
  88. struct skl_dsp_ops {
  89. int id;
  90. struct skl_dsp_loader_ops (*loader_ops)(void);
  91. int (*init)(struct device *dev, void __iomem *mmio_base,
  92. int irq, const char *fw_name,
  93. struct skl_dsp_loader_ops loader_ops,
  94. struct skl_sst **skl_sst);
  95. int (*init_fw)(struct device *dev, struct skl_sst *ctx);
  96. void (*cleanup)(struct device *dev, struct skl_sst *ctx);
  97. };
  98. int skl_platform_unregister(struct device *dev);
  99. int skl_platform_register(struct device *dev);
  100. struct nhlt_acpi_table *skl_nhlt_init(struct device *dev);
  101. void skl_nhlt_free(struct nhlt_acpi_table *addr);
  102. struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
  103. u8 link_type, u8 s_fmt, u8 no_ch, u32 s_rate, u8 dirn);
  104. int skl_get_dmic_geo(struct skl *skl);
  105. int skl_nhlt_update_topology_bin(struct skl *skl);
  106. int skl_init_dsp(struct skl *skl);
  107. int skl_free_dsp(struct skl *skl);
  108. int skl_suspend_late_dsp(struct skl *skl);
  109. int skl_suspend_dsp(struct skl *skl);
  110. int skl_resume_dsp(struct skl *skl);
  111. void skl_cleanup_resources(struct skl *skl);
  112. const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id);
  113. void skl_update_d0i3c(struct device *dev, bool enable);
  114. #endif /* __SOUND_SOC_SKL_H */