skl.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. struct skl_dsp_resource {
  51. u32 max_mcps;
  52. u32 max_mem;
  53. u32 mcps;
  54. u32 mem;
  55. };
  56. struct skl {
  57. struct hdac_ext_bus ebus;
  58. struct pci_dev *pci;
  59. unsigned int init_failed:1; /* delayed init failed */
  60. struct platform_device *dmic_dev;
  61. struct platform_device *i2s_dev;
  62. struct snd_soc_platform *platform;
  63. struct nhlt_acpi_table *nhlt; /* nhlt ptr */
  64. struct skl_sst *skl_sst; /* sst skl ctx */
  65. struct skl_dsp_resource resource;
  66. struct list_head ppl_list;
  67. const char *fw_name;
  68. char tplg_name[64];
  69. unsigned short pci_id;
  70. const struct firmware *tplg;
  71. int supend_active;
  72. };
  73. #define skl_to_ebus(s) (&(s)->ebus)
  74. #define ebus_to_skl(sbus) \
  75. container_of(sbus, struct skl, sbus)
  76. /* to pass dai dma data */
  77. struct skl_dma_params {
  78. u32 format;
  79. u8 stream_tag;
  80. };
  81. /* to pass dmic data */
  82. struct skl_machine_pdata {
  83. u32 dmic_num;
  84. };
  85. struct skl_dsp_ops {
  86. int id;
  87. struct skl_dsp_loader_ops (*loader_ops)(void);
  88. int (*init)(struct device *dev, void __iomem *mmio_base,
  89. int irq, const char *fw_name,
  90. struct skl_dsp_loader_ops loader_ops,
  91. struct skl_sst **skl_sst);
  92. int (*init_fw)(struct device *dev, struct skl_sst *ctx);
  93. void (*cleanup)(struct device *dev, struct skl_sst *ctx);
  94. };
  95. int skl_platform_unregister(struct device *dev);
  96. int skl_platform_register(struct device *dev);
  97. struct nhlt_acpi_table *skl_nhlt_init(struct device *dev);
  98. void skl_nhlt_free(struct nhlt_acpi_table *addr);
  99. struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
  100. u8 link_type, u8 s_fmt, u8 no_ch, u32 s_rate, u8 dirn);
  101. int skl_get_dmic_geo(struct skl *skl);
  102. int skl_nhlt_update_topology_bin(struct skl *skl);
  103. int skl_init_dsp(struct skl *skl);
  104. int skl_free_dsp(struct skl *skl);
  105. int skl_suspend_dsp(struct skl *skl);
  106. int skl_resume_dsp(struct skl *skl);
  107. void skl_cleanup_resources(struct skl *skl);
  108. const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id);
  109. #endif /* __SOUND_SOC_SKL_H */