skl.h 3.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 *  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>
26
#include <sound/soc.h>
27
#include "skl-nhlt.h"
28 29 30

#define SKL_SUSPEND_DELAY 2000

31 32
#define AZX_PCIREG_PGCTL		0x44
#define AZX_PGCTL_LSRMD_MASK		(1 << 4)
33 34
#define AZX_PCIREG_CGCTL		0x48
#define AZX_CGCTL_MISCBDCGE_MASK	(1 << 6)
35 36 37
/* D0I3C Register fields */
#define AZX_REG_VS_D0I3C_CIP      0x1 /* Command in progress */
#define AZX_REG_VS_D0I3C_I3       0x4 /* D0i3 enable */
38

39 40 41 42 43 44 45
struct skl_dsp_resource {
	u32 max_mcps;
	u32 max_mem;
	u32 mcps;
	u32 mem;
};

46 47
struct skl_debug;

48 49 50 51
struct skl {
	struct hdac_ext_bus ebus;
	struct pci_dev *pci;

52
	unsigned int init_done:1; /* delayed init status */
53
	struct platform_device *dmic_dev;
54
	struct platform_device *i2s_dev;
55
	struct snd_soc_platform *platform;
56

57
	struct nhlt_acpi_table *nhlt; /* nhlt ptr */
58
	struct skl_sst *skl_sst; /* sst skl ctx */
59 60 61

	struct skl_dsp_resource resource;
	struct list_head ppl_list;
62
	struct list_head bind_list;
63 64

	const char *fw_name;
65 66
	char tplg_name[64];
	unsigned short pci_id;
67
	const struct firmware *tplg;
68 69

	int supend_active;
70 71

	struct work_struct probe_work;
72 73

	struct skl_debug *debugfs;
74 75 76 77 78 79 80 81 82 83 84 85
};

#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;
};

86 87 88 89 90
/* to pass dmic data */
struct skl_machine_pdata {
	u32 dmic_num;
};

91 92 93 94 95 96 97
struct skl_dsp_ops {
	int id;
	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);
98
	int (*init_fw)(struct device *dev, struct skl_sst *ctx);
99 100 101
	void (*cleanup)(struct device *dev, struct skl_sst *ctx);
};

102 103 104
int skl_platform_unregister(struct device *dev);
int skl_platform_register(struct device *dev);

105 106
struct nhlt_acpi_table *skl_nhlt_init(struct device *dev);
void skl_nhlt_free(struct nhlt_acpi_table *addr);
107
struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
108 109
					u8 link_type, u8 s_fmt, u8 no_ch,
					u32 s_rate, u8 dirn, u8 dev_type);
110

111
int skl_get_dmic_geo(struct skl *skl);
112
int skl_nhlt_update_topology_bin(struct skl *skl);
113
int skl_init_dsp(struct skl *skl);
114
int skl_free_dsp(struct skl *skl);
115
int skl_suspend_late_dsp(struct skl *skl);
116 117
int skl_suspend_dsp(struct skl *skl);
int skl_resume_dsp(struct skl *skl);
118
void skl_cleanup_resources(struct skl *skl);
119
const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id);
120
void skl_update_d0i3c(struct device *dev, bool enable);
121 122
int skl_nhlt_create_sysfs(struct skl *skl);
void skl_nhlt_remove_sysfs(struct skl *skl);
123

124 125
struct skl_module_cfg;

126 127 128
#ifdef CONFIG_DEBUG_FS
struct skl_debug *skl_debugfs_init(struct skl *skl);
void skl_debugfs_exit(struct skl_debug *d);
129 130 131
void skl_debug_init_module(struct skl_debug *d,
			struct snd_soc_dapm_widget *w,
			struct skl_module_cfg *mconfig);
132 133 134 135 136 137 138
#else
static inline struct skl_debug *skl_debugfs_init(struct skl *skl)
{
	return NULL;
}
static inline void skl_debugfs_exit(struct skl_debug *d)
{}
139 140 141 142
static inline void skl_debug_init_module(struct skl_debug *d,
					 struct snd_soc_dapm_widget *w,
					 struct skl_module_cfg *mconfig)
{}
143 144
#endif

145
#endif /* __SOUND_SOC_SKL_H */