ASoC: Intel: Skylake: Add IPC to configure the copier secondary pins
[sfrench/cifs-2.6.git] / sound / soc / intel / skylake / skl-topology.h
index cc64d6bdb4f6c4859621619daa3a9077a96a8dc7..2717db92036b4cc58ac7148904b41d00d16d4805 100644 (file)
 #define MODULE_MAX_IN_PINS     8
 #define MODULE_MAX_OUT_PINS    8
 
+#define SKL_MIC_CH_SUPPORT     4
+#define SKL_MIC_MAX_CH_SUPPORT 8
+#define SKL_DEFAULT_MIC_SEL_GAIN       0x3FF
+#define SKL_MIC_SEL_SWITCH     0x3
+
+#define SKL_OUTPUT_PIN         0
+#define SKL_INPUT_PIN          1
+#define SKL_MAX_PATH_CONFIGS   8
+#define SKL_MAX_MODULES_IN_PIPE        8
+#define SKL_MAX_MODULE_FORMATS         32
+#define SKL_MAX_MODULE_RESOURCES       32
+
 enum skl_channel_index {
        SKL_CHANNEL_LEFT = 0,
        SKL_CHANNEL_RIGHT = 1,
@@ -126,6 +138,11 @@ struct skl_cpr_cfg {
        struct skl_cpr_gtw_cfg gtw_cfg;
 } __packed;
 
+struct skl_cpr_pin_fmt {
+       u32 sink_id;
+       struct skl_audio_data_format src_fmt;
+       struct skl_audio_data_format dst_fmt;
+} __packed;
 
 struct skl_src_module_cfg {
        struct skl_base_cfg base_cfg;
@@ -209,6 +226,7 @@ struct skl_kpb_params {
 };
 
 struct skl_module_inst_id {
+       uuid_le mod_uuid;
        int module_id;
        u32 instance_id;
        int pvt_id;
@@ -261,6 +279,23 @@ struct skl_pipe_params {
        unsigned int link_bps;
 };
 
+struct skl_pipe_fmt {
+       u32 freq;
+       u8 channels;
+       u8 bps;
+};
+
+struct skl_pipe_mcfg {
+       u8 res_idx;
+       u8 fmt_idx;
+};
+
+struct skl_path_config {
+       u8 mem_pages;
+       struct skl_pipe_fmt in_fmt;
+       struct skl_pipe_fmt out_fmt;
+};
+
 struct skl_pipe {
        u8 ppl_id;
        u8 pipe_priority;
@@ -269,6 +304,10 @@ struct skl_pipe {
        u8 lp_mode;
        struct skl_pipe_params *p_params;
        enum skl_pipe_state state;
+       u8 direction;
+       u8 cur_config_idx;
+       u8 nr_cfgs;
+       struct skl_path_config configs[SKL_MAX_PATH_CONFIGS];
        struct list_head w_list;
        bool passthru;
 };
@@ -287,9 +326,57 @@ enum d0i3_capability {
        SKL_D0I3_NON_STREAMING = 2,
 };
 
+struct skl_module_pin_fmt {
+       u8 id;
+       struct skl_module_fmt fmt;
+};
+
+struct skl_module_iface {
+       u8 fmt_idx;
+       u8 nr_in_fmt;
+       u8 nr_out_fmt;
+       struct skl_module_pin_fmt inputs[MAX_IN_QUEUE];
+       struct skl_module_pin_fmt outputs[MAX_OUT_QUEUE];
+};
+
+struct skl_module_pin_resources {
+       u8 pin_index;
+       u32 buf_size;
+};
+
+struct skl_module_res {
+       u8 id;
+       u32 is_pages;
+       u32 cps;
+       u32 ibs;
+       u32 obs;
+       u32 dma_buffer_size;
+       u32 cpc;
+       u8 nr_input_pins;
+       u8 nr_output_pins;
+       struct skl_module_pin_resources input[MAX_IN_QUEUE];
+       struct skl_module_pin_resources output[MAX_OUT_QUEUE];
+};
+
+struct skl_module {
+       uuid_le uuid;
+       u8 loadable;
+       u8 input_pin_type;
+       u8 output_pin_type;
+       u8 max_input_pins;
+       u8 max_output_pins;
+       u8 nr_resources;
+       u8 nr_interfaces;
+       struct skl_module_res resources[SKL_MAX_MODULE_RESOURCES];
+       struct skl_module_iface formats[SKL_MAX_MODULE_FORMATS];
+};
+
 struct skl_module_cfg {
        u8 guid[16];
        struct skl_module_inst_id id;
+       struct skl_module *module;
+       int res_idx;
+       int fmt_idx;
        u8 domain;
        bool homogenous_inputs;
        bool homogenous_outputs;
@@ -309,11 +396,14 @@ struct skl_module_cfg {
        u8 dev_type;
        u8 dma_id;
        u8 time_slot;
+       u8 dmic_ch_combo_index;
+       u32 dmic_ch_type;
        u32 params_fixup;
        u32 converter;
        u32 vbus_id;
        u32 mem_pages;
        enum d0i3_capability d0i3_caps;
+       u32 dma_buffer_size; /* in milli seconds */
        struct skl_module_pin *m_in_pin;
        struct skl_module_pin *m_out_pin;
        enum skl_module_type m_type;
@@ -321,6 +411,7 @@ struct skl_module_cfg {
        enum skl_module_state m_state;
        struct skl_pipe *pipe;
        struct skl_specific_cfg formats_config;
+       struct skl_pipe_mcfg mod_cfg[SKL_MAX_MODULES_IN_PIPE];
 };
 
 struct skl_algo_data {
@@ -342,6 +433,19 @@ struct skl_module_deferred_bind {
        struct list_head node;
 };
 
+struct skl_mic_sel_config {
+       u16 mic_switch;
+       u16 flags;
+       u16 blob[SKL_MIC_MAX_CH_SUPPORT][SKL_MIC_MAX_CH_SUPPORT];
+} __packed;
+
+enum skl_channel {
+       SKL_CH_MONO = 1,
+       SKL_CH_STEREO = 2,
+       SKL_CH_TRIO = 3,
+       SKL_CH_QUATRO = 4,
+};
+
 static inline struct skl *get_skl_ctx(struct device *dev)
 {
        struct hdac_ext_bus *ebus = dev_get_drvdata(dev);