18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * skl-tplg-interface.h - Intel DSP FW private data interface
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2015 Intel Corp
68c2ecf20Sopenharmony_ci * Author: Jeeja KP <jeeja.kp@intel.com>
78c2ecf20Sopenharmony_ci *	    Nilofer, Samreen <samreen.nilofer@intel.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef __HDA_TPLG_INTERFACE_H__
118c2ecf20Sopenharmony_ci#define __HDA_TPLG_INTERFACE_H__
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <linux/types.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/*
168c2ecf20Sopenharmony_ci * Default types range from 0~12. type can range from 0 to 0xff
178c2ecf20Sopenharmony_ci * SST types start at higher to avoid any overlapping in future
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_ci#define SKL_CONTROL_TYPE_BYTE_TLV	0x100
208c2ecf20Sopenharmony_ci#define SKL_CONTROL_TYPE_MIC_SELECT	0x102
218c2ecf20Sopenharmony_ci#define SKL_CONTROL_TYPE_MULTI_IO_SELECT	0x103
228c2ecf20Sopenharmony_ci#define SKL_CONTROL_TYPE_MULTI_IO_SELECT_DMIC	0x104
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define HDA_SST_CFG_MAX	900 /* size of copier cfg*/
258c2ecf20Sopenharmony_ci#define MAX_IN_QUEUE 8
268c2ecf20Sopenharmony_ci#define MAX_OUT_QUEUE 8
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define SKL_UUID_STR_SZ 40
298c2ecf20Sopenharmony_ci/* Event types goes here */
308c2ecf20Sopenharmony_ci/* Reserve event type 0 for no event handlers */
318c2ecf20Sopenharmony_cienum skl_event_types {
328c2ecf20Sopenharmony_ci	SKL_EVENT_NONE = 0,
338c2ecf20Sopenharmony_ci	SKL_MIXER_EVENT,
348c2ecf20Sopenharmony_ci	SKL_MUX_EVENT,
358c2ecf20Sopenharmony_ci	SKL_VMIXER_EVENT,
368c2ecf20Sopenharmony_ci	SKL_PGA_EVENT
378c2ecf20Sopenharmony_ci};
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/**
408c2ecf20Sopenharmony_ci * enum skl_ch_cfg - channel configuration
418c2ecf20Sopenharmony_ci *
428c2ecf20Sopenharmony_ci * @SKL_CH_CFG_MONO:	One channel only
438c2ecf20Sopenharmony_ci * @SKL_CH_CFG_STEREO:	L & R
448c2ecf20Sopenharmony_ci * @SKL_CH_CFG_2_1:	L, R & LFE
458c2ecf20Sopenharmony_ci * @SKL_CH_CFG_3_0:	L, C & R
468c2ecf20Sopenharmony_ci * @SKL_CH_CFG_3_1:	L, C, R & LFE
478c2ecf20Sopenharmony_ci * @SKL_CH_CFG_QUATRO:	L, R, Ls & Rs
488c2ecf20Sopenharmony_ci * @SKL_CH_CFG_4_0:	L, C, R & Cs
498c2ecf20Sopenharmony_ci * @SKL_CH_CFG_5_0:	L, C, R, Ls & Rs
508c2ecf20Sopenharmony_ci * @SKL_CH_CFG_5_1:	L, C, R, Ls, Rs & LFE
518c2ecf20Sopenharmony_ci * @SKL_CH_CFG_DUAL_MONO: One channel replicated in two
528c2ecf20Sopenharmony_ci * @SKL_CH_CFG_I2S_DUAL_STEREO_0: Stereo(L,R) in 4 slots, 1st stream:[ L, R, -, - ]
538c2ecf20Sopenharmony_ci * @SKL_CH_CFG_I2S_DUAL_STEREO_1: Stereo(L,R) in 4 slots, 2nd stream:[ -, -, L, R ]
548c2ecf20Sopenharmony_ci * @SKL_CH_CFG_INVALID:	Invalid
558c2ecf20Sopenharmony_ci */
568c2ecf20Sopenharmony_cienum skl_ch_cfg {
578c2ecf20Sopenharmony_ci	SKL_CH_CFG_MONO = 0,
588c2ecf20Sopenharmony_ci	SKL_CH_CFG_STEREO = 1,
598c2ecf20Sopenharmony_ci	SKL_CH_CFG_2_1 = 2,
608c2ecf20Sopenharmony_ci	SKL_CH_CFG_3_0 = 3,
618c2ecf20Sopenharmony_ci	SKL_CH_CFG_3_1 = 4,
628c2ecf20Sopenharmony_ci	SKL_CH_CFG_QUATRO = 5,
638c2ecf20Sopenharmony_ci	SKL_CH_CFG_4_0 = 6,
648c2ecf20Sopenharmony_ci	SKL_CH_CFG_5_0 = 7,
658c2ecf20Sopenharmony_ci	SKL_CH_CFG_5_1 = 8,
668c2ecf20Sopenharmony_ci	SKL_CH_CFG_DUAL_MONO = 9,
678c2ecf20Sopenharmony_ci	SKL_CH_CFG_I2S_DUAL_STEREO_0 = 10,
688c2ecf20Sopenharmony_ci	SKL_CH_CFG_I2S_DUAL_STEREO_1 = 11,
698c2ecf20Sopenharmony_ci	SKL_CH_CFG_7_1 = 12,
708c2ecf20Sopenharmony_ci	SKL_CH_CFG_4_CHANNEL = SKL_CH_CFG_7_1,
718c2ecf20Sopenharmony_ci	SKL_CH_CFG_INVALID
728c2ecf20Sopenharmony_ci};
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_cienum skl_module_type {
758c2ecf20Sopenharmony_ci	SKL_MODULE_TYPE_MIXER = 0,
768c2ecf20Sopenharmony_ci	SKL_MODULE_TYPE_COPIER,
778c2ecf20Sopenharmony_ci	SKL_MODULE_TYPE_UPDWMIX,
788c2ecf20Sopenharmony_ci	SKL_MODULE_TYPE_SRCINT,
798c2ecf20Sopenharmony_ci	SKL_MODULE_TYPE_ALGO,
808c2ecf20Sopenharmony_ci	SKL_MODULE_TYPE_BASE_OUTFMT,
818c2ecf20Sopenharmony_ci	SKL_MODULE_TYPE_KPB,
828c2ecf20Sopenharmony_ci	SKL_MODULE_TYPE_MIC_SELECT,
838c2ecf20Sopenharmony_ci};
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_cienum skl_core_affinity {
868c2ecf20Sopenharmony_ci	SKL_AFFINITY_CORE_0 = 0,
878c2ecf20Sopenharmony_ci	SKL_AFFINITY_CORE_1,
888c2ecf20Sopenharmony_ci	SKL_AFFINITY_CORE_MAX
898c2ecf20Sopenharmony_ci};
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_cienum skl_pipe_conn_type {
928c2ecf20Sopenharmony_ci	SKL_PIPE_CONN_TYPE_NONE = 0,
938c2ecf20Sopenharmony_ci	SKL_PIPE_CONN_TYPE_FE,
948c2ecf20Sopenharmony_ci	SKL_PIPE_CONN_TYPE_BE
958c2ecf20Sopenharmony_ci};
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_cienum skl_hw_conn_type {
988c2ecf20Sopenharmony_ci	SKL_CONN_NONE = 0,
998c2ecf20Sopenharmony_ci	SKL_CONN_SOURCE = 1,
1008c2ecf20Sopenharmony_ci	SKL_CONN_SINK = 2
1018c2ecf20Sopenharmony_ci};
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_cienum skl_dev_type {
1048c2ecf20Sopenharmony_ci	SKL_DEVICE_BT = 0x0,
1058c2ecf20Sopenharmony_ci	SKL_DEVICE_DMIC = 0x1,
1068c2ecf20Sopenharmony_ci	SKL_DEVICE_I2S = 0x2,
1078c2ecf20Sopenharmony_ci	SKL_DEVICE_SLIMBUS = 0x3,
1088c2ecf20Sopenharmony_ci	SKL_DEVICE_HDALINK = 0x4,
1098c2ecf20Sopenharmony_ci	SKL_DEVICE_HDAHOST = 0x5,
1108c2ecf20Sopenharmony_ci	SKL_DEVICE_NONE
1118c2ecf20Sopenharmony_ci};
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci/**
1148c2ecf20Sopenharmony_ci * enum skl_interleaving - interleaving style
1158c2ecf20Sopenharmony_ci *
1168c2ecf20Sopenharmony_ci * @SKL_INTERLEAVING_PER_CHANNEL: [s1_ch1...s1_chN,...,sM_ch1...sM_chN]
1178c2ecf20Sopenharmony_ci * @SKL_INTERLEAVING_PER_SAMPLE: [s1_ch1...sM_ch1,...,s1_chN...sM_chN]
1188c2ecf20Sopenharmony_ci */
1198c2ecf20Sopenharmony_cienum skl_interleaving {
1208c2ecf20Sopenharmony_ci	SKL_INTERLEAVING_PER_CHANNEL = 0,
1218c2ecf20Sopenharmony_ci	SKL_INTERLEAVING_PER_SAMPLE = 1,
1228c2ecf20Sopenharmony_ci};
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_cienum skl_sample_type {
1258c2ecf20Sopenharmony_ci	SKL_SAMPLE_TYPE_INT_MSB = 0,
1268c2ecf20Sopenharmony_ci	SKL_SAMPLE_TYPE_INT_LSB = 1,
1278c2ecf20Sopenharmony_ci	SKL_SAMPLE_TYPE_INT_SIGNED = 2,
1288c2ecf20Sopenharmony_ci	SKL_SAMPLE_TYPE_INT_UNSIGNED = 3,
1298c2ecf20Sopenharmony_ci	SKL_SAMPLE_TYPE_FLOAT = 4
1308c2ecf20Sopenharmony_ci};
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_cienum module_pin_type {
1338c2ecf20Sopenharmony_ci	/* All pins of the module takes same PCM inputs or outputs
1348c2ecf20Sopenharmony_ci	* e.g. mixout
1358c2ecf20Sopenharmony_ci	*/
1368c2ecf20Sopenharmony_ci	SKL_PIN_TYPE_HOMOGENEOUS,
1378c2ecf20Sopenharmony_ci	/* All pins of the module takes different PCM inputs or outputs
1388c2ecf20Sopenharmony_ci	* e.g mux
1398c2ecf20Sopenharmony_ci	*/
1408c2ecf20Sopenharmony_ci	SKL_PIN_TYPE_HETEROGENEOUS,
1418c2ecf20Sopenharmony_ci};
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_cienum skl_module_param_type {
1448c2ecf20Sopenharmony_ci	SKL_PARAM_DEFAULT = 0,
1458c2ecf20Sopenharmony_ci	SKL_PARAM_INIT,
1468c2ecf20Sopenharmony_ci	SKL_PARAM_SET,
1478c2ecf20Sopenharmony_ci	SKL_PARAM_BIND
1488c2ecf20Sopenharmony_ci};
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_cistruct skl_dfw_algo_data {
1518c2ecf20Sopenharmony_ci	__u32 set_params:2;
1528c2ecf20Sopenharmony_ci	__u32 rsvd:30;
1538c2ecf20Sopenharmony_ci	__u32 param_id;
1548c2ecf20Sopenharmony_ci	__u32 max;
1558c2ecf20Sopenharmony_ci	char params[0];
1568c2ecf20Sopenharmony_ci} __packed;
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_cienum skl_tkn_dir {
1598c2ecf20Sopenharmony_ci	SKL_DIR_IN,
1608c2ecf20Sopenharmony_ci	SKL_DIR_OUT
1618c2ecf20Sopenharmony_ci};
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_cienum skl_tuple_type {
1648c2ecf20Sopenharmony_ci	SKL_TYPE_TUPLE,
1658c2ecf20Sopenharmony_ci	SKL_TYPE_DATA
1668c2ecf20Sopenharmony_ci};
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci/* v4 configuration data */
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_cistruct skl_dfw_v4_module_pin {
1718c2ecf20Sopenharmony_ci	__u16 module_id;
1728c2ecf20Sopenharmony_ci	__u16 instance_id;
1738c2ecf20Sopenharmony_ci} __packed;
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_cistruct skl_dfw_v4_module_fmt {
1768c2ecf20Sopenharmony_ci	__u32 channels;
1778c2ecf20Sopenharmony_ci	__u32 freq;
1788c2ecf20Sopenharmony_ci	__u32 bit_depth;
1798c2ecf20Sopenharmony_ci	__u32 valid_bit_depth;
1808c2ecf20Sopenharmony_ci	__u32 ch_cfg;
1818c2ecf20Sopenharmony_ci	__u32 interleaving_style;
1828c2ecf20Sopenharmony_ci	__u32 sample_type;
1838c2ecf20Sopenharmony_ci	__u32 ch_map;
1848c2ecf20Sopenharmony_ci} __packed;
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_cistruct skl_dfw_v4_module_caps {
1878c2ecf20Sopenharmony_ci	__u32 set_params:2;
1888c2ecf20Sopenharmony_ci	__u32 rsvd:30;
1898c2ecf20Sopenharmony_ci	__u32 param_id;
1908c2ecf20Sopenharmony_ci	__u32 caps_size;
1918c2ecf20Sopenharmony_ci	__u32 caps[HDA_SST_CFG_MAX];
1928c2ecf20Sopenharmony_ci} __packed;
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_cistruct skl_dfw_v4_pipe {
1958c2ecf20Sopenharmony_ci	__u8 pipe_id;
1968c2ecf20Sopenharmony_ci	__u8 pipe_priority;
1978c2ecf20Sopenharmony_ci	__u16 conn_type:4;
1988c2ecf20Sopenharmony_ci	__u16 rsvd:4;
1998c2ecf20Sopenharmony_ci	__u16 memory_pages:8;
2008c2ecf20Sopenharmony_ci} __packed;
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_cistruct skl_dfw_v4_module {
2038c2ecf20Sopenharmony_ci	char uuid[SKL_UUID_STR_SZ];
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci	__u16 module_id;
2068c2ecf20Sopenharmony_ci	__u16 instance_id;
2078c2ecf20Sopenharmony_ci	__u32 max_mcps;
2088c2ecf20Sopenharmony_ci	__u32 mem_pages;
2098c2ecf20Sopenharmony_ci	__u32 obs;
2108c2ecf20Sopenharmony_ci	__u32 ibs;
2118c2ecf20Sopenharmony_ci	__u32 vbus_id;
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci	__u32 max_in_queue:8;
2148c2ecf20Sopenharmony_ci	__u32 max_out_queue:8;
2158c2ecf20Sopenharmony_ci	__u32 time_slot:8;
2168c2ecf20Sopenharmony_ci	__u32 core_id:4;
2178c2ecf20Sopenharmony_ci	__u32 rsvd1:4;
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci	__u32 module_type:8;
2208c2ecf20Sopenharmony_ci	__u32 conn_type:4;
2218c2ecf20Sopenharmony_ci	__u32 dev_type:4;
2228c2ecf20Sopenharmony_ci	__u32 hw_conn_type:4;
2238c2ecf20Sopenharmony_ci	__u32 rsvd2:12;
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci	__u32 params_fixup:8;
2268c2ecf20Sopenharmony_ci	__u32 converter:8;
2278c2ecf20Sopenharmony_ci	__u32 input_pin_type:1;
2288c2ecf20Sopenharmony_ci	__u32 output_pin_type:1;
2298c2ecf20Sopenharmony_ci	__u32 is_dynamic_in_pin:1;
2308c2ecf20Sopenharmony_ci	__u32 is_dynamic_out_pin:1;
2318c2ecf20Sopenharmony_ci	__u32 is_loadable:1;
2328c2ecf20Sopenharmony_ci	__u32 rsvd3:11;
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci	struct skl_dfw_v4_pipe pipe;
2358c2ecf20Sopenharmony_ci	struct skl_dfw_v4_module_fmt in_fmt[MAX_IN_QUEUE];
2368c2ecf20Sopenharmony_ci	struct skl_dfw_v4_module_fmt out_fmt[MAX_OUT_QUEUE];
2378c2ecf20Sopenharmony_ci	struct skl_dfw_v4_module_pin in_pin[MAX_IN_QUEUE];
2388c2ecf20Sopenharmony_ci	struct skl_dfw_v4_module_pin out_pin[MAX_OUT_QUEUE];
2398c2ecf20Sopenharmony_ci	struct skl_dfw_v4_module_caps caps;
2408c2ecf20Sopenharmony_ci} __packed;
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci#endif
243