2019-05-29 21:17:59 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2015-07-09 16:50:08 +07:00
|
|
|
/*
|
|
|
|
* skl.h - HD Audio skylake defintions.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Intel Corp
|
|
|
|
* Author: Jeeja KP <jeeja.kp@intel.com>
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
*
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SOUND_SOC_SKL_H
|
|
|
|
#define __SOUND_SOC_SKL_H
|
|
|
|
|
|
|
|
#include <sound/hda_register.h>
|
|
|
|
#include <sound/hdaudio_ext.h>
|
2018-08-23 03:25:02 +07:00
|
|
|
#include <sound/hda_codec.h>
|
2017-06-30 10:36:06 +07:00
|
|
|
#include <sound/soc.h>
|
2015-07-22 01:23:55 +07:00
|
|
|
#include "skl-nhlt.h"
|
2017-11-22 19:09:46 +07:00
|
|
|
#include "skl-ssp-clk.h"
|
2015-07-09 16:50:08 +07:00
|
|
|
|
|
|
|
#define SKL_SUSPEND_DELAY 2000
|
|
|
|
|
2017-12-06 18:04:02 +07:00
|
|
|
#define SKL_MAX_ASTATE_CFG 3
|
|
|
|
|
2016-06-03 19:59:37 +07:00
|
|
|
#define AZX_PCIREG_PGCTL 0x44
|
|
|
|
#define AZX_PGCTL_LSRMD_MASK (1 << 4)
|
2018-03-13 10:32:25 +07:00
|
|
|
#define AZX_PGCTL_ADSPPGD BIT(2)
|
2015-12-18 16:42:03 +07:00
|
|
|
#define AZX_PCIREG_CGCTL 0x48
|
|
|
|
#define AZX_CGCTL_MISCBDCGE_MASK (1 << 6)
|
2018-03-13 10:32:25 +07:00
|
|
|
#define AZX_CGCTL_ADSPDCGE BIT(1)
|
2016-11-03 18:37:16 +07:00
|
|
|
/* D0I3C Register fields */
|
|
|
|
#define AZX_REG_VS_D0I3C_CIP 0x1 /* Command in progress */
|
|
|
|
#define AZX_REG_VS_D0I3C_I3 0x4 /* D0i3 enable */
|
2018-01-04 18:25:14 +07:00
|
|
|
#define SKL_MAX_DMACTRL_CFG 18
|
|
|
|
#define DMA_CLK_CONTROLS 1
|
|
|
|
#define DMA_TRANSMITION_START 2
|
|
|
|
#define DMA_TRANSMITION_STOP 3
|
2015-12-18 16:42:03 +07:00
|
|
|
|
2019-06-14 02:04:30 +07:00
|
|
|
#define AZX_VS_EM2_DUM BIT(23)
|
2018-03-13 10:32:25 +07:00
|
|
|
#define AZX_REG_VS_EM2_L1SEN BIT(13)
|
|
|
|
|
2015-10-07 17:31:52 +07:00
|
|
|
struct skl_dsp_resource {
|
|
|
|
u32 max_mcps;
|
|
|
|
u32 max_mem;
|
|
|
|
u32 mcps;
|
|
|
|
u32 mem;
|
|
|
|
};
|
|
|
|
|
2017-06-30 10:36:05 +07:00
|
|
|
struct skl_debug;
|
|
|
|
|
2017-12-06 18:04:02 +07:00
|
|
|
struct skl_astate_param {
|
|
|
|
u32 kcps;
|
|
|
|
u32 clk_src;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct skl_astate_config {
|
|
|
|
u32 count;
|
|
|
|
struct skl_astate_param astate_table[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct skl_fw_config {
|
|
|
|
struct skl_astate_config *astate_cfg;
|
|
|
|
};
|
|
|
|
|
2015-07-09 16:50:08 +07:00
|
|
|
struct skl {
|
2018-08-23 03:25:02 +07:00
|
|
|
struct hda_bus hbus;
|
2015-07-09 16:50:08 +07:00
|
|
|
struct pci_dev *pci;
|
|
|
|
|
2017-05-04 15:39:10 +07:00
|
|
|
unsigned int init_done:1; /* delayed init status */
|
2015-07-09 16:50:08 +07:00
|
|
|
struct platform_device *dmic_dev;
|
2015-11-05 23:04:13 +07:00
|
|
|
struct platform_device *i2s_dev;
|
2017-11-22 19:09:46 +07:00
|
|
|
struct platform_device *clk_dev;
|
2018-01-29 09:41:43 +07:00
|
|
|
struct snd_soc_component *component;
|
2017-10-09 12:50:30 +07:00
|
|
|
struct snd_soc_dai_driver *dais;
|
2015-07-22 01:23:55 +07:00
|
|
|
|
2016-05-05 12:49:19 +07:00
|
|
|
struct nhlt_acpi_table *nhlt; /* nhlt ptr */
|
2015-07-22 01:23:56 +07:00
|
|
|
struct skl_sst *skl_sst; /* sst skl ctx */
|
2015-10-07 17:31:52 +07:00
|
|
|
|
|
|
|
struct skl_dsp_resource resource;
|
|
|
|
struct list_head ppl_list;
|
2017-03-25 00:40:34 +07:00
|
|
|
struct list_head bind_list;
|
2015-11-05 23:04:15 +07:00
|
|
|
|
|
|
|
const char *fw_name;
|
2016-02-19 13:12:34 +07:00
|
|
|
char tplg_name[64];
|
|
|
|
unsigned short pci_id;
|
2016-01-05 18:46:04 +07:00
|
|
|
const struct firmware *tplg;
|
2015-12-04 01:00:00 +07:00
|
|
|
|
|
|
|
int supend_active;
|
2017-05-04 15:39:10 +07:00
|
|
|
|
|
|
|
struct work_struct probe_work;
|
2017-06-30 10:36:05 +07:00
|
|
|
|
|
|
|
struct skl_debug *debugfs;
|
2017-08-23 21:03:51 +07:00
|
|
|
u8 nr_modules;
|
|
|
|
struct skl_module **modules;
|
2017-10-09 12:50:30 +07:00
|
|
|
bool use_tplg_pcm;
|
2017-12-06 18:04:02 +07:00
|
|
|
struct skl_fw_config cfg;
|
2017-12-18 12:16:50 +07:00
|
|
|
struct snd_soc_acpi_mach *mach;
|
2015-07-09 16:50:08 +07:00
|
|
|
};
|
|
|
|
|
2018-08-23 03:25:02 +07:00
|
|
|
#define skl_to_bus(s) (&(s)->hbus.core)
|
|
|
|
#define bus_to_skl(bus) container_of(bus, struct skl, hbus.core)
|
|
|
|
|
|
|
|
#define skl_to_hbus(s) (&(s)->hbus)
|
|
|
|
#define hbus_to_skl(hbus) container_of((hbus), struct skl, (hbus))
|
2015-07-09 16:50:08 +07:00
|
|
|
|
|
|
|
/* to pass dai dma data */
|
|
|
|
struct skl_dma_params {
|
|
|
|
u32 format;
|
|
|
|
u8 stream_tag;
|
|
|
|
};
|
|
|
|
|
2016-05-27 11:30:15 +07:00
|
|
|
struct skl_machine_pdata {
|
2017-10-09 12:50:30 +07:00
|
|
|
bool use_tplg_pcm; /* use dais and dai links from topology */
|
2016-05-27 11:30:15 +07:00
|
|
|
};
|
|
|
|
|
2016-03-11 11:42:53 +07:00
|
|
|
struct skl_dsp_ops {
|
|
|
|
int id;
|
2017-08-02 23:21:12 +07:00
|
|
|
unsigned int num_cores;
|
2016-03-11 11:42:53 +07:00
|
|
|
struct skl_dsp_loader_ops (*loader_ops)(void);
|
|
|
|
int (*init)(struct device *dev, void __iomem *mmio_base,
|
|
|
|
int irq, const char *fw_name,
|
|
|
|
struct skl_dsp_loader_ops loader_ops,
|
|
|
|
struct skl_sst **skl_sst);
|
2016-07-26 19:36:42 +07:00
|
|
|
int (*init_fw)(struct device *dev, struct skl_sst *ctx);
|
2016-03-11 11:42:53 +07:00
|
|
|
void (*cleanup)(struct device *dev, struct skl_sst *ctx);
|
|
|
|
};
|
|
|
|
|
2015-07-09 16:50:08 +07:00
|
|
|
int skl_platform_unregister(struct device *dev);
|
|
|
|
int skl_platform_register(struct device *dev);
|
|
|
|
|
2016-05-05 12:49:19 +07:00
|
|
|
struct nhlt_acpi_table *skl_nhlt_init(struct device *dev);
|
|
|
|
void skl_nhlt_free(struct nhlt_acpi_table *addr);
|
2015-07-22 01:23:55 +07:00
|
|
|
struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
|
2017-02-09 18:14:01 +07:00
|
|
|
u8 link_type, u8 s_fmt, u8 no_ch,
|
|
|
|
u32 s_rate, u8 dirn, u8 dev_type);
|
2015-07-22 01:23:56 +07:00
|
|
|
|
2016-05-27 11:30:15 +07:00
|
|
|
int skl_get_dmic_geo(struct skl *skl);
|
2016-02-19 13:12:34 +07:00
|
|
|
int skl_nhlt_update_topology_bin(struct skl *skl);
|
2015-07-22 01:23:56 +07:00
|
|
|
int skl_init_dsp(struct skl *skl);
|
2016-03-11 11:42:53 +07:00
|
|
|
int skl_free_dsp(struct skl *skl);
|
2016-11-03 18:37:21 +07:00
|
|
|
int skl_suspend_late_dsp(struct skl *skl);
|
2015-07-22 01:23:56 +07:00
|
|
|
int skl_suspend_dsp(struct skl *skl);
|
|
|
|
int skl_resume_dsp(struct skl *skl);
|
2016-06-03 19:59:39 +07:00
|
|
|
void skl_cleanup_resources(struct skl *skl);
|
2016-07-26 19:36:41 +07:00
|
|
|
const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id);
|
2016-11-03 18:37:16 +07:00
|
|
|
void skl_update_d0i3c(struct device *dev, bool enable);
|
2017-01-11 18:01:02 +07:00
|
|
|
int skl_nhlt_create_sysfs(struct skl *skl);
|
|
|
|
void skl_nhlt_remove_sysfs(struct skl *skl);
|
2017-11-22 19:09:46 +07:00
|
|
|
void skl_get_clks(struct skl *skl, struct skl_ssp_clk *ssp_clks);
|
|
|
|
struct skl_clk_parent_src *skl_get_parent_clk(u8 clk_id);
|
2018-01-04 18:25:14 +07:00
|
|
|
int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps,
|
|
|
|
u32 caps_size, u32 node_id);
|
2016-11-03 18:37:16 +07:00
|
|
|
|
2017-06-30 10:36:06 +07:00
|
|
|
struct skl_module_cfg;
|
|
|
|
|
2017-06-30 10:36:05 +07:00
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
struct skl_debug *skl_debugfs_init(struct skl *skl);
|
2019-06-17 18:36:39 +07:00
|
|
|
void skl_debugfs_exit(struct skl *skl);
|
2017-06-30 10:36:06 +07:00
|
|
|
void skl_debug_init_module(struct skl_debug *d,
|
|
|
|
struct snd_soc_dapm_widget *w,
|
|
|
|
struct skl_module_cfg *mconfig);
|
2017-06-30 10:36:05 +07:00
|
|
|
#else
|
|
|
|
static inline struct skl_debug *skl_debugfs_init(struct skl *skl)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2019-06-17 18:36:39 +07:00
|
|
|
|
|
|
|
static inline void skl_debugfs_exit(struct skl *skl)
|
|
|
|
{}
|
|
|
|
|
2017-06-30 10:36:06 +07:00
|
|
|
static inline void skl_debug_init_module(struct skl_debug *d,
|
|
|
|
struct snd_soc_dapm_widget *w,
|
|
|
|
struct skl_module_cfg *mconfig)
|
|
|
|
{}
|
2017-06-30 10:36:05 +07:00
|
|
|
#endif
|
|
|
|
|
2015-07-09 16:50:08 +07:00
|
|
|
#endif /* __SOUND_SOC_SKL_H */
|