0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef __SOUND_SOC_SKL_H
0013 #define __SOUND_SOC_SKL_H
0014
0015 #include <sound/hda_register.h>
0016 #include <sound/hdaudio_ext.h>
0017 #include <sound/hda_codec.h>
0018 #include <sound/soc.h>
0019 #include "skl-ssp-clk.h"
0020 #include "skl-sst-ipc.h"
0021
0022 #define SKL_SUSPEND_DELAY 2000
0023
0024 #define SKL_MAX_ASTATE_CFG 3
0025
0026 #define AZX_PCIREG_PGCTL 0x44
0027 #define AZX_PGCTL_LSRMD_MASK (1 << 4)
0028 #define AZX_PGCTL_ADSPPGD BIT(2)
0029 #define AZX_PCIREG_CGCTL 0x48
0030 #define AZX_CGCTL_MISCBDCGE_MASK (1 << 6)
0031 #define AZX_CGCTL_ADSPDCGE BIT(1)
0032
0033 #define AZX_REG_VS_D0I3C_CIP 0x1
0034 #define AZX_REG_VS_D0I3C_I3 0x4
0035 #define SKL_MAX_DMACTRL_CFG 18
0036 #define DMA_CLK_CONTROLS 1
0037 #define DMA_TRANSMITION_START 2
0038 #define DMA_TRANSMITION_STOP 3
0039
0040 #define AZX_VS_EM2_DUM BIT(23)
0041 #define AZX_REG_VS_EM2_L1SEN BIT(13)
0042
0043 struct skl_debug;
0044
0045 struct skl_astate_param {
0046 u32 kcps;
0047 u32 clk_src;
0048 };
0049
0050 struct skl_astate_config {
0051 u32 count;
0052 struct skl_astate_param astate_table[];
0053 };
0054
0055 struct skl_fw_config {
0056 struct skl_astate_config *astate_cfg;
0057 };
0058
0059 struct skl_dev {
0060 struct hda_bus hbus;
0061 struct pci_dev *pci;
0062
0063 unsigned int init_done:1;
0064 struct platform_device *dmic_dev;
0065 struct platform_device *i2s_dev;
0066 struct platform_device *clk_dev;
0067 struct snd_soc_component *component;
0068 struct snd_soc_dai_driver *dais;
0069
0070 struct nhlt_acpi_table *nhlt;
0071
0072 struct list_head ppl_list;
0073 struct list_head bind_list;
0074
0075 const char *fw_name;
0076 char tplg_name[64];
0077 unsigned short pci_id;
0078
0079 int supend_active;
0080
0081 struct work_struct probe_work;
0082
0083 struct skl_debug *debugfs;
0084 u8 nr_modules;
0085 struct skl_module **modules;
0086 bool use_tplg_pcm;
0087 struct skl_fw_config cfg;
0088 struct snd_soc_acpi_mach *mach;
0089
0090 struct device *dev;
0091 struct sst_dsp *dsp;
0092
0093
0094 wait_queue_head_t boot_wait;
0095 bool boot_complete;
0096
0097
0098 wait_queue_head_t mod_load_wait;
0099 bool mod_load_complete;
0100 bool mod_load_status;
0101
0102
0103 struct sst_generic_ipc ipc;
0104
0105
0106 void (*enable_miscbdcge)(struct device *dev, bool enable);
0107
0108 bool miscbdcg_disabled;
0109
0110
0111 struct list_head uuid_list;
0112
0113
0114 bool fw_loaded;
0115
0116
0117 bool is_first_boot;
0118
0119
0120 struct skl_dsp_cores cores;
0121
0122
0123 struct skl_lib_info lib_info[SKL_MAX_LIB];
0124 int lib_count;
0125
0126
0127 void (*update_d0i3c)(struct device *dev, bool enable);
0128
0129 struct skl_d0i3_data d0i3;
0130
0131 const struct skl_dsp_ops *dsp_ops;
0132
0133
0134 void (*clock_power_gating)(struct device *dev, bool enable);
0135 };
0136
0137 #define skl_to_bus(s) (&(s)->hbus.core)
0138 #define bus_to_skl(bus) container_of(bus, struct skl_dev, hbus.core)
0139
0140 #define skl_to_hbus(s) (&(s)->hbus)
0141 #define hbus_to_skl(hbus) container_of((hbus), struct skl_dev, (hbus))
0142
0143
0144 struct skl_dma_params {
0145 u32 format;
0146 u8 stream_tag;
0147 };
0148
0149 struct skl_machine_pdata {
0150 bool use_tplg_pcm;
0151 };
0152
0153 struct skl_dsp_ops {
0154 int id;
0155 unsigned int num_cores;
0156 struct skl_dsp_loader_ops (*loader_ops)(void);
0157 int (*init)(struct device *dev, void __iomem *mmio_base,
0158 int irq, const char *fw_name,
0159 struct skl_dsp_loader_ops loader_ops,
0160 struct skl_dev **skl_sst);
0161 int (*init_fw)(struct device *dev, struct skl_dev *skl);
0162 void (*cleanup)(struct device *dev, struct skl_dev *skl);
0163 };
0164
0165 int skl_platform_unregister(struct device *dev);
0166 int skl_platform_register(struct device *dev);
0167
0168 int skl_nhlt_update_topology_bin(struct skl_dev *skl);
0169 int skl_init_dsp(struct skl_dev *skl);
0170 int skl_free_dsp(struct skl_dev *skl);
0171 int skl_suspend_late_dsp(struct skl_dev *skl);
0172 int skl_suspend_dsp(struct skl_dev *skl);
0173 int skl_resume_dsp(struct skl_dev *skl);
0174 void skl_cleanup_resources(struct skl_dev *skl);
0175 const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id);
0176 void skl_update_d0i3c(struct device *dev, bool enable);
0177 int skl_nhlt_create_sysfs(struct skl_dev *skl);
0178 void skl_nhlt_remove_sysfs(struct skl_dev *skl);
0179 void skl_get_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks);
0180 struct skl_clk_parent_src *skl_get_parent_clk(u8 clk_id);
0181 int skl_dsp_set_dma_control(struct skl_dev *skl, u32 *caps,
0182 u32 caps_size, u32 node_id);
0183
0184 struct skl_module_cfg;
0185
0186 #ifdef CONFIG_DEBUG_FS
0187 struct skl_debug *skl_debugfs_init(struct skl_dev *skl);
0188 void skl_debugfs_exit(struct skl_dev *skl);
0189 void skl_debug_init_module(struct skl_debug *d,
0190 struct snd_soc_dapm_widget *w,
0191 struct skl_module_cfg *mconfig);
0192 #else
0193 static inline struct skl_debug *skl_debugfs_init(struct skl_dev *skl)
0194 {
0195 return NULL;
0196 }
0197
0198 static inline void skl_debugfs_exit(struct skl_dev *skl)
0199 {}
0200
0201 static inline void skl_debug_init_module(struct skl_debug *d,
0202 struct snd_soc_dapm_widget *w,
0203 struct skl_module_cfg *mconfig)
0204 {}
0205 #endif
0206
0207 #endif