2 * skl.h - HD Audio skylake defintions.
4 * Copyright (C) 2015 Intel Corp
5 * Author: Jeeja KP <jeeja.kp@intel.com>
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
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.
17 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 #ifndef __SOUND_SOC_SKL_H
22 #define __SOUND_SOC_SKL_H
24 #include <sound/hda_register.h>
25 #include <sound/hdaudio_ext.h>
26 #include <sound/soc.h>
28 #include "skl-ssp-clk.h"
30 #define SKL_SUSPEND_DELAY 2000
32 #define SKL_MAX_ASTATE_CFG 3
34 #define AZX_PCIREG_PGCTL 0x44
35 #define AZX_PGCTL_LSRMD_MASK (1 << 4)
36 #define AZX_PCIREG_CGCTL 0x48
37 #define AZX_CGCTL_MISCBDCGE_MASK (1 << 6)
38 /* D0I3C Register fields */
39 #define AZX_REG_VS_D0I3C_CIP 0x1 /* Command in progress */
40 #define AZX_REG_VS_D0I3C_I3 0x4 /* D0i3 enable */
41 #define SKL_MAX_DMACTRL_CFG 18
42 #define DMA_CLK_CONTROLS 1
43 #define DMA_TRANSMITION_START 2
44 #define DMA_TRANSMITION_STOP 3
46 struct skl_dsp_resource
{
55 struct skl_astate_param
{
60 struct skl_astate_config
{
62 struct skl_astate_param astate_table
[0];
65 struct skl_fw_config
{
66 struct skl_astate_config
*astate_cfg
;
70 struct hdac_ext_bus ebus
;
73 unsigned int init_done
:1; /* delayed init status */
74 struct platform_device
*dmic_dev
;
75 struct platform_device
*i2s_dev
;
76 struct platform_device
*clk_dev
;
77 struct snd_soc_platform
*platform
;
78 struct snd_soc_dai_driver
*dais
;
80 struct nhlt_acpi_table
*nhlt
; /* nhlt ptr */
81 struct skl_sst
*skl_sst
; /* sst skl ctx */
83 struct skl_dsp_resource resource
;
84 struct list_head ppl_list
;
85 struct list_head bind_list
;
89 unsigned short pci_id
;
90 const struct firmware
*tplg
;
94 struct work_struct probe_work
;
96 struct skl_debug
*debugfs
;
98 struct skl_module
**modules
;
100 struct skl_fw_config cfg
;
101 struct snd_soc_acpi_mach
*mach
;
104 #define skl_to_ebus(s) (&(s)->ebus)
105 #define ebus_to_skl(sbus) \
106 container_of(sbus, struct skl, sbus)
108 /* to pass dai dma data */
109 struct skl_dma_params
{
114 struct skl_machine_pdata
{
116 bool use_tplg_pcm
; /* use dais and dai links from topology */
121 unsigned int num_cores
;
122 struct skl_dsp_loader_ops (*loader_ops
)(void);
123 int (*init
)(struct device
*dev
, void __iomem
*mmio_base
,
124 int irq
, const char *fw_name
,
125 struct skl_dsp_loader_ops loader_ops
,
126 struct skl_sst
**skl_sst
);
127 int (*init_fw
)(struct device
*dev
, struct skl_sst
*ctx
);
128 void (*cleanup
)(struct device
*dev
, struct skl_sst
*ctx
);
131 int skl_platform_unregister(struct device
*dev
);
132 int skl_platform_register(struct device
*dev
);
134 struct nhlt_acpi_table
*skl_nhlt_init(struct device
*dev
);
135 void skl_nhlt_free(struct nhlt_acpi_table
*addr
);
136 struct nhlt_specific_cfg
*skl_get_ep_blob(struct skl
*skl
, u32 instance
,
137 u8 link_type
, u8 s_fmt
, u8 no_ch
,
138 u32 s_rate
, u8 dirn
, u8 dev_type
);
140 int skl_get_dmic_geo(struct skl
*skl
);
141 int skl_nhlt_update_topology_bin(struct skl
*skl
);
142 int skl_init_dsp(struct skl
*skl
);
143 int skl_free_dsp(struct skl
*skl
);
144 int skl_suspend_late_dsp(struct skl
*skl
);
145 int skl_suspend_dsp(struct skl
*skl
);
146 int skl_resume_dsp(struct skl
*skl
);
147 void skl_cleanup_resources(struct skl
*skl
);
148 const struct skl_dsp_ops
*skl_get_dsp_ops(int pci_id
);
149 void skl_update_d0i3c(struct device
*dev
, bool enable
);
150 int skl_nhlt_create_sysfs(struct skl
*skl
);
151 void skl_nhlt_remove_sysfs(struct skl
*skl
);
152 void skl_get_clks(struct skl
*skl
, struct skl_ssp_clk
*ssp_clks
);
153 struct skl_clk_parent_src
*skl_get_parent_clk(u8 clk_id
);
154 int skl_dsp_set_dma_control(struct skl_sst
*ctx
, u32
*caps
,
155 u32 caps_size
, u32 node_id
);
157 struct skl_module_cfg
;
159 #ifdef CONFIG_DEBUG_FS
160 struct skl_debug
*skl_debugfs_init(struct skl
*skl
);
161 void skl_debug_init_module(struct skl_debug
*d
,
162 struct snd_soc_dapm_widget
*w
,
163 struct skl_module_cfg
*mconfig
);
165 static inline struct skl_debug
*skl_debugfs_init(struct skl
*skl
)
169 static inline void skl_debug_init_module(struct skl_debug
*d
,
170 struct snd_soc_dapm_widget
*w
,
171 struct skl_module_cfg
*mconfig
)
175 #endif /* __SOUND_SOC_SKL_H */