Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Intel SKL IPC Support
0004  *
0005  * Copyright (C) 2014-15, Intel Corporation.
0006  */
0007 
0008 #ifndef __SKL_IPC_H
0009 #define __SKL_IPC_H
0010 
0011 #include <linux/irqreturn.h>
0012 #include "../common/sst-ipc.h"
0013 #include "skl-sst-dsp.h"
0014 
0015 struct sst_dsp;
0016 struct sst_generic_ipc;
0017 
0018 enum skl_ipc_pipeline_state {
0019     PPL_INVALID_STATE = 0,
0020     PPL_UNINITIALIZED = 1,
0021     PPL_RESET =     2,
0022     PPL_PAUSED =        3,
0023     PPL_RUNNING =       4,
0024     PPL_ERROR_STOP =    5,
0025     PPL_SAVED =     6,
0026     PPL_RESTORED =      7
0027 };
0028 
0029 struct skl_ipc_dxstate_info {
0030     u32 core_mask;
0031     u32 dx_mask;
0032 };
0033 
0034 struct skl_ipc_header {
0035     u32 primary;
0036     u32 extension;
0037 };
0038 
0039 struct skl_dsp_cores {
0040     unsigned int count;
0041     enum skl_dsp_states *state;
0042     int *usage_count;
0043 };
0044 
0045 /**
0046  * skl_d0i3_data: skl D0i3 counters data struct
0047  *
0048  * @streaming: Count of usecases that can attempt streaming D0i3
0049  * @non_streaming: Count of usecases that can attempt non-streaming D0i3
0050  * @non_d0i3: Count of usecases that cannot attempt D0i3
0051  * @state: current state
0052  * @work: D0i3 worker thread
0053  */
0054 struct skl_d0i3_data {
0055     int streaming;
0056     int non_streaming;
0057     int non_d0i3;
0058     enum skl_dsp_d0i3_states state;
0059     struct delayed_work work;
0060 };
0061 
0062 #define SKL_LIB_NAME_LENGTH 128
0063 #define SKL_MAX_LIB 16
0064 
0065 struct skl_lib_info {
0066     char name[SKL_LIB_NAME_LENGTH];
0067     const struct firmware *fw;
0068 };
0069 
0070 struct skl_ipc_init_instance_msg {
0071     u32 module_id;
0072     u32 instance_id;
0073     u16 param_data_size;
0074     u8 ppl_instance_id;
0075     u8 core_id;
0076     u8 domain;
0077 };
0078 
0079 struct skl_ipc_bind_unbind_msg {
0080     u32 module_id;
0081     u32 instance_id;
0082     u32 dst_module_id;
0083     u32 dst_instance_id;
0084     u8 src_queue;
0085     u8 dst_queue;
0086     bool bind;
0087 };
0088 
0089 struct skl_ipc_large_config_msg {
0090     u32 module_id;
0091     u32 instance_id;
0092     u32 large_param_id;
0093     u32 param_data_size;
0094 };
0095 
0096 struct skl_ipc_d0ix_msg {
0097     u32 module_id;
0098     u32 instance_id;
0099     u8 streaming;
0100     u8 wake;
0101 };
0102 
0103 #define SKL_IPC_BOOT_MSECS      3000
0104 
0105 #define SKL_IPC_D3_MASK 0
0106 #define SKL_IPC_D0_MASK 3
0107 
0108 irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context);
0109 
0110 int skl_ipc_create_pipeline(struct sst_generic_ipc *ipc,
0111         u16 ppl_mem_size, u8 ppl_type, u8 instance_id, u8 lp_mode);
0112 
0113 int skl_ipc_delete_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
0114 
0115 int skl_ipc_set_pipeline_state(struct sst_generic_ipc *ipc,
0116         u8 instance_id, enum skl_ipc_pipeline_state state);
0117 
0118 int skl_ipc_save_pipeline(struct sst_generic_ipc *ipc,
0119         u8 instance_id, int dma_id);
0120 
0121 int skl_ipc_restore_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
0122 
0123 int skl_ipc_init_instance(struct sst_generic_ipc *ipc,
0124         struct skl_ipc_init_instance_msg *msg, void *param_data);
0125 
0126 int skl_ipc_bind_unbind(struct sst_generic_ipc *ipc,
0127         struct skl_ipc_bind_unbind_msg *msg);
0128 
0129 int skl_ipc_load_modules(struct sst_generic_ipc *ipc,
0130                 u8 module_cnt, void *data);
0131 
0132 int skl_ipc_unload_modules(struct sst_generic_ipc *ipc,
0133                 u8 module_cnt, void *data);
0134 
0135 int skl_ipc_set_dx(struct sst_generic_ipc *ipc,
0136         u8 instance_id, u16 module_id, struct skl_ipc_dxstate_info *dx);
0137 
0138 int skl_ipc_set_large_config(struct sst_generic_ipc *ipc,
0139         struct skl_ipc_large_config_msg *msg, u32 *param);
0140 
0141 int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
0142         struct skl_ipc_large_config_msg *msg,
0143         u32 **payload, size_t *bytes);
0144 
0145 int skl_sst_ipc_load_library(struct sst_generic_ipc *ipc,
0146             u8 dma_id, u8 table_id, bool wait);
0147 
0148 int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc,
0149         struct skl_ipc_d0ix_msg *msg);
0150 
0151 int skl_ipc_check_D0i0(struct sst_dsp *dsp, bool state);
0152 
0153 void skl_ipc_int_enable(struct sst_dsp *ctx);
0154 void skl_ipc_op_int_enable(struct sst_dsp *ctx);
0155 void skl_ipc_op_int_disable(struct sst_dsp *ctx);
0156 void skl_ipc_int_disable(struct sst_dsp *ctx);
0157 
0158 bool skl_ipc_int_status(struct sst_dsp *ctx);
0159 void skl_ipc_free(struct sst_generic_ipc *ipc);
0160 int skl_ipc_init(struct device *dev, struct skl_dev *skl);
0161 void skl_clear_module_cnt(struct sst_dsp *ctx);
0162 
0163 void skl_ipc_process_reply(struct sst_generic_ipc *ipc,
0164         struct skl_ipc_header header);
0165 int skl_ipc_process_notification(struct sst_generic_ipc *ipc,
0166         struct skl_ipc_header header);
0167 void skl_ipc_tx_data_copy(struct ipc_message *msg, char *tx_data,
0168         size_t tx_size);
0169 #endif /* __SKL_IPC_H */