2015-07-09 15:20:08 +05:30
/*
* 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>
2017-06-30 09:06:06 +05:30
# include <sound/soc.h>
2015-07-21 23:53:55 +05:30
# include "skl-nhlt.h"
2017-11-22 17:39:46 +05:30
# include "skl-ssp-clk.h"
2015-07-09 15:20:08 +05:30
# define SKL_SUSPEND_DELAY 2000
2017-12-06 16:34:02 +05:30
# define SKL_MAX_ASTATE_CFG 3
2016-06-03 18:29:37 +05:30
# define AZX_PCIREG_PGCTL 0x44
# define AZX_PGCTL_LSRMD_MASK (1 << 4)
2018-03-13 09:02:25 +05:30
# define AZX_PGCTL_ADSPPGD BIT(2)
2015-12-18 15:12:03 +05:30
# define AZX_PCIREG_CGCTL 0x48
# define AZX_CGCTL_MISCBDCGE_MASK (1 << 6)
2018-03-13 09:02:25 +05:30
# define AZX_CGCTL_ADSPDCGE BIT(1)
2016-11-03 17:07:16 +05:30
/* 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 16:55:14 +05:30
# define SKL_MAX_DMACTRL_CFG 18
# define DMA_CLK_CONTROLS 1
# define DMA_TRANSMITION_START 2
# define DMA_TRANSMITION_STOP 3
2015-12-18 15:12:03 +05:30
2018-03-13 09:02:25 +05:30
# define AZX_REG_VS_EM2_L1SEN BIT(13)
2015-10-07 11:31:52 +01:00
struct skl_dsp_resource {
u32 max_mcps ;
u32 max_mem ;
u32 mcps ;
u32 mem ;
} ;
2017-06-30 09:06:05 +05:30
struct skl_debug ;
2017-12-06 16:34:02 +05:30
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 15:20:08 +05:30
struct skl {
struct hdac_ext_bus ebus ;
struct pci_dev * pci ;
2017-05-04 14:09:10 +05:30
unsigned int init_done : 1 ; /* delayed init status */
2015-07-09 15:20:08 +05:30
struct platform_device * dmic_dev ;
2015-11-05 21:34:13 +05:30
struct platform_device * i2s_dev ;
2017-11-22 17:39:46 +05:30
struct platform_device * clk_dev ;
2018-01-29 02:41:43 +00:00
struct snd_soc_component * component ;
2017-10-09 11:20:30 +05:30
struct snd_soc_dai_driver * dais ;
2015-07-21 23:53:55 +05:30
2016-05-05 11:19:19 +05:30
struct nhlt_acpi_table * nhlt ; /* nhlt ptr */
2015-07-21 23:53:56 +05:30
struct skl_sst * skl_sst ; /* sst skl ctx */
2015-10-07 11:31:52 +01:00
struct skl_dsp_resource resource ;
struct list_head ppl_list ;
2017-03-24 23:10:34 +05:30
struct list_head bind_list ;
2015-11-05 21:34:15 +05:30
const char * fw_name ;
2016-02-19 11:42:34 +05:30
char tplg_name [ 64 ] ;
unsigned short pci_id ;
2016-01-05 17:16:04 +05:30
const struct firmware * tplg ;
2015-12-03 23:30:00 +05:30
int supend_active ;
2017-05-04 14:09:10 +05:30
struct work_struct probe_work ;
2017-06-30 09:06:05 +05:30
struct skl_debug * debugfs ;
2017-08-23 19:33:51 +05:30
u8 nr_modules ;
struct skl_module * * modules ;
2017-10-09 11:20:30 +05:30
bool use_tplg_pcm ;
2017-12-06 16:34:02 +05:30
struct skl_fw_config cfg ;
2017-12-18 10:46:50 +05:30
struct snd_soc_acpi_mach * mach ;
2015-07-09 15:20:08 +05:30
} ;
# define skl_to_ebus(s) (&(s)->ebus)
# define ebus_to_skl(sbus) \
container_of ( sbus , struct skl , sbus )
/* to pass dai dma data */
struct skl_dma_params {
u32 format ;
u8 stream_tag ;
} ;
2016-05-26 21:30:15 -07:00
struct skl_machine_pdata {
u32 dmic_num ;
2017-10-09 11:20:30 +05:30
bool use_tplg_pcm ; /* use dais and dai links from topology */
2016-05-26 21:30:15 -07:00
} ;
2016-03-11 10:12:53 +05:30
struct skl_dsp_ops {
int id ;
2017-08-02 21:51:12 +05:30
unsigned int num_cores ;
2016-03-11 10:12:53 +05:30
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 18:06:42 +05:30
int ( * init_fw ) ( struct device * dev , struct skl_sst * ctx ) ;
2016-03-11 10:12:53 +05:30
void ( * cleanup ) ( struct device * dev , struct skl_sst * ctx ) ;
} ;
2015-07-09 15:20:08 +05:30
int skl_platform_unregister ( struct device * dev ) ;
int skl_platform_register ( struct device * dev ) ;
2016-05-05 11:19:19 +05:30
struct nhlt_acpi_table * skl_nhlt_init ( struct device * dev ) ;
void skl_nhlt_free ( struct nhlt_acpi_table * addr ) ;
2015-07-21 23:53:55 +05:30
struct nhlt_specific_cfg * skl_get_ep_blob ( struct skl * skl , u32 instance ,
2017-02-09 16:44:01 +05:30
u8 link_type , u8 s_fmt , u8 no_ch ,
u32 s_rate , u8 dirn , u8 dev_type ) ;
2015-07-21 23:53:56 +05:30
2016-05-26 21:30:15 -07:00
int skl_get_dmic_geo ( struct skl * skl ) ;
2016-02-19 11:42:34 +05:30
int skl_nhlt_update_topology_bin ( struct skl * skl ) ;
2015-07-21 23:53:56 +05:30
int skl_init_dsp ( struct skl * skl ) ;
2016-03-11 10:12:53 +05:30
int skl_free_dsp ( struct skl * skl ) ;
2016-11-03 17:07:21 +05:30
int skl_suspend_late_dsp ( struct skl * skl ) ;
2015-07-21 23:53:56 +05:30
int skl_suspend_dsp ( struct skl * skl ) ;
int skl_resume_dsp ( struct skl * skl ) ;
2016-06-03 18:29:39 +05:30
void skl_cleanup_resources ( struct skl * skl ) ;
2016-07-26 18:06:41 +05:30
const struct skl_dsp_ops * skl_get_dsp_ops ( int pci_id ) ;
2016-11-03 17:07:16 +05:30
void skl_update_d0i3c ( struct device * dev , bool enable ) ;
2017-01-11 16:31:02 +05:30
int skl_nhlt_create_sysfs ( struct skl * skl ) ;
void skl_nhlt_remove_sysfs ( struct skl * skl ) ;
2017-11-22 17:39:46 +05:30
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 16:55:14 +05:30
int skl_dsp_set_dma_control ( struct skl_sst * ctx , u32 * caps ,
u32 caps_size , u32 node_id ) ;
2016-11-03 17:07:16 +05:30
2017-06-30 09:06:06 +05:30
struct skl_module_cfg ;
2017-06-30 09:06:05 +05:30
# ifdef CONFIG_DEBUG_FS
struct skl_debug * skl_debugfs_init ( struct skl * skl ) ;
2017-06-30 09:06:06 +05:30
void skl_debug_init_module ( struct skl_debug * d ,
struct snd_soc_dapm_widget * w ,
struct skl_module_cfg * mconfig ) ;
2017-06-30 09:06:05 +05:30
# else
static inline struct skl_debug * skl_debugfs_init ( struct skl * skl )
{
return NULL ;
}
2017-06-30 09:06:06 +05:30
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 09:06:05 +05:30
# endif
2015-07-09 15:20:08 +05:30
# endif /* __SOUND_SOC_SKL_H */