2015-07-09 17:50:08 +08:00
|
|
|
/*
|
|
|
|
* skl.h - HD Audio skylake defintions.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Intel Corp
|
|
|
|
* Author: Jeeja KP <jeeja.kp@intel.com>
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SOUND_SOC_SKL_H
|
|
|
|
#define __SOUND_SOC_SKL_H
|
|
|
|
|
|
|
|
#include <sound/hda_register.h>
|
|
|
|
#include <sound/hdaudio_ext.h>
|
2018-08-23 04:25:02 +08:00
|
|
|
#include <sound/hda_codec.h>
|
2017-06-30 11:36:06 +08:00
|
|
|
#include <sound/soc.h>
|
2015-07-22 02:23:55 +08:00
|
|
|
#include "skl-nhlt.h"
|
2017-11-22 20:09:46 +08:00
|
|
|
#include "skl-ssp-clk.h"
|
2015-07-09 17:50:08 +08:00
|
|
|
|
|
|
|
#define SKL_SUSPEND_DELAY 2000
|
|
|
|
|
2017-12-06 19:04:02 +08:00
|
|
|
#define SKL_MAX_ASTATE_CFG 3
|
|
|
|
|
2016-06-03 20:59:37 +08:00
|
|
|
#define AZX_PCIREG_PGCTL 0x44
|
|
|
|
#define AZX_PGCTL_LSRMD_MASK (1 << 4)
|
2018-03-13 11:32:25 +08:00
|
|
|
#define AZX_PGCTL_ADSPPGD BIT(2)
|
2015-12-18 17:42:03 +08:00
|
|
|
#define AZX_PCIREG_CGCTL 0x48
|
|
|
|
#define AZX_CGCTL_MISCBDCGE_MASK (1 << 6)
|
2018-03-13 11:32:25 +08:00
|
|
|
#define AZX_CGCTL_ADSPDCGE BIT(1)
|
2016-11-03 19:37:16 +08: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 19:25:14 +08: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 17:42:03 +08:00
|
|
|
|
2018-03-13 11:32:25 +08:00
|
|
|
#define AZX_REG_VS_EM2_L1SEN BIT(13)
|
|
|
|
|
2015-10-07 18:31:52 +08:00
|
|
|
struct skl_dsp_resource {
|
|
|
|
u32 max_mcps;
|
|
|
|
u32 max_mem;
|
|
|
|
u32 mcps;
|
|
|
|
u32 mem;
|
|
|
|
};
|
|
|
|
|
2017-06-30 11:36:05 +08:00
|
|
|
struct skl_debug;
|
|
|
|
|
2017-12-06 19:04:02 +08: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 17:50:08 +08:00
|
|
|
struct skl {
|
2018-08-23 04:25:02 +08:00
|
|
|
struct hda_bus hbus;
|
2015-07-09 17:50:08 +08:00
|
|
|
struct pci_dev *pci;
|
|
|
|
|
2017-05-04 16:39:10 +08:00
|
|
|
unsigned int init_done:1; /* delayed init status */
|
2015-07-09 17:50:08 +08:00
|
|
|
struct platform_device *dmic_dev;
|
2015-11-06 00:04:13 +08:00
|
|
|
struct platform_device *i2s_dev;
|
2017-11-22 20:09:46 +08:00
|
|
|
struct platform_device *clk_dev;
|
2018-01-29 10:41:43 +08:00
|
|
|
struct snd_soc_component *component;
|
2017-10-09 13:50:30 +08:00
|
|
|
struct snd_soc_dai_driver *dais;
|
2015-07-22 02:23:55 +08:00
|
|
|
|
2016-05-05 13:49:19 +08:00
|
|
|
struct nhlt_acpi_table *nhlt; /* nhlt ptr */
|
2015-07-22 02:23:56 +08:00
|
|
|
struct skl_sst *skl_sst; /* sst skl ctx */
|
2015-10-07 18:31:52 +08:00
|
|
|
|
|
|
|
struct skl_dsp_resource resource;
|
|
|
|
struct list_head ppl_list;
|
2017-03-25 01:40:34 +08:00
|
|
|
struct list_head bind_list;
|
2015-11-06 00:04:15 +08:00
|
|
|
|
|
|
|
const char *fw_name;
|
2016-02-19 14:12:34 +08:00
|
|
|
char tplg_name[64];
|
|
|
|
unsigned short pci_id;
|
2016-01-05 19:46:04 +08:00
|
|
|
const struct firmware *tplg;
|
2015-12-04 02:00:00 +08:00
|
|
|
|
|
|
|
int supend_active;
|
2017-05-04 16:39:10 +08:00
|
|
|
|
|
|
|
struct work_struct probe_work;
|
2017-06-30 11:36:05 +08:00
|
|
|
|
|
|
|
struct skl_debug *debugfs;
|
2017-08-23 22:03:51 +08:00
|
|
|
u8 nr_modules;
|
|
|
|
struct skl_module **modules;
|
2017-10-09 13:50:30 +08:00
|
|
|
bool use_tplg_pcm;
|
2017-12-06 19:04:02 +08:00
|
|
|
struct skl_fw_config cfg;
|
2017-12-18 13:16:50 +08:00
|
|
|
struct snd_soc_acpi_mach *mach;
|
2015-07-09 17:50:08 +08:00
|
|
|
};
|
|
|
|
|
2018-08-23 04:25:02 +08: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 17:50:08 +08:00
|
|
|
|
|
|
|
/* to pass dai dma data */
|
|
|
|
struct skl_dma_params {
|
|
|
|
u32 format;
|
|
|
|
u8 stream_tag;
|
|
|
|
};
|
|
|
|
|
2016-05-27 12:30:15 +08:00
|
|
|
struct skl_machine_pdata {
|
|
|
|
u32 dmic_num;
|
2017-10-09 13:50:30 +08:00
|
|
|
bool use_tplg_pcm; /* use dais and dai links from topology */
|
2018-08-23 04:24:59 +08:00
|
|
|
const char *platform;
|
|
|
|
u32 codec_mask;
|
2016-05-27 12:30:15 +08:00
|
|
|
};
|
|
|
|
|
2016-03-11 12:42:53 +08:00
|
|
|
struct skl_dsp_ops {
|
|
|
|
int id;
|
2017-08-03 00:21:12 +08:00
|
|
|
unsigned int num_cores;
|
2016-03-11 12:42:53 +08: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 20:36:42 +08:00
|
|
|
int (*init_fw)(struct device *dev, struct skl_sst *ctx);
|
2016-03-11 12:42:53 +08:00
|
|
|
void (*cleanup)(struct device *dev, struct skl_sst *ctx);
|
|
|
|
};
|
|
|
|
|
2015-07-09 17:50:08 +08:00
|
|
|
int skl_platform_unregister(struct device *dev);
|
|
|
|
int skl_platform_register(struct device *dev);
|
|
|
|
|
2016-05-05 13:49:19 +08:00
|
|
|
struct nhlt_acpi_table *skl_nhlt_init(struct device *dev);
|
|
|
|
void skl_nhlt_free(struct nhlt_acpi_table *addr);
|
2015-07-22 02:23:55 +08:00
|
|
|
struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
|
2017-02-09 19:14:01 +08:00
|
|
|
u8 link_type, u8 s_fmt, u8 no_ch,
|
|
|
|
u32 s_rate, u8 dirn, u8 dev_type);
|
2015-07-22 02:23:56 +08:00
|
|
|
|
2016-05-27 12:30:15 +08:00
|
|
|
int skl_get_dmic_geo(struct skl *skl);
|
2016-02-19 14:12:34 +08:00
|
|
|
int skl_nhlt_update_topology_bin(struct skl *skl);
|
2015-07-22 02:23:56 +08:00
|
|
|
int skl_init_dsp(struct skl *skl);
|
2016-03-11 12:42:53 +08:00
|
|
|
int skl_free_dsp(struct skl *skl);
|
2016-11-03 19:37:21 +08:00
|
|
|
int skl_suspend_late_dsp(struct skl *skl);
|
2015-07-22 02:23:56 +08:00
|
|
|
int skl_suspend_dsp(struct skl *skl);
|
|
|
|
int skl_resume_dsp(struct skl *skl);
|
2016-06-03 20:59:39 +08:00
|
|
|
void skl_cleanup_resources(struct skl *skl);
|
2016-07-26 20:36:41 +08:00
|
|
|
const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id);
|
2016-11-03 19:37:16 +08:00
|
|
|
void skl_update_d0i3c(struct device *dev, bool enable);
|
2017-01-11 19:01:02 +08:00
|
|
|
int skl_nhlt_create_sysfs(struct skl *skl);
|
|
|
|
void skl_nhlt_remove_sysfs(struct skl *skl);
|
2017-11-22 20:09:46 +08: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 19:25:14 +08:00
|
|
|
int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps,
|
|
|
|
u32 caps_size, u32 node_id);
|
2016-11-03 19:37:16 +08:00
|
|
|
|
2017-06-30 11:36:06 +08:00
|
|
|
struct skl_module_cfg;
|
|
|
|
|
2017-06-30 11:36:05 +08:00
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
struct skl_debug *skl_debugfs_init(struct skl *skl);
|
2017-06-30 11:36:06 +08:00
|
|
|
void skl_debug_init_module(struct skl_debug *d,
|
|
|
|
struct snd_soc_dapm_widget *w,
|
|
|
|
struct skl_module_cfg *mconfig);
|
2017-06-30 11:36:05 +08:00
|
|
|
#else
|
|
|
|
static inline struct skl_debug *skl_debugfs_init(struct skl *skl)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2017-06-30 11:36:06 +08: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 11:36:05 +08:00
|
|
|
#endif
|
|
|
|
|
2015-07-09 17:50:08 +08:00
|
|
|
#endif /* __SOUND_SOC_SKL_H */
|