root/sound/soc/intel/skylake/skl-sst-ipc.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /*
   3  * Intel SKL IPC Support
   4  *
   5  * Copyright (C) 2014-15, Intel Corporation.
   6  */
   7 
   8 #ifndef __SKL_IPC_H
   9 #define __SKL_IPC_H
  10 
  11 #include <linux/irqreturn.h>
  12 #include "../common/sst-ipc.h"
  13 #include "skl-sst-dsp.h"
  14 
  15 struct sst_dsp;
  16 struct sst_generic_ipc;
  17 
  18 enum skl_ipc_pipeline_state {
  19         PPL_INVALID_STATE =     0,
  20         PPL_UNINITIALIZED =     1,
  21         PPL_RESET =             2,
  22         PPL_PAUSED =            3,
  23         PPL_RUNNING =           4,
  24         PPL_ERROR_STOP =        5,
  25         PPL_SAVED =             6,
  26         PPL_RESTORED =          7
  27 };
  28 
  29 struct skl_ipc_dxstate_info {
  30         u32 core_mask;
  31         u32 dx_mask;
  32 };
  33 
  34 struct skl_ipc_header {
  35         u32 primary;
  36         u32 extension;
  37 };
  38 
  39 struct skl_dsp_cores {
  40         unsigned int count;
  41         enum skl_dsp_states *state;
  42         int *usage_count;
  43 };
  44 
  45 /**
  46  * skl_d0i3_data: skl D0i3 counters data struct
  47  *
  48  * @streaming: Count of usecases that can attempt streaming D0i3
  49  * @non_streaming: Count of usecases that can attempt non-streaming D0i3
  50  * @non_d0i3: Count of usecases that cannot attempt D0i3
  51  * @state: current state
  52  * @work: D0i3 worker thread
  53  */
  54 struct skl_d0i3_data {
  55         int streaming;
  56         int non_streaming;
  57         int non_d0i3;
  58         enum skl_dsp_d0i3_states state;
  59         struct delayed_work work;
  60 };
  61 
  62 #define SKL_LIB_NAME_LENGTH 128
  63 #define SKL_MAX_LIB 16
  64 
  65 struct skl_lib_info {
  66         char name[SKL_LIB_NAME_LENGTH];
  67         const struct firmware *fw;
  68 };
  69 
  70 struct skl_ipc_init_instance_msg {
  71         u32 module_id;
  72         u32 instance_id;
  73         u16 param_data_size;
  74         u8 ppl_instance_id;
  75         u8 core_id;
  76         u8 domain;
  77 };
  78 
  79 struct skl_ipc_bind_unbind_msg {
  80         u32 module_id;
  81         u32 instance_id;
  82         u32 dst_module_id;
  83         u32 dst_instance_id;
  84         u8 src_queue;
  85         u8 dst_queue;
  86         bool bind;
  87 };
  88 
  89 struct skl_ipc_large_config_msg {
  90         u32 module_id;
  91         u32 instance_id;
  92         u32 large_param_id;
  93         u32 param_data_size;
  94 };
  95 
  96 struct skl_ipc_d0ix_msg {
  97         u32 module_id;
  98         u32 instance_id;
  99         u8 streaming;
 100         u8 wake;
 101 };
 102 
 103 #define SKL_IPC_BOOT_MSECS              3000
 104 
 105 #define SKL_IPC_D3_MASK 0
 106 #define SKL_IPC_D0_MASK 3
 107 
 108 irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context);
 109 
 110 int skl_ipc_create_pipeline(struct sst_generic_ipc *sst_ipc,
 111                 u16 ppl_mem_size, u8 ppl_type, u8 instance_id, u8 lp_mode);
 112 
 113 int skl_ipc_delete_pipeline(struct sst_generic_ipc *sst_ipc, u8 instance_id);
 114 
 115 int skl_ipc_set_pipeline_state(struct sst_generic_ipc *sst_ipc,
 116                 u8 instance_id, enum skl_ipc_pipeline_state state);
 117 
 118 int skl_ipc_save_pipeline(struct sst_generic_ipc *ipc,
 119                 u8 instance_id, int dma_id);
 120 
 121 int skl_ipc_restore_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
 122 
 123 int skl_ipc_init_instance(struct sst_generic_ipc *sst_ipc,
 124                 struct skl_ipc_init_instance_msg *msg, void *param_data);
 125 
 126 int skl_ipc_bind_unbind(struct sst_generic_ipc *sst_ipc,
 127                 struct skl_ipc_bind_unbind_msg *msg);
 128 
 129 int skl_ipc_load_modules(struct sst_generic_ipc *ipc,
 130                                 u8 module_cnt, void *data);
 131 
 132 int skl_ipc_unload_modules(struct sst_generic_ipc *ipc,
 133                                 u8 module_cnt, void *data);
 134 
 135 int skl_ipc_set_dx(struct sst_generic_ipc *ipc,
 136                 u8 instance_id, u16 module_id, struct skl_ipc_dxstate_info *dx);
 137 
 138 int skl_ipc_set_large_config(struct sst_generic_ipc *ipc,
 139                 struct skl_ipc_large_config_msg *msg, u32 *param);
 140 
 141 int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
 142                 struct skl_ipc_large_config_msg *msg,
 143                 u32 **payload, size_t *bytes);
 144 
 145 int skl_sst_ipc_load_library(struct sst_generic_ipc *ipc,
 146                         u8 dma_id, u8 table_id, bool wait);
 147 
 148 int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc,
 149                 struct skl_ipc_d0ix_msg *msg);
 150 
 151 int skl_ipc_check_D0i0(struct sst_dsp *dsp, bool state);
 152 
 153 void skl_ipc_int_enable(struct sst_dsp *dsp);
 154 void skl_ipc_op_int_enable(struct sst_dsp *ctx);
 155 void skl_ipc_op_int_disable(struct sst_dsp *ctx);
 156 void skl_ipc_int_disable(struct sst_dsp *dsp);
 157 
 158 bool skl_ipc_int_status(struct sst_dsp *dsp);
 159 void skl_ipc_free(struct sst_generic_ipc *ipc);
 160 int skl_ipc_init(struct device *dev, struct skl_dev *skl);
 161 void skl_clear_module_cnt(struct sst_dsp *ctx);
 162 
 163 void skl_ipc_process_reply(struct sst_generic_ipc *ipc,
 164                 struct skl_ipc_header header);
 165 int skl_ipc_process_notification(struct sst_generic_ipc *ipc,
 166                 struct skl_ipc_header header);
 167 void skl_ipc_tx_data_copy(struct ipc_message *msg, char *tx_data,
 168                 size_t tx_size);
 169 #endif /* __SKL_IPC_H */

/* [<][>][^][v][top][bottom][index][help] */